:root {
  --bg: #edeff4;
  --surface: #ffffff;
  --surface-2: #f5f6fa;
  --ink: #111733;
  --muted: #586079;
  --line: #d7dbe6;
  --accent: #f7a603;
  --accent-soft: #fef0d0;
  --accent-ink: #1e1500;
  --navy: #081a80;
  --navy-soft: #e3e7f7;
  --ok: #1e8a4c;
  --ok-soft: #dff2e6;
  --warn: #a8690f;
  --warn-soft: #fbebd0;
  --bad: #c3302a;
  --bad-soft: #fbe1df;
  --map-bg: #e6e9f0;
  --map-grid: #d5dae5;
  --road: #c3c9d8;
  --c1: #3452d1;
  --c2: #cc8400;
  --shadow: 0 1px 2px rgba(17, 23, 51, 0.06), 0 6px 20px rgba(17, 23, 51, 0.06);
  --display: "Readex Pro", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --body: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1020;
    --surface: #151a30;
    --surface-2: #1b2139;
    --ink: #e7e9f3;
    --muted: #97a0bf;
    --line: #293152;
    --accent: #f7a603;
    --accent-soft: #3a2c0c;
    --accent-ink: #1e1500;
    --navy: #93a6f2;
    --navy-soft: #1b2452;
    --ok: #42b874;
    --ok-soft: #173022;
    --warn: #e3a33b;
    --warn-soft: #352812;
    --bad: #ef5b52;
    --bad-soft: #3a1918;
    --map-bg: #121731;
    --map-grid: #1b2140;
    --road: #2c3456;
    --c1: #6a82ea;
    --c2: #b8800e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1020;
  --surface: #151a30;
  --surface-2: #1b2139;
  --ink: #e7e9f3;
  --muted: #97a0bf;
  --line: #293152;
  --accent: #f7a603;
  --accent-soft: #3a2c0c;
  --accent-ink: #1e1500;
  --navy: #93a6f2;
  --navy-soft: #1b2452;
  --ok: #42b874;
  --ok-soft: #173022;
  --warn: #e3a33b;
  --warn-soft: #352812;
  --bad: #ef5b52;
  --bad-soft: #3a1918;
  --map-bg: #121731;
  --map-grid: #1b2140;
  --road: #2c3456;
  --c1: #6a82ea;
  --c2: #b8800e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.6;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
h1,
h2,
h3 {
  font-family: var(--display);
  line-height: 1.25;
  margin: 0;
  text-wrap: balance;
}
h2 {
  font-size: 1.15rem;
  font-weight: 600;
}
h3 {
  font-size: 1rem;
  font-weight: 600;
}
.num,
.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.82rem;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* top bar */
.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.top-in {
  max-width: 1320px;
  margin: 0 auto;
  padding-inline: 16px;
  padding-block: 10px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-inline-end: auto;
  min-width: 0;
}
.logo-tile {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #fff;
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: 0 0 0 1px var(--line);
}
.logo-tile img {
  width: 36px;
  height: auto;
  display: block;
}
.brand b {
  font-family: var(--display);
  font-size: 1.05rem;
  display: block;
  line-height: 1.15;
  color: var(--navy);
}
.brand span {
  font-size: 0.75rem;
  color: var(--muted);
}
.top-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
@media (min-width: 1561px) {
  .tabs {
    order: 3;
    flex: 1 1 100%;
    min-width: 0;
    justify-content: flex-start;
    overflow: visible;
  }
}
@media (max-width: 1380px) {
  .clock {
    display: none;
  }
}
.brand b {
  white-space: nowrap;
}
@media (max-width: 1560px) and (min-width: 761px) {
  .top-in {
    flex-wrap: wrap;
  }
  .tabs {
    order: 3;
    flex: 1 1 100%;
    justify-content: flex-start;
  }
}
@media (max-width: 1000px) and (min-width: 761px) {
  .tabs {
    flex-wrap: wrap;
    overflow: visible;
  }
  .tab {
    padding: 8px 10px;
  }
  .tab .ti {
    display: none;
  }
  .uc-tx,
  .lo-tx {
    display: none;
  }
}
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  overflow-x: auto;
  max-width: 100%;
}
.tab {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
  position: relative;
  transition:
    background 0.15s,
    color 0.15s;
}
.tab:hover {
  color: var(--ink);
}
.tab .ti {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.tab .ts {
  display: none;
}
.tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--navy);
  box-shadow: var(--shadow);
}
.tab[aria-selected="true"] .ti {
  stroke: var(--accent);
}
.wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding-inline: 16px;
  padding-block: 20px 48px;
}
.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.view-head h1 {
  font-size: 1.5rem;
  font-weight: 600;
}
.view-head p {
  margin: 4px 0 0;
  color: var(--muted);
  max-width: 62ch;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.card-h {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.card-b {
  padding: 16px;
}

/* buttons */
.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 9px 14px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:hover {
  background: var(--surface-2);
}
.btn-p {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-p:hover {
  background: var(--accent);
  filter: brightness(1.05);
}
.btn-n {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--surface);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}
.btn-s {
  padding: 5px 10px;
  font-size: 0.82rem;
  border-radius: 7px;
}
.btn-block {
  width: 100%;
}
a.link {
  color: var(--navy);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

/* forms */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}
.field input,
.field select,
.field textarea {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  width: 100%;
}
.form-grid {
  display: grid;
  gap: 12px;
}
.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ops */
.ops {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 18px;
  align-items: start;
}
.ops-main {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.pipeline {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.pipe {
  padding: 12px 12px 10px;
  border-inline-start: 1px solid var(--line);
  position: relative;
}
.pipe:first-child {
  border-inline-start: 0;
}
.pipe .k {
  padding-inline-end: 14px;
  font-size: 0.74rem;
  color: var(--muted);
  letter-spacing: 0.01em;
  display: block;
  min-height: 2.4em;
  line-height: 1.3;
}
.pipe .v {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 600;
}
.pipe .step {
  position: absolute;
  inset-inline-end: 10px;
  top: 10px;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
}
.tbl-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
th {
  text-align: start;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--surface-2);
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tr:last-child td {
  border-bottom: 0;
}
tbody tr.row {
  cursor: pointer;
}
tbody tr.row:hover td {
  background: var(--surface-2);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.st-new {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px dashed var(--line);
}
.st-assigned,
.st-toPickup {
  background: var(--navy-soft);
  color: var(--navy);
}
.st-atPickup,
.st-atDrop {
  background: var(--warn-soft);
  color: var(--warn);
}
.st-toDrop {
  background: var(--accent-soft);
  color: var(--warn);
}
.st-delivered {
  background: var(--ok-soft);
  color: var(--ok);
}
.route-cell {
  white-space: nowrap;
}
.route-cell .arrow {
  color: var(--muted);
  margin-inline: 4px;
}
:root[dir="ltr"] .route-cell .arrow {
  display: inline-block;
  transform: scaleX(-1);
}
td.num {
  white-space: nowrap;
}

.alerts {
  display: flex;
  flex-direction: column;
}
.alert {
  display: grid;
  grid-template-columns: 4px 1fr auto;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  align-items: start;
}
.alert:last-child {
  border-bottom: 0;
}
.alert .bar {
  align-self: stretch;
  border-radius: 2px;
  background: var(--muted);
}
.alert.route .bar {
  background: var(--bad);
}
.alert.stop .bar {
  background: var(--warn);
}
.alert.info .bar {
  background: var(--ok);
}
.alert.acked > div:nth-child(2) {
  opacity: 0.7;
}
.alert.acked .bar {
  background: var(--ok);
}
.al-notes,
.al-form {
  grid-column: 2/-1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.al-note {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
}
.al-note .al-who {
  font-size: 0.76rem;
  color: var(--muted);
}
.al-note .al-ok {
  color: var(--ok);
}
.al-note p {
  margin: 3px 0 0;
  font-weight: 500;
  font-size: 0.88rem;
}
.al-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.al-quick .chip {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font: inherit;
  font-size: 0.78rem;
}
.al-quick .chip:hover {
  background: var(--accent-soft);
}
.al-txt {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}
.al-btns {
  display: flex;
  gap: 6px;
}
td[data-label="رقم الرحلة"] .num,
td[data-label="رقم الفاتورة"] .num {
  white-space: nowrap;
}
.alert p {
  margin: 0;
  font-weight: 600;
}
.alert .meta {
  font-size: 0.78rem;
  color: var(--muted);
}
.empty {
  padding: 22px 16px;
  color: var(--muted);
  text-align: center;
}

/* modal */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 20, 0.45);
  z-index: 50;
  display: flex;
  justify-content: flex-start;
}
.drawer {
  background: var(--surface);
  width: min(560px, 100%);
  height: 100%;
  overflow-y: auto;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow);
}
.tl {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.tl li {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  padding: 7px 0;
  align-items: center;
}
.tl .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--surface);
}
.tl li.done .dot {
  background: var(--ok);
  border-color: var(--ok);
}
.tl li.done {
  color: var(--ink);
}
.tl li:not(.done) {
  color: var(--muted);
}
.ph-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.ph {
  aspect-ratio: 4/3;
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  overflow: hidden;
  position: relative;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}
.ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ph .cap {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  background: rgba(10, 14, 20, 0.6);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 6px;
}
.ph.seed {
  background: repeating-linear-gradient(
    135deg,
    var(--surface-2) 0 8px,
    var(--map-grid) 8px 9px
  );
}
.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  font-size: 0.88rem;
}
.kv dt {
  color: var(--muted);
}
.kv dd {
  margin: 0;
  font-weight: 500;
}
.section {
  margin-top: 18px;
}
.section > h3 {
  margin-bottom: 10px;
}

/* driver */
.drv-layout {
  display: grid;
  grid-template-columns: 1fr 380px 1fr;
  gap: 24px;
  align-items: start;
}
.drv-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: var(--surface);
}
.seg button {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}
.seg button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.steps li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  align-items: center;
}
.steps .n {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 0.8rem;
  border: 1px solid var(--line);
  background: var(--surface);
}
.steps li.done .n {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}
.steps li.cur {
  background: var(--accent-soft);
}
.steps li.cur .n {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.steps li span.t {
  font-weight: 600;
  font-size: 0.9rem;
}
.steps li small {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: 0.78rem;
}

.phone {
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  border-radius: 34px;
  background: #0d1117;
  padding: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.screen {
  border-radius: 26px;
  background: var(--bg);
  min-height: 680px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.p-top {
  background: var(--ink);
  color: var(--bg);
  padding: 14px 16px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.p-top b {
  font-family: var(--display);
  font-size: 0.95rem;
}
.p-top .sub {
  font-size: 0.72rem;
  opacity: 0.75;
}
.p-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.notif {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  animation: drop 0.5s ease;
}
@keyframes drop {
  from {
    transform: translateY(-8px);
    opacity: 0.3;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.p-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}
.p-card .lbl {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.loc {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
}
.loc .ic {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-weight: 600;
}
.loc.a .ic {
  background: var(--navy-soft);
  color: var(--navy);
}
.loc.b .ic {
  background: var(--accent-soft);
  color: var(--warn);
}
.loc b {
  display: block;
  font-size: 0.95rem;
}
.locked {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.84rem;
  display: flex;
  gap: 8px;
  align-items: center;
}
.prog {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
  border: 1px solid var(--line);
}
.prog i {
  display: block;
  height: 100%;
  background: var(--navy);
  transition: width 0.25s linear;
}
.shots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.shot {
  aspect-ratio: 4/3;
  max-width: 100%;
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  display: grid;
  place-items: center;
  text-align: center;
  cursor: pointer;
  background: var(--surface-2);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  position: relative;
  overflow: hidden;
}
.shot.one {
  aspect-ratio: 16/8;
}
.shot:hover {
  border-color: var(--accent);
}
.shot.has {
  border-style: solid;
  border-color: var(--ok);
}
.shot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.shot .tag {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  background: rgba(10, 14, 20, 0.62);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 6px;
}
.shot input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.cam {
  width: 22px;
  height: 22px;
  display: block;
  margin: 0 auto 4px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
}
.chk {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chk label {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 7px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
  cursor: pointer;
}
.chk label:last-child {
  border-bottom: 0;
}
.chk input,
.pledge input {
  width: 20px;
  height: 20px;
  accent-color: var(--ok);
  flex: none;
}
.pledge {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--warn-soft);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.84rem;
  line-height: 1.55;
  cursor: pointer;
}
.hint {
  font-size: 0.78rem;
  color: var(--bad);
  text-align: center;
}
.timer {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--warn);
}
.done-big {
  text-align: center;
  padding: 30px 10px;
}
.done-big .ring {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
  display: grid;
  place-items: center;
  margin: 0 auto 10px;
  font-size: 2rem;
}

/* tracking */
.trk {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}
.map-box {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--map-bg);
}
.map-box svg {
  display: block;
  width: 100%;
  min-width: 640px;
  height: auto;
}
.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 10px 4px 0;
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lg-line {
  width: 22px;
  border-top: 2px dashed var(--navy);
}
.lg-band {
  width: 22px;
  height: 9px;
  border-radius: 5px;
  background: var(--navy);
  opacity: 0.18;
}
.lg-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--navy);
}
.lg-dot.bad {
  background: var(--bad);
}
.trucks {
  display: flex;
  flex-direction: column;
}
.truck {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.truck:last-child {
  border-bottom: 0;
}
.truck.off {
  background: var(--bad-soft);
}
.truck-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.truck-h b {
  font-size: 0.9rem;
}
.dev-tag {
  color: var(--bad);
  font-weight: 700;
  font-size: 0.78rem;
}
@keyframes pulse {
  0% {
    r: 9;
    opacity: 0.7;
  }
  100% {
    r: 26;
    opacity: 0;
  }
}
.pulse {
  animation: pulse 1.4s ease-out infinite;
}

/* performance */
.kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}
.kpi .k {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}
.kpi .v {
  font-family: var(--mono);
  font-size: 1.55rem;
  font-weight: 600;
  margin-top: 4px;
  direction: ltr;
  text-align: right;
  unicode-bidi: isolate;
}
:root[dir="ltr"] .kpi .v {
  text-align: left;
}
.kpi .s {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}
.perf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}
.late-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .late-grid {
    grid-template-columns: 1fr;
  }
}
.bars {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 70px;
  gap: 10px;
  align-items: center;
  font-size: 0.85rem;
}
.bar-row .nm {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track {
  height: 14px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--navy);
}
.bar-fill.top {
  background: var(--accent);
}
.bar-fill.warn {
  background: var(--warn);
}
.bar-row .val {
  white-space: nowrap;
  font-family: var(--mono);
  text-align: start;
  font-size: 0.82rem;
  direction: ltr;
  unicode-bidi: isolate;
}
th.sort {
  cursor: pointer;
  user-select: none;
}
th.sort[aria-sort]::after {
  content: " ▾";
  color: var(--accent);
}
th.sort[aria-sort="ascending"]::after {
  content: " ▴";
}
.rank {
  font-family: var(--mono);
  color: var(--muted);
  width: 28px;
}
td.hi {
  color: var(--bad);
  font-weight: 600;
}
td.good {
  color: var(--ok);
  font-weight: 600;
}
.chart svg {
  width: 100%;
  height: auto;
  display: block;
}
.note {
  font-size: 0.8rem;
  color: var(--muted);
  border-inline-start: 3px solid var(--line);
  padding-inline-start: 10px;
  margin-top: 12px;
  max-width: 80ch;
}

.toast {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  z-index: 60;
  box-shadow: var(--shadow);
  max-width: calc(100% - 32px);
}

.flt-kpis {
  grid-template-columns: repeat(5, 1fr);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.chip.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.chip.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.chip.bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.chip.mut {
  background: var(--surface-2);
  color: var(--muted);
}
.st-active {
  background: var(--ok-soft);
  color: var(--ok);
}
.st-shop {
  background: var(--bad-soft);
  color: var(--bad);
}
.st-trip {
  background: var(--navy-soft);
  color: var(--navy);
}
.alert.maint .bar {
  background: var(--warn);
}
.alert.bad .bar {
  background: var(--bad);
}
.sched {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sched-row {
  display: grid;
  grid-template-columns: 1fr 110px auto;
  gap: 10px;
  align-items: center;
  font-size: 0.86rem;
}
.meter {
  height: 7px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
  border: 1px solid var(--line);
}
.meter i {
  display: block;
  height: 100%;
}
.rep {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.reasons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.btn.reason {
  font-size: 0.85rem;
  padding: 9px 8px;
}
.btn.reason[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.rep textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}
@media (max-width: 1100px) {
  .flt-kpis {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 640px) {
  .flt-kpis .kpi:last-child:nth-child(odd) {
    grid-column: 1/-1;
  }
  .flt-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .sched-row {
    grid-template-columns: 1fr 80px;
  }
  .sched-row .chip {
    grid-column: 1/-1;
    justify-self: start;
  }
}
/* loading order (paper keeps the printed form's colors in both themes) */
.lo-scrim {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 20, 0.55);
  z-index: 55;
  overflow-y: auto;
  padding: 16px;
}
.lo-bar {
  max-width: 820px;
  margin: 0 auto 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: #fff;
}
.lo-bar p {
  margin: 0;
  font-size: 0.82rem;
  opacity: 0.85;
}
.lo-scroll {
  max-width: 820px;
  margin: 0 auto;
  overflow-x: auto;
  border-radius: 6px;
}
.paper {
  --pb: #2e3192;
  --po: #f39200;
  --pi: #1b1b2a;
  --pl: #9aa0b8;
  min-width: 680px;
  background: #fff;
  color: var(--pi);
  padding: 26px 30px 0;
  font-size: 13px;
  line-height: 1.5;
  direction: rtl;
  position: relative;
  overflow: hidden;
}
.paper .wm {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0.06;
}
.paper .wm img {
  width: 62%;
}
.lo-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: start;
  border-bottom: 3px solid var(--pb);
  padding-bottom: 10px;
  position: relative;
}
.lo-head::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -7px;
  border-bottom: 1.5px solid var(--po);
}
.lo-co {
  font-size: 12px;
  color: var(--pb);
  line-height: 1.55;
}
.lo-co b {
  font-family: var(--display);
  font-size: 17px;
  display: block;
  color: var(--pb);
}
.lo-co.en {
  direction: ltr;
  text-align: left;
  font-family: var(--mono);
  font-size: 11px;
}
.lo-co.en b {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
}
.lo-mid {
  text-align: center;
}
.lo-mid img {
  height: 84px;
  display: block;
  margin: 0 auto 4px;
}
.lo-title {
  display: inline-block;
  border: 1.5px solid var(--pi);
  border-radius: 8px;
  padding: 2px 14px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
}
.lo-title small {
  display: block;
  font-family: Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
}
.lo-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 18px 0 10px;
  gap: 12px;
}
.lo-no {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  color: #c8102e;
  direction: ltr;
}
.lo-dates {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 10px;
  font-size: 12.5px;
}
.lo-dates span:nth-child(odd) {
  color: #555;
}
.lo-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
}
.lo-row {
  display: grid;
  grid-template-columns: 150px 1fr 150px;
  gap: 10px;
  align-items: end;
}
.lo-row .ar {
  font-weight: 700;
}
.lo-row.two-c {
  grid-template-columns: 170px 1fr;
}
.lo-row .en {
  direction: ltr;
  text-align: left;
  font-family: Arial, sans-serif;
  font-weight: 700;
  font-size: 12px;
}
.lo-row .v {
  border-bottom: 1.5px dotted #777;
  min-height: 22px;
  padding: 0 6px;
  font-weight: 600;
  color: #123;
  text-align: center;
  font-size: 14px;
}
.lo-row .v.empty {
  color: #aaa;
  font-weight: 400;
}
.lo-sec {
  text-align: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  margin: 14px 0 6px;
  text-decoration: underline;
  text-underline-offset: 5px;
}
.lo-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  position: relative;
}
.lo-tbl th,
.lo-tbl td {
  border: 1.2px solid var(--pi);
  padding: 5px 6px;
  text-align: center;
  background: transparent;
  color: var(--pi);
}
.lo-tbl th {
  font-weight: 700;
  white-space: normal;
  font-size: 11.5px;
}
.lo-tbl th small {
  display: block;
  font-family: Arial, sans-serif;
  font-weight: 700;
  font-size: 10px;
}
.lo-tbl td {
  font-weight: 600;
  font-size: 13.5px;
  height: 40px;
}
.lo-sign {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
  align-items: start;
}
.lo-stamp {
  border: 2px solid var(--pb);
  color: var(--pb);
  border-radius: 50%;
  width: 98px;
  height: 98px;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  transform: rotate(-12deg);
  line-height: 1.3;
  margin-top: 4px;
}
.lo-note {
  margin-top: 12px;
  font-size: 11.5px;
  line-height: 1.7;
}
.lo-note b {
  color: #c8102e;
}
.lo-note ul {
  margin: 4px 0 0;
  padding-inline-start: 16px;
  list-style: "★  ";
}
.lo-drv {
  margin: 10px 0 14px;
  font-weight: 700;
}
.lo-drv span {
  font-weight: 500;
  color: #1e7a45;
}
.lo-foot {
  background: linear-gradient(90deg, var(--po), #f7b24a);
  color: var(--pb);
  margin: 0 -30px;
  padding: 6px 30px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  flex-wrap: wrap;
}
.lo-foot2 {
  background: var(--pb);
  color: #fff;
  margin: 0 -30px;
  padding: 5px 30px;
  font-family: Arial, sans-serif;
  font-size: 11px;
  direction: ltr;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
@media print {
  body * {
    visibility: hidden;
  }
  .paper,
  .paper * {
    visibility: visible;
  }
  .paper {
    position: absolute;
    inset: 0;
    min-width: 0;
  }
}
@media (max-width: 1100px) {
  .ops {
    grid-template-columns: 1fr;
  }
  .drv-layout {
    grid-template-columns: 1fr;
  }
  .drv-layout .drv-side:last-child {
    order: 3;
  }
  .trk {
    grid-template-columns: minmax(0, 1fr);
  }
  .kpis {
    grid-template-columns: repeat(3, 1fr);
  }
  .pipeline {
    grid-template-columns: repeat(4, 1fr);
  }
  .pipe:nth-child(5) {
    border-inline-start: 0;
  }
  .pipe:nth-child(n + 5) {
    border-top: 1px solid var(--line);
  }
}
@media (max-width: 640px) {
  .perf-grid {
    grid-template-columns: 1fr;
  }
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .pipeline {
    grid-template-columns: repeat(2, 1fr);
  }
  .pipe {
    border-inline-start: 0;
    border-top: 1px solid var(--line);
  }
  .pipe:first-child,
  .pipe:nth-child(2) {
    border-top: 0;
  }
  .pipe:nth-child(even) {
    border-inline-start: 1px solid var(--line);
  }
  .two {
    grid-template-columns: 1fr;
  }
  .bar-row {
    grid-template-columns: 90px 1fr 60px;
  }
  .screen {
    min-height: 600px;
  }
  .clock {
    display: none;
  }
}

.badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--bad);
  color: #fff;
  font-size: 0.72rem;
  display: inline-grid;
  place-items: center;
  font-family: var(--mono);
}
.clock {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}
.view-in {
  animation: viewIn 0.22s ease-out;
}
@keyframes viewIn {
  from {
    opacity: 0.4;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.p-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #fff;
  display: grid;
  place-items: center;
  flex: none;
}
.p-logo img {
  width: 24px;
}
.drv-open {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- phones & small tablets ---- */
@media (max-width: 760px) {
  body {
    font-size: 15.5px;
  }
  .top-in {
    padding-block: 8px;
    gap: 10px;
    flex-wrap: nowrap;
  }
  .brand b {
    font-size: 0.95rem;
  }
  .brand div span,
  .clock {
    display: none;
  }
  .logo-tile {
    width: 38px;
    height: 38px;
  }
  .logo-tile img {
    width: 31px;
  }
  .seg button {
    padding: 7px 10px;
  }
  .tabs {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 40;
    border-radius: 0;
    border: 0;
    border-top: 1px solid var(--line);
    background: var(--surface);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 16px rgba(17, 23, 51, 0.08);
    overflow: visible;
  }
  .tab {
    flex-direction: column;
    gap: 2px;
    padding: 7px 2px 6px;
    font-size: 0.7rem;
    border-radius: 10px;
    white-space: nowrap;
  }
  .tab .ti {
    width: 22px;
    height: 22px;
  }
  .tab .tl {
    display: none;
  }
  .tab .ts {
    display: block;
  }
  .tab[aria-selected="true"] {
    box-shadow: none;
    background: var(--navy-soft);
  }
  .tab .badge {
    position: absolute;
    top: 2px;
    inset-inline-end: calc(50% - 22px);
    min-width: 17px;
    height: 17px;
    font-size: 0.62rem;
    padding: 0 4px;
  }
  .wrap {
    padding-block: 14px 140px;
  }
  .view-head {
    margin-bottom: 12px;
  }
  .view-head h1 {
    font-size: 1.3rem;
  }
  .view-head p {
    font-size: 0.88rem;
  }
  .toast {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }
  .field input,
  .field select,
  .field textarea,
  .rep textarea,
  #stopNote {
    font-size: 16px;
    min-height: 44px;
  }
  .btn {
    min-height: 44px;
  }
  .btn-s {
    min-height: 36px;
  }
  .card-h,
  .card-b {
    padding-inline: 14px;
  }
  .drawer {
    padding-inline: 16px;
  }
  /* tables become cards */
  table.resp thead {
    display: none;
  }
  table.resp,
  table.resp tbody {
    display: block;
    width: 100%;
  }
  table.resp tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
  }
  table.resp tr:last-child {
    border-bottom: 0;
  }
  table.resp td {
    border: 0;
    padding: 0;
    background: transparent !important;
    min-width: 0;
  }
  table.resp td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 1px;
  }
  table.resp td.wide {
    grid-column: 1/-1;
  }
  table.resp .route-cell {
    white-space: normal;
  }
  /* driver view: real phone look */
  .drv-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: stretch;
  }
  .drv-layout .drv-side {
    display: contents;
  }
  .drv-layout .drv-side > .card {
    order: 3;
  }
  .drv-layout .drv-side > .card.drv-pick {
    order: 0;
  }
  .drv-layout .phone {
    order: 1;
  }
}
@media (max-width: 640px) {
  #v-drv .phone {
    max-width: none;
    border-radius: 0;
    padding: 0;
    background: none;
    box-shadow: none;
    margin-inline: -16px;
    width: auto;
  }
  #v-drv .screen {
    border-radius: 0;
    min-height: calc(100dvh - 190px);
  }
}
/* ---- full-screen driver mode ---- */
body.drv-mode .tabs,
body.drv-mode #v-drv .view-head,
body.drv-mode .drv-side > .card:not(.drv-pick),
body.drv-mode .clock {
  display: none !important;
}
body.drv-mode .wrap {
  padding-block: 10px 20px;
  max-width: 560px;
}
body.drv-mode #v-drv .drv-layout {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}
body.drv-mode #uiLang {
  display: none;
}
body.drv-mode .brand div span {
  display: none;
}
body.drv-mode #v-drv .drv-side {
  display: contents;
}
body.drv-mode .drv-pick {
  order: 0;
}
body.drv-mode .drv-pick .card-b,
body.drv-mode .drv-pick {
  padding: 10px 12px;
}
body.drv-mode #v-drv .phone {
  order: 1;
  max-width: none;
  border-radius: 16px;
  padding: 0;
  background: none;
  box-shadow: none;
}
body.drv-mode #v-drv .screen {
  border-radius: 16px;
  min-height: calc(100dvh - 170px);
  box-shadow: var(--shadow);
}
@media (max-width: 640px) {
  body.drv-mode #v-drv .phone {
    margin-inline: -16px;
  }
  body.drv-mode #v-drv .screen {
    border-radius: 0;
  }
}

/* login & roles */
.login {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: var(--bg);
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top, 0px)) 16px 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  margin-top: 4vh;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}
.login-logo {
  width: 170px;
  align-self: center;
  background: #fff;
  border-radius: 12px;
  padding: 8px;
}
.login-card h1 {
  text-align: center;
  font-size: 1.2rem;
  color: var(--navy);
}
.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-tabs button {
  padding: 9px;
}
.demo-box {
  border-top: 1px dashed var(--line);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.demo-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
#loginLang {
  align-self: center;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 3px 3px 3px 3px;
  padding-inline-start: 4px;
  background: var(--surface);
}
.uc-av {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--surface);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex: none;
}
.uc-tx {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.uc-tx b {
  font-size: 0.82rem;
  white-space: nowrap;
}
.uc-tx span {
  font-size: 0.7rem;
  color: var(--muted);
}
.user-chip .btn {
  min-height: 30px;
  padding: 4px 8px;
}
.role-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--navy-soft);
  color: var(--navy);
}
.role-pill.admin {
  background: var(--accent-soft);
  color: var(--warn);
}
.role-pill.accountant {
  background: var(--ok-soft);
  color: var(--ok);
}
.perm-tbl {
  font-size: 0.8rem;
}
.perm-tbl td,
.perm-tbl th {
  padding: 6px 8px;
  text-align: center;
}
.perm-tbl td:first-child,
.perm-tbl th:first-child {
  text-align: start;
}
.perm-yes {
  color: var(--ok);
  font-weight: 700;
}
.perm-no {
  color: var(--muted);
}
.perm-view {
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 600;
}
.audit-filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 8px;
  padding-block: 12px;
}
.audit-filters select,
.audit-filters input {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  width: 100%;
  min-width: 0;
}
.audit {
  max-height: 560px;
  overflow-y: auto;
}
.au {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 0.86rem;
}
.au .tm {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}
.au .who {
  font-weight: 600;
}
.au .what {
  color: var(--ink);
}
.au .det {
  color: var(--muted);
  font-size: 0.8rem;
}
.au .tgt {
  font-family: var(--mono);
  font-size: 0.78rem;
  background: var(--surface-2);
  border-radius: 5px;
  padding: 0 5px;
}
body[data-edit="0"] .perm-edit {
  display: none !important;
}
body[data-edit="0"] .ops {
  grid-template-columns: 1fr;
}
body[data-role="driver"] .drv-pick .field:first-child {
  display: none;
}
.net {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 600;
}
.net.off {
  background: var(--bad-soft);
  color: var(--bad);
}
.net.sync {
  background: var(--ok-soft);
  color: var(--ok);
}
@media (max-width: 430px) {
  body[data-role] .brand div {
    display: none;
  }
}
@media (max-width: 760px) {
  .uc-tx,
  .lo-tx {
    display: none;
  }
  .user-chip {
    border: 0;
    padding: 0;
    background: none;
  }
  .tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-flow: row;
    overflow: visible;
    scrollbar-width: none;
  }
  .audit-filters {
    grid-template-columns: 1fr 1fr;
  }
  .audit-filters input {
    grid-column: 1/-1;
  }
  .au {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

.mini-sel {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  max-width: 100%;
}
td.neg {
  color: var(--bad);
  font-weight: 700;
}
td.pos {
  color: var(--ok);
  font-weight: 700;
}
.aging {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.aging div {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px;
}
.aging b {
  display: block;
  font-family: var(--mono);
  font-size: 1.05rem;
}
.aging span {
  font-size: 0.75rem;
  color: var(--muted);
}
.aging .late b {
  color: var(--bad);
}
body:not([data-role="admin"]):not([data-role="accountant"]) .perm-fin {
  display: none !important;
}
@media (max-width: 640px) {
  .aging {
    grid-template-columns: 1fr 1fr;
  }
}

.dsp {
  display: grid;
  grid-template-columns: 1fr 1.25fr 0.85fr;
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}
.dsp-col {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.dsp-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
  font-family: var(--display);
}
.dsp-h span {
  font-weight: 700;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.85rem;
}
.dsp-h.ok span {
  background: var(--ok-soft);
  color: var(--ok);
}
.dsp-h.nav span {
  background: var(--navy-soft);
  color: var(--navy);
}
.dsp-h.bad span {
  background: var(--bad-soft);
  color: var(--bad);
}
.dsp-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dc-h {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.dc-h b {
  font-size: 0.92rem;
}
.dc .sub {
  font-size: 0.78rem;
  color: var(--muted);
}
.dc .eta {
  font-size: 0.82rem;
}
.dc .eta b {
  font-family: var(--mono);
}
.dc-act {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.dc-act select {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
}
.dsp-wait {
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.wchip {
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  min-width: 0;
  gap: 6px;
  align-items: center;
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 5px 10px;
  font-size: 0.82rem;
}
@media (max-width: 900px) {
  .dsp {
    grid-template-columns: 1fr;
  }
}

.score {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}
.score b {
  font-family: var(--mono);
  font-size: 1.15rem;
  width: 34px;
}
.score .meter {
  flex: 1;
}
#stopReasons .bar-row {
  grid-template-columns: 120px 1fr 120px;
}
@media (max-width: 640px) {
  #stopReasons .bar-row {
    grid-template-columns: 80px 1fr 96px;
  }
}
@media (max-width: 1400px) and (min-width: 761px) {
  .tab .ti {
    display: none;
  }
  .tab {
    padding: 8px 11px;
  }
}
.grade {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.8rem;
  font-family: var(--mono);
}
.grade.A {
  background: var(--ok-soft);
  color: var(--ok);
}
.grade.B {
  background: var(--navy-soft);
  color: var(--navy);
}
.grade.C {
  background: var(--warn-soft);
  color: var(--warn);
}
.grade.D {
  background: var(--bad-soft);
  color: var(--bad);
}

.dl-bar {
  display: flex;
  gap: 6px;
  align-items: center;
}
.dl {
  display: none !important;
}
body.can-dl .dl {
  display: inline-flex !important;
}
body.can-dl #sCopy {
  display: none;
}
.view-head {
  align-items: center;
}

.imp-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line);
}
.fm-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 640px) {
  .fm-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.effg {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 170px;
}
.effg b {
  width: 40px;
}
.effbar {
  position: relative;
  flex: 1;
  height: 10px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.effbar .band {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--ok-soft);
  border-inline: 2px solid var(--ok);
}
.effbar .mark {
  position: absolute;
  top: -4px;
  width: 6px;
  height: 16px;
  border-radius: 3px;
  margin-inline-start: -3px;
  background: var(--muted);
}
.effbar .mark.bad {
  background: var(--bad);
}
.effbar .mark.ok {
  background: var(--ok);
}
.effbar .mark.navy {
  background: var(--navy);
}
.chip.navy {
  background: var(--navy-soft);
  color: var(--navy);
}
.st-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 760px) {
  .st-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.cyc-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--line);
}
.cyc-kpis div {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 12px;
}
.cyc-kpis b {
  display: block;
  font-family: var(--mono);
  font-size: 1.25rem;
}
.cyc-kpis span {
  font-size: 0.76rem;
  color: var(--muted);
}
.gantt-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  color: var(--muted);
}
.gantt-legend i {
  display: inline-block;
  width: 14px;
  height: 10px;
  border-radius: 2px;
  margin-inline-end: 5px;
  vertical-align: middle;
}
.gantt-legend i.idle {
  background: repeating-linear-gradient(
    135deg,
    var(--surface-2) 0 3px,
    var(--line) 3px 5px
  );
  border: 1px solid var(--line);
}
#gantt svg {
  display: block;
  min-width: 720px;
  width: 100%;
  height: auto;
}
@media (max-width: 760px) {
  .cyc-kpis {
    grid-template-columns: 1fr 1fr;
  }
}

.home-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.home-head h1 {
  font-size: 1.5rem;
  color: var(--navy);
}
.home-sub {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 14px 0 10px;
}
.acts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}
.act {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: start;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--surface);
  cursor: pointer;
  border-inline-start: 5px solid var(--line);
  transition: transform 0.12s;
}
.act:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.act b {
  font-family: var(--mono);
  font-size: 1.6rem;
  line-height: 1.2;
}
.act span {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}
.act.bad {
  border-inline-start-color: var(--bad);
}
.act.bad b {
  color: var(--bad);
}
.act.warn {
  border-inline-start-color: var(--warn);
}
.act.warn b {
  color: var(--warn);
}
.act.zero {
  opacity: 0.6;
}
.act.zero b {
  color: var(--muted);
}
.tsearch {
  position: relative;
  margin: 0 0 14px;
}
.tsearch .tsq {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
}
.tsearch .tsq:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.tsr {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 4px);
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  max-height: 360px;
  overflow: auto;
}
.tsr button {
  display: block;
  width: 100%;
  text-align: start;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.tsr button:hover,
.tsr button:focus {
  background: var(--accent-soft);
}
.tsr .h1 {
  display: block;
  font-size: 0.9rem;
}
.tsr .h2 {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}
.tsr .empty {
  margin: 0;
  padding: 12px 14px;
}
.trip-ids,
.trip-money {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.trip-money {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.trip-money:not(:has(> div:nth-child(4))) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.trip-ids > div,
.trip-money > div {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 0;
}
.trip-ids > div > span,
.trip-money > div > span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}
.trip-ids b,
.trip-money b {
  display: block;
  font-size: 1.1rem;
  margin-top: 3px;
  overflow-wrap: anywhere;
}
.trip-money small {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 2px;
}
.trip-money .pos b {
  color: var(--ok);
}
.trip-money .neg b {
  color: var(--bad);
}
.inv-form {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.inv-form input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
@media (max-width: 600px) {
  .trip-ids {
    grid-template-columns: minmax(0, 1fr);
  }
  .trip-money {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.gsearch {
  margin: 4px 0 18px;
}
.gsearch .ts-ic {
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}
.gsearch .tsq {
  padding: 13px 16px;
  padding-inline-start: 44px;
  font-size: 1rem;
  border-width: 1.5px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 18px;
}
.home-grid .span2 {
  grid-column: 1/-1;
}
.hc .card-b {
  padding-block: 14px;
}
.segbar {
  display: flex;
  gap: 2px;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
}
.segbar span {
  display: block;
  height: 100%;
}
.seglegend,
.legend2 {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}
.seglegend i,
.legend2 i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-inline-end: 6px;
  vertical-align: middle;
}
.seglegend b {
  color: var(--ink);
  margin-inline-start: 4px;
}
.mini-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.mini-kpis div {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.mini-kpis b {
  display: block;
  font-size: 1.5rem;
  font-family: var(--mono);
}
.mini-kpis span {
  font-size: 0.78rem;
  color: var(--muted);
}
.rtabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: -4px 0 14px;
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 118px);
  z-index: 5;
  background: var(--bg);
  padding-block: 6px;
}
.rtabs button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.rtabs button[aria-pressed="true"] {
  background: var(--navy);
  color: var(--surface);
  border-color: var(--navy);
}
.info {
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9em;
  margin-inline-start: 8px;
  padding: 0 4px;
  vertical-align: middle;
}
.info:hover {
  color: var(--navy);
}
@media (max-width: 900px) {
  .home-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.home-grid > *,
.hc {
  min-width: 0;
}
@media (max-width: 760px) {
  .rtabs {
    top: calc(env(safe-area-inset-top, 0px) + 54px);
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .rtabs button {
    white-space: nowrap;
  }
  .mini-kpis {
    grid-template-columns: 1fr 1fr;
  }
  .acts {
    grid-template-columns: 1fr 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
