:root {
  color-scheme: dark;
  --page: #0d1110;
  --bar: #151a18;
  --panel: #181e1b;
  --panel-high: #202722;
  --line: #343d37;
  --line-strong: #4a574d;
  --ink: #f5f7f4;
  --muted: #a8b1aa;
  --subtle: #78827b;
  --green: #b9f35c;
  --green-dark: #18260b;
  --blue: #79bfff;
  --blue-dark: #102438;
  --amber: #ffc46b;
  --amber-dark: #30200b;
  --red: #ff8680;
  --red-dark: #321414;
  --white: #ffffff;
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--page); color: var(--ink); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, select { min-height: 40px; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }

.app-shell { width: min(1600px, 100%); margin: 0 auto; padding: 0 24px 28px; }
.topbar { display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid #72923b; border-radius: 6px; background: var(--green-dark); color: var(--green); font-size: 0.77rem; font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 0.84rem; }
.brand small { margin-top: 2px; color: var(--subtle); font-size: 0.68rem; }
.topbar-status { display: flex; align-items: center; gap: 12px; }
.environment { color: var(--subtle); font-size: 0.7rem; }

.human-alert { position: sticky; top: 0; z-index: 40; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; margin: 12px 0 0; border: 2px solid #ffd06f; border-radius: 8px; padding: 12px 14px; background: #33220b; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38); }
.human-alert-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; background: var(--amber); color: #241503; font-size: 1.35rem; font-weight: 900; }
.human-alert-copy { min-width: 0; }
.human-alert-copy p, .human-alert-copy strong, .human-alert-copy span { display: block; margin: 0; overflow-wrap: anywhere; }
.human-alert-copy p { color: var(--amber); font-size: 0.66rem; font-weight: 850; text-transform: uppercase; letter-spacing: 0.08em; }
.human-alert-copy strong { margin-top: 2px; font-size: 0.94rem; }
.human-alert-copy span { margin-top: 3px; color: #f3d6a5; font-size: 0.7rem; }
.human-alert-actions { display: flex; gap: 8px; }
.button-alert { border-color: #ffd06f; background: #ffd06f; color: #231605; }
.button-alert:hover:not(:disabled) { background: #ffe09e; }

.page-heading { display: flex; min-height: 132px; align-items: center; justify-content: space-between; gap: 28px; padding: 26px 0; }
.page-heading h1 { margin: 2px 0 6px; font-size: 2rem; line-height: 1.1; letter-spacing: 0; }
.page-heading p { margin: 0; color: var(--muted); font-size: 0.86rem; }
.eyebrow, .kicker { color: var(--green) !important; font-size: 0.66rem !important; font-weight: 800; text-transform: uppercase; letter-spacing: 0.09em !important; }
.heading-actions, .shift-controls, .setup-actions, .call-buttons, .queue-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 14px; background: var(--panel-high); color: var(--ink); font-size: 0.76rem; font-weight: 750; }
.button:hover:not(:disabled) { border-color: #69766c; background: #29312b; }
.button-primary { border-color: #9cce4d; background: var(--green); color: #11170c; }
.button-primary:hover:not(:disabled) { background: #cffc83; }
.button-secondary { background: #252d28; }
.button-danger { border-color: #75403d; background: var(--red-dark); color: #ffd7d4; }
.button-warning { border-color: #8d6728; background: var(--amber-dark); color: #ffe1b4; }
.button-takeover { border-color: #456c8c; background: var(--blue-dark); color: #d5ebff; }

.status-pill { display: inline-flex; min-height: 26px; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px; padding: 0 10px; color: var(--muted); font-size: 0.66rem; font-weight: 750; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-neutral { color: var(--muted); }
.status-ready { border-color: #547329; background: var(--green-dark); color: var(--green); }
.status-active { border-color: #34638b; background: var(--blue-dark); color: var(--blue); }
.status-warning { border-color: #866129; background: var(--amber-dark); color: var(--amber); }
.status-takeover { border-color: #4d7598; background: #132c42; color: #bfe1ff; }

.workstation-grid { display: grid; grid-template-columns: 218px minmax(570px, 1fr) 276px; gap: 14px; align-items: start; }
.left-rail, .main-column, .right-rail { display: grid; gap: 14px; min-width: 0; }
.left-rail, .right-rail { position: sticky; top: 14px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); }
.main-column > .panel, .right-rail > .panel { padding: 18px; }
.employee-panel, .safety-panel { padding: 18px; }
.panel h2, .panel h3, .panel p { overflow-wrap: anywhere; }
.panel h2 { margin: 3px 0 0; font-size: 1rem; line-height: 1.25; }
.panel h3 { margin: 3px 0 7px; font-size: 1.05rem; }
.panel p { margin: 6px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.5; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.panel-heading.compact { margin-bottom: 14px; }
.avatar { display: grid; width: 42px; height: 42px; place-items: center; margin-bottom: 14px; border: 1px solid #59782c; border-radius: 7px; background: var(--green-dark); color: var(--green); font-size: 0.82rem; font-weight: 850; }
.employee-panel > p:not(.kicker) { margin-top: 4px; }
.presence-row { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.68rem; }
.presence-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--subtle); }
.presence-dot.online { background: var(--green); }
.presence-dot.warning { background: var(--amber); }
.presence-age { color: var(--subtle); }

.section-nav { overflow: hidden; box-shadow: none; }
.nav-item { display: grid; width: 100%; min-height: 44px; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border: 0; border-bottom: 1px solid var(--line); padding: 0 14px; background: transparent; color: var(--muted); text-align: left; font-size: 0.75rem; font-weight: 700; }
.nav-item:last-child { border-bottom: 0; }
.nav-item:hover, .nav-item.active { background: var(--panel-high); color: var(--ink); }
.nav-item.active { box-shadow: inset 3px 0 0 var(--green); }
.nav-item span { display: grid; min-width: 22px; height: 22px; place-items: center; border-radius: 11px; background: #303833; color: var(--muted); font-size: 0.64rem; }
.safety-panel ul { display: grid; gap: 10px; margin: 14px 0 0; padding: 0; list-style: none; }
.safety-panel li { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 0.7rem; }
.checkmark, .lockmark { display: grid; width: 20px; height: 20px; flex: 0 0 20px; place-items: center; border: 1px solid #507126; border-radius: 50%; background: var(--green-dark); color: var(--green); font-size: 0.58rem; font-weight: 900; }
.lockmark { border-color: #7e5d27; background: var(--amber-dark); color: var(--amber); }

.shift-controls { display: grid; grid-template-columns: minmax(210px, 1fr) repeat(4, auto); align-items: end; }
.system-assignment { display: grid; min-height: 56px; align-content: center; gap: 2px; border-left: 3px solid var(--green); padding-left: 11px; }
.system-assignment span { color: var(--subtle); font-size: 0.61rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.system-assignment strong { font-size: 0.78rem; }
.system-assignment small { color: var(--muted); font-size: 0.65rem; }
.field { display: grid; gap: 6px; min-width: 0; color: var(--muted); font-size: 0.68rem; font-weight: 700; }
.field > span { min-height: 16px; }
.field select, .field input, .field textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 5px; background: #101512; color: var(--ink); }
.field select, .field input { min-height: 40px; padding: 0 11px; }
.field textarea { min-height: 62px; resize: vertical; padding: 10px 11px; line-height: 1.4; }
.required-field > span::after { color: var(--amber); content: " - required"; }
.metrics-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 18px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.metrics-strip > div { min-height: 64px; padding: 12px 14px; border-right: 1px solid var(--line); }
.metrics-strip > div:last-child { border-right: 0; }
.metrics-strip span, .metrics-strip strong { display: block; }
.metrics-strip span { color: var(--subtle); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.08em; }
.metrics-strip strong { margin-top: 6px; font-size: 1rem; }

.setup-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 22px; align-items: center; }
.setup-row strong { font-size: 0.82rem; }
.bridge-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 22px; align-items: center; margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--line); }
.bridge-row strong { font-size: 0.78rem; }
.bridge-row p { margin-top: 3px; }
.progress-count { color: var(--subtle); font-size: 0.68rem; font-weight: 800; }
.meter { width: min(360px, 100%); height: 6px; margin-top: 12px; overflow: hidden; border-radius: 3px; background: #0c100e; }
.meter span { display: block; width: 0; height: 100%; background: var(--green); transition: width 80ms linear; }

.empty-task { min-height: 88px; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: 6px; color: var(--muted); font-size: 0.78rem; text-align: center; }
.active-task { display: grid; gap: 16px; }
.task-identity { border-left: 3px solid var(--green); padding-left: 12px; }
.task-identity > span { color: var(--green); font-size: 0.64rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.call-surface { display: grid; grid-template-columns: 96px minmax(180px, 1fr); gap: 16px 20px; align-items: center; border: 1px solid var(--line); border-radius: 7px; padding: 16px; background: #111613; }
.call-buttons { grid-column: 1 / -1; }
.sound-orb { display: flex; width: 84px; height: 66px; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-high); }
.sound-orb span { width: 5px; height: 16px; border-radius: 3px; background: var(--subtle); }
.sound-orb span:nth-child(2), .sound-orb span:nth-child(4) { height: 28px; }
.sound-orb span:nth-child(3) { height: 40px; }
.sound-orb.active span { background: var(--green); animation: meter-pulse 900ms ease-in-out infinite alternate; }
.sound-orb.active span:nth-child(2) { animation-delay: 150ms; }
.sound-orb.active span:nth-child(3) { animation-delay: 300ms; }
.sound-orb.active span:nth-child(4) { animation-delay: 450ms; }
.sound-orb.active span:nth-child(5) { animation-delay: 600ms; }
@keyframes meter-pulse { from { transform: scaleY(0.45); } to { transform: scaleY(1); } }
.disposition-form { display: grid; grid-template-columns: 180px 190px minmax(180px, 1fr) auto; gap: 10px; align-items: end; padding-top: 15px; border-top: 1px solid var(--line); }
.notes-field textarea { min-height: 40px; max-height: 120px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 620px; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 11px 9px; text-align: left; font-size: 0.7rem; }
th { color: var(--subtle); font-size: 0.61rem; text-transform: uppercase; letter-spacing: 0.08em; }
td { color: var(--muted); }
td strong, td small { display: block; }
td strong { color: var(--ink); font-size: 0.73rem; }
td small { margin-top: 3px; color: var(--subtle); font-size: 0.63rem; }
.table-status { display: inline-flex; min-height: 24px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 0 8px; font-size: 0.62rem; font-weight: 750; white-space: nowrap; }
.table-status.ready { border-color: #4c6e27; color: var(--green); }
.table-status.locked { border-color: #775927; color: var(--amber); }

.line-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.line-card { min-height: 72px; border: 1px solid var(--line); border-radius: 6px; padding: 11px; background: #111613; }
.line-card strong, .line-card span { display: block; }
.line-card strong { font-size: 0.7rem; }
.line-card span { margin-top: 7px; color: var(--subtle); font-size: 0.61rem; line-height: 1.35; }
.line-card.provisioned { border-color: #4b652d; background: #16200f; }
.line-card.waiting { border-color: #7f5d27; background: var(--amber-dark); }
.line-card.connected { border-color: #3d6484; background: var(--blue-dark); }
.human-queue-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: end; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.human-queue { margin: 0; padding-left: 22px; color: var(--muted); font-size: 0.7rem; }
.human-queue li { margin: 4px 0; }
.human-queue strong, .human-queue span { display: block; }
.human-queue span { margin-top: 2px; color: var(--subtle); font-size: 0.62rem; }
.sample-action { width: 100%; margin-top: 8px; }
.sample-shipment-form { display: grid; gap: 7px; margin-top: 9px; }
.sample-shipment-form input { width: 100%; min-height: 38px; border: 1px solid var(--line-strong); border-radius: 5px; padding: 0 9px; background: #101512; color: var(--ink); font-size: 0.68rem; }
.sample-shipment-form .button { width: 100%; }

.compact-list, .event-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.compact-list li, .event-list li { padding: 11px 0; border-bottom: 1px solid var(--line); }
.compact-list li:last-child, .event-list li:last-child { border-bottom: 0; }
.compact-list strong, .compact-list span, .event-list strong, .event-list time { display: block; }
.compact-list strong, .event-list strong { font-size: 0.7rem; line-height: 1.35; }
.compact-list span, .event-list time { margin-top: 4px; color: var(--subtle); font-size: 0.62rem; line-height: 1.4; }
.empty-list { color: var(--subtle); font-size: 0.7rem; }
.activity-panel { background: #161c19; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; width: min(380px, calc(100vw - 28px)); border: 1px solid #556259; border-radius: 7px; padding: 13px 15px; background: #202923; box-shadow: var(--shadow); color: var(--ink); font-size: 0.76rem; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity 150ms ease, transform 150ms ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: #7a413e; background: #2c1717; color: #ffd8d5; }
footer { display: flex; justify-content: space-between; gap: 24px; padding: 22px 2px 0; color: var(--subtle); font-size: 0.66rem; }

@media (max-width: 1260px) {
  .workstation-grid { grid-template-columns: 210px minmax(560px, 1fr); }
  .right-rail { position: static; grid-column: 1 / -1; grid-template-columns: repeat(3, 1fr); }
  .disposition-form { grid-template-columns: 1fr 1fr; }
  .notes-field { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .app-shell { padding-inline: 16px; }
  .page-heading { min-height: 118px; }
  .workstation-grid { grid-template-columns: 1fr; }
  .left-rail { position: static; grid-template-columns: 1fr 1fr; }
  .section-nav { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); }
  .nav-item { border-right: 1px solid var(--line); border-bottom: 0; }
  .nav-item:last-child { border-right: 0; }
  .shift-controls { grid-template-columns: 1fr 1fr; }
  .campaign-field { grid-column: 1 / -1; }
  .line-grid { grid-template-columns: repeat(3, 1fr); }
  .right-rail { grid-template-columns: 1fr 1fr; }
  .activity-panel { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .app-shell { padding-inline: 12px; }
  .topbar { min-height: 62px; }
  .environment, .brand small { display: none; }
  .page-heading { align-items: flex-start; flex-direction: column; min-height: auto; padding: 22px 0; }
  .page-heading h1 { font-size: 1.65rem; }
  .heading-actions { width: 100%; }
  .heading-actions .button { flex: 1; }
  .left-rail, .right-rail { grid-template-columns: 1fr; }
  .section-nav { grid-template-columns: 1fr 1fr; }
  .nav-item { border-right: 0; border-bottom: 1px solid var(--line); }
  .main-column > .panel, .right-rail > .panel, .employee-panel, .safety-panel { padding: 15px; }
  .panel-heading { align-items: flex-start; }
  .shift-controls, .metrics-strip, .setup-row, .bridge-row, .disposition-form, .human-queue-row { grid-template-columns: 1fr; }
  .shift-controls .button, .setup-actions .button, .call-buttons .button, .queue-actions .button, .disposition-form .button { width: 100%; }
  .metrics-strip > div { min-height: 54px; border-right: 0; border-bottom: 1px solid var(--line); }
  .metrics-strip > div:last-child { border-bottom: 0; }
  .setup-actions, .call-buttons, .queue-actions { width: 100%; }
  .call-surface { grid-template-columns: 1fr; }
  .sound-orb { width: 100%; }
  .call-buttons { grid-column: auto; }
  .line-grid { grid-template-columns: 1fr 1fr; }
  .notes-field, .activity-panel { grid-column: auto; }
  .toast { right: 14px; bottom: 14px; }
  .human-alert { grid-template-columns: 38px minmax(0, 1fr); }
  .human-alert-icon { width: 36px; height: 36px; }
  .human-alert-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .human-alert-actions .button { width: 100%; }
  footer { flex-direction: column; gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
:root { --private-test-border: rgba(185, 243, 92, .25); }
.private-tests-panel { border-color: var(--private-test-border); }
.private-test-hint { color: var(--muted, #a6b2ab); line-height: 1.5; margin: 0 0 16px; }
.private-test-targets { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; }
.private-test-targets > div { display: flex; flex: 1; min-width: 140px; flex-direction: column; gap: 8px; }
.private-test-targets small { color: var(--muted, #a6b2ab); font-size: 11px; }
.private-test-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.private-test-scope { color: var(--muted, #a6b2ab); font-size: 11px; line-height: 1.6; margin: 14px 0 0; }
