:root {
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --subtle: #F2F2F0;
  --ink: #111110;
  --ink-70: rgba(17, 17, 16, 0.74);
  --ink-45: rgba(17, 17, 16, 0.62);
  --ink-15: rgba(17, 17, 16, 0.14);
  --ink-06: rgba(17, 17, 16, 0.05);
  --accent: #C8102E;
  --accent-12: rgba(200, 16, 46, 0.10);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

::selection {
  background-color: var(--accent);
  color: #FFFFFF;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--ink-45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  overflow-x: clip;
  background-color: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans", "IBM Plex Sans JP", "Hiragino Kaku Gothic ProN", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Swiss Flat Top Index Architecture (No Sidebar Boxification) */
.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px 128px;
}

.top-index-bar {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
  align-items: baseline;
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--ink);
  position: sticky;
  top: 0;
  background: rgba(250, 250, 250, 0.94);
  backdrop-filter: blur(8px);
  z-index: 30;
}

.brand-col {
  grid-column: span 3;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.brand-title {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand-sub {
  font-size: 14px;
  color: var(--ink-70);
}

.nav-col {
  grid-column: span 6;
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.nav-link {
  background: none;
  border: none;
  padding: 4px 0;
  font-size: 15px;
  font-weight: 400;
  color: var(--ink-70);
  cursor: pointer;
  position: relative;
  transition: color 140ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .nav-link:hover {
    color: var(--ink);
  }
}

.nav-link.active {
  color: var(--ink);
  font-weight: 500;
}

.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -21px;
  height: 2px;
  background: var(--accent);
}

.meta-col {
  grid-column: span 3;
  text-align: right;
  font-size: 14px;
  color: var(--ink-70);
  font-variant-numeric: tabular-nums;
}

/* Views */
.view-pane {
  display: none;
}
.view-pane.active {
  display: block;
}

/* Swiss Hero & Page Header (12-Column Asymmetric) */
.swiss-hero {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
  padding: 72px 0 56px;
  border-bottom: 1px solid var(--ink-15);
}

.hero-left {
  grid-column: span 4;
  font-size: 14px;
  color: var(--ink-70);
  padding-top: 8px;
}

.hero-right {
  grid-column: span 8;
}

.page-title {
  font-size: clamp(2.1rem, 4vw, 3.35rem);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.14;
  color: var(--ink);
  text-wrap: balance;
  margin-bottom: 24px;
}

.page-desc {
  font-size: 16px;
  font-weight: 400;
  color: var(--ink-70);
  max-width: 58ch;
  line-height: 1.7;
}

/* 12-Column Asymmetric Section Row (Left 4 Cols Heading / Right 8 Cols Content) */
.swiss-section {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
  padding: 64px 0;
  border-bottom: 1px solid var(--ink-15);
}

.section-aside {
  grid-column: span 4;
  padding-right: 24px;
}

.section-title {
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 10px;
}

.section-note {
  font-size: 14px;
  color: var(--ink-70);
  max-width: 34ch;
  line-height: 1.6;
}

.section-body {
  grid-column: span 8;
  min-width: 0;
}

/* Swiss Typographic Metric Grid (Hairlines only, no boxed cards) */
.metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink-15);
}

.metric-cell {
  padding: 28px 20px 28px 0;
  border-right: 1px solid var(--ink-15);
}

.metric-cell:not(:first-child) {
  padding-left: 20px;
}

.metric-cell:last-child {
  border-right: none;
}

.metric-label {
  font-size: 14px;
  color: var(--ink-70);
  margin-bottom: 12px;
}

.metric-value {
  font-size: clamp(1.75rem, 2.6vw, 2.4rem);
  font-weight: 300;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1.1;
}

.metric-value.accent {
  color: var(--accent);
}

.metric-note {
  font-size: 14px;
  color: var(--ink-45);
  margin-top: 10px;
}

/* Role Selector (Pure Hairline Grid) */
.role-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--ink-15);
  border-left: 1px solid var(--ink-15);
  margin-bottom: 24px;
}

.role-option {
  background: transparent;
  border: none;
  border-right: 1px solid var(--ink-15);
  border-bottom: 1px solid var(--ink-15);
  padding: 24px;
  cursor: pointer;
  text-align: left;
  transition: background-color 140ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .role-option:hover {
    background: var(--ink-06);
  }
}

.role-option.selected {
  background: var(--ink);
  color: var(--bg);
}

.role-option-title {
  font-size: 17px;
  font-weight: 500;
  margin-bottom: 6px;
}

.role-option-desc {
  font-size: 14px;
  color: var(--ink-70);
  line-height: 1.55;
}

.role-option.selected .role-option-desc {
  color: rgba(250, 250, 250, 0.75);
}

/* Curriculum List (Minimal Editorial Table Rows) */
.curriculum-list {
  border-top: 1px solid var(--ink);
}

.curriculum-row {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 24px;
  align-items: baseline;
  padding: 28px 0;
  border-bottom: 1px solid var(--ink-15);
}

.curriculum-week {
  font-size: 14px;
  color: var(--ink-70);
  font-variant-numeric: tabular-nums;
}

.curriculum-status {
  display: block;
  font-size: 14px;
  color: var(--accent);
  margin-top: 4px;
}

.curriculum-main h3 {
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}

.curriculum-main p {
  font-size: 15px;
  color: var(--ink-70);
  max-width: 58ch;
}

.curriculum-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Editorial Statement Block (Replaces Callout Boxes) */
.audit-banner {
  padding: 20px 24px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink-15);
  background: var(--subtle);
  margin: 24px 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
}

.audit-banner.alert {
  border-top-color: var(--accent);
  background: var(--accent-12);
}

/* Lab Index Strip */
.lab-nav-bar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink-15);
  margin-bottom: 48px;
}

.lab-tab-btn {
  background: transparent;
  border: none;
  border-right: 1px solid var(--ink-15);
  padding: 18px 14px;
  text-align: left;
  cursor: pointer;
  color: var(--ink-70);
  transition: background-color 140ms var(--ease-out), color 140ms var(--ease-out);
}

.lab-tab-btn:last-child {
  border-right: none;
}

@media (hover: hover) and (pointer: fine) {
  .lab-tab-btn:hover {
    background: var(--ink-06);
    color: var(--ink);
  }
}

.lab-tab-btn.active {
  background: var(--ink);
  color: var(--bg);
}

.lab-tab-day {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.lab-tab-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}

/* Workbench Area */
.workbench-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ink);
}

.workbench-title {
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.workbench-status {
  font-size: 14px;
  color: var(--accent);
}

/* Tactile Bars & Controls */
.bar-group {
  margin: 24px 0;
}

.bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.bar-track {
  height: 10px;
  background: var(--ink-15);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--ink);
  transition: width 90ms linear, background-color 160ms var(--ease-out);
}

.bar-fill.accent-bar {
  background: var(--accent);
}

.control-well {
  padding: 28px 0;
  border-top: 1px solid var(--ink-15);
  border-bottom: 1px solid var(--ink-15);
  margin: 28px 0;
}

.slider-row {
  margin-bottom: 20px;
}
.slider-row:last-child {
  margin-bottom: 0;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 4px;
  cursor: pointer;
}

/* Minimalist Swiss Buttons (Sharp Rectangular) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  transition: background-color 140ms var(--ease-out), color 140ms var(--ease-out), transform 120ms var(--ease-out);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    background: var(--accent);
    border-color: var(--accent);
  }
}

.btn-secondary {
  border-color: var(--ink-45);
  color: var(--ink);
}

@media (hover: hover) and (pointer: fine) {
  .btn-secondary:hover {
    border-color: var(--ink);
    background: var(--ink-06);
  }
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

/* Split Columns */
.split-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin: 24px 0;
}

/* Data Table */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  max-height: 420px;
  overflow-y: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

table.data-table th {
  background: var(--bg);
  color: var(--ink-70);
  padding: 12px 14px;
  text-align: left;
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--ink);
  font-weight: 500;
}

table.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--ink-15);
  color: var(--ink);
}

table.data-table tr.dirty-cell-row {
  background: var(--accent-12);
}

.cell-bad {
  color: var(--accent);
  text-decoration: underline;
  font-weight: 500;
}

/* Prompt Output */
.prompt-box {
  background: var(--subtle);
  color: var(--ink);
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink-15);
  padding: 24px;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  margin-top: 16px;
}

/* CSV Dropzone */
.csv-dropzone {
  border: 1px dashed var(--ink-45);
  padding: 32px;
  text-align: center;
  background: transparent;
  transition: border-color 140ms var(--ease-out), background-color 140ms var(--ease-out);
  margin: 20px 0;
}

.csv-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-12);
}

.mobile-nav {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 960px) {
  .app-shell {
    padding: 0 20px 96px;
  }
  .top-index-bar, .swiss-hero, .swiss-section {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .brand-col, .nav-col, .meta-col, .hero-left, .hero-right, .section-aside, .section-body {
    grid-column: span 1;
    text-align: left;
  }
  .nav-col {
    display: none;
  }
  .metrics-strip, .role-strip, .lab-nav-bar, .split-columns {
    grid-template-columns: 1fr;
  }
  .metric-cell {
    border-right: none;
    border-bottom: 1px solid var(--ink-15);
    padding: 20px 0 !important;
  }
  .curriculum-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg);
    border-top: 1px solid var(--ink);
    z-index: 50;
  }
  .mobile-nav button {
    background: none;
    border: none;
    color: var(--ink-70);
    font-size: 14px;
    cursor: pointer;
  }
  .mobile-nav button.active {
    color: var(--accent);
    font-weight: 500;
  }
}
