/* =========================================================
   SHAREBUY — Global design system & application shell
   ========================================================= */
:root {
  --bg: #080A0E;
  --bg-2: #10141B;
  --card: #151A22;
  --elev: #1B222D;
  --elev-2: #222A37;
  --line: rgba(255, 255, 255, 0.06);
  --line-2: rgba(255, 255, 255, 0.1);
  --gold: #D6AD60;
  --gold-2: #F2D89C;
  --gold-dim: rgba(214, 173, 96, 0.14);
  --gold-line: rgba(214, 173, 96, 0.35);
  --text: #F5F5F2;
  --text-2: #9299A5;
  --text-3: #646B78;
  --success: #36C991;
  --success-dim: rgba(54, 201, 145, 0.12);
  --danger: #F16D75;
  --danger-dim: rgba(241, 109, 117, 0.12);
  --warning: #E9B65C;
  --warning-dim: rgba(233, 182, 92, 0.13);
  --info: #7FA6D9;
  --info-dim: rgba(127, 166, 217, 0.13);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar: 252px;
  --topbar: 72px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 20px 40px -24px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 40px 80px -30px rgba(0, 0, 0, 0.85);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01', 'lnum';
  font-variant-numeric: lining-nums;
  overflow: hidden;
}
body.modal-open { overflow: hidden; }
a { color: var(--gold); text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
.num, .money { font-variant-numeric: lining-nums tabular-nums; }
.serif { font-family: var(--serif); }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.gold { color: var(--gold); }
.pos { color: var(--success); }
.neg { color: var(--danger); }
.ic { width: 18px; height: 18px; flex: none; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.75; flex: none; }
::selection { background: rgba(214, 173, 96, 0.3); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #232a35; border-radius: 10px; border: 3px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--gold-line); outline-offset: 2px; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #0B0E13 0%, #090B0F 100%);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; z-index: 40;
  transition: transform 0.4s var(--ease), width 0.4s var(--ease);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px; cursor: pointer; }
.brand-mark { width: 38px; height: 38px; flex: none; }
.brand-word { font-weight: 600; letter-spacing: 0.34em; font-size: 15px; color: var(--text); }
.brand-sub { font-size: 9.5px; letter-spacing: 0.28em; color: var(--gold); text-transform: uppercase; margin-top: 2px; }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.nav::-webkit-scrollbar-thumb { border-color: #0A0C10; }
.nav-group { margin-top: 14px; }
.nav-label { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-3); padding: 0 12px 6px; font-weight: 600; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 8px 12px; border-radius: 10px; border: 0; background: none; cursor: pointer;
  color: var(--text-2); font-size: 13.25px; text-align: left; transition: color 0.2s, background 0.2s;
}
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.03); }
.nav-item.active { color: var(--gold-2); background: linear-gradient(90deg, rgba(214, 173, 96, 0.13), rgba(214, 173, 96, 0.02)); }
.nav-item.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); box-shadow: 0 0 12px rgba(214, 173, 96, 0.5); }
.nav-item .count { margin-left: auto; font-size: 10.5px; background: var(--gold-dim); color: var(--gold-2); padding: 1px 7px; border-radius: 20px; font-weight: 600; }
.nav-item.locked { opacity: 0.45; }
.sidebar-foot { padding: 14px; border-top: 1px solid var(--line); }
.owner-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); cursor: pointer; transition: border-color .2s; }
.owner-card:hover { border-color: var(--gold-line); }
.owner-card img { width: 38px; height: 38px; border-radius: 50%; }
.owner-card b { display: block; font-size: 13px; font-weight: 600; }
.owner-card span { font-size: 11px; color: var(--gold); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  height: var(--topbar); flex: none; display: flex; align-items: center; gap: 14px; padding: 0 28px;
  border-bottom: 1px solid var(--line); background: rgba(8, 10, 14, 0.82); backdrop-filter: blur(14px); z-index: 30;
}
.icon-btn.menu-btn { display: none; }
.crumbs { display: flex; flex-direction: column; min-width: 0; }
.crumbs small { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); }
.crumbs b { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-trigger {
  margin-left: auto; display: flex; align-items: center; gap: 10px; width: min(360px, 32vw); height: 40px; padding: 0 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 11px; color: var(--text-3); cursor: pointer; transition: border-color .2s;
}
.search-trigger:hover { border-color: var(--line-2); }
.search-trigger span { flex: 1; text-align: left; font-size: 13px; }
kbd { font-family: var(--font); font-size: 10.5px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--text-2); background: var(--elev); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.date-pill { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 40px; border-radius: 11px; border: 1px solid var(--line); color: var(--text-2); font-size: 12.5px; white-space: nowrap; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; background: var(--card);
  border: 1px solid var(--line); cursor: pointer; color: var(--text-2); position: relative; transition: all .2s; flex: none;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 10px; background: var(--gold); color: #1a1408; font-size: 9.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); transform: translate(40%, -40%); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }
.icon-btn.sm svg { width: 15px; height: 15px; }
.avatar-btn { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 30px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.avatar-btn img { width: 32px; height: 32px; border-radius: 50%; }
.avatar-btn span { font-size: 12.5px; font-weight: 500; }
.btn-present { border-color: var(--gold-line) !important; color: var(--gold-2) !important; }

.view-wrap { flex: 1; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }
.view { padding: 28px 28px 60px; max-width: 1680px; margin: 0 auto; animation: viewIn 0.55s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--serif); font-size: 34px; font-weight: 600; letter-spacing: -0.005em; line-height: 1.1; }
.page-head p { color: var(--text-2); margin-top: 6px; }
.eyebrow { font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); font-weight: 600; margin-bottom: 8px; display: block; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Grid ---------- */
.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.g-3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }

/* ---------- Cards ---------- */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0)) , var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  position: relative; transition: border-color 0.35s var(--ease), transform 0.35s var(--ease); min-width: 0;
}
.card.hover:hover, .card.clickable:hover { border-color: var(--gold-line); }
.card.clickable { cursor: pointer; }
.card.clickable:hover { transform: translateY(-2px); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-head p { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.card-title { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-2); font-weight: 600; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 18px 20px 0; }
.card.gold-edge { border-color: var(--gold-line); }

/* ---------- KPI ---------- */
.kpi { display: flex; flex-direction: column; gap: 10px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--elev); border: 1px solid var(--line); color: var(--gold); }
.kpi-ic svg { width: 17px; height: 17px; }
.kpi-label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.kpi-value { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-sub { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 8px; }
.trend { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.trend svg { width: 13px; height: 13px; }
.trend.up { color: var(--success); background: var(--success-dim); }
.trend.down { color: var(--danger); background: var(--danger-dim); }
.spark { height: 34px; margin-top: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 11px; border: 1px solid var(--line-2); background: var(--elev); color: var(--text); cursor: pointer;
  font-size: 13px; font-weight: 500; white-space: nowrap; transition: all 0.2s var(--ease);
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: rgba(255, 255, 255, 0.2); background: var(--elev-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-gold { background: linear-gradient(180deg, #E2BD74, #C99B4B); color: #17120A; border-color: transparent; font-weight: 600; box-shadow: 0 8px 20px -10px rgba(214, 173, 96, 0.6); }
.btn-gold:hover { background: linear-gradient(180deg, #EBC985, #D2A658); border-color: transparent; }
.btn-ghost { background: transparent; border-color: var(--line-2); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.04); }
.btn-danger { background: var(--danger-dim); color: var(--danger); border-color: rgba(241, 109, 117, 0.3); }
.btn-danger:hover { background: rgba(241, 109, 117, 0.2); border-color: rgba(241, 109, 117, 0.5); }
.btn-success { background: var(--success-dim); color: var(--success); border-color: rgba(54, 201, 145, 0.3); }
.btn-success:hover { background: rgba(54, 201, 145, 0.2); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; border-radius: 9px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 14px; border-radius: 13px; }
.btn-link { background: none; border: 0; color: var(--gold); cursor: pointer; padding: 0; font-size: 12.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.btn-link:hover { color: var(--gold-2); }
.btn-link svg { width: 14px; height: 14px; }

/* ---------- Toolbar / chips / tabs ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 32px; padding: 0 13px; border-radius: 20px; border: 1px solid var(--line-2); background: transparent;
  color: var(--text-2); font-size: 12.5px; cursor: pointer; transition: all .2s; display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--gold-dim); color: var(--gold-2); border-color: var(--gold-line); }
.chip .n { font-size: 10.5px; opacity: .7; }
.tabs { display: inline-flex; padding: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; gap: 2px; flex-wrap: wrap; }
.tab { height: 32px; padding: 0 14px; border-radius: 9px; border: 0; background: none; cursor: pointer; color: var(--text-2); font-size: 12.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--elev-2); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.seg button { height: 34px; width: 38px; border: 0; background: transparent; color: var(--text-3); cursor: pointer; display: grid; place-items: center; }
.seg button.active { background: var(--elev-2); color: var(--gold); }

/* ---------- Forms ---------- */
.input, .select, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--bg-2); color: var(--text); font: inherit; font-size: 13px; transition: border-color .2s, box-shadow .2s;
}
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus { outline: none; border-color: var(--gold-line); box-shadow: 0 0 0 3px rgba(214, 173, 96, 0.1); }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239299A5' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.select option { background: var(--bg-2); }
input[type=date].input { color-scheme: dark; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 16px; height: 16px; pointer-events: none; }
.input-icon .input { padding-left: 36px; }
.toolbar .input-icon { min-width: 240px; flex: 1; max-width: 340px; }
.toolbar .select, .toolbar .input { width: auto; min-width: 140px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 11.5px; color: var(--text-2); font-weight: 500; letter-spacing: 0.02em; }
.field .hint { font-size: 11px; color: var(--text-3); }
.field.has-error .input, .field.has-error .select { border-color: rgba(241, 109, 117, 0.6); }
.field-error { font-size: 11px; color: var(--danger); }
.money-input { position: relative; }
.money-input::before { content: '₹'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gold); font-weight: 600; pointer-events: none; }
.money-input .input { padding-left: 28px; font-variant-numeric: tabular-nums; }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: var(--elev-2); border: 1px solid var(--line-2); cursor: pointer; transition: .25s; }
.switch span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-2); transition: .25s var(--ease); }
.switch input:checked + span { background: var(--gold-dim); border-color: var(--gold-line); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--gold); }
.dropzone { border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 22px; text-align: center; color: var(--text-2); cursor: pointer; transition: all .2s; background: var(--bg-2); }
.dropzone:hover, .dropzone.drag { border-color: var(--gold-line); color: var(--text); background: rgba(214, 173, 96, 0.04); }
.dropzone svg { width: 26px; height: 26px; color: var(--gold); margin-bottom: 6px; }
.dropzone small { display: block; font-size: 11px; color: var(--text-3); margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; color: var(--text-2); }
.check input { accent-color: var(--gold); width: 16px; height: 16px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 600; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3);
  padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--card); z-index: 1;
}
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text-2); }
.table th.sorted { color: var(--gold); }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.022); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .r, .r { text-align: right; }
.table .c { text-align: center; }
.table .amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; text-align: right; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main b { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.cell-main small { color: var(--text-3); font-size: 11.5px; }
.tx-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--elev); border: 1px solid var(--line); }
.tx-ic svg { width: 16px; height: 16px; }
.tx-ic.in { color: var(--success); background: var(--success-dim); border-color: transparent; }
.tx-ic.out { color: var(--danger); background: var(--danger-dim); border-color: transparent; }
.tx-ic.tr { color: var(--info); background: var(--info-dim); border-color: transparent; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: .6; transition: opacity .2s; }
tr:hover .row-actions { opacity: 1; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 12.5px; gap: 10px; flex-wrap: wrap; }
.pager .row { gap: 6px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 20px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-dim); color: var(--success); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-danger { background: var(--danger-dim); color: var(--danger); }
.badge-info { background: var(--info-dim); color: var(--info); }
.badge-muted { background: rgba(255, 255, 255, 0.05); color: var(--text-2); }
.badge-gold { background: var(--gold-dim); color: var(--gold-2); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11px; background: var(--elev); color: var(--text-2); border: 1px solid var(--line); white-space: nowrap; }

/* ---------- Progress ---------- */
.progress { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.progress span { display: block; height: 100%; width: var(--w); border-radius: 6px; animation: grow 1.1s var(--ease) both; }
@keyframes grow { from { width: 0; } }
.progress-gold span { background: linear-gradient(90deg, #A9843F, var(--gold), var(--gold-2)); }
.progress-warning span { background: var(--warning); }
.progress-danger span { background: var(--danger); }
.progress-success span { background: var(--success); }
.progress-info span { background: var(--info); }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item b { font-weight: 500; font-size: 13px; display: block; }
.list-item small { color: var(--text-3); font-size: 11.5px; }
.legend { display: flex; flex-direction: column; gap: 10px; }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.legend-row i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-row span { flex: 1; color: var(--text-2); }
.legend-row b { font-weight: 600; font-variant-numeric: tabular-nums; }
.legend-row em { font-style: normal; color: var(--text-3); width: 46px; text-align: right; font-size: 11.5px; }
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.stat-row:last-child { border-bottom: 0; }
.stat-row span { color: var(--text-2); }
.stat-row b { font-weight: 600; font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* ---------- Chart containers ---------- */
.chart { position: relative; height: 280px; width: 100%; }
.chart.sm { height: 200px; }
.chart.lg { height: 340px; }
.chart.xs { height: 140px; }
.chart canvas { animation: fadeIn 0.8s var(--ease) both; }
@keyframes fadeIn { from { opacity: 0; } }
.donut-wrap { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: center; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.donut-center b { display: block; font-size: 18px; font-weight: 600; }
.donut-center small { font-size: 10.5px; color: var(--text-3); letter-spacing: .12em; text-transform: uppercase; }

/* ---------- Empty / skeleton ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--text-2); }
.empty-ic { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: var(--elev); border: 1px solid var(--line); color: var(--gold); }
.empty h4 { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty p { font-size: 13px; margin-bottom: 14px; }
.skeleton-wrap { display: flex; flex-direction: column; gap: 12px; }
.skeleton { height: 44px; border-radius: 10px; background: linear-gradient(90deg, var(--elev) 0%, var(--elev-2) 50%, var(--elev) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
.loading-bar { position: fixed; top: 0; left: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--gold), var(--gold-2)); z-index: 999; width: 0; opacity: 0; transition: width .5s var(--ease), opacity .3s; }
.loading-bar.on { opacity: 1; width: 70%; }
.loading-bar.done { width: 100%; opacity: 0; }

/* ---------- Modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 4, 6, 0.72); backdrop-filter: blur(6px); animation: fadeIn .25s both; }
.modal {
  position: relative; width: 100%; max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  background: linear-gradient(180deg, #19202A, #141920); border: 1px solid var(--line-2); border-radius: 20px; box-shadow: var(--shadow-lg);
  animation: modalIn 0.38s var(--ease) both;
}
.modal-sm { max-width: 420px; } .modal-md { max-width: 600px; } .modal-lg { max-width: 860px; } .modal-xl { max-width: 1120px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
.modal-wrap.out .modal { animation: modalOut .22s ease both; }
.modal-wrap.out .modal-backdrop { animation: fadeOut .22s both; }
@keyframes modalOut { to { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes fadeOut { to { opacity: 0; } }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.modal-head p { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.confirm-body { text-align: center; padding: 8px 4px; }
.confirm-body p { color: var(--text-2); margin-top: 12px; }
.confirm-ic { width: 52px; height: 52px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; background: var(--gold-dim); color: var(--gold); }
.confirm-ic.danger { background: var(--danger-dim); color: var(--danger); }
.detail-hero { display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); margin-bottom: 18px; }
.detail-hero .big { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv span { color: var(--text-2); }
.kv b { font-weight: 500; text-align: right; }

/* ---------- Toasts ---------- */
#toast-root { position: fixed; right: 24px; bottom: 24px; z-index: 400; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 12px; min-width: 300px; max-width: 400px; padding: 14px 14px 14px 16px;
  background: #1A212B; border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-lg); animation: toastIn .4s var(--ease) both;
}
.toast.out { animation: toastOut .26s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }
.toast-ic { color: var(--gold); margin-top: 1px; }
.toast-success .toast-ic { color: var(--success); }
.toast-error .toast-ic { color: var(--danger); }
.toast-warning .toast-ic { color: var(--warning); }
.toast-body { flex: 1; display: flex; flex-direction: column; font-size: 13px; }
.toast-body strong { font-weight: 600; margin-bottom: 1px; }
.toast-body span { color: var(--text-2); }
.toast-x { background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 0; }

/* ---------- Dropdowns / panels ---------- */
.panel {
  position: fixed; top: calc(var(--topbar) - 6px); right: 20px; z-index: 120; width: 400px; max-height: calc(100vh - 100px);
  background: #161C25; border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow-lg);
  display: none; flex-direction: column; overflow: hidden; animation: modalIn .3s var(--ease) both;
}
.panel.open { display: flex; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel-head h4 { font-size: 14px; }
.panel-body { overflow-y: auto; }
.notif { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .2s; position: relative; }
.notif:hover { background: rgba(255, 255, 255, 0.025); }
.notif.unread::after { content: ''; position: absolute; right: 18px; top: 20px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.notif-ic { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--elev); }
.notif-ic.warning { color: var(--warning); background: var(--warning-dim); }
.notif-ic.success { color: var(--success); background: var(--success-dim); }
.notif-ic.danger { color: var(--danger); background: var(--danger-dim); }
.notif-ic.info { color: var(--info); background: var(--info-dim); }
.notif-ic.gold { color: var(--gold); background: var(--gold-dim); }
.notif b { font-size: 13px; font-weight: 500; display: block; padding-right: 16px; }
.notif p { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.notif small { font-size: 11px; color: var(--text-3); }
.notif:not(.unread) b { color: var(--text-2); }
.profile-panel { width: 320px; }
.profile-top { padding: 22px; text-align: center; border-bottom: 1px solid var(--line); background: radial-gradient(120% 90% at 50% 0%, rgba(214, 173, 96, 0.12), transparent 70%); }
.profile-top img { width: 84px; height: 84px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(214, 173, 96, 0.25); }
.profile-top h4 { font-family: var(--serif); font-size: 22px; margin-top: 10px; }
.profile-top p { color: var(--text-2); font-size: 12px; }
.menu { padding: 8px; }
.menu button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; border: 0; background: none; cursor: pointer; color: var(--text-2); font-size: 13px; text-align: left; }
.menu button:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.menu button.danger { color: var(--danger); }
.menu .sep { height: 1px; background: var(--line); margin: 6px 4px; }
.premium-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-2); border: 1px solid var(--gold-line); padding: 3px 10px; border-radius: 20px; margin-top: 10px; background: var(--gold-dim); }
.premium-badge svg { width: 12px; height: 12px; }

/* ---------- Command search ---------- */
.cmd-wrap { position: fixed; inset: 0; z-index: 300; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.cmd-wrap.open { display: flex; }
.cmd-wrap .modal-backdrop { animation: fadeIn .2s both; }
.cmd { position: relative; width: min(680px, calc(100vw - 32px)); background: #161C25; border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; animation: modalIn .3s var(--ease) both; }
.cmd-input { display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.cmd-input svg { color: var(--gold); }
.cmd-input input { flex: 1; height: 58px; background: none; border: 0; outline: none; color: var(--text); font: inherit; font-size: 16px; }
.cmd-results { max-height: 56vh; overflow-y: auto; padding: 8px; }
.cmd-group { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--text-3); padding: 10px 12px 6px; font-weight: 600; }
.cmd-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.cmd-item:hover, .cmd-item.sel { background: rgba(214, 173, 96, 0.08); }
.cmd-item .grow { flex: 1; min-width: 0; }
.cmd-item b { font-weight: 500; font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-item small { color: var(--text-3); font-size: 11.5px; }
.cmd-item .amt { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cmd-foot { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 11px; color: var(--text-3); }
mark { background: rgba(214, 173, 96, 0.25); color: var(--gold-2); border-radius: 3px; padding: 0 1px; }

/* ---------- Avatar ---------- */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; background: var(--elev-2); color: var(--gold-2); border: 1px solid var(--line-2); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 56px; height: 56px; font-size: 16px; }

/* ---------- Login / lock screen ---------- */
.login {
  position: fixed; inset: 0; z-index: 500; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg);
  transition: opacity .7s var(--ease), visibility .7s;
}
.login.hide { opacity: 0; visibility: hidden; }
.login-art {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 48px;
  background: radial-gradient(90% 70% at 30% 20%, rgba(214, 173, 96, 0.14), transparent 60%), linear-gradient(160deg, #0E1218, #07080B);
  border-right: 1px solid var(--line);
}
.login-art::after { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 64px 64px; mask-image: radial-gradient(80% 80% at 40% 40%, #000, transparent); pointer-events: none; }
.login-art .brand { padding: 0; position: relative; z-index: 1; }
.login-quote { position: relative; z-index: 1; max-width: 520px; }
.login-quote h2 { font-family: var(--serif); font-size: 52px; line-height: 1.04; font-weight: 600; }
.login-quote h2 em { color: var(--gold); font-style: italic; }
.login-quote p { color: var(--text-2); margin-top: 16px; font-size: 15px; max-width: 420px; }
.login-stats { display: flex; gap: 36px; position: relative; z-index: 1; }
.login-stats div b { display: block; font-size: 22px; font-weight: 600; }
.login-stats div span { font-size: 11px; color: var(--text-3); letter-spacing: .14em; text-transform: uppercase; }
.login-form { display: grid; place-items: center; padding: 40px; }
.login-box { width: min(380px, 100%); text-align: center; }
.login-box .avatar-xl { width: 128px; height: 128px; border-radius: 50%; margin: 0 auto 18px; box-shadow: 0 0 0 1px var(--gold-line), 0 0 0 10px rgba(214, 173, 96, 0.05), 0 30px 60px -20px rgba(214, 173, 96, 0.35); }
.login-box h3 { font-family: var(--serif); font-size: 30px; }
.login-box > p { color: var(--text-2); margin: 4px 0 26px; font-size: 13px; }
.login-box .field { text-align: left; margin-bottom: 12px; }
.login-box .btn { width: 100%; margin-top: 8px; }
.login-meta { margin-top: 20px; font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; justify-content: center; gap: 8px; }
.login-meta svg { width: 14px; height: 14px; color: var(--success); }
.bio-scan { position: relative; overflow: hidden; }
.bio-scan.scanning::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent); animation: scan 0.9s linear infinite; }
@keyframes scan { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- Mobile overlay ---------- */
.scrim { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 35; }

/* ---------- Presentation mode (core shell rules; scenes styled in presentation section) ---------- */
body.presenting .app { grid-template-columns: 0 1fr; }
body.presenting .sidebar { transform: translateX(-100%); }
body.presenting .topbar { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1440px) {
  .g-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-value { font-size: 22px; }
}
@media (max-width: 1200px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-2-1, .g-1-2, .g-3-2 { grid-template-columns: 1fr; }
  .date-pill { display: none; }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar); transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open .scrim { display: block; }
  .icon-btn.menu-btn { display: grid; }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
}
@media (max-width: 720px) {
  :root { --topbar: 64px; }
  .topbar { padding: 0 16px; gap: 8px; }
  .search-trigger { width: 40px; padding: 0; justify-content: center; margin-left: auto; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .avatar-btn span { display: none; }
  .avatar-btn { padding: 4px; }
  .crumbs small { display: none; }
  .btn-present { display: none !important; }
  .view { padding: 20px 16px 48px; }
  .page-head h1 { font-size: 28px; }
  .g-2, .g-3, .g-4, .g-5, .g-6 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .g-6.kpis, .g-4.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .donut-wrap { grid-template-columns: 1fr; }
  .panel { left: 12px; right: 12px; width: auto; }
  .toast { min-width: 0; }
  #toast-root { left: 16px; right: 16px; bottom: 16px; }
  .toolbar .input-icon { max-width: none; min-width: 100%; }
  .toolbar .select, .toolbar .input { flex: 1; min-width: 0; }
  .modal-wrap { padding: 0; align-items: end; }
  .modal { border-radius: 20px 20px 0 0; max-height: 92vh; }
  .kpi-value { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
body.compact .card { padding: 16px; }
body.compact .table td { padding: 9px 12px; }

/* Serif display figures: always lining numerals */
.page-head h1, .modal-head h3, .detail-hero .big, .kpi-value, [class*='-value'], [class*='-amt'], [class*='-val'], .pbiz-rev, .lux-val, .appr-amt, .teaser-amt { font-variant-numeric: lining-nums tabular-nums; }
