:root {
  color-scheme: light;
  --ink: #263238;
  --paper: #f0f4f8;
  --paper-strong: #ffffff;
  --green: #00a676;
  --yellow: #ffcf56;
  --red: #d7473f;
  --blue: #335c81;
  --line: rgba(38, 50, 56, 0.16);
  --muted: rgba(38, 50, 56, 0.64);
  --shadow: 0 18px 60px rgba(31, 45, 51, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(38, 50, 56, 0.045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(38, 50, 56, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100svh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  color: var(--paper);
  background: var(--ink);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.brand {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand strong {
  display: block;
  font-size: 20px;
  line-height: 1.05;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: rgba(240, 244, 248, 0.66);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

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

.nav-tab,
.filter,
.secondary-action,
.searchbar button,
.action-row button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
  color: var(--ink);
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.nav-tab {
  width: 100%;
  padding: 10px 12px;
  border-color: rgba(240, 244, 248, 0.16);
  color: rgba(240, 244, 248, 0.78);
  background: rgba(255, 255, 255, 0.06);
  text-align: left;
}

.nav-tab:hover,
.filter:hover,
.secondary-action:hover,
.searchbar button:hover,
.action-row button:hover {
  transform: translateY(-1px);
}

.nav-tab.is-active {
  color: var(--ink);
  border-color: var(--green);
  background: var(--green);
}

.lab-note {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(240, 244, 248, 0.16);
}

.lab-note p {
  margin: 12px 0 0;
  color: rgba(240, 244, 248, 0.76);
  font-size: 14px;
  line-height: 1.55;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 7px;
  color: var(--ink);
  background: var(--yellow);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
}

.badge.warn {
  background: rgba(255, 207, 86, 0.55);
}

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

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--ink);
}

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

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(34px, 5vw, 68px);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.04;
}

h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.22;
}

.searchbar {
  display: grid;
  grid-template-columns: minmax(180px, 320px) 88px;
  gap: 8px;
  width: min(100%, 420px);
}

.searchbar input {
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--paper-strong);
}

.searchbar button,
.secondary-action,
.action-row button {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 22px 0 28px;
  background: var(--ink);
  border: 2px solid var(--ink);
}

.metric {
  min-width: 0;
  padding: 16px;
  background: rgba(255, 255, 255, 0.76);
}

.metric span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.metric strong {
  display: block;
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1;
}

.metric.danger strong {
  color: var(--red);
}

.metric.resource strong {
  color: var(--green);
}

.view {
  display: none;
  animation: rise 220ms ease both;
}

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

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

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.filter {
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.82);
}

.filter.is-active {
  border-color: var(--green);
  background: var(--green);
  color: var(--ink);
  font-weight: 800;
}

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

.queue-item,
.detail-panel,
.timeline,
.report-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.queue-item {
  min-height: 210px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.queue-item:hover,
.queue-item.is-selected {
  transform: translateY(-3px);
  border-color: var(--green);
  box-shadow: 0 22px 70px rgba(0, 166, 118, 0.18);
}

.queue-item.is-selected {
  outline: 2px solid rgba(0, 166, 118, 0.22);
}

.item-top,
.item-meta,
.record-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item-meta {
  margin-top: auto;
  flex-wrap: wrap;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.queue-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.priority,
.status,
.resource-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 7px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
}

.priority-critical {
  color: white;
  background: var(--red);
}

.priority-high {
  background: var(--yellow);
}

.priority-normal {
  color: white;
  background: var(--blue);
}

.priority-low {
  background: rgba(38, 50, 56, 0.12);
}

.status,
.resource-chip {
  color: var(--ink);
  background: rgba(0, 166, 118, 0.14);
}

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

.detail-panel,
.timeline,
.report-block {
  padding: 18px;
}

.record-copy {
  margin: 20px 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--line);
  border: 1px solid var(--line);
}

.record-grid div {
  min-width: 0;
  padding: 12px;
  background: var(--paper-strong);
}

dt {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

dd {
  margin: 6px 0 0;
  font-weight: 800;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.action-row button {
  padding: 8px 11px;
}

.timeline {
  display: grid;
  gap: 12px;
  align-content: start;
}

.timeline-step {
  padding-left: 18px;
  border-left: 3px solid var(--line);
}

.timeline-step.is-done {
  border-left-color: var(--green);
}

.timeline-step span {
  font-weight: 900;
}

.timeline-step p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.calendar-lanes {
  display: grid;
  gap: 10px;
}

.lane {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  padding: 10px;
  border-left: 8px solid var(--green);
  background: rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.lane.has-conflict {
  border-left-color: var(--yellow);
  background:
    repeating-linear-gradient(135deg, rgba(255, 207, 86, 0.18), rgba(255, 207, 86, 0.18) 9px, rgba(255, 255, 255, 0.88) 9px, rgba(255, 255, 255, 0.88) 18px);
}

.lane time {
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 7px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.lane time strong {
  font-size: 28px;
  line-height: 1;
}

.lane-body {
  display: grid;
  gap: 8px;
  align-content: center;
  min-width: 0;
}

.lane-body p {
  margin: 0;
  color: var(--muted);
}

.report-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr 1fr;
  gap: 14px;
}

.report-block {
  min-width: 0;
}

.report-block h3 {
  margin-bottom: 12px;
}

.report-block p {
  color: var(--muted);
  line-height: 1.55;
}

.report-block strong {
  display: block;
  margin-top: 16px;
  color: var(--green);
  font-size: 34px;
  line-height: 1;
}

.report-line {
  display: grid;
  gap: 4px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.report-line span {
  color: var(--muted);
  line-height: 1.35;
}

.empty-state {
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.74);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

  .detail-layout {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

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

  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    padding: 18px;
  }

  .searchbar,
  .metrics,
  .queue-grid,
  .record-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .lane {
    grid-template-columns: 1fr;
  }
}

