/* ============================================================
   SELLERMARX Design System
   Tokens per "Complete UI/UX Improvement Specification" v1
   ============================================================ */
:root {
  --primary: #0B1F3A;    /* Brand Navy — sidebar, header, primary text */
  --secondary: #146BFF;  /* Primary Blue — primary actions, links, selected states */
  --success: #27D17F;    /* Profit Green — positive/healthy, not every primary action */
  --danger: #E5484D;     /* Danger Red — losses/errors/destructive actions */
  --warning: #F59E0B;    /* Warning Amber — review/warning states */
  --growth: #9BE51A;     /* Growth Lime — growth accents, upward indicators */
  --bg: #F5F7FA;         /* Surface — page background */
  --card: #FFFFFF;
  --text: #111827;
  --text-2: #6B7280;
  --border: #D9E0EA;
  --row-alt: #F9FAFB;
  --row-hover: #EFF6FF;
  --shadow: 0 4px 20px rgba(0,0,0,.05);
  --shadow-hover: 0 10px 30px rgba(0,0,0,.08);
  --radius: 18px;
  --radius-sm: 12px;
  /* legacy aliases used by templates */
  --navy: #0B1F3A;
  --navy-2: #146BFF;
  --red: #E5484D;
  --green: #27D17F;
}

.icon { display: inline-block; vertical-align: -3px; flex-shrink: 0; }
.side-ico .icon { vertical-align: -4px; width: 18px; height: 18px; }
.dept-icon .icon { width: 28px; height: 28px; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- header ---------------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  height: 64px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
}
.brand-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo-img { height: 34px; width: auto; display: block; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff; font-weight: 800; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
}
.logo-text { font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }
.logo-sub { color: var(--text-2); font-weight: 500; font-size: 13px; }
.topbar-right { margin-left: auto; display: flex; gap: 8px; }
.topbar-chip {
  background: #EFF6FF; color: var(--secondary);
  padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
}
.nav-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text); }

/* ---------------- sidebar ---------------- */
.sidebar {
  position: fixed; top: 64px; bottom: 0; left: 0; z-index: 50;
  width: 232px;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.side-section {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-2); padding: 14px 12px 6px;
}
.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 1px 0;
  border-radius: 10px;
  color: var(--text); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: background .15s;
}
.side-link:hover { background: var(--row-hover); }
.side-link.active { background: #EFF6FF; color: var(--secondary); font-weight: 600; }
.side-link.soon { color: var(--text-2); opacity: .6; cursor: default; }
.side-ico { width: 20px; text-align: center; font-size: 15px; }
.soon-tag {
  margin-left: auto; font-size: 10px; font-weight: 700; text-transform: uppercase;
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px;
}
.side-foot { margin-top: auto; padding: 14px 12px; font-size: 11.5px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.sidebar-collapse-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; margin-left: auto; border-radius: 8px;
  background: none; border: 1px solid var(--border); color: var(--text-2);
  cursor: pointer; font-size: 13px; flex-shrink: 0;
}
.sidebar-collapse-btn:hover { border-color: var(--secondary); color: var(--secondary); }

/* collapsed sidebar: icons + tooltips only */
body.sidebar-collapsed .sidebar { width: 64px; }
body.sidebar-collapsed .content { margin-left: 64px; }
body.sidebar-collapsed .side-section,
body.sidebar-collapsed .side-link span:not(.side-ico),
body.sidebar-collapsed .soon-tag,
body.sidebar-collapsed .side-foot-text { display: none; }
body.sidebar-collapsed .side-link { justify-content: center; padding: 9px; }
body.sidebar-collapsed .side-foot { justify-content: center; }
body.sidebar-collapsed .sidebar-collapse-btn { transform: rotate(180deg); margin-left: 0; }
@media (max-width: 900px) {
  body.sidebar-collapsed .sidebar { width: 232px; }
  body.sidebar-collapsed .content { margin-left: 0; }
  body.sidebar-collapsed .side-section, body.sidebar-collapsed .side-link span:not(.side-ico),
  body.sidebar-collapsed .soon-tag, body.sidebar-collapsed .side-foot-text { display: initial; }
  body.sidebar-collapsed .side-link { justify-content: flex-start; padding: 9px 12px; }
  body.sidebar-collapsed .side-foot { justify-content: flex-start; }
  body.sidebar-collapsed .sidebar-collapse-btn { transform: none; margin-left: auto; }
}

/* ---------------- main content ---------------- */
.content {
  margin-left: 232px;
  margin-top: 64px;
  padding: 32px;
  max-width: 1240px;
  animation: fadeUp .35s ease both;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; }
h2 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; margin: 32px 0 14px; }
.subtitle { color: var(--text-2); margin: 0 0 22px; font-size: 14.5px; }

.navlinks { margin: 2px 0 22px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.navlinks a { font-size: 13.5px; font-weight: 600; color: var(--secondary); text-decoration: none; }
.navlinks a:hover { text-decoration: underline; }
.navlinks a.active { color: var(--navy); text-decoration: underline; }

/* ---------------- cards ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 24px; }
.brand-card { display: block; text-decoration: none; color: inherit; }
.brand-card .card { margin-bottom: 0; }
.brand-card:hover .card { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: #c7d2fe; }

/* ---------------- department cards ---------------- */
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 24px; margin-top: 24px; }
.dept-card {
  background: var(--card); border: 1px solid var(--border); border-top: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 20px; text-align: center; text-decoration: none; color: inherit;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.dept-card.active:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: #c7d2fe; }
.dept-card.soon { opacity: .5; cursor: not-allowed; }
.dept-card.c-amazon { border-top-color: #16A34A; }
.dept-card.c-ebay { border-top-color: #2563EB; }
.dept-card.c-tiktok { border-top-color: #7C3AED; }
.dept-card.c-shein { border-top-color: #DB2777; }
.dept-card.c-temu { border-top-color: #F59E0B; }
.dept-card.c-shopify { border-top-color: #95BF47; }
.dept-icon { font-size: 36px; }
.dept-icon svg { width: 44px; height: 44px; display: inline-block; border-radius: 11px; vertical-align: middle; }
.dept-name { font-size: 17px; font-weight: 700; margin-top: 12px; }
.dept-desc { font-size: 12.5px; color: var(--text-2); margin-top: 5px; }

/* ---------------- KPI tiles ---------------- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-bottom: 8px; }
.tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.tile::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--secondary);
}
.tile .label, .tile .tile-label {
  font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-2);
}
.tile .value, .tile .tile-value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin-top: 8px; color: var(--text); font-variant-numeric: tabular-nums; }
.tile .sub, .tile .tile-sub { font-size: 12.5px; margin-top: 6px; color: var(--text-2); font-weight: 600; }
.tile.revenue::before { background: var(--primary); }
.tile.payout::before { background: var(--secondary); }
.tile.deductions::before { background: var(--danger); }
.tile.deductions .value { color: var(--danger); }
.tile.profit::before { background: var(--success); }
.tile.profit .value { color: var(--success); }
.tile.profit .value.neg, .tile.red .value { color: var(--danger); }
.tile.green::before { background: var(--success); }
.tile.red::before { background: var(--danger); }
.tile.navy::before { background: var(--primary); }
.tile.blue::before { background: var(--secondary); }

/* ---------------- tables ---------------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th {
  position: sticky; top: 64px; z-index: 5;
  background: var(--row-alt);
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-2);
}
.card th { top: 0; }
tbody tr:nth-child(even), table tr:nth-child(even) { background: var(--row-alt); }
table tr:hover td { background: var(--row-hover); }
tr.total-row td { font-weight: 700; background: #F0FDF4; }
td { font-variant-numeric: tabular-nums; }

/* ---------------- badges & pills ---------------- */
.pill, .badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.pill.mfn { background: #EFF6FF; color: var(--secondary); }
.pill.afn { background: #FEF2F2; color: var(--danger); }
.badge.finalized, .badge.completed { background: #F0FDF4; color: var(--success); }
.badge.pending, .badge.needs { background: #FFFBEB; color: var(--warning); }
.badge.draft { background: var(--bg); color: var(--text-2); }

.neg { color: var(--danger); }
.pos { color: var(--success); }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-block;
  background: var(--secondary);
  color: #fff;
  border: 1px solid var(--secondary);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px; font-weight: 600;
  text-decoration: none;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--primary); border-color: var(--primary); transform: scale(1.02); box-shadow: 0 4px 12px rgba(20,107,255,.25); }
.btn-secondary { background: var(--card); color: var(--secondary); border: 1px solid var(--secondary); }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }

/* ---------------- finalize checklist ---------------- */
.checklist-card { padding: 18px 22px; }
.checklist-title { font-weight: 700; margin-bottom: 12px; }
.checklist-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; flex-wrap: wrap; }
.btn-secondary:hover { background: #EFF6FF; color: var(--primary); box-shadow: none; }
.btn-tertiary {
  display: inline-block; background: none; color: var(--secondary); border: 1px solid transparent;
  padding: 10px 14px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 14px; font-weight: 600; text-decoration: none; transition: background .15s ease;
}
.btn-tertiary:hover { background: var(--row-hover); }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; box-shadow: 0 4px 12px rgba(229,72,77,.25); }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; border-radius: 9px;
  background: var(--card); color: var(--text-2); border: 1px solid var(--border);
  cursor: pointer; font-size: 15px; text-decoration: none; transition: border-color .15s ease, color .15s ease;
}
.btn-icon:hover { border-color: var(--secondary); color: var(--secondary); }
.btn[disabled], .btn-secondary[disabled], .btn-tertiary[disabled], .btn-danger[disabled] {
  opacity: .5; cursor: not-allowed; pointer-events: none;
}

/* ---------------- forms ---------------- */
form.stack label { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 13.5px; }
form.stack input[type=text], form.stack input[type=number], form.stack input[type=file],
input[type=text], input[type=number], input[type=password], select {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px;
  background: var(--card); color: var(--text); font-family: inherit;
}
form.stack input[type=text], form.stack input[type=number], form.stack input[type=file] { width: 100%; }
input:focus, select:focus { outline: 2px solid #BFDBFE; border-color: var(--secondary); }

.expense-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.expense-grid label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: var(--text-2); }
.expense-grid input { width: 100%; }

/* ---------------- toasts (flash) ---------------- */
.toasts { position: fixed; top: 76px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--text); color: #fff;
  padding: 12px 18px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover);
  font-size: 13.5px; max-width: 420px;
  animation: fadeUp .3s ease both;
  transition: opacity .5s ease, transform .5s ease;
}
.toast.hide { opacity: 0; transform: translateX(20px); }

/* ---------------- breakdown bars ---------------- */
.stackbar { display: flex; height: 32px; border-radius: 10px; overflow: hidden; margin-bottom: 20px; background: var(--bg); }
.stackbar-seg { height: 100%; min-width: 2px; }
.barchart { display: flex; flex-direction: column; gap: 10px; }
.barrow { display: grid; grid-template-columns: 210px 1fr 190px; align-items: center; gap: 12px; font-size: 13.5px; }
.barlabel { color: var(--text); font-weight: 500; }
.bartrack { background: var(--bg); border-radius: 999px; height: 12px; overflow: hidden; }
.barfill { height: 100%; border-radius: 999px; }
.barvalue { text-align: right; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.barpct { color: var(--text-2); font-weight: 500; font-size: 12px; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 13px; color: var(--text-2); }
.legend .key { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }

.trend-svg { width: 100%; height: auto; }

/* ---------------- accountant P&L ---------------- */
.pl-detail { width: 100%; }
.pl-detail td { padding: 8px 12px; font-size: 13.5px; }
.pl-detail .pl-amt { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pl-section td { background: #FFFBEB; font-weight: 700; color: #92400E; padding-top: 10px; padding-bottom: 10px; }
.pl-item { padding-left: 26px !important; }
.pl-total td { background: #F0FDF4; font-weight: 700; border-top: 1px solid #BBF7D0; }
.pl-grand td { background: var(--primary); color: #fff; font-weight: 700; font-size: 15px; padding-top: 12px; padding-bottom: 12px; }
.pl-grand.pl-loss td { background: var(--danger); }
.pl-grand .neg, .pl-total .neg { color: inherit; }
.pl-detail tr:hover td { background: inherit; }
.pl-section:hover td { background: #FFFBEB; }
.pl-total:hover td { background: #F0FDF4; }

.status-banner {
  background: #EFF6FF; border: 1px solid #BFDBFE; border-radius: var(--radius-sm);
  padding: 14px 18px; margin-bottom: 24px; font-size: 14px; color: var(--primary);
}
.helptext { color: var(--text-2); font-size: 13px; margin-top: 6px; line-height: 1.55; }

/* ---------------- filter toolbar + dropdown ---------------- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.filter-bar label.filter-label { font-size: 12.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; margin-right: 8px; }
.filter-bar select { min-width: 130px; cursor: pointer; }
.dropdown { position: relative; display: inline-block; }
.dropdown-toggle {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 14px; font-size: 14px; font-weight: 600; color: var(--text);
  cursor: pointer; user-select: none; transition: border-color .15s ease;
}
.dropdown-toggle:hover { border-color: var(--secondary); }
.dropdown-toggle .chev { color: var(--text-2); font-size: 11px; transition: transform .15s ease; }
.dropdown.open .dropdown-toggle .chev { transform: rotate(180deg); }
.dropdown-panel {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 20;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-hover); padding: 10px; min-width: 220px;
}
.dropdown.open .dropdown-panel { display: block; }
.dropdown-panel label.dropdown-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500; cursor: pointer; margin: 0;
}
.dropdown-panel label.dropdown-item:hover { background: var(--bg); }
.dropdown-panel .dropdown-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.dropdown-panel .dropdown-actions .btn { padding: 6px 14px; font-size: 12.5px; }

/* ---------------- compare-over-time table ---------------- */
.compare-table th, .compare-table td { text-align: right; }
.compare-table th:first-child, .compare-table td:first-child { text-align: left; }
.compare-table td.dept-net, .compare-table th.dept-net { font-variant-numeric: tabular-nums; }
.compare-table .dept-head { display: inline-flex; align-items: center; gap: 6px; }
.compare-table tr.grand-total td { border-top: 2px solid var(--primary); font-weight: 700; background: var(--bg); }

.chatlog { max-height: 480px; overflow-y: auto; }

/* ---------------- report header (period P&L page) ---------------- */
.report-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
}
.report-eyebrow { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.crumb { color: var(--text-2); text-decoration: none; font-weight: 600; }
.crumb:hover { color: var(--secondary); }
.crumb-sep { color: var(--border); }
.crumb-current { color: var(--text-2); font-weight: 600; }
.status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em; margin-left: 6px;
}
.status-pill.finalized { background: #F0FDF4; color: var(--success); }
.report-head h1 { margin-bottom: 2px; }
.report-head-nav { display: flex; gap: 8px; flex-shrink: 0; padding-top: 4px; }
.period-nav-btn {
  display: inline-block; padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: border-color .15s ease, background .15s ease;
}
.period-nav-btn:hover { border-color: var(--secondary); background: var(--row-hover); color: var(--secondary); }
.period-nav-btn.disabled { color: var(--text-2); opacity: .45; cursor: default; }

.action-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 26px; }
.dropdown-item-link {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500; color: var(--text); text-decoration: none;
}
.dropdown-item-link:hover { background: var(--bg); }

/* ---------------- breakdown table (merged bar + table) ---------------- */
.breakdown-table .dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 8px; vertical-align: 1px; }
.breakdown-table td, .breakdown-table th { padding: 9px 12px; }
.breakdown-table .bartrack { margin: 0; }

/* ---------------- stat chips (order data quality etc.) ---------------- */
.stat-chip-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 8px; }
.stat-chip {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px 18px; text-align: center;
}
.stat-chip-value { font-size: 24px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-chip-value.mfn { color: var(--secondary); }
.stat-chip-value.afn { color: var(--danger); }
.stat-chip-label { font-size: 12px; color: var(--text-2); font-weight: 600; margin-top: 4px; }

/* ---------------- empty / loading states ---------------- */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text-2);
}
.empty-state .empty-icon { font-size: 30px; margin-bottom: 10px; opacity: .7; }
.empty-state .empty-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.empty-state .empty-desc { font-size: 13.5px; max-width: 420px; margin: 0 auto; line-height: 1.55; }
.empty-state .empty-action { margin-top: 16px; }

.skeleton {
  background: linear-gradient(90deg, var(--row-alt) 25%, var(--border) 37%, var(--row-alt) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: 6px;
}
@keyframes skeleton-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------- data import center: source rows ---------------- */
.import-group-title {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-2); padding: 4px 4px 10px;
}
.source-row { display: flex; align-items: flex-start; gap: 14px; padding: 14px 4px; }
.source-row + .source-row { border-top: 1px solid var(--border); }
.source-icon {
  width: 36px; height: 36px; border-radius: 10px; background: var(--row-alt);
  display: flex; align-items: center; justify-content: center; color: var(--secondary); flex-shrink: 0;
}
.source-main { flex: 1; min-width: 0; }
.source-name { font-weight: 700; font-size: 14.5px; }
.source-desc { font-size: 12.5px; color: var(--text-2); margin-top: 3px; line-height: 1.5; }
.source-meta { font-size: 12px; color: var(--text-2); margin-top: 5px; }
.source-status { flex-shrink: 0; padding-top: 2px; }
.source-detail { margin: 0 0 4px 50px; }
.source-detail .edit-panel-toggle { font-size: 13px; padding: 4px 0 8px; }

/* ---------------- collapsible edit panel ---------------- */
.edit-panel { margin-top: 32px; }
.edit-panel-toggle {
  cursor: pointer; list-style: none; font-size: 14px; font-weight: 700; color: var(--secondary);
  padding: 10px 0; user-select: none;
}
.edit-panel-toggle::-webkit-details-marker { display: none; }
.edit-panel-toggle:before { content: "▸ "; display: inline-block; transition: transform .15s ease; }
.edit-panel[open] .edit-panel-toggle:before { content: "▾ "; }

/* ---------------- clearance dashboard: collapsible department groups ---------------- */
.clearance-group {
  background: #fff; border-radius: 12px; padding: 4px 18px; margin: 0 0 12px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04); border: 1px solid var(--border, #E5E7EB);
}
.clearance-group .edit-panel-toggle { display: flex; align-items: center; margin-top: 0; }
.clearance-group[open] { padding-bottom: 16px; }
.clearance-group > div { display: none; }
.clearance-group[open] > div { display: block; }
.compact-table { width: 100%; border-collapse: collapse; }
.compact-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-2); padding: 6px 10px; border-bottom: 1px solid var(--border, #E5E7EB); }
.compact-table td { padding: 7px 10px; font-size: 13.5px; border-bottom: 1px solid #F3F4F6; font-variant-numeric: tabular-nums; }
.compact-table tr:last-child td { border-bottom: none; }

/* ---------------- print / download PDF ---------------- */
.page-break { display: none; }
@media print {
  .sidebar, .topbar, .toasts, .no-print, .edit-panel, .report-head-nav, .helptext a { display: none !important; }
  .content { margin: 0; padding: 0; max-width: none; }
  body { background: #fff; font-size: 12px; }
  .card, .tile, .stat-chip { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .tiles, .stat-chip-row { break-inside: avoid; }
  h2 { break-after: avoid; }
  a[href]:after { content: ""; }
  .page-break { display: block; break-before: page; }
}

/* ---------------- responsive ---------------- */
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .expense-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-chip-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-hover); }
  .nav-toggle { display: block; }
  .content { margin-left: 0; padding: 20px 16px; }
  .logo-sub { display: none; }
}
@media (max-width: 700px) {
  .tiles { grid-template-columns: 1fr; }
  .expense-grid { grid-template-columns: 1fr; }
  .barrow { grid-template-columns: 1fr; gap: 4px; }
  .barvalue { text-align: left; }
  .btn { width: 100%; text-align: center; }
  .navlinks .btn { width: auto; }
}
