@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --ink: #0f172a;           /* Deep high-contrast Slate 900 */
  --ink-secondary: #334155; /* Slate 700 - super crisp reading */
  --muted: #475569;         /* Slate 600 - WCAG AAA compliant contrast */
  --line: #cbd5e1;          /* Slate 300 - clearly visible borders */
  --brand: #4f46e5;         /* Indigo 600 */
  --brand-hover: #4338ca;   /* Indigo 700 */
  --brand-soft: #eef2ff;    /* Indigo 50 */
  --brand-text: #3730a3;    /* Indigo 800 */
  --green: #047857;         /* Emerald 700 */
  --green-soft: #d1fae5;
  --green-text: #064e3b;
  --amber: #b45309;         /* Amber 700 */
  --amber-soft: #fef3c7;
  --amber-text: #78350f;
  --red: #b91c1c;           /* Red 700 */
  --red-soft: #fee2e2;
  --red-text: #7f1d1d;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  --sidebar: 246px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 'DM Sans', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button, a, input, select {
  touch-action: manipulation;
}

button, a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

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

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #818cf8;
  outline-offset: 2px;
}

svg {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
  width: 19px;
  height: 19px;
}

button svg {
  pointer-events: none;
}

[hidden] {
  display: none !important;
}

/* Sidebar */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  background: #ffffff;
  border-right: 1.5px solid var(--line);
  z-index: 40;
  display: flex;
  flex-direction: column;
  padding: 26px 16px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: var(--brand);
  border-radius: 12px;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.brand-mark svg {
  width: 26px;
  height: 26px;
}

.brand-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: var(--ink);
}

.brand-name span {
  color: var(--brand);
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  margin-top: 2px;
}

.workspace {
  border: 1.5px solid var(--line);
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 4px 20px;
}

.workspace-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
}

.workspace strong {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  display: block;
}

.workspace small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.nav-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 0 14px;
  margin: 14px 0 8px;
  font-weight: 800;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  background: none;
  color: var(--ink-secondary);
  border-radius: 9px;
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 13.5px;
  margin: 2px 0;
  min-height: 44px;
  transition: all 0.15s ease;
}

.nav-link svg {
  color: var(--muted);
  transition: color 0.15s ease;
}

.nav-link:hover {
  background: #f1f5f9;
  color: var(--ink);
}

.nav-link:hover svg {
  color: var(--ink);
}

.nav-link.active {
  background: var(--brand-soft);
  color: var(--brand-text);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--brand);
}

.nav-link.active svg {
  color: var(--brand);
}

.nav-link .nav-count {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  background: #e0e7ff;
  color: var(--brand-text);
  border-radius: 6px;
  padding: 3px 7px;
}

.sidebar-bottom {
  margin-top: auto;
}

.build-card {
  border: 1.5px solid #c7d2fe;
  background: linear-gradient(145deg, #f5f7ff, #eef2ff);
  border-radius: 12px;
  padding: 15px;
  margin: 16px 4px 10px;
}

.build-card strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #1e1b4b;
}

.build-card p {
  font-size: 11.5px;
  line-height: 1.6;
  color: #3730a3;
  margin: 6px 0 12px;
  font-weight: 500;
}

.build-card button {
  border: 1px solid #c7d2fe;
  padding: 9px;
  background: #ffffff;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  width: 100%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.build-card button:hover {
  background: #faf5ff;
}

.sidebar-foot {
  padding: 12px 14px 0;
  border-top: 1.5px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  display: inline-block;
}

/* Layout */
.main {
  margin-left: var(--sidebar);
  min-height: 100vh;
}

.topbar {
  height: 74px;
  border-bottom: 1.5px solid var(--line);
  background: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 36px;
  gap: 20px;
}

.crumb {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.crumb svg {
  color: var(--muted);
}

.crumb b {
  color: var(--ink);
  font-weight: 700;
  font-size: 13.5px;
}

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

.preview-pill {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  padding: 6px 11px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.icon-button {
  display: grid;
  place-items: center;
  border: 1.5px solid var(--line);
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #ffffff;
  color: var(--ink-secondary);
  transition: all 0.15s ease;
}

.icon-button:hover {
  background: #f1f5f9;
  color: var(--ink);
  border-color: #94a3b8;
}

.profile {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-left: 16px;
  border-left: 1.5px solid var(--line);
}

.avatar {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-text);
  font-size: 12px;
  font-weight: 800;
}

.profile b {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  display: block;
}

.profile small {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.menu-button {
  display: none;
}

.content {
  padding: 30px 36px 40px;
  max-width: 1600px;
  margin: auto;
}

/* Typography & Headings */
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 22px;
}

.eyebrow {
  font-size: 11px;
  color: var(--brand);
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

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

h1 {
  font: 800 27px/1.2 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.8px;
  color: var(--ink);
}

h2 {
  font: 700 16px/1.3 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.3px;
  color: var(--ink);
}

h3 {
  font: 700 14px/1.3 'Plus Jakarta Sans', sans-serif;
  color: var(--ink);
}

.page-heading p {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-secondary);
  margin-top: 8px;
  line-height: 1.6;
}

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

/* Buttons */
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--line);
  background: #ffffff;
  border-radius: 9px;
  padding: 9px 15px;
  min-height: 38px;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--ink);
  white-space: nowrap;
  transition: all 0.15s ease;
}

.button svg {
  width: 16px;
  height: 16px;
}

.button:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.button.primary {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand-hover);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}

.button.primary:hover {
  background: var(--brand-hover);
}

.button.soft {
  background: var(--brand-soft);
  color: var(--brand-text);
  border: 1.5px solid #c7d2fe;
}

.button.soft:hover {
  background: #e0e7ff;
}

.button:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Banner / Demo Note */
.demo-note {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #eef2ff;
  border: 1.5px solid #c7d2fe;
  padding: 12px 16px;
  border-radius: 10px;
  color: #312e81;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  margin-bottom: 22px;
}

.demo-note svg {
  width: 18px;
  height: 18px;
  color: var(--brand);
}

/* Stats Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 22px;
  border: 1.5px solid var(--line);
  background: #ffffff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.stat-card .stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.stat-caption {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-secondary);
}

.stat-icon {
  display: grid;
  place-items: center;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  color: var(--brand);
  background: var(--brand-soft);
}

.stat-icon.green {
  background: var(--green-soft);
  color: var(--green);
}

.stat-icon.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.stat-icon.blue {
  background: #e0f2fe;
  color: #0369a1;
}

.stat-value {
  font: 800 25px/1.2 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.6px;
  color: var(--ink);
  white-space: nowrap;
}

.stat-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.stat-mini {
  padding: 3px 8px;
  border-radius: 6px;
  background: #dcfce7;
  color: #166534;
  font-size: 11px;
  font-weight: 700;
}

.stat-tag {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}

/* Panels */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
  gap: 20px;
  margin-bottom: 22px;
}

.panel {
  background: #ffffff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 0;
}

.panel-pad {
  padding: 22px;
}

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

.subtle {
  color: var(--ink-secondary);
  font-size: 12.5px;
  line-height: 1.6;
  font-weight: 500;
}

.panel-heading .subtle {
  margin-top: 4px;
}

.small-pill {
  border: 1.5px solid var(--line);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-secondary);
  background: #f8fafc;
}

.chart-legend {
  display: flex;
  gap: 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-secondary);
  align-items: center;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--brand);
  margin-right: 6px;
}

.legend-dot.light {
  background: #a5b4fc;
}

.chart {
  width: 100%;
  height: 200px;
  display: block;
  overflow: visible;
}

.chart text {
  font: 600 11.5px 'DM Sans', sans-serif;
  fill: var(--ink-secondary);
}

.chart-line {
  stroke: var(--line);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

/* Distribution / Donut Chart */
.distribution {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 10px 0;
}

.donut {
  width: 136px;
  height: 136px;
  border-radius: 50%;
  background: conic-gradient(#4f46e5 0 43%, #818cf8 43% 69%, #a5b4fc 69% 87%, #e0e7ff 87% 100%);
  position: relative;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.donut:before {
  content: '';
  position: absolute;
  width: 98px;
  height: 98px;
  border-radius: 50%;
  background: #ffffff;
}

.donut .inner {
  z-index: 1;
  text-align: center;
}

.donut .inner b {
  display: block;
  font: 800 24px 'Plus Jakarta Sans', sans-serif;
  color: var(--ink);
}

.donut .inner small {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.dist-legend {
  flex: 1;
  display: grid;
  gap: 12px;
}

.dist-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.dist-row b {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.distribution-foot {
  margin-top: 20px;
  padding: 12px 0 2px;
  border-top: 1.5px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.distribution-foot b {
  color: var(--brand-text);
  font-weight: 800;
}

.section-row {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
  gap: 20px;
}

.panel-top {
  padding: 20px 22px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.text-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  border: 0;
  background: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.text-link svg {
  width: 14px;
  height: 14px;
}

/* Table Styles */
.table-scroll {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th {
  text-align: left;
  padding: 13px 18px;
  background: #f8fafc;
  color: #1e293b;
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  font-weight: 800;
  border-top: 1.5px solid var(--line);
  border-bottom: 1.5px solid var(--line);
}

td {
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
}

tr:last-child td {
  border-bottom: 0;
}

.cell-main {
  color: var(--ink);
  font-weight: 700;
  font-size: 13.5px;
}

.cell-sub {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  margin-top: 4px;
}

/* Status Badges */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 700;
}

.status:before {
  content: '';
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
}

.status.success {
  background: var(--green-soft);
  color: var(--green-text);
  border: 1px solid #a7f3d0;
}

.status.pending {
  background: var(--amber-soft);
  color: var(--amber-text);
  border: 1px solid #fde68a;
}

.status.failed {
  background: var(--red-soft);
  color: var(--red-text);
  border: 1px solid #fecaca;
}

.status.neutral {
  background: #f1f5f9;
  color: var(--ink-secondary);
  border: 1px solid #cbd5e1;
}

.status.purple {
  background: var(--brand-soft);
  color: var(--brand-text);
  border: 1px solid #c7d2fe;
}

.table-foot {
  padding: 14px 20px;
  border-top: 1.5px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  background: #f8fafc;
}

.page-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--line);
  background: #ffffff;
  border-radius: 6px;
  color: var(--ink-secondary);
  font-size: 11px;
  font-weight: 700;
}

.page-number.active {
  background: var(--brand-soft);
  border-color: #a5b4fc;
  color: var(--brand-text);
}

/* Vendor Info */
.vendor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 0;
}

.vendor-ident {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vendor-logo {
  height: 36px;
  width: 36px;
  border: 1.5px solid var(--line);
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 800;
  color: var(--brand-text);
}

.vendor-row strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  display: block;
}

.vendor-row small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 3px;
}

.balance-demo {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  margin-bottom: 10px;
}

.balance-demo b {
  color: var(--ink);
  font-weight: 800;
}

.vendor-note {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.6;
  margin: 16px 0 0;
}

/* Filters & Inputs */
.filters {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-top: 1.5px solid var(--line);
  border-bottom: 1.5px solid var(--line);
  background: #f8fafc;
}

.input, .select {
  background: #ffffff;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 9px 13px;
  min-height: 40px;
  font-size: 13.5px;
  font-weight: 600;
}

.input {
  min-width: 180px;
  flex: 1;
}

.select {
  min-width: 140px;
}

.filter-chips {
  display: flex;
  gap: 8px;
  padding: 18px 20px 0;
}

.chip {
  border: 1.5px solid var(--line);
  background: #ffffff;
  padding: 9px 15px;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.chip:hover {
  background: #f1f5f9;
  color: var(--ink);
}

.chip.active {
  background: var(--brand-soft);
  border-color: #818cf8;
  color: var(--brand-text);
  font-weight: 800;
}

.route-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  border-radius: 5px;
  display: inline-block;
  margin: 2px;
}

.section-gap {
  margin-bottom: 22px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
  gap: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-secondary);
}

.field span {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
}

.field .input, .field .select {
  width: 100%;
}

.field.full {
  grid-column: 1 / -1;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 600;
  margin: 16px 0;
  line-height: 1.6;
}

.check-label input {
  accent-color: var(--brand);
  width: 16px;
  height: 16px;
}

/* Simulation Results */
.simulation-result {
  padding: 20px;
  background: #f5f7ff;
  border: 1.5px solid #c7d2fe;
  border-radius: 12px;
  margin-top: 20px;
}

.simulation-result h3 {
  margin-bottom: 10px;
}

.simulation-result p {
  font-size: 13px;
  line-height: 1.7;
  color: #1e1b4b;
  font-weight: 500;
}

.simulation-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.simulation-metrics div {
  padding: 12px;
  background: #ffffff;
  border-radius: 8px;
  border: 1.5px solid var(--line);
}

.simulation-metrics span {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

.simulation-metrics b {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

/* Flow List */
.flow-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.flow-list li {
  display: flex;
  gap: 14px;
  position: relative;
  padding: 12px 0;
}

.flow-list li + li:before {
  content: '';
  position: absolute;
  left: 14px;
  top: -8px;
  height: 20px;
  width: 2px;
  background: #c7d2fe;
}

.flow-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-text);
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.flow-text b {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  display: block;
  margin-bottom: 4px;
}

.flow-text span {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.6;
}

/* Metric Strip */
.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.metric-strip .panel {
  padding: 20px;
}

.metric-strip span {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-secondary);
}

.metric-strip strong {
  display: block;
  font: 800 24px/1.2 'Plus Jakarta Sans', sans-serif;
  color: var(--ink);
  margin-top: 10px;
}

/* Architecture Page */
.architecture {
  display: grid;
  grid-template-columns: 1fr 28px 1.5fr 28px 1fr;
  align-items: center;
  gap: 14px;
  margin: 25px 0;
}

.architecture-stack {
  display: grid;
  gap: 12px;
}

.architecture-node {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  background: #ffffff;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.architecture-node small {
  display: block;
  font-weight: 500;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.6;
}

.architecture-core {
  padding: 26px;
  border-radius: 16px;
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  color: #ffffff;
  box-shadow: 0 16px 36px rgba(79, 70, 229, 0.3);
}

.architecture-core h2 {
  font-size: 24px;
  color: #ffffff;
  margin-bottom: 8px;
}

.architecture-core p {
  color: #e0e7ff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.7;
}

.core-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 18px;
}

.core-grid span {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: #ffffff;
}

.architecture-arrow {
  color: var(--brand);
  font-size: 20px;
  font-weight: 800;
  text-align: center;
}

.phase-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.phase {
  padding: 20px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.phase small {
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
}

.phase h3 {
  margin: 8px 0;
  font-size: 15px;
}

.phase p {
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.7;
}

.code-block {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 20px;
  font: 12px/1.8 Consolas, monospace;
  margin: 16px 0;
  border: 1px solid #334155;
}

.notice {
  padding: 14px 16px;
  border: 1.5px solid #fde68a;
  background: #fffbeb;
  border-radius: 10px;
  color: #92400e;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.7;
}

.brand-preview {
  border: 1.5px solid #c7d2fe;
  background: linear-gradient(135deg, #faf5ff, #eef2ff);
  border-radius: 14px;
  padding: 35px 22px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 15px;
}

.brand-preview .brand-name {
  font-size: 38px;
}

.brand-preview p {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.toast {
  position: fixed;
  right: 25px;
  bottom: 25px;
  z-index: 200;
  max-width: min(380px, calc(100vw - 35px));
  background: #0f172a;
  color: #ffffff;
  padding: 14px 18px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.7;
}

.overlay {
  display: none;
}

.muted {
  color: var(--muted);
}

/* Dialog */
dialog {
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 0;
  max-width: min(540px, calc(100vw - 30px));
  width: 100%;
  box-shadow: 0 25px 100px rgba(15, 23, 42, 0.25);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}

.dialog-content {
  padding: 26px;
}

.dialog-content h2 {
  font-size: 19px;
  margin-bottom: 10px;
}

.dialog-content p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-secondary);
  font-weight: 500;
}

.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 18px;
}

.dialog-foot {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.dialog-content .form-grid {
  margin-top: 20px;
}

/* Responsive */
@media (min-width: 1600px) {
  .content {
    padding-top: 38px;
  }
  .stat-card {
    padding: 24px;
  }
  .stat-value {
    font-size: 28px;
  }
  .chart {
    height: 230px;
  }
}

@media (max-width: 1200px) {
  :root {
    --sidebar: 210px;
  }
  .content {
    padding: 25px;
  }
  .topbar {
    padding: 0 25px;
  }
  .stat-value {
    font-size: 22px;
  }
  .distribution {
    gap: 16px;
  }
  .donut {
    width: 116px;
    height: 116px;
  }
  .donut:before {
    width: 84px;
    height: 84px;
  }
  .dashboard-grid, .section-row {
    grid-template-columns: minmax(0, 1.65fr) minmax(250px, 1fr);
  }
  .architecture {
    gap: 10px;
  }
}

@media (max-width: 1000px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-grid, .section-row, .split {
    grid-template-columns: 1fr;
  }
  .distribution {
    justify-content: center;
    gap: 35px;
  }
  .dist-legend {
    max-width: 220px;
  }
  .phase-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  :root {
    --sidebar: 246px;
  }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .sidebar.open {
    transform: none;
  }
  .main {
    margin-left: 0;
  }
  .topbar {
    height: 66px;
    padding: 0 18px;
  }
  .top-actions {
    gap: 10px;
  }
  .profile-info {
    display: none;
  }
  .menu-button {
    display: grid;
  }
  .content {
    padding: 22px 18px;
  }
  .page-heading {
    align-items: start;
  }
  .page-heading h1 {
    font-size: 22px;
  }
  .page-heading .actions {
    max-width: 100%;
    justify-content: flex-start;
  }
  .overlay.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 35;
  }
  .architecture {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .architecture-arrow {
    transform: rotate(90deg);
  }
  .architecture-stack {
    grid-template-columns: repeat(2, 1fr);
  }
  .architecture-core {
    order: 0;
  }
  .simulation-metrics {
    grid-template-columns: 1fr 1fr;
  }
  .stat-card {
    padding: 18px;
  }
  .stat-value {
    font-size: 22px;
  }
  .input, .select {
    font-size: 16px;
  }
}

@media (max-width: 430px) {
  .stat-grid {
    gap: 10px;
  }
  .stat-value {
    font-size: 20px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .metric-strip {
    grid-template-columns: 1fr;
  }
  .phase-grid {
    grid-template-columns: 1fr;
  }
  .filters .select {
    min-width: 0;
    flex: 1;
  }
  .filters .input {
    width: 100%;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
