/* =====================================================================
   Leora Digital Amigos — Invoicing System
   Design tokens: brand red extracted from the company logo (#D30417),
   paired with cool paper/navy surfaces and a restrained glass treatment.
   Signature motif: the rotated "ledger stamp" status badge + the red
   rule under section headers, echoing the invoice's own divider bar.
   ===================================================================== */

:root {
  --lda-red: #D30417;
  --lda-red-dark: #8C0311;
  --lda-red-soft: #FCE7E9;
  --lda-ink: #12131C;
  --lda-slate: #5C6178;
  --lda-slate-soft: #9599AC;
  --lda-mist: #E7EAF6;
  --lda-paper: #F3F5FC;
  --lda-white: #FFFFFF;

  --glass-bg: rgba(255, 255, 255, 0.70);
  --glass-border: rgba(255, 255, 255, 0.55);
  --shadow-soft: 0 10px 30px rgba(23, 26, 51, 0.07);
  --shadow-lift: 0 16px 40px rgba(23, 26, 51, 0.12);

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --font-display: 'Plus Jakarta Sans', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--lda-ink);
  background:
    radial-gradient(1100px 500px at 90% -10%, #FBE9EA 0%, rgba(251,233,234,0) 60%),
    radial-gradient(900px 500px at -10% 10%, #EDF0FC 0%, rgba(237,240,252,0) 55%),
    var(--lda-paper);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .display-font {
  font-family: var(--font-display);
  color: var(--lda-ink);
  letter-spacing: -0.01em;
}

a { text-decoration: none; }

/* Tabular numerals everywhere money/quantities appear */
.tnum, td.num, th.num, .money {
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------
   Auth screen (login)
   --------------------------------------------------------------------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: 40px 36px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.auth-brand img { height: 44px; width: auto; }

.auth-brand .name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.15;
  color: var(--lda-ink);
}

.auth-brand .tag {
  font-size: 11.5px;
  color: var(--lda-slate);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------------
   App shell — sidebar + topbar + content
   --------------------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 258px;
  flex-shrink: 0;
  background: rgba(18, 19, 28, 0.97);
  color: #EDEEF6;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 1030;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 22px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 14px;
}

.sidebar-brand img { height: 34px; width: auto; border-radius: 6px; }

.sidebar-brand .name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14.5px;
  color: #fff;
  line-height: 1.2;
}

.sidebar-brand .tag {
  font-size: 10.5px;
  color: #9AA0B8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6A6F87;
  padding: 14px 12px 6px;
}

.sidebar .nav-link {
  color: #C7CAE0;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 2px;
  border-left: 3px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar .nav-link i { font-size: 16px; width: 18px; text-align: center; opacity: 0.9; }

.sidebar .nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.sidebar .nav-link.active {
  background: linear-gradient(90deg, rgba(211,4,23,0.28), rgba(211,4,23,0.05));
  color: #fff;
  border-left-color: var(--lda-red);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  font-size: 13px;
  color: #C7CAE0;
}

.sidebar-user .avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--lda-red);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12.5px;
  flex-shrink: 0;
}

.main-col {
  margin-left: 258px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,0.6);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.topbar h1 {
  font-size: 19px;
  font-weight: 700;
  margin: 0;
}

.btn-mobile-nav {
  display: none;
  border: none;
  background: var(--lda-white);
  box-shadow: var(--shadow-soft);
  width: 38px; height: 38px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: var(--lda-ink);
}

.content-area {
  padding: 26px 28px 60px;
  flex: 1;
}

/* ---------------------------------------------------------------------
   Cards / glass surfaces
   --------------------------------------------------------------------- */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 24px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}

.section-heading h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  padding-left: 12px;
  border-left: 3px solid var(--lda-red);
}

/* Stat cards */
.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 20px 22px;
  height: 100%;
}

.stat-card .label {
  font-size: 12.5px;
  color: var(--lda-slate);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

.stat-card .value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
}

.stat-card .sub { font-size: 12.5px; color: var(--lda-slate-soft); margin-top: 6px; }

.stat-icon {
  width: 40px; height: 40px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 12px;
}

/* ---------------------------------------------------------------------
   Status pill + the "ledger stamp" signature element
   --------------------------------------------------------------------- */
.status-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.ledger-stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid currentColor;
  border-radius: 10px;
  padding: 8px 22px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transform: rotate(-4deg);
  opacity: 0.9;
}

/* ---------------------------------------------------------------------
   Tables
   --------------------------------------------------------------------- */
.table-glass {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table-glass thead th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--lda-slate);
  font-weight: 700;
  border-bottom: 1px solid rgba(18,19,28,0.08);
  padding: 10px 14px;
  white-space: nowrap;
}

.table-glass tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(18,19,28,0.05);
  font-size: 14px;
  vertical-align: middle;
}

.table-glass tbody tr:hover { background: rgba(231,234,246,0.35); }
.table-glass tbody tr:last-child td { border-bottom: none; }

.row-link { cursor: pointer; }

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */
.btn-brand {
  background: var(--lda-red);
  border: 1px solid var(--lda-red);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  border-radius: 10px;
  padding: 9px 18px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  box-shadow: 0 6px 16px rgba(211,4,23,0.25);
}
.btn-brand:hover { background: var(--lda-red-dark); color: #fff; box-shadow: 0 8px 20px rgba(211,4,23,0.32); transform: translateY(-1px); }
.btn-brand:focus-visible { outline: 3px solid #F7B9C0; outline-offset: 2px; }

.btn-ghost {
  background: var(--lda-white);
  border: 1px solid rgba(18,19,28,0.10);
  color: var(--lda-ink);
  font-weight: 600;
  font-size: 14px;
  border-radius: 10px;
  padding: 9px 16px;
}
.btn-ghost:hover { background: #F7F8FC; border-color: rgba(18,19,28,0.16); }

.btn-danger-ghost {
  background: var(--lda-white);
  border: 1px solid #F3C6CA;
  color: var(--lda-red);
  font-weight: 600;
  font-size: 13.5px;
  border-radius: 10px;
  padding: 8px 14px;
}
.btn-danger-ghost:hover { background: var(--lda-red-soft); }

a.btn-brand, a.btn-ghost, a.btn-danger-ghost { display: inline-flex; align-items: center; gap: 7px; }

/* Focus visibility (accessibility floor) */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #B9C4F7;
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--lda-ink);
  margin-bottom: 6px;
}

.form-control, .form-select {
  border-radius: 10px;
  border: 1px solid rgba(18,19,28,0.12);
  padding: 9px 13px;
  font-size: 14px;
  background: rgba(255,255,255,0.85);
}

.form-control:focus, .form-select:focus {
  border-color: var(--lda-red);
  box-shadow: 0 0 0 3px rgba(211,4,23,0.12);
}

.input-group-text { background: rgba(231,234,246,0.5); border: 1px solid rgba(18,19,28,0.12); font-size: 13px; color: var(--lda-slate); }

/* ---------------------------------------------------------------------
   Invoice line-item builder
   --------------------------------------------------------------------- */
.items-table th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--lda-slate); padding: 6px 8px; }
.items-table td { padding: 6px 8px; vertical-align: top; }
.items-table .amount-cell { font-weight: 700; white-space: nowrap; }
.remove-item-btn { color: var(--lda-slate-soft); border: none; background: none; font-size: 17px; padding: 6px; }
.remove-item-btn:hover { color: var(--lda-red); }

.totals-box {
  background: rgba(231,234,246,0.35);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.totals-box .row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.totals-box .row.grand { border-top: 1.5px dashed rgba(18,19,28,0.15); margin-top: 6px; padding-top: 12px; font-size: 19px; font-weight: 800; color: var(--lda-red); font-family: var(--font-display); }

/* ---------------------------------------------------------------------
   Invoice preview (matches/extends the reference letterhead)
   --------------------------------------------------------------------- */
.invoice-sheet {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 34px;
  max-width: 860px;
  margin: 0 auto;
}

.invoice-sheet .letterhead { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.invoice-sheet .letterhead .brand { display: flex; gap: 12px; align-items: center; }
.invoice-sheet .letterhead .brand img { height: 56px; }
.invoice-sheet .letterhead .brand .name { font-family: var(--font-display); font-weight: 800; color: var(--lda-red); font-size: 19px; }
.invoice-sheet .letterhead .meta { text-align: right; font-size: 12.5px; color: var(--lda-slate); line-height: 1.6; }

.invoice-sheet .title-bar { text-align: center; margin: 22px 0 10px; }
.invoice-sheet .title-bar h2 { color: var(--lda-red); font-size: 24px; font-weight: 800; letter-spacing: 0.04em; margin: 0; }
.invoice-sheet .title-bar .rule { height: 5px; background: var(--lda-mist); border-radius: 3px; margin-top: 10px; }

.invoice-sheet .billto-row { display: flex; gap: 20px; margin-top: 22px; flex-wrap: wrap; }
.invoice-sheet .billto-row .billto { flex: 1.6; min-width: 240px; font-size: 13.5px; line-height: 1.7; }
.invoice-sheet .billto-row .meta-box { flex: 1; min-width: 200px; background: var(--lda-paper); border-radius: var(--radius-sm); padding: 12px 16px; font-size: 13.5px; }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .invoice-sheet { box-shadow: none; padding: 0; }
}

/* ---------------------------------------------------------------------
   Responsive — mobile
   --------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lift);
  }
  .sidebar.open { transform: translateX(0); }
  .main-col { margin-left: 0; }
  .btn-mobile-nav { display: inline-flex; }
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0; background: rgba(10,10,16,0.45); z-index: 1025;
  }
  .sidebar-backdrop.show { display: block; }
  .content-area { padding: 18px 16px 44px; }
  .topbar { padding: 12px 16px; }
  .invoice-sheet { padding: 18px; }
  .invoice-sheet .letterhead .meta { text-align: left; }
}

@media (max-width: 575.98px) {
  .stat-card .value { font-size: 22px; }
  .totals-box .row.grand { font-size: 17px; }
}
