:root {
  --ink: #17211c;
  --muted: #68746d;
  --line: #d8ded9;
  --paper: #f6f8f6;
  --surface: #ffffff;
  --green: #176b4d;
  --green-2: #dff2e8;
  --amber: #a65c00;
  --amber-2: #fff0d7;
  --red: #a52b2b;
  --red-2: #fbe2e0;
  --blue: #225d8f;
  --blue-2: #e1eef8;
  --nav: #1d2923;
  --shadow: 0 8px 24px rgba(25, 42, 33, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  letter-spacing: 0;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
a { color: inherit; }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 540px) minmax(360px, 1fr);
  background: #edf1ee;
}
.login-panel { display: grid; align-content: center; padding: clamp(32px, 7vw, 92px); background: var(--surface); }
.login-art { position: relative; overflow: hidden; background: #1c2a23; color: #fff; display: grid; place-items: end start; padding: 64px; }
.login-art::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 54px, rgba(255,255,255,.04) 55px 56px), repeating-linear-gradient(0deg, transparent 0 54px, rgba(255,255,255,.04) 55px 56px); }
.login-art strong { position: relative; max-width: 650px; font-size: clamp(36px, 5vw, 72px); line-height: .98; }
.brand-lockup { display: flex; align-items: center; gap: 12px; margin-bottom: 52px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; color: white; background: var(--green); border-radius: 6px; font-weight: 900; }
.brand-name { font-size: 18px; font-weight: 800; }
.brand-sub { color: var(--muted); font-size: 12px; text-transform: uppercase; font-weight: 700; }
.login-panel h1 { margin: 0 0 10px; font-size: clamp(30px, 4vw, 48px); }
.login-panel p { color: var(--muted); line-height: 1.55; margin: 0 0 30px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 246px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 20px 14px; background: var(--nav); color: #eaf2ed; display: flex; flex-direction: column; z-index: 20; }
.sidebar .brand-lockup { margin: 2px 10px 26px; }
.sidebar .brand-sub { color: #9fb0a6; }
.nav { display: grid; gap: 3px; overflow-y: auto; }
.nav button { width: 100%; border: 0; color: #cbd7d0; background: transparent; padding: 10px 12px; border-radius: 6px; text-align: left; display: flex; align-items: center; gap: 10px; font-size: 14px; }
.nav button:hover { background: rgba(255,255,255,.07); color: white; }
.nav button.active { background: #eaf4ee; color: #183527; font-weight: 800; }
.nav-icon { width: 20px; text-align: center; font-weight: 900; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding: 16px 10px 4px; font-size: 11px; color: #9fb0a6; text-transform: uppercase; font-weight: 800; }

.main { min-width: 0; }
.topbar { height: 72px; display: flex; align-items: center; gap: 14px; justify-content: space-between; padding: 0 26px; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); }
.page-title { font-size: 19px; font-weight: 850; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.mode-tag { padding: 7px 9px; border-radius: 4px; color: var(--blue); background: var(--blue-2); font-size: 11px; font-weight: 900; }
.content { padding: 24px 26px 70px; max-width: 1600px; margin: 0 auto; }

.btn { min-height: 40px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); padding: 8px 14px; font-weight: 750; }
.btn:hover { border-color: #9aa79f; }
.btn.primary { color: white; background: var(--green); border-color: var(--green); }
.btn.danger { color: var(--red); border-color: #e2b7b3; background: var(--red-2); }
.btn.small { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; }

.hero-row { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.hero-row h1 { margin: 0; font-size: 30px; }
.hero-row p { margin: 5px 0 0; color: var(--muted); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 28px 0 10px; }
.section-head h2 { margin: 0; font-size: 17px; }
.section-head span { color: var(--muted); font-size: 13px; }

.score-strip { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.score { min-height: 94px; padding: 15px 16px; border: 0; border-right: 1px solid var(--line); background: var(--surface); text-align: left; }
.score[data-score-view]:hover { background: #f0f7f3; }
.score:last-child { border-right: 0; }
.score-label { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.score-value { font-size: 28px; font-weight: 900; margin-top: 7px; }
.score.alert .score-value { color: var(--amber); }
.score.bad .score-value { color: var(--red); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 4px 14px rgba(25,42,33,.04); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { font-size: 15px; margin: 0; }
.panel-body { padding: 15px 16px; }
.queue-list { display: grid; }
.queue-item { padding: 13px 16px; display: grid; grid-template-columns: 12px minmax(0,1fr) auto; gap: 12px; align-items: center; border-bottom: 1px solid #edf0ee; }
.queue-item:last-child { border-bottom: 0; }
.severity { width: 8px; height: 38px; background: var(--amber); border-radius: 3px; }
.severity.high { background: var(--red); }
.queue-title { font-weight: 800; font-size: 14px; }
.queue-detail { color: var(--muted); font-size: 12px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.station-grid { display: grid; grid-template-columns: repeat(7, minmax(90px, 1fr)); gap: 7px; }
.station-cell { min-height: 78px; border: 1px solid var(--line); padding: 9px; background: #fbfcfb; text-align: left; }
.station-cell:hover { border-color: var(--green); box-shadow: 0 3px 12px rgba(23,107,77,.1); }
.station-cell strong { display: block; font-size: 15px; }
.station-cell span { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.3; }
.station-cell.dedicated { border-left: 4px solid var(--blue); }
.station-cell.shared { border-left: 4px solid var(--green); }
.station-cell.available { background: var(--green-2); border-color: #a7d2bd; }

.storage-bars { display: grid; gap: 16px; }
.storage-row { display: grid; grid-template-columns: 92px minmax(0,1fr) 80px; gap: 12px; align-items: center; }
.bar { height: 11px; background: #e9edea; border-radius: 2px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--green); }
.storage-row small { color: var(--muted); }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 11px 12px; text-align: left; color: #5d6962; background: #f1f4f2; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 11px; text-transform: uppercase; }
td { padding: 11px 12px; border-bottom: 1px solid #edf0ee; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfb; }
.click-row { cursor: pointer; }
.click-row:hover { background: #eff7f2; }
.cell-title { font-weight: 800; }
.cell-sub { color: var(--muted); font-size: 11px; margin-top: 3px; }
.pill { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: #edf1ef; color: #46534c; font-size: 10px; font-weight: 850; text-transform: uppercase; white-space: nowrap; }
.pill.green { background: var(--green-2); color: var(--green); }
.pill.amber { background: var(--amber-2); color: var(--amber); }
.pill.red { background: var(--red-2); color: var(--red); }
.pill.blue { background: var(--blue-2); color: var(--blue); }

.filters { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 11px; color: var(--muted); font-weight: 800; text-transform: uppercase; }
.field input, .field select, .field textarea, .filters input, .filters select { min-height: 42px; padding: 9px 11px; border: 1px solid #cbd3ce; border-radius: 5px; background: white; color: var(--ink); }
.field textarea { min-height: 92px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }

.week-grid { min-width: 980px; display: grid; grid-template-columns: 90px repeat(7, minmax(120px,1fr)); }
.week-cell { min-height: 62px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px; background: white; font-size: 11px; }
.week-head { min-height: 38px; background: #eef2ef; font-weight: 800; text-transform: uppercase; }
.week-station { font-weight: 900; background: #f7f9f7; }
.schedule-block { background: var(--green-2); color: var(--green); padding: 6px; border-left: 3px solid var(--green); margin-bottom: 4px; }
.schedule-block.dedicated { background: var(--blue-2); color: var(--blue); border-color: var(--blue); }
.schedule-block, .availability { width: 100%; border-top: 0; border-right: 0; border-bottom: 0; text-align: left; font-size: inherit; }
.schedule-block.booking { background: var(--amber-2); color: var(--amber); border-color: var(--amber); }
.availability { min-height: 42px; border: 1px dashed #9fc5b0; color: var(--green); background: #f3faf6; text-align: center; }
.availability:hover { background: var(--green-2); }
.week-head small { display: block; margin-top: 3px; color: var(--muted); }
.current-day { background: #fff8e9; box-shadow: inset 0 3px 0 #e7a52d; }
.week-controls { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 12px; }
.week-controls strong { min-width: 240px; text-align: center; }

.empty { padding: 50px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 17px; margin-bottom: 5px; }
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(290px, .75fr); gap: 14px; }
.detail-list { display: grid; }
.detail-row { display: flex; justify-content: space-between; gap: 18px; padding: 10px 0; border-bottom: 1px solid #edf0ee; }
.detail-row:last-child { border-bottom: 0; }
.detail-row span { color: var(--muted); }
.detail-row strong { text-align: right; }
.detail-button { width: 100%; border: 0; background: transparent; }
.detail-button:hover { background: #f5faf7; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.detail-head { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 16px; align-items: center; margin-bottom: 20px; }
.detail-heading h1 { margin: 0; font-size: 30px; }
.detail-heading p { margin: 5px 0 0; color: var(--muted); }
.action-group { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.warning-banner { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 12px 14px; margin-bottom: 14px; color: #683900; background: var(--amber-2); border-left: 5px solid var(--amber); }
.warning-banner span { font-size: 13px; }
.cleanup-strip { margin-top: 18px; padding: 15px 16px; display: flex; justify-content: space-between; align-items: center; gap: 14px; border: 1px solid var(--line); background: #eef2ef; }
.cleanup-strip strong, .cleanup-strip span { display: block; }
.cleanup-strip span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.queue-button { width: 100%; border: 0; background: var(--surface); text-align: left; }
.queue-button:hover { background: #f5faf7; }
.record-status { border: 0; padding: 0; background: transparent; }
.checklist { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.check-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid var(--line); background: var(--surface); }
.check-item.complete { border-color: #9ac9b2; background: var(--green-2); }
.check-item.not-applicable { background: #f0f2f1; color: #66716b; }
.check-item strong, .check-item span { display: block; }
.check-item span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.check-item select { min-height: 38px; max-width: 165px; border: 1px solid #cbd3ce; background: white; }
.ordered-checklist .check-item { display: grid; grid-template-columns: 30px minmax(0,1fr) 150px; }
.sequence-number { width: 26px; height: 26px; display: grid !important; place-items: center; margin: 0 !important; border-radius: 50%; background: #e8edea; color: var(--ink) !important; font-weight: 900; }
.check-item.complete .sequence-number { color: white !important; background: var(--green); }
.readiness-milestone { grid-column: 1 / -1; border-width: 2px; }
.progress-line { height: 8px; margin: -6px 0 18px; background: #dfe5e1; overflow: hidden; }
.progress-line span { display: block; height: 100%; background: var(--green); }
.quiet { color: var(--muted); line-height: 1.55; }
.decision-summary { display: grid; grid-template-columns: minmax(0,1fr) minmax(230px,.7fr); gap: 12px; margin-bottom: 18px; }
.decision-summary h3 { margin: 8px 0 4px; }
.decision-summary p { color: var(--muted); margin: 0; }
.assessment { display: grid; align-content: center; gap: 5px; padding: 14px; border-left: 5px solid var(--green); background: var(--green-2); }
.assessment.fail { border-color: var(--red); background: var(--red-2); }
.assessment span { font-size: 12px; }

dialog { width: min(650px, calc(100vw - 28px)); max-height: calc(100vh - 40px); border: 0; border-radius: 8px; padding: 0; box-shadow: 0 28px 90px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(11,20,15,.58); backdrop-filter: blur(3px); }
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: 360px; padding: 12px 15px; color: white; background: var(--ink); border-radius: 6px; box-shadow: var(--shadow); z-index: 80; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

.mobile-nav { display: none; }

@media (max-width: 1050px) {
  .score-strip { grid-template-columns: repeat(3, 1fr); }
  .score:nth-child(3) { border-right: 0; }
  .score:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .dashboard-grid, .split, .detail-grid { grid-template-columns: 1fr; }
  .station-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { height: 60px; padding: 0 14px; }
  .mode-tag { display: none; }
  .content { padding: 17px 14px 92px; }
  .hero-row { align-items: start; }
  .hero-row h1 { font-size: 25px; }
  .score-strip { grid-template-columns: repeat(2, 1fr); }
  .score { min-height: 82px; }
  .score:nth-child(2n) { border-right: 0; }
  .score:nth-child(3) { border-right: 1px solid var(--line); }
  .score:nth-child(-n+4) { border-bottom: 1px solid var(--line); }
  .score-value { font-size: 24px; }
  .station-grid { grid-template-columns: repeat(3, 1fr); }
  .station-cell { min-height: 72px; }
  .queue-item { grid-template-columns: 10px minmax(0,1fr); }
  .queue-item .btn { grid-column: 2; justify-self: start; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .storage-row { grid-template-columns: 76px minmax(0,1fr) 66px; }
  .mobile-nav { position: fixed; display: grid; grid-template-columns: repeat(5, 1fr); left: 0; right: 0; bottom: 0; background: var(--nav); z-index: 30; padding: 6px 4px max(6px, env(safe-area-inset-bottom)); }
  .mobile-nav button { min-height: 54px; border: 0; background: transparent; color: #b9c7bf; font-size: 10px; display: grid; place-items: center; gap: 2px; }
  .mobile-nav button.active { color: white; font-weight: 800; }
  .mobile-nav .nav-icon { font-size: 17px; }
  .table-wrap { margin-left: -14px; margin-right: -14px; border-left: 0; border-right: 0; border-radius: 0; }
  .detail-head { grid-template-columns: auto minmax(0,1fr); align-items: start; }
  .detail-head .action-group { grid-column: 1 / -1; justify-content: stretch; }
  .detail-head .action-group .btn { flex: 1; }
  .detail-heading h1 { font-size: 25px; }
  .warning-banner { grid-template-columns: 1fr; }
  .cleanup-strip { align-items: stretch; flex-direction: column; }
  .week-controls { justify-content: stretch; flex-wrap: wrap; }
  .week-controls strong { order: -1; min-width: 100%; }
  .week-controls .btn { flex: 1; }
  .checklist { grid-template-columns: 1fr; }
  .ordered-checklist .check-item { grid-template-columns: 30px minmax(0,1fr); }
  .ordered-checklist .check-item select, .ordered-checklist .check-item > .pill { grid-column: 2; width: 100%; max-width: none; }
  .decision-summary { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .station-grid { grid-template-columns: repeat(2, 1fr); }
  .top-actions .btn:not(.primary) { display: none; }
  .hero-row { display: block; }
  .hero-row .btn { margin-top: 12px; width: 100%; }
}
