:root {
  color-scheme: light;
  --ink: #171713;
  --muted: #716f66;
  --line: #dedbd0;
  --paper: #f4f1e9;
  --panel: #fffdf8;
  --accent: #b58b48;
  --accent-soft: #efe4d0;
  --success: #2f7454;
  --warning: #b2672d;
  --danger: #a54842;
  --shadow: 0 22px 55px rgba(48, 41, 27, 0.07);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }
button { color: inherit; }

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 30px 20px;
  color: #f5f1e7;
  background: #1d1d19;
  border-right: 1px solid #2d2d28;
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid #817258; border-radius: 50%; color: #d9bb84; font-family: Georgia, serif; font-size: 14px; }
.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, serif; font-size: 18px; font-weight: 500; letter-spacing: .02em; }
.brand small { margin-top: 3px; color: #9f9b91; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }

.navigation { display: grid; gap: 5px; margin-top: 42px; scrollbar-width: none; }
.navigation::-webkit-scrollbar { display: none; }
.nav-item { display: flex; align-items: center; gap: 13px; width: 100%; padding: 12px 11px; border: 0; border-radius: 8px; color: #aaa69d; background: transparent; text-align: left; cursor: pointer; transition: .18s ease; }
.nav-item span { width: 21px; color: #6f6c64; font-family: ui-monospace, monospace; font-size: 10px; }
.nav-item:hover { color: #fffdf7; background: #282823; }
.nav-item.is-active { color: #fff; background: #333129; box-shadow: inset 2px 0 #c7a46c; }
.nav-item.is-active span { color: #d9bb84; }

.sidebar-footer { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 15px 10px 0; border-top: 1px solid #33332e; }
.sidebar-footer strong, .sidebar-footer small { display: block; }
.sidebar-footer strong { font-size: 12px; font-weight: 600; }
.sidebar-footer small { margin-top: 3px; color: #827f77; font-size: 10px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #817f77; box-shadow: 0 0 0 4px rgba(129,127,119,.12); }
.status-dot.ok { background: #63ab80; box-shadow: 0 0 0 4px rgba(99,171,128,.12); }
.status-dot.warning { background: #d3a25c; box-shadow: 0 0 0 4px rgba(211,162,92,.12); }

main { width: 100%; max-width: 1600px; min-width: 0; margin: 0 auto; padding: 0 52px 64px; }
.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 112px; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 5px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(28px, 3vw, 42px); font-weight: 500; }
.eyebrow { margin: 0; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .17em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 11px; }
.environment, .source-badge { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.5); font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); cursor: pointer; }
.icon-button:hover { border-color: var(--accent); }
.icon-button.is-loading { animation: spin .8s linear infinite; }

.view { display: none; padding-top: 34px; }
.view.is-visible { display: block; animation: enter .25s ease; }

.foundation-notice { display: flex; align-items: center; justify-content: space-between; gap: 35px; padding: 34px 36px; color: #f8f5ed; background: linear-gradient(135deg, #22221e, #313027); border-radius: 16px; box-shadow: var(--shadow); }
.foundation-notice h2 { margin: 11px 0 8px; max-width: 680px; font-family: Georgia, serif; font-size: clamp(25px, 3vw, 38px); font-weight: 500; }
.foundation-notice p { max-width: 760px; margin: 0; color: #bcb7ac; line-height: 1.65; }
.notice-tag { display: inline-block; color: #e2c18c; font-size: 9px; font-weight: 800; letter-spacing: .18em; }
.notice-tag.muted { color: var(--muted); }
.readiness-ring { display: grid; flex: 0 0 116px; width: 116px; height: 116px; place-content: center; border: 1px solid #696352; border-radius: 50%; text-align: center; box-shadow: inset 0 0 0 9px rgba(255,255,255,.025); }
.readiness-ring strong { display: block; font-family: Georgia, serif; font-size: 29px; font-weight: 500; }
.readiness-ring span { color: #99958b; font-size: 9px; letter-spacing: .14em; text-transform: uppercase; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 22px; margin: 42px 0 18px; }
.section-heading h2 { margin: 5px 0 0; font-family: Georgia, serif; font-size: 28px; font-weight: 500; }
.freshness { color: var(--muted); font-size: 12px; }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.metric-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-card { min-height: 148px; padding: 20px 21px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 8px 24px rgba(48,41,27,.025); }
.metric-card span, .metric-card small { display: block; }
.metric-card span { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.metric-card strong { display: block; margin: 18px 0 13px; font-family: Georgia, serif; font-size: 35px; font-weight: 500; }
.metric-card small { color: #9b978d; }

.two-column { display: grid; grid-template-columns: 1.35fr 1fr; gap: 15px; margin-top: 15px; }
.panel { padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 15px; }
.panel-heading h3 { margin: 5px 0 0; font-family: Georgia, serif; font-size: 22px; font-weight: 500; }
.count-pill { min-width: 29px; padding: 5px 9px; border-radius: 999px; color: #645b4c; background: var(--accent-soft); font-size: 11px; text-align: center; }
.empty-state { min-height: 180px; display: grid; place-content: center; text-align: center; color: var(--muted); }
.empty-state > span { display: grid; width: 36px; height: 36px; margin: 0 auto 9px; place-items: center; border: 1px solid var(--line); border-radius: 50%; }
.empty-state h4 { margin: 0 0 5px; color: var(--ink); }
.empty-state p { max-width: 420px; margin: 0; font-size: 13px; line-height: 1.55; }
.progress-track { height: 6px; margin: 30px 0 24px; overflow: hidden; border-radius: 99px; background: #e9e5dc; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .3s ease; }
.compact-list { display: grid; gap: 13px; padding: 0; margin: 0; list-style: none; }
.compact-list li { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 12px; border-bottom: 1px solid #ece8de; color: var(--muted); font-size: 12px; }
.compact-list li:last-child { border: 0; }
.compact-list strong { color: var(--ink); font-weight: 600; }

.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.filter { padding: 8px 13px; border: 1px solid var(--line); border-radius: 99px; background: transparent; cursor: pointer; }
.filter.is-active { color: #fff; background: var(--ink); border-color: var(--ink); }
.filter b { margin-left: 5px; }
.approval-preview { display: grid; grid-template-columns: minmax(280px, .85fr) 1.15fr; gap: 32px; align-items: center; min-height: 390px; }
.preview-placeholder { display: grid; min-height: 320px; place-content: center; border: 1px dashed #cbc5b7; border-radius: 10px; color: var(--muted); background: #f2eee5; text-align: center; }
.preview-placeholder span { font-size: 34px; }
.preview-placeholder strong, .preview-placeholder small { display: block; margin-top: 9px; }
.preview-placeholder small { color: #9f998e; }
.approval-copy h3 { margin: 13px 0 10px; font-family: Georgia, serif; font-size: 29px; font-weight: 500; }
.approval-copy p { color: var(--muted); line-height: 1.7; }
.approval-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 25px; }
.approval-actions button { padding: 10px 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.approval-actions button.primary { color: #fff; border-color: var(--ink); background: var(--ink); }
.approval-actions button:disabled { cursor: not-allowed; opacity: .45; }

.feature-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.feature-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.feature-card { min-height: 220px; padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.feature-card > span { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 50%; color: #7b6036; background: var(--accent-soft); font-size: 10px; font-weight: 800; }
.feature-card h3 { margin: 34px 0 9px; font-family: Georgia, serif; font-size: 20px; font-weight: 500; }
.feature-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.blocked-panel { margin-top: 15px; padding: 18px 20px; border: 1px solid #dccdb4; border-radius: 10px; color: #715e3e; background: #f5ecdc; font-size: 13px; }

.funnel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); }
.funnel div { min-height: 170px; padding: 23px; border-right: 1px solid var(--line); }
.funnel div:last-child { border: 0; }
.funnel span, .funnel strong, .funnel b { display: block; }
.funnel span { color: var(--accent); font-family: ui-monospace, monospace; font-size: 10px; }
.funnel strong { margin-top: 31px; font-family: Georgia, serif; font-size: 20px; font-weight: 500; }
.funnel b { margin-top: 10px; font-family: Georgia, serif; font-size: 31px; font-weight: 500; }

.service-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 15px; }
.service-card { display: flex; justify-content: space-between; gap: 18px; padding: 19px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.service-card strong, .service-card small { display: block; }
.service-card small { margin-top: 4px; color: var(--muted); }
.service-state { align-self: start; padding: 5px 8px; border-radius: 99px; color: var(--muted); background: #eeebe4; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.service-state.reachable { color: var(--success); background: #e3efe8; }
.service-state.unreachable, .service-state.degraded { color: var(--danger); background: #f3e3e1; }

.connections { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.connection-card { display: flex; align-items: center; gap: 13px; min-height: 88px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.connection-icon { display: grid; flex: 0 0 36px; width: 36px; height: 36px; place-items: center; border-radius: 8px; color: #7c6743; background: var(--accent-soft); font-size: 11px; font-weight: 800; }
.connection-copy { min-width: 0; flex: 1; }
.connection-copy strong, .connection-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connection-copy small { margin-top: 3px; color: var(--muted); }
.connection-status { color: var(--warning); font-size: 10px; font-weight: 800; text-transform: uppercase; }

@keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 86px minmax(0, 1fr); }
  .sidebar { padding: 27px 13px; }
  .brand > span:last-child, .nav-item:not(.is-active) { font-size: 0; }
  .nav-item { justify-content: center; padding: 12px 5px; font-size: 0; }
  .nav-item span { width: auto; font-size: 10px; }
  .nav-item.is-active { font-size: 0; }
  .sidebar-footer > div { display: none; }
  .sidebar-footer { justify-content: center; }
  .metric-grid, .metric-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .connections { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: auto; height: auto; padding: 16px; }
  .brand { margin-bottom: 13px; }
  .brand > span:last-child { display: block; }
  .navigation { display: flex; margin: 0; overflow-x: auto; }
  .nav-item, .nav-item.is-active, .nav-item:not(.is-active) { flex: 0 0 52px; font-size: 0; }
  .sidebar-footer { display: none; }
  main { padding: 0 17px 42px; }
  .topbar { min-height: 90px; }
  .foundation-notice { align-items: start; padding: 25px; }
  .readiness-ring { flex-basis: 82px; width: 82px; height: 82px; }
  .readiness-ring strong { font-size: 21px; }
  .metric-grid, .metric-grid.compact, .two-column, .feature-grid, .feature-grid.three, .service-grid, .connections, .funnel, .approval-preview { grid-template-columns: 1fr; }
  .funnel div { min-height: 120px; border-right: 0; border-bottom: 1px solid var(--line); }
  .section-heading { align-items: start; flex-direction: column; }
  .source-badge, .freshness { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
