:root {
  color-scheme: light;
  --ink: #263238;
  --paper: #f0f4f8;
  --paper-strong: #ffffff;
  --green: #00a676;
  --amber: #ffcf56;
  --line: rgba(38, 50, 56, 0.16);
  --muted: #617078;
  --danger: #d95032;
  --shadow: 0 18px 45px rgba(38, 50, 56, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(38, 50, 56, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(38, 50, 56, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.side-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: var(--ink);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

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

.brand small {
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.35;
}

.tabs {
  display: grid;
  gap: 8px;
}

.tab {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  text-align: left;
  border-radius: 6px;
  padding: 10px 12px;
}

.tab.is-active {
  background: var(--green);
  color: #06251d;
  border-color: var(--green);
  font-weight: 800;
}

.rail-status {
  margin-top: auto;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 14px;
}

.mono {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  line-height: 1.25;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0;
}

.side-rail .mono {
  color: rgba(255, 255, 255, 0.58);
}

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

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.04;
}

h2 {
  font-size: 18px;
  margin-bottom: 4px;
}

h3 {
  font-size: 16px;
  margin-bottom: 6px;
}

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

.search-box {
  display: grid;
  gap: 4px;
  min-width: min(260px, 100%);
}

.search-box input {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: var(--paper-strong);
}

.icon-button,
.primary-button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  font-weight: 800;
}

.icon-button {
  width: 42px;
  background: var(--paper-strong);
  box-shadow: inset 0 0 0 1px var(--line);
}

.primary-button {
  background: var(--amber);
  color: var(--ink);
  padding: 0 16px;
}

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

.metric {
  min-height: 112px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.metric strong {
  display: block;
  margin: 8px 0 2px;
  font-size: 30px;
}

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

.metric-accent {
  border-top: 5px solid var(--green);
}

.metric-alert {
  border-top: 5px solid var(--amber);
}

.view {
  display: none;
}

.view.is-visible {
  display: grid;
  gap: 16px;
}

.board-wrap,
.table-zone,
.inspector,
.record-card,
.workflow-card,
.lab-card {
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.board-wrap,
.table-zone,
.inspector {
  padding: 16px;
}

.board-head,
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.board-head p {
  color: var(--muted);
  margin-bottom: 0;
}

.lane-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.lane {
  min-height: 280px;
  background:
    linear-gradient(90deg, transparent 47px, rgba(38, 50, 56, 0.08) 48px, transparent 49px),
    #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.lane header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 900;
}

.lane-meter {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green) var(--value), rgba(38, 50, 56, 0.12) var(--value));
  margin: 10px 0 12px;
}

.lane-items {
  display: grid;
  gap: 10px;
}

.lane-card,
.request-row {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
}

.lane-card {
  padding: 11px;
  display: grid;
  gap: 5px;
}

.lane-card strong,
.request-row strong {
  overflow-wrap: anywhere;
}

.lane-card.watch,
.calendar-slot.watch {
  box-shadow: inset 4px 0 0 var(--amber);
}

.lane-card.conflict,
.calendar-slot.conflict {
  box-shadow: inset 4px 0 0 var(--danger);
}

.sample-code,
.version-badge,
.resource-chip,
.conflict {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.sample-code {
  background: var(--ink);
  color: #fff;
}

.version-badge {
  background: #e7edf1;
  color: var(--ink);
}

.resource-chip {
  background: rgba(0, 166, 118, 0.13);
  color: #006c51;
  font-weight: 800;
}

.conflict.clear {
  background: rgba(0, 166, 118, 0.13);
  color: #006c51;
}

.conflict.watch {
  background: rgba(255, 207, 86, 0.32);
  color: #735300;
}

.conflict.conflict {
  background: rgba(217, 80, 50, 0.13);
  color: #9d2d17;
}

.status-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.request-table {
  display: grid;
  gap: 8px;
}

.request-row {
  display: grid;
  grid-template-columns: 112px minmax(180px, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
}

.request-row small,
.lane-card small,
.lab-card small {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.request-row.is-selected {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(0, 166, 118, 0.18);
}

.inspector {
  position: sticky;
  top: 24px;
  height: fit-content;
}

dl {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 9px 12px;
  margin: 16px 0 0;
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  margin: 0;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.record-card {
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
}

.record-rail {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.record-card dl {
  grid-column: 1 / -1;
}

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

.timeline-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 4px;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(0, 166, 118, 0.14);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.calendar-slot {
  min-height: 128px;
  display: grid;
  align-content: space-between;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    repeating-linear-gradient(180deg, rgba(38, 50, 56, 0.05) 0 1px, transparent 1px 24px),
    #fff;
}

.workflow-grid,
.lab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.workflow-card,
.lab-card {
  padding: 16px;
}

.lab-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  align-items: center;
  gap: 12px;
}

.capacity-ring {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  background:
    radial-gradient(#fff 54%, transparent 55%),
    conic-gradient(var(--green) var(--value), rgba(38, 50, 56, 0.14) 0);
}

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

dialog {
  width: min(520px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.dialog-form {
  display: grid;
  gap: 16px;
  padding: 18px;
}

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

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

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

.dialog-actions button:not(.primary-button) {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 0 14px;
  min-height: 40px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-rail {
    position: static;
    height: auto;
  }

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

  .tab {
    text-align: center;
  }

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

  .status-grid,
  .record-card {
    grid-template-columns: 1fr;
  }

  .inspector {
    position: static;
  }
}

@media (max-width: 680px) {
  .workspace,
  .side-rail {
    padding: 16px;
  }

  .topbar,
  .board-head,
  .section-head {
    display: grid;
  }

  .toolbar {
    justify-content: stretch;
  }

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

  .icon-button {
    width: 100%;
  }

  .metric-strip,
  .tabs {
    grid-template-columns: 1fr;
  }

  .lane-board {
    grid-template-columns: minmax(245px, 1fr);
  }

  .request-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  dl {
    grid-template-columns: 1fr;
  }
}
