:root {
  color-scheme: dark;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-code: "IBM Plex Mono", "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --font-draft: "Nanum Pen Script", "Bradley Hand", "Segoe Print", "Marker Felt", cursive;
  --font-title: Georgia, "Times New Roman", serif;
  --blue-950: #010816;
  --blue-925: #031326;
  --blue-900: #061b31;
  --blue-850: #09223c;
  --line: rgba(105, 167, 224, 0.28);
  --line-soft: rgba(105, 167, 224, 0.13);
  --line-faint: rgba(105, 167, 224, 0.065);
  --ink: #eef5ff;
  --ink-soft: #aec0d7;
  --ink-muted: #7188a5;
  --cyan: #67b1ff;
  --cyan-strong: #2b8eff;
  --green: #78df78;
  --orange: #ff8b2a;
  --red: #ff6b6b;
  --paper: #d6cbb5;
  --paper-ink: #20212a;
  --radius: 6px;
  --shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.018);
  font-family: var(--font-ui);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--blue-950);
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--blue-950);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background:
    repeating-linear-gradient(0deg, transparent 0 7px, rgba(255,255,255,0.018) 8px),
    linear-gradient(90deg, rgba(103,177,255,0.06), transparent 12%, transparent 88%, rgba(103,177,255,0.06));
  mix-blend-mode: screen;
}

button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid rgba(103,177,255,0.95);
  outline-offset: 2px;
}

h1, h2, h3, p { margin: 0; }
h1 {
  font-family: var(--font-title);
  font-size: clamp(1.42rem, 1.9vw, 1.88rem);
  font-weight: 500;
  line-height: 1.05;
  color: #f8fbff;
}
h2 {
  font-family: var(--font-draft);
  font-size: 1.42rem;
  font-weight: 400;
  line-height: 1.05;
  color: var(--cyan);
}
h3 {
  font-size: 0.92rem;
  line-height: 1.28;
  color: var(--ink);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr) 344px;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(rgba(103,177,255,0.034) 1px, transparent 1px),
    linear-gradient(90deg, rgba(103,177,255,0.034) 1px, transparent 1px),
    linear-gradient(180deg, #020b18 0%, #031528 47%, #061b31 100%);
  background-size: 64px 64px, 64px 64px, auto;
}

.sidebar {
  display: flex;
  min-width: 0;
  height: 100vh;
  flex-direction: column;
  border: 1px solid var(--line);
  border-right-color: rgba(103,177,255,0.4);
  background:
    linear-gradient(rgba(103,177,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(103,177,255,0.026) 1px, transparent 1px),
    rgba(4,19,38,0.93);
  background-size: 32px 32px;
  overflow: hidden;
}

.brand {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 118px;
  color: inherit;
  text-align: center;
  text-decoration: none;
}

.brand::before,
.brand::after,
.brand-mark {
  position: absolute;
  border: 1px solid rgba(174,192,215,0.18);
  border-radius: 50%;
  content: "";
}

.brand::before { width: 96px; height: 96px; }
.brand::after { width: 70px; height: 70px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: rgba(237,246,255,0.84);
  background: rgba(103,177,255,0.06);
}
.brand svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
}
.brand span:last-child {
  position: absolute;
  top: 92px;
  left: 10px;
  right: 10px;
}
.brand strong,
.brand small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand strong {
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.15;
}
.brand small {
  margin-top: 2px;
  color: rgba(174,192,215,0.76);
  font-size: 0.62rem;
}

.nav-list {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  padding: 20px 10px 12px;
  overflow-y: auto;
}
.nav-link {
  display: grid;
  align-items: center;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}
.nav-link::before {
  content: attr(data-code);
  display: block;
  color: rgba(237,246,255,0.84);
  font-family: var(--font-code);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}
.nav-link span {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-link small {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: rgba(174,192,215,0.76);
  font-size: 0.62rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-link:hover,
.nav-link.active {
  border-color: rgba(103,177,255,0.55);
  background: rgba(58,137,225,0.18);
  box-shadow: inset 0 0 0 1px rgba(103,177,255,0.12);
}

.side-status,
.controller-card,
.rail-panel,
.panel,
.table-wrap {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(rgba(103,177,255,0.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(103,177,255,0.024) 1px, transparent 1px),
    rgba(7,29,54,0.74);
  background-size: 26px 26px;
  box-shadow: var(--shadow);
}

.side-status {
  margin: 0 10px 40px;
  padding: 17px 13px 14px;
  overflow: hidden;
  font-size: 0.77rem;
}
.side-status::before,
.side-status::after {
  position: absolute;
  left: 7px;
  top: -53px;
  width: 116px;
  height: 116px;
  border: 1px solid rgba(103,177,255,0.18);
  border-radius: 50%;
  content: "";
}
.side-status::after { inset: -35px auto auto 25px; width: 78px; height: 78px; opacity: 0.7; }
.status-dot {
  position: relative;
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
}

.main {
  display: grid;
  grid-template-rows: 74px minmax(0, 1fr);
  min-width: 0;
  height: 100vh;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(280px, 420px);
  align-items: center;
  gap: 18px;
  min-width: 0;
  padding: 0 24px 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(2,11,24,0.48);
}
.topbar p {
  margin-top: 6px;
  color: rgba(218,228,241,0.72);
  font-size: 0.88rem;
}
.top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 13px;
  min-width: 0;
}
.search-box {
  display: flex;
  align-items: center;
  width: min(360px, 32vw);
  min-height: 39px;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: rgba(174,192,215,0.08);
  color: rgba(238,245,255,0.86);
}
.search-box svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}
.search-box input::placeholder { color: rgba(174,192,215,0.72); }
.icon-button {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(238,245,255,0.86);
  cursor: pointer;
}
.icon-button:hover { background: rgba(103,177,255,0.1); }

.view {
  min-height: 0;
  padding: 17px 15px 18px;
  overflow: auto;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(430px, 1.06fr) minmax(390px, 1fr);
  gap: 13px;
  align-items: start;
}
.stack { display: grid; gap: 13px; }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}
.panel-pad { padding: 14px; }
.panel,
.hero-grid,
.split,
.stack,
.row {
  min-width: 0;
}
.muted { color: var(--ink-soft); }
.small {
  font-size: 0.72rem;
  line-height: 1.35;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.stat,
.card {
  border: 1px solid rgba(103,177,255,0.18);
  border-radius: var(--radius);
  background: rgba(2,12,24,0.35);
}
.stat {
  min-height: 76px;
  padding: 12px;
}
.stat strong {
  display: block;
  color: var(--cyan);
  font-family: var(--font-title);
  font-size: 1.72rem;
  font-weight: 400;
  line-height: 1;
}
.stat span {
  display: block;
  margin-top: 7px;
  color: var(--ink-soft);
  font-size: 0.68rem;
}
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.card {
  min-height: 136px;
  padding: 13px;
}
.card h3 { margin-bottom: 8px; }
.card p {
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.5;
}
.card p + p { margin-top: 8px; }

.status-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: rgba(103,177,255,0.1);
  color: var(--cyan);
  font-family: var(--font-code);
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
  white-space: normal;
}
.status-chip.blocked,
.status-chip.fail {
  border-color: rgba(255,107,107,0.34);
  background: rgba(255,107,107,0.1);
  color: var(--red);
}
.status-chip.partial,
.status-chip.draft {
  border-color: rgba(255,139,42,0.34);
  background: rgba(255,139,42,0.1);
  color: var(--orange);
}
.status-chip.built,
.status-chip.pass,
.status-chip.verified {
  border-color: rgba(120,223,120,0.34);
  background: rgba(120,223,120,0.1);
  color: var(--green);
}
.status-chip.zero {
  border-color: rgba(174,192,215,0.18);
  background: rgba(174,192,215,0.055);
  color: var(--ink-muted);
}

.table-wrap { overflow: auto; }
table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(103,177,255,0.09);
  font-size: 0.72rem;
  line-height: 1.45;
  text-align: left;
  vertical-align: top;
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: rgba(218,228,241,0.78);
  background: rgba(2,11,24,0.94);
  font-family: var(--font-code);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
td {
  max-width: 360px;
  color: var(--ink-soft);
}

.split {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 13px;
}
.file-list {
  display: grid;
  gap: 6px;
  max-height: 70vh;
  margin-top: 12px;
  overflow: auto;
}
.file-button {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid rgba(103,177,255,0.18);
  border-radius: 5px;
  background: rgba(2,12,24,0.35);
  color: var(--ink-soft);
  font-size: 0.72rem;
  text-align: left;
  cursor: pointer;
}
.file-button:hover,
.file-button.active {
  border-color: rgba(103,177,255,0.55);
  background: rgba(58,137,225,0.18);
  color: var(--ink);
}
.doc {
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.6;
  white-space: pre-wrap;
}
.report-box {
  min-height: 100%;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(rgba(103,177,255,0.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(103,177,255,0.024) 1px, transparent 1px),
    rgba(3,16,31,0.82);
  background-size: 26px 26px;
  color: #dceaff;
  font-family: var(--font-code);
  font-size: 0.75rem;
  line-height: 1.6;
  overflow: auto;
  white-space: pre-wrap;
}

.controller-rail {
  position: relative;
  display: flex;
  min-width: 0;
  height: 100vh;
  flex-direction: column;
  gap: 20px;
  padding: 16px 13px 20px 18px;
  border: 1px solid var(--line);
  border-left-color: rgba(103,177,255,0.4);
  background: rgba(4,19,38,0.45);
  overflow-y: auto;
}
.rail-quote {
  position: relative;
  margin: 0;
  padding: 0 20px 0 24px;
  color: var(--cyan);
  text-align: center;
}
.rail-quote::before,
.rail-quote::after {
  position: absolute;
  top: -7px;
  color: rgba(174,192,215,0.45);
  font-family: var(--font-title);
  font-size: 2.5rem;
  line-height: 1;
}
.rail-quote::before { left: 0; content: "\""; }
.rail-quote::after { right: 4px; content: "\""; }
.rail-quote blockquote {
  margin: 0;
  font-family: var(--font-draft);
  font-size: 1.28rem;
  line-height: 1.1;
}
.rail-panel { overflow: hidden; }
.rail-panel h2 {
  min-height: 37px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.controller-stack {
  display: grid;
  gap: 10px;
  padding: 10px 8px 8px;
}
.controller-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 10px;
}
.controller-card strong {
  display: block;
  color: var(--ink);
  font-size: 0.86rem;
}
.controller-card span {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 0.67rem;
}
.controller-glyph {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--cyan);
  font-family: var(--font-code);
}
.controller-card[data-accent="green"] .controller-glyph { color: var(--green); }
.controller-card[data-accent="orange"] .controller-glyph { color: var(--orange); }
.rail-note {
  position: relative;
  min-height: 150px;
  padding: 18px 22px;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--paper-ink);
  overflow: hidden;
}
.rail-note strong,
.rail-note span {
  display: block;
  font-family: var(--font-draft);
  font-size: 1.26rem;
  line-height: 1.05;
}
.rail-note small {
  display: block;
  margin-top: 12px;
  color: rgba(32,33,42,0.72);
  font-size: 0.72rem;
}

@media (max-width: 1180px) {
  body { overflow: auto; }
  .app-shell {
    grid-template-columns: 156px minmax(0, 1fr);
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  .controller-rail { display: none; }
  .main {
    grid-template-rows: auto minmax(0, 1fr);
    height: auto;
    min-height: 100vh;
  }
  .topbar {
    grid-template-columns: 1fr;
    min-height: 74px;
    padding: 16px;
  }
  .top-actions { justify-content: flex-start; }
  .search-box { width: min(520px, 100%); }
  .hero-grid, .split { grid-template-columns: 1fr; }
  .stat-grid, .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    height: auto;
    border-right: 1px solid var(--line);
  }
  .brand { min-height: 86px; }
  .brand span:last-child { top: 62px; }
  .nav-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-top: 12px; }
  .side-status { display: none; }
  .main {
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
  }
  .view { padding: 13px; }
  .stat-grid, .cards { grid-template-columns: 1fr; }
  .top-actions { align-items: stretch; flex-direction: column; }
  .icon-button { width: 100%; border-radius: 5px; background: rgba(174,192,215,0.08); }
}
