:root {
  --bg: oklch(98% 0.005 250);
  --surface: oklch(100% 0 0);
  --surface-2: oklch(96.5% 0.006 245);
  --fg: oklch(22% 0.02 240);
  --muted: oklch(50% 0.018 240);
  --border: oklch(90% 0.008 240);
  --accent: oklch(58% 0.16 145);
  --accent-2: oklch(57% 0.14 235);
  --warn: oklch(74% 0.14 80);
  --danger: oklch(60% 0.18 28);
  --ok-soft: oklch(95% 0.035 145);
  --blue-soft: oklch(95% 0.025 235);
  --warn-soft: oklch(96% 0.04 80);
  --danger-soft: oklch(95% 0.035 28);
  --shadow: 0 18px 48px rgba(26, 38, 62, 0.08);
  --font-display: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0) 220px),
    radial-gradient(circle at 15% -10%, oklch(92% 0.045 160 / 0.55), transparent 30%),
    var(--bg);
  color: var(--fg);
  font: 15px/1.5 var(--font-body);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 14px;
  border-right: 1px solid var(--border);
  background: color-mix(in oklch, var(--surface) 92%, transparent);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 12px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--fg);
  color: white;
  font: 700 13px/1 var(--font-mono);
}

.brand-title {
  font-weight: 760;
  line-height: 1.1;
  letter-spacing: 0;
}

.brand-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font: 11px/1.2 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  transition: background 0.18s cubic-bezier(0.23, 1, 0.32, 1), border-color 0.18s cubic-bezier(0.23, 1, 0.32, 1), color 0.18s cubic-bezier(0.23, 1, 0.32, 1);
}

.nav a:hover,
.nav a.active {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--fg);
}

.nav small {
  color: var(--muted);
  font: 11px/1 var(--font-mono);
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.sidebar-foot b {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.sidebar-foot span {
  color: var(--muted);
  font-size: 12px;
}

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

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

.crumb {
  color: var(--muted);
  font: 12px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-title {
  margin: 7px 0 0;
  font: 760 clamp(28px, 4vw, 44px)/1.04 var(--font-display);
  letter-spacing: 0;
}

.page-lead {
  max-width: 820px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
  text-wrap: pretty;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  font-weight: 650;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(10, 20, 35, 0.04);
}

.btn:hover {
  border-color: color-mix(in oklch, var(--accent-2) 28%, var(--border));
}

.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.btn.danger {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: color-mix(in oklch, var(--danger) 72%, black);
}

.btn.ghost {
  background: transparent;
  box-shadow: none;
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

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

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in oklch, var(--surface) 96%, transparent);
  box-shadow: var(--shadow);
}

.panel.flat {
  box-shadow: none;
}

.panel.pad {
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  margin: 0;
  font: 720 17px/1.2 var(--font-display);
}

.panel-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 132px;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  font: 760 32px/1 var(--font-display);
  font-variant-numeric: tabular-nums;
}

.metric-delta {
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: color-mix(in oklch, var(--accent) 76%, black);
  font: 12px/1.2 var(--font-mono);
}

.metric-delta.warn {
  background: var(--warn-soft);
  color: color-mix(in oklch, var(--warn) 55%, black);
}

.metric-delta.danger {
  background: var(--danger-soft);
  color: color-mix(in oklch, var(--danger) 72%, black);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font: 11px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--surface-2);
}

td {
  font-size: 14px;
}

.num,
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

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

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: 12px/1 var(--font-mono);
  white-space: nowrap;
}

.status.ok {
  border-color: color-mix(in oklch, var(--accent) 30%, var(--border));
  background: var(--ok-soft);
  color: color-mix(in oklch, var(--accent) 76%, black);
}

.status.info {
  border-color: color-mix(in oklch, var(--accent-2) 30%, var(--border));
  background: var(--blue-soft);
  color: color-mix(in oklch, var(--accent-2) 76%, black);
}

.status.warn {
  border-color: color-mix(in oklch, var(--warn) 35%, var(--border));
  background: var(--warn-soft);
  color: color-mix(in oklch, var(--warn) 55%, black);
}

.status.danger {
  border-color: color-mix(in oklch, var(--danger) 30%, var(--border));
  background: var(--danger-soft);
  color: color-mix(in oklch, var(--danger) 75%, black);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.field,
.select,
.textarea {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  outline: none;
}

.field,
.select {
  padding: 0 11px;
}

.textarea {
  width: 100%;
  min-height: 88px;
  padding: 10px 11px;
  resize: vertical;
}

.field:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent-2) 18%, transparent);
}

.field.search {
  min-width: min(360px, 100%);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 14px;
}

.stack {
  display: grid;
  gap: 14px;
}

.timeline {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.step-index {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font: 12px/1 var(--font-mono);
}

.step-title {
  font-weight: 700;
}

.step-text {
  color: var(--muted);
  font-size: 13px;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.progress span {
  display: block;
  width: var(--value, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.22s cubic-bezier(0.23, 1, 0.32, 1);
}

.dropzone {
  min-height: 230px;
  display: grid;
  place-items: center;
  padding: 26px;
  border: 1px dashed color-mix(in oklch, var(--accent-2) 36%, var(--border));
  border-radius: 8px;
  background: linear-gradient(180deg, var(--blue-soft), var(--surface));
  text-align: center;
}

.dropzone strong {
  display: block;
  margin-bottom: 6px;
  font: 720 24px/1.15 var(--font-display);
}

.dropzone p {
  max-width: 520px;
  margin: 0 auto 18px;
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.chip.active {
  border-color: var(--accent);
  background: var(--ok-soft);
  color: color-mix(in oklch, var(--accent) 76%, black);
}

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

.screen-card {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.18s cubic-bezier(0.23, 1, 0.32, 1), border-color 0.18s cubic-bezier(0.23, 1, 0.32, 1);
}

.screen-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in oklch, var(--accent-2) 30%, var(--border));
}

.screen-card h2 {
  margin: 10px 0 8px;
  font: 720 20px/1.15 var(--font-display);
}

.screen-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.screen-no {
  color: var(--muted);
  font: 12px/1 var(--font-mono);
}

.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  color: var(--accent-2);
  font-weight: 700;
}

.hero-board {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: 14px;
  margin-bottom: 14px;
}

.hero-copy {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in oklch, var(--accent-2) 14%, white), transparent 46%),
    var(--surface);
  box-shadow: var(--shadow);
}

.hero-copy h1 {
  max-width: 760px;
  margin: 0;
  font: 780 clamp(38px, 6vw, 72px)/0.98 var(--font-display);
  letter-spacing: 0;
  text-wrap: balance;
}

.hero-copy p {
  max-width: 740px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.system-map {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.node {
  min-height: 102px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.node.wide {
  grid-column: 1 / -1;
}

.node b {
  display: block;
  margin-bottom: 8px;
}

.node span {
  color: var(--muted);
  font-size: 13px;
}

.stat-line {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 64px;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
}

.bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.bar span {
  display: block;
  width: var(--value);
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-2);
}

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

.lane {
  min-height: 220px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.lane h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font: 12px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.task {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.task + .task {
  margin-top: 8px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: 360px;
  padding: 12px 14px;
  border: 1px solid color-mix(in oklch, var(--accent) 30%, var(--border));
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 60px rgba(13, 22, 42, 0.18);
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.23, 1, 0.32, 1), transform 0.2s cubic-bezier(0.23, 1, 0.32, 1);
}

.toast.active {
  opacity: 1;
  transform: translateY(0);
}

.mobile-only {
  display: none;
}

@media (max-width: 1180px) {
  .grid.cols-4,
  .screen-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-board,
  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  body {
    background: var(--bg);
  }

  .shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .brand {
    padding-bottom: 10px;
  }

  .nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav a {
    min-width: 150px;
  }

  .sidebar-foot {
    display: none;
  }

  .main {
    padding: 16px;
  }

  .topbar {
    display: grid;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .screen-grid,
  .kanban {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    min-height: 0;
  }

  .system-map {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 460px) {
  .main {
    padding: 12px;
  }

  .panel-head,
  .toolbar {
    display: grid;
  }

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

  .metric-value {
    font-size: 28px;
  }

  .step {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .step > .status,
  .step > .btn {
    grid-column: 2;
    justify-self: start;
    width: auto;
  }
}
