/* ==========================================================================
   Koveira — SaaS Analytics Dashboard (concept demo)
   Light premium theme · Indigo #4f46e5 · Inter · Mobile-first
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light;

  /* Brand */
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-100: #e0e7ff;
  --brand-50:  #eef2ff;
  --brand-soft: rgba(79, 70, 229, 0.08);

  /* Neutrals (slate) */
  --ink-900: #0f172a;
  --ink-800: #1e293b;
  --ink-700: #334155;
  --ink-600: #475569;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --ink-300: #cbd5e1;
  --line:     #e2e8f0;
  --line-soft: #eef1f6;
  --bg:       #f7f8fc;
  --surface:  #ffffff;

  /* Semantic */
  --success: #059669;  --success-soft: #ecfdf5;
  --warning: #d97706;  --warning-soft: #fffbeb;
  --danger:  #dc2626;  --danger-soft:  #fef2f2;
  --violet:  #7c3aed;
  --cyan:    #0891b2;
  --rose:    #e11d48;

  /* Spacing (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* Type */
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --fs-10: 10px;
  --fs-11: 11px;
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-17: 17px;
  --fs-18: 18px;
  --fs-26: 26px;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 10px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 14px 30px -10px rgba(15, 23, 42, 0.16);

  /* Layout */
  --sidebar-w: 264px;
  --sidebar-w-collapsed: 76px;
  --panel-pad: 20px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  line-height: 1.5;
  color: var(--ink-700);
  background:
    radial-gradient(1100px 480px at 88% -8%, rgba(79, 70, 229, 0.055), transparent 62%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--brand-600);
  outline-offset: 2px;
  border-radius: 4px;
}

.noscript {
  background: var(--warning-soft);
  color: var(--warning);
  font-size: var(--fs-13);
  font-weight: 600;
  text-align: center;
  padding: var(--space-3);
}

/* ---------- Icon button ---------- */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink-500);
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--bg); color: var(--ink-800); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- Backdrop (mobile nav) ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.backdrop.is-open { opacity: 1; visibility: visible; }

/* ---------- Layout ---------- */
.layout { min-height: 100vh; }

.main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 60;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: var(--space-4) var(--space-3) var(--space-4);
  background: var(--surface);
  border-right: 1px solid var(--line);
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow-lg); }

/* Head */
.sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-2);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  border-radius: var(--radius-md);
}
.brand__mark {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #4f46e5 55%, #4338ca);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
}
.brand__mark svg { width: 18px; height: 18px; }
.brand__name {
  font-size: var(--fs-17);
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

/* Nav */
.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-top: var(--space-4);
  overflow-y: auto;
}
.sidebar__group-label {
  padding: var(--space-2) var(--space-3);
  margin-top: var(--space-2);
  font-size: var(--fs-11);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-400);
  white-space: nowrap;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--fs-14);
  font-weight: 500;
  color: var(--ink-500);
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.nav-item svg { width: 20px; height: 20px; flex: none; }
.nav-item:hover { background: var(--bg); color: var(--ink-800); }
.nav-item.is-active {
  background: var(--brand-soft);
  color: var(--brand-700);
  font-weight: 600;
}

/* Foot */
.sidebar__foot { margin-top: auto; padding: var(--space-2) var(--space-1) 0; }
.concept-badge {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: var(--bg);
  font-size: var(--fs-12);
  font-weight: 500;
  color: var(--ink-500);
  white-space: nowrap;
}
.concept-badge__dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--warning);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ==========================================================================
   Topbar
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar__title h1 {
  font-size: var(--fs-18);
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.topbar__spacer { flex: 1; }

.topbar__search {
  order: 5;
  flex: 1 0 100%;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.topbar__search:focus-within {
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.topbar__search svg { width: 16px; height: 16px; flex: none; color: var(--ink-400); }
.topbar__search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font: inherit;
  font-size: var(--fs-13);
  color: var(--ink-800);
}
.topbar__search input::placeholder { color: var(--ink-400); }
.topbar__search input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Avatar */
.avatar {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid #fff;
  background: linear-gradient(135deg, #6366f1, #4338ca);
  color: #fff;
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 3px 8px rgba(79, 70, 229, 0.35);
}
.avatar--sm { width: 30px; height: 30px; font-size: var(--fs-10); border-width: 1px; box-shadow: none; }

/* Tinted avatar variants (table) */
.avatar.is-indigo  { background: var(--brand-50);   color: var(--brand-600); }
.avatar.is-emerald { background: var(--success-soft); color: var(--success); }
.avatar.is-amber   { background: var(--warning-soft); color: var(--warning); }
.avatar.is-violet  { background: #f5f3ff;            color: var(--violet); }
.avatar.is-cyan    { background: #ecfeff;            color: var(--cyan); }
.avatar.is-rose    { background: var(--danger-soft); color: var(--rose); }
.avatar.is-slate   { background: var(--line-soft);   color: var(--ink-600); }

/* ==========================================================================
   Content
   ========================================================================== */
.content {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ---------- Panels ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--panel-pad);
}
.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
}
.panel__head--row { align-items: center; }
.panel__head h2 {
  font-size: var(--fs-16);
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.02em;
}
.panel__sub {
  margin-top: 2px;
  font-size: var(--fs-12);
  color: var(--ink-400);
}
.panel__actions { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }

.link {
  font-size: var(--fs-13);
  font-weight: 600;
  color: var(--brand-600);
  transition: color 0.15s ease;
  white-space: nowrap;
}
.link:hover { color: var(--brand-700); text-decoration: underline; }

/* ---------- Segmented control ---------- */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
}
.segmented__btn {
  border: 0;
  background: none;
  padding: var(--space-1) var(--space-3);
  border-radius: calc(var(--radius-md) - 3px);
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--ink-500);
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.segmented__btn:hover { color: var(--ink-800); }
.segmented__btn.is-active {
  background: var(--surface);
  color: var(--brand-700);
  box-shadow: var(--shadow-xs), 0 0 0 1px var(--line);
}

/* ---------- Secondary button ---------- */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink-700);
  font-size: var(--fs-13);
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.btn-secondary:hover { background: var(--bg); border-color: var(--ink-300); }
.btn-secondary svg { width: 15px; height: 15px; }

/* ==========================================================================
   KPI cards
   ========================================================================== */
.kpis {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

.kpi-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.kpi-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}
.kpi-card__label { font-size: var(--fs-13); font-weight: 500; color: var(--ink-500); }
.kpi-card__icon {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
}
.kpi-card__icon svg { width: 18px; height: 18px; }
.kpi-card__icon.is-indigo { background: var(--brand-50); color: var(--brand-600); }
.kpi-card__icon.is-amber  { background: var(--warning-soft); color: var(--warning); }

.kpi-card__value {
  font-size: var(--fs-26);
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kpi-card__foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
}
.kpi-card__meta { display: flex; flex-direction: column; gap: var(--space-1); }

.trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--success);
  background: var(--success-soft);
  font-variant-numeric: tabular-nums;
}
.trend svg { width: 11px; height: 11px; }
.trend__period { font-size: var(--fs-12); color: var(--ink-400); }

.kpi-card__spark { width: 84px; height: 28px; flex: none; }

/* ==========================================================================
   Revenue chart
   ========================================================================== */
.chart { position: relative; height: 280px; }
.chart__svg { width: 100%; height: 100%; overflow: visible; }

.chart__svg .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart__svg .axis { font-size: 11px; font-weight: 500; fill: var(--ink-400); }
.chart__svg .line {
  stroke: var(--brand-600);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart__svg .area { opacity: 0; animation: fadeIn 0.6s ease 0.15s forwards; }
@keyframes fadeIn { to { opacity: 1; } }

.chart__svg .last-dot {
  fill: var(--brand-600);
  stroke: #fff;
  stroke-width: 2;
  filter: drop-shadow(0 2px 6px rgba(79, 70, 229, 0.45));
}
.chart__svg .hover { opacity: 0; transition: opacity 0.15s ease; }
.chart__svg .hover.is-on { opacity: 1; }
.chart__svg .hover__line { stroke: var(--ink-300); stroke-width: 1; stroke-dasharray: 4 4; }
.chart__svg .hover__dot { fill: var(--surface); stroke: var(--brand-600); stroke-width: 2.5; }

.chart__tooltip {
  position: absolute;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 88px;
  padding: var(--space-2) var(--space-3);
  background: var(--ink-900);
  color: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, calc(-100% - 14px));
  opacity: 0;
  transition: opacity 0.15s ease;
}
.chart__tooltip.is-visible { opacity: 1; }
.chart__tooltip.is-below { transform: translate(-50%, 14px); }
.chart__tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 8px;
  height: 8px;
  background: var(--ink-900);
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
}
.chart__tooltip.is-below::after { bottom: auto; top: -4px; }
.chart__tooltip .tip-label { font-size: 11px; font-weight: 500; color: var(--ink-300); }
.chart__tooltip .tip-value {
  font-size: var(--fs-14);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Transactions table
   ========================================================================== */
.table-wrap {
  overflow-x: auto;
  margin: 0 calc(var(--panel-pad) * -1);
  padding: 0 var(--panel-pad);
}
.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: var(--radius-full); }

.table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: var(--fs-13); }
.table th {
  text-align: left;
  padding: 0 0 var(--space-2);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-11);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-400);
  white-space: nowrap;
}
.table td {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.table tbody tr { transition: background 0.12s ease; }
.table tbody tr:hover { background: var(--bg); }
.table tbody tr:last-child td { border-bottom: 0; }
.table th + th, .table td + td { padding-left: var(--space-4); }

.cell-customer { display: flex; align-items: center; gap: var(--space-3); }
.cell-customer__name { font-weight: 600; color: var(--ink-800); white-space: nowrap; }
.cell-date { color: var(--ink-500); white-space: nowrap; }
.cell-amount {
  font-weight: 600;
  color: var(--ink-800);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Plan chip + dots */
.plan-chip { display: inline-flex; align-items: center; gap: var(--space-1); font-weight: 500; color: var(--ink-600); white-space: nowrap; }
.plan-chip__dot, .plan__dot { width: 8px; height: 8px; flex: none; border-radius: 50%; }
.is-basic { background: var(--ink-300); }
.is-pro   { background: var(--brand-600); }
.is-ent   { background: var(--violet); }

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--fs-12);
  font-weight: 600;
  white-space: nowrap;
}
.badge__dot { width: 6px; height: 6px; border-radius: 50%; }
.badge.is-paid     { background: var(--success-soft); color: var(--success); }
.badge.is-paid .badge__dot     { background: var(--success); }
.badge.is-pending  { background: var(--warning-soft); color: var(--warning); }
.badge.is-pending .badge__dot  { background: var(--warning); }
.badge.is-refunded { background: var(--danger-soft); color: var(--danger); }
.badge.is-refunded .badge__dot { background: var(--danger); }

.empty-state {
  padding: var(--space-8) 0;
  text-align: center;
  font-size: var(--fs-13);
  color: var(--ink-400);
}

/* ==========================================================================
   Top plans
   ========================================================================== */
.plans { list-style: none; display: flex; flex-direction: column; gap: var(--space-5); }
.plan__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.plan__name {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--ink-800);
}
.plan__tag {
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: var(--fs-10);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.plan__count { font-size: var(--fs-13); font-weight: 600; color: var(--ink-900); font-variant-numeric: tabular-nums; }
.plan__track {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--bg);
}
.plan__bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: var(--radius-full);
  animation: grow 0.9s cubic-bezier(0.25, 0.7, 0.25, 1) both;
}
@keyframes grow { from { width: 0; } }
.plan__bar.is-basic { background: var(--ink-300); }
.plan__bar.is-pro   { background: linear-gradient(90deg, var(--brand-600), #6366f1); }
.plan__bar.is-ent   { background: var(--violet); }
.plan__meta { margin-top: var(--space-2); font-size: var(--fs-12); color: var(--ink-400); }

.plans__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line-soft);
  font-size: var(--fs-13);
  color: var(--ink-500);
}
.plans__total { font-weight: 700; color: var(--ink-900); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Page footer
   ========================================================================== */
.page-foot {
  padding: var(--space-2) 0 var(--space-4);
  text-align: center;
  font-size: var(--fs-12);
  color: var(--ink-400);
}

/* ==========================================================================
   Responsive — mobile-first breakpoints
   ========================================================================== */

/* ---------- Small phones: hide Export button ---------- */
@media (max-width: 639px) {
  .export-btn { display: none; }
}

/* ---------- ≥640px: KPI grid 2-up ---------- */
@media (min-width: 640px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- ≥768px: tablet — icon-only sidebar, inline search ---------- */
@media (min-width: 768px) {
  :root { --panel-pad: 24px; }

  .sidebar {
    transform: none;
    width: var(--sidebar-w-collapsed);
  }
  .sidebar .brand__name,
  .sidebar .nav-item__label,
  .sidebar .sidebar__group-label,
  .sidebar .sidebar__foot { display: none; }
  .sidebar .sidebar__head { justify-content: center; }
  .sidebar .brand { justify-content: center; padding: 0; }
  .sidebar .nav-item { justify-content: center; padding: var(--space-2) 0; }
  .sidebar__collapse { display: none; }

  .main { margin-left: var(--sidebar-w-collapsed); }

  .topbar { flex-wrap: nowrap; }
  .topbar__burger { display: none; }
  .topbar__search { order: 0; flex: 0 1 240px; }

  .chart { height: 320px; }
  .content { padding: var(--space-5); gap: var(--space-5); }
  .kpi-card__value { font-size: 28px; }
}

/* ---------- ≥1024px: desktop — full sidebar with collapse ---------- */
@media (min-width: 1024px) {
  .sidebar { width: var(--sidebar-w); }
  .sidebar .brand__name,
  .sidebar .nav-item__label,
  .sidebar .sidebar__group-label,
  .sidebar .sidebar__foot { display: revert; }
  .sidebar .sidebar__head { justify-content: space-between; }
  .sidebar .brand { justify-content: flex-start; padding: var(--space-2); }
  .sidebar .nav-item { justify-content: flex-start; padding: var(--space-2) var(--space-3); }
  .sidebar__collapse { display: inline-grid; }
  .sidebar__collapse svg { transition: transform 0.25s ease; }
  .sidebar.is-collapsed .sidebar__collapse svg { transform: rotate(180deg); }

  .main { margin-left: var(--sidebar-w); transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1); }
  .sidebar.is-collapsed ~ .main { margin-left: var(--sidebar-w-collapsed); }

  /* Collapsed sidebar hides text content */
  .sidebar.is-collapsed { width: var(--sidebar-w-collapsed); }
  .sidebar.is-collapsed .brand__name,
  .sidebar.is-collapsed .nav-item__label,
  .sidebar.is-collapsed .sidebar__group-label,
  .sidebar.is-collapsed .sidebar__foot { display: none; }
  .sidebar.is-collapsed .sidebar__head { justify-content: center; }
  .sidebar.is-collapsed .brand { justify-content: center; padding: 0; }
  .sidebar.is-collapsed .nav-item { justify-content: center; padding: var(--space-2) 0; }
}

/* ---------- ≥1200px: KPI grid 4-up, two-column content row ---------- */
@media (min-width: 1200px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .grid-2 { grid-template-columns: minmax(0, 1fr) 340px; }
  .content { padding: var(--space-6); gap: var(--space-5); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
