/* ── Design tokens ──────────────────────────────────────────── */
:root {
  --navy:    #111C35;
  --navy-2:  #1A2847;
  --navy-3:  #253660;
  --bg:      #F5F4F0;
  --surface: #FFFFFF;
  --border:  #E5E2DC;
  --border-2:#D0CDC6;
  --text:    #1A1A2E;
  --text-2:  #6B6882;
  --text-3:  #A8A5B8;
  --purple:  #5B4CF5;
  --purple-2:#EEF0FF;
  --gold:    #D4A84B;
  --green:   #16A34A;
  --green-bg:#DCFCE7;
  --orange:  #D97706;
  --orange-bg:#FEF3C7;
  --red:     #DC2626;
  --red-bg:  #FEE2E2;
  --blue:    #2563EB;
  --blue-bg: #DBEAFE;
  --radius:  10px;
  --shadow:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.12);
  --sidebar-w: 200px;
  --transition: 150ms ease;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6; }
.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 200;
  padding: 8px 12px; border-radius: 7px;
  background: var(--navy); color: #fff;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }
button { font: inherit; cursor: pointer; background: none; border: none; }
input, textarea, select { font: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round; }

/* ── Shell layout ───────────────────────────────────────────── */
.shell { display: flex; height: 100dvh; overflow: hidden; }
.mobile-nav { display: none; }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--navy); color: #fff;
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 16px; border-bottom: 1px solid var(--navy-3);
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--purple); display: flex; align-items: center;
  justify-content: center; font-size: 16px; font-weight: 700;
  color: #fff; flex-shrink: 0;
}
.brand-copy { display: flex; flex-direction: column; }
.brand-copy strong { font-size: 13px; line-height: 1.2; }
.brand-copy small { font-size: 10px; color: rgba(255,255,255,.45); letter-spacing: .05em; }
nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 7px;
  color: rgba(255,255,255,.65); font-size: 13px; font-weight: 500;
  transition: background var(--transition), color var(--transition);
  position: relative; width: 100%; text-align: left;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item:hover { background: var(--navy-2); color: #fff; }
.nav-item.is-active { background: var(--navy-2); color: #fff; }
.nav-item.is-active::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--purple);
}
.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--navy-3); color: rgba(255,255,255,.8);
  font-size: 11px; font-style: normal; font-weight: 600;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.nav-badge.is-alert { background: var(--red); color: #fff; }
.sidebar-foot { padding: 12px 8px 16px; border-top: 1px solid var(--navy-3); }
.user-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 7px; width: 100%;
  color: rgba(255,255,255,.65); font-size: 13px;
  transition: background var(--transition);
}
.user-btn:hover { background: var(--navy-2); color: #fff; }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--navy-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: rgba(255,255,255,.8); flex-shrink: 0;
}
.identity-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--navy-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: rgba(255,255,255,.9); flex-shrink: 0;
}
.user-info {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.user-info strong {
  font-size: 13px; font-weight: 600; color: rgba(255,255,255,.9); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-info small {
  font-size: 11px; color: rgba(255,255,255,.5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  margin-left: auto;
}
.nav-badge:not(.is-alert):empty { display: none; }
.nav-badge.is-alert { background: var(--orange); }
.nav-item[aria-current="page"] { background: var(--navy-2); color: #fff; }

/* ── Workspace ──────────────────────────────────────────────── */
.workspace {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
}
.page-loader {
  flex: 1; display: flex; align-items: center; justify-content: center;
}
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--purple);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-line {
  height: 2px; background: transparent;
  transition: background .2s;
}
.progress-line.is-loading {
  background: var(--purple);
  animation: progress-pulse 1.2s ease-in-out infinite;
}
@keyframes progress-pulse { 0%,100%{opacity:.6} 50%{opacity:1} }

/* ── Page chrome ────────────────────────────────────────────── */
.page-header {
  padding: 20px 24px 0;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.page-header-left {
  flex: 1; min-width: 0;
}
.page-header-right {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.connection {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 6px; font-size: 12px;
  background: var(--bg); color: var(--text-3); border: 1px solid var(--border-2);
}
.connection::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3);
}
.connection.is-online {
  background: var(--green-bg); color: var(--green); border-color: var(--green);
}
.connection.is-online::before { background: var(--green); }
.connection.is-error {
  background: var(--red-bg); color: var(--red); border-color: var(--red);
}
.connection.is-error::before { background: var(--red); }
.page-title { font-size: 18px; font-weight: 700; line-height: 1.3; }
.page-subtitle { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }
.page-content { padding: 16px 24px 32px; display: flex; flex-direction: column; gap: 16px; }

/* ── Cards / Surface ────────────────────────────────────────── */
.card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.card-head {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-body { padding: 16px 20px; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 7px;
  background: var(--purple); color: #fff;
  font-size: 13px; font-weight: 600;
  transition: opacity var(--transition), transform var(--transition);
}
.btn-primary:hover { opacity: .88; }
.btn-primary:active { transform: scale(.97); }
.btn-primary.full { width: 100%; justify-content: center; }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 7px;
  border: 1px solid var(--border-2); background: var(--surface);
  color: var(--text); font-size: 13px; font-weight: 500;
  transition: background var(--transition);
}
.btn-secondary:hover { background: var(--bg); }
.btn-danger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 7px;
  background: var(--red-bg); color: var(--red);
  font-size: 13px; font-weight: 600;
  transition: opacity var(--transition);
}
.btn-danger:hover { opacity: .8; }
.btn-icon {
  width: 32px; height: 32px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); transition: background var(--transition);
}
.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon svg { width: 16px; height: 16px; }
.btn-link { color: var(--purple); font-size: 13px; background: none; border: none; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }

/* ── Status badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 99px;
  font-size: 12px; font-weight: 600; line-height: 1.6;
  white-space: nowrap;
}
.badge.wait    { background: var(--bg); color: var(--text-2); border: 1px solid var(--border-2); }
.badge.active  { background: var(--blue-bg); color: var(--blue); }
.badge.done    { background: var(--green-bg); color: var(--green); }
.badge.warn    { background: var(--orange-bg); color: var(--orange); }
.badge.risk    { background: var(--red-bg); color: var(--red); }
.badge.purple  { background: var(--purple-2); color: var(--purple); }

/* ── Stats grid ─────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 16px 20px;
}
.stat-label { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; color: var(--text); }
.stat-value.gold { color: var(--gold); }
.stat-value.green { color: var(--green); }
.stat-value.red   { color: var(--red); }
.stat-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ── Day progress (D1-D7) ───────────────────────────────────── */
.day-progress {
  display: flex; gap: 3px; align-items: center; min-width: 0;
}
.day-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--border-2); flex-shrink: 0; position: relative;
}
.day-dot.done { background: var(--green); }
.day-dot.active { background: var(--purple); box-shadow: 0 0 0 2px var(--purple-2); }
.day-dot.pending { background: var(--border-2); }
.day-label { font-size: 12px; color: var(--text-2); margin-left: 6px; white-space: nowrap; }

/* ── Table ──────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; padding: 10px 14px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
  background: var(--bg);
}
.data-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px; vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(91,76,245,.03); }
.data-table tbody tr { cursor: pointer; }
.table-wrap { border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.cell-stack { display: flex; flex-direction: column; gap: 2px; }
.cell-main { font-weight: 500; }
.cell-sub  { font-size: 12px; color: var(--text-2); }

/* ── Account identity ───────────────────────────────────────── */
.acct-id {
  display: flex; align-items: center; gap: 10px;
}
.acct-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--purple-2); color: var(--purple);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.acct-name { font-weight: 600; font-size: 13px; line-height: 1.3; }
.acct-sub  { font-size: 12px; color: var(--text-2); }

/* ── Toolbar / filter bar ───────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--surface);
  border-radius: var(--radius); border: 1px solid var(--border);
}
.toolbar-title { font-weight: 600; font-size: 13px; }
.toolbar-spacer { flex: 1; }
.search-input {
  padding: 7px 12px; border-radius: 7px;
  border: 1px solid var(--border-2); background: var(--bg);
  font-size: 13px; width: 200px; outline: none;
  transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--purple); }
select.filter-select {
  padding: 7px 10px; border-radius: 7px;
  border: 1px solid var(--border-2); background: var(--bg);
  font-size: 13px; outline: none; cursor: pointer;
}

/* ── Pagination ─────────────────────────────────────────────── */
.pager {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  padding: 12px 16px; font-size: 13px; color: var(--text-2);
}
.pager-btn {
  width: 30px; height: 30px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; border: 1px solid var(--border-2);
  transition: background var(--transition);
}
.pager-btn:hover:not(:disabled) { background: var(--bg); }
.pager-btn:disabled { opacity: .4; cursor: default; }
.pager-btn.current { background: var(--purple); color: #fff; border-color: var(--purple); }

/* ── Overview: pipeline ─────────────────────────────────────── */
.pipeline {
  display: flex; gap: 0; overflow-x: auto;
  border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden;
}
.pipeline-step {
  flex: 1; padding: 14px 16px; text-align: center;
  background: var(--surface); min-width: 0;
  border-right: 1px solid var(--border);
}
.pipeline-step:last-child { border-right: none; }
.pipeline-step .p-num {
  font-size: 22px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.pipeline-step .p-num.active { color: var(--purple); }
.pipeline-step .p-num.done   { color: var(--green); }
.pipeline-step .p-num.risk   { color: var(--red); }
.pipeline-step .p-label { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ── Today's summary ────────────────────────────────────────── */
.today-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.today-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px;
  display: flex; align-items: center; gap: 14px;
}
.today-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.today-icon svg { width: 20px; height: 20px; }
.today-icon.purple { background: var(--purple-2); color: var(--purple); }
.today-icon.green  { background: var(--green-bg); color: var(--green); }
.today-icon.orange { background: var(--orange-bg); color: var(--orange); }
.today-icon.red    { background: var(--red-bg); color: var(--red); }
.today-num { font-size: 22px; font-weight: 700; }
.today-text { font-size: 12px; color: var(--text-2); }

/* ── Plans: day cards ───────────────────────────────────────── */
.days-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px;
}
.day-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.day-card-head {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
}
.day-num { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.day-name { font-size: 13px; font-weight: 600; margin-top: 1px; }
.day-actions { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.action-item { display: flex; flex-direction: column; gap: 1px; }
.action-type { font-size: 12px; font-weight: 600; }
.action-detail { font-size: 11px; color: var(--text-2); }
.action-count {
  display: inline-block; margin-top: 3px;
  font-size: 11px; font-weight: 600;
  background: var(--bg); border: 1px solid var(--border-2);
  border-radius: 4px; padding: 1px 6px; color: var(--text-2);
}

/* ── Nodes ──────────────────────────────────────────────────── */
.node-ip { font-family: 'Courier New', monospace; font-size: 12px; }
.node-status-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-right: 5px; vertical-align: middle;
}
.node-status-dot.free     { background: var(--green); }
.node-status-dot.assigned { background: var(--orange); }
.node-status-dot.expiring { background: var(--red); }

/* ── Graduation ─────────────────────────────────────────────── */
.grad-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.grad-head { display: flex; align-items: center; justify-content: space-between; }
.grad-metrics { display: flex; flex-direction: column; gap: 8px; }
.metric-row { display: flex; align-items: center; gap: 10px; }
.metric-label { font-size: 13px; color: var(--text-2); width: 110px; flex-shrink: 0; }
.metric-bar-wrap { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.metric-bar { height: 100%; border-radius: 3px; background: var(--purple); transition: width .4s ease; }
.metric-bar.good { background: var(--green); }
.metric-bar.warn { background: var(--orange); }
.metric-value { font-size: 13px; font-weight: 600; width: 60px; text-align: right; }
.grad-actions { display: flex; gap: 8px; }
.delivery-evidence-form {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.delivery-evidence-title {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}
.delivery-evidence-grid {
  display: grid;
  grid-template-columns: 90px 90px minmax(160px, 1fr) auto;
  gap: 8px;
}
.delivery-evidence-grid input {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border-2);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
}
.grad-blockers { margin-top: 10px; color: var(--orange); font-size: 12px; }

/* ── Auth overlay ───────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; background: rgba(17,28,53,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; backdrop-filter: blur(4px);
}
.overlay[hidden] {
  display: none;
}
.auth-card,
.auth-dialog {
  background: var(--surface); border-radius: 14px;
  padding: 32px; width: 360px; max-width: 90vw;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 16px;
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.auth-brand strong { font-size: 15px; }
.auth-card h2, .auth-dialog h2 { font-size: 18px; font-weight: 700; }
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-group label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field-group input {
  padding: 9px 12px; border-radius: 7px;
  border: 1px solid var(--border-2); font-size: 14px; outline: none;
  transition: border-color var(--transition);
}
.field-group input:focus { border-color: var(--purple); }
.auth-error { font-size: 13px; color: var(--red); min-height: 18px; }
.password-field { display: flex; gap: 8px; align-items: center; }
.password-field input { flex: 1; }
/* ── Guard overlay ──────────────────────────────────────────── */
.guard-dialog {
  background: var(--surface); border-radius: 14px;
  padding: 32px; width: 400px; max-width: 90vw;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 16px;
}
.guard-dialog h2 { font-size: 18px; font-weight: 700; color: var(--orange); }
.guard-dialog p { font-size: 14px; color: var(--text-2); line-height: 1.6; }

/* ── Drawer ─────────────────────────────────────────────────── */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(17,28,53,.4);
  z-index: 50; backdrop-filter: blur(2px);
}
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: 480px; max-width: 95vw;
  background: var(--surface); z-index: 51;
  display: flex; flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,.12);
  transform: translateX(100%); transition: transform .22s ease;
}
.drawer[aria-hidden="false"],
.drawer.is-open { transform: none; }
.drawer-head {
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer-head h2 { font-size: 16px; font-weight: 700; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }

/* ── Toast ──────────────────────────────────────────────────── */
.toast-area,
.toast-region {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px; z-index: 200;
}
.toast {
  padding: 11px 16px; border-radius: 9px; font-size: 13px;
  background: var(--text); color: #fff; box-shadow: var(--shadow-lg);
  animation: toast-in .2s ease; max-width: 300px;
}
.toast.error,
.toast.is-error { background: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  padding: 40px 20px; text-align: center;
  color: var(--text-2); font-size: 13px;
}
.empty-state strong { display: block; font-size: 15px; color: var(--text); margin-bottom: 6px; }

/* ── Mobile More Menu ───────────────────────────────────────── */
.mobile-more-backdrop {
  position: fixed; inset: 0; background: rgba(17,28,53,.4);
  z-index: 90; backdrop-filter: blur(2px); display: none;
}
.mobile-more-backdrop:not([hidden]) { display: block; }
.mobile-more {
  position: fixed; top: 0; right: 0; bottom: 0; width: 280px;
  background: var(--surface); z-index: 91;
  display: flex; flex-direction: column; padding: 20px;
  box-shadow: -4px 0 24px rgba(0,0,0,.12);
  transform: translateX(100%); transition: transform .22s ease;
}
.mobile-more[aria-hidden="false"],
.mobile-more.is-open { transform: none; }
.mobile-more nav { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.mobile-more button {
  padding: 10px 14px; border-radius: 7px; text-align: left;
  font-size: 13px; font-weight: 500; color: var(--text);
  background: var(--bg); border: 1px solid var(--border);
  transition: background var(--transition);
}
.mobile-more button:hover { background: var(--border); }
.mobile-more button.is-active { background: var(--purple-2); color: var(--purple); border-color: var(--purple); }

/* ── Health / Unblock UI ────────────────────────────────────── */
.tab-nav {
  display: flex; gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}
.tab-btn {
  padding: 8px 16px; border-radius: 6px 6px 0 0;
  font-size: 13px; font-weight: 500;
  color: var(--text-2); background: none; border: none;
  cursor: pointer; transition: color var(--transition), background var(--transition);
}
.tab-btn:hover { color: var(--text); background: var(--bg); }
.tab-btn.active {
  color: var(--purple); background: var(--purple-2);
  border-bottom: 2px solid var(--purple);
  margin-bottom: -2px;
}

.recovery-timeline { display: flex; flex-direction: column; gap: 0; padding: 4px 0; }
.timeline-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 0; position: relative;
}
.timeline-item:not(:last-child)::before {
  content: ''; position: absolute;
  left: 7px; top: 28px; bottom: -10px;
  width: 2px; background: var(--border-2);
}
.timeline-dot {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border-2); background: var(--surface);
  flex-shrink: 0; margin-top: 2px; position: relative; z-index: 1;
}
.timeline-dot.done  { background: var(--green);  border-color: var(--green); }
.timeline-dot.warn  { background: var(--orange); border-color: var(--orange); }
.timeline-dot.risk  { background: var(--red);    border-color: var(--red); }
.timeline-dot.wait  { background: var(--text-3); border-color: var(--text-3); }

.timeline-content { flex: 1; min-width: 0; }
.timeline-content strong { display: block; font-size: 13px; font-weight: 600; }
.timeline-content span   { display: block; font-size: 12px; color: var(--text-2); margin-top: 2px; }
.timeline-empty { padding: 20px 0; text-align: center; color: var(--text-3); font-size: 13px; }

.btn-sm {
  font-size: 12px; padding: 4px 10px;
  border-radius: 6px; font-weight: 500;
  background: var(--purple); color: #fff;
  border: none; cursor: pointer;
  transition: opacity var(--transition);
}
.btn-sm:hover  { opacity: .85; }
.btn-sm.full   { width: 100%; margin-top: 12px; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .shell { padding-bottom: 58px; }
  .mobile-nav {
    position: fixed; inset: auto 0 0 0; z-index: 80;
    display: grid; grid-template-columns: repeat(5, 1fr);
    min-height: 58px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border); background: var(--surface);
    box-shadow: 0 -4px 16px rgba(17,28,53,.08);
  }
  .mobile-nav button { padding: 7px 3px; color: var(--text-2); font-size: 12px; border-radius: 7px; }
  .mobile-nav button.is-active { background: var(--purple-2); color: var(--purple); font-weight: 650; }
  .delivery-evidence-grid { grid-template-columns: 1fr 1fr; }
  .delivery-evidence-grid input:nth-child(3),
  .delivery-evidence-grid button { grid-column: 1 / -1; }
  :root { --sidebar-w: 60px; }
  .brand-copy, .nav-item span, .nav-item em, .user-btn span { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .nav-item svg { width: 20px; height: 20px; }
  .page-header { padding: 14px 16px 0; }
  .page-content { padding: 12px 16px 24px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .days-grid { grid-template-columns: 1fr; }
  .today-grid { grid-template-columns: 1fr; }
}
