/* MSA Portal 2.0 — Phase 2 read screens: charts, filters, report layouts (Employees, Vehicles, Consumables, production).
   Ported from the approved prototype's Tailwind classes. Logical properties only (RTL); zebra rows on every list. */

/* ───────────────────────── Shared bits ───────────────────────── */
.strong { font-weight: 600; }
.normal { font-weight: 400; }
.nowrap { white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; flex-shrink: 0; border-radius: 999px; }
.warning-text { color: var(--warning-text); }
.critical-text { color: var(--critical-text); }
.view-gap { margin-top: 16px; }
.view-body { margin-top: 16px; }
.view-content { margin-top: 12px; }
.report-stack { display: grid; gap: 16px; }
.show-more { margin-top: 16px; display: flex; justify-content: center; }
.table-note { padding: 10px 16px; border-top: 1px solid var(--separator); }
.chart-empty { padding: 40px 0; text-align: center; }
.inset-note { padding: 12px; }
.inspector-foot { margin-top: 16px; padding-inline: 4px; }
.link-btn { margin-top: 8px; padding-inline: 8px; font-size: 13px; font-weight: 500; color: var(--accent); }
.link-btn:hover, .section-link:hover { text-decoration: underline; }
.section-link { font-size: 12.5px; font-weight: 500; color: var(--accent); }
.load-error { margin-top: 0; }
.awaiting-data .empty-state { padding-block: 40px; }
@media (min-width: 1280px) { .hide-below-xl { display: inline; } }
@media (max-width: 1279px) { .hide-below-xl { display: none; } }

/* Icon tiles tinted by --tone (status / kind / category). */
.icon-tile-xs, .icon-tile-sm, .icon-tile-md, .icon-tile-lg {
  --tone: var(--label-secondary);
  display: grid; flex-shrink: 0; place-items: center; color: var(--tone); background: color-mix(in oklab, var(--tone) 14%, transparent);
}
.icon-tile-xs { width: 28px; height: 28px; border-radius: 8px; }
.icon-tile-sm { width: 36px; height: 36px; border-radius: 10px; }
.icon-tile-sm:not([style]) { color: var(--label-secondary); background: var(--fill); }
.icon-tile-md { width: 44px; height: 44px; border-radius: 12px; }
.icon-tile-lg { width: 56px; height: 56px; border-radius: 14px; }
.icon-label { display: inline-flex; min-width: 0; align-items: center; gap: 8px; }
.type-chips { margin-bottom: 8px; }
.statement-to, .forecast-date { display: inline-flex; align-items: center; gap: 6px; }
.statement-to .input, .forecast-date .input { width: 150px; height: 32px; }

/* Names with avatar (tables). */
.name-cell { display: inline-flex; min-width: 0; max-width: 100%; align-items: center; gap: 8px; }
.name-cell-text { display: flex; min-width: 0; flex-direction: column; line-height: 1.2; }
.name-primary { font-weight: 500; }
.name-secondary { font-size: 11.5px; color: var(--label-secondary); }
.dept-label { display: inline-flex; min-width: 0; align-items: center; gap: 6px; }

/* Phone card rows inside DataTable (.dt-card is the flex container). */
.phone-row { display: flex; width: 100%; min-width: 0; align-items: center; gap: 12px; }
.phone-row-text { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.phone-row-title { font-weight: 600; }
.phone-row-chip { margin-top: 4px; }
.phone-row-end { display: flex; flex-shrink: 0; flex-direction: column; align-items: flex-end; gap: 4px; }
.phone-row-qty { flex-shrink: 0; text-align: end; font-weight: 600; }
.phone-row-qty > .strong { display: block; }

/* ───────────────────────── Filter bar, chips, search ───────────────────────── */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter-search { min-width: 0; flex: 1 1 220px; max-width: 28rem; }
.filter-count { margin-inline-start: auto; }
.filter-chips { min-width: 0; flex: 1; }
.filter-caption { margin: 4px 4px 6px; font-size: 12px; font-weight: 600; color: var(--label-secondary); }
.filter-caption:not(:first-child) { margin-top: 12px; }
.filter-list { display: grid; gap: 2px; max-height: 16rem; overflow-y: auto; }
.filter-option { display: flex; width: 100%; height: 36px; align-items: center; gap: 8px; border-radius: 8px; padding-inline: 8px; text-align: start; font-size: 13.5px; }
.filter-option:hover { background: var(--fill); }
.filter-option > .truncate { flex: 1; }
.filter-option.is-on { color: var(--accent); font-weight: 600; }
.filter-check { display: grid; width: 16px; place-items: center; }
.checkbox { display: grid; width: 18px; height: 18px; place-items: center; border-radius: 5px; border: 1px solid var(--separator-strong); }
.checkbox.is-on { border-color: transparent; background: var(--accent); color: var(--on-accent); }
.filters-count { margin-inline-start: 4px; border-radius: 999px; background: var(--accent); padding-inline: 6px; font-size: 11px; color: var(--on-accent); }
.filters-pop { padding: 12px; }

.chip-row { display: flex; gap: 6px; overflow-x: auto; margin-inline: -4px; padding: 2px 4px; }
.chip {
  display: inline-flex; height: 32px; flex-shrink: 0; align-items: center; gap: 6px; border-radius: 999px; padding-inline: 12px;
  font-size: 13px; font-weight: 500; background: var(--bg-elevated); box-shadow: 0 0 0 1px var(--separator); transition: background .15s;
}
.chip:hover { background: var(--fill); }
.chip.is-selected { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.chip-count { font-size: 11.5px; color: var(--label-secondary); }
.chip.is-selected .chip-count { color: inherit; opacity: .8; }
.chip-swatch { width: 8px; height: 8px; border-radius: 999px; }

.search-field { position: relative; }
.search-box {
  display: flex; height: 32px; min-width: 0; align-items: center; gap: 6px; border-radius: 999px; background: var(--fill); padding-inline: 10px;
  transition: box-shadow .15s;
}
.search-box:focus-within { box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 45%, transparent); }
.search-icon { flex-shrink: 0; color: var(--label-secondary); }
.search-box input { height: 100%; min-width: 4rem; flex: 1; border: 0; background: transparent; font-size: 13.5px; outline: none; }
.search-box input::placeholder { color: var(--label-secondary); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-token {
  display: inline-flex; height: 24px; flex-shrink: 0; align-items: center; gap: 4px; border-radius: 999px; background: var(--accent-soft);
  padding-inline: 8px 4px; font-size: 12px; font-weight: 500; color: var(--accent);
}
.search-token-label { opacity: .7; }
.search-token button { display: grid; width: 16px; height: 16px; place-items: center; border-radius: 999px; }
.search-token button:hover { background: color-mix(in oklab, var(--accent) 20%, transparent); }
.search-clear { display: grid; width: 16px; height: 16px; flex-shrink: 0; place-items: center; border-radius: 999px; background: var(--label-tertiary); color: var(--bg-elevated); }
.search-suggest { position: absolute; inset-inline: 0; top: 40px; z-index: 30; border-radius: 12px; padding: 4px; }
.search-suggest-item { display: flex; width: 100%; height: 32px; align-items: center; gap: 8px; border-radius: 8px; padding-inline: 10px; font-size: 13px; }
.search-suggest-item:hover { background: var(--accent); color: var(--on-accent); }
.search-suggest-item:hover .text-2 { color: inherit; opacity: .8; }
.search-suggest-value { font-weight: 500; }

/* ───────────────────────── Date range pill ───────────────────────── */
.date-pill { display: inline-flex; height: 32px; align-items: center; gap: 6px; border-radius: 999px; background: var(--fill); padding-inline: 12px; font-size: 13px; font-weight: 500; }
.date-pill:hover { background: var(--fill-strong); }
.date-pill-icon { color: var(--accent); }
.date-pill-chevron { opacity: .6; }
.drp-pop { padding: 0; }
.drp { display: flex; }
.drp-presets { display: flex; width: 160px; flex-direction: column; gap: 2px; border-inline-end: 1px solid var(--separator); padding: 8px; }
.drp-preset { display: flex; height: 32px; align-items: center; justify-content: space-between; gap: 8px; border-radius: 8px; padding-inline: 10px; text-align: start; font-size: 13.5px; }
.drp-preset:hover:not(.is-static) { background: var(--fill); }
.drp-preset.is-static { color: var(--label-secondary); }
.drp-preset.is-selected { color: var(--accent); font-weight: 600; }
.drp-cal { padding: 12px; }
.drp-cal-head { margin-bottom: 4px; display: flex; align-items: center; justify-content: space-between; }
.drp-months { display: flex; gap: 20px; }
.drp-month { width: 232px; }
.drp-month-title { margin-bottom: 8px; text-align: center; font-size: 13px; font-weight: 600; }
.drp-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); row-gap: 2px; text-align: center; }
.drp-wd { padding-bottom: 4px; }
.drp-day { position: relative; height: 32px; font-size: 13px; }
.drp-day > span { margin-inline: auto; display: grid; width: 32px; height: 32px; place-items: center; border-radius: 999px; }
.drp-day:hover:not(:disabled) > span { background: var(--fill); }
.drp-day:disabled { color: var(--label-tertiary); }
.drp-day.in-range { background: var(--accent-soft); }
.drp-day.is-edge > span { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.drp-day.is-today:not(.is-edge) > span { color: var(--accent); font-weight: 600; }
@media (max-width: 639px) {
  .drp { flex-direction: column; }
  .drp-presets { width: auto; flex-direction: row; flex-wrap: wrap; border-inline-end: 0; border-bottom: 1px solid var(--separator); }
  .drp-months { flex-direction: column; }
  .drp-second { display: none; }
}

/* ───────────────────────── KPI tiles ───────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.kpi-grid.kpi-3 { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .kpi-grid.kpi-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .kpi-grid.kpi-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kpi-grid.kpi-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .kpi-grid.kpi-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 1279px) { .kpi-grid.kpi-5 .kpi-wide { grid-column: span 2; } }
@media (max-width: 1023px) { .kpi-grid.kpi-5 .kpi-wide { grid-column: 1 / -1; } }
.kpi-main { margin-top: 8px; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.kpi-main-text { min-width: 0; }
.kpi-main .kpi-value { margin-top: 0; }
.kpi-delta { margin-top: 8px; }
.kpi-spark { flex-shrink: 0; }
.kpi-ring-row { margin-top: 8px; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.kpi-ring-row .kpi-value { margin-top: 0; }
.kpi-sub { margin-top: 8px; }
.delta-chip {
  display: inline-flex; height: 20px; align-items: center; gap: 4px; border-radius: 999px; padding-inline: 6px; font-size: 11.5px; font-weight: 600;
  color: var(--tone-text); background: color-mix(in oklab, var(--tone) 13%, transparent);
}
.delta-suffix { font-weight: 400; opacity: .9; }

/* Summary strip and stat tiles. */
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 4px; padding: 8px; }
.stat-item { display: flex; align-items: center; gap: 12px; border-radius: 12px; padding: 12px; text-align: start; transition: background .15s, transform .15s; }
.stat-item:not(.is-static):hover { background: var(--fill); }
.stat-item:not(.is-static):active { transform: scale(.98); }
.stat-item.is-static { cursor: default; }
.stat-item:disabled { color: inherit; }
.stat-icon { display: grid; width: 40px; height: 40px; flex-shrink: 0; place-items: center; border-radius: 12px; color: var(--tone); background: color-mix(in oklab, var(--tone) 15%, transparent); }
.stat-text { display: flex; min-width: 0; flex-direction: column; }
.stat-value { font-size: 22px; font-weight: 700; line-height: 28px; }
.stat-tile { display: flex; align-items: center; gap: 12px; padding: 16px; }
.tile-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 640px) { .tile-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.docs-view { display: grid; gap: 16px; }

/* ───────────────────────── Charts ───────────────────────── */
.chart-card { min-width: 0; }
.chart-card.is-flat { margin-top: 4px; }
.chart-head { margin-bottom: 12px; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 12px; }
.chart-titles { min-width: 0; flex: 1; }
.chart-summary { margin-top: 2px; }
.chart-actions { display: flex; align-items: center; gap: 8px; }
.chart-body { min-width: 0; }
.chart-grid { max-height: 20rem; overflow: auto; border-radius: 12px; box-shadow: 0 0 0 1px var(--separator); }
.chart-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.chart-table th { position: sticky; top: 0; padding: 8px 12px; font-weight: 600; color: var(--label-secondary); }
.chart-table td { border-top: 1px solid var(--separator); padding: 6px 12px; }
.chart-table .align-start { text-align: start; }
.chart-table .align-end { text-align: end; }
.chart-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1024px) {
  .chart-row.chart-row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-row.chart-row-3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}

.chart-legend { margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.legend-item { display: inline-flex; height: 24px; align-items: center; gap: 6px; border-radius: 999px; padding-inline: 8px; font-size: 12px; font-weight: 500; transition: opacity .15s; }
.legend-item:hover:not(:disabled) { background: var(--fill); }
.legend-item.is-off { opacity: .4; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; }
.legend-dot { width: 8px; height: 8px; border-radius: 999px; }

/* Time series (inline SVG plot + HTML axes). */
.ts-chart { user-select: none; }
.ts-frame { display: grid; grid-template-columns: 40px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 22px; column-gap: 4px; }
.ts-yaxis { position: relative; margin-top: 8px; }
.ts-ytick { position: absolute; inset-inline-end: 4px; translate: 0 -50%; font-size: 11px; color: var(--label-secondary); white-space: nowrap; }
.ts-plot { position: relative; margin-top: 8px; min-width: 0; }
.ts-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
[dir="rtl"] .ts-svg { transform: scaleX(-1); }
.ts-grid { stroke: var(--separator); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ts-grid.is-base { stroke: var(--separator-strong); }
.ts-cols { position: absolute; inset: 0; }
.ts-col { position: absolute; top: 0; bottom: 0; cursor: crosshair; }
.ts-col:hover, .ts-col:focus-visible { background: color-mix(in oklab, var(--fill) 70%, transparent); outline: none; }
.ts-col.is-pickable { cursor: pointer; }
.ts-tip {
  position: absolute; top: 4px; inset-inline-start: 50%; z-index: 5; display: none; min-width: 9rem; border-radius: 12px;
  padding: 8px 12px; font-size: 12px; text-align: start; pointer-events: none; white-space: nowrap;
}
.ts-tip.is-end { inset-inline-start: auto; inset-inline-end: 50%; }
.ts-col:hover .ts-tip, .ts-col:focus-visible .ts-tip { display: block; }
.ts-tip-title { display: block; margin-bottom: 4px; font-weight: 600; }
.ts-tip-row { display: flex; justify-content: space-between; gap: 16px; }
.ts-tip-key { display: inline-flex; align-items: center; gap: 6px; color: var(--label-secondary); }
.ts-tip-key i { width: 8px; height: 8px; border-radius: 999px; }
.ts-tip-sum { margin-top: 4px; border-top: 1px solid var(--separator); padding-top: 4px; }
.ts-xaxis { position: relative; grid-column: 2; }
.ts-xtick { position: absolute; top: 6px; translate: -50% 0; font-size: 11px; color: var(--label-secondary); white-space: nowrap; max-width: 7rem; overflow: hidden; text-overflow: ellipsis; }
[dir="rtl"] .ts-xtick { translate: 50% 0; }
.ts-xtick.is-first { translate: 0 0; }
.ts-xtick.is-last { translate: -100% 0; }
[dir="rtl"] .ts-xtick.is-last { translate: 100% 0; }

/* Horizontal bars, stacked bar, waterfall, sparkline, ring. */
.hbar-list { display: grid; gap: 4px; }
.hbar-row { display: grid; width: 100%; grid-template-columns: minmax(84px, 34%) minmax(0, 1fr) auto; align-items: center; gap: 12px; border-radius: 10px; padding: 6px 8px; text-align: start; }
.hbar-row.is-pickable:hover { background: var(--fill); }
.hbar-row.is-selected { background: var(--accent-soft); }
.hbar-label { display: flex; min-width: 0; flex-direction: column; font-size: 13px; }
.hbar-sub { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--label-secondary); }
.hbar-track { position: relative; height: 20px; overflow: hidden; border-radius: 5px; background: var(--fill); }
.hbar-fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 5px; transition: width .5s cubic-bezier(.22,1,.36,1); }
.hbar-value { min-width: 3.5rem; text-align: end; font-size: 13px; font-weight: 600; }
.hbar-unit, .mini-unit { margin-inline-start: 2px; font-size: 11px; font-weight: 400; color: var(--label-secondary); }

.stacked-track { display: flex; width: 100%; gap: 2px; overflow: hidden; border-radius: 999px; }
.stacked-seg { height: 100%; min-width: 4px; flex-basis: 0; transition: filter .15s, flex-grow .6s cubic-bezier(.22,1,.36,1); }
.stacked-seg.is-pickable:hover { filter: brightness(1.1); }
.stacked-legend { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.stacked-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }

.waterfall { display: grid; gap: 8px; }
.wf-row { display: grid; grid-template-columns: minmax(80px, 26%) minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.wf-label { font-size: 13px; color: var(--label-secondary); }
.wf-track { position: relative; height: 24px; }
.wf-bar { position: absolute; inset-block: 0; border-radius: 6px; }
.wf-total { background: var(--c3); }
.wf-up { background: var(--positive); }
.wf-down { background: var(--attention); }
.wf-value { min-width: 5rem; text-align: end; font-size: 13px; font-weight: 600; }

.sparkline { overflow: visible; }
[dir="rtl"] .sparkline { transform: scaleX(-1); }
.progress-ring { position: relative; display: inline-grid; flex-shrink: 0; place-items: center; }
.progress-ring svg { transform: rotate(-90deg); }
[dir="rtl"] .progress-ring svg { transform: rotate(-90deg) scaleY(-1); }
.progress-ring circle:last-child { transition: stroke-dashoffset .5s cubic-bezier(.22,1,.36,1); }
.progress-ring-center { position: absolute; inset: 0; display: grid; place-items: center; }
.ring-num { font-size: 13px; font-weight: 700; }

/* ───────────────────────── Inspectors ───────────────────────── */
.inspector-hero { padding: 0 20px 12px; }
.hero-card { display: flex; align-items: center; gap: 12px; padding: 12px; }
.hero-text { min-width: 0; flex: 1; }
.hero-title { font-weight: 600; }
.hero-text .dept-label { margin-top: 2px; }
.hero-link { margin-top: 4px; display: inline-flex; max-width: 100%; align-items: center; gap: 6px; font-size: 13px; color: var(--accent); }
a.hero-link:hover { text-decoration: underline; }
.hero-link.is-static { color: var(--label); }
.hero-tabs { margin-top: 12px; }
.section-label { margin: 20px 4px 6px; display: flex; align-items: center; justify-content: space-between; }
.section-label h3 { font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--label-secondary); }
[dir="rtl"] .section-label h3 { letter-spacing: 0; }
.section-label.is-first, .kv-list.is-first { margin-top: 4px; }
.kv-list { overflow: hidden; }
.kv-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 14px; }
.kv-row dt { flex-shrink: 0; }
.kv-row dd { min-width: 0; margin: 0; text-align: end; }
.inset-list { overflow: hidden; }
.inset-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.inset-row-text { display: flex; min-width: 0; flex: 1; flex-direction: column; overflow-wrap: anywhere; }   /* long codes (document numbers) wrap instead of running under the chip */
.inset-row-title { font-size: 13.5px; font-weight: 500; }
.inset-row-sub { font-size: 11.5px; color: var(--label-secondary); }
.inset-row-qty { flex-shrink: 0; font-size: 13px; font-weight: 600; }
.inset-row-end { display: flex; flex-shrink: 0; flex-direction: column; align-items: flex-end; gap: 2px; }   /* chip with the view icon under it, so the text keeps its width */
.leave-banner { margin-top: 4px; display: flex; align-items: center; gap: 12px; border-radius: 12px; padding: 12px; background: color-mix(in oklab, var(--neutral) 12%, transparent); }
.reg-card { display: flex; align-items: center; gap: 14px; padding: 14px; }
.reg-card-text { min-width: 0; flex: 1; }
.reg-card-chip { margin-top: 4px; }
.mini-tiles { margin-top: 4px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mini-tile { padding: 8px 10px; }
.mini-value { margin-top: 2px; font-size: 17px; font-weight: 700; }
.inspector-chart { margin-top: 16px; }
.thumb { position: relative; display: inline-block; flex-shrink: 0; overflow: hidden; background: var(--fill); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); pointer-events: none; }
.thumb-fallback { display: grid; width: 100%; height: 100%; place-items: center; color: var(--label-tertiary); }

/* ───────────────────────── Employees ───────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 268px), 1fr)); gap: 12px; }
.person-card { display: flex; width: 100%; align-items: flex-start; gap: 12px; padding: 16px; text-align: start; transition: transform .2s, box-shadow .2s; }
.person-card:hover, .vehicle-card:hover { transform: scale(1.01); }
.person-card:active, .vehicle-card:active { transform: scale(.98); }
.person-card.is-selected, .vehicle-card.is-selected { box-shadow: 0 0 0 2px var(--accent); }
.person-card-text { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.person-card-name { font-size: 15px; font-weight: 600; }
.person-card-alt { font-size: 12.5px; color: var(--label-tertiary); }
.person-card-des { margin-top: 6px; font-size: 13px; }
.person-card .dept-label { margin-top: 2px; font-size: 12px; color: var(--label-secondary); }

.leave-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1280px) { .leave-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.leave-side { display: grid; align-content: start; gap: 16px; }
.leave-gantt-card { overflow: hidden; }
.leave-gantt-head { padding: 16px 16px 8px; }
@media (min-width: 640px) { .leave-gantt-head { padding: 20px 20px 8px; } }
.legend-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.legend-row > span { display: inline-flex; align-items: center; gap: 6px; }
.legend-bar { width: 20px; height: 10px; border-radius: 3px; }
.legend-bar.is-leave { background: var(--neutral); }
.legend-today { width: 2px; height: 12px; border-radius: 999px; background: var(--critical); }
.gantt { max-height: 560px; overflow: auto; border-top: 1px solid var(--separator); }
.gantt-inner { min-width: 620px; }
.gantt-row { display: grid; grid-template-columns: minmax(150px, 200px) minmax(0, 1fr); border-bottom: 1px solid var(--separator); }
.gantt-row:last-child { border-bottom: 0; }
.gantt-row.is-selected { background: var(--accent-soft); }
.gantt-axis { position: sticky; top: 0; z-index: 20; }
.gantt-name-head { display: flex; height: 32px; align-items: center; padding-inline: 16px; font-size: 11.5px; font-weight: 600; color: var(--label-secondary); }
.gantt-name { position: sticky; inset-inline-start: 0; z-index: 10; display: flex; height: 44px; min-width: 0; align-items: center; gap: 8px; padding-inline: 16px; text-align: start; background: var(--bg-elevated); }
.gantt-row.zebra-row .gantt-name { background: color-mix(in oklab, var(--fill) 55%, var(--bg-elevated)); }
.gantt-row.is-selected .gantt-name { background: var(--accent-soft); }
.gantt-name:hover { background: var(--fill); }
.gantt-name-text { display: flex; min-width: 0; flex-direction: column; }
.gantt-name-primary { font-size: 13px; font-weight: 500; }
.gantt-name-secondary { font-size: 11px; color: var(--label-secondary); }
.gantt-track { position: relative; height: 44px; margin-inline-end: 16px; }
.gantt-axis .gantt-track { height: 32px; }
.gantt-tick { position: absolute; top: 0; display: flex; height: 100%; align-items: center; padding-inline-start: 4px; font-size: 11px; color: var(--label-secondary); white-space: nowrap; }
.gantt-grid { position: absolute; inset-block: 0; width: 1px; background: var(--separator); opacity: .6; }
.gantt-today { position: absolute; inset-block: 0; z-index: 2; width: 2px; background: var(--critical); }
.gantt-bar {
  position: absolute; inset-block: 8px; z-index: 3; display: flex; align-items: center; overflow: hidden; border-radius: 7px; padding-inline: 8px;
  background: var(--neutral); color: #fff; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.gantt-unknown { position: absolute; inset-block: 0; inset-inline-start: 8px; display: flex; align-items: center; }
.person-list { margin-inline: -8px; }
.person-list.is-scroll { max-height: 340px; overflow-y: auto; }
.person-list > li { border-radius: 10px; }
.person-list-row { display: flex; width: 100%; align-items: center; gap: 12px; border-radius: 10px; padding: 6px 8px; text-align: start; }
.person-list-row:hover { background: var(--fill); }
.person-list-row.is-selected { background: var(--accent-soft); }
.person-list-text { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.person-list-name { font-size: 13.5px; font-weight: 500; }
.person-list-sub { font-size: 11.5px; color: var(--label-secondary); }
.anniv-end { display: flex; flex-shrink: 0; flex-direction: column; align-items: flex-end; }
.anniv-years { font-size: 12.5px; font-weight: 600; color: var(--gold-text); }
.anniv-date { font-size: 11px; color: var(--label-secondary); }
.anniv-date.is-today { font-weight: 600; color: var(--accent); }

/* ───────────────────────── Vehicles ───────────────────────── */
.status-tiles { margin-top: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .status-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .status-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.status-tile { display: flex; flex-direction: column; border-radius: 12px; padding: 10px 12px; text-align: start; background: var(--fill); transition: background .15s, box-shadow .15s, opacity .15s, transform .15s; }
.status-tile:hover { background: var(--fill-strong); }
.status-tile:active { transform: scale(.98); }
.status-tile.is-selected { background: var(--bg-elevated); box-shadow: 0 0 0 2px var(--accent); }
.status-tile.is-dim { opacity: .6; }
.status-tile.is-dim:hover { opacity: 1; }
.status-tile-label { display: flex; min-width: 0; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; }
.status-tile .stat-value { margin-top: 2px; }
.reg-banner {
  margin-top: 16px; display: flex; width: 100%; align-items: center; gap: 12px; border-radius: 14px; padding: 12px 16px; text-align: start;
  background: color-mix(in oklab, var(--warning) 12%, var(--bg-elevated)); transition: box-shadow .15s, filter .15s;
}
.reg-banner:hover { filter: brightness(1.02); }
.reg-banner.is-active { box-shadow: 0 0 0 2px var(--warning); }
.reg-banner-icon { display: grid; width: 36px; height: 36px; flex-shrink: 0; place-items: center; border-radius: 10px; color: var(--warning-text); background: color-mix(in oklab, var(--warning) 20%, transparent); }
.reg-banner-text { min-width: 0; flex: 1; font-size: 14px; font-weight: 600; }
.reg-banner-action { display: inline-flex; flex-shrink: 0; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; color: var(--accent); }
.vehicle-card { display: block; width: 100%; padding: 16px; text-align: start; transition: transform .2s, box-shadow .2s; }
.vehicle-card-head { display: flex; align-items: flex-start; gap: 12px; }
.vehicle-card-title { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.vehicle-code { font-size: 15px; font-weight: 600; }
.vehicle-card-facts { margin-top: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; }
.vehicle-card-facts dd { margin: 0; font-size: 13px; font-weight: 500; }
.vehicle-card-foot { margin-top: 12px; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--separator); padding-top: 10px; font-size: 12.5px; }
.vehicle-card-foot > .truncate { min-width: 0; flex: 1; }
.owner-pill { border-radius: 999px; background: var(--fill); padding-inline: 6px; font-size: 11px; font-weight: 600; line-height: 20px; color: var(--label-secondary); }

/* ───────────────────────── Production ───────────────────────── */
.season-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; }
.season-banner .icon-tile-md { width: 36px; height: 36px; border-radius: 10px; }
.season-text { min-width: 0; flex: 1; }
.season-track { height: 8px; width: 100%; overflow: hidden; border-radius: 999px; background: var(--fill); }
@media (min-width: 640px) { .season-track { width: 14rem; } }
.season-track > div { height: 100%; border-radius: 999px; background: var(--c4); }
.warn-value { display: inline-flex; align-items: center; gap: 4px; color: var(--warning-text); }

/* ── Owner feedback 19-10-2026 ── */
.stat-item.is-selected { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.stat-tile.is-button { width: 100%; text-align: start; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.stat-tile.is-button:hover { box-shadow: 0 0 0 1px var(--separator-strong), var(--card-shadow); }
.stat-tile.is-button:active { transform: scale(.98); }
.stat-tile.is-selected, .stat-tile.is-selected:hover { box-shadow: 0 0 0 2px var(--accent); }
.follow-tiles, .follow-card { margin-bottom: 16px; }
.follow-detail { flex-shrink: 0; }
.leave-banner.is-overdue { background: color-mix(in oklab, var(--critical) 14%, transparent); color: var(--critical-text); }
.gantt-bar.is-overdue { background: var(--critical); }
.kv-copy { display: inline-flex; max-width: 100%; align-items: center; gap: 6px; margin-inline-end: -6px; border-radius: 8px; padding: 2px 6px; color: var(--accent); }
.kv-copy:hover { background: var(--fill); }
.kv-copy-icon { opacity: .75; }
.inspector-back { display: inline-flex; max-width: 100%; align-items: center; gap: 6px; margin-bottom: 10px; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--fill); }
.inspector-back:hover { background: var(--fill-strong); }
.mulkiya-row { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.mulkiya-chip { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 8px 14px; font-size: 13.5px; font-weight: 600; color: var(--tone-text); background: color-mix(in oklab, var(--tone) 14%, transparent); transition: box-shadow .15s; }
.mulkiya-chip.is-expired { --tone: var(--critical); --tone-text: var(--critical-text); }
.mulkiya-chip.is-expiring { --tone: var(--warning); --tone-text: var(--warning-text); }
.mulkiya-chip:hover { background: color-mix(in oklab, var(--tone) 22%, transparent); }
.mulkiya-chip.is-active { box-shadow: 0 0 0 2px var(--tone); }
.mulkiya-count { border-radius: 999px; padding: 0 8px; font-size: 12px; line-height: 20px; color: #fff; background: var(--tone); }
.farm-pill, .category-pill { display: inline-flex; height: 32px; max-width: 240px; align-items: center; gap: 6px; border-radius: 999px; background: var(--fill); padding-inline: 12px; font-size: 13px; font-weight: 500; }
.farm-pill:hover, .category-pill:hover { background: var(--fill-strong); }
.farm-pill-icon { flex-shrink: 0; color: var(--accent); }
.farm-pill-chevron { flex-shrink: 0; opacity: .6; }
.farm-pill-label { min-width: 0; max-width: 180px; }
.farm-pill.is-filtered, .category-pill.is-filtered { box-shadow: inset 0 0 0 1.5px var(--accent); }
.farm-menu-list { max-height: 360px; overflow-y: auto; }
.positive-text { color: var(--positive-text); }

/* ── Vehicle documents (CR-026): table actions, upload dialog with drag and drop, viewer with preview ── */
.doc-cell { display: inline-flex; align-items: center; gap: 2px; }
.doc-cell .icon-btn { color: var(--label-secondary); }
.doc-cell .icon-btn:hover { color: var(--c3); }
.doc-drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 180px; padding: 24px;
  border: 1.5px dashed color-mix(in oklab, var(--c3) 45%, var(--separator)); border-radius: 16px; text-align: center;
  background: color-mix(in oklab, var(--c3) 5%, transparent); transition: background .15s, border-color .15s, min-height .2s; }
.doc-drop:hover, .doc-drop.is-dragging { border-color: var(--c3); background: color-mix(in oklab, var(--c3) 11%, transparent); }
.doc-drop.is-dragging { box-shadow: 0 0 0 4px color-mix(in oklab, var(--c3) 16%, transparent); }
.doc-drop.is-compact { flex-direction: row; min-height: 0; padding: 12px 16px; gap: 12px; text-align: start; justify-content: flex-start; }
.doc-drop.is-disabled { opacity: .6; }
.doc-drop-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 1; }
.doc-drop-input:disabled { cursor: default; }
.doc-drop:has(.doc-drop-input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.doc-drop-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
  background: color-mix(in oklab, var(--c3) 14%, transparent); color: var(--c3); }
.doc-drop.is-compact .doc-drop-icon { width: 36px; height: 36px; border-radius: 10px; }
.doc-drop-text { display: flex; flex-direction: column; gap: 4px; }
.doc-drop.is-compact .doc-drop-text { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.doc-drop-browse { color: var(--c3); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.doc-lines { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.doc-line { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; border-radius: 12px; background: var(--fill); }
.doc-line.is-error { background: color-mix(in oklab, var(--critical) 9%, transparent); }
.doc-line.is-done { opacity: .7; }
.doc-line-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.doc-desc { min-height: 36px; padding: 6px 10px; font-weight: 500; }
.doc-line-meta { display: flex; align-items: center; gap: 4px; min-width: 0; }
.doc-line-error { color: var(--critical-text); white-space: nowrap; }
.doc-line-end { flex-shrink: 0; display: flex; align-items: center; }
.doc-state { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.doc-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  --tone: var(--label-secondary); background: color-mix(in oklab, var(--tone) 14%, transparent); color: var(--tone); }
.doc-icon[data-kind="pdf"] { --tone: var(--critical); }
.doc-icon[data-kind="image"] { --tone: var(--c6); }
.doc-icon[data-kind="word"] { --tone: var(--c3); }
.doc-icon[data-kind="excel"] { --tone: var(--positive); }
.doc-icon.is-lg { width: 64px; height: 64px; border-radius: 16px; }
.doc-footer-hint { margin-inline-end: auto; }
.sheet-footer .doc-footer-start { margin-inline-end: auto; }
.doc-viewer { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 16px; height: min(68vh, 680px); }
.doc-list { list-style: none; margin: 0; padding: 0 4px 0 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.doc-list-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border-radius: 12px; text-align: start; background: transparent;
  transition: background .15s, box-shadow .15s; }
.doc-list-item:hover { background: var(--fill); }
.doc-list-item.is-selected { background: color-mix(in oklab, var(--c3) 12%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--c3) 55%, transparent); }
.doc-list-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.doc-preview { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.doc-preview-head { display: flex; align-items: flex-start; gap: 12px; }
.doc-preview-titles { min-width: 0; flex: 1; }
.doc-preview-titles h3, .doc-preview-titles p { margin: 0; }
.doc-preview-actions { display: flex; gap: 6px; flex-shrink: 0; }
.doc-delete-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.doc-preview-body { position: relative; flex: 1; min-height: 0; border-radius: 14px; overflow: hidden; background: var(--bg-grouped); box-shadow: inset 0 0 0 1px var(--separator);
  display: grid; place-items: center; }
.doc-preview-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.doc-preview-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.doc-preview-body > .banner { margin: 16px; align-self: start; }
.doc-no-preview { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px; text-align: center; }
.doc-no-preview p { margin: 0; }
/* Documents band of a report screen (CR-027), styled like the season banner */
.docs-band { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; }
.docs-band .icon-tile-md { width: 36px; height: 36px; border-radius: 10px; }
.docs-band-text { min-width: 0; flex: 1; }
.docs-band-text p { margin: 0; }
.docs-band-actions { display: flex; flex-wrap: wrap; gap: 8px; }.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 767px) {
  .doc-viewer { grid-template-columns: 1fr; height: auto; }
  .doc-list { max-height: 30vh; }
  .doc-preview-body { min-height: 55vh; }
  .doc-footer-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }