:root {
  --ink: #1d3557;
  --paper: #fff8f0;
  --paper-strong: #ffffff;
  --teal: #2a9d8f;
  --coral: #e76f51;
  --muted: #6a7280;
  --line: rgba(29, 53, 87, 0.16);
  --shadow: 0 18px 48px rgba(29, 53, 87, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(42, 157, 143, 0.08) 1px, transparent 1px) 0 0 / 44px 44px,
    var(--paper);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
}

.brand-lockup strong,
.brand-lockup span {
  display: block;
}

.brand-lockup strong {
  font-size: 18px;
}

.brand-lockup span,
.eyebrow,
.metric span,
.panel-head span,
.lane-head span,
.detail-list dt,
.rail-note span,
.timeline span,
.team-tile small {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-lockup span,
.rail-note span,
.nav-item {
  color: rgba(255, 248, 240, 0.72);
}

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

.nav-item {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(255, 248, 240, 0.12);
  color: var(--paper);
}

.rail-note {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid rgba(255, 248, 240, 0.18);
  padding-top: 16px;
}

.rail-note strong {
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--teal);
  color: var(--paper-strong);
  font-size: 12px;
}

.rail-note strong.source-demo {
  background: var(--coral);
}

.workspace {
  min-width: 0;
  padding: 22px clamp(16px, 3vw, 34px) 40px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
}

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

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

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.2;
}

.topbar-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.search-box {
  display: grid;
  gap: 6px;
}

.search-box span {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
}

.search-box input {
  width: min(42vw, 320px);
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
  color: var(--ink);
  font-size: 18px;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
  animation: screen-in 180ms ease-out;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.metric {
  min-height: 104px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.78);
}

.metric strong {
  display: block;
  margin-top: 12px;
  font-size: 34px;
  line-height: 1;
}

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

.status-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.status-switch button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
}

.status-switch button.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.lane-board,
.queue-panel,
.inspector {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow);
}

.lane-board {
  margin-bottom: 18px;
  padding: 16px;
}

.lane-head,
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-head.wide {
  margin-bottom: 18px;
}

.lane-head span,
.panel-head span {
  color: var(--muted);
  text-align: right;
}

.lanes {
  display: grid;
  gap: 12px;
}

.lane {
  display: grid;
  grid-template-columns: 150px minmax(220px, 1fr);
  gap: 14px;
  align-items: center;
}

.lane-label strong,
.lane-label span {
  display: block;
}

.lane-label span {
  color: var(--muted);
  font-size: 12px;
}

.lane-track {
  position: relative;
  height: 54px;
  overflow: hidden;
  border: 1px solid rgba(29, 53, 87, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(29, 53, 87, 0.1) 1px, transparent 1px) 0 0 / 25% 100%,
    rgba(255, 248, 240, 0.7);
}

.lane-chip {
  position: absolute;
  top: 8px;
  min-width: 74px;
  height: 38px;
  overflow: hidden;
  border: 0;
  border-radius: 7px;
  padding: 5px 8px;
  background: var(--teal);
  color: #fff;
  text-align: left;
  transition: transform 160ms ease, filter 160ms ease;
}

.lane-chip:hover {
  transform: translateY(-2px);
  filter: brightness(0.98);
}

.lane-chip strong,
.lane-chip span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lane-chip span {
  font-size: 10px;
  opacity: 0.86;
}

.lane-chip strong {
  font-size: 12px;
}

.lane-chip.has-conflict {
  background: var(--coral);
}

.queue-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.queue-panel,
.inspector {
  min-width: 0;
  padding: 16px;
}

.table-wrap {
  overflow-x: auto;
}

.queue-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.queue-table th {
  padding: 0 10px 10px;
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
}

.queue-table td {
  border-top: 1px solid var(--line);
  padding: 13px 10px;
  vertical-align: middle;
}

.queue-table tr {
  transition: background 140ms ease;
}

.queue-table tr:hover,
.queue-table tr.is-selected {
  background: rgba(42, 157, 143, 0.1);
}

.queue-table td strong,
.queue-table td span {
  display: block;
}

.queue-table td strong {
  max-width: 330px;
}

.queue-table td span {
  color: var(--muted);
  font-size: 13px;
}

.priority,
.zone-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.priority {
  background: rgba(42, 157, 143, 0.12);
  color: var(--teal);
}

.priority-urgent,
.priority-high {
  background: rgba(231, 111, 81, 0.13);
  color: #b9472d;
}

.priority-low {
  background: rgba(29, 53, 87, 0.1);
  color: var(--ink);
}

.zone-chip {
  display: inline-flex;
  background: rgba(29, 53, 87, 0.08);
  color: var(--ink);
}

.conflict-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--coral);
  vertical-align: middle;
}

.resource-line,
.capacity {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(29, 53, 87, 0.13);
}

.resource-line {
  width: 110px;
  margin-bottom: 6px;
}

.resource-line span,
.capacity span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.inspector {
  position: sticky;
  top: 22px;
}

.inspector-head h2 {
  margin: 12px 0 8px;
  font-size: 22px;
}

.inspector-head p {
  margin-bottom: 16px;
  color: var(--muted);
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.detail-list div {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.conflict-box,
.quiet-box {
  margin: 14px 0;
  border-radius: 8px;
  padding: 12px;
}

.conflict-box {
  background: rgba(231, 111, 81, 0.12);
  color: #8f351f;
}

.quiet-box {
  background: rgba(42, 157, 143, 0.1);
  color: #176d63;
}

.conflict-box span,
.quiet-box span {
  display: block;
  margin-bottom: 4px;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  text-transform: uppercase;
}

.action-form {
  display: grid;
  gap: 10px;
}

.action-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.action-form textarea,
.action-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
}

.action-form button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
}

.timeline,
.rule-grid,
.team-grid {
  display: grid;
  gap: 10px;
}

.timeline-item,
.rule-tile,
.team-tile {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 12px 30px rgba(29, 53, 87, 0.07);
}

.timeline-item {
  grid-template-columns: 120px minmax(0, 1fr);
}

.timeline-item time {
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.timeline-item p,
.rule-tile p,
.team-tile p {
  margin: 5px 0;
}

.timeline span,
.rule-tile span,
.team-tile span {
  color: var(--muted);
}

.rule-grid,
.team-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.rule-tile,
.team-tile {
  min-height: 140px;
}

.rule-tile {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.rule-tile p {
  grid-column: 1 / -1;
}

.toggle {
  display: inline-flex;
  align-items: center;
}

.toggle input {
  position: absolute;
  opacity: 0;
}

.toggle span {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: rgba(29, 53, 87, 0.18);
}

.toggle span::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 150ms ease;
  content: "";
}

.toggle input:checked + span {
  background: var(--teal);
}

.toggle input:checked + span::after {
  transform: translateX(18px);
}

.team-tile .capacity {
  width: 100%;
}

.empty-state,
.table-empty {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.empty-state.error {
  color: #9b2f19;
}

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

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

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

  .nav-item {
    text-align: center;
  }

  .rail-note {
    display: none;
  }

  .topbar,
  .queue-layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions {
    align-items: stretch;
  }

  .search-box {
    flex: 1;
  }

  .search-box input {
    width: 100%;
  }

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

  .inspector {
    position: static;
  }
}

@media (max-width: 640px) {
  .workspace {
    padding: 16px 12px 28px;
  }

  .brand-lockup {
    align-items: flex-start;
  }

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

  .metric-row {
    grid-template-columns: 1fr;
  }

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

  .lane-track {
    min-width: 0;
  }

  .lane-head,
  .panel-head {
    display: grid;
  }

  .lane-head span,
  .panel-head span {
    text-align: left;
  }

  .detail-list,
  .timeline-item,
  .rule-tile {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
  }
}

