:root {
  --bg: #eef1f6;
  --bg-elev: #ffffff;
  --bg-soft: #f5f7fb;
  --bg-muted: #e8ecf3;
  --line: #d7dde8;
  --line-strong: #c3cbd8;
  --text: #0f172a;
  --muted: #5b6577;
  --faint: #8b95a8;
  --accent: #1d4ed8;
  --accent-2: #1e40af;
  --accent-soft: rgba(29, 78, 216, 0.1);
  --ok: #059669;
  --ok-soft: rgba(5, 150, 105, 0.1);
  --bad: #dc2626;
  --bad-soft: rgba(220, 38, 38, 0.1);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, 0.12);
  --info: #0284c7;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.05);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --display: "Manrope", "IBM Plex Sans", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sidebar: 248px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --nav-h: 68px;
  --touch: 44px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(29, 78, 216, 0.08), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(5, 150, 105, 0.06), transparent 50%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font-family: var(--mono); font-size: 0.9em; }
.hidden { display: none !important; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -3px;
}
.panel-h h2 .ico { margin-right: 6px; }

/* Gate */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate-card {
  width: min(420px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.gate-brand { margin-bottom: 22px; }
.gate-card h1 {
  font-family: var(--display);
  font-size: 1.7rem;
  margin: 0 0 8px;
  letter-spacing: -0.03em;
  font-weight: 800;
}
.gate-card form { display: grid; gap: 14px; margin-top: 18px; }
.error { color: var(--bad); margin-top: 12px; font-size: 0.9rem; }

/* App shell */
.app {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 8px;
}
.brand strong {
  display: block;
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  font-weight: 800;
}
.brand span { color: var(--muted); font-size: 0.8rem; }
.mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-family: var(--display);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--touch);
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.94rem;
}
.side-nav a:hover {
  color: var(--text);
  background: var(--bg-soft);
}
.side-nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
}
.side-foot { margin-top: auto; }

.main-wrap {
  min-width: 0;
  padding: 20px 28px 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}
.topbar h1 {
  font-family: var(--display);
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  margin: 0;
  letter-spacing: -0.04em;
  font-weight: 800;
}
.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.68rem;
  color: var(--accent);
  font-weight: 700;
}
.muted { color: var(--muted); font-size: 0.9rem; }
.topbar-actions { display: flex; gap: 8px; }

.view { display: none; }
.view.active { display: block; animation: fadeIn 0.22s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.btn:active { transform: scale(0.98); }
.btn.primary {
  border-color: transparent;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 6px 16px rgba(29, 78, 216, 0.25);
}
.btn.ghost { background: transparent; }
.btn.sm { padding: 8px 12px; font-size: 0.85rem; min-height: 36px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Forms */
.field {
  display: grid;
  gap: 6px;
}
.field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}
.field em {
  font-style: normal;
  color: var(--faint);
}
.field input,
.field select,
.field textarea,
textarea,
input:not([type="checkbox"]) {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  min-height: var(--touch);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus,
textarea:focus,
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea {
  resize: vertical;
  min-height: 240px;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.45;
}
.field.compact input { min-height: 40px; }
.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
}
.field-row.two-col { grid-template-columns: 1fr 1fr; }
.row-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.stack-form { display: grid; gap: 12px; }
.checkbox-field {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
}
.checkbox-field input { width: auto; min-height: auto; }

/* Toolbar / range */
.sticky-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 0 14px;
  padding: 14px 16px;
  background: rgba(238, 241, 246, 0.94);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.range-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.range-dates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.range-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.preset-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  background: var(--bg-muted);
  border-radius: 12px;
}
.preset-group .btn {
  background: transparent;
  border-color: transparent;
}
.preset-group .btn:hover {
  background: var(--bg-elev);
  border-color: var(--line);
}
.range-status {
  margin: 0;
  font-size: 0.82rem;
}

.day-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.day-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex: 1;
}
.day-ledger-toggle {
  min-width: 140px;
}
.day-ledger-toggle select {
  min-height: 36px;
  padding: 8px 10px;
}

.line-editor-table input[type="number"] {
  width: 100%;
  min-width: 88px;
  min-height: 36px;
  padding: 8px 10px;
}
.line-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: end center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.45);
}
.modal-card {
  width: min(520px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: calc(8px + var(--safe-b));
}
.add-line-results {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
}
.add-line-option {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
}
.add-line-option:hover,
.add-line-option.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

@media (min-width: 720px) {
  .modal { place-items: center; }
  .modal-card { margin-bottom: 0; }
}
.dash-stack {
  display: grid;
  gap: 14px;
}

/* KPIs */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.kpi-hero { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.kpi .label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi .value {
  font-family: var(--display);
  font-size: clamp(1.25rem, 2.4vw, 1.65rem);
  letter-spacing: -0.03em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.kpi .delta {
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.kpi .delta.up { color: var(--ok); }
.kpi .delta.down { color: var(--bad); }
.kpi .delta.flat { color: var(--muted); }

/* Panels */
.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.panel-h {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.panel-h h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
}
.panel-h .muted { margin: 4px 0 0; }
.metric-card h3 {
  margin: 0 0 12px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}
.metric-list {
  display: grid;
  gap: 10px;
}
.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  font-size: 0.92rem;
}
.metric-row strong {
  font-variant-numeric: tabular-nums;
  font-family: var(--display);
  font-weight: 800;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 14px;
  padding: 4px;
  background: var(--bg-muted);
  border-radius: 14px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 10px;
  white-space: nowrap;
  min-height: 40px;
  flex: 1 0 auto;
}
.tab.active {
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.2s ease; }

/* Collapse */
.collapse {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.collapse > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.98rem;
  min-height: var(--touch);
  user-select: none;
}
.collapse > summary::-webkit-details-marker { display: none; }
.collapse .chev { transition: transform 0.2s ease; color: var(--muted); }
.collapse[open] > summary .chev { transform: rotate(180deg); }
.collapse-body { padding: 0 16px 16px; }
.editor-hint { margin: 0 0 12px; }

/* Charts */
.chart-wrap { min-height: 180px; }
.chart-empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 28px 8px;
  text-align: center;
}
.line-chart {
  width: 100%;
  height: auto;
  display: block;
}
.bar-list { display: grid; gap: 10px; }
.bar-row { display: grid; gap: 6px; }
.bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.84rem;
}
.bar-meta strong { font-variant-numeric: tabular-nums; }
.bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--bg-muted);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  min-width: 2px;
}

.method-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  background: var(--bg-muted);
  color: var(--muted);
}
.method-chip.card { background: rgba(29, 78, 216, 0.12); color: #1d4ed8; }
.method-chip.cash { background: rgba(5, 150, 105, 0.12); color: #047857; }
.method-chip.transfer { background: rgba(124, 58, 237, 0.12); color: #6d28d9; }
.method-chip.other { background: rgba(100, 116, 139, 0.14); color: #475569; }

.expense-sections {
  display: grid;
  gap: 14px;
}
.expense-section .panel-h { margin-bottom: 4px; }

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--muted);
  white-space: nowrap;
}
.inline-check input { width: 16px; height: 16px; }

.dash-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
  align-items: start;
}
.dash-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 0;
}

/* Layouts */
.parse-grid,
.clients-grid,
.products-layout,
.calendar-layout {
  display: grid;
  gap: 14px;
  align-items: start;
}
.parse-grid { grid-template-columns: 1fr 1fr; }
.clients-grid { grid-template-columns: minmax(280px, 360px) 1fr; }
.products-layout { grid-template-columns: 1.2fr minmax(300px, 0.9fr); }
.products-side { display: grid; gap: 14px; }
.products-toolbar { margin-top: 0; margin-bottom: 12px; }
.calendar-layout { grid-template-columns: 1.4fr minmax(280px, 0.85fr); }
.calendar-toolbar { align-items: center; }
.calendar-nav { display: flex; gap: 8px; flex-wrap: wrap; }

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 0.82rem;
  color: var(--muted);
}
.cal-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}
.cal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: var(--faint);
}
.cal-dot.ok { background: var(--ok); }
.cal-dot.attention { background: var(--warn); }
.cal-dot.empty { background: var(--faint); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.cal-dow {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 0 0 4px;
}
.cal-cell {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 12px;
  min-height: 84px;
  padding: 10px 8px;
  text-align: left;
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}
.cal-cell:hover {
  border-color: var(--accent);
  background: #fff;
}
.cal-cell:active { transform: scale(0.98); }
.cal-cell.placeholder {
  opacity: 0.35;
  pointer-events: none;
  cursor: default;
}
.cal-cell.placeholder:hover,
.cal-cell.placeholder:active {
  border-color: var(--line);
  background: var(--bg-soft);
  transform: none;
}
.cal-cell.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  background: #fff;
}
.cal-cell.ok { background: var(--ok-soft); border-color: rgba(5, 150, 105, 0.28); }
.cal-cell.attention { background: var(--warn-soft); border-color: rgba(217, 119, 6, 0.3); }
.cal-cell.today .cal-daynum { color: var(--accent); }
.cal-daynum {
  font-family: var(--display);
  font-size: 1.1rem;
  letter-spacing: -0.03em;
  font-weight: 800;
  line-height: 1;
}
.cal-meta {
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.3;
}
.cal-badge {
  margin-top: auto;
  align-self: flex-start;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}
.cal-cell.ok .cal-badge { color: var(--ok); border-color: rgba(5, 150, 105, 0.28); }
.cal-cell.attention .cal-badge { color: var(--warn); border-color: rgba(217, 119, 6, 0.3); }

/* Tables */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 520px;
}
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
th {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: sticky;
  top: 0;
  background: var(--bg-elev);
}
td a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}
td a:hover { text-decoration: underline; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--bg-soft); }
.num { text-align: right; font-family: var(--display); font-weight: 700; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.pill.ok { color: var(--ok); background: var(--ok-soft); border-color: rgba(5, 150, 105, 0.2); }
.pill.bad { color: var(--bad); background: var(--bad-soft); border-color: rgba(220, 38, 38, 0.2); }
.pill.warn { color: var(--warn); background: var(--warn-soft); border-color: rgba(217, 119, 6, 0.22); }

.result-box {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 70vh;
  overflow: auto;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}
.result-box-sm { min-height: 80px; max-height: 240px; }

.issue-list { display: grid; gap: 8px; margin-bottom: 14px; }
.issue {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg-soft);
  font-family: var(--font);
  font-size: 0.88rem;
}
.issue .code { font-family: var(--mono); font-size: 0.78rem; color: var(--accent); }

.key-banner {
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(29, 78, 216, 0.25);
  background: var(--accent-soft);
}
.key-banner p { margin: 0 0 10px; font-size: 0.9rem; }
.key-banner code {
  display: block;
  word-break: break-all;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  font-size: 0.82rem;
}
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Mobile nav */
.mobile-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 6px 6px calc(6px + var(--safe-b));
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
  gap: 2px;
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.06);
}
.mobile-nav a {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 6px 2px;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.mobile-nav a .ico { width: 20px; height: 20px; }
.mobile-nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-grid.three { grid-template-columns: 1fr; }
  .kpi-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .parse-grid,
  .clients-grid,
  .products-layout,
  .calendar-layout { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .range-dates {
    grid-template-columns: 1fr 1fr;
  }
  .range-dates .field:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-wrap {
    padding: 14px 14px calc(var(--nav-h) + 18px + var(--safe-b));
  }
  .mobile-nav { display: flex; }
  .btn-label { display: none; }
  .topbar { align-items: center; margin-bottom: 12px; }
  .sticky-toolbar {
    top: 0;
    margin-left: -2px;
    margin-right: -2px;
    border-radius: 14px;
  }
  .cal-cell { min-height: 72px; padding: 8px 6px; }
  .cal-meta { display: none; }
  .field-row.two-col { grid-template-columns: 1fr; }
  .day-toolbar { align-items: stretch; }
  .day-nav { width: 100%; }
  .day-nav input[type="date"] { flex: 1; min-width: 0; }
}

@media (max-width: 560px) {
  .range-dates { grid-template-columns: 1fr; }
  .range-dates .field:last-child { grid-column: auto; }
  .range-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .preset-group {
    width: 100%;
  }
  .preset-group .btn {
    flex: 1;
  }
}

@media (max-width: 420px) {
  .kpi-hero,
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .mobile-nav a span { font-size: 0.58rem; }
}

@media (hover: none) {
  .side-nav a:hover,
  tr.clickable:hover td { background: transparent; }
}
