/* Qala Machine Health — phone / field layer (loaded after the main stylesheet). */
:root { --qmh-amber: #f59e0b; --qmh-ink: #0f172a; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html { overscroll-behavior-y: none; } /* on html, not body: on body it blocked scrolling on phones (v3.5) */
#root { min-height: 100dvh; }

/* ---------- boot splash (shown until React mounts) ---------- */
.qmh-boot { min-height: 100dvh; display: grid; place-items: center; background: var(--qmh-ink); color: #e2e8f0; font: 600 14px/1.4 system-ui, sans-serif; text-align: center; }
.qmh-boot img { width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 14px; display: block; }
.qmh-boot small { display: block; opacity: .6; font-weight: 400; margin-top: 4px; }

/* ---------- bottom navigation + More sheet ---------- */
.qm-bnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: hsl(var(--card)); border-top: 1px solid hsl(var(--border));
  padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 16px rgb(15 23 42 / .06); }
.qm-tab { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; padding: 6px 2px;
  font-size: 11px; font-weight: 500; color: hsl(var(--muted-foreground)); background: none; border: 0; position: relative; }
.qm-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qm-tab.qm-on { color: hsl(var(--foreground)); font-weight: 700; }
.qm-tab.qm-on::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--qmh-amber); }
.qm-tab:active { background: hsl(var(--muted)); }
.qm-sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgb(15 23 42 / .45); animation: qmh-fade .15s ease-out; }
.qm-sheet { position: absolute; left: 0; right: 0; bottom: 0; background: hsl(var(--card)); border-radius: 20px 20px 0 0;
  padding: 8px 14px calc(78px + env(safe-area-inset-bottom)); max-height: 80dvh; overflow-y: auto; animation: qmh-up .18s ease-out; }
.qm-grab { width: 40px; height: 4px; border-radius: 4px; background: hsl(var(--border)); margin: 4px auto 12px; }
.qm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.qm-gi { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 4px; min-height: 76px; border-radius: 14px;
  border: 1px solid hsl(var(--border)); background: hsl(var(--background)); font-size: 12px; font-weight: 600; color: hsl(var(--foreground)); text-align: center; }
.qm-gi.qm-on { border-color: var(--qmh-amber); background: #fffbeb; }
.qm-gi:active { transform: scale(.97); }
@keyframes qmh-up { from { transform: translateY(24px); opacity: .6 } to { transform: none; opacity: 1 } }
@keyframes qmh-fade { from { opacity: 0 } to { opacity: 1 } }

/* sandbox banner: short text on phones */
.qm-short { display: none; }
@media (max-width: 639px) { .qm-long { display: none; } .qm-short { display: inline; } }

/* ---------- PWA chrome (install / update / backup nudges) ---------- */
.qmh-toast { position: fixed; left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 35; display: flex; gap: 10px; align-items: center;
  background: var(--qmh-ink); color: #f8fafc; border-radius: 14px; padding: 10px 12px; font: 13px/1.35 system-ui, sans-serif; box-shadow: 0 8px 24px rgb(0 0 0 / .25); }
.qmh-toast p { margin: 0; flex: 1; }
.qmh-toast button { border: 0; border-radius: 10px; padding: 9px 12px; font-weight: 700; font-size: 13px; min-height: 40px; }
.qmh-toast .qmh-go { background: var(--qmh-amber); color: var(--qmh-ink); }
.qmh-toast .qmh-x { background: transparent; color: #94a3b8; padding: 9px 6px; }
@media (min-width: 768px) { .qmh-toast { left: auto; right: 20px; bottom: 20px; max-width: 420px; } }

/* ---------- phone layout fixes ---------- */
@media (max-width: 767px) {
  main { padding-bottom: calc(96px + env(safe-area-inset-bottom)) !important; }
  /* card/grid children could not shrink -> page wider than the phone (History, Spares, Settings, Reports) */
  main [data-slot="card"], main [data-slot="card-content"], main [data-slot="card-header"], main .grid > *, main [data-slot="tabs"], main [data-slot="tabs-content"] { min-width: 0; max-width: 100%; }
  main [data-slot="table-container"] { -webkit-overflow-scrolling: touch; }
  /* headers with a title + action buttons: wrap instead of squashing the title to one word per line */
  main .flex.justify-between { flex-wrap: wrap; row-gap: .4rem; }
  main h2 { min-width: 0; }
  /* tab strips scroll sideways instead of overflowing the page */
  main [data-slot="tabs-list"] { max-width: 100%; width: auto; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; height: auto; min-height: 2.5rem; }
  main [data-slot="tabs-list"]::-webkit-scrollbar { display: none; }
  main [data-slot="tabs-trigger"] { flex: 0 0 auto; }
  main .flex.gap-1:has(> button), main .flex.gap-2:has(> button) { flex-wrap: wrap; }
  main img { max-width: 100%; height: auto; }
  main pre, main code { white-space: pre-wrap; word-break: break-word; }
}

/* ---------- touch ergonomics (gloved / dusty hands) ---------- */
@media (pointer: coarse) {
  /* iOS zooms the page on focus when input text is under 16px */
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), textarea, select { font-size: 16px !important; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, [role="combobox"] { min-height: 42px; }
  main button, [role="combobox"], [data-slot="tabs-trigger"] { min-height: 38px; }
  main button[data-slot="checkbox"], main [role="checkbox"] { min-height: 0; width: 22px; height: 22px; }
  main [role="switch"] { min-height: 0; }
  [role="option"] { min-height: 44px; }
  input[type="file"] { font-size: 14px; padding: 6px 0; }
  input[type="file"]::file-selector-button { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid hsl(var(--border)); background: hsl(var(--secondary)); font-weight: 600; margin-right: 10px; }
  input[type="date"], input[type="time"], input[type="datetime-local"] { min-width: 0; }
}

/* never let the page scroll sideways on a phone */
/* clip, not hidden: "hidden" on html+body made body a scroll box, and with overscroll-behavior it froze page scrolling on phones */
@media (max-width: 767px) { html, body { overflow-x: clip; } }

/* badges with long notes wrap instead of pushing the page wider */
@media (max-width: 767px) {
  main [data-slot="badge"] { white-space: normal; max-width: 100%; height: auto; text-align: left; line-height: 1.3; }
}

/* tablets/desktop keep the original side navigation */
@media (min-width: 768px) { .qm-bnav, .qm-sheet-bg { display: none !important; } }

/* =================== cloud layer: sign-in gate, me sheet, users & access =================== */
html.qa-gated body { overflow: hidden; }
.qa-gate { position: fixed; inset: 0; z-index: 100; background: var(--qmh-ink); display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.qa-card { width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 24px 20px; display: flex; flex-direction: column; gap: 10px; font: 15px/1.4 system-ui, sans-serif; color: #0f172a; }
.qa-card h1 { margin: 0; font-size: 20px; text-align: center; }
.qa-logo { width: 64px; height: 64px; border-radius: 16px; margin: 0 auto; }
.qa-sub { margin: 0 0 6px; color: #475569; text-align: center; font-size: 14px; }
.qa-form { display: flex; flex-direction: column; gap: 10px; }
.qa-card input, .qa-form input, .qa-form select, .qa-tri { width: 100%; min-height: 46px; border: 1px solid #cbd5e1; border-radius: 10px; padding: 10px 12px; font-size: 16px; background: #fff; color: #0f172a; }
.qa-btn { min-height: 46px; border: 0; border-radius: 12px; background: var(--qmh-ink); color: #fff; font-weight: 700; font-size: 15px; padding: 0 16px; }
.qa-btn:disabled { opacity: .6; }
.qa-btn2 { background: hsl(var(--secondary)); color: hsl(var(--foreground)); border: 1px solid hsl(var(--border)); }
.qa-sm { min-height: 38px; font-size: 13px; padding: 0 12px; }
.qa-link { background: none; border: 0; color: #2563eb; font-size: 14px; padding: 8px; min-height: 40px; }
.qa-danger { color: #dc2626; }
.qa-err { color: #b91c1c; font-size: 13px; min-height: 1em; white-space: pre-line; }
.qa-toasts { position: fixed; left: 12px; right: 12px; top: calc(10px + env(safe-area-inset-top)); z-index: 120; display: flex; flex-direction: column; gap: 8px; pointer-events: none; align-items: center; }
.qa-toast { max-width: 520px; background: var(--qmh-ink); color: #f8fafc; border-radius: 12px; padding: 10px 14px; font: 14px/1.35 system-ui, sans-serif; box-shadow: 0 8px 24px rgb(0 0 0 / .25); transition: opacity .3s; }
.qa-toast.qa-warn { background: #92400e; } .qa-toast.qa-out { opacity: 0; }
.qa-sheet-bg { position: fixed; inset: 0; z-index: 90; background: rgb(15 23 42 / .45); display: flex; align-items: flex-end; justify-content: center; }
.qa-sheet { width: 100%; max-width: 520px; background: hsl(var(--card)); border-radius: 20px 20px 0 0; padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.qa-grab { width: 40px; height: 4px; border-radius: 4px; background: hsl(var(--border)); margin: 4px auto 6px; }
.qa-me-name { font-weight: 800; font-size: 18px; } .qa-me-sub, .qa-me-status { color: hsl(var(--muted-foreground)); font-size: 13px; }
.qa-cred { background: hsl(var(--muted)); border-radius: 10px; padding: 12px; font-size: 14px; white-space: pre-wrap; }
.qmh-me { border: 1px solid hsl(var(--border)); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; background: hsl(var(--background)); max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 32px; }
/* users & access page */
.qa-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 14px 0 8px; }
.qa-head h2, .qa-head h3 { margin: 0; } h2 + .qa-muted { margin-top: 0; }
.qa-muted { color: hsl(var(--muted-foreground)); font-size: 13px; }
.qa-panel { border: 1px solid hsl(var(--border)); border-radius: 14px; padding: 14px; background: hsl(var(--card)); margin: 10px 0; }
.qa-panel h3, .qa-panel h4 { margin: 4px 0 8px; } .qa-panel h4 { margin-top: 14px; font-size: 14px; }
.qa-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.qa-list { display: flex; flex-direction: column; gap: 6px; }
.qa-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; border: 1px solid hsl(var(--border)); border-radius: 12px; padding: 12px; background: hsl(var(--card)); min-height: 56px; width: 100%; }
.qa-item-main { display: flex; flex-direction: column; min-width: 0; } .qa-item-main span { overflow: hidden; text-overflow: ellipsis; }
.qa-pill { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.qa-pill-ok { background: #dcfce7; color: #166534; } .qa-pill-off { background: #fee2e2; color: #991b1b; } .qa-pill-master { background: #fef3c7; color: #92400e; }
.qa-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.qa-check { flex-direction: row !important; align-items: center; gap: 10px !important; font-weight: 500 !important; }
.qa-check input { width: 22px; height: 22px; min-height: 0; flex: none; }
.qa-perm { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid hsl(var(--border)); font-size: 14px; }
.qa-perm .qa-tri { width: auto; min-width: 150px; min-height: 40px; font-size: 14px; }
.qa-back { background: none; border: 0; color: #2563eb; font-size: 14px; padding: 6px 0; min-height: 40px; }

/* v3.1 History page utilities not present in the compiled Tailwind build */
.bg-slate-800{background-color:#1e293b}.border-slate-800{border-color:#1e293b}.border-slate-700{border-color:#334155}.text-slate-800{color:#1e293b}
.border-gray-300{border-color:#d1d5db}.bg-red-50{background-color:#fef2f2}.bg-rose-700{background-color:#be123c}.border-emerald-600{border-color:#059669}
.border-red-400{border-color:#f87171}.cursor-help{cursor:help}.leading-4{line-height:1rem}.max-h-\[40rem\]{max-height:40rem}.text-blue-700{color:#1d4ed8}
@media (min-width:640px){.sm\:inline{display:inline}}
.qmh-chip{min-height:36px}.qmh-more{min-height:36px;display:block}

/* ===================== v4: Shifts, Downtime, Performance, Chat ===================== */
.qo-host { min-height: 60vh; }
.qo-page { display: flex; flex-direction: column; gap: 6px; padding-bottom: 24px; font-size: 14px; }
.qo-page h2 { font-size: 20px; font-weight: 800; margin: 0; }
.qo-page h3 { font-size: 15px; font-weight: 700; } .qo-page h4 { font-size: 13px; font-weight: 700; margin: 12px 0 6px; }
.qo-h { margin: 14px 0 4px; }
.qo-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.qo-tabs::-webkit-scrollbar { display: none; }
.qo-tab { flex: none; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid hsl(var(--border)); background: hsl(var(--card)); font-size: 13px; font-weight: 600; color: hsl(var(--muted-foreground)); display: inline-flex; align-items: center; gap: 6px; }
.qo-tab.qo-on { background: var(--qmh-ink); color: #fff; border-color: var(--qmh-ink); }
.qo-badge { background: #dc2626; color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 6px; }
.qo-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 6px 0; }
.qo-tile { border: 1px solid hsl(var(--border)); border-radius: 12px; padding: 10px 12px; background: hsl(var(--card)); min-width: 0; }
.qo-tile-l { font-size: 12px; color: hsl(var(--muted-foreground)); } .qo-tile-v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.qo-tile-s { font-size: 11px; color: hsl(var(--muted-foreground)); }
.qo-tile.qo-red .qo-tile-v, td.qo-red, .qo-red { color: #b91c1c; } .qo-tile.qo-green .qo-tile-v, td.qo-green { color: #15803d; }
.qo-bars { display: flex; flex-direction: column; gap: 6px; }
.qo-bar-row { display: grid; grid-template-columns: minmax(80px, 34%) 1fr auto; gap: 8px; align-items: center; font-size: 12px; }
.qo-bar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qo-bar-track { position: relative; height: 14px; background: hsl(var(--muted)); border-radius: 7px; overflow: hidden; }
.qo-bar { height: 100%; background: #475569; border-radius: 7px; } .qo-bar.qo-bad { background: #dc2626; } .qo-bar.qo-good { background: #16a34a; }
.qo-bar-ref { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #f59e0b; }
.qo-bar-v { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.qo-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.qo-table th, .qo-table td { border-bottom: 1px solid hsl(var(--border)); padding: 6px 6px; text-align: left; white-space: nowrap; }
.qo-table th { font-weight: 700; color: hsl(var(--muted-foreground)); position: sticky; top: 0; background: hsl(var(--card)); }
.qo-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.qo-hours input.qo-num { width: 70px; min-height: 40px; }
.qo-num { font-variant-numeric: tabular-nums; }
.qo-filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.qo-filters select { min-height: 40px; border: 1px solid hsl(var(--border)); border-radius: 10px; padding: 0 10px; background: hsl(var(--card)); font-size: 14px; max-width: 100%; }
.qo-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.qo-col { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.qo-dt { align-items: flex-start; }
.qo-pill-red { background: #fee2e2; color: #991b1b; } .qo-pill-ok { background: #dcfce7; color: #166534; } .qo-pill-amber { background: #fef3c7; color: #92400e; }
.qo-pill-blue { background: #dbeafe; color: #1e40af; } .qo-pill-grey { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.qo-note { background: #fef3c7; color: #78350f; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.qo-empty { color: hsl(var(--muted-foreground)); padding: 18px 4px; text-align: center; }
.qo-line { padding: 6px 0; border-bottom: 1px dashed hsl(var(--border)); font-size: 13px; overflow-wrap: anywhere; }
.qo-kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid hsl(var(--border)); font-size: 13px; }
.qo-kv span { color: hsl(var(--muted-foreground)); flex: none; } .qo-kv b { text-align: right; overflow-wrap: anywhere; }
.qo-sheet-bg { z-index: 95; } .qo-sheet { max-height: 92vh; overflow-y: auto; max-width: 640px; }
html.qo-locked body { overflow: hidden; }
.qo-sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; } .qo-sheet-head h3 { margin: 0; font-size: 17px; }
.qo-sheet-body { display: flex; flex-direction: column; gap: 10px; padding-bottom: 10px; }
.qo-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.qo-field input, .qo-field select, .qo-field textarea, .qo-sheet-body > input, .qo-sheet-body > textarea, .qo-compose textarea { width: 100%; min-height: 44px; border: 1px solid #cbd5e1; border-radius: 10px; padding: 9px 11px; font-size: 16px; background: #fff; color: #0f172a; font-weight: 400; }
.qo-field textarea { min-height: 70px; }
.qo-sub { display: flex; flex-direction: column; gap: 8px; padding: 8px 0 8px 12px; border-left: 3px solid hsl(var(--border)); }
.qo-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.qo-chip { min-height: 38px; padding: 0 12px; border-radius: 999px; border: 1px solid hsl(var(--border)); background: hsl(var(--card)); font-size: 13px; font-weight: 600; }
.qo-chip.qo-on { background: #1e40af; color: #fff; border-color: #1e40af; }
.qo-mach { display: flex; flex-direction: column; gap: 6px; }
.qo-mrow { display: grid; grid-template-columns: 70px 1fr 110px; gap: 8px; align-items: center; }
.qo-mrow select, .qo-mrow input { min-height: 42px; border: 1px solid #cbd5e1; border-radius: 10px; padding: 0 8px; font-size: 15px; background: #fff; color: #0f172a; min-width: 0; }
.qo-photos { display: flex; gap: 6px; flex-wrap: wrap; } .qo-photos img { width: 88px; height: 88px; object-fit: cover; border-radius: 8px; border: 1px solid hsl(var(--border)); }
.qo-ph { position: relative; } .qo-ph button { position: absolute; top: 2px; right: 2px; background: rgb(0 0 0 / .6); color: #fff; border: 0; border-radius: 999px; width: 24px; height: 24px; }
.qo-file { font-size: 14px; max-width: 100%; }
.qo-filebtn { position: relative; overflow: hidden; display: inline-flex; align-items: center; } .qo-filebtn input { position: absolute; inset: 0; opacity: 0; }
.qo-flag { border-left: 4px solid #f59e0b; align-items: flex-start; } .qo-flag.qo-red { border-left-color: #dc2626; }
.qo-flag .qa-item-main span { white-space: normal; }
details summary { cursor: pointer; padding: 8px 0; font-weight: 600; }
/* chat */
.qo-chat { min-height: calc(100vh - 210px); }
.qo-chbar { position: sticky; top: 0; z-index: 2; background: hsl(var(--background)); }
.qo-msgs { flex: 1; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; max-height: calc(100vh - 330px); min-height: 220px; padding: 4px 2px; }
.qo-msg { align-self: flex-start; max-width: 86%; text-align: left; background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: 14px 14px 14px 4px; padding: 8px 10px; font-size: 14px; }
.qo-msg.qo-mine { align-self: flex-end; background: #dbeafe; border-color: #bfdbfe; border-radius: 14px 14px 4px 14px; color: #0f172a; }
.qo-msg.qo-hidden { opacity: .55; font-style: italic; }
.qo-msg-h { display: flex; gap: 8px; justify-content: space-between; font-size: 11px; color: hsl(var(--muted-foreground)); }
.qo-msg-t { white-space: pre-wrap; overflow-wrap: anywhere; } .qo-msg img { max-width: 220px; max-height: 220px; border-radius: 10px; margin-top: 6px; display: block; }
.qo-pinned { background: #fef9c3; border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.qo-compose { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); background: hsl(var(--background)); padding: 6px 0; display: flex; flex-direction: column; gap: 6px; }
@media (min-width: 768px) { .qo-compose { bottom: 0; } }
.qo-compose-row { display: flex; gap: 6px; align-items: flex-end; } .qo-compose-row textarea { flex: 1; min-height: 44px; max-height: 140px; }
.qo-iconbtn { position: relative; width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 1px solid hsl(var(--border)); border-radius: 12px; font-size: 20px; overflow: hidden; }
.qo-iconbtn input { position: absolute; inset: 0; opacity: 0; }
.qo-sugg { display: flex; gap: 6px; flex-wrap: wrap; } .qo-sugg button { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid hsl(var(--border)); background: hsl(var(--card)); font-size: 13px; }
/* print (Kanu pack) */
.qo-print { display: none; }
@media print { html.qo-printing body > *:not(.qo-print) { display: none !important; } html.qo-printing .qo-print { display: block; padding: 12mm; color: #000; font: 11px/1.4 system-ui, sans-serif; }
  .qo-print h1 { font-size: 18px; margin: 0 0 4px; } .qo-print .qo-table th { position: static; } .qo-print .qa-item { border: 0; border-bottom: 1px solid #ccc; border-radius: 0; } }
.qo-hours th, .qo-hours td { padding: 4px 3px; }
.qo-hours select { max-width: 112px; min-height: 40px; font-size: 13px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 0 4px; background: #fff; color: #0f172a; }
.qo-hours input.qo-num { width: 58px; min-height: 40px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 0 6px; font-size: 16px; background: #fff; color: #0f172a; text-align: right; }
.qo-hours input:disabled, .qo-hours select:disabled { background: hsl(var(--muted)); }

/* v4.1 */
.qo-bad-input { outline: 2px solid #c62828; outline-offset: 1px; }
.qa-check.qo-small { font-size: 13px; font-weight: 400 !important; margin: 2px 0 8px; }

/* v4.3 dashboard tiles open their detail */
[data-qmh-tap] { cursor: pointer; position: relative; transition: border-color .15s, box-shadow .15s; -webkit-tap-highlight-color: transparent; }
[data-qmh-tap]::after { content: "Details ›"; position: absolute; top: 10px; right: 12px; font-size: 11px; font-weight: 600; color: var(--primary, #0f766e); opacity: .85; }
[data-qmh-tap]:hover, [data-qmh-tap]:focus-visible { border-color: var(--primary, #0f766e); box-shadow: 0 0 0 2px rgba(15,118,110,.15); outline: none; }
[data-qmh-tap]:active { transform: scale(.99); }
.qo-big { font-size: 26px; font-weight: 700; line-height: 1.2; margin: 2px 0 4px; }
.qo-small-note { font-size: 12px; margin: 8px 0; }
.qo-table tr.qo-hl td { background: rgba(220,38,38,.08); font-weight: 600; }
/* v4.4 shift sign-off reminder, crew */
/* in the page flow at the very top (never covers a button); the app sits below it */
.qo-remind { position: relative; margin: calc(env(safe-area-inset-top, 0px) + 6px) 8px 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #1e3a8a; color: #fff; border-radius: 14px; padding: 10px 12px; font-size: 13px; }
.qo-remind-t { display: flex; flex-direction: column; gap: 2px; flex: 1 1 200px; min-width: 0; }
.qo-remind .qa-btn { background: #fff; color: #1e3a8a; flex: none; }
.qo-remind .qa-link { color: #dbeafe; flex: none; }
html.qa-gated .qo-remind, html.qo-locked .qo-remind, html.qo-printing .qo-remind { display: none; }
.qo-table tr.qo-tap { cursor: pointer; }
.qo-crewgroup { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.qo-signoff .qa-item { align-items: center; }
/* v4.6 service tracker upload */
.qo-trk-map { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid #e5e7eb; }
.qo-trk-map select { width: 100%; min-width: 0; }
.qo-trk-row { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; padding: 6px 0; }
.qo-trk-row > input { flex: none; width: 22px; height: 22px; margin-top: 2px; }
.qo-trk-row > div { flex: 1; min-width: 0; }
.qo-trk-row.qo-off { opacity: .75; }
.qo-file-x { display: block; margin: 10px 0; max-width: 100%; }
@media (max-width: 420px) { .qo-trk-map { grid-template-columns: 1fr; } }
.qo-trk { display: flex; flex-direction: column; gap: 10px; }
/* v4.7 payroll */
.qo-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qo-tile.qo-amber .qo-tile-v { color: #92400e; }
/* v4.8 cost engine */
.qo-idea { border: 1px solid hsl(var(--border)); border-radius: 12px; background: hsl(var(--card)); margin: 8px 0; overflow: hidden; }
.qo-idea.qo-open { border-color: hsl(var(--primary) / .45); }
.qo-idea-h { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 10px 12px; cursor: pointer; }
.qo-idea-t { min-width: 0; flex: 1; } .qo-idea-t b { display: block; font-size: 14px; line-height: 1.3; }
.qo-idea-s { font-size: 12px; color: hsl(var(--muted-foreground)); margin-top: 3px; overflow-wrap: anywhere; }
.qo-idea-v { text-align: right; flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; max-width: 42%; }
.qo-idea-r { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qo-idea-b { padding: 0 12px 12px; border-top: 1px solid hsl(var(--border)); }
.qo-idea-b h4 { margin: 10px 0 4px; font-size: 13px; } .qo-idea-b ol, .qo-idea-b ul { margin: 0; padding-left: 20px; font-size: 13px; } .qo-idea-b li { margin: 3px 0; }
.qo-idea-b .qo-small-note { margin-top: 8px; }
@media (max-width: 480px) { .qo-idea-h { flex-direction: column; } .qo-idea-v { max-width: none; flex-direction: row; align-items: center; flex-wrap: wrap; } }
.qo-hl td { background: hsl(var(--primary) / .08); font-weight: 700; }
/* v4.10 action targets */
.qo-tgt-bar { position: relative; height: 10px; border-radius: 6px; background: hsl(var(--muted)); margin: 10px 0 6px; overflow: visible; }
.qo-tgt-fill { height: 100%; border-radius: 6px; background: #2563eb; } .qo-tgt-on-track, .qo-tgt-achieved { background: #16a34a; } .qo-tgt-behind, .qo-tgt-overdue { background: #dc2626; } .qo-tgt-no-data, .qo-tgt-parked { background: #9ca3af; }
.qo-tgt-time { position: absolute; top: -3px; width: 2px; height: 16px; background: hsl(var(--foreground)); }
.qo-tgt-steps { list-style: none; padding-left: 0 !important; margin: 8px 0 0; }
.qo-tgt-step { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 3px 0; } .qo-tgt-step input { margin-top: 2px; width: 18px; height: 18px; flex: 0 0 auto; }
.qo-tgt-step.qo-done span { text-decoration: line-through; color: hsl(var(--muted-foreground)); }

/* v4.11 Diesel vs manufacturer charts */
.qo-fuel-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px; margin: 6px 0; }
.qo-fuel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.qo-fuel-svg { width: 100%; height: auto; display: block; font-family: inherit; }
.qo-fuel-grid-l { stroke: #e2e8f0; stroke-width: 1; }
.qo-fuel-ax { font-size: 9px; fill: #64748b; }
.qo-fuel-lbl { font-size: 11px; fill: #0f172a; font-weight: 600; }
.qo-fuel-t { font-size: 11px; fill: #0f172a; font-weight: 700; }
.qo-fuel-val { font-size: 11px; font-weight: 700; fill: #0f172a; }
.qo-fuel-band { fill: #bbf7d0; stroke: #16a34a; stroke-width: 1; }
.qo-fuel-line { fill: none; stroke: #0f172a; stroke-width: 2; }
.qo-fuel-dot { fill: #0f172a; stroke: #fff; stroke-width: 1.5; }
.qo-fuel-dot.qo-fuel-hi, .qo-fuel-val.qo-fuel-hi { fill: #b91c1c; } .qo-fuel-dot.qo-fuel-lo, .qo-fuel-val.qo-fuel-lo { fill: #b45309; } .qo-fuel-dot.qo-fuel-ok, .qo-fuel-val.qo-fuel-ok { fill: #15803d; }
td.qo-fuel-hi { color: #b91c1c; font-weight: 700; } td.qo-fuel-lo { color: #b45309; font-weight: 700; } td.qo-fuel-ok { color: #15803d; font-weight: 700; }
.qo-fuel-key { font-size: 11px; margin-top: 4px; }
.qo-fuel-sw { display: inline-block; width: 14px; height: 10px; border-radius: 3px; vertical-align: middle; }
.qo-fuel-sw.band { background: #bbf7d0; border: 1px solid #16a34a; } .qo-fuel-sw.dot { background: #b91c1c; border-radius: 50%; width: 10px; }
.qo-fuel-src { margin-top: 6px; font-size: 12px; } .qo-fuel-src a { color: inherit; text-decoration: underline; word-break: break-all; }
.qo-fine { font-size: 11px; margin-top: 6px; }
.qo-fuel-dot.qo-fuel-thin { fill: #fff; stroke-width: 2; } .qo-fuel-dot.qo-fuel-thin.qo-fuel-hi { stroke: #b91c1c; } .qo-fuel-dot.qo-fuel-thin.qo-fuel-lo { stroke: #b45309; } .qo-fuel-dot.qo-fuel-thin.qo-fuel-ok { stroke: #15803d; }

/* v4.12 Lean engine */
.qo-lean-n { text-align: right !important; }
.qo-table tr.qo-lean-sub td { font-weight: 800; border-top: 2px solid hsl(var(--border)); }
.qo-lean-s1 { fill: #2a78d6; } .qo-lean-s2 { fill: #eb6834; }
.qo-lean-ref { stroke: #0f172a; stroke-width: 1.5; }
.qo-lean-key { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; margin-top: 6px; color: #334155; }
.qo-lean-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; }
.qo-lean-b1 { background: #2a78d6; } .qo-lean-b2 { background: #eb6834; } .qo-lean-ln { background: #0f172a; width: 2px; height: 14px; border-radius: 0; vertical-align: -3px; }
.qo-lean-age { display: flex; gap: 2px; height: 22px; border-radius: 4px; overflow: hidden; }
.qo-lean-age span { min-width: 3px; }
.qo-lean-a1 { background: #86b6ef; } .qo-lean-a2 { background: #5598e7; } .qo-lean-a3 { background: #2a78d6; } .qo-lean-a4 { background: #1c5cab; } .qo-lean-a5 { background: #0d366b; }
.qo-lean-list { margin: 4px 0; padding-left: 20px; font-size: 13px; } .qo-lean-list li { margin: 4px 0; }
.qo-lean-conf { padding-top: 10px; border-top: 0; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
input.qo-lean-vol { width: 130px; min-height: 38px; border: 1px solid hsl(var(--border)); border-radius: 999px; padding: 0 12px; font-size: 14px; background: hsl(var(--card)); color: inherit; }
.qo-lean-svg { max-width: 560px; }
.qo-lean-w td:first-child, .qo-lean-w th:first-child { white-space: normal; min-width: 132px; max-width: 260px; }
.qo-lean-w td:not(.qo-lean-n) { white-space: normal; }
.qo-lean-w td:not(.qo-lean-n):not(:first-child) { min-width: 120px; }
