:root {
  --bg: #eef2f6;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --text: #111827;
  --muted: #64748b;
  --border: #cfd8e3;
  --primary: #155e75;
  --primary-2: #cffafe;
  --good: #15803d;
  --warn: #a16207;
  --bad: #b91c1c;
  --ink: #0f172a;
  --shadow: 0 10px 28px rgba(15, 23, 42, .07);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: inherit; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar {
  width: 264px;
  background: #0b1220;
  color: #e5e7eb;
  padding: 18px;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
}
.brand { display: flex; align-items: center; gap: 12px; padding-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-title { font-size: 28px; line-height: 1; font-weight: 850; letter-spacing: 0; white-space: nowrap; }
.brand-title span { color: #e8f1ff; }
.brand-title strong { color: #ef4444; font-weight: 850; }
.brand-sub { color: #94a3b8; font-size: 12px; margin-top: 2px; }
.nav { display: grid; gap: 5px; margin-top: 20px; }
.nav a {
  text-decoration: none;
  color: #cbd5e1;
  padding: 11px 12px;
  border-radius: 8px;
  font-weight: 650;
  font-size: 14px;
}
.nav a.active, .nav a:hover { background: rgba(103,232,249,.12); color: #fff; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding-top: 16px; font-size: 13px; }
.logout { display: inline-block; margin-top: 10px; color: #bfdbfe; font-weight: 700; }
.main { margin-left: 264px; width: calc(100% - 264px); padding: 28px; }
.main-auth { margin: 0; width: 100%; display: grid; place-items: center; padding: 20px; }
.topbar { margin-bottom: 22px; display: flex; justify-content: space-between; align-items: center; }
h1 { margin: 0; font-size: 28px; letter-spacing: 0; line-height: 1.15; }
h2 { margin: 0 0 14px; font-size: 18px; }
h3 { margin: 0 0 8px; font-size: 15px; }
.muted { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}
.surface {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.section { margin-top: 18px; }
.metric { font-size: 26px; font-weight: 850; margin-top: 8px; }
.metric-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric-tile {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 15px;
}
.metric-tile .label { color: var(--muted); font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.metric-tile .value { margin-top: 5px; font-size: 24px; font-weight: 850; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.btn {
  border: 0;
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
}
.btn.secondary { background: #334155; }
.btn.light { background: var(--primary-2); color: #164e63; }
.btn.danger { background: var(--bad); }
.btn.small { min-height: 32px; padding: 7px 10px; font-size: 12px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 10px 11px;
  font: inherit;
}
input:focus, select:focus, textarea:focus, .btn:focus, a:focus, th[role="button"]:focus {
  outline: 3px solid rgba(21, 94, 117, .25);
  outline-offset: 2px;
}
label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: #334155; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { background: #f8fafc; color: #475569; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]::after { content: " sort"; color: #94a3b8; font-weight: 700; font-size: 10px; text-transform: none; }
th[data-direction="asc"]::after { content: " asc"; color: var(--primary); }
th[data-direction="desc"]::after { content: " desc"; color: var(--primary); }
.notice { padding: 12px 14px; border-radius: 7px; margin-bottom: 16px; border: 1px solid var(--border); background: #eff6ff; color: #1e3a8a; font-weight: 650; }
.notice.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.notice.success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.idle-warning {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  background: #111827;
  color: #fff;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-weight: 750;
}
.danger-zone { border-color: #fecaca; background: #fffafa; }
.danger-zone h2 { color: var(--bad); }
.confirm-text { font-weight: 850; color: var(--bad); }
.auth-card { width: min(420px, 100%); }
.auth-wordmark { font-size: clamp(42px, 9vw, 66px); line-height: 1; font-weight: 850; letter-spacing: 0; margin-bottom: 18px; white-space: nowrap; }
.auth-wordmark span { color: #084987; }
.auth-wordmark strong { color: #df1f26; font-weight: 850; }
.auth-title { font-size: 26px; font-weight: 850; margin-bottom: 8px; }
.badge { display: inline-flex; padding: 4px 9px; border-radius: 999px; background: var(--panel-2); font-weight: 800; font-size: 12px; font-variant-numeric: tabular-nums; }
.badge.good { background: #dcfce7; color: var(--good); }
.badge.warn { background: #fef9c3; color: var(--warn); }
.badge.bad { background: #fee2e2; color: var(--bad); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.step { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: #fff; }
.step.active { border-color: var(--primary); background: #eff6ff; }
.row-actions { display: flex; gap: 8px; }
.result-hero {
  padding: 18px;
}
.result-title { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.controller-dot { display:inline-block; width:10px; height:10px; border-radius:50%; margin-right:7px; vertical-align:middle; }
.shift-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.shift-panel { background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.shift-panel-header {
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  background: #fbfdff;
}
.shift-heading { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.shift-heading h2 { margin: 0; }
.shift-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.shift-summary { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.summary-pill { background: #eef2f6; border: 1px solid var(--border); border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.summary-pill.good { background: #dcfce7; color: var(--good); border-color: #bbf7d0; }
.summary-pill.warn { background: #fef9c3; color: var(--warn); border-color: #fde68a; }
.summary-pill.bad { background: #fee2e2; color: var(--bad); border-color: #fecaca; }
.table-caption { padding: 10px 14px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); background: #fbfdff; }
@media (max-width: 900px) {
  .sidebar { position: static; width: 100%; }
  .app-shell { display: block; }
  .main { margin-left: 0; width: 100%; padding: 18px; }
  .grid, .grid-2, .form-grid, .steps, .metric-row { grid-template-columns: 1fr; }
  .shift-panel-header { grid-template-columns: 1fr; }
  .shift-summary { justify-content: flex-start; }
}
