:root {
  --ink: #0b132b;
  --paper: #f6fff8;
  --teal: #5bc0be;
  --sun: #ffd166;
  --rose: #ef476f;
  --leaf: #2a9d8f;
  --line: rgba(11, 19, 43, 0.14);
  --muted: rgba(11, 19, 43, 0.64);
  --shadow: 0 18px 50px rgba(11, 19, 43, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.left-rail {
  background: var(--ink);
  color: var(--paper);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: rgba(246, 255, 248, 0.68);
  margin-top: 3px;
}

.rail-tabs {
  display: grid;
  gap: 10px;
}

.rail-tab,
.ghost-button,
.primary-button,
.open-record,
.dialog-actions button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
}

.rail-tab {
  text-align: left;
  color: rgba(246, 255, 248, 0.76);
  background: transparent;
  padding: 12px 14px;
}

.rail-tab.is-active {
  color: var(--ink);
  background: var(--sun);
}

.rail-card {
  margin-top: auto;
  border: 1px solid rgba(246, 255, 248, 0.16);
  border-radius: 8px;
  padding: 16px;
}

.canvas {
  padding: 28px;
  overflow: hidden;
}

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

.eyebrow,
.label,
.badge {
  margin: 0 0 6px;
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--muted);
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4.8rem);
  line-height: 0.95;
}

h2 {
  margin-bottom: 8px;
}

p {
  color: var(--muted);
  line-height: 1.45;
}

.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.search input,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 11px 12px;
  min-width: 230px;
}

.ghost-button {
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0 16px;
}

.primary-button {
  background: var(--teal);
  color: var(--ink);
  font-weight: 800;
  padding: 0 18px;
}

.primary-button.full {
  width: 100%;
}

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

.metric,
.progress-map,
.detail-board,
.inspector,
.report-card,
.calendar-item,
.record-card,
.timeline-item {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric strong {
  display: block;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 0.9;
}

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

.metric-risk {
  background: var(--sun);
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.progress-map,
.detail-board {
  padding: 20px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  margin: 0;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(91, 192, 190, 0.18);
  color: var(--ink);
}

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

.track {
  position: relative;
  min-height: 210px;
  padding: 16px;
  background: #f6fff8;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.track-step {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-weight: 900;
}

.track-line {
  height: 6px;
  margin: 18px 0;
  border-radius: 999px;
  background: var(--teal);
}

.track.medium .track-line {
  background: var(--sun);
}

.track.high .track-line {
  background: var(--rose);
}

.track h3 {
  min-height: 70px;
  font-size: 1rem;
  line-height: 1.25;
}

.track-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 8px;
  align-items: baseline;
}

.track-meta strong {
  font-size: 1.8rem;
}

.track-meta span {
  color: var(--muted);
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.record-card {
  padding: 18px;
  transition: transform 160ms ease, border-color 160ms ease;
}

.record-card.is-selected {
  border-color: var(--teal);
  transform: translateY(-2px);
}

.record-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.risk-pill {
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 0.8rem;
  font-weight: 900;
}

.risk-pill.low {
  background: rgba(42, 157, 143, 0.18);
}

.risk-pill.medium {
  background: rgba(255, 209, 102, 0.5);
}

.risk-pill.high {
  background: rgba(239, 71, 111, 0.16);
  color: #9d1235;
}

.record-card h3 {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.record-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.record-stats span {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.record-stats b {
  display: block;
  color: var(--ink);
  font-size: 1.05rem;
}

.open-record {
  width: 100%;
  background: var(--ink);
  color: var(--paper);
}

.inspector {
  border-radius: 0;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  padding: 28px 22px;
  box-shadow: none;
}

.inspector h2 {
  font-size: 1.35rem;
}

dl {
  display: grid;
  grid-template-columns: minmax(90px, auto) 1fr;
  gap: 10px;
  margin: 22px 0;
}

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

dd {
  margin: 0;
  font-weight: 750;
}

.checklist {
  display: grid;
  gap: 10px;
  max-width: 720px;
}

.check-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.check-row span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 900;
}

.check-row.done span {
  background: rgba(91, 192, 190, 0.25);
}

.check-row.wait span {
  background: rgba(255, 209, 102, 0.6);
}

.calendar-list,
.report-grid,
.timeline {
  display: grid;
  gap: 12px;
}

.calendar-item {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-left: 8px solid var(--leaf);
}

.calendar-item.medium {
  border-left-color: var(--sun);
}

.calendar-item.high {
  border-left-color: var(--rose);
}

.calendar-item time,
.calendar-item strong {
  font-size: 1.45rem;
  font-weight: 900;
}

.report-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.report-card {
  padding: 18px;
}

.report-card strong {
  display: block;
  font-size: 3rem;
  line-height: 1;
  margin: 10px 0;
}

.timeline-item {
  padding: 16px;
}

.timeline-item span,
.timeline-item small {
  color: var(--muted);
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(11, 19, 43, 0.5);
}

.dialog-form {
  display: grid;
  gap: 16px;
  width: min(520px, calc(100vw - 32px));
  padding: 22px;
}

.dialog-form label {
  display: grid;
  gap: 8px;
  font-weight: 800;
}

.dialog-form textarea {
  min-width: 0;
  resize: vertical;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.dialog-actions button {
  padding: 0 16px;
}

.empty {
  padding: 20px;
}

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

  .inspector {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

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

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

  .left-rail {
    padding: 16px;
  }

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

  .rail-tab {
    text-align: center;
  }

  .canvas,
  .inspector {
    padding: 18px;
  }

  .topbar,
  .section-title {
    display: block;
  }

  .toolbar {
    justify-content: stretch;
    margin-top: 14px;
  }

  .search,
  .search input,
  .ghost-button,
  .primary-button {
    width: 100%;
  }

  .metric-grid,
  .tracks,
  .record-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .calendar-item {
    grid-template-columns: 1fr;
  }

  .check-row {
    grid-template-columns: 36px 1fr;
  }

  .check-row small {
    grid-column: 2;
  }
}
