/* VSV ShiftTrack - mobile-first stylesheet */
:root {
  --ink: #0f1f2b;
  --ink-2: #183040;
  --primary: #17324a;
  --primary-2: #1c5f94;
  --signal: #f2b705;
  --signal-ink: #251a00;
  --accent: #f2b705;
  --ok: #1e8e5a;
  --err: #c8372d;
  --warn: #9a6700;
  --bg: #edf0f3;
  --card: #ffffff;
  --text: #13222d;
  --muted: #5a6b78;
  --line: #d8dfe5;
  --shiftA: #e07b12;
  --shiftB: #1c8c7a;
  --shiftC: #4a4cb3;
  --shiftG: #5a6b78;
  --radius: 10px;
  --shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(16,32,43,.05);
  --top: 56px;
  --rail: 248px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; font-variant-numeric: tabular-nums;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--primary-2); }
h1 { font-size: 1.4rem; margin: 0; letter-spacing: -.01em; font-weight: 750; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
h3 { margin: 0 0 .4rem; }
code { background: #e2e8f0; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); font-size: .92rem; }
[hidden] { display: none !important; }

/* ---------- App shell: rail + top bar ---------- */
.ico { flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app { flex: 1; display: flex; min-height: 100vh; }
.rail {
  position: fixed; inset: 0 auto 0 0; width: var(--rail); z-index: 50; display: flex; flex-direction: column;
  background: var(--ink); color: #c3d0db; padding: 14px 12px 12px; overflow-y: auto;
  transform: translateX(-102%); transition: transform .2s ease;
}
.rail.open { transform: none; box-shadow: 10px 0 40px rgba(0,0,0,.4); }
.rail-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; text-decoration: none; color: #fff; }
.mark { display: inline-grid; place-items: center; background: var(--signal); color: var(--signal-ink); font-weight: 900; letter-spacing: .5px; border-radius: 8px; padding: 5px 9px; font-size: .95rem; }
.rail-brand .word { display: flex; flex-direction: column; line-height: 1.15; }
.rail-brand strong { font-size: 1.05rem; letter-spacing: -.01em; }
.rail-brand small { color: #7f93a3; font-size: .74rem; }
.rail-nav { flex: 1; }
.rail-sec { margin: 16px 10px 6px; font-size: .74rem; font-weight: 600; color: #6f8596; }
.nav-link { position: relative; display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 8px; color: #c3d0db; text-decoration: none; font-weight: 600; font-size: .95rem; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: rgba(255,255,255,.09); color: #fff; }
.nav-link.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--signal); }
.nav-link.soon { opacity: .42; cursor: default; }
.nav-link.soon:hover { background: none; color: #c3d0db; }
.nav-link em { margin-left: auto; font-style: normal; font-size: .68rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,.12); }
.rail-foot { border-top: 1px solid rgba(255,255,255,.1); padding-top: 10px; margin-top: 10px; }
.rail-user { display: flex; align-items: center; gap: 10px; padding: 8px 8px 2px; }
.rail-user .ru { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; }
.rail-user strong { color: #fff; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-user small { color: #7f93a3; font-size: .75rem; }
.ru-out { color: #9fb1bf; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; }
.ru-out:hover { background: rgba(255,255,255,.08); color: #fff; }
.avatar.sm { width: 36px; height: 36px; font-size: .8rem; background: var(--ink-2); color: var(--signal); }
.scrim { position: fixed; inset: 0; background: rgba(8,16,22,.55); z-index: 45; display: none; }
.scrim.show { display: block; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--top); display: flex; align-items: center; gap: 8px; padding: 0 10px;
  padding-top: env(safe-area-inset-top); background: rgba(255,255,255,.94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); color: var(--text);
}
.topbar .icon-btn { color: var(--text); }
.topbar .icon-btn:active { background: #e6ebef; }
.brand { text-decoration: none; display: flex; align-items: center; }
.top-title { font-weight: 700; font-size: 1.02rem; margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.top-date { color: var(--muted); font-size: .88rem; display: none; }
.now-chip { display: none; align-items: center; gap: 7px; font-size: .84rem; font-weight: 700; padding: 5px 11px; border-radius: 999px; background: #e7f5ee; color: #14633f; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(30,142,90,.5); animation: pulse 2.2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(30,142,90,0); } 100% { box-shadow: 0 0 0 0 rgba(30,142,90,0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.icon-btn { background: transparent; border: 0; color: inherit; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; cursor: pointer; }
.content { padding: 14px; padding-bottom: 24px; max-width: 1280px; margin: 0 auto; width: 100%; flex: 1; }
.content-plain { padding: 14px; max-width: 760px; margin: 0 auto; width: 100%; flex: 1; }
.foot { text-align: center; color: var(--muted); font-size: .78rem; padding: 14px 10px 18px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }

/* ---------- Cards, forms, buttons ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card.narrow, .form.narrow { max-width: 460px; }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 4px; color: #334155; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 12px; font-size: 1rem; font-family: inherit;
  border: 1.5px solid #cbd5e1; border-radius: 10px; background: #fff; color: var(--text);
}
.input:focus { outline: 3px solid #bfdbfe; border-color: var(--primary-2); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; }
.check input { width: 22px; height: 22px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 18px; border-radius: 10px; border: 1.5px solid transparent;
  font: 600 1rem/1 inherit; font-family: inherit; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--signal); color: var(--signal-ink); border-color: #d9a400; }
.btn-primary:hover { background: #ffc61a; }
.btn-primary:active { background: #e0aa00; }
.btn-quiet { background: #fff; color: var(--text); border-color: var(--line); }
.btn-quiet:hover { background: #f3f6f8; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-danger { background: var(--err); color: #fff; }
.btn-light { background: #fff; color: var(--primary); border-color: #c5cfd8; }
.btn-light:hover { background: #f3f6f8; }
.btn-ghost { background: transparent; color: inherit; border-color: rgba(255,255,255,.45); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .88rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 12px; font-weight: 500; }
.alert-ok { background: #dcfce7; color: #14532d; }
.alert-error { background: #fee2e2; color: #7f1d1d; }
.alert-warn { background: #fef3c7; color: #78350f; }
.alert-info { background: #e3edf5; color: #17324a; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: #e2e8f0; color: #334155; }
.badge-ok { background: #dcfce7; color: #14532d; }
.badge-err { background: #fee2e2; color: #7f1d1d; }
.badge-warn { background: #fef3c7; color: #78350f; }
.badge-blue { background: #dfeaf3; color: #17324a; }
.badge-A { background: var(--shiftA); color: #fff; }
.badge-B { background: var(--shiftB); color: #fff; }
.badge-C { background: var(--shiftC); color: #fff; }
.badge-G { background: var(--shiftG); color: #fff; }

/* ---------- Lists / responsive tables ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.toolbar .input { width: auto; min-width: 150px; flex: 1; }
.rtable { width: 100%; border-collapse: collapse; }
.rtable thead { display: none; }
.rtable tr { display: block; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; margin-bottom: 10px; }
.rtable td { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; text-align: right; }
.rtable td::before { content: attr(data-label); font-weight: 600; color: var(--muted); text-align: left; flex: 0 0 38%; }
.rtable td.row-actions { justify-content: flex-start; flex-wrap: wrap; gap: 8px; padding-top: 8px; }
.rtable td.row-actions::before { display: none; }
.rtable tr.inactive { opacity: .6; }

/* ---------- Login ---------- */
.login-page { background: var(--bg); }
.login-shell { flex: 1; display: flex; flex-direction: column; }
.login-brand { display: none; }
.login-main { width: 100%; max-width: 760px; margin: 0 auto; padding: 14px; flex: 1; }
.login-wrap { padding-bottom: 20px; }
.login-head { text-align: left; color: var(--text); padding: 18px 2px 12px; display: flex; flex-direction: column; gap: 2px; }
.login-head h1 { font-size: 1.7rem; }
.login-head p { margin: 2px 0 0; color: var(--muted); }
.logo-mark { align-self: flex-start; display: inline-block; background: var(--signal); color: var(--signal-ink); font-weight: 900; letter-spacing: 1px; padding: 5px 12px; border-radius: 9px; margin-bottom: 8px; }
.search-row { margin: 0 0 8px; }
.section-title { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 2px 8px; }
.name-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.name-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 8px;
  min-height: 118px; cursor: pointer; box-shadow: var(--shadow); font: inherit; color: inherit;
}
.name-card:active { transform: scale(.98); border-color: var(--primary-2); }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: #e3ebf1; color: var(--primary); display: grid; place-items: center; font-weight: 800; }
.avatar-lg { width: 54px; height: 54px; font-size: 1.1rem; }
.name-card .nm { font-weight: 700; line-height: 1.2; }
.name-card .rl { font-size: .75rem; color: var(--muted); }

.sheet-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 60; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; background: #fff;
  border-radius: 20px 20px 0 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  max-width: 460px; margin: 0 auto; box-shadow: 0 -8px 30px rgba(0,0,0,.25);
}
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: #cbd5e1; margin: 0 auto 10px; }
body.sheet-open { overflow: hidden; }
.pin-who { display: flex; align-items: center; gap: 12px; justify-content: center; }
.pin-name { font-weight: 800; font-size: 1.1rem; }
.pin-role { color: var(--muted); font-size: .85rem; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 16px 0 6px; }
.dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--primary); background: #fff; }
.dot.filled { background: var(--primary); }
.shake { animation: shake .35s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }
.pin-msg { min-height: 24px; text-align: center; font-weight: 600; color: var(--muted); font-size: .92rem; margin-bottom: 6px; }
.pin-msg.err { color: var(--err); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.key {
  min-height: 62px; border-radius: 14px; border: 1.5px solid var(--line); background: #f8fafc;
  font-size: 1.6rem; font-weight: 700; color: var(--text); cursor: pointer; font-family: inherit;
}
.key:active { background: #dbeafe; transform: scale(.97); }
.key-alt { font-size: 1rem; color: var(--muted); }

/* ---------- Idle modal ---------- */
.idle-modal { position: fixed; inset: 0; background: rgba(15,23,42,.6); z-index: 100; display: grid; place-items: center; padding: 20px; }
.idle-card { background: #fff; border-radius: 16px; padding: 22px; max-width: 360px; width: 100%; text-align: center; }

/* ---------- Dashboard tiles ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: #fff; border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; }
.tile .n { font-size: 1.8rem; font-weight: 800; color: var(--primary); }
.tile .l { color: var(--muted); font-size: .88rem; }

/* ---------- Pagination ---------- */
.pager { display: flex; gap: 8px; justify-content: center; margin: 12px 0; }

/* ---------- Tablet ---------- */
@media (min-width: 600px) {
  .brand-name { display: inline; }
  .name-grid { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .content, .content-plain { padding: 18px; }
}
@media (min-width: 768px) {
  .rtable { display: table; }
  .rtable thead { display: table-header-group; }
  .rtable tr { display: table-row; background: transparent; box-shadow: none; padding: 0; margin: 0; }
  .rtable th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); }
  .rtable td { display: table-cell; text-align: left; padding: 10px; border-bottom: 1px solid var(--line); }
  .rtable td::before { display: none; }
  .rtable tbody tr:hover { background: #f8fafc; }
  .rtable td.row-actions { white-space: nowrap; }
  .table-wrap { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 10px; overflow-x: auto; }
}
/* ---------- Desktop ---------- */
@media (min-width: 1024px) {
  .menu-btn { display: none; }
  .brand { display: none; }
  .rail { position: sticky; top: 0; height: 100vh; transform: none; flex: 0 0 var(--rail); box-shadow: none; }
  .scrim { display: none !important; }
  .top-date { display: inline; }
  .now-chip { display: inline-flex; }
  .topbar { padding: 0 24px; }
  .content { padding: 22px 28px 28px; }
  .name-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 700px) { .now-chip { display: inline-flex; } }

@media print {
  .topbar, .rail, .foot, .toolbar, .btn, .idle-modal { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ====================== Phase 2: shifts + mapping ====================== */
.badge-lg { font-size: .95rem; padding: 4px 12px; }
.datebar { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 12px; }
.shift-list { display: grid; gap: 12px; }
.shift-card { margin: 0; }
.shift-card.is-now { border: 2px solid var(--ok); }
.shift-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }

.progress-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 14px; margin-bottom: 10px; }
.progress-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.bar { height: 10px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--primary-2); transition: width .25s; }
.bar i.full { background: var(--ok); }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; position: sticky; top: var(--top); z-index: 20; background: var(--bg); }
.tab { flex: 0 0 auto; min-height: 42px; padding: 0 14px; border-radius: 999px; border: 1.5px solid #cbd5e1; background: #fff; font: 600 .95rem inherit; font-family: inherit; color: var(--text); cursor: pointer; }
.tab.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab-n { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #111; font-size: .78rem; text-align: center; margin-left: 4px; }
.tab-n.ok { background: #bbf7d0; color: #14532d; }

.vgroup-title { margin: 6px 2px 8px; color: var(--primary); }
.vgrid { display: grid; gap: 10px; grid-template-columns: 1fr; margin-bottom: 14px; }
.vcard { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; border: 2px solid transparent; }
.vcard.need { border-color: var(--accent); }
.vcard.off { background: #f8fafc; }
.vhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-size: 1.05rem; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 8px; }
.seg-btn { min-height: 42px; border: 1.5px solid #cbd5e1; background: #fff; border-radius: 9px; font: 600 .85rem inherit; font-family: inherit; color: #334155; cursor: pointer; padding: 0 2px; }
.seg-btn.on.seg-RUNNING { background: var(--ok); border-color: var(--ok); color: #fff; }
.seg-btn.on.seg-IDLE { background: #64748b; border-color: #64748b; color: #fff; }
.seg-btn.on.seg-BREAKDOWN { background: var(--err); border-color: var(--err); color: #fff; }
.seg-btn.on.seg-NOT_AVAILABLE { background: #334155; border-color: #334155; color: #fff; }
.seg-btn[disabled] { opacity: .6; }
.seg-lg { margin: 10px 0; }
.driver-btn { width: 100%; min-height: 50px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; text-align: left;
  border: 1.5px dashed #94a3b8; background: #f8fafc; border-radius: 10px; padding: 6px 12px; cursor: pointer; font-family: inherit; color: var(--text); margin-bottom: 8px; }
.driver-btn .dname { font-weight: 700; font-size: 1.02rem; }
.vcard.need .driver-btn { border-color: var(--accent); background: #fffbeb; }
.driver-btn[disabled] { opacity: .8; cursor: default; }
.driver-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.rundriver { margin-bottom: 6px; }
.meterrow { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .92rem; }
.meterrow b { color: var(--text); font-size: 1.05rem; }
.link-btn { background: none; border: 0; color: var(--primary-2); font: 600 .9rem inherit; font-family: inherit; text-decoration: underline; cursor: pointer; min-height: 36px; padding: 0 6px; }
.st-badge.st-RUNNING { background: #dcfce7; color: #14532d; }
.st-badge.st-IDLE { background: #e2e8f0; color: #334155; }
.st-badge.st-BREAKDOWN { background: #fee2e2; color: #7f1d1d; }
.st-badge.st-NOT_AVAILABLE { background: #cbd5e1; color: #1e293b; }
.vcard-run .actions { margin-top: 8px; }
.change-list { list-style: none; padding: 0; margin: 0; }
.change-list li { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.next-steps { border-left: 5px solid var(--ok); }

.page-session .content { padding-bottom: 96px; }
.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; gap: 10px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0,0,0,.08); }
.bottom-bar .btn { flex: 1; }
.bottom-bar #confirmBtn { flex: 1.4; }

.sheet-tall { max-height: 88vh; overflow-y: auto; }
.sheet-title { font-size: 1.1rem; margin: 4px 0 10px; }
.picker-list { max-height: 48vh; overflow-y: auto; margin: 10px 0; border: 1px solid var(--line); border-radius: 10px; }
.picker-sec { position: sticky; top: 0; background: #f1f5f9; padding: 6px 12px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.picker-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; min-height: 52px; padding: 8px 12px; background: #fff; border: 0; border-bottom: 1px solid var(--line);
  text-align: left; font-family: inherit; font-size: 1rem; color: var(--text); cursor: pointer; }
.picker-item:active { background: #dbeafe; }
.picker-item .pn { font-weight: 600; flex: 1 1 auto; }
.picker-item .pg { font-size: .75rem; color: var(--muted); }
.picker-item .pb { font-size: .75rem; font-weight: 700; color: var(--warn); }
.picker-item .pb.ok { color: var(--ok); }
.picker-item.busy { opacity: .5; cursor: not-allowed; }
.picker-item.current { background: #eff6ff; }
.rc { font-size: .72rem; font-weight: 800; padding: 1px 7px; border-radius: 6px; }
.rc-on { background: #dfeaf3; color: #17324a; }
.rc-off { background: #fee2e2; color: #7f1d1d; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { min-height: 38px; padding: 0 12px; border-radius: 999px; border: 1.5px solid #cbd5e1; background: #fff; font: 600 .85rem inherit; font-family: inherit; cursor: pointer; }

@media (min-width: 600px) {
  .vgrid { grid-template-columns: 1fr 1fr; }
  .shift-list { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 768px) {
  .sheet-tall { max-width: 520px; }
  .tabs { position: static; }
}
@media (min-width: 1024px) {
  .vgrid { grid-template-columns: repeat(3, 1fr); }
  .shift-list { grid-template-columns: repeat(3, 1fr); }
  .bottom-bar { left: var(--rail); justify-content: flex-end; }
  .bottom-bar .btn { flex: 0 0 auto; min-width: 220px; }
  .sheet { bottom: auto; top: 50%; transform: translateY(-50%); border-radius: 20px; }
}
.check-row { padding: 6px 0; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: 0; }

/* ---------- Dashboard ---------- */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.head-actions .ico { margin-right: 2px; }
.link { color: var(--primary-2); font-weight: 650; font-size: .9rem; text-decoration: none; white-space: nowrap; }
.link:hover { text-decoration: underline; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-head h2 { margin: 0; font-size: 1.02rem; }

.ribbon-card { background: var(--card); box-shadow: var(--shadow); border-radius: var(--radius); padding: 12px 12px 8px; margin-bottom: 12px; }
.ribbon { position: relative; display: flex; gap: 3px; }
.rib-seg { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 9px 10px; border-radius: 7px; color: #fff; text-decoration: none; overflow: hidden; background: var(--shiftG); }
.rib-seg.sh-A { background: var(--shiftA); } .rib-seg.sh-B { background: var(--shiftB); } .rib-seg.sh-C { background: var(--shiftC); }
.rib-seg:not(.has):not(.rib-now) { opacity: .5; }
.rib-seg.has:hover { filter: brightness(1.08); }
.rib-seg.rib-now { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.rs-code { font-weight: 800; font-size: .95rem; white-space: nowrap; }
.rs-time, .rs-state { font-size: .76rem; opacity: .95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-state { font-weight: 650; }
.rib-needle { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--ink); border-radius: 2px; pointer-events: none; }
.rib-needle::before { content: ""; position: absolute; top: -3px; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--signal); border: 2px solid var(--ink); }
.rib-scale { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); padding: 6px 2px 0; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.kpi { background: var(--card); box-shadow: var(--shadow); border-radius: var(--radius); padding: 12px 14px; border-left: 4px solid var(--primary); }
.kpi.kpi-alert { border-left-color: var(--err); }
.k-l { font-size: .82rem; color: var(--muted); font-weight: 600; }
.k-n { font-size: 2rem; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; }
.k-n small { font-size: 1rem; color: var(--muted); font-weight: 650; margin-left: 4px; }
.k-s { font-size: .78rem; color: var(--muted); }

.dash-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.dash-grid .card { margin-bottom: 0; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 10px; font-size: .82rem; color: var(--muted); }
.lg i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; background: var(--shiftG); }
.lg b { color: var(--text); }
.lg-running i { background: var(--ok); } .lg-idle i { background: #aab6c0; } .lg-breakdown i { background: var(--err); } .lg-not_available i { background: #5a6b78; }
.yard { display: flex; flex-direction: column; gap: 12px; }
.yard-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.yard-group h3 { flex-basis: 100%; margin: 0; font-size: .85rem; color: var(--muted); font-weight: 650; }
.veh { flex: 0 1 112px; min-width: 96px; display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; border: 1.5px solid var(--line); background: #f8fafb; border-left-width: 5px; }
.v-code { font-weight: 800; font-size: .95rem; }
.v-drv { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.veh-running { border-color: #bfe3d0; border-left-color: var(--ok); background: #f0faf5; }
.veh-idle { border-left-color: #aab6c0; }
.veh-breakdown { border-color: #f0c4c0; border-left-color: var(--err); background: #fdf1f0; }
.veh-not_available { border-left-color: #5a6b78; opacity: .7; }

.alert-list, .feed, .bars, .soon-list { list-style: none; margin: 0; padding: 0; }
.alert-list li { display: flex; gap: 9px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.alert-list li:first-child { border-top: 0; padding-top: 0; }
.alert-list li .link { margin-left: auto; }
.al-warn .ico { color: var(--warn); } .al-err .ico { color: var(--err); }
.ok-line { display: flex; gap: 8px; align-items: center; color: #14633f; margin: 0; font-weight: 600; }
.feed li { display: flex; gap: 6px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.feed li:first-child { border-top: 0; padding-top: 0; }
.f-who { font-weight: 700; } .f-what { color: var(--muted); }
.feed time { margin-left: auto; color: var(--muted); font-size: .78rem; white-space: nowrap; }
.bars li { display: grid; grid-template-columns: minmax(90px, 1.2fr) 2fr 28px; gap: 8px; align-items: center; padding: 5px 0; font-size: .88rem; }
.b-t { height: 8px; background: #e6ebef; border-radius: 4px; overflow: hidden; }
.b-t i { display: block; height: 100%; background: var(--primary-2); border-radius: 4px; }
.b-n { text-align: right; font-weight: 700; }
.soon-list li { display: flex; gap: 10px; align-items: center; padding: 7px 0; color: var(--muted); }

@media (max-width: 520px) { .rib-seg { padding: 7px 6px; } .rs-time { display: none; } .rs-code { font-size: .8rem; } }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, 1fr); } .dash-grid { grid-template-columns: repeat(2, 1fr); } .dash-grid .span-2 { grid-column: span 2; } }
@media (min-width: 1100px) { .dash-grid { grid-template-columns: repeat(3, 1fr); } .dash-grid .span-2 { grid-column: span 2; } }

/* ---------- Login split ---------- */
.login-main .login-wrap { max-width: 720px; margin: 0 auto; }
@media (min-width: 900px) {
  .login-shell { flex-direction: row; min-height: 100vh; }
  .login-brand { display: flex; flex-direction: column; justify-content: center; gap: 14px; flex: 0 0 38%; max-width: 480px; padding: 48px; background: var(--ink); color: #c3d0db; }
  .login-brand .mark { align-self: flex-start; font-size: 1.1rem; padding: 7px 13px; }
  .login-brand h1 { color: #fff; font-size: 2.6rem; margin: 0; }
  .login-brand p { font-size: 1.05rem; margin: 0; max-width: 32ch; }
  .login-brand ul { margin: 8px 0; padding-left: 18px; line-height: 1.9; }
  .login-brand small { color: #6f8596; margin-top: auto; }
  .login-main { padding: 40px 48px; max-width: none; margin: 0; overflow-y: auto; }
  .login-head .logo-mark { display: none; }
  .login-main .name-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Phase 3: end of shift ---------- */
.cl-inputs { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; margin-top: 8px; }
.cl-card .field { margin-bottom: 8px; }
.input.bad { border-color: var(--err); background: #fff5f5; }
.calc { display: flex; gap: 18px; margin-top: 4px; font-weight: 700; color: var(--primary); }
.calc span span { font-size: 1.15rem; }
.work-grid { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 600px) { .work-grid { grid-template-columns: repeat(2, 1fr); } .vgrid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .vgrid { grid-template-columns: repeat(3, 1fr); } .work-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Phase 4: roster ---------- */
.rost-wrap { padding: 0; overflow-x: auto; }
.rost { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 0; }
.rost th, .rost td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: center; font-size: .88rem; vertical-align: middle; }
.rost thead th { background: #f4f6f8; position: sticky; top: 0; z-index: 2; font-weight: 700; }
.rost th.today { background: #fff3c4; }
.rost .nm { text-align: left; position: sticky; left: 0; background: #fff; z-index: 1; min-width: 118px; font-weight: 600; white-space: nowrap; border-right: 1px solid var(--line); }
.rost thead .nm { background: #f4f6f8; z-index: 3; }
.rost tr.grp th { background: #e9eef2; font-size: .8rem; }
.rost tr.grp th.nm { background: #e9eef2; color: var(--primary); }
.rost tr.grp-remark td { text-align: left; }
.cnt { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; margin: 1px; }
.cnt.okc { background: #dcfce7; color: #14532d; }
.cnt.short { background: #fee2e2; color: #7f1d1d; }
.rsel { width: 100%; min-width: 64px; min-height: 38px; border: 1.5px solid #cbd5e1; border-radius: 8px; font: 700 .9rem inherit; font-family: inherit; background: #fff; color: var(--text); text-align: center; }
.rnote { width: 100%; min-height: 28px; margin-top: 3px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: .78rem; text-align: center; }
.rc-A .rsel, td.rc-A .rcode { background: #fde8d1; } .rc-B .rsel, td.rc-B .rcode { background: #d5f0eb; }
.rc-C .rsel, td.rc-C .rcode { background: #dedffa; } .rc-G .rsel, td.rc-G .rcode { background: #e3e8ec; }
.rc-OFF .rsel { background: #f1f5f9; color: #64748b; } .rc-LEAVE .rsel { background: #fef3c7; } .rc-SUSP .rsel { background: #fee2e2; color: #7f1d1d; }
.rc-AB .rsel, .rc-AC .rsel, .rc-BC .rsel { background: #ede9fe; }
td.saving .rsel { opacity: .5; }
.rost-legend { margin-top: 10px; }
.day-tabs { display: flex; }
@media (max-width: 767px) {
  .rost th[data-d], .rost td[data-d] { display: none; }
  .rost[data-day="0"] [data-d="0"], .rost[data-day="1"] [data-d="1"], .rost[data-day="2"] [data-d="2"], .rost[data-day="3"] [data-d="3"],
  .rost[data-day="4"] [data-d="4"], .rost[data-day="5"] [data-d="5"], .rost[data-day="6"] [data-d="6"] { display: table-cell; }
  .rost tr.grp-remark td[colspan] { display: table-cell; }
  .rost .nm { min-width: 0; width: 40%; }
}
@media (min-width: 768px) { .day-tabs { display: none; } .rost { min-width: 760px; } }

/* ---------- Phase 6: daily work ---------- */
.dm-list { display: grid; gap: 10px; margin-bottom: 12px; }
.dm-task { margin: 0; padding: 12px; }
.dm-task.is-done { background: #f3fbf6; }
.dm-row { display: flex; gap: 12px; align-items: flex-start; }
.dm-check { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 12px; border: 2px solid #b6c2cc; background: #fff; color: transparent; display: grid; place-items: center; cursor: pointer; }
.dm-check[aria-pressed="true"], .dm-check.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.dm-text { flex: 1; min-width: 0; }
.dm-meta { font-size: .82rem; margin-top: 2px; }
.dm-remark { margin-top: 8px; min-height: 40px; }
.team-row { display: grid; grid-template-columns: minmax(140px, 1.6fr) 2fr 48px; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.team-row:first-of-type { border-top: 0; }
.team-row b { text-align: right; }

/* ---------- Phase 5: reports ---------- */
.report-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.report-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; margin: 0; }
.report-card:hover { box-shadow: 0 0 0 2px var(--primary-2); }
.report-card .ico { color: var(--primary-2); }
.report-card-main { border-left: 5px solid var(--signal); }
@media (min-width: 700px) { .report-grid { grid-template-columns: repeat(2, 1fr); } .report-card-main { grid-column: span 2; } }
@media (min-width: 1100px) { .report-grid { grid-template-columns: repeat(3, 1fr); } .report-card-main { grid-column: span 3; } }
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.presets .tab { text-decoration: none; display: inline-flex; align-items: center; }
.filter-bar { align-items: flex-end; }
.filter-bar .field { margin: 0; flex: 1; min-width: 140px; }
.rtable tfoot tr.totals td { font-weight: 700; background: #f4f6f8; }

.paper { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.paper-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.paper-date { text-align: right; }
.paper-scroll { overflow-x: auto; }
.rpt { border-collapse: collapse; width: 100%; font-size: .78rem; }
.rpt th, .rpt td { border: 1px solid #b8c3cc; padding: 3px 4px; text-align: center; white-space: nowrap; }
.rpt th { background: #eef2f5; font-weight: 700; }
.rpt .v { text-align: left; font-weight: 600; }
.rpt .n { text-align: right; font-variant-numeric: tabular-nums; }
.rpt .rm { text-align: left; white-space: normal; min-width: 80px; font-size: .78rem; }
.rpt tr.gh td { background: #dfe7ed; font-weight: 800; text-align: left; color: var(--primary); }
.rpt tr.gt td { background: #f4f6f8; font-weight: 700; }
.rpt th.sh-A { background: #fde8d1; } .rpt th.sh-B { background: #d5f0eb; } .rpt th.sh-C { background: #dedffa; }
.rpt td.dr { color: #7b8794; font-style: italic; }
.rpt td.st { color: var(--err); font-weight: 600; font-size: .76rem; }
.rpt td.st-IDLE, .rpt td.st-NOT_AVAILABLE { color: #64748b; }
.draft { font-style: normal; font-size: .66rem; background: #fef3c7; color: #78350f; padding: 1px 6px; border-radius: 999px; margin-left: 4px; }
.paper-cols { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 16px; }
.paper-cols h3 { margin: 10px 0 4px; font-size: .95rem; }
.rpt-sm { max-width: 520px; }
.paper-foot { margin-top: 14px; display: grid; gap: 4px; font-size: .85rem; border-top: 1px solid var(--line); padding-top: 10px; }
.paper-credit { color: var(--muted); font-size: .75rem; }
@media (min-width: 900px) { .paper-cols { grid-template-columns: 1.2fr 1fr; } }
@media print {
  @page { size: A4 landscape; margin: 8mm; }
  .noprint, .presets, .filter-bar, .bottom-bar { display: none !important; }
  .main, .content { display: block; padding: 0 !important; }
  .paper { box-shadow: none; padding: 0; }
  .paper-scroll { overflow: visible; }
  .rpt { font-size: 8.5pt; } .rpt th, .rpt td { padding: 1px 4px; }
  .paper-cols { grid-template-columns: 1.2fr 1fr; break-inside: avoid; }
  .page-report .topbar { display: none; }
  .table-wrap { box-shadow: none; }
}

/* ---------- Diesel history ---------- */
.hist-box { background: #f4f7f9; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 12px; font-size: .85rem; }
.hist-title { font-weight: 700; margin-bottom: 4px; }
.hist-table { width: 100%; border-collapse: collapse; margin-bottom: 4px; }
.hist-table th, .hist-table td { text-align: left; padding: 3px 6px 3px 0; font-weight: 500; }
.hist-table th { color: var(--muted); font-size: .75rem; }

/* ---------- DM sheets (same as the Excel plan) ---------- */
.sheet-tabs .tab { text-decoration: none; display: inline-flex; align-items: center; }
.people-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1.5px solid #cbd5e1; background: #fff; font-size: .88rem; font-weight: 600; text-decoration: none; color: var(--text); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.dmt { width: 100%; border-collapse: collapse; }
.dmt th { text-align: left; font-size: .8rem; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); }
.dmt td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dmt tr.is-done td { background: #f3fbf6; }
.dmt .dm-c { width: 64px; text-align: center; }
.dm-rem { min-width: 180px; }
.dm-rem .input { min-height: 40px; }
.month-sheet th, .month-sheet td { padding: 2px 5px; min-width: 24px; }
.month-sheet td.v { min-width: 240px; white-space: normal; }
.mc.ok { background: #dcfce7; color: #14532d; font-weight: 700; } .mc.late { background: #fee2e2; color: #7f1d1d; font-weight: 700; }
@media (max-width: 600px) { .dm-rem { min-width: 0; } .dmt th:nth-child(3) { display: none; } .dmt td { display: block; border: 0; } .dmt tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; } .dmt .dm-c { text-align: left; width: auto; display: inline-block; vertical-align: top; } .dmt td:nth-child(2) { display: inline-block; width: calc(100% - 70px); } }

/* ---------- Ops: tasks, issues, alerts, live, charts ---------- */
.badge-info { background: #dbeafe; color: #1e3a8a; } .badge-muted { background: #e2e8f0; color: #334155; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0 0 8px; } .kv dt { color: var(--muted); font-size: .88rem; } .kv dd { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); } .timeline li { padding: 6px 0 8px 12px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; } .filters .field { margin: 0; } .filters .input { min-width: 140px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; } .btn-row .input { flex: 1; min-width: 180px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; color: inherit; border-radius: 50%; }
.bell b { position: absolute; top: 2px; right: 0; background: #dc2626; color: #fff; font-size: .68rem; min-width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 9px; padding: 0 4px; }
.alert-row { margin: 0; border-bottom: 1px solid var(--line); } .alert-row.unread { background: #fffbeb; }
.alert-btn { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 12px 8px; font: inherit; color: inherit; cursor: pointer; min-height: 48px; }
.alert-btn small { display: block; margin-top: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 12px; font-size: .85rem; color: var(--muted); }
.live-grid { display: grid; grid-template-columns: 1fr; gap: 12px; } @media (min-width: 900px) { .live-grid { grid-template-columns: 1fr 1fr; } }
.live-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; } .live-stat { background: #f1f5f9; border-radius: 10px; padding: 8px 10px; }
.live-stat strong { display: block; font-size: 1.15rem; } .live-stat.bad { background: #fee2e2; color: #7f1d1d; } .live-line { margin: 8px 0; } .live-warn { color: #b91c1c; font-weight: 700; }
.live-veh { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; } .veh-pill { font-size: .8rem; padding: 4px 9px; border-radius: 999px; background: #e2e8f0; }
.veh-pill.v-running { background: #dcfce7; color: #14532d; } .veh-pill.v-breakdown { background: #fee2e2; color: #7f1d1d; } .veh-pill.v-idle { background: #fef3c7; color: #78350f; }
.chart-grid { display: grid; grid-template-columns: 1fr; gap: 12px; } @media (min-width: 1000px) { .chart-grid { grid-template-columns: 1fr 1fr; } }
.chart { width: 100%; height: auto; display: block; } .chart .grid { stroke: #e2e8f0; stroke-width: 1; } .chart .axis { fill: #64748b; font-size: 11px; }
.cs0 { fill: #0f1f2b; background: #0f1f2b; } .cs1 { fill: #f2b705; background: #f2b705; } .cs2 { fill: #dc2626; background: #dc2626; } .cs3 { fill: #94a3b8; background: #94a3b8; } .cs4 { fill: #2563eb; background: #2563eb; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .82rem; margin-bottom: 4px; } .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.chart-data summary { cursor: pointer; font-size: .85rem; color: var(--muted); margin-top: 6px; }
.hbars { display: grid; gap: 8px; } .hb { display: grid; grid-template-columns: 110px 1fr 56px; gap: 8px; align-items: center; font-size: .9rem; } .hb-t { background: #e2e8f0; border-radius: 6px; height: 14px; overflow: hidden; } .hb-t i { display: block; height: 100%; } .hb b { text-align: right; }
.kpi small { display: block; color: var(--muted); font-size: .75rem; }
.dm-sheet { overflow-x: auto; }
.cs5 { fill: #16a34a; background: #16a34a; }
.handover{border-left:4px solid var(--brand,#F2B705);background:#FFFBEA}
.timeline .cmt{background:#F6F7F8;padding:4px 8px;border-radius:6px}

/* Phone layout fixes: wide tables scroll inside their box instead of the whole page */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.paper-cols > div { min-width: 0; overflow-x: auto; }
@media (max-width: 767px) {
  .rtable, .rtable tbody { display: block; width: 100%; }
  .rtable td { min-width: 0; }
  .rtable td > *:not(.btn):not(a) { min-width: 0; overflow-wrap: break-word; text-align: right; }
  .rtable td .muted { white-space: nowrap; }
  .rtable td[data-label="Details"] > * { overflow-wrap: anywhere; }
}
.dm-card summary{cursor:pointer;display:flex;flex-wrap:wrap;gap:8px;align-items:center}.dm-card{margin-bottom:10px}

/* ===== Simple shift flow: vehicle card rows, End Trip grid, fleet tables (mobile first, tablet, PC) ===== */
.seg { grid-template-columns: repeat(3, 1fr); }
.vnote { margin: 0 0 8px; padding: 6px 10px; background: #f1f5f9; border-radius: 8px; font-size: .9rem; color: var(--text); }
.vcard.off .vnote { background: #fff1f0; }
.vrow { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.vrow .vlabel, .vsel .vlabel { font-size: .75rem; color: var(--muted); font-weight: 700; min-width: 74px; }
.vrow .driver-btn { flex: 1 1 180px; width: auto; margin-bottom: 0; min-height: 44px; }
.driver-btn-2 { border-style: solid; background: #fff; }
.locs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 1 1 180px; }
.chip-loc { display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 0 4px 0 12px; background: #dfeaf3; border: 0; color: #17324a; cursor: default; font-weight: 600; font-size: .85rem; border-radius: 999px; }
.chip-x { border: 0; background: none; font-size: 1.2rem; line-height: 1; min-width: 32px; min-height: 32px; cursor: pointer; color: #475569; border-radius: 50%; }
.chip-x:hover { background: rgba(0,0,0,.08); }
.input-sm { min-height: 40px; padding: 4px 10px; font-size: .95rem; }
.vrow-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.vsel { display: flex; flex-direction: column; gap: 3px; }
.vsel .vlabel { min-width: 0; }
.open-in { max-width: 140px; }
.vmiss { margin: 6px 0 0; font-size: .85rem; font-weight: 600; color: var(--warn); }
.vcard.need { border-color: var(--accent); }
.meterrow em { font-style: normal; font-size: .75rem; }
.stat-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.stat { background: #fff; box-shadow: var(--shadow); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; }
.stat b { font-size: 1.5rem; color: var(--primary); }
.stat span { font-size: .8rem; color: var(--muted); }
.cols-2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
.txt-bad { color: var(--err); font-weight: 700; }
.txt-warn { color: var(--warn); font-weight: 700; }
.maint-card p { margin: 6px 0; }
.grid-note { margin: -4px 2px 14px; font-size: .85rem; }

/* tables: stacked "label : value" rows on phones, real grid from tablet up */
.gridwrap { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; margin-bottom: 14px; }
.gtable { width: 100%; border-collapse: collapse; font-size: .92rem; }
.gtable th, .gtable td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.gtable thead th { background: #f1f5f9; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); position: sticky; top: 0; }
.gtable .g-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gtable .g-in { width: 92px; }
.gtable .g-in .input { text-align: right; padding: 4px 8px; }
.gtable .g-veh { font-weight: 700; white-space: nowrap; }
.gtable .g-rem { min-width: 160px; }
.gtable .input.bad { border-color: var(--err); background: #fff1f0; }
.gtable tbody tr:focus-within { background: #fffbeb; }
@media (max-width: 767px) {
  .gtable thead { position: absolute; left: -9999px; }
  .gtable, .gtable tbody, .gtable tr, .gtable td, .gtable th { display: block; width: 100%; }
  .gtable tr { padding: 8px 12px; border-bottom: 6px solid var(--bg); }
  .gtable th.g-veh { border: 0; padding: 4px 0; font-size: 1.05rem; }
  .gtable td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: right; }
  .gtable td::before { content: attr(data-label); font-size: .78rem; font-weight: 700; color: var(--muted); text-align: left; }
  .gtable .g-in { width: 100%; }
  .gtable .g-in .input { width: 110px; }
  .gtable .g-rem { min-width: 0; }
  .gtable .g-rem .input { flex: 1; text-align: left; max-width: 220px; }
}
@media (min-width: 600px) { .stat-row { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 768px) {
  .cols-2 { grid-template-columns: 1fr 1fr; }
  .vgrid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1100px) { .vgrid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1500px) { .vgrid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 400px) { .vrow-two { grid-template-columns: 1fr; } .seg-btn { font-size: .8rem; } }

/* ===== Compact professional pass: smaller boxes, tighter spacing, quieter chrome ===== */
:root { --radius: 8px; --shadow: 0 0 0 1px var(--line), 0 1px 1px rgba(16,32,43,.04); }
body { font-size: 15px; }
h1 { font-size: 1.25rem; }
h2 { font-size: 1rem; margin-bottom: .4rem; }
.content { padding: 12px 14px 20px; }
.page-head { margin-bottom: 10px; }
.page-head .muted { font-size: .85rem; }
.card { padding: 12px; margin-bottom: 10px; }
.btn { min-height: 40px; padding: 0 14px; font-size: .92rem; border-radius: 8px; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: .84rem; }
.input, select.input, textarea.input { min-height: 40px; font-size: .95rem; border-radius: 8px; }
.input-sm { min-height: 34px !important; padding: 3px 8px; font-size: .9rem; }
.field { margin-bottom: 9px; }
.badge { padding: 1px 8px; font-size: .72rem; }
.nav-link { padding: 8px 12px; font-size: .9rem; }

/* sign in */
.login-head h1 { font-size: 1.45rem; }
.login-head { padding: 12px 2px 8px; }
.section-title { margin: 12px 2px 6px; font-size: .75rem; }
.name-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
.name-card { flex-direction: row; justify-content: flex-start; text-align: left; gap: 10px; padding: 8px 10px; min-height: 56px; border-radius: 10px; border-width: 1px; }
.name-card .avatar { width: 36px; height: 36px; font-size: .78rem; flex: 0 0 36px; }
.name-card .nm { font-size: .88rem; }
.name-card > .nm, .name-card > .rl { display: block; }
.name-card:hover { border-color: var(--primary-2); background: #f8fbfd; }
@media (min-width: 900px) { .name-grid { grid-template-columns: repeat(3, 1fr); } .login-main { max-width: 820px; } }

/* dashboard */
.kpis { gap: 8px; margin-bottom: 10px; }
.kpi { padding: 9px 12px; }
.k-n { font-size: 1.5rem; }
.k-l { font-size: .78rem; }
.dash-grid { gap: 10px; }

/* vehicle cards */
.vgrid { gap: 8px; margin-bottom: 10px; }
.vcard { padding: 9px 10px; border-width: 1.5px; }
.vhead { margin-bottom: 6px; font-size: .98rem; gap: 6px; }
.seg { gap: 3px; margin-bottom: 6px; }
.seg-btn { min-height: 34px; font-size: .8rem; border-radius: 7px; }
.vnote { padding: 4px 8px; font-size: .82rem; margin-bottom: 6px; }
.vrow { gap: 8px; margin-bottom: 6px; }
.vrow .vlabel, .vsel .vlabel { font-size: .7rem; min-width: 64px; }
.vrow .driver-btn { min-height: 36px; padding: 3px 10px; border-radius: 8px; flex-basis: 150px; }
.driver-btn .dname { font-size: .92rem; }
.chip-loc { min-height: 28px; font-size: .8rem; padding-left: 10px; }
.chip-x { min-width: 26px; min-height: 26px; font-size: 1.05rem; }
.vrow-two { gap: 8px; }
.open-in { max-width: 110px; }
.vmiss { margin-top: 3px; font-size: .78rem; }
.meterrow { font-size: .85rem; }
.vgroup-title { font-size: .95rem; margin: 4px 2px 6px; }
.tabs .tab, .tab { min-height: 34px; padding: 0 12px; font-size: .85rem; }
.progress-card { padding: 9px 12px; margin-bottom: 8px; }
.picker-item { min-height: 44px; padding: 6px 12px; font-size: .95rem; }
.shift-card { padding: 11px 12px; }

/* tables and stats */
.gtable { font-size: .86rem; }
.gtable th, .gtable td { padding: 6px 9px; }
.gtable .g-in .input { min-height: 32px !important; }
.stat { padding: 9px 12px; }
.stat b { font-size: 1.25rem; }
.bottom-bar { padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
.bottom-bar .btn { min-height: 42px; }
@media (min-width: 1100px) { .vgrid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1600px) { .vgrid { grid-template-columns: repeat(5, 1fr); } }
select.input.input-sm, .vcard select.input { min-height: 32px !important; height: 32px; padding: 2px 6px; font-size: .86rem; }
.vcard input.input-sm { min-height: 32px !important; height: 32px; }
@media (max-width: 400px) { .vrow-two { grid-template-columns: 1fr 1fr; } }
.name-card { display: grid; grid-template-columns: 36px 1fr; grid-template-rows: auto auto; column-gap: 10px; row-gap: 0; align-content: center; }
.name-card .avatar { grid-row: 1 / span 2; align-self: center; }
.name-card .nm { align-self: end; }
.name-card .rl { align-self: start; }

/* ===== Easy-to-use pass: step guide, clear colours, comfortable touch size on phones ===== */
.steps { list-style: none; margin: 0 0 8px; padding: 8px 12px; background: #fff8e1; border: 1px solid #f2d27a; border-radius: 8px; display: grid; gap: 4px; font-size: .88rem; }
.steps b { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--signal); color: var(--signal-ink); font-size: .75rem; margin-right: 6px; }
.seg-btn.seg-RUNNING { border-color: #86d3ad; color: #14532d; background: #f0fbf5; }
.seg-btn.seg-BREAKDOWN { border-color: #f1a9a4; color: #7f1d1d; background: #fff5f4; }
.seg-btn.on.seg-RUNNING { background: var(--ok); color: #fff; }
.seg-btn.on.seg-BREAKDOWN { background: var(--err); color: #fff; }
.vcard[data-status="RUNNING"] { border-left: 5px solid var(--ok); }
.vcard[data-status="BREAKDOWN"] { border-left: 5px solid var(--err); }
.vcard[data-status="IDLE"] { border-left: 5px solid #94a3b8; }
.vmiss { background: #fef3c7; padding: 3px 8px; border-radius: 6px; }
.vcard.need { background: #fffdf5; }
@media (max-width: 767px) {
  .seg-btn { min-height: 42px; font-size: .86rem; }
  select.input.input-sm, .vcard select.input, .vcard input.input-sm { min-height: 40px !important; height: 40px; font-size: .95rem; }
  .vrow .driver-btn { min-height: 44px; }
  .chip-x { min-width: 34px; min-height: 34px; }
  .btn { min-height: 44px; }
}

/* alerts + alignment polish */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.card-head h2 { margin: 0; }
.alerts-card .alert-list li { align-items: center; padding: 7px 0; }
.al-dot { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%; background: #94a3b8; }
.al-bad .al-dot { background: var(--err); } .al-warn .al-dot { background: var(--signal); } .al-info .al-dot { background: var(--primary-2); }
.alert-list li .link { margin-left: auto; white-space: nowrap; font-weight: 700; font-size: .85rem; }
.page-head { align-items: flex-start; }
.page-head > div:first-child { min-width: 0; }
.page-head h1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; line-height: 1.25; }
.page-head .actions, .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.shift-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.toolbar { align-items: center; }
.toolbar .input, .toolbar .btn { margin: 0; }
.gtable th, .gtable td { vertical-align: middle; }
.gtable .g-num, .gtable th.g-num { text-align: right; }
@media (max-width: 767px) { .page-head .actions, .page-head > .btn { width: 100%; } .page-head .actions .btn { flex: 1; } }
.shift-card { display: flex; flex-direction: column; gap: 6px; margin-bottom: 0; }
.shift-card p { margin: 0; }
.shift-card .actions { margin-top: auto; padding-top: 6px; }
.shift-list { align-items: stretch; }
.datebar { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 10px; }
.alerts-card { border-left: 4px solid var(--primary-2); }

/* ===== Paper-flow pass: 5 statuses, loading check, Control Room ===== */
.seg { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 560px) { .seg { grid-template-columns: repeat(5, 1fr); } }
.seg-btn.seg-MAINTENANCE { border-color: #e8c66a; color: #78350f; background: #fffbeb; }
.seg-btn.seg-OUTSIDE { border-color: #a9b8d6; color: #1e3a5f; background: #f1f5fb; }
.seg-btn.seg-IDLE { border-color: #cbd5e1; color: #334155; }
.seg-btn.on.seg-MAINTENANCE { background: #b45309; border-color: #b45309; color: #fff; }
.seg-btn.on.seg-OUTSIDE { background: #475f8a; border-color: #475f8a; color: #fff; }
.st-badge.st-MAINTENANCE { background: #fef3c7; color: #78350f; }
.st-badge.st-OUTSIDE { background: #dfe7f3; color: #1e3a5f; }
.vcard[data-status="MAINTENANCE"] { border-left: 5px solid #b45309; }
.vcard[data-status="OUTSIDE"] { border-left: 5px solid #475f8a; }
.rpt td.st-MAINTENANCE { color: #b45309; font-weight: 600; } .rpt td.st-OUTSIDE { color: #475f8a; }
.rpt td.st-BREAKDOWN { color: var(--err); font-weight: 600; }
.rpt td.bad, .rpt-sm td.bad { color: var(--err); font-weight: 800; }
.wc-line { margin: 8px 0 0; color: var(--err); font-size: .88rem; font-weight: 600; }

/* loading / unloading must equal Magnet trips */
.wcheck { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; padding: 9px 12px; border-radius: 8px; font-size: .92rem; border: 1px solid var(--line); }
.wcheck b { font-size: 1.05rem; margin-left: 4px; }
.wcheck .wc-state { margin-left: auto; font-weight: 800; }
.wcheck.wc-ok { background: #effaf4; border-color: #bfe5d0; color: #14532d; }
.wcheck.wc-bad { background: #fff4f2; border-color: #f3b9b2; color: #7f1d1d; }

/* Control Room */
.cr-date { margin: -4px 0 8px; font-size: .9rem; }
.cr-h { font-size: 1rem; margin: 14px 0 6px; }
.cr-kpis { grid-template-columns: repeat(2, 1fr); }
.cr-kpis .kpi-warn { border-left-color: var(--signal); }
.cr-kpis .k-n { font-size: 1.7rem; }
@media (min-width: 700px) { .cr-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .cr-kpis { grid-template-columns: repeat(6, 1fr); } }
.cr-shifts { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 10px; }
@media (min-width: 900px) { .cr-shifts { grid-template-columns: repeat(3, 1fr); } }
.cr-shift { margin: 0; display: flex; flex-direction: column; border-top: 4px solid var(--shiftG); }
.cr-shift.sh-A { border-top-color: var(--shiftA); } .cr-shift.sh-B { border-top-color: var(--shiftB); } .cr-shift.sh-C { border-top-color: var(--shiftC); }
.cr-shift .card-head h3 { margin: 0; font-size: .95rem; }
.cr-sup { margin: 0 0 8px; font-size: .88rem; color: var(--muted); }
.cr-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.cr-stats div { background: #f4f7fa; border-radius: 8px; padding: 6px 4px; text-align: center; min-width: 0; }
.cr-stats b { display: block; font-size: 1.05rem; line-height: 1.2; }
.cr-stats span { display: block; font-size: .66rem; color: var(--muted); line-height: 1.15; }
.cr-mix { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.cr-line { margin: 6px 0 0; font-size: .86rem; }
.bad-line { color: var(--err); font-weight: 600; } .bad-text { color: var(--err); font-weight: 700; }
.cr-open { margin-top: auto; align-self: flex-start; }
.cr-shift .cr-line + .cr-open, .cr-shift .cr-mix + .cr-open { margin-top: 10px; }
.cr-two { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 10px; }
.cr-two > .card { margin: 0; min-width: 0; }
@media (min-width: 1000px) { .cr-two { grid-template-columns: 1fr 1fr; } }
.cr-man td, .cr-man th { white-space: nowrap; }
.cell-short { background: #fff1f0; color: var(--err); font-weight: 800; }
.cr-note { font-size: .78rem; margin: 6px 0 0; }
.cr-sub { font-size: .8rem; margin: 8px 0 4px; color: var(--muted); font-weight: 700; }
.cr-legend { display: flex; flex-wrap: wrap; gap: 4px; }
.cr-fleet .cr-gh td { background: #f1f5f9; font-weight: 800; font-size: .8rem; letter-spacing: .03em; padding: 6px 10px; }
.cr-fleet td small { font-size: .72rem; }
.useb { display: inline-block; width: 46px; height: 7px; background: #e6ebf0; border-radius: 4px; vertical-align: middle; overflow: hidden; }
.useb i { display: block; height: 100%; background: var(--primary-2); }
@media (max-width: 767px) {
  .cr-fleet .cr-gh { padding: 0; border: 0; } .cr-fleet .cr-gh td { display: block; }
  .cr-man td, .cr-man th { white-space: normal; }
  .cr-stats b { font-size: .98rem; }
}
.kpi-warn { border-left-color: var(--signal); }

/* Touch devices: comfortable tap size for status buttons */
@media (pointer: coarse) { .seg-btn { min-height: 44px; } .vc select, .vc input { min-height: 40px; } }

/* ---------- Page guide ---------- */
.guide-btn { display: inline-flex; align-items: center; gap: 5px; }
.guide-btn svg { flex: none; }
.guide-scrim { position: fixed; inset: 0; background: rgba(15,31,43,.45); z-index: 80; }
.guide-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: #fff; z-index: 81; box-shadow: -8px 0 30px rgba(15,31,43,.25); display: flex; flex-direction: column; outline: none; }
.guide-panel[hidden], .guide-scrim[hidden] { display: none; }
.guide-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.guide-head small { color: #64748b; font-size: .75rem; }
.guide-head h2 { margin: 2px 0 0; font-size: 1.12rem; line-height: 1.25; }
.guide-head .icon-btn { font-size: 1.6rem; line-height: 1; min-width: 40px; min-height: 40px; }
.guide-body { overflow-y: auto; padding: 14px 16px 28px; -webkit-overflow-scrolling: touch; }
.guide-body h3 { margin: 18px 0 8px; font-size: .95rem; color: var(--primary); }
.guide-about { margin: 0; line-height: 1.5; }
.guide-steps { margin: 0; padding-left: 22px; line-height: 1.5; }
.guide-steps li { margin-bottom: 6px; }
.guide-fields { margin: 0; }
.guide-fields dt { font-weight: 700; margin-top: 10px; font-size: .9rem; }
.guide-fields dd { margin: 2px 0 0; color: #475569; line-height: 1.45; font-size: .9rem; }
.guide-tips { margin: 0; padding-left: 20px; line-height: 1.5; color: #475569; }
body.guide-open { overflow: hidden; }
@media (max-width: 520px) { .guide-btn span { display: none; } .guide-btn { padding: 0 10px; } }
@media print { .guide-btn, .guide-panel, .guide-scrim { display: none !important; } }

/* ---- Version 7: supervisor card (no horizontal scroll) ---- */
.vgrid > * { min-width: 0; }
.vgrid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.vcard { overflow: hidden; word-break: break-word; }
.vcard .seg { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.vcard .seg-btn { font-size: .8rem; line-height: 1.15; padding: 4px 2px; }
.vrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; min-width: 0; }
.vrow .vlabel { flex: 0 0 100%; font-size: .74rem; color: #64748b; font-weight: 600; }
.vrow .driver-btn, .vrow select.input, .vrow .open-in { flex: 1 1 140px; min-width: 0; max-width: 100%; }
.vrow .hrs { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.hrs-in { width: 64px; text-align: center; }
.hrs-t { font-size: .85rem; }
.req { color: var(--err); }
.chip-att { border: 1.5px solid #cbd5e1; background: #f8fafc; border-radius: 999px; padding: 6px 12px; font: 600 .85rem inherit; font-family: inherit; cursor: pointer; }
.vcard.locked { background: #fef2f2; border-color: var(--err); }
.lock-box { background: #b91c1c; color: #fff; border-radius: 10px; padding: 12px; margin-top: 8px; }
.lock-box strong { display: block; font-size: 1rem; }
.lock-box p { margin: 4px 0; }
.lock-box small { display: block; opacity: .85; margin-bottom: 8px; }
.reason-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.reason-chips .chip { border: 1.5px solid #cbd5e1; background: #fff; border-radius: 999px; padding: 8px 12px; font: 600 .85rem inherit; font-family: inherit; cursor: pointer; }
.reason-chips .chip.on { background: var(--primary, #1d4ed8); border-color: var(--primary, #1d4ed8); color: #fff; }
body.page-session { overflow-x: hidden; }
.vgrid { align-items: start; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chips .chip { border: 1.5px solid #cbd5e1; background: #fff; border-radius: 999px; padding: 9px 14px; min-height: 40px; font: 600 .88rem inherit; font-family: inherit; color: #334155; cursor: pointer; }
.chips .chip.on { background: #1e3a5f; border-color: #1e3a5f; color: #fff; }
.reason-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.reason-chip { border: 1.5px solid #cbd5e1; background: #fff; border-radius: 999px; padding: 9px 14px; min-height: 40px; font: 600 .88rem inherit; font-family: inherit; color: #334155; cursor: pointer; }
.reason-chip.on { background: #1e3a5f; border-color: #1e3a5f; color: #fff; }

/* ---- Daily updates checklist ---- */
.cl-list { display: grid; gap: 10px; margin-bottom: 24px; }
.cl-item { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; display: grid; gap: 8px; border-left: 5px solid #cbd5e1; }
.cl-item.done { border-left-color: var(--ok); }
.cl-tick { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; cursor: pointer; }
.cl-tick input { width: 24px; height: 24px; flex: 0 0 24px; margin-top: 1px; }
.cl-item .badge { justify-self: start; }
.cl-remark { width: 100%; }
@media (min-width: 900px) { .cl-item { grid-template-columns: minmax(0, 1.2fr) auto minmax(0, 1fr); align-items: center; } .cl-item .badge { justify-self: end; } }
.cl-link { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 14px; margin-bottom: 12px; text-decoration: none; color: inherit; }
.cl-link .muted { flex: 1 1 200px; }
.cl-rev-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.cl-rev-actions .input { flex: 1 1 200px; min-width: 0; }

.sheet { max-height: 92vh; overflow-y: auto; }
.sheet-close { position: absolute; top: 8px; right: 10px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #f1f5f9; color: #334155; font: 400 26px/1 inherit; font-family: inherit; cursor: pointer; z-index: 2; }
.sheet-close:hover { background: #e2e8f0; }
.sheet-title { padding-right: 44px; }

/* ---- Tablet: bigger boxes and touch targets ---- */
@media (min-width: 700px) {
  .vgrid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
  .vcard { padding: 16px; }
  .vcard .seg-btn { min-height: 52px; font-size: .95rem; }
  .vcard .driver-btn { min-height: 56px; }
  .vcard .input, .vcard select.input { min-height: 48px; font-size: 1rem; }
  .vrow { margin-top: 12px; }
  .vrow .vlabel { font-size: .8rem; }
  .hrs-in { width: 76px; }
  .cl-tick input { width: 28px; height: 28px; flex-basis: 28px; }
  .sheet { max-width: 560px; padding: 14px 22px calc(20px + env(safe-area-inset-bottom)); }
  .reason-chip { min-height: 48px; font-size: 1rem; }
  .sheet .btn { min-height: 52px; }
}

/* ---- v7c: 4 boxes per row on wide screens, compact boxes ---- */
@media (min-width: 700px) {
  .vgrid { grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 12px; }
  .vcard { padding: 12px; container-type: inline-size; }
  .vcard .seg-btn { min-height: 46px; font-size: .88rem; }
  .vcard .driver-btn { min-height: 48px; margin-bottom: 0; }
  .vcard .driver-btn .dname { font-size: .95rem; }
  .vcard .input, .vcard select.input { min-height: 44px; font-size: .95rem; }
  .vrow { margin-top: 8px; gap: 4px 8px; }
  .vrow .vlabel { font-size: .74rem; }
}
@container (max-width: 300px) {
  .vcard .seg-btn { font-size: .76rem; padding: 4px 1px; }
  .vcard .driver-btn .dname { font-size: .9rem; }
}
@media (min-width: 900px) { .vgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .vgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@container (max-width: 270px) {
  .vcard .seg-btn { font-size: .7rem; }
  .vcard .vhead strong { font-size: .95rem; }
}

.btn-wait { opacity: .55; }
.prog-left { margin-top: 10px; font-size: .92rem; }
.prog-left-title { font-weight: 700; color: #92400e; margin-bottom: 4px; }
.prog-left ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.prog-left .link-btn { min-height: 30px; text-align: left; }
.vcard.flash { animation: vflash 1.8s ease; }
@keyframes vflash { 0%, 60% { box-shadow: 0 0 0 4px #f59e0b; } 100% { box-shadow: var(--shadow); } }
@media (prefers-reduced-motion: reduce) { .vcard.flash { animation: none; box-shadow: 0 0 0 4px #f59e0b; } }

.cl-submit { padding: 14px; margin-bottom: 24px; }
.cl-submit p { margin: 0 0 10px; }
.cl-submit .btn { min-height: 54px; font-size: 1.05rem; gap: 8px; display: inline-flex; align-items: center; justify-content: center; }

/* ---- v7e: status buttons with icons, status bar, events, dropdown fix ---- */
.vcard .seg { gap: 6px; }
.vcard .seg-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 66px; padding: 6px 2px; border-width: 2px; font-weight: 700; line-height: 1.1; }
.vcard .seg-btn .ico { width: 22px; height: 22px; stroke-width: 2; }
.vcard .seg-btn.seg-RUNNING { background: #ecfdf5; border-color: #16a34a; color: #166534; }
.vcard .seg-btn.seg-BREAKDOWN { background: #fef2f2; border-color: #dc2626; color: #991b1b; }
.vcard .seg-btn.seg-IDLE { background: #f1f5f9; border-color: #64748b; color: #334155; }
.vcard .seg-btn.on { color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.vcard .seg-btn.on.seg-RUNNING { background: #16a34a; border-color: #15803d; }
.vcard .seg-btn.on.seg-BREAKDOWN { background: #dc2626; border-color: #b91c1c; }
.vcard .seg-btn.on.seg-IDLE { background: #475569; border-color: #334155; }
.vcard .seg-btn:not(.on):hover { filter: brightness(.96); }
.stat-bar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; color: #fff; font-size: 1.05rem; margin-bottom: 8px; }
.stat-bar.stat-RUNNING { background: #16a34a; }
.stat-bar.stat-BREAKDOWN, .stat-bar.stat-OUTSIDE { background: #dc2626; }
.stat-bar.stat-IDLE, .stat-bar.stat-NOT_AVAILABLE { background: #475569; }
.btn-warn { background: #fff7ed; border: 2px solid #ea580c; color: #9a3412; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; border-radius: 10px; cursor: pointer; font-family: inherit; font-size: .95rem; }
.btn-warn:hover { background: #ffedd5; }
.ev-btn { margin-bottom: 4px; }
.ev-opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; margin-top: 10px; padding: 10px 14px; border-radius: 12px; border: 2px solid; font-weight: 700; font-size: 1.05rem; font-family: inherit; text-align: left; cursor: pointer; }
.ev-opt .ico { width: 28px; height: 28px; stroke-width: 2; }
.ev-ok { background: #ecfdf5; border-color: #16a34a; color: #166534; }
.ev-bad { background: #fef2f2; border-color: #dc2626; color: #991b1b; }
.ev-idle { background: #f1f5f9; border-color: #64748b; color: #334155; }
/* dropdown pair (diesel / tyre) */
.vcard .vrow-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; margin-top: 10px; }
.vcard .vsel { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.vcard .vsel .vlabel { flex: 0 0 auto; min-width: 0; font-size: .74rem; color: #64748b; font-weight: 600; }
.vcard .vsel select.input, .vcard select.input { width: 100%; height: 44px; min-height: 44px; padding: 0 28px 0 10px; border: 1.5px solid #94a3b8; border-radius: 10px; background-color: #fff; font-size: .95rem; color: var(--text); }
.btn .ico { margin-right: 2px; }
.btn-lg { min-height: 50px; padding: 0 18px; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-light { border-width: 1.5px; border-color: #94a3b8; }
.ev-btn { font-size: .95rem; }
.vcard .vsel select.input, .vcard .vsel .input { flex: 0 0 auto !important; height: 44px; align-self: stretch; }
.vcard .vrow-two { grid-template-columns: .85fr 1.15fr; }

/* ======================================================================
   v8: compact cards, icons everywhere, space saving (phone, tablet, PC)
   One control height for the whole app: --ctl (42px touch, 38px mouse).
   ====================================================================== */
:root { --ctl: 42px; }
@media (pointer: fine) { :root { --ctl: 38px; } }
.ico { flex: 0 0 auto; vertical-align: -3px; }
.btn { min-height: var(--ctl); }
.btn-lg { min-height: var(--ctl); padding: 0 14px; font-size: .95rem; gap: 6px; }
.btn .ico { margin: 0; }
.bottom-bar .btn { min-height: 46px; }

/* grid adapts to the real width of the page: 1 column on phones, 2 on tablets, 4-5 on PC */
.vgrid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 272px), 1fr)) !important; gap: 10px; margin-bottom: 8px; }
.vcard { container-type: inline-size; padding: 10px; border-width: 1px; border-left-width: 5px; border-radius: 12px; }
.vcard[data-status="RUNNING"] { border-left-color: #16a34a; }
.vcard[data-status="BREAKDOWN"] { border-left-color: #dc2626; }
.vcard[data-status="IDLE"], .vcard[data-status="NOT_AVAILABLE"], .vcard[data-status="OUTSIDE"] { border-left-color: #64748b; }
.vcard[data-status="MAINTENANCE"], .vcard.locked { border-left-color: #b91c1c; }
.vcard.need { border-color: #f59e0b; border-left-color: #f59e0b; }
.vcard .vhead { margin: 0 0 6px; font-size: 1rem; line-height: 1.2; min-height: 0; }

/* status: mapping buttons + running bar */
.vcard .seg { gap: 6px; margin: 0; }
.vcard .seg-btn { min-height: 50px; padding: 4px 2px; gap: 2px; font-size: .8rem; border-radius: 9px; }
.vcard .seg-btn .ico { width: 20px; height: 20px; }
.vstat { display: flex; gap: 6px; align-items: stretch; }
.vcard .stat-bar { flex: 1 1 auto; min-width: 0; margin: 0; min-height: var(--ctl); padding: 0 12px; gap: 8px; border-radius: 9px; font-size: .95rem; }
.vcard .ev-btn { flex: 0 0 auto; min-height: var(--ctl); padding: 0 12px; margin: 0; gap: 6px; font-size: .85rem; border-width: 1.5px; border-radius: 9px; }
@container (max-width: 250px) { .vcard .ev-btn span { display: none; } .vcard .ev-btn { padding: 0 14px; } }
.vcard .vnote { margin: 6px 0 0; padding: 4px 8px; font-size: .8rem; }

/* driver rows: caption sits inside the box (saves a line) */
.vcard .vrow { margin-top: 6px; gap: 6px; flex-wrap: nowrap; align-items: stretch; margin-bottom: 0; }
.vcard .vrow .driver-btn { flex: 1 1 0; min-width: 0; min-height: 48px; padding: 3px 10px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; text-align: left; border: 1.5px solid #cbd5e1; border-radius: 9px; background: #fff; font-family: inherit; cursor: pointer; }
.vcard .driver-btn small { display: flex; align-items: center; gap: 3px; font-size: .68rem; line-height: 1.2; color: #64748b; font-weight: 600; }
.vcard .driver-btn .dname { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; font-weight: 700; line-height: 1.25; color: var(--text); }
.vcard .driver-btn:not(.add):hover { border-color: #1d4ed8; }
.vcard .driver-btn.add { flex-direction: row; align-items: center; justify-content: flex-start; gap: 8px; min-height: 38px; border-style: dashed; background: #f8fafc; color: #1d4ed8; }
.vcard .driver-btn.add .dname { color: #1d4ed8; font-weight: 600; font-size: .85rem; }
.vcard .vrow .hrs { display: flex; align-items: center; gap: 3px; flex: 0 0 auto; font-size: .8rem; color: #64748b; }
.vcard .hrs-in { width: 58px; height: 48px; min-height: 48px !important; text-align: center; padding: 0 4px; }
.vcard .vro { display: flex; flex-direction: column; }
.vcard .vro small { font-size: .68rem; color: #64748b; font-weight: 600; }

/* two small boxes per line: Location + Opening, Diesel + Tyre */
.vpair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.vcard .vfld { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin: 0; }
.vcard .vfld .vlabel { display: flex; align-items: center; gap: 3px; flex: 0 0 auto; min-width: 0; font-size: .68rem; line-height: 1.2; font-weight: 600; color: #64748b; }
.vcard .vfld select.input, .vcard .vfld .input { width: 100%; max-width: 100%; flex: 0 0 auto !important; height: var(--ctl) !important; min-height: var(--ctl) !important; padding: 0 26px 0 8px; font-size: .92rem; border: 1.5px solid #94a3b8; border-radius: 9px; background-color: #fff; }
.vcard .vfld .open-in { padding: 0 8px; }
.vcard .openbox { display: flex; align-items: center; justify-content: space-between; height: var(--ctl); padding: 0 4px 0 10px; border: 1.5px solid #cbd5e1; border-radius: 9px; background: #f8fafc; }
.vcard .openbox b { font-size: 1rem; }
.vcard .openbox .link-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; min-height: 0; border-radius: 8px; color: #1d4ed8; padding: 0; }
.vcard .openbox .link-btn:hover { background: #e0e7ff; }
.vcard .vval { display: flex; align-items: center; min-height: var(--ctl); font-size: .92rem; }
.vcard .vsmall { font-size: .75rem; line-height: 1.2; }
.vcard .vr-fit { align-items: center; justify-content: space-between; }
.vcard .vr-fit .vlabel { flex: 0 0 auto; font-size: .68rem; font-weight: 600; color: #64748b; }
.vcard .chip-att { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 3px 10px; font-size: .85rem; border-radius: 999px; }
.vcard .vmiss { margin: 6px 0 0; font-size: .75rem; line-height: 1.25; }
.vcard .lock-box { margin-top: 0; padding: 10px; }
.vcard .lock-box strong { display: flex; align-items: center; gap: 6px; font-size: .95rem; }

/* phones: slightly roomier touch targets */
@media (max-width: 699px) { .vcard .seg-btn { min-height: 54px; } .vcard .vrow .driver-btn { min-height: 52px; } .vcard .hrs-in { height: 52px; min-height: 52px !important; } }

/* page chrome: less height */
.page-head { margin-bottom: 8px; gap: 6px 12px; }
.page-head h1 { font-size: 1.15rem; line-height: 1.25; }
.content { padding: 10px 12px 18px; }
.next-steps { padding: 10px 12px; }
.next-steps .muted { font-size: .85rem; }
.next-steps .actions { margin-top: 8px; gap: 6px; }
.steps { margin: 0 0 8px; font-size: .85rem; }
.progress-card { padding: 8px 12px; margin-bottom: 8px; }
.tabs { padding: 2px 0 8px; }
.vgroup-title { font-size: .95rem; margin: 6px 2px 6px; display: flex; align-items: center; gap: 8px; }
.cl-link { padding: 9px 12px; margin-bottom: 8px; }

/* End Trip: Magnet work summary + E / Op */
.work-card, .eo-card { padding: 12px; }
.work-card { margin: 10px 0 4px; }
.work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 10px; margin-top: 6px; }
.work-grid .field { margin: 0; }
.work-grid .field > span { display: block; font-size: .78rem; line-height: 1.2; margin-bottom: 2px; }
.work-grid .work-in { height: var(--ctl); min-height: var(--ctl); text-align: center; font-weight: 700; }
.work-box .wcheck { margin-top: 10px; }
.wc-help { margin: 6px 0 0; font-size: .82rem; }
.card-head h2 { display: flex; align-items: center; gap: 6px; margin: 0; }
.eo-grid { display: grid; gap: 6px; max-width: 540px; margin-top: 8px; }
.eo-row { display: grid; grid-template-columns: minmax(0, 1fr) 84px 84px; gap: 8px; align-items: center; }
.eo-row > b { text-align: center; font-size: 1.05rem; }
.eo-head { font-size: .75rem; color: #64748b; font-weight: 700; }
.eo-head span:not(:first-child) { display: flex; align-items: center; justify-content: center; gap: 4px; }
.eo-in { height: var(--ctl); min-height: var(--ctl); text-align: center; font-weight: 700; font-size: 1rem; padding: 0 4px; }
.eo-help { margin: 8px 0 0; font-size: .8rem; }
.vcard .vfld .vlabel { height: 14px; white-space: nowrap; overflow: hidden; }
.vcard .vfld .vlabel .req { font-size: .8rem; line-height: 1; }
.vpair { align-items: end; }
.vcard .vfld { align-items: stretch; }
.vcard .vfld .vlabel { align-self: flex-start; }

/* ---- v9: role pages (edit bar, manpower tiles) ---- */
.edit-bar { padding: 10px 12px; margin-bottom: 8px; border-left: 5px solid #1d4ed8; }
.edit-bar.active { border-left-color: #16a34a; background: #f0fdf4; }
.eb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.eb-row > span { flex: 1 1 260px; min-width: 0; font-size: .88rem; }
.eb-row strong { display: inline-flex; align-items: center; gap: 6px; }
.eb-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.eb-form .input { flex: 1 1 260px; min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.kpi { display: flex; flex-direction: column; align-items: flex-start; gap: 0; }
.kpi .k-n { display: block; line-height: 1.1; }
.kpi .k-l { display: block; }
