/* ═══════════════════════════════════════
   RESET & BOX MODEL
═══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ═══════════════════════════════════════
   VARIABLES — Light theme (default)
═══════════════════════════════════════ */
:root {
  --brand:        #00C87A;
  --brand-dk:     #007A3E;
  --brand-lt:     #00A866;
  --brand-tint:   rgba(0,160,90,.10);
  --brand-glow:   rgba(0,160,90,.22);
  --brand-strong: rgba(0,160,90,.40);

  --bg:    #F5FAF7;
  --bg2:   #EBF2ED;
  --bg3:   #FFFFFF;
  --bg4:   #D5E4D9;

  --text:  #0C1C13;
  --muted: #527A62;

  --border:    rgba(0,100,50,.12);
  --border-md: rgba(0,100,50,.20);

  --err:    #DC2626;
  --err-bg: rgba(220,38,38,.08);
  --ok:     #00A866;
  --ok-bg:  rgba(0,168,102,.10);

  --rs: 10px; --rm: 14px; --rl: 18px;
  --tr: .2s cubic-bezier(.4,0,.2,1);
  --tr-f: .1s ease;

  /* Status */
  --s-planned-bg:  rgba(99,102,241,.10);  --s-planned-tx:  #4338CA;
  --s-active-bg:   rgba(0,168,102,.12);   --s-active-tx:   #007A3E;
  --s-urgent-bg:   rgba(234,88,12,.12);   --s-urgent-tx:   #C2410C;
  --s-inwork-bg:   rgba(217,119,6,.12);   --s-inwork-tx:   #B45309;
  --s-nosync-bg:   rgba(124,58,237,.12);  --s-nosync-tx:   #6D28D9;
  --s-done-bg:     rgba(0,200,122,.15);   --s-done-tx:     #006E3C;
  --s-closed-bg:   rgba(74,122,90,.12);   --s-closed-tx:   #3D6B50;
  --s-overdue-bg:  rgba(220,38,38,.12);   --s-overdue-tx:  #DC2626;

  /* Types */
  --t-conn-bg:      rgba(0,168,102,.12);   --t-conn-tx:      #007A3E;
  --t-repair-bg:    rgba(217,119,6,.12);   --t-repair-tx:    #B45309;
  --t-net-bg:       rgba(79,70,229,.12);   --t-net-tx:       #4338CA;
  --t-trans-bg:     rgba(14,165,233,.12);  --t-trans-tx:     #0369A1;
  --t-sales-bg:     rgba(168,85,247,.12);  --t-sales-tx:     #7C3AED;
  --t-internal-bg:  rgba(71,85,105,.12);   --t-internal-tx:  #334155;

  --sidebar-w:    220px;
  --topbar-h:     56px;
  --bottomnav-h:  62px;
}

/* ═══════════════════════════════════════
   DARK THEME
═══════════════════════════════════════ */
body.dark {
  --brand-dk: #00A866; --brand-lt: #34D494;
  --brand-tint: rgba(0,200,122,.12); --brand-glow: rgba(0,200,122,.25); --brand-strong: rgba(0,200,122,.50);
  --bg: #0D2A1C; --bg2: #09201A; --bg3: #162E22; --bg4: #1C3A2A;
  --text: #DFF0E8; --muted: #5A8A70;
  --border: rgba(0,200,122,.16); --border-md: rgba(0,200,122,.30);
  --s-planned-bg:  rgba(129,140,248,.15); --s-planned-tx:  #818CF8;
  --s-active-bg:   rgba(0,200,122,.15);   --s-active-tx:   #34D494;
  --s-urgent-bg:   rgba(251,146,60,.15);  --s-urgent-tx:   #FB923C;
  --s-inwork-bg:   rgba(251,191,36,.15);  --s-inwork-tx:   #FCD34D;
  --s-nosync-bg:   rgba(167,139,250,.15); --s-nosync-tx:   #A78BFA;
  --s-done-bg:     rgba(52,212,148,.15);  --s-done-tx:     #6EE7B7;
  --s-closed-bg:   rgba(90,138,112,.15);  --s-closed-tx:   #5A8A70;
  --s-overdue-bg:  rgba(248,113,113,.15); --s-overdue-tx:  #F87171;
  --t-conn-bg:      rgba(0,200,122,.15);   --t-conn-tx:      #34D494;
  --t-repair-bg:    rgba(251,191,36,.15);  --t-repair-tx:    #FCD34D;
  --t-net-bg:       rgba(129,140,248,.15); --t-net-tx:       #A5B4FC;
  --t-trans-bg:     rgba(56,189,248,.15);  --t-trans-tx:     #7DD3FC;
  --t-sales-bg:     rgba(196,181,253,.15); --t-sales-tx:     #C4B5FD;
  --t-internal-bg:  rgba(148,163,184,.12); --t-internal-tx:  #94A3B8;
}

/* ═══════════════════════════════════════
   BASE
═══════════════════════════════════════ */
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px; line-height: 1.6;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
  height: 100%; overflow: hidden;
}
button { cursor: pointer; font: inherit; border: none; background: none; padding: 0; }
input, textarea, select { font: inherit; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 2px; }

/* ═══════════════════════════════════════
   APP SHELL
═══════════════════════════════════════ */
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }

/* ═══════════════════════════════════════
   TOPBAR
═══════════════════════════════════════ */
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  background: var(--bg3); border-bottom: 1px solid var(--border-md);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; gap: 12px; z-index: 20;
}
.brand {
  font-size: 1.5rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase;
  background: linear-gradient(135deg, #00C87A 0%, #007A3E 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.topbar-left  { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-user-name { font-size: .78rem; font-weight: 600; color: var(--text); display: block; line-height: 1.2; text-align: right; }
.topbar-user-role { font-size: .68rem; color: var(--muted); display: block; text-align: right; }
.icon-btn {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-md); border-radius: 50%;
  background: var(--bg2); color: var(--muted); flex-shrink: 0;
  transition: all var(--tr); -webkit-tap-highlight-color: transparent;
}
.icon-btn:active { background: var(--brand-tint); border-color: var(--brand); color: var(--brand-dk); transform: scale(.92); }

/* Theme toggle — contrasting to active theme */
#theme-btn { background: #162E22; border-color: #1C3A2A; color: #A8D4BC; }
#theme-btn:active { background: #0D2A1C; border-color: var(--brand); color: var(--brand); transform: scale(.92); }
body.dark #theme-btn { background: #E8F2EC; border-color: #CDE0D5; color: #0C1C13; }
body.dark #theme-btn:active { background: #FFFFFF; border-color: var(--brand-lt); color: var(--brand-dk); }
.avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-tint); border: 1.5px solid var(--brand-glow);
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; color: var(--brand-dk); flex-shrink: 0;
}

/* ═══════════════════════════════════════
   LAYOUT
═══════════════════════════════════════ */
.layout { display: flex; flex: 1; overflow: hidden; min-height: 0; }

/* ═══════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w); background: var(--bg2);
  border-right: 1px solid var(--border-md);
  display: none; flex-direction: column;
  flex-shrink: 0; overflow-y: auto; padding: 8px 0;
}
.sidebar-section-label {
  font-size: .62rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
  padding: 14px 16px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: .87rem; font-weight: 500;
  color: var(--muted); border-left: 3px solid transparent;
  cursor: pointer; background: none; width: 100%; text-align: left;
  transition: all var(--tr); -webkit-tap-highlight-color: transparent;
  position: relative;
}
.nav-item svg { flex-shrink: 0; opacity: .65; transition: opacity var(--tr); }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item:hover svg { opacity: 1; }
.nav-item.active {
  color: var(--brand-dk); border-left-color: var(--brand);
  background: var(--brand-tint); font-weight: 600;
}
.nav-item.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 18px; padding: 0 5px;
  background: var(--err); color: #fff; border-radius: 50px;
  font-size: .62rem; font-weight: 700; letter-spacing: .02em;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-footer {
  margin-top: auto; padding: 12px; border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  background: var(--bg3); border: 1px solid var(--border-md);
  border-radius: var(--rm);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand-tint); border: 1.5px solid var(--brand-glow);
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; color: var(--brand-dk); flex-shrink: 0;
}
.sidebar-user-name { font-size: .8rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-sub  { font-size: .68rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 768px) { .sidebar { display: flex; } }

/* ═══════════════════════════════════════
   CONTENT
═══════════════════════════════════════ */
.content { flex: 1; overflow-y: auto; min-width: 0; padding-bottom: var(--bottomnav-h); }
@media (min-width: 768px) { .content { padding-bottom: 0; } }
.section { display: none; }
.section.active { display: block; }

/* ═══════════════════════════════════════
   BOTTOM NAV
═══════════════════════════════════════ */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-h); background: var(--bg3);
  border-top: 1px solid var(--border-md);
  display: flex; align-items: center; z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
}
.bn-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  padding: 6px 2px; font-size: .55rem; font-weight: 600;
  color: var(--muted); cursor: pointer;
  text-transform: uppercase; letter-spacing: .04em;
  transition: color var(--tr); -webkit-tap-highlight-color: transparent;
  position: relative;
}
.bn-item svg { opacity: .55; transition: opacity var(--tr); }
.bn-item.active { color: var(--brand-dk); }
.bn-item.active svg { opacity: 1; }
.bn-dot {
  position: absolute; top: 6px; right: calc(50% - 14px);
  width: 7px; height: 7px; border-radius: 50%; background: var(--err);
}
@media (min-width: 768px) { .bottom-nav { display: none; } }

/* ═══════════════════════════════════════
   SECTION HEADER
═══════════════════════════════════════ */
.sec-header {
  padding: 14px 16px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.sec-title { font-size: 1.05rem; font-weight: 700; color: var(--text); letter-spacing: -.01em; }

/* ═══════════════════════════════════════
   TYPE TABS
═══════════════════════════════════════ */
.type-tabs {
  display: flex; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--border); background: var(--bg3);
  padding: 0 12px; position: sticky; top: 0; z-index: 10;
}
.type-tabs::-webkit-scrollbar { display: none; }
.type-tab {
  flex-shrink: 0; padding: 12px 12px;
  font-size: .8rem; font-weight: 500; color: var(--muted);
  border: none; border-bottom: 2px solid transparent;
  background: none; cursor: pointer; white-space: nowrap;
  transition: color var(--tr), border-color var(--tr);
  -webkit-tap-highlight-color: transparent;
}
.type-tab.active { color: var(--brand-dk); border-bottom-color: var(--brand); font-weight: 700; }

/* ═══════════════════════════════════════
   STATUS FILTER
═══════════════════════════════════════ */
.status-filter {
  display: flex; overflow-x: auto; scrollbar-width: none; gap: 6px;
  padding: 10px 16px; background: var(--bg);
}
.status-filter::-webkit-scrollbar { display: none; }
.sf-chip {
  flex-shrink: 0; padding: 5px 12px; font-size: .74rem; font-weight: 500;
  border: 1px solid var(--border-md); border-radius: 50px;
  background: var(--bg3); color: var(--muted); cursor: pointer; white-space: nowrap;
  transition: all var(--tr); -webkit-tap-highlight-color: transparent;
}
.sf-chip.active { background: var(--brand-dk); border-color: var(--brand-dk); color: #fff; font-weight: 600; }

/* ═══════════════════════════════════════
   TICKETS COUNTER
═══════════════════════════════════════ */
.tickets-counter {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 16px; font-size: .78rem; color: var(--muted); font-weight: 500;
}
.tc-num {
  font-size: .68rem; font-weight: 700;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 50px; padding: 2px 7px; color: var(--text);
}

/* ═══════════════════════════════════════
   TICKET CARDS
═══════════════════════════════════════ */
.tickets-list { display: flex; flex-direction: column; gap: 8px; padding: 6px 16px 24px; }
.ticket-card {
  background: var(--bg3); border: 1px solid var(--border-md);
  border-radius: var(--rm); padding: 13px; cursor: pointer;
  transition: border-color var(--tr), box-shadow var(--tr), transform var(--tr-f);
  -webkit-tap-highlight-color: transparent;
}
.ticket-card:active { transform: scale(.99); }
.ticket-card:hover  { border-color: var(--brand-glow); box-shadow: 0 2px 12px var(--brand-tint); }
.ticket-card-top {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 8px; margin-bottom: 8px;
}
.ticket-id-label { font-size: .68rem; font-weight: 600; color: var(--muted); letter-spacing: .04em; }
.ticket-addr   { font-size: .9rem; font-weight: 600; color: var(--text); line-height: 1.3; margin-bottom: 3px; }
.ticket-client { font-size: .78rem; color: var(--muted); }
.ticket-card-bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px;
}
.ticket-meta { display: flex; align-items: center; gap: 6px; }
.ticket-assignee { font-size: .72rem; color: var(--muted); }
.ticket-date     { font-size: .68rem; color: var(--muted); }

/* ═══════════════════════════════════════
   BADGES
═══════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 50px;
  font-size: .68rem; font-weight: 700; white-space: nowrap; letter-spacing: .02em;
}
.badge-planned   { background: var(--s-planned-bg);  color: var(--s-planned-tx);  }
.badge-active    { background: var(--s-active-bg);   color: var(--s-active-tx);   }
.badge-urgent    { background: var(--s-urgent-bg);   color: var(--s-urgent-tx);   }
.badge-inwork    { background: var(--s-inwork-bg);   color: var(--s-inwork-tx);   }
.badge-nosync    { background: var(--s-nosync-bg);   color: var(--s-nosync-tx);   }
.badge-done      { background: var(--s-done-bg);     color: var(--s-done-tx);     }
.badge-closed    { background: var(--s-closed-bg);   color: var(--s-closed-tx);   }
.badge-overdue   { background: var(--s-overdue-bg);  color: var(--s-overdue-tx);  }
.badge-conn      { background: var(--t-conn-bg);     color: var(--t-conn-tx);     }
.badge-repair    { background: var(--t-repair-bg);   color: var(--t-repair-tx);   }
.badge-net       { background: var(--t-net-bg);      color: var(--t-net-tx);      }
.badge-trans     { background: var(--t-trans-bg);    color: var(--t-trans-tx);    }
.badge-sales     { background: var(--t-sales-bg);    color: var(--t-sales-tx);    }
.badge-internal  { background: var(--t-internal-bg); color: var(--t-internal-tx); }

/* ═══════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════ */
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-icon  { font-size: 2.4rem; margin-bottom: 10px; opacity: .45; }
.empty-text  { font-size: .88rem; }

/* ═══════════════════════════════════════
   EXPENSES
═══════════════════════════════════════ */
.expenses-total {
  margin: 12px 16px 4px;
  background: var(--brand-tint); border: 1px solid var(--brand-glow);
  border-radius: var(--rm); padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.expenses-total-lbl { font-size: .74rem; font-weight: 700; color: var(--brand-dk); text-transform: uppercase; letter-spacing: .06em; }
.expenses-total-val { font-size: 1.15rem; font-weight: 800; color: var(--brand-dk); }
.expenses-list { display: flex; flex-direction: column; gap: 8px; padding: 8px 16px 24px; }
.expense-card {
  background: var(--bg3); border: 1px solid var(--border-md);
  border-radius: var(--rm); padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
}
.expense-icon {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.exp-fuel  { background: rgba(245,158,11,.12); }
.exp-mat   { background: rgba(79,70,229,.12);  }
.exp-tool  { background: rgba(14,165,233,.12); }
.exp-other { background: rgba(107,114,128,.12); }
.expense-body { flex: 1; min-width: 0; }
.expense-cat  { font-size: .66rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.expense-desc { font-size: .87rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.expense-date { font-size: .68rem; color: var(--muted); }
.expense-amt  { font-size: .98rem; font-weight: 700; color: var(--text); flex-shrink: 0; white-space: nowrap; }

/* ═══════════════════════════════════════
   STATS & BONUSES
═══════════════════════════════════════ */
.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 16px;
}
@media (min-width: 768px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card {
  background: var(--bg3); border: 1px solid var(--border-md);
  border-radius: var(--rm); padding: 14px;
}
.stat-card.highlight { background: var(--brand-tint); border-color: var(--brand-glow); }
.stat-label { font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 4px; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--text); line-height: 1.1; }
.stat-card.highlight .stat-value { color: var(--brand-dk); }
.stat-sub { font-size: .7rem; color: var(--muted); margin-top: 3px; }
.section-label {
  font-size: .68rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em; padding: 12px 16px 6px;
}
.bonus-list { padding: 0 16px 24px; display: flex; flex-direction: column; gap: 8px; }
.bonus-row {
  background: var(--bg3); border: 1px solid var(--border-md);
  border-radius: var(--rm); padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.bonus-type  { font-size: .85rem; font-weight: 500; color: var(--text); }
.bonus-count { font-size: .72rem; color: var(--muted); margin-top: 1px; }
.bonus-amt   { font-size: .9rem; font-weight: 700; color: var(--brand-dk); }

/* ═══════════════════════════════════════
   RATING
═══════════════════════════════════════ */
.rating-list { padding: 12px 16px 24px; display: flex; flex-direction: column; gap: 8px; }
.rating-row {
  background: var(--bg3); border: 1px solid var(--border-md);
  border-radius: var(--rm); padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
}
.rating-row.me { background: var(--brand-tint); border-color: var(--brand-glow); }
.rating-pos {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg2); border: 1px solid var(--border-md);
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; color: var(--muted); flex-shrink: 0;
}
.pos-gold   { background: #F59E0B; border-color: #F59E0B; color: #fff; }
.pos-silver { background: #94A3B8; border-color: #94A3B8; color: #fff; }
.pos-bronze { background: #B45309; border-color: #B45309; color: #fff; }
.rating-row.me .rating-pos { background: var(--brand-dk); border-color: var(--brand-dk); color: #fff; }
.rating-name { flex: 1; font-size: .87rem; font-weight: 500; color: var(--text); }
.rating-row.me .rating-name { font-weight: 700; }
.rating-stats { text-align: right; flex-shrink: 0; }
.rating-tickets { font-size: .8rem; font-weight: 600; color: var(--text); }
.rating-bonus   { font-size: .7rem; color: var(--muted); }

/* ═══════════════════════════════════════
   REPORT CARDS
═══════════════════════════════════════ */
.report-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 16px;
}
@media (min-width: 768px) { .report-grid { grid-template-columns: repeat(3, 1fr); } }
.report-card {
  background: var(--bg3); border: 1px solid var(--border-md);
  border-radius: var(--rm); padding: 16px; cursor: pointer;
  transition: border-color var(--tr), box-shadow var(--tr);
  -webkit-tap-highlight-color: transparent;
}
.report-card:hover { border-color: var(--brand-glow); box-shadow: 0 2px 10px var(--brand-tint); }
.report-card-icon { font-size: 1.5rem; margin-bottom: 8px; }
.report-card-name { font-size: .85rem; font-weight: 600; color: var(--text); }
.report-card-desc { font-size: .72rem; color: var(--muted); margin-top: 3px; line-height: 1.4; }

/* ═══════════════════════════════════════
   PLACEHOLDER
═══════════════════════════════════════ */
.placeholder-section {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 350px; padding: 40px 24px;
  text-align: center; gap: 14px;
}
.placeholder-icon {
  width: 68px; height: 68px; background: var(--brand-tint);
  border: 1px solid var(--brand-glow); border-radius: 20px;
  display: flex; align-items: center; justify-content: center; color: var(--brand-dk);
}
.placeholder-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.placeholder-sub   { font-size: .85rem; color: var(--muted); max-width: 240px; line-height: 1.5; }

/* ═══════════════════════════════════════
   MODAL / OVERLAY
═══════════════════════════════════════ */
.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  z-index: 100; align-items: flex-end; justify-content: center;
}
.overlay.open { display: flex; }
@media (min-width: 768px) { .overlay { align-items: center; } }
.modal-sheet {
  background: var(--bg3); border: 1px solid var(--border-md);
  border-radius: var(--rl) var(--rl) 0 0;
  width: 100%; max-width: 620px; max-height: 92vh;
  overflow-y: auto; box-shadow: 0 -4px 40px rgba(0,0,0,.15);
}
@media (min-width: 768px) {
  .modal-sheet { border-radius: var(--rl); max-height: 82vh; }
}
.modal-handle {
  width: 40px; height: 4px; background: var(--border-md);
  border-radius: 2px; margin: 12px auto 0;
}
@media (min-width: 768px) { .modal-handle { display: none; } }
.modal-header {
  padding: 14px 16px 12px; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; background: var(--bg3); z-index: 1;
}
.modal-title    { font-size: .98rem; font-weight: 700; color: var(--text); }
.modal-subtitle { font-size: .76rem; color: var(--muted); margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; }
.modal-close {
  width: 30px; height: 30px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-md); border-radius: 8px;
  background: var(--bg2); color: var(--muted); font-size: 15px;
  -webkit-tap-highlight-color: transparent; transition: all var(--tr);
}
.modal-close:active { background: var(--brand-tint); color: var(--brand-dk); }
.modal-body { padding: 14px 16px; }

/* Info rows */
.info-section { margin-bottom: 16px; }
.info-section-title {
  font-size: .64rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); margin-bottom: 8px;
}
.info-row {
  display: flex; gap: 12px; padding: 8px 0;
  border-bottom: 1px solid var(--border); font-size: .86rem;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--muted); font-size: .74rem; font-weight: 600; width: 110px; flex-shrink: 0; text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
.info-value { color: var(--text); flex: 1; line-height: 1.4; }

/* Timestamps */
.timestamps {
  background: var(--bg2); border-radius: var(--rs);
  border: 1px solid var(--border); padding: 12px; margin-bottom: 16px;
}
.ts-row { display: flex; justify-content: space-between; font-size: .77rem; padding: 5px 0; border-bottom: 1px solid var(--border); }
.ts-row:last-child { border-bottom: none; }
.ts-label { color: var(--muted); }
.ts-value { color: var(--text); font-weight: 500; }
.ts-value.empty { color: var(--border-md); font-style: italic; }

/* Action buttons */
.action-btns { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.btn-action {
  width: 100%; padding: 13px; border-radius: 50px;
  font-size: .93rem; font-weight: 700; cursor: pointer;
  font-family: inherit; letter-spacing: .03em;
  transition: all var(--tr); -webkit-tap-highlight-color: transparent;
}
.btn-primary {
  background: var(--brand); color: #fff; border: none;
  box-shadow: 0 4px 16px var(--brand-strong);
}
.btn-primary:active { opacity: .88; transform: scale(.99); }
.btn-secondary {
  background: none; color: var(--muted); border: 1px solid var(--border-md);
}
.btn-secondary:active { background: var(--bg2); }
.btn-danger { background: none; color: var(--err); border: 1px solid rgba(220,38,38,.25); }
.btn-danger:active { background: var(--err-bg); }
.closed-note {
  text-align: center; padding: 12px;
  font-size: .84rem; color: var(--muted); font-style: italic;
}

/* ═══════════════════════════════════════
   EXPENSE FORM
═══════════════════════════════════════ */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block; font-size: .68rem; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 6px;
}
.form-input {
  width: 100%; padding: 11px 14px; font-size: .93rem;
  border: 1px solid var(--border-md); border-radius: var(--rs);
  background: var(--bg2); color: var(--text); outline: none;
  transition: border-color var(--tr), box-shadow var(--tr); -webkit-appearance: none;
}
.form-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.form-input::placeholder { color: var(--muted); opacity: .7; }
select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23527A62' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 36px; cursor: pointer;
}

/* FAB */
.fab {
  position: fixed; bottom: calc(var(--bottomnav-h) + 14px); right: 16px;
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px var(--brand-strong);
  cursor: pointer; z-index: 15; font-size: 1.4rem;
  transition: all var(--tr); -webkit-tap-highlight-color: transparent;
}
.fab:active { transform: scale(.92); box-shadow: 0 2px 10px var(--brand-glow); }
@media (min-width: 768px) { .fab { bottom: 16px; } }

/* Sec add btn */
.sec-btn {
  padding: 7px 14px; border-radius: 50px; font-size: .78rem; font-weight: 600;
  background: var(--brand-tint); color: var(--brand-dk); border: 1px solid var(--brand-glow);
  cursor: pointer; transition: all var(--tr); -webkit-tap-highlight-color: transparent;
}
.sec-btn:active { opacity: .8; }

/* ═══════════════════════════════════════
   SALES SECTION
═══════════════════════════════════════ */
.sales-list { display: flex; flex-direction: column; gap: 8px; padding: 8px 16px 24px; }
.sale-card {
  background: var(--bg3); border: 1px solid var(--border-md);
  border-radius: var(--rm); padding: 13px; cursor: default;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.sale-card:hover { border-color: var(--brand-glow); box-shadow: 0 2px 12px var(--brand-tint); }
.sale-card-top {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 8px; margin-bottom: 8px;
}
.sale-id { font-size: .68rem; font-weight: 600; color: var(--muted); letter-spacing: .04em; }
.sale-total { font-size: 1rem; font-weight: 800; color: var(--brand-dk); white-space: nowrap; }
.sale-items { margin-bottom: 6px; }
.sale-item-row { font-size: .82rem; color: var(--text); line-height: 1.5; }
.sale-item-row span { color: var(--muted); font-size: .75rem; }
.sale-card-bottom {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border);
}
.sale-meta { font-size: .72rem; color: var(--muted); }
.sale-date { font-size: .68rem; color: var(--muted); }

/* Closure tag */
.closure-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 50px; font-size: .72rem; font-weight: 700;
  letter-spacing: .02em;
}
.closure-tag-ok      { background: var(--ok-bg);  color: var(--ok); }
.closure-tag-overdue { background: var(--err-bg); color: var(--err); }
.closure-tag-block {
  text-align: center; padding: 10px;
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
}

/* ═══════════════════════════════════════
   RESPONSIVE TWEAKS
═══════════════════════════════════════ */
@media (max-width: 424px) {
  .type-tab  { padding: 11px 10px; font-size: .75rem; }
  .sf-chip   { font-size: .7rem; padding: 4px 10px; }
  .stat-value { font-size: 1.3rem; }
  .ticket-addr { font-size: .85rem; }
}
