:root {
  --bg: #eef4f7;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #dbe5ec;
  --text: #0f2742;
  --muted: #64748b;
  --orange: #f59e0b;
  --orange-dark: #ea7a00;
  --teal: #0f766e;
  --mint: #d9f5ef;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --blue-soft: #dbeafe;
  --shadow: 0 18px 45px rgba(15, 39, 66, 0.11);
  --radius: 24px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: radial-gradient(circle at 20% 0%, #fff8ec 0, transparent 28rem), var(--bg);
  color: var(--text);
  overflow-x: hidden;
}
body.theme-dark {
  --bg: #07111f;
  --surface: #0f1b2d;
  --surface-soft: #111f33;
  --line: #25364f;
  --text: #e8f0f8;
  --muted: #9eb0c5;
  --orange: #f59e0b;
  --orange-dark: #fbbf24;
  --teal: #2dd4bf;
  --mint: #133a34;
  --red-soft: #3c1717;
  --blue-soft: #17284c;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
  background: radial-gradient(circle at 20% 0%, rgba(245, 158, 11, 0.18) 0, transparent 28rem), var(--bg);
}

.app-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  background: rgba(255, 255, 255, 0.72);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  overflow-x: hidden;
}

.brand-logo-card {
  width: 100%;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--line);
  padding: 14px;
  box-shadow: 0 8px 22px rgba(15, 39, 66, 0.06);
}
.brand-logo-card img {
  display: block;
  width: min(210px, 100%);
  height: auto;
}
.login-logo { width: 100%; max-width: 100%; padding: 16px 18px; }
.login-logo img { width: min(260px, 100%); max-width: 100%; }

h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.25rem; line-height: 1.2; }
h2 { font-size: clamp(2rem, 4vw, 4.2rem); letter-spacing: -0.05em; line-height: 0.98; }
h3 { font-size: 1rem; }
.eyebrow {
  color: var(--orange-dark);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 800;
}
.subtle { color: var(--muted); line-height: 1.55; }

.nav-card, .note-card, .filter-card, .session-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 20px;
  padding: 12px;
  box-shadow: 0 8px 22px rgba(15, 39, 66, 0.06);
}
.nav-card { display: grid; gap: 4px; }
.nav-card a {
  color: var(--text);
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.9rem;
}
.nav-card a.active,
.nav-card a:hover { background: #fff5e5; color: #9a4e00; }
.nav-card a.coming-soon { color: #94a3b8; cursor: not-allowed; }
.nav-card a.coming-soon:hover { background: transparent; color: #94a3b8; }
.nav-card a.coming-soon::after { content: "Soon"; float: right; font-size: 0.68rem; color: #cbd5e1; margin-top: 2px; }
.note-card { display: grid; gap: 6px; margin-top: auto; }
.note-card span { color: var(--muted); font-size: 0.86rem; line-height: 1.45; }
.session-card { display: grid; gap: 10px; }
.session-card > span { color: var(--muted); font-size: 0.82rem; font-weight: 800; }
.sidebar-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compact-button { padding: 9px 10px; border-radius: 12px; font-size: 0.84rem; }
.filter-card { display: grid; gap: 12px; max-height: none; overflow: visible; }
.filter-heading { display: flex; align-items: center; justify-content: space-between; }
.filter-card label { display: grid; gap: 6px; color: var(--muted); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.filter-card select,
.filter-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
  font-size: 0.86rem;
  text-transform: none;
  letter-spacing: 0;
}
.filter-card select[multiple] { min-height: 86px; }
.date-filter-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.filter-help { color: var(--muted); font-size: 0.76rem; line-height: 1.35; margin-top: -6px; }
.filter-card details { border-top: 1px solid #edf2f7; padding-top: 8px; }
.filter-card summary { cursor: pointer; font-weight: 900; color: var(--text); margin-bottom: 8px; }
.filter-card details label { margin-top: 10px; }
.primary-button, .link-button {
  border: 0;
  cursor: pointer;
  font-weight: 900;
  font-family: inherit;
}
button:disabled { opacity: 0.62; cursor: not-allowed; }
.primary-button {
  border-radius: 14px;
  padding: 11px 14px;
  background: linear-gradient(90deg, var(--orange), #facc15);
  color: #fff;
  box-shadow: 0 10px 18px rgba(245, 158, 11, 0.25);
}
.link-button { background: transparent; color: var(--orange-dark); padding: 0; }

.content { padding: 34px; display: grid; gap: 22px; align-content: start; min-width: 0; overflow-x: hidden; }
.view-section { display: grid; gap: 22px; }
.hero {
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(15, 39, 66, 0.95), rgba(15, 118, 110, 0.9));
  color: #fff;
  padding: 36px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.hero::after {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  right: -70px;
  top: -110px;
  background: rgba(245, 158, 11, 0.24);
  border-radius: 999px;
}
.hero > * { position: relative; z-index: 1; }
.hero .subtle { color: rgba(255,255,255,0.76); max-width: 760px; margin-top: 14px; }
.hero-actions { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.pill {
  border: 1px solid rgba(15, 39, 66, 0.12);
  background: rgba(255,255,255,0.82);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}
.hero .pill { border-color: rgba(255,255,255,0.22); }
.pill-accent { background: var(--orange); color: #fff; border-color: var(--orange); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  min-width: 0;
}
.comparison-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.comparison-card {
  --comparison-accent: var(--teal);
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 92% 0%, rgba(245, 158, 11, 0.16), transparent 9rem),
    linear-gradient(135deg, rgba(255,255,255,0.98), rgba(248,250,252,0.94));
  border: 1px solid rgba(219, 229, 236, 0.95);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 14px;
  min-height: 255px;
}
.comparison-card.down { --comparison-accent: var(--red); }
.comparison-card.flat { --comparison-accent: #1d4ed8; }
.comparison-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--comparison-accent), var(--orange));
}
.comparison-card > * { position: relative; z-index: 1; }
.comparison-title {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 900;
}
.comparison-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: color-mix(in srgb, var(--comparison-accent) 12%, white);
  color: var(--comparison-accent);
  letter-spacing: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.7);
}
.comparison-current span,
.comparison-prior span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.74rem;
  font-weight: 900;
}
.comparison-current {
  border: 1px solid var(--line);
  border-left: 5px solid var(--comparison-accent);
  background: var(--surface);
  border-radius: 20px;
  padding: 16px;
  display: grid;
  gap: 7px;
  box-shadow: 0 10px 22px rgba(15, 39, 66, 0.05);
}
.comparison-current strong { font-size: clamp(1.55rem, 2.2vw, 2.25rem); letter-spacing: -0.05em; }
.comparison-current small { color: var(--muted); }
.comparison-prior {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.comparison-prior strong { white-space: nowrap; }
.comparison-card > .subtle { margin-top: -4px; font-size: 0.82rem; }
.comparison-card .delta { width: fit-content; margin-top: auto; }
.panel, .error-card, .loading-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(15, 39, 66, 0.07);
}
.kpi-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 22px;
  display: grid;
  gap: 13px;
  min-height: 178px;
  background:
    radial-gradient(circle at 92% 0%, rgba(245, 158, 11, 0.13), transparent 8rem),
    linear-gradient(135deg, rgba(255,255,255,0.98), rgba(248,250,252,0.94));
  border: 1px solid rgba(219, 229, 236, 0.95);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--teal), var(--orange));
}
.kpi-card > * { position: relative; z-index: 1; }
.kpi-card.clickable, .bar-row.clickable, tr.clickable, .movement-item.clickable, .chart-dot.clickable { cursor: pointer; }
.kpi-card.clickable:hover, .bar-row.clickable:hover, tr.clickable:hover, .movement-item.clickable:hover { transform: translateY(-2px); box-shadow: 0 20px 42px rgba(15, 39, 66, 0.14); border-color: rgba(245, 158, 11, 0.45); }
.kpi-card.clickable, .bar-row.clickable, tr.clickable, .movement-item.clickable { transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
.chart-dot.clickable:hover { stroke: var(--orange-dark); stroke-width: 4; }
.kpi-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.kpi-top .eyebrow { font-size: 0.68rem; letter-spacing: 0.16em; }
.kpi-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(245, 158, 11, 0.12);
  color: var(--orange-dark);
  font-size: 1.1rem;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.7);
}
.kpi-value { font-size: clamp(1.65rem, 2.25vw, 2.55rem); font-weight: 950; letter-spacing: -0.06em; line-height: 1.02; overflow-wrap: anywhere; }
.kpi-note { color: var(--muted); font-size: 0.84rem; line-height: 1.35; }
.kpi-card-detailed { min-height: 286px; align-content: start; }
.kpi-detail-current {
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  background: rgba(255,255,255,0.76);
  border-radius: 18px;
  padding: 14px;
  display: grid;
  gap: 6px;
}
.kpi-detail-current span,
.kpi-detail-prior span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.72rem;
  font-weight: 900;
}
.kpi-detail-current strong {
  font-size: clamp(1.45rem, 2.1vw, 2.25rem);
  letter-spacing: -0.05em;
  line-height: 1.02;
  overflow-wrap: anywhere;
}
.kpi-detail-current small { color: var(--muted); }
.kpi-detail-prior {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 15px;
  padding: 11px 13px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.kpi-detail-prior strong { white-space: nowrap; }
.kpi-card-detailed .delta { margin-top: auto; }
.delta { display: inline-flex; align-items: center; width: max-content; border-radius: 999px; padding: 6px 10px; font-size: 0.78rem; font-weight: 900; }
.delta.up { background: var(--mint); color: var(--teal); }
.delta.down { background: var(--red-soft); color: var(--red); }
.delta.flat { background: var(--blue-soft); color: #1d4ed8; }

.grid { display: grid; gap: 22px; }
.two-columns { grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr); }
.dashboard-section { display: grid; gap: 22px; padding-top: 10px; }
.section-heading {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  background:
    radial-gradient(circle at 94% 0%, rgba(15, 118, 110, 0.12), transparent 12rem),
    linear-gradient(135deg, rgba(255,255,255,0.98), rgba(248,250,252,0.94));
  border: 1px solid rgba(219, 229, 236, 0.95);
  padding: 28px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}
.section-heading::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--orange), var(--teal));
}
.section-heading > * { position: relative; z-index: 1; }
.section-heading h2 { font-size: clamp(1.8rem, 3vw, 3.1rem); color: var(--text); }
.section-heading .subtle { margin-top: 8px; }
.segmented-control { display: flex; gap: 6px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 999px; padding: 5px; }
.segmented-control button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}
.segmented-control button.active { background: var(--orange); color: #fff; box-shadow: 0 8px 14px rgba(245, 158, 11, 0.22); }
.compact-control { padding: 4px; }
.compact-control button { padding: 6px 9px; font-size: 0.76rem; }
.panel-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.panel { padding: 22px; min-width: 0; }
.large-panel { min-height: 420px; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }

.line-chart { min-height: 330px; }
.line-chart svg { width: 100%; height: 330px; display: block; overflow: visible; }
.axis-label { fill: var(--muted); font-size: 11px; }
.chart-grid { stroke: #e8eef4; stroke-width: 1; }
.revenue-line { fill: none; stroke: var(--orange); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.net-line { fill: none; stroke: var(--teal); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.gp-line { fill: none; stroke: var(--orange); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.margin-line { fill: none; stroke: var(--teal); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 6 5; }
.refund-line { fill: none; stroke: var(--red); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { stroke: #fff; stroke-width: 2; }
.legend { display: flex; gap: 16px; margin-top: 10px; color: var(--muted); font-size: 0.85rem; font-weight: 700; }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 99px; margin-right: 6px; vertical-align: -1px; }
.legend .revenue::before { background: var(--orange); }
.legend .net::before, .legend .margin::before { background: var(--teal); }
.legend .gp::before { background: var(--orange); }
.legend .refund::before { background: var(--red); }

.bar-list, .movement-list { display: grid; gap: 12px; }
.bar-row { display: grid; gap: 7px; }
.bar-meta { display: flex; justify-content: space-between; gap: 16px; font-size: 0.86rem; font-weight: 800; }
.bar-meta small { color: var(--muted); font-weight: 700; }
.track { height: 12px; background: #eef3f7; border-radius: 99px; overflow: hidden; }
.fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), #10b981); }
.fill.orange { background: linear-gradient(90deg, var(--orange), #facc15); }
.fill.red { background: linear-gradient(90deg, #ef4444, #f97316); }
.negative { color: var(--red); font-weight: 900; }
.compact .track { height: 10px; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; }
th, td { padding: 12px 10px; border-bottom: 1px solid #edf2f7; vertical-align: top; }
td:nth-child(3), td:nth-child(4), th:nth-child(3), th:nth-child(4) { text-align: right; }
td:nth-child(5), th:nth-child(5) { text-align: right; }
.table-wrap tr.clickable:hover { background: #fff7ed; }
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.admin-tabs button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 13px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 900;
  cursor: pointer;
}
.admin-tabs button.active { background: #fff5e5; border-color: #fed7aa; color: #9a4e00; }
.admin-tab-panel { display: grid; gap: 16px; }
.inline-select {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 260px;
}
.inline-select select {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  text-transform: none;
  letter-spacing: 0;
}
.ownership-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(200px, 0.8fr) minmax(200px, 0.8fr);
  gap: 12px;
  margin-bottom: 16px;
}
.ownership-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ownership-toolbar input,
.ownership-toolbar select {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  text-transform: none;
  letter-spacing: 0;
}
.ownership-table-wrap { max-height: 620px; }
.ownership-table { min-width: 1680px; }
.ownership-table th,
.ownership-table td { text-align: left; }
.ownership-table th:nth-child(n+9),
.ownership-table td:nth-child(n+9) { text-align: right; font-variant-numeric: tabular-nums; }
.ownership-table td:nth-child(3), .ownership-table td:nth-child(4) { max-width: 260px; }
.ownership-table strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }

.movement-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 12px; background: var(--surface-soft); border: 1px solid #edf2f7; border-radius: 16px; }
.movement-item strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.movement-item span { color: var(--muted); font-size: 0.8rem; }
.movement-value { font-weight: 900; color: var(--teal); }
.movement-value.negative { color: var(--red); }

.error-card { padding: 22px; background: #fff7ed; border-color: #fed7aa; }
.error-card pre { background: #0f2742; color: #fff; padding: 14px; border-radius: 14px; overflow: auto; }
.loading-card { padding: 18px 20px; display: flex; align-items: center; gap: 14px; }
.spinner { width: 28px; height: 28px; border: 4px solid #e8eef4; border-top-color: var(--orange); border-radius: 999px; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(440px, 100%); max-width: 440px; }
.login-card {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 30px;
  display: grid;
  gap: 20px;
}
.login-card > * { min-width: 0; }
.login-form { width: 100%; min-width: 0; display: grid; gap: 14px; }
.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.login-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 12px 13px;
  font: inherit;
  font-size: 0.95rem;
  text-transform: none;
  letter-spacing: 0;
}
.login-error { border: 1px solid #fecaca; background: var(--red-soft); color: var(--red); border-radius: 14px; padding: 10px 12px; font-weight: 800; }
body.theme-dark .sidebar { background: rgba(15, 27, 45, 0.74); }
body.theme-dark .hero { background: linear-gradient(135deg, rgba(10, 20, 34, 0.96), rgba(12, 80, 76, 0.9)); }
body.theme-dark .nav-card a.active,
body.theme-dark .nav-card a:hover,
body.theme-dark .admin-tabs button.active { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
body.theme-dark .pill { background: rgba(15, 27, 45, 0.86); color: var(--text); }
body.theme-dark .pill-accent { background: var(--orange); color: #fff; }
body.theme-dark .comparison-card,
body.theme-dark .kpi-card,
body.theme-dark .section-heading {
  background:
    radial-gradient(circle at 92% 0%, rgba(245, 158, 11, 0.12), transparent 9rem),
    linear-gradient(135deg, rgba(15, 27, 45, 0.98), rgba(17, 31, 51, 0.94));
  border-color: var(--line);
}
body.theme-dark .comparison-icon,
body.theme-dark .kpi-icon { background: rgba(255,255,255,0.08); box-shadow: none; }
body.theme-dark .kpi-detail-current { background: rgba(255,255,255,0.04); }
body.theme-dark .chart-grid { stroke: #1f3149; }
body.theme-dark .track { background: #18283d; }
body.theme-dark th,
body.theme-dark td { border-bottom-color: #1e3048; }
body.theme-dark .drilldown-table-wrap,
body.theme-dark .drilldown-drawer { background: var(--surface); }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 39, 66, 0.36);
  z-index: 30;
}
.drilldown-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(1080px, 92vw);
  background: var(--surface);
  z-index: 31;
  box-shadow: -22px 0 60px rgba(15, 39, 66, 0.22);
  transform: translateX(105%);
  transition: transform 0.2s ease;
  padding: 24px;
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr);
  gap: 16px;
  overflow: auto;
}
.drilldown-drawer.open { transform: translateX(0); }
.drawer-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.drawer-header h3 { font-size: 1.45rem; margin-top: 4px; }
.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip { border: 1px solid var(--line); background: var(--surface-soft); border-radius: 999px; padding: 7px 10px; font-size: 0.78rem; color: var(--muted); font-weight: 800; }
.filter-chip strong { color: var(--text); }
.drawer-status { border: 1px solid #fed7aa; background: #fff7ed; color: #9a4e00; border-radius: 14px; padding: 10px 12px; font-weight: 800; }
.drawer-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.drawer-total-card { border: 1px solid var(--line); background: var(--surface-soft); border-radius: 16px; padding: 12px; display: grid; gap: 5px; }
.drawer-total-card span { color: var(--muted); font-size: 0.76rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em; }
.drawer-total-card strong { font-size: 1.05rem; }
.drawer-total-card small { color: var(--muted); font-weight: 700; }
.drawer-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.drawer-tools label { display: grid; gap: 6px; color: var(--muted); font-size: 0.78rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.05em; }
.drawer-tools input {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  text-transform: none;
  letter-spacing: 0;
}
.secondary-button {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 14px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  font-family: inherit;
}
.drawer-section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.drawer-section-title h4 { margin: 0; }
.drawer-section-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
.drilldown-groups { display: grid; gap: 10px; }
.drilldown-group { border: 1px solid var(--line); border-radius: 18px; background: var(--surface-soft); overflow: hidden; }
.drilldown-group summary { cursor: pointer; list-style: none; padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.drilldown-group summary::-webkit-details-marker { display: none; }
.group-main strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-main span { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 3px; }
.group-metrics { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 0.82rem; font-weight: 800; text-align: right; }
.group-metrics strong { color: var(--text); display: block; font-size: 0.95rem; }
.drilldown-table-wrap { max-height: 360px; overflow: auto; border-top: 1px solid var(--line); background: #fff; }
.drilldown-table { min-width: 1900px; font-size: 0.78rem; }
.drilldown-table th, .drilldown-table td { padding: 8px 9px; }
.drilldown-table td.money, .drilldown-table th.money { text-align: right; font-variant-numeric: tabular-nums; }
.no-drilldown { padding: 16px; color: var(--muted); }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .comparison-card-grid { grid-template-columns: 1fr; }
  .two-columns { grid-template-columns: 1fr; }
  .drawer-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-heading { flex-direction: column; }
  .ownership-toolbar { grid-template-columns: 1fr; }
  .inline-select { min-width: 0; width: 100%; }
}
@media (max-width: 650px) {
  .content { padding: 18px; }
  .hero { flex-direction: column; padding: 26px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .comparison-card-grid { grid-template-columns: 1fr; }
  .drilldown-drawer { width: 100vw; padding: 18px; }
  .date-filter-grid { grid-template-columns: 1fr; }
  .drawer-tools { grid-template-columns: 1fr; }
  .drawer-totals { grid-template-columns: 1fr; }
  .drilldown-group summary { grid-template-columns: 1fr; }
  .group-metrics { text-align: left; flex-wrap: wrap; }
}
