/* JUGRAC Rental Collection ERP — one stylesheet, no framework.
   Light work surface, deep navy chrome, JUGRAC gold reserved for the brand plate and the active marker. */

:root {
  --graphite: #16324f;
  --graphite-2: #1d3d5f;
  --graphite-3: #2b4e73;
  --steel: #ebedef;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --ink: #17212b;
  --ink-2: #4b5967;
  --ink-3: #7a8794;
  --line: #d8dee4;
  --line-2: #e7ebef;
  --plant: #c8952e;
  --plant-deep: #8a6418;
  --action: #1d5a8c;
  --action-hover: #164a74;
  --action-tint: #e8f0f7;

  --st-available: #1e8a4c;
  --st-hire: #1f68c9;
  --st-idle: #d77300;
  --st-breakdown: #cc2f26;
  --st-maintenance: #7446bb;
  --st-out: #2b2f33;

  --ok: #1e8a4c;
  --warn: #b86200;
  --bad: #c0281f;

  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-num: "DIN Alternate", Bahnschrift, "Roboto Condensed", "Arial Narrow", var(--font-ui);
  --radius: 6px;
  --sidebar-w: 248px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--steel);
  color: var(--ink);
  font: 14px/1.5 var(--font-ui);
  font-variant-numeric: tabular-nums;
}
a { color: var(--action); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font: 700 26px/1.15 var(--font-num); letter-spacing: .005em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 .75em; }
small, .muted { color: var(--ink-3); }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Brand plate: the one loud element ---------- */
.plate {
  display: inline-block;
  padding: 1px 7px 0;
  background: var(--plant);
  color: #1b0f05;
  font: 700 13px/1.6 var(--font-num);
  letter-spacing: .06em;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1.5px rgba(20, 16, 6, .78);
  white-space: nowrap;
}
.plate-lg { font-size: 18px; padding: 2px 10px 1px; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: var(--graphite); color: #c9d1d8;
  display: flex; flex-direction: column; z-index: 40;
  overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--graphite-3) transparent;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; border-bottom: 1px solid var(--graphite-2); }
.brand-name { color: #fff; font-weight: 650; font-size: 14px; line-height: 1.25; }
.brand-name small { display: block; color: #8d99a5; font-weight: 400; font-size: 12px; }
.nav { padding: 8px 0 16px; flex: 1; }
.nav-section { padding: 16px 18px 6px; font-size: 12px; color: #7f8b97; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 7px 18px; color: #c9d1d8; font-size: 14px;
}
.nav a svg { flex: none; opacity: .75; }
.nav a:hover { background: var(--graphite-2); color: #fff; text-decoration: none; }
.nav a.active { background: var(--graphite-2); color: #fff; font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 4px; background: var(--plant); border-radius: 0 2px 2px 0; }
.nav a.active svg { opacity: 1; }
.nav a.pending { color: #8d99a5; }
.nav .soon { margin-left: auto; font-size: 11px; color: #75818c; border: 1px solid var(--graphite-3); border-radius: 3px; padding: 0 5px; }
.nav .count { margin-left: auto; background: var(--plant); color: #16120a; font-weight: 700; font-size: 11px; border-radius: 9px; padding: 0 7px; }
.sidebar-foot { padding: 12px 18px 16px; font-size: 12px; color: #7f8b97; border-top: 1px solid var(--graphite-2); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  height: 56px; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar .spacer { flex: 1; }
.menu-toggle { display: none; background: none; border: 0; padding: 6px; color: var(--ink); cursor: pointer; }
.search { position: relative; width: min(420px, 40vw); }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search input[type=search] {
  width: 100%; height: 36px; padding: 0 12px 0 34px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); font: inherit; color: var(--ink);
}
.search input[type=search]:focus { background: #fff; border-color: var(--action); outline: none; box-shadow: 0 0 0 3px var(--action-tint); }
.company-switch select { height: 34px; }
.bell { position: relative; color: var(--ink-2); display: flex; padding: 6px; border-radius: var(--radius); }
.bell:hover { background: var(--surface-2); }
.bell .dot { position: absolute; top: 1px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; line-height: 17px; text-align: center; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--graphite); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.avatar:hover { text-decoration: none; background: var(--graphite-3); }

.content { padding: 24px; max-width: 1480px; width: 100%; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { margin-top: 6px; color: var(--ink-2); max-width: 72ch; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--ink-3); margin-bottom: 8px; }
.crumbs a { color: var(--ink-2); }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 600 14px/1 var(--font-ui); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; border-color: #c4ccd4; }
.btn-primary { background: var(--action); border-color: var(--action); color: #fff; }
.btn-primary:hover { background: var(--action-hover); border-color: var(--action-hover); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: #fdf0ef; border-color: #f0c2bf; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-link { background: none; border: 0; padding: 0; height: auto; color: var(--action); font-weight: 500; cursor: pointer; }
.btn-link:hover { text-decoration: underline; background: none; }
.inline { display: inline; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search],
input[type=url], input[type=tel], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 36px; padding: 7px 10px; font: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--action); outline: none; box-shadow: 0 0 0 3px var(--action-tint); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--action); vertical-align: -3px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px 20px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.field .help { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
.field .errors { color: var(--bad); font-size: 13px; margin: 4px 0 0; padding: 0; list-style: none; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--bad); }
.field-check label { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; }
.field-check .help { margin-left: 24px; }
.field-wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.form-errors { background: #fdf0ef; border: 1px solid #f0c2bf; color: var(--bad); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; }
.fieldset-title { margin: 6px 0 2px; }
.fieldset-note { color: var(--ink-3); font-size: 13px; margin: 0 0 12px; }
.fieldset + .fieldset { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line-2); }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.panel-body { padding: 18px; }
.panel + .panel, .grid + .panel, .panel + .grid { margin-top: 20px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.empty { padding: 28px 18px; color: var(--ink-2); text-align: center; }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

/* ---------- KPI strip ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.kpi { padding: 16px 18px; border-left: 1px solid var(--line-2); color: inherit; }
.kpi:first-child { border-left: 0; }
a.kpi:hover { background: var(--surface-2); text-decoration: none; }
.kpi .label { font-size: 13px; color: var(--ink-2); }
.kpi .value { font: 700 28px/1.2 var(--font-num); margin-top: 6px; color: var(--ink); }
.kpi .value.none { color: #b3bcc5; }
.kpi .foot { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ---------- Fleet status ---------- */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: currentColor; }
.st-available { color: var(--st-available); }
.st-on_hire { color: var(--st-hire); }
.st-idle { color: var(--st-idle); }
.st-breakdown { color: var(--st-breakdown); }
.st-maintenance { color: var(--st-maintenance); }
.st-out_of_service { color: var(--st-out); }
.fleet-bar { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.fleet-cell { padding: 14px 18px; border-left: 1px solid var(--line-2); }
.fleet-cell:first-child { border-left: 0; }
.fleet-cell .n { font: 700 24px/1.2 var(--font-num); color: #b3bcc5; margin-top: 4px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table th { background: var(--surface-2); font-size: 12.5px; font-weight: 650; color: var(--ink-2); white-space: nowrap; position: sticky; top: 0; }
.table tbody tr:hover { background: #fafbfc; }
.table td.num, .table th.num { text-align: right; }
.table .row-muted td { color: var(--ink-3); }
.table tr:last-child td { border-bottom: 0; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.filters .field { min-width: 150px; flex: 0 1 190px; }
.filters .field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.filters .grow { flex: 1 1 240px; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); }
.pager .links { display: flex; gap: 6px; }

/* ---------- Badges, tags ---------- */
.tag { display: inline-block; padding: 1px 8px; border-radius: 3px; font-size: 12px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.tag-ok { background: #e9f6ee; border-color: #bfe3cd; color: var(--ok); }
.tag-warn { background: #fdf3e6; border-color: #f2d3a7; color: var(--warn); }
.tag-bad { background: #fdf0ef; border-color: #f0c2bf; color: var(--bad); }
.tag-info { background: var(--action-tint); border-color: #c4d8ea; color: var(--action); }

/* ---------- Messages ---------- */
.messages { list-style: none; margin: 0 0 18px; padding: 0; }
.messages li { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 8px; background: var(--action-tint); border: 1px solid #c4d8ea; }
.messages li.success { background: #e9f6ee; border-color: #bfe3cd; }
.messages li.error { background: #fdf0ef; border-color: #f0c2bf; color: var(--bad); }
.messages li.warning { background: #fdf3e6; border-color: #f2d3a7; }

/* ---------- Definition lists, lists ---------- */
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 22px; margin: 0; }
dl.facts dt { color: var(--ink-3); }
dl.facts dd { margin: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 11px 18px; border-bottom: 1px solid var(--line-2); display: flex; gap: 12px; align-items: baseline; justify-content: space-between; }
.list li:last-child { border-bottom: 0; }
.list .meta { font-size: 12.5px; color: var(--ink-3); }
.checklist li::before { content: ""; flex: none; width: 16px; height: 16px; border: 1.5px solid #b3bcc5; border-radius: 3px; align-self: center; }
.checklist li.done::before { background: var(--ok); border-color: var(--ok); box-shadow: inset 0 0 0 3px #fff; }
.checklist li { justify-content: flex-start; }
.checklist li > a, .checklist li > span { flex: 1; }
.checklist li.done > a, .checklist li.done > span { color: var(--ink-3); }

.progress { height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ok); }

/* Permission matrix */
.matrix th.rot { writing-mode: vertical-rl; transform: rotate(180deg); height: 140px; vertical-align: bottom; padding: 8px 6px; }
.matrix td.cell { text-align: center; width: 44px; }
.matrix .yes { color: var(--ok); font-weight: 700; }
.matrix .mod td { background: var(--surface-2); font-weight: 650; font-size: 12.5px; }
.perm-group { border: 1px solid var(--line-2); border-radius: var(--radius); padding: 10px 14px; }
.perm-group h3 { margin-bottom: 6px; }
.perm-group label { display: flex; gap: 8px; padding: 3px 0; font-weight: 400; }

/* ---------- Greeting ---------- */
.greeting { margin-bottom: 18px; }
.greeting h1 { font-size: 30px; }
.greeting .sub { color: var(--ink-2); margin-top: 4px; }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 480px); }
.auth-side {
  background: var(--graphite); color: #c9d1d8; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background-image: repeating-linear-gradient(135deg, transparent 0 22px, rgba(242, 183, 5, .05) 22px 44px);
}
.auth-side > .plate { align-self: flex-start; }
.auth-side h2 { color: #fff; font: 700 34px/1.15 var(--font-num); max-width: 16ch; margin: 18px 0 14px; }
.auth-side p { max-width: 46ch; color: #a9b4be; }
.auth-form { background: var(--surface); padding: 48px 44px; display: flex; flex-direction: column; justify-content: center; }
.auth-form h1 { margin-bottom: 6px; }
.auth-form .field { margin-top: 14px; }
.auth-form .btn { width: 100%; margin-top: 20px; height: 42px; }

/* ---------- Search results ---------- */
.result-group h2 { padding: 14px 18px 4px; font-size: 13px; color: var(--ink-2); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis, .fleet-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(4), .fleet-cell:nth-child(4) { border-left: 0; }
  .kpi:nth-child(n+4), .fleet-cell:nth-child(n+4) { border-top: 1px solid var(--line-2); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(15, 20, 25, .45); }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 12px; gap: 8px; }
  .content { padding: 16px; }
  .grid-2, .grid-3, .grid-main { grid-template-columns: minmax(0, 1fr); }
  .hide-sm { display: none !important; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-form { padding: 32px 20px; }
}
@media (max-width: 600px) {
  .kpis, .fleet-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(odd), .fleet-cell:nth-child(odd) { border-left: 0; }
  .kpi:nth-child(4), .fleet-cell:nth-child(4) { border-left: 1px solid var(--line-2); }
  .kpi:nth-child(n+3), .fleet-cell:nth-child(n+3) { border-top: 1px solid var(--line-2); }
  .search { width: auto; flex: 1; }
  .search + .spacer { display: none; }
  .company-switch { display: none; }
  h1 { font-size: 22px; }
  .greeting h1 { font-size: 24px; }
  .table th, .table td { padding: 8px 10px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .sidebar, .topbar, .page-head .actions, .filters, .pager { display: none !important; }
  .main { margin: 0; }
  body { background: #fff; }
}

/* ---------- Phase 2: profiles, tabs, photos, compliance ---------- */
.profile-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.profile-title { flex: 1; min-width: 220px; }
.profile-title .sub { margin: 4px 0 0; color: var(--ink-2); }
.profile-status { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.status-lg { font-size: 15px; }
.status-lg::before { width: 11px; height: 11px; }
.profile-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 16px; }
.profile-strip > div { padding: 12px 16px; border-left: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.profile-strip > div:first-child { border-left: 0; }
.profile-strip .label { font-size: 12px; color: var(--ink-3); }
.profile-strip small { color: var(--ink-3); font-size: 12px; }
.fig { font-family: var(--font-num); font-size: 17px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 18px; scrollbar-width: thin; }
.tabs a { padding: 9px 12px; color: var(--ink-2); white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--plant); font-weight: 650; }
.tabs a.later { color: var(--ink-3); }
.tabs small { font-size: 10.5px; color: var(--ink-3); }
dl.facts-2 { grid-template-columns: max-content 1fr max-content 1fr; }
.list.compact li { padding: 6px 0; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.photo-grid figure { margin: 0; }
.photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); }
.photo-grid figcaption { font-size: 12.5px; margin-top: 4px; color: var(--ink-2); }
.chain { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); }
.chain .link { padding: 16px; border-left: 1px solid var(--line-2); position: relative; }
.chain .link:first-child { border-left: 0; }
.chain .link .label { display: block; font-size: 12px; color: var(--ink-3); }
.chain .link.pending .fig { color: #b3bcc5; }
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi .value.bad { color: var(--bad); }
.kpi .value.warn { color: var(--warn); }
.kpi .value .none, .kpi .none { color: #b3bcc5; }
.fleet-cell { color: inherit; }
a.fleet-cell:hover { background: var(--surface-2); text-decoration: none; }
.fleet-cell .n-live { color: var(--ink); }
.delete-form { display: flex; gap: 8px; flex-wrap: wrap; }
.delete-form input { flex: 1; min-width: 180px; }
table.compliance td { white-space: nowrap; }
@media (max-width: 1180px) {
  .profile-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .profile-strip > div:nth-child(4) { border-left: 0; }
  .profile-strip > div:nth-child(n+4) { border-top: 1px solid var(--line-2); }
  .chain { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .chain .link:nth-child(5) { border-left: 0; }
  .chain .link:nth-child(n+5) { border-top: 1px solid var(--line-2); }
}
@media (max-width: 600px) {
  .profile-strip, .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-strip > div:nth-child(odd) { border-left: 0; }
  .profile-strip > div:nth-child(4) { border-left: 1px solid var(--line-2); }
  .profile-strip > div:nth-child(n+3) { border-top: 1px solid var(--line-2); }
  dl.facts-2 { grid-template-columns: max-content 1fr; }
  .profile-status { align-items: flex-start; }
}
@media (min-width: 601px) {
  .kpis-4 .kpi:nth-child(4) { border-left: 1px solid var(--line-2); }
  .kpis-4 .kpi { border-top: 0; }
}

/* ---------- Phase 3: hire ---------- */
.hint-box { margin-top: 12px; padding: 10px 14px; border-radius: var(--radius); background: var(--action-tint); border: 1px solid #c4d8ea; font-size: 13.5px; }
.hint-box.bad { background: #fdf0ef; border-color: #f0c2bf; }
.avail { font-weight: 650; font-size: 13px; padding: 2px 8px; border-radius: 3px; white-space: nowrap; }
.av-available { background: #e9f6ee; color: var(--ok); }
.av-partial { background: #fdf3e6; color: var(--warn); }
.av-booked { background: var(--action-tint); color: var(--st-hire); }
.av-maintenance { background: #f1ebfa; color: var(--st-maintenance); }
.av-unavailable { background: #eceef0; color: var(--st-out); }
.cond { font-weight: 600; }
.c-poor { color: var(--bad); }
.c-fair { color: var(--warn); }
.c-good { color: var(--ok); }
table.board td, table.board th { vertical-align: middle; }
.board .timeline-head, .board .timeline { min-width: 560px; padding: 6px 10px; }
.days, .lane { display: grid; grid-template-columns: repeat(var(--days), minmax(18px, 1fr)); position: relative; }
.days span { text-align: center; font-size: 11px; color: var(--ink-2); line-height: 1.1; }
.days span small { display: block; color: var(--ink-3); font-size: 10px; }
.days span.we { color: var(--ink-3); }
.days span.today { color: var(--ink); font-weight: 700; }
.lane { height: 26px; }
.lane .slot { grid-row: 1; grid-column: calc(var(--o) + 1) / span 1; border-left: 1px solid var(--line-2); }
.lane .slot:hover { background: var(--action-tint); }
.lane .today-line { grid-row: 1; grid-column: calc(var(--o) + 1) / span 1; border-left: 2px solid var(--plant); pointer-events: none; }
.lane .bar { grid-row: 1; grid-column: calc(var(--o) + 1) / span var(--s); z-index: 1; margin: 2px 1px; border-radius: 3px; padding: 0 6px;
  font-size: 11.5px; line-height: 22px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane .bar:hover { text-decoration: none; filter: brightness(1.1); }
.bar-confirmed { background: var(--action); }
.bar-on_hire { background: var(--st-hire); }
.bar-pending_approval { background: var(--warn); }
.bar-returned { background: #9aa6b2; }
.bar-key { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin: 0 4px 0 12px; vertical-align: middle; }
.legend { font-size: 12.5px; color: var(--ink-2); }
.sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 2; }
th.sticky-col { background: var(--surface-2); z-index: 3; }
table.formset td { padding: 6px; }
table.formset input, table.formset select { min-width: 90px; }

/* ---------- Phase 4 ---------- */
.steps { display: flex; gap: 0; list-style: none; padding: 0; margin: 0 0 18px; counter-reset: s; flex-wrap: wrap; }
.steps li { flex: 1; min-width: 120px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-left-width: 0; font-size: 13px; color: var(--ink-3); counter-increment: s; }
.steps li:first-child { border-left-width: 1px; border-radius: var(--radius) 0 0 var(--radius); }
.steps li:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.steps li::before { content: counter(s) " · "; }
.steps li.done { color: var(--ok); font-weight: 650; background: #f2faf5; }
.steps li.bad { color: var(--bad); font-weight: 650; background: #fdf0ef; }

/* ---------- Phase 6: dashboard ---------- */
.chart { position: relative; height: 240px; }
.chart-tall { height: 360px; }
.alerts li { justify-content: flex-start; gap: 10px; }
.alerts li::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--ink-3); align-self: center; }
.alerts li.al-critical::before { background: var(--bad); }
.alerts li.al-warning::before { background: var(--warn); }
.alerts li.al-info::before { background: var(--action); }
.map { position: relative; height: 520px; overflow: hidden; background: #dfe5ea; touch-action: none; cursor: grab; border-radius: var(--radius) var(--radius) 0 0; }
.map-tiles img { position: absolute; user-select: none; }
.map-pin { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; text-decoration: none; z-index: 2; }
.map-pin span { width: 16px; height: 16px; border-radius: 50%; background: var(--pin); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); order: 2; }
.map-pin.approx span { background: #fff; border: 3px solid var(--pin); }
.map-pin b { background: var(--plant); color: #16120a; font: 700 11px/1.5 var(--font-num); padding: 0 4px; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(20,16,6,.7); margin-bottom: 2px; white-space: nowrap; }
.map-pin:hover { z-index: 3; text-decoration: none; }
.map-ctrl { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 4px; z-index: 4; }
.map-attr { position: absolute; right: 0; bottom: 0; background: rgba(255,255,255,.85); font-size: 11px; padding: 1px 6px; z-index: 4; }

/* ---------- Line-item tables and ledger cues ---------- */
.table td.bad, .table th.bad { color: var(--bad); }
.table-form td { vertical-align: top; }
.table-form input:not([type=checkbox]), .table-form select, .table-form textarea { width: 100%; min-width: 88px; }
.table-form td .errors { color: var(--bad); font-size: 12px; margin-top: 2px; }
.table-form td.has-error input, .table-form td.has-error select { border-color: var(--bad); }
.table tr.row-warn td { background: #fff7e8; }
.inline { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline .field { margin: 0; }

/* Executive dashboard */
.section-title { font-size: 15px; font-weight: 600; color: var(--ink-2); margin: 22px 0 10px; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value.warn { color: var(--warn); }
.kpi .foot.bad { color: var(--bad); }
.table.trend td.bars { width: 60%; }
.table.trend .bar { height: 7px; border-radius: 3px; margin: 2px 0; min-width: 2px; }
.table.trend .bar-a { background: var(--action); }
.table.trend .bar-b { background: var(--ok); }
.table.trend .bar-c { background: var(--plant); }
