:root {
  --canvas: #f6f3ee;
  --surface: #fffdf9;
  --surface-2: #f0ede6;
  --ink: #16130f;
  --body: #514c45;
  --muted: #82796e;
  --line: #ded8cf;
  --line-strong: #c8beb2;
  --charcoal: #201d19;
  --green: #3b7d52;
  --green-soft: #d9f0e7;
  --teal: #2f7d80;
  --amber: #b56a18;
  --amber-soft: #f5dfbd;
  --rose: #b94d5c;
  --rose-soft: #f3d8dc;
  --violet: #8067a9;
  --blue: #3f6f91;
  --shadow: 0 16px 48px rgba(34, 29, 23, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(47, 125, 128, 0.09), transparent 36%),
    linear-gradient(225deg, rgba(181, 106, 24, 0.09), transparent 34%),
    var(--canvas);
  color: var(--body);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  background: var(--charcoal);
  color: rgba(255, 253, 249, 0.78);
  border-right: 1px solid rgba(255, 253, 249, 0.12);
}

.product-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fffdf9;
}

.product-mark strong,
.product-mark small {
  display: block;
}

.product-mark strong {
  line-height: 1.15;
}

.product-mark small {
  margin-top: 3px;
  color: rgba(255, 253, 249, 0.52);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}

.mark-orbit {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 42%, rgba(255, 253, 249, 0.8) 42% 58%, transparent 58%),
    linear-gradient(0deg, transparent 42%, rgba(255, 253, 249, 0.8) 42% 58%, transparent 58%),
    conic-gradient(from 40deg, #2f7d80, #b56a18, #8067a9, #3b7d52, #2f7d80);
  box-shadow: inset 0 0 0 8px rgba(32, 29, 25, 0.72), 0 0 0 1px rgba(255, 253, 249, 0.16);
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: rgba(255, 253, 249, 0.68);
}

.side-nav a:hover,
.side-nav a.active {
  background: rgba(255, 253, 249, 0.08);
  color: #fffdf9;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 253, 249, 0.1);
  color: #f0d8ad;
  font-size: 0.86rem;
}

.sidebar-status {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 253, 249, 0.13);
  border-radius: var(--radius);
  background: rgba(255, 253, 249, 0.06);
}

.sidebar-status strong,
.sidebar-status small {
  display: block;
}

.sidebar-status strong {
  color: #fffdf9;
  font-size: 0.9rem;
}

.sidebar-status small {
  margin-top: 2px;
  color: rgba(255, 253, 249, 0.56);
  font-size: 0.8rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #51c99e;
  box-shadow: 0 0 0 5px rgba(81, 201, 158, 0.14);
}

.main-panel {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--ink);
  letter-spacing: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.85rem, 3.1vw, 3.1rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
  line-height: 1.25;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: rgba(255, 253, 249, 0.74);
  color: var(--ink);
}

.icon-button {
  width: 40px;
  font-size: 1rem;
}

.primary-action {
  padding: 0 14px;
  background: var(--ink);
  border-color: var(--ink);
  color: #fffdf9;
  font-weight: 700;
}

.status-band {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 20px;
  align-items: stretch;
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 8% 20%, rgba(47, 125, 128, 0.13), transparent 28%),
    radial-gradient(circle at 82% 10%, rgba(181, 106, 24, 0.15), transparent 24%),
    var(--surface);
  box-shadow: var(--shadow);
}

.status-copy {
  display: grid;
  align-content: center;
  gap: 14px;
}

.status-copy h2 {
  max-width: 720px;
  font-size: clamp(1.35rem, 2.2vw, 2.15rem);
  line-height: 1.12;
}

.live-pill,
.badge,
.trend,
.state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  border-radius: 999px;
  white-space: nowrap;
}

.live-pill {
  gap: 8px;
  padding: 6px 10px;
  background: var(--green-soft);
  color: #236a55;
  font-size: 0.82rem;
  font-weight: 800;
}

.live-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.status-cells {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.status-cells div {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 132px;
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(246, 243, 238, 0.72);
  border: 1px solid rgba(222, 216, 207, 0.9);
}

.status-cells small {
  color: var(--muted);
  font-weight: 700;
}

.status-cells strong {
  color: var(--ink);
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric-card,
.chart-card,
.table-card,
.timeline-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 249, 0.86);
  box-shadow: 0 8px 28px rgba(34, 29, 23, 0.05);
}

.metric-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 1.55rem;
  line-height: 1;
}

.metric-card p {
  grid-column: 1 / -1;
  margin-bottom: 0;
  color: var(--body);
  font-size: 0.88rem;
}

.trend {
  height: 26px;
  padding: 0 9px;
  background: var(--green-soft);
  color: #236a55;
  font-size: 0.8rem;
  font-weight: 800;
}

.trend.down {
  background: #dbecea;
  color: var(--teal);
}

.trend.muted {
  background: var(--amber-soft);
  color: var(--amber);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.chart-card,
.table-card,
.timeline-card {
  min-width: 0;
  padding: 16px;
}

.chart-wide {
  grid-column: span 2;
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.badge {
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.badge.good {
  background: var(--green-soft);
  color: #236a55;
}

.badge.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.danger {
  background: var(--rose-soft);
  color: var(--rose);
}

.chart-surface {
  width: 100%;
  height: 260px;
  border: 1px solid rgba(222, 216, 207, 0.78);
  border-radius: var(--radius);
  background:
    linear-gradient(rgba(32, 29, 25, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32, 29, 25, 0.035) 1px, transparent 1px),
    #fffdf9;
  background-size: 100% 25%, 12.5% 100%;
  overflow: hidden;
}

.chart-surface svg {
  display: block;
  width: 100%;
  height: 100%;
}

.gauge-surface {
  display: grid;
  place-items: center;
}

.risk-list {
  display: grid;
  gap: 18px;
  padding: 15px 0 4px;
}

.risk-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(90px, 38%) auto;
  gap: 10px;
  align-items: center;
  color: var(--body);
  font-size: 0.88rem;
}

meter {
  width: 100%;
  height: 9px;
}

.risk-list strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
  gap: 14px;
  margin-top: 14px;
}

.model-table {
  display: grid;
  overflow-x: auto;
}

.model-table [role="row"] {
  display: grid;
  grid-template-columns: minmax(190px, 1.6fr) minmax(110px, 0.8fr) minmax(80px, 0.6fr) minmax(80px, 0.6fr);
  gap: 12px;
  align-items: center;
  min-width: 620px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.model-table .table-head {
  border-top: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.model-table [role="cell"] {
  color: var(--body);
}

.state {
  height: 24px;
  padding: 0 9px;
  font-size: 0.78rem;
  font-weight: 800;
}

.state.ok {
  background: var(--green-soft);
  color: #236a55;
}

.state.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.timeline {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
}

.timeline time {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.timeline strong {
  display: block;
  color: var(--ink);
  font-size: 0.93rem;
}

.timeline p {
  margin: 5px 0 0;
  color: var(--body);
  font-size: 0.88rem;
}

@media (max-width: 1160px) {
  .app-shell {
    grid-template-columns: 224px minmax(0, 1fr);
  }

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

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

  .chart-wide {
    grid-column: span 2;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

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

  .sidebar-status {
    margin-top: 0;
  }

  .main-panel {
    padding: 16px;
  }

  .topbar,
  .status-band,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .status-cells,
  .metric-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .chart-wide {
    grid-column: auto;
  }

  .chart-surface {
    height: 230px;
  }
}

@media (max-width: 520px) {
  .side-nav {
    grid-template-columns: 1fr;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 40px 40px minmax(0, 1fr);
  }

  .primary-action {
    min-width: 0;
    padding: 0 10px;
  }

  .status-cells div {
    min-height: 100px;
  }

  .risk-list div {
    grid-template-columns: 1fr auto;
  }

  .risk-list meter {
    grid-column: 1 / -1;
  }
}
