:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --brand: #1d4ed8;
  --brand-ink: #ffffff;
  --brand-soft: #dbeafe;
  --side: #0f172a;
  --side-ink: #cbd5e1;

  --red: #dc2626; --red-bg: #fee2e2; --red-ink: #991b1b;
  --amber: #d97706; --amber-bg: #fef3c7; --amber-ink: #92400e;
  --yellow: #ca8a04; --yellow-bg: #fef9c3; --yellow-ink: #854d0e;
  --green: #16a34a; --green-bg: #dcfce7; --green-ink: #166534;
  --grey-bg: #f1f5f9; --grey-ink: #475569;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  font-size: 15px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin-bottom: .75rem; }
code { background: var(--grey-bg); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
small { font-size: .82em; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.text-red { color: var(--red); font-weight: 600; }
.lead { font-size: 1.1rem; font-weight: 500; margin: 0 0 1rem; }
.grow { flex: 1; min-width: 0; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  background: var(--side); color: var(--side-ink);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; padding: 18px 12px;
}
.brand { display: flex; gap: 10px; align-items: center; color: #fff; padding: 4px 8px 18px; text-decoration: none !important; }
.brand strong { display: block; font-size: .98rem; line-height: 1.2; }
.brand small { color: #94a3b8; font-size: .78rem; }
.logo {
  flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--brand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M7 20V11h11v9M18 14h4l3 3v3h-7' stroke='white' stroke-width='2' fill='none' stroke-linejoin='round'/%3E%3Ccircle cx='11' cy='22' r='2' fill='white'/%3E%3Ccircle cx='21' cy='22' r='2' fill='white'/%3E%3C/svg%3E");
  background-size: cover;
}
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a {
  display: flex; align-items: center; justify-content: space-between;
  color: var(--side-ink); padding: 8px 10px; border-radius: 7px; font-weight: 500; font-size: .94rem;
  text-decoration: none;
}
.side nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side nav a.on { background: rgba(255, 255, 255, .1); color: #fff; }
.side nav a.minor { font-weight: 400; font-size: .88rem; color: #94a3b8; }
.signed-in { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: auto 0 0; padding: 10px 10px 0; border-top: 1px solid rgba(255, 255, 255, .08); font-size: .84rem; color: #94a3b8; }
.quick + .signed-in { margin-top: 12px; }
.signed-in span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: #cbd5e1; text-decoration: underline; cursor: pointer; white-space: nowrap; }
.auth-page { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 32px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h1 { margin: 22px 0 12px; }
.auth-brand { display: flex; gap: 10px; align-items: center; }
.auth-brand strong { display: block; line-height: 1.2; }
.auth-brand small { color: var(--muted); }
.nav-sep { height: 1px; background: rgba(255, 255, 255, .08); margin: 10px 6px; }
.quick { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding: 16px 4px 0; }
.quick .btn.ghost { background: transparent; color: #e2e8f0; border-color: rgba(255, 255, 255, .2); }
.menu-btn { display: none; }

.main { padding: 26px 32px 60px; min-width: 0; max-width: 1500px; }

/* ---------- page head ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; }
.back { display: inline-block; font-size: .87rem; margin-bottom: 4px; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.with-status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: .92rem;
  background: var(--brand); color: var(--brand-ink);
  border: 1px solid var(--brand); border-radius: 8px;
  padding: 8px 14px; cursor: pointer; text-decoration: none !important; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--surface-2); filter: none; }
.btn.small { padding: 6px 11px; font-size: .86rem; }
.btn.tiny { padding: 3px 9px; font-size: .8rem; border-radius: 6px; }
.btn.block { width: 100%; }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.white { background: #fff; color: var(--red-ink); border-color: #fff; }
.danger-text { color: var(--red) !important; }

/* ---------- flash / banners ---------- */
.flash {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--green-bg); color: var(--green-ink); border: 1px solid #bbf7d0;
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 18px; font-weight: 500;
}
.flash.bad { background: var(--red-bg); color: var(--red-ink); border-color: #fecaca; }
.flash button { background: none; border: 0; font-size: 1.2rem; color: inherit; cursor: pointer; }
.error-box { background: var(--red-bg); color: var(--red-ink); border: 1px solid #fecaca; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; }
.banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; }
.banner.red { background: var(--red); color: #fff; }
.banner.amber { background: var(--amber-bg); color: var(--amber-ink); border: 1px solid #fcd34d; }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; }
.backup-status { margin: 0 0 12px; }
.banner form { margin: 0; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card.flush { padding: 0; }
.card.subtle { background: var(--surface-2); box-shadow: none; }
.card.danger { border-color: #fecaca; background: #fffafa; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.card-head a, .card-head span { font-size: .87rem; }
.empty { color: var(--muted); margin: 6px 0; }
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state p { color: var(--muted); max-width: 520px; margin: 8px auto 0; }
.more { margin: 8px 0 0; font-size: .87rem; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-2 > .card, .stack > .card { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.grid-2 + .card, .grid-2 + section { margin-top: 18px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow); color: var(--ink); text-decoration: none !important; border-top: 3px solid var(--line-2);
}
.kpi b { display: block; font-size: 1.9rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: .86rem; font-weight: 500; }
.kpi.red { border-top-color: var(--red); } .kpi.red b { color: var(--red); }
.kpi.amber { border-top-color: var(--amber); } .kpi.amber b { color: var(--amber); }
.kpi.green { border-top-color: var(--green); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list li .grow small { display: block; }
.list.compact li { padding: 6px 0; }
.list li.dim { opacity: .6; }

.alerts { list-style: none; margin: 0; padding: 0; }
.alerts li { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 8px; border-left: 4px solid transparent; }
.alerts li + li { margin-top: 4px; }
.alerts li.overdue { background: var(--red-bg); border-left-color: var(--red); }
.alerts li.due7 { background: var(--amber-bg); border-left-color: var(--amber); }
.alerts li.due30 { background: var(--surface-2); border-left-color: var(--yellow); }
.alerts .grow { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.alerts .when { text-align: right; white-space: nowrap; }
.alerts .when b { display: block; font-size: .88rem; }
.alerts .when small { color: var(--muted); }
.alerts li.overdue .when b { color: var(--red-ink); }
.row-actions { display: flex; gap: 4px; }
.reg { font-weight: 700; color: var(--ink); letter-spacing: .02em; white-space: nowrap; }
.tag { font-size: .78rem; background: var(--brand-soft); color: var(--brand); padding: 1px 7px; border-radius: 999px; font-weight: 600; }

/* ---------- badges / pills ---------- */
.badge { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 999px; font-size: .76rem; font-weight: 700; text-align: center; line-height: 1.5; text-decoration: none !important; }
.badge.red { background: var(--red); color: #fff; }
.badge.amber { background: var(--amber); color: #fff; }
.pill, .sev, .status, .result { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.pill.red, .sev.red, .status.vor { background: var(--red-bg); color: var(--red-ink); }
.pill.amber, .sev.amber { background: var(--amber-bg); color: var(--amber-ink); }
.pill.green, .sev.green, .status.active, .result.ok { background: var(--green-bg); color: var(--green-ink); }
.pill.blue { background: var(--brand-soft); color: var(--brand); }
.pill.grey, .sev.grey, .status.off_fleet { background: var(--grey-bg); color: var(--grey-ink); }
.result.bad { background: var(--red-bg); color: var(--red-ink); }
.sev { min-width: 64px; text-align: center; }

.due { display: inline-block; padding: 2px 7px; border-radius: 6px; font-weight: 600; font-variant-numeric: tabular-nums; font-size: .88rem; white-space: nowrap; }
.due.overdue { background: var(--red); color: #fff; }
.due.due7 { background: var(--amber-bg); color: var(--amber-ink); box-shadow: inset 0 0 0 1px #fcd34d; }
.due.due30 { background: var(--yellow-bg); color: var(--yellow-ink); }
.due.ok { color: var(--ink-2); font-weight: 500; }

/* ---------- number plate ---------- */
.plate { background: #fcd116; color: #111; font-family: "Charles Wright", "Arial Narrow", Arial, sans-serif; font-weight: 800; letter-spacing: .06em; padding: 2px 12px; border-radius: 5px; border: 2px solid #111; font-size: 1.4rem; }
.plate.trailer { background: #fff; }

/* ---------- due cards ---------- */
.due-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.due-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; border-left: 4px solid var(--line-2); }
.due-card span { display: block; color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.due-card b { display: block; font-size: 1.15rem; margin: 2px 0; font-variant-numeric: tabular-nums; }
.due-card small { color: var(--muted); }
.due-card.overdue { border-left-color: var(--red); background: #fff7f7; } .due-card.overdue b { color: var(--red); }
.due-card.due7 { border-left-color: var(--amber); background: #fffbeb; }
.due-card.due30 { border-left-color: var(--yellow); }
.due-card.ok { border-left-color: var(--green); }
.due-card.none b { color: var(--muted); font-weight: 500; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.dim { opacity: .55; }
.table tr.row-alert { background: #fff7f7; }
.table.small th, .table.small td { padding: 7px 8px; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tfoot td { border-top: 2px solid var(--line); border-bottom: 0; background: var(--surface-2); }
.defect-options { display: flex; flex-direction: column; }
.table td.rectification { min-width: 220px; max-width: 360px; }
.table td.rectification small { display: block; margin-top: 2px; }
.checklist .tick { color: var(--green); font-weight: 700; font-size: 1rem; text-decoration: none; }
.checklist .gap { font-size: .8rem; color: var(--muted); }
.checklist .gap:hover { color: var(--brand); }
.defect-options .check { margin: 4px 0 8px; }
.card .table.small { margin: 0 -8px; width: calc(100% + 16px); }

/* ---------- toolbar / tabs ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar.filters .field { margin: 0; min-width: 200px; }
.toolbar.filters .field span { display: none; }
.toolbar.filters .check { margin: 0; }
.tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.tabs a { padding: 6px 12px; color: var(--ink-2); font-size: .88rem; font-weight: 500; border-left: 1px solid var(--line); text-decoration: none; }
.tabs a:first-child { border-left: 0; }
.tabs a:hover { background: var(--surface-2); }
.tabs a.on { background: var(--ink); color: #fff; }
.month-title { margin: 0; font-size: 1.2rem; min-width: 160px; }

/* ---------- forms ---------- */
.form h2 { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.form h2:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.form.narrow { max-width: 720px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px 16px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.fields .field { margin-bottom: 0; }
.field.wide { grid-column: 1 / -1; }
.field > span { font-size: .84rem; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); }
.req { color: var(--red); font-style: normal; }
input[type=text], input[type=password], input[type=number], input[type=date], input:not([type]), select, textarea {
  font: inherit; font-size: .95rem; color: var(--ink);
  background: #fff; border: 1px solid var(--line-2); border-radius: 7px; padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { resize: vertical; }
input[type=file] { font: inherit; font-size: .9rem; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); }
.check span { font-weight: 500; }
.check small { display: block; color: var(--muted); font-weight: 400; }
.fields .check { align-self: end; margin-bottom: 8px; }
.pct-lock { display: flex; gap: 12px; align-items: center; }
.pct-lock .check { align-self: center; margin: 0; white-space: nowrap; }
.files { margin-bottom: 12px; }
.files .check { margin: 0; }
.upload-sheets { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.upload-sheets .field { margin-bottom: 10px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 2px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; font-size: .95rem; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 8px; }
.delete-row { margin-top: -6px; }
.inline-forms { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.inline-forms form { margin: 0; }

.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 0; }
.dl dt { color: var(--muted); font-size: .88rem; }
.dl dd { margin: 0; font-weight: 500; }

/* ---------- wheel grid ---------- */
.wheel-grid { display: grid; grid-template-columns: 70px repeat(4, minmax(56px, 90px)); gap: 6px; align-items: center; margin-bottom: 12px; }
.wg-head { font-size: .74rem; color: var(--muted); font-weight: 600; text-align: center; }
.wg-axle { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.wg-cell { display: flex; justify-content: center; cursor: pointer; }
.wg-cell input { position: absolute; opacity: 0; pointer-events: none; }
.wg-cell .tyre { width: 30px; height: 44px; border-radius: 7px; background: var(--grey-bg); border: 2px solid var(--line-2); transition: .1s; background-image: repeating-linear-gradient(0deg, transparent 0 5px, rgba(0,0,0,.06) 5px 7px); }
.wg-cell input:checked + .tyre { background-color: var(--brand); border-color: var(--brand); background-image: repeating-linear-gradient(0deg, transparent 0 5px, rgba(255,255,255,.18) 5px 7px); }
.wg-cell input:focus-visible + .tyre { outline: 3px solid var(--brand-soft); }

.retorque-form { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.retorque-form input { width: auto; padding: 4px 6px; font-size: .82rem; }
.retorque-form input[type=text] { width: 110px; }
.retorque-form input[type=number] { width: 70px; }
.retorque-cell { min-width: 220px; }

/* ---------- chips (calendar & planner items) ---------- */
.chip { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 5px; font-size: .74rem; line-height: 1.5; white-space: nowrap; text-decoration: none !important; border: 1px solid transparent; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip b { font-weight: 700; letter-spacing: .02em; }
.t-pmi { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.t-mot { background: #ede9fe; color: #5b21b6; border-color: #ddd6fe; }
.t-tax { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.t-ins { background: #ccfbf1; color: #115e59; border-color: #99f6e4; }
.t-tac { background: #fce7f3; color: #9d174d; border-color: #fbcfe8; }
.t-lol { background: #ffedd5; color: #9a3412; border-color: #fed7aa; }
.t-frg { background: #cffafe; color: #155e75; border-color: #a5f3fc; }
.t-bkg { background: #e2e8f0; color: #1e293b; border-color: #cbd5e1; }
.t-rtq { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.t-olic { background: #e0f2fe; color: #075985; border-color: #bae6fd; }
.t-done { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.t-rpr { background: #ecfccb; color: #3f6212; border-color: #d9f99d; }
.t-doc { background: #f5f3ff; color: #4c1d95; border-color: #ddd6fe; border-style: dashed; }
.chip.projected { background: transparent; border-style: dashed; opacity: .85; }
.chip.booked { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
.chip.late { box-shadow: 0 0 0 2px var(--red); }

/* ---------- planner ---------- */
.planner-wrap { overflow: auto; max-height: calc(100vh - 230px); }
.planner { border-collapse: separate; border-spacing: 0; font-size: .82rem; min-width: 100%; }
.planner th, .planner td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; min-width: 56px; height: 44px; vertical-align: middle; text-align: center; }
.planner thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 2; font-weight: 600; height: auto; padding: 6px 4px; }
.planner thead th b { display: block; font-size: .82rem; }
.planner thead th small { color: var(--muted); font-weight: 400; font-size: .72rem; white-space: nowrap; }
.planner .sticky { position: sticky; left: 0; background: var(--surface); z-index: 1; text-align: left; min-width: 130px; padding: 6px 10px; }
.planner thead .sticky { z-index: 3; background: var(--surface-2); }
.planner .sticky small { display: block; color: var(--muted); font-size: .72rem; }
.planner td.current, .planner th.current { background: #eff6ff; }
.planner thead th.current { background: var(--brand); color: #fff; }
.planner thead th.current small { color: #dbeafe; }
.planner td.past { background: #fafbfc; }
.planner td .chip { display: flex; justify-content: center; margin: 1px 0; }
.planner tr.vor .sticky { box-shadow: inset 4px 0 0 var(--red); }
.planner tr.olic-row td { height: 32px; }
.planner .add { display: block; color: transparent; font-size: 1.1rem; text-decoration: none; line-height: 34px; border-radius: 5px; }
.planner td.empty:hover .add { color: var(--brand); background: var(--brand-soft); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: .82rem; color: var(--muted); margin: 14px 0; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- calendar ---------- */
.calendar { overflow: hidden; }
.cal-head, .cal-week { display: grid; grid-template-columns: 38px repeat(7, minmax(0, 1fr)); }
.cal-head span { padding: 8px; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal-wk { font-size: .72rem; color: var(--muted); padding: 8px 4px; background: var(--surface-2); border-bottom: 1px solid var(--line); text-align: center; }
.cal-day { min-height: 112px; padding: 6px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.cal-day.out { background: #fafbfc; }
.cal-day.out .cal-date { color: #cbd5e1; }
.cal-date { font-size: .82rem; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.cal-day.today .cal-date { background: var(--brand); color: #fff; border-radius: 999px; width: 24px; height: 24px; display: grid; place-items: center; }
.cal-items { display: flex; flex-direction: column; gap: 2px; }
.cal-items .chip { display: block; }
.more-items { font-size: .74rem; color: var(--muted); }
.agenda li.overdue .agenda-date { color: var(--red); }
.agenda-date { width: 54px; font-weight: 600; font-size: .85rem; font-variant-numeric: tabular-nums; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; z-index: 10; }
  .brand { padding: 0; flex: 1; }
  .menu-btn { display: block; background: none; border: 1px solid rgba(255,255,255,.25); color: #fff; font-size: 1.2rem; border-radius: 7px; padding: 4px 10px; cursor: pointer; }
  .side nav, .quick, .signed-in { display: none; width: 100%; }
  body.nav-open .side nav, body.nav-open .quick, body.nav-open .signed-in { display: flex; }
  .side nav { padding-top: 10px; }
  .quick { margin-top: 0; padding-bottom: 6px; }
  .main { padding: 18px 16px 50px; overflow-x: hidden; }
  .page-head .actions .btn { flex: 1 1 auto; }
  .alerts .grow { flex-basis: 60%; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .alerts li { flex-wrap: wrap; }
  .alerts .row-actions { width: 100%; justify-content: flex-end; }
  .cal-day { min-height: 70px; padding: 3px; }
  .cal-items .chip { font-size: .66rem; padding: 0 3px; }
  .cal-head, .cal-week { grid-template-columns: 26px repeat(7, minmax(0, 1fr)); }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .toolbar.filters .field { min-width: 0; flex: 1; }
}

/* ---------- print ---------- */
@media print {
  :root { font-size: 12px; }
  body { background: #fff; }
  .shell { display: block; }
  .side, .no-print, .flash, .actions, .toolbar, .row-actions, .add, .retorque-form { display: none !important; }
  .main { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .planner-wrap { max-height: none; overflow: visible; }
  .planner .sticky, .planner thead th { position: static; }
  a { color: inherit; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
}
