:root {
  --bg: #dfe1ea;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #ffffff;
  --line: rgba(91, 104, 138, 0.12);
  --text: #1a1d25;
  --muted: #7d8598;
  --accent: #1e57d8;
  --accent-soft: rgba(30, 87, 216, 0.12);
  --accent-lime: #c7f13b;
  --accent-dark: #151515;
  --warning: #d65a3a;
  --success: #20a464;
  --shadow: 0 20px 50px rgba(48, 59, 86, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Aptos", "Segoe UI Variable", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.55), transparent 26rem),
    linear-gradient(180deg, #dfe1ea 0%, #d9dbe6 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.topbar-title {
  margin: 0.2rem 0 0;
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  letter-spacing: -0.03em;
}

.nav-tabs {
  display: inline-flex;
  gap: 0.45rem;
  padding: 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

.nav-tab {
  color: var(--muted);
  text-decoration: none;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  font-weight: 700;
}

.nav-tab.is-active {
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 8px 20px rgba(48, 59, 86, 0.08);
}

.hero {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr auto;
  align-items: end;
  padding: 1.5rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(250, 251, 255, 0.92));
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.hero--simple {
  grid-template-columns: 1fr auto;
}

.hero-title {
  margin: 0;
  max-width: 18ch;
  font-size: clamp(2rem, 4vw, 3.35rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-weight: 800;
}

.hero-copy-block {
  display: grid;
  gap: 0.7rem;
}

.live-status {
  display: flex;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -5rem -5rem auto;
  width: 16rem;
  height: 16rem;
  border-radius: 999px;
  background: rgba(30, 87, 216, 0.06);
}

.eyebrow {
  margin: 0 0 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
}

.hero h1,
.dialog-heading h2,
.panel h2 {
  margin: 0;
  font-family: inherit;
  letter-spacing: -0.03em;
}

.hero-copy {
  max-width: 52rem;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.hero-actions,
.dialog-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-btn,
.ghost-btn,
.icon-btn {
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-btn:hover,
.ghost-btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  padding: 0.9rem 1.3rem;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.ghost-btn {
  padding: 0.9rem 1.3rem;
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.icon-btn {
  width: 2.4rem;
  height: 2.4rem;
  background: transparent;
  color: var(--text);
  border-color: var(--line);
  font-size: 1.35rem;
}

.dashboard {
  display: grid;
  gap: 1rem;
}

.panel,
.kpi-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.panel {
  padding: 1.1rem;
}

.panel--feature {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 247, 255, 0.92));
}

.panel--warning {
  border-color: rgba(214, 90, 58, 0.22);
  background: linear-gradient(180deg, rgba(255, 248, 246, 0.94), rgba(255, 255, 255, 0.94));
}

.panel-heading {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.9rem;
}

.panel-heading--stack {
  align-items: start;
}

.panel-note,
.warning-copy {
  color: var(--muted);
  font-size: 0.9rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  background: rgba(214, 90, 58, 0.1);
  color: var(--warning);
  padding: 0.4rem 0.7rem;
  font-size: 0.84rem;
  font-weight: 700;
}

.warning-list {
  display: grid;
  gap: 0.65rem;
}

.warning-item {
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(159, 47, 18, 0.12);
}

.kpi-grid,
.analytics-grid,
.dual-grid,
.spotlight-grid {
  display: grid;
  gap: 1rem;
}

.spotlight-grid {
  grid-template-columns: 1.25fr;
  align-items: stretch;
}

.kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi-card {
  padding: 1.15rem;
}

.kpi-label {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
}

.kpi-value {
  margin: 0.5rem 0 0.35rem;
  font-size: clamp(1.7rem, 3vw, 2.8rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}

.kpi-subtext {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.filters {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 2fr repeat(3, 1fr) 1.2fr;
}

.filters label,
.record-form label,
.textarea-label {
  display: grid;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.92rem;
}

.filters input,
.filters select,
.record-form input,
.record-form select,
.record-form textarea {
  width: 100%;
  padding: 0.85rem 0.9rem;
  border-radius: 0.95rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

.checkbox {
  align-content: center;
  grid-template-columns: auto 1fr;
  gap: 0.65rem;
}

.checkbox input {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.1rem;
}

.analytics-grid {
  grid-template-columns: 1.05fr 1.05fr 0.9fr;
}

.dual-grid {
  grid-template-columns: 1.1fr 0.9fr;
}

.bar-list,
.bar-row {
  display: grid;
  gap: 0.35rem;
}

.analytics-grid--dashboard .bar-row {
  gap: 0.28rem;
}

.benchmark-chart {
  display: grid;
  gap: 0.65rem;
}

.benchmark-summary {
  display: flex;
  gap: 1rem;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
}

.benchmark-current {
  display: grid;
  gap: 0.18rem;
}

.benchmark-label {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.benchmark-value {
  font-size: 1.95rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.benchmark-value-inline {
  display: inline-block;
  margin-left: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0;
  vertical-align: middle;
}

.benchmark-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.benchmark-track {
  display: flex;
  height: 1rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(125, 133, 152, 0.12);
}

.benchmark-fill {
  background: linear-gradient(90deg, var(--accent), #5f89ea);
}

.benchmark-fill--inactive {
  background: rgba(125, 133, 152, 0.3);
}

.benchmark-legend {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.benchmark-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.48rem 0.65rem;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
}

.benchmark-legend-label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
}

.benchmark-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 999px;
  background: var(--accent);
}

.benchmark-dot--inactive {
  background: rgba(125, 133, 152, 0.7);
}

.benchmark-legend-value {
  font-weight: 800;
}

.investment-board {
  overflow-x: auto;
}

.investment-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.investment-toggle {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  padding: 0.45rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.investment-toggle.is-active {
  border-color: rgba(30, 87, 216, 0.18);
  background: rgba(30, 87, 216, 0.1);
  color: var(--accent);
}

.investment-table {
  width: 100%;
  min-width: 1160px;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.56);
}

.investment-table thead th {
  padding: 0.56rem 0.65rem;
  text-align: left;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
}

.investment-table thead tr:first-child th {
  font-size: 0.76rem;
}

.investment-table .group-head {
  text-align: center;
}

.investment-table tbody td {
  padding: 0.46rem 0.65rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.88rem;
  font-family: inherit;
}

.investment-table tbody tr:last-child td {
  border-bottom: 0;
}

.investment-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.18);
}

.investment-code {
  font-size: 0.88rem;
  font-weight: 800;
}

.investment-volume,
.investment-total {
  font-weight: 700;
  font-size: 0.88rem;
}

.investment-total {
  font-size: 0.88rem;
}

.investment-manual-cell {
  min-width: 130px;
}

.investment-display,
.investment-input,
.investment-select {
  width: 100%;
  padding: 0.42rem 0.58rem;
  border-radius: 0.7rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.3;
}

.investment-display {
  display: inline-block;
}

.investment-table--readonly .investment-display {
  width: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
}

.investment-table--readonly .investment-manual-cell {
  min-width: 110px;
}

.investment-actions {
  display: flex;
  justify-content: flex-end;
}

.investment-save {
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 0.38rem 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.investment-meta {
  display: block;
  margin-top: 0.22rem;
  color: var(--muted);
  font-size: 0.7rem;
}

.investment-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  height: 1.55rem;
  margin-right: 0.55rem;
  border-radius: 999px;
  background: rgba(30, 87, 216, 0.12);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
}

.investment-rank--1 {
  background: rgba(245, 158, 11, 0.14);
  color: #c88714;
}

.investment-rank--2 {
  background: rgba(125, 133, 152, 0.16);
  color: #5d6476;
}

.investment-rank--3 {
  background: rgba(214, 90, 58, 0.14);
  color: #b04f35;
}

.donut-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 0.7rem;
  align-items: center;
  min-height: 0;
}

.donut-card {
  position: relative;
  width: 248px;
  height: 248px;
  display: grid;
  place-items: center;
  margin: 0 auto;
}

.donut-chart {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(30, 87, 216, 0.08);
  position: relative;
  transition: transform 900ms ease, box-shadow 300ms ease;
}

.donut-chart::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: inset 0 0 0 1px var(--line);
}

.donut-center {
  position: absolute;
  z-index: 1;
  display: grid;
  gap: 0.18rem;
  text-align: center;
  padding: 0.8rem;
}

.donut-total {
  font-size: 1.62rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.donut-legend {
  display: grid;
  gap: 0.5rem;
  align-content: start;
  width: 100%;
}

.legend-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.42rem 0.62rem;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  transition: transform 220ms ease, border-color 220ms ease, background 220ms ease;
}

.legend-dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
}

.legend-label,
.legend-value {
  font-size: 0.86rem;
  font-weight: 700;
}

.legend-label.is-active,
.legend-value.is-active,
.bar-head .is-active {
  color: var(--accent);
}

.metric-tiles {
  display: grid;
  gap: 0.48rem;
  height: 100%;
  align-content: start;
}

.metric-tiles--compact {
  margin-top: 0.85rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.subpanel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
  margin-bottom: 0.7rem;
}

.subpanel-heading h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.metric-tile {
  padding: 0.62rem 0.74rem;
  border-radius: 1rem;
  background: rgba(30, 87, 216, 0.05);
  border: 1px solid var(--line);
  min-height: 0;
  align-content: center;
  transition: transform 220ms ease, border-color 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

.metric-tile-label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-tile-value {
  margin-top: 0.2rem;
  font-size: 1.42rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.metric-tile-meta {
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.bar-head,
.record-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-weight: 700;
}

.bar-track {
  height: 0.9rem;
  border-radius: 999px;
  background: rgba(30, 87, 216, 0.08);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #5f89ea);
  transition: width 700ms ease, filter 220ms ease, transform 220ms ease;
}

.bar-fill.is-active {
  filter: saturate(1.15);
  transform: scaleY(1.05);
}

.stack-list,
.style-cards,
.record-cards,
.code-directory {
  display: grid;
  gap: 0.8rem;
}

.stack-item,
.style-card,
.record-card,
.code-chip {
  padding: 0.85rem 0.95rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  transition: transform 220ms ease, border-color 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

.stack-item.is-active,
.style-card.is-active,
.code-chip.is-active,
.metric-tile.is-active,
.legend-row:has(.legend-label.is-active) {
  border-color: rgba(30, 87, 216, 0.24);
  background: rgba(30, 87, 216, 0.08);
  box-shadow: 0 12px 24px rgba(30, 87, 216, 0.08);
  transform: translateY(-1px);
}

.stack-item {
  display: grid;
  gap: 0.45rem;
}

.stack-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.stack-value-inline {
  display: inline-block;
  margin-left: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  vertical-align: middle;
}

.stack-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.style-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.style-card {
  display: grid;
  gap: 0.65rem;
}

.style-head,
.record-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: start;
}

.style-name,
.record-style {
  font-size: 1.1rem;
  font-weight: 800;
}

.style-meta,
.record-meta,
.code-meta {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.style-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.mini-stat {
  padding: 0.7rem;
  border-radius: 0.95rem;
  background: rgba(30, 87, 216, 0.06);
  min-width: 0;
}

.mini-label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mini-value {
  margin-top: 0.25rem;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.record-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tag {
  display: inline-flex;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
}

.tag--neutral {
  background: rgba(21, 21, 21, 0.08);
  color: var(--accent-dark);
}

.tag--success {
  background: rgba(31, 107, 79, 0.12);
  color: var(--success);
}

.row-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.7rem;
}

.row-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
}

.row-btn--danger {
  color: var(--warning);
  border-color: rgba(159, 47, 18, 0.2);
}

.empty-state {
  padding: 1.4rem;
  color: var(--muted);
  text-align: center;
}

.panel--hidden {
  display: none;
}

.panel-grid--collapsed {
  display: none;
}

.code-directory {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.code-chip {
  display: grid;
  gap: 0.35rem;
}

.code-label {
  font-size: 1rem;
  font-weight: 800;
}

.dialog {
  width: min(42rem, calc(100vw - 2rem));
  border: 0;
  padding: 0;
  border-radius: 1.6rem;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(42, 23, 11, 0.35);
  backdrop-filter: blur(3px);
}

.record-form {
  padding: 1.25rem;
}

.dialog-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.form-grid {
  margin-top: 1rem;
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.textarea-label {
  margin-top: 0.9rem;
}

.auto-note {
  display: grid;
  gap: 0.3rem;
  align-content: start;
  padding: 0.95rem 1rem;
  border-radius: 1rem;
  background: rgba(30, 87, 216, 0.06);
  border: 1px solid rgba(30, 87, 216, 0.12);
}

.auto-note-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 800;
}

.auto-note-copy {
  color: var(--muted);
  line-height: 1.45;
}

.form-note {
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 1100px) {
  .topbar,
  .hero,
  .filters,
  .spotlight-grid,
  .analytics-grid,
  .kpi-grid,
  .dual-grid,
  .style-cards,
  .record-cards,
  .code-directory,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    justify-content: start;
  }

  .benchmark-legend {
    grid-template-columns: 1fr;
  }

  .nav-tabs {
    width: fit-content;
  }

  .donut-layout {
    grid-template-columns: 1fr;
    min-height: unset;
  }

  .donut-card {
    width: 220px;
    height: 220px;
    margin: 0 auto;
  }
}

@media (max-width: 720px) {
  html {
    font-size: 14px;
  }

  .app-shell {
    padding: 0.7rem;
  }

  .dashboard {
    gap: 0.8rem;
  }

  .panel,
  .hero,
  .kpi-card {
    border-radius: 1.15rem;
  }

  .topbar {
    align-items: start;
  }

  .nav-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.3rem;
    padding: 0.25rem;
  }

  .nav-tab {
    text-align: center;
    padding: 0.72rem 0.45rem;
    font-size: 0.86rem;
  }

  .hero {
    padding: 1.05rem;
  }

  .hero-title {
    max-width: none;
    font-size: 2.2rem;
    line-height: 0.98;
  }

  .hero-actions,
  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .hero-actions .primary-btn,
  .hero-actions .ghost-btn,
  .dialog-actions .primary-btn,
  .dialog-actions .ghost-btn {
    width: 100%;
    justify-content: center;
  }

  .panel-heading,
  .style-head,
  .record-head,
  .dialog-heading {
    flex-direction: column;
    align-items: start;
  }

  .live-status {
    flex-direction: column;
    gap: 0.35rem;
  }

  .record-cards,
  .style-cards,
  .code-directory {
    grid-template-columns: 1fr;
  }

  .record-card,
  .style-card,
  .code-chip {
    padding: 0.9rem;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
  }

  .kpi-card {
    padding: 0.9rem;
  }

  .kpi-value {
    font-size: 1.9rem;
  }

  .panel-heading {
    gap: 0.35rem;
    margin-bottom: 0.75rem;
  }

  .panel-note {
    font-size: 0.82rem;
  }

  .donut-layout {
    gap: 0.8rem;
  }

  .donut-card {
    width: 210px;
    height: 210px;
  }

  .donut-total {
    font-size: 1.55rem;
  }

  .legend-row {
    padding: 0.5rem 0.6rem;
    gap: 0.45rem;
  }

  .legend-label,
  .legend-value,
  .record-meta,
  .style-meta,
  .code-meta {
    font-size: 0.86rem;
  }

  .metric-tile {
    padding: 0.7rem 0.75rem;
  }

  .metric-tile-value,
  .stack-value {
    font-size: 1.45rem;
  }

  .bar-track {
    height: 0.78rem;
  }

  .row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .row-btn {
    width: 100%;
    text-align: center;
  }

  .dialog {
    width: calc(100vw - 1rem);
    max-height: calc(100vh - 1rem);
    margin: auto 0.5rem;
  }

  .record-form {
    padding: 1rem;
  }

  .form-grid {
    gap: 0.75rem;
  }

  .filters {
    gap: 0.75rem;
  }

  .filters input,
  .filters select,
  .record-form input,
  .record-form select,
  .record-form textarea {
    min-height: 2.9rem;
  }

  .investment-table {
    min-width: 1040px;
  }
}

@media (max-width: 520px) {
  .topbar-title {
    font-size: 1.9rem;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: 1.95rem;
  }

  .donut-card {
    width: 186px;
    height: 186px;
  }

  .dialog {
    width: calc(100vw - 0.6rem);
    margin: auto 0.3rem;
  }
}
