/* Fixcell — monochrome, Apple-inspired theme taken from the logo (black, white, one electric-blue accent). */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fafafb;
  --ink: #0a0a0a;
  --text: #1d1d1f;
  --text-2: #424245;
  --muted: #6e6e73;
  --faint: #a1a1a6;
  --line: #e8e8ed;
  --line-2: #d2d2d7;
  --accent: #0071e3;
  --accent-2: #2997ff;
  --accent-soft: #e8f2fd;
  --accent-ink: #0058b0;
  --green: #1a8f4c;
  --green-mark: #30b660;
  --green-soft: #e8f6ee;
  --amber: #a65a00;
  --amber-mark: #f5a524;
  --amber-soft: #fff4e2;
  --orange: #c2410c;
  --orange-soft: #fff0e8;
  --red: #d42a20;
  --red-mark: #ff453a;
  --red-soft: #fdecea;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 24px rgba(0, 0, 0, .04);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .08);
  --side-w: 248px;
  --side-w-c: 76px;
  --top-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; letter-spacing: -0.005em; }
body.no-scroll { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5, h6 { margin: 0; letter-spacing: -0.02em; color: var(--text); }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.ic { flex: none; display: inline-block; vertical-align: -0.2em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 650; color: var(--text); }
.ok { color: var(--green); }
.bad { color: var(--red); }
.warn { color: var(--amber); }
.info { color: var(--accent); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.mt { margin-top: 20px; }
.mt-xs { margin-top: 4px; }
.row-gap { display: flex; gap: 8px; align-items: center; }
.row-gap.wrap { flex-wrap: wrap; }
.row-end { display: flex; justify-content: flex-end; }
.clamp { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; max-width: 280px; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: #0a0a0a; color: #f5f5f7;
  display: flex; flex-direction: column; z-index: 40; transition: width .22s ease, transform .22s ease;
}
.brand { display: block; padding: 18px 20px 6px; overflow: hidden; }
.brand img { display: block; width: 116px; height: 116px; margin: 0 auto; object-fit: cover; object-position: top; transition: width .22s, height .22s; }
.nav { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: none; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: #a1a1a6;
  font-weight: 500; font-size: 14px; white-space: nowrap; border: 0; background: none; cursor: pointer; width: 100%; text-align: left; position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav-item.active { background: #fff; color: #0a0a0a; }
.nav-item.active .nav-count { background: var(--red-mark); color: #fff; }
.nav-ic { display: inline-flex; width: 20px; justify-content: center; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }
.nav-count { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; line-height: 20px; text-align: center; padding: 0 6px; border-radius: 10px; background: rgba(255, 69, 58, .18); color: #ff6961; }
.sidebar-foot { padding: 10px 12px 16px; border-top: 1px solid rgba(255, 255, 255, .08); }
.app.collapsed .sidebar { width: var(--side-w-c); }
.app.collapsed .brand { padding: 14px 8px 4px; }
.app.collapsed .brand img { width: 56px; height: 46px; }
.app.collapsed .nav-label, .app.collapsed .nav-count { display: none; }
.app.collapsed .nav-item { justify-content: center; padding: 10px; }
.app.collapsed .collapse-btn .ic { transform: scaleX(-1); }
.app.collapsed .main { margin-left: var(--side-w-c); }
.main { flex: 1; min-width: 0; margin-left: var(--side-w); transition: margin-left .22s ease; }
.scrim { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 16px; padding: 0 28px;
  background: rgba(245, 245, 247, .82); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid rgba(0, 0, 0, .06);
}
.page-title { font-size: 19px; font-weight: 700; white-space: nowrap; }
.search { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.search input {
  width: 100%; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 40px 0 38px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0, 113, 227, .12); }
.search > .ic { position: absolute; left: 12px; top: 10px; color: var(--muted); }
.search kbd { position: absolute; right: 10px; top: 9px; font: 600 11px var(--font); color: var(--muted); border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 7px; background: var(--surface-2); }
.search-results {
  position: absolute; top: 46px; left: 0; right: 0; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); max-height: 70vh; overflow: auto; padding: 6px; z-index: 50;
}
.sr-group h6 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 10px 4px; }
.sr-group a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--text); }
.sr-group a:hover { background: var(--bg); text-decoration: none; }
.sr-group a span { flex: 1; min-width: 0; }
.sr-group a small { display: block; color: var(--muted); }
.sr-empty { padding: 20px; text-align: center; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.qa-wrap { position: relative; }
.qa-menu { position: absolute; right: 0; top: 48px; width: 260px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); padding: 6px; z-index: 50; }
.qa-menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: 10px; cursor: pointer; text-align: left; font-weight: 500; }
.qa-menu button:hover { background: var(--bg); }
.qa-menu button .ic { color: var(--text-2); }
.bell { position: relative; }
.bell em { position: absolute; top: 3px; right: 2px; font-style: normal; background: var(--red-mark); color: #fff; font-size: 10px; font-weight: 700; min-width: 17px; height: 17px; line-height: 17px; border-radius: 9px; padding: 0 4px; text-align: center; border: 2px solid var(--bg); box-sizing: content-box; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; font-weight: 650; font-size: 13px; cursor: pointer; }
.demo-banner { display: flex; align-items: center; gap: 10px; margin: 14px 28px 0; padding: 10px 14px; border-radius: 12px; background: #1d1d1f; color: #e8e8ed; font-size: 13px; }
.demo-banner a { margin-left: auto; color: #fff; font-weight: 600; white-space: nowrap; border: 1px solid rgba(255, 255, 255, .25); padding: 4px 10px; border-radius: 8px; }
.demo-banner .ic { color: var(--accent-2); }
.content { padding: 24px 28px 48px; max-width: 1560px; margin: 0 auto; outline: none; }
.mobile-only { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: 11px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; text-decoration: none !important;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #2a2a2d; }
.btn-ghost { background: var(--surface); border-color: var(--line-2); color: var(--text); }
.btn-ghost:hover { background: var(--bg); }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn.danger { color: var(--red); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; margin-top: 12px; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn-new { height: 38px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: rgba(0, 0, 0, .05); color: var(--text); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; color: var(--muted); }
.icon-btn.sm:hover { color: var(--text); background: var(--bg); }
.icon-btn.ok { color: var(--green); }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-weight: 550; display: inline-flex; gap: 4px; align-items: center; }
.link-btn.strong { color: var(--text); font-weight: 650; }
.link-btn.danger { color: var(--red); }
.link-btn.warn { color: var(--amber); }

/* ---------- Badges & chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #f0f0f3; color: var(--text-2); }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-orange { background: var(--orange-soft); color: var(--orange); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-blue { background: var(--accent-soft); color: var(--accent-ink); }
.badge-ink { background: #1d1d1f; color: #fff; }
.badge-ink i { background: #fff; }
.badge-slate { background: #eef0f3; color: #3f4651; }
.badge-muted { background: #f2f2f4; color: var(--faint); }
.chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 650; }
.chip-red { background: var(--red-soft); color: var(--red); }
.chip-amber { background: var(--amber-soft); color: var(--amber); }
.chip-green { background: var(--green-soft); color: var(--green); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: #f0f0f3; color: var(--muted); border: 0; cursor: default; margin-top: 6px; }
.tag.ok { background: var(--green-soft); color: var(--green); }
.tag.warn { background: var(--amber-soft); color: var(--amber); cursor: pointer; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 650; }
.delta em { font-style: normal; font-weight: 500; color: var(--muted); }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.delta.flat { color: var(--muted); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(0, 0, 0, .04); padding: 20px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head.pad { padding: 18px 20px 0; margin-bottom: 12px; }
.card-head h3 { font-size: 16px; font-weight: 700; }
.card-head a { font-size: 13px; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.card.dark { background: radial-gradient(120% 140% at 100% 0%, #1b2a44 0%, #0f1115 45%, #0a0a0a 100%); color: #f5f5f7; border: 0; box-shadow: 0 12px 40px rgba(0, 0, 0, .18); }
.card.dark h3 { color: #fff; }
.link-light { color: #a1c9ff !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
.grid-1-2 { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.grid-2-1.stretch { align-items: stretch; }
.progress-card { display: flex; flex-direction: column; }
.progress-card .progress-main { flex: 1; }
.nowrap { white-space: nowrap; }
.stack-badges { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.more-link { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 20px -20px -20px; padding: 12px; border-top: 1px solid var(--line); font-weight: 600; font-size: 13px; }
.more-link:hover { background: var(--surface-2); text-decoration: none; }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 26px; font-weight: 750; letter-spacing: -0.03em; }
.page-head p { margin: 4px 0 0; }

/* ---------- Dashboard ---------- */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.dash-head h2 { font-size: 24px; font-weight: 750; letter-spacing: -0.03em; }
.dash-head p { margin: 6px 0 0; display: flex; align-items: center; gap: 6px; }
.range-filter { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.seg { display: inline-flex; background: #e8e8ed; border-radius: 11px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 13px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.custom-range { display: flex; align-items: center; gap: 6px; }
.custom-range input, .date-range input { height: 34px; border: 1px solid var(--line-2); border-radius: 9px; padding: 0 8px; background: var(--surface); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi {
  display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(0, 0, 0, .04);
  color: var(--text); transition: transform .15s, box-shadow .15s; min-width: 0;
}
.kpi:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0, 0, 0, .04), 0 12px 32px rgba(0, 0, 0, .08); }
.kpi-top { display: flex; align-items: center; gap: 10px; }
.kpi-ic { width: 32px; height: 32px; border-radius: 9px; background: #f2f2f5; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); flex: none; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--text-2); line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kpi-go { margin-left: auto; color: var(--faint); opacity: 0; transition: opacity .15s; }
.kpi:hover .kpi-go { opacity: 1; }
.kpi-value { font-size: 28px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); min-height: 20px; }

.progress-card { padding: 22px 24px; }
.progress-main { display: flex; gap: 28px; align-items: center; margin: 4px 0 20px; }
.progress-figure { display: flex; flex-direction: column; flex: none; }
.progress-figure .big { font-size: 64px; font-weight: 750; letter-spacing: -0.05em; line-height: 1; font-variant-numeric: tabular-nums; background: linear-gradient(180deg, #fff 30%, #a9c8ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.progress-figure .big em { font-style: normal; font-size: 30px; margin-left: 2px; }
.progress-figure .cap { font-size: 12px; color: #a1a1a6; margin-top: 6px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.progress-bars { flex: 1; min-width: 0; }
.progress-bars p { margin: 0 0 10px; color: #d2d2d7; font-size: 15px; }
.progress-bars p b { color: #fff; }
.muted-light { color: #8e8e93; font-size: 13px; }
.sub-progress { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin: 16px 0 7px; color: inherit; }
.card.dark .sub-progress { color: #c7c7cc; }
.card.dark .sub-progress b { color: #fff; }
.pbar { height: 8px; border-radius: 99px; background: #ececf0; overflow: hidden; }
.card.dark .pbar { background: rgba(255, 255, 255, .1); }
.pbar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--ink); transition: width 1s cubic-bezier(.2, .8, .2, 1); }
.pbar.xl { height: 14px; }
.pbar.accent span { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.pbar.green span { background: linear-gradient(90deg, #1f9d55, #34c759); }
.pstats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.pstat { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); color: #fff; border: 1px solid rgba(255, 255, 255, .06); transition: background .15s; }
a.pstat[href]:hover { background: rgba(255, 255, 255, .12); text-decoration: none; }
.pstat b { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pstat small { color: #a1a1a6; font-size: 11.5px; font-weight: 500; }
.pstat.g b { color: #4ade80; }
.pstat.b b { color: #6cb4ff; }
.pstat.a b { color: #fbbf24; }
.pstat.r b { color: #ff6961; }

.cash-card .cf-hero { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
.cf-hero > div { display: flex; flex-direction: column; min-width: 0; }
.cf-hero .r { align-items: flex-end; text-align: right; }
.cf-hero small { font-size: 12px; color: var(--muted); font-weight: 550; }
.cf-hero b { font-size: 22px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.accent-text { color: var(--accent-ink); }
.cf-arrow { color: var(--faint); }
.cf-lines { margin: 12px 0; display: flex; flex-direction: column; }
.cf-line { display: flex; justify-content: space-between; align-items: center; padding: 7px 2px; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.cf-line span { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.cf-line b { font-variant-numeric: tabular-nums; }
.cf-line.in .ic { color: var(--green); }
.cf-line.out .ic { color: var(--red); }
.cf-line.muted .ic { color: var(--muted); }
.cf-digital { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cf-digital div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.cf-digital small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-digital b { font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.cf-total { margin-top: 12px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 14px; border-radius: 12px; background: #0a0a0a; color: #fff; }
.cf-total span { font-weight: 600; font-size: 13px; }
.cf-total span small { color: #8e8e93; font-weight: 500; }
.cf-total b { font-size: 17px; font-variant-numeric: tabular-nums; }
.cf-total em { grid-column: 1 / -1; font-style: normal; color: #8e8e93; font-size: 12px; }

.summary-line { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.summary-line b { color: var(--text); }
.row-actions { display: inline-flex; gap: 2px; justify-content: flex-end; }
.alerts-card { padding-bottom: 16px; }
.alert-list { display: flex; flex-direction: column; gap: 6px; }
.alert-item { display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); align-items: flex-start; }
.alert-item:hover { text-decoration: none; border-color: var(--line-2); }
.ai-ic { width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex: none; background: #eef0f3; color: var(--muted); }
.alert-item.p1 .ai-ic { background: var(--red-soft); color: var(--red); }
.alert-item.p2 .ai-ic { background: var(--amber-soft); color: var(--amber); }
.ai-body { min-width: 0; }
.ai-body b { display: block; font-size: 13px; font-weight: 600; }
.ai-body small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.mstat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mstat small { color: var(--muted); font-size: 12px; font-weight: 550; }
.mstat b { font-size: 24px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mstats.small-row { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.mstats.small-row b { font-size: 18px; }
.mstat .delta { flex-wrap: wrap; }
.mcompletion { margin: 6px 0 4px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; margin: 16px 0 6px; }
.chart-head h4 { font-size: 13px; color: var(--text-2); }
.legend { list-style: none; margin: 0; padding: 0; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); padding: 4px 0; }
.legend li i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend.inline { display: flex; gap: 14px; }
.legend li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend li b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.legend li em { font-style: normal; color: var(--muted); width: 36px; text-align: right; font-size: 12px; }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .grid.base { stroke: var(--line-2); }
.chart .ax { font-size: 10px; fill: var(--faint); font-family: var(--font); }
.chart .future { fill: var(--line); }
.chart .hit { cursor: default; }
.chart .hit.on path, .chart circle.hit.on { opacity: .85; }
.chart .hit.on rect:first-child { fill: rgba(0, 0, 0, .035); }
.tip { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 5; background: rgba(20, 20, 22, .95); color: #fff; padding: 8px 10px; border-radius: 9px; font-size: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); white-space: nowrap; display: flex; flex-direction: column; gap: 3px; }
.tip span { display: flex; align-items: center; gap: 6px; color: #d2d2d7; }
.tip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.donut-wrap { display: flex; gap: 20px; align-items: center; }
.donut { flex: none; }
.donut svg circle.hit { transition: opacity .15s; cursor: default; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center small { font-size: 11px; color: var(--muted); }
.donut-center b { font-size: 16px; font-weight: 750; letter-spacing: -0.02em; }
.donut-wrap .legend { flex: 1; min-width: 0; }

.incoming-card .inc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inc-grid div, .ih-stats div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.inc-grid small, .ih-stats small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 550; }
.inc-grid b, .ih-stats b { font-size: 19px; font-weight: 750; font-variant-numeric: tabular-nums; }
.inc-flags { display: flex; gap: 8px; margin: 10px 0; }
.flag { flex: 1; display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-size: 12.5px; }
.flag:hover { text-decoration: none; border-color: var(--line-2); }
.flag.amber { background: var(--amber-soft); border-color: #ffe2b0; color: var(--amber); }
.flag.red { background: var(--red-soft); border-color: #f8c9c5; color: var(--red); }
.inc-list { list-style: none; margin: 0; padding: 0; }
.inc-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 2px; border-top: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.inc-list li:hover { background: var(--surface-2); }
.inc-list small { display: block; color: var(--muted); font-size: 12px; }
.foot-note { color: var(--muted); font-size: 12px; margin: 22px 0 0; display: flex; align-items: center; gap: 6px; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl.compact td { padding: 8px 12px; }
.tbl.compact th { padding: 8px 12px; }
.tbl tr.clickable { cursor: pointer; }
.tbl tbody tr:hover td { background: #fbfbfd; }
.tbl tr.row-red td:first-child { box-shadow: inset 3px 0 0 var(--red-mark); }
.tbl tr.row-amber td:first-child { box-shadow: inset 3px 0 0 var(--amber-mark); }
.tbl tr.row-green td:first-child { box-shadow: inset 3px 0 0 var(--green-mark); }
.tbl tr.row-highlight td { background: var(--accent-soft); }
.card .tbl th:first-child, .card .tbl td:first-child { padding-left: 20px; }
.card .tbl th:last-child, .card .tbl td:last-child { padding-right: 20px; }
.deliveries-card .table-wrap { margin: 0 -20px -20px; width: calc(100% + 40px); }
.deliveries-card .tbl th { background: var(--surface-2); }
.dev { display: inline-flex; align-items: center; gap: 6px; font-weight: 550; }
.dev .ic { color: var(--muted); }
.list-meta { padding: 12px 20px; color: var(--muted); font-size: 12.5px; border-bottom: 1px solid var(--line); }
.sub-table { border-top: 1px solid var(--line); padding: 14px 0 0; }
.sub-table h4 { padding: 0 20px 10px; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.tbl.lines td, .tbl.lines th { padding: 6px; background: none; }
.tbl.lines input, .tbl.lines select { width: 100%; height: 34px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 8px; background: var(--surface); }
.tbl.lines td > input + select, .tbl.lines td > select + input { margin-top: 6px; }
.tbl.lines input.num { width: 90px; text-align: right; }
.tbl.lines .input-prefix input.num { width: 110px; }
.lines-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 13px; }
.empty, .error-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 40px 20px; color: var(--muted); text-align: center; }
.empty .ic { color: var(--faint); }
.empty p, .error-state p { margin: 0; }
.error-state .ic { color: var(--red); }
.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, #ececf0 25%, #f6f6f8 50%, #ececf0 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.page-loading { display: flex; justify-content: center; padding: 80px 0; }
.page-loading.small { padding: 30px 0; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--ink); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Toolbars & filters ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select, .toolbar .date-range input { height: 38px; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 10px; background: var(--surface); }
.search-box { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search-box .ic { position: absolute; left: 11px; top: 11px; color: var(--muted); }
.search-box input { width: 100%; height: 38px; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 12px 0 34px; background: var(--surface); outline: none; }
.search-box input:focus, .toolbar select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0, 113, 227, .12); outline: none; }
.date-range { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-chips.inline { margin: 0; }
.fchip { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; font-size: 13px; cursor: pointer; color: var(--text-2); white-space: nowrap; }
.fchip em { font-style: normal; font-size: 11.5px; color: var(--muted); background: #f0f0f3; padding: 1px 7px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.fchip:hover { border-color: var(--faint); }
.fchip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.fchip.on em { background: rgba(255, 255, 255, .18); color: #fff; }
.fchip.alert em { background: var(--red-soft); color: var(--red); }
.fchip.alert.on em { background: var(--red-mark); color: #fff; }
.tabs { display: inline-flex; background: #e8e8ed; border-radius: 11px; padding: 3px; overflow-x: auto; max-width: 100%; }
.tabs button { border: 0; background: none; padding: 7px 13px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.date-nav { display: flex; align-items: center; gap: 6px; }
.date-nav input { height: 38px; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 10px; background: var(--surface); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); border: 1px solid rgba(0, 0, 0, .04); }
.stat small { display: block; color: var(--muted); font-size: 12px; font-weight: 550; }
.stat b { font-size: 24px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat.g b { color: var(--green); }
.stat.a b { color: var(--amber); }
.stat.r b { color: var(--red); }
.stat.b b { color: var(--accent-ink); }

/* Purchases hero */
.incoming-hero { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.ih-title { display: flex; gap: 12px; align-items: center; min-width: 220px; }
.ih-title > .ic { width: 40px; height: 40px; padding: 10px; border-radius: 12px; background: var(--ink); color: #fff; box-sizing: border-box; }
.ih-stats { flex: 1; display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); gap: 10px; }
.ih-stats em { font-style: normal; font-size: 11.5px; color: var(--muted); margin-left: 4px; }
.ih-stats .amber { background: var(--amber-soft); border-color: #ffe2b0; }
.ih-stats .amber b { color: var(--amber); }
.ih-stats .red { background: var(--red-soft); border-color: #f8c9c5; }
.ih-stats .red b { color: var(--red); }

/* Cashbook ledger */
.ledger { display: flex; flex-direction: column; }
.ledger-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ledger-row span small { display: block; color: var(--muted); font-size: 11.5px; }
.ledger-row b { font-variant-numeric: tabular-nums; }
.ledger-row.in b { color: var(--green); }
.ledger-row.out b { color: var(--red); }
.ledger-row.head { font-weight: 600; }
.ledger-row.total { border-bottom: 0; margin-top: 6px; padding: 12px 14px; background: var(--ink); color: #fff; border-radius: 12px; }
.ledger-row.total b { color: #fff; font-size: 18px; }
.formula { font-size: 12px; color: var(--muted); margin: 12px 0 0; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; border: 1px dashed var(--line-2); }
.funds-flow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.funds-flow > div { flex: 1; min-width: 150px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.funds-flow > div.hl { background: var(--ink); color: #fff; border-color: var(--ink); }
.funds-flow > div.hl small { color: #a1a1a6; }
.funds-flow small { display: block; color: var(--muted); font-size: 12px; }
.funds-flow b { font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; }
.funds-flow > span { font-size: 20px; color: var(--faint); font-weight: 300; }
.top-cats { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.top-cats h4 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.tc { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13.5px; }

/* Reports */
.reports-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.report-list { padding: 10px; position: sticky; top: calc(var(--top-h) + 16px); }
.report-list h6 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 10px 4px; }
.report-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-weight: 550; font-size: 13.5px; color: var(--text-2); }
.report-list button:hover { background: var(--bg); }
.report-list button.on { background: var(--ink); color: #fff; }
.report-main .toolbar { justify-content: space-between; }
.report-summary { display: flex; gap: 10px; flex-wrap: wrap; padding: 0 20px 14px; }
.report-summary div { padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; min-width: 140px; }
.report-summary small { display: block; color: var(--muted); font-size: 12px; }
.report-summary b { font-size: 18px; font-variant-numeric: tabular-nums; }
.note { margin: 0 20px 14px; color: var(--muted); font-size: 12.5px; display: flex; gap: 6px; align-items: center; }

/* Settings */
.demo-card.on { border: 1px solid #1d1d1f; }
.audit-details { font-size: 11.5px; color: var(--muted); word-break: break-all; }

/* ---------- Overlays: modals & drawers ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; }
.overlay-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .32); opacity: 0; transition: opacity .2s; backdrop-filter: blur(2px); }
.overlay.open .overlay-backdrop { opacity: 1; }
.modal { position: absolute; left: 50%; top: 50%; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); transform: translate(-50%, -48%) scale(.98); opacity: 0; transition: transform .2s, opacity .2s; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.modal.wide { width: min(780px, calc(100vw - 32px)); }
.modal form { display: flex; flex-direction: column; min-height: 0; max-height: calc(100vh - 48px); }
.overlay.open .modal { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.modal-head, .drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 12px; }
.modal-head h2, .drawer-head h2 { font-size: 19px; font-weight: 700; }
.modal-head .sub, .drawer-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.modal-body { padding: 4px 22px 18px; overflow-y: auto; }
.modal-body p { margin: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; }
.drawer.wide { width: min(680px, 100vw); }
.drawer.instant { transition: none; }
.overlay.open .drawer { transform: none; }
.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 22px 14px; border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 40px; }
.drawer.sheet { top: auto; left: 0; width: 100%; border-radius: 20px 20px 0 0; transform: translateY(100%); max-height: 80vh; }
.overlay.open .drawer.sheet { transform: none; }
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qa-grid button { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); text-align: left; font-weight: 600; cursor: pointer; }
.detail-hero { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.detail-hero h3 { font-size: 18px; }
.dev-ic { width: 46px; height: 46px; border-radius: 13px; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.hero-badges { margin-left: auto; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.summary-strip.four { grid-template-columns: repeat(4, 1fr); }
.summary-strip div { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.summary-strip small { display: block; color: var(--muted); font-size: 11.5px; }
.summary-strip b { font-size: 17px; font-variant-numeric: tabular-nums; }
.dsec { margin-top: 18px; }
.dsec h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.dsec-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.dsec-head h4 { margin: 0; }
.kv { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.kv div { min-width: 0; }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.mini-list li > :first-child { flex: 1; min-width: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; position: relative; padding-bottom: 14px; }
.timeline li i { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); margin-top: 5px; flex: none; position: relative; z-index: 1; box-shadow: 0 0 0 3px #fff; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 4.5px; top: 12px; bottom: 0; width: 1px; background: var(--line-2); }
.timeline li:not(:first-child) i { background: var(--line-2); }
.timeline small { display: block; color: var(--muted); font-size: 12px; }
.contact-row { margin-bottom: 14px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 14px; }
.span-2 { grid-column: 1 / -1; }
.form-section { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; padding-top: 6px; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 12px; }
.form-section:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.req { color: var(--red); margin-left: 3px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; min-height: 40px; border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 11px; background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0, 113, 227, .12); }
.field input[readonly] { background: var(--surface-2); color: var(--muted); }
.input-prefix { position: relative; display: flex; }
.input-prefix span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-prefix input { padding-left: 26px !important; }
.hint { color: var(--muted); font-size: 12px; }
.hint .ok { color: var(--green); }
.hint .bad { color: var(--red); }
.err { color: var(--red); font-size: 12px; font-weight: 550; }
.err:empty { display: none; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--red) !important; box-shadow: 0 0 0 4px rgba(212, 42, 32, .1) !important; }
.form-error { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--red-soft); color: var(--red); font-weight: 550; font-size: 13px; margin-bottom: 14px; }
.check { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 550; cursor: pointer; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.check .hint, .check .err { width: 100%; }
.segmented { display: flex; background: #eeeef1; border-radius: 10px; padding: 3px; gap: 2px; }
.segmented label { flex: 1; position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; text-align: center; padding: 7px 8px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }

/* Notifications panel */
.notif-panel { position: fixed; top: calc(var(--top-h) - 4px); right: 20px; width: min(420px, calc(100vw - 24px)); max-height: min(640px, calc(100vh - 90px)); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); z-index: 60; display: flex; flex-direction: column; overflow: hidden; }
.np-head { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 18px 10px; border-bottom: 1px solid var(--line); }
.np-head h3 { font-size: 16px; }
.np-list { overflow-y: auto; padding: 6px; }
.np-item { display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; color: var(--text); }
.np-item:hover { background: var(--bg); text-decoration: none; }
.np-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--faint); }
.np-item.p1 .np-dot { background: var(--red-mark); }
.np-item.p2 .np-dot { background: var(--amber-mark); }
.np-body { min-width: 0; }
.np-type { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; }
.np-body b { display: block; font-size: 13.5px; font-weight: 600; }
.np-body small { color: var(--muted); }

/* Toasts */
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: #1d1d1f; color: #fff; box-shadow: var(--shadow-lg); font-weight: 550; font-size: 13.5px; opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: none; }
.toast-success .ic { color: #4ade80; }
.toast-error { background: var(--red); }
.toast-info .ic { color: var(--accent-2); }

/* Bottom nav (mobile) */
.bottom-nav { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .kpi-value { font-size: 24px; }
  .pstats { grid-template-columns: repeat(3, 1fr); }
  .ih-stats { grid-template-columns: repeat(3, 1fr); }
  .grid-2-1 { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); }
}
@media (max-width: 1100px) {
  .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reports-layout { grid-template-columns: 1fr; }
  .report-list { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .report-list h6 { width: 100%; }
  .report-list button { width: auto; }
}
@media (max-width: 860px) {
  :root { --top-h: 56px; }
  .mobile-only { display: inline-flex !important; }
  .desktop-only { display: none !important; }
  .sidebar { transform: translateX(-100%); width: 272px !important; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 35; }
  .app.collapsed .nav-label, .app.collapsed .nav-count { display: inline; }
  .app.collapsed .nav-item { justify-content: flex-start; padding: 9px 12px; }
  .app.collapsed .brand img { width: 116px; height: 116px; }
  .collapse-btn { display: none !important; }
  .main, .app.collapsed .main { margin-left: 0; }
  .topbar { padding: 0 10px; gap: 6px; }
  .mobile-logo { width: 30px; height: 30px; border-radius: 8px; }
  .page-title { font-size: 17px; flex: 1; overflow: hidden; text-overflow: ellipsis; }
  .search { position: absolute; left: 10px; right: 10px; top: calc(var(--top-h) + 6px); max-width: none; display: none; }
  body.search-open .search { display: block; }
  .search input { height: 44px; box-shadow: var(--shadow-lg); }
  .content { padding: 16px 16px 100px; }
  .demo-banner { margin: 10px 16px 0; font-size: 12px; align-items: flex-start; }
  .demo-banner a { margin-left: 0; }
  .dash-head h2 { font-size: 20px; }
  .range-filter { width: 100%; justify-content: flex-start; }
  .seg { width: 100%; overflow-x: auto; }
  .seg button { flex: 1; padding: 7px 8px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 22px; }
  .kpi-label { white-space: normal; font-size: 12.5px; line-height: 1.2; }
  .progress-main { flex-direction: column; align-items: stretch; gap: 14px; }
  .progress-figure .big { font-size: 52px; }
  .pstats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .pstat { padding: 10px; }
  .pstat b { font-size: 19px; }
  .cf-digital { grid-template-columns: 1fr 1fr; }
  .mstats { grid-template-columns: 1fr 1fr; gap: 14px; }
  .grid-2 { grid-template-columns: 1fr; }
  .donut-wrap { flex-direction: column; align-items: stretch; }
  .donut { margin: 0 auto; }
  .ih-stats { grid-template-columns: 1fr 1fr; }
  .page-head h2 { font-size: 22px; }
  .page-head .row-gap { flex-wrap: wrap; }
  .search-box { max-width: none; min-width: 100%; }
  .toolbar select { flex: 1; min-width: 140px; }
  .funds-flow > span { display: none; }

  /* Tables become stacked cards on phones. */
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { padding: 12px 16px; border-bottom: 1px solid var(--line); position: relative; }
  .tbl td { border: 0 !important; padding: 3px 0 !important; display: flex; justify-content: space-between; gap: 12px; text-align: right; background: none !important; }
  .tbl td > .cv { text-align: right; min-width: 0; }
  .tbl td > .cv .stack-badges { align-items: flex-end; }
  .tbl td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 550; text-align: left; flex: none; }
  .tbl td[data-label=""]::before { content: none; }
  .tbl td:first-child { font-size: 15px; }
  .tbl tr.row-red, .tbl tr.row-amber, .tbl tr.row-green { box-shadow: inset 3px 0 0 var(--red-mark); }
  .tbl tr.row-amber { box-shadow: inset 3px 0 0 var(--amber-mark); }
  .tbl tr.row-green { box-shadow: inset 3px 0 0 var(--green-mark); }
  .tbl tr td:first-child { box-shadow: none !important; }
  .tbl .row-actions { justify-content: flex-end; }
  .tbl.lines tr { padding: 8px 0; }
  .clamp { max-width: 200px; }
  .deliveries-card .table-wrap { margin: 0 -20px -20px; }

  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 45; background: rgba(10, 10, 10, .94); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; align-items: center; }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: #8e8e93; font-size: 10.5px; font-weight: 600; padding: 4px 8px; min-width: 56px; text-decoration: none; }
  .bottom-nav a.active { color: #fff; }
  .bottom-nav .fab { width: 50px; height: 50px; border-radius: 16px; border: 0; background: #fff; color: #0a0a0a; display: inline-flex; align-items: center; justify-content: center; margin-top: -18px; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
  .toasts { bottom: 86px; }
  .modal { top: auto; bottom: 0; left: 0; width: 100% !important; transform: translateY(100%); border-radius: 20px 20px 0 0; max-height: 92vh; }
  .modal form { max-height: 92vh; }
  .overlay.open .modal { transform: none; }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .summary-strip.four { grid-template-columns: 1fr 1fr; }
  .notif-panel { right: 12px; left: 12px; width: auto; }
}
@media (max-width: 380px) {
  .kpi-grid { gap: 10px; }
  .kpi-value { font-size: 20px; }
  .pstats { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
