/* ============================================================
   Zagros ERP — app.css
   RTL-first design system. Brand green #0e6f4f (hover #0a5039).
   ============================================================ */

/* ---- kill Frappe web chrome + container constraints ---- */
.navbar, .web-footer { display: none !important; }
.page_content,
.page-content-wrapper,
.page-container,
main.container,
.container {
  max-width: 100% !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

html { height: 100%; }
body {
  direction: rtl;
  background: #f3f6f4;
  color: #1f2937;
  font-family: 'Cairo', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#z-app { direction: rtl; min-height: 100vh; }

/* ============================ layout ============================ */

#z-side {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 230px;
  background: linear-gradient(180deg, #0e6f4f 0%, #0a5039 70%, #073d2b 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 18px 12px 14px;
  z-index: 50;
}

.z-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px 16px;
  border-bottom: 1px solid rgba(255,255,255,.15);
  margin-bottom: 14px;
}
.z-logo img { height: 42px; width: auto; background: #fff; border-radius: 10px; padding: 4px; }
.z-logo-t .a { font-size: 18px; font-weight: 800; line-height: 1.2; }
.z-logo-t .e { font-size: 11px; opacity: .8; letter-spacing: .5px; }

#z-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }

.z-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: background .15s;
}
.z-nav-item:hover { background: rgba(255,255,255,.10); color: #fff; text-decoration: none; }
.z-nav-item.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 800; }
.z-nav-item .ico { font-size: 18px; width: 24px; text-align: center; }
.z-nav-item .lb .a { display: block; line-height: 1.25; }
.z-nav-item .lb .e { display: block; font-size: 10.5px; opacity: .65; font-weight: 400; }

.z-user {
  border-top: 1px solid rgba(255,255,255,.15);
  padding: 12px 8px 2px;
  font-size: 12.5px;
}
.z-user .n { font-weight: 700; margin-bottom: 2px; word-break: break-word; }
.z-user-link { color: rgba(255,255,255,.7); font-size: 11.5px; text-decoration: none; }
.z-user-link:hover { color: #fff; text-decoration: none; }

#z-main {
  margin-right: 230px;
  padding: 22px 24px 60px;
  min-height: 100vh;
}

/* bottom tab bar — hidden on desktop */
#z-tabs { display: none; }

@media (max-width: 767px) {
  #z-side { display: none; }
  #z-main { margin-right: 0; padding: 14px 12px calc(84px + env(safe-area-inset-bottom)); }

  #z-tabs {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, #0c5f44, #073d2b);
    z-index: 60;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(0,0,0,.18);
  }
  .z-tab {
    flex: 1;
    min-height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
    border-radius: 10px;
  }
  .z-tab:hover { text-decoration: none; color: #fff; }
  .z-tab.active { color: #fff; background: rgba(255,255,255,.14); font-weight: 800; }
  .z-tab .ico { font-size: 19px; line-height: 1.1; }
}

/* ============================ cards / typography ============================ */

.card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
  padding: 16px;
  margin-bottom: 14px;
}

.z-title { font-size: 20px; font-weight: 800; color: #0e6f4f; margin: 0 0 4px; }
.z-sub { font-size: 12.5px; color: #6b7280; margin: 0 0 16px; }
.z-sec { font-size: 14px; font-weight: 800; color: #374151; margin: 0 0 10px; }

.z-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

/* ============================ KPI cards ============================ */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.kpi {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
  padding: 14px 16px;
  min-height: 42px;
}
.kpi .v { font-size: 24px; font-weight: 800; color: #0e6f4f; line-height: 1.2; direction: ltr; text-align: right; }
.kpi .l { font-size: 12px; color: #6b7280; font-weight: 600; margin-top: 3px; }
.kpi.warn .v { color: #b45309; }
.kpi.bad .v { color: #b91c1c; }

/* ============================ tables ============================ */

.zt-wrap { overflow-x: auto; border-radius: 12px; }
table.zt {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  background: #fff;
}
table.zt thead th {
  position: sticky;
  top: 0;
  background: #eaf3ef;
  color: #0a5039;
  font-weight: 800;
  font-size: 12.5px;
  text-align: right;
  padding: 11px 12px;
  border-bottom: 2px solid #cfe3da;
  white-space: nowrap;
  z-index: 2;
}
table.zt td {
  padding: 11px 12px;
  border-bottom: 1px solid #eef2f0;
  text-align: right;
  vertical-align: middle;
}
table.zt tbody tr:nth-child(even) { background: #f7faf8; }
table.zt tbody tr:hover { background: #eef7f2; }
table.zt tbody tr.clickable { cursor: pointer; }
table.zt tfoot td {
  padding: 11px 12px;
  font-weight: 800;
  background: #eaf3ef;
  border-top: 2px solid #cfe3da;
}
table.zt .num { direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }

/* ============================ status pills ============================ */

.pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}
.pill.draft { background: #e5e7eb; color: #374151; }
.pill.submitted { background: #d7efe4; color: #0a5039; }
.pill.cancelled { background: #fee2e2; color: #b91c1c; }

/* ============================ buttons ============================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: #0e6f4f;
  border: 1.5px solid #0e6f4f;
  border-radius: 11px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.btn:hover { background: #0a5039; border-color: #0a5039; color: #fff; text-decoration: none; }
.btn.ghost { background: transparent; color: #0e6f4f; }
.btn.ghost:hover { background: #ecf7f2; color: #0a5039; }
.btn.danger { background: #dc2626; border-color: #dc2626; }
.btn.danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.sm { min-height: 36px; padding: 6px 14px; font-size: 13.5px; }

/* ============================ forms ============================ */

.zlabel { display: block; font-size: 13px; font-weight: 700; color: #374151; margin: 12px 0 4px; }
.zin {
  width: 100%;
  font-size: 16px;
  font-family: inherit;
  padding: 11px 12px;
  min-height: 42px;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  color: #1f2937;
}
.zin:focus { outline: none; border-color: #0e6f4f; box-shadow: 0 0 0 3px rgba(14,111,79,.15); }
.zrow { display: flex; gap: 10px; flex-wrap: wrap; }
.zrow > div { flex: 1; min-width: 130px; }

/* filter chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
  min-height: 42px;
  padding: 8px 18px;
  font-size: 13.5px;
  font-weight: 700;
  font-family: inherit;
  color: #374151;
  background: #fff;
  border: 1.5px solid #d1d5db;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: #0e6f4f; color: #0e6f4f; }
.chip.active { background: #0e6f4f; border-color: #0e6f4f; color: #fff; }

/* ============================ bars (dashboard) ============================ */

.z-bar-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.z-bar-row .lb { flex: 0 0 130px; font-size: 13px; font-weight: 700; color: #374151; }
.z-bar-row .val { flex: 0 0 auto; font-size: 12.5px; font-weight: 700; color: #0a5039; direction: ltr; }
.z-bar { flex: 1; height: 14px; background: #e8efeb; border-radius: 999px; overflow: hidden; }
.z-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #17a374, #0e6f4f);
  border-radius: 999px;
  min-width: 3px;
  transition: width .4s ease;
}

/* ============================ toast / spinner ============================ */

#z-toasts {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
@media (max-width: 767px) {
  #z-toasts { bottom: calc(92px + env(safe-area-inset-bottom)); }
}
.z-toast {
  padding: 12px 20px;
  border-radius: 11px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(0,0,0,.22);
  animation: ztoast-in .2s ease;
  max-width: 100%;
}
.z-toast.ok { background: #0e6f4f; }
.z-toast.err { background: #dc2626; }
@keyframes ztoast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.z-spin-wrap { display: flex; justify-content: center; padding: 56px 0; }
.z-spin {
  width: 38px; height: 38px;
  border: 4px solid #d7efe4;
  border-top-color: #0e6f4f;
  border-radius: 50%;
  animation: zspin .8s linear infinite;
}
@keyframes zspin { to { transform: rotate(360deg); } }

/* ============================ misc helpers ============================ */

.z-empty { text-align: center; color: #6b7280; padding: 32px 12px; font-size: 14px; }
.z-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.muted { color: #6b7280; font-size: 12.5px; }
img { max-width: 100%; }

/* ============================================================
   Wave-1 additions (appended) — trip type badges, lifecycle
   status pills, Table|Board toggle, board columns, stepper,
   shortage→freight chain, status timeline, truck status pills.
   ============================================================ */

/* ---- trip type badges (§8.4.0 color map) ---- */
.tt {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.tt.tt-yin  { background: #dbeafe; color: #1d4ed8; } /* Yard Inbound — info blue */
.tt.tt-dout { background: #d7efe4; color: #0a5039; } /* Domestic Outbound — primary green */
.tt.tt-ext  { background: #ede9fe; color: #6d28d9; } /* External Trade — purple */
.tt.tt-exp  { background: #fef3c7; color: #b45309; } /* Export Outbound — amber */
.tt.tt-swap { background: #ccfbf1; color: #0f766e; } /* Swap In / Swap Out — teal */
.tt.tt-other { background: #e5e7eb; color: #374151; }

/* ---- trip lifecycle status pills ---- */
.ts {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.ts.ts-planned   { background: #e5e7eb; color: #374151; }
.ts.ts-assigned  { background: #dbeafe; color: #1d4ed8; }
.ts.ts-loading   { background: #fef3c7; color: #b45309; }
.ts.ts-transit   { background: #e0e7ff; color: #4338ca; }
.ts.ts-delivered { background: #ccfbf1; color: #0f766e; }
.ts.ts-completed { background: #d7efe4; color: #0a5039; }

/* ---- segmented toggle (Table | Board, Trucks | Drivers) ---- */
.z-seg {
  display: inline-flex;
  border: 1.5px solid #d1d5db;
  border-radius: 11px;
  overflow: hidden;
  background: #fff;
}
.z-seg button {
  min-height: 42px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: #374151;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.z-seg button.on { background: #0e6f4f; color: #fff; }

/* ---- trips board (one column per lifecycle status) ---- */
.z-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  align-items: flex-start;
  padding-bottom: 8px;
}
.z-board-col {
  flex: 0 0 250px;
  background: #eef2f0;
  border-radius: 12px;
  padding: 10px;
  min-height: 120px;
}
.z-board-col > .h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 800;
  color: #374151;
  margin: 0 2px 10px;
}
.z-board-col > .h .n {
  background: #fff;
  border-radius: 999px;
  font-size: 11.5px;
  padding: 1px 9px;
  color: #6b7280;
}
.z-tripcard {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 13px;
}
.z-tripcard:hover { box-shadow: 0 2px 8px rgba(0,0,0,.14); }
.z-tripcard .t {
  font-weight: 800;
  color: #0e6f4f;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: center;
}
.z-tripcard .m { color: #374151; margin: 2px 0; }
.z-tripcard .s { color: #6b7280; font-size: 12px; }

/* ---- trip status stepper ---- */
.z-stepper {
  display: flex;
  align-items: flex-start;
  overflow-x: auto;
  padding: 6px 2px 2px;
}
.z-step { flex: 1; min-width: 86px; text-align: center; position: relative; }
.z-step .dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  margin: 0 auto 6px;
  background: #e5e7eb;
  color: #6b7280;
  font-size: 12.5px;
  font-weight: 800;
  line-height: 26px;
  position: relative;
  z-index: 1;
}
.z-step .lb { font-size: 11px; font-weight: 700; color: #6b7280; line-height: 1.3; }
/* connector toward the previous step (right side in RTL) */
.z-step::before {
  content: "";
  position: absolute;
  top: 13px;
  left: 50%;
  width: 100%;
  height: 3px;
  background: #e5e7eb;
}
.z-step:first-child::before { display: none; }
.z-step.done .dot { background: #0e6f4f; color: #fff; }
.z-step.done::before, .z-step.now::before { background: #0e6f4f; }
.z-step.done .lb { color: #0a5039; }
.z-step.now .dot { background: #fff; color: #0e6f4f; box-shadow: 0 0 0 3px #0e6f4f inset; }
.z-step.now .lb { color: #0e6f4f; }

/* ---- shortage → penalty → freight chain flow ---- */
.z-chain {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.z-chain .cbox {
  background: #f7faf8;
  border: 1.5px solid #cfe3da;
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 104px;
  text-align: center;
}
.z-chain .cbox .l { font-size: 11px; color: #6b7280; font-weight: 700; margin-bottom: 2px; }
.z-chain .cbox .v {
  font-size: 14.5px;
  font-weight: 800;
  color: #0e6f4f;
  direction: ltr;
  font-variant-numeric: tabular-nums;
}
.z-chain .cbox.neg { border-color: #fecaca; background: #fef2f2; }
.z-chain .cbox.neg .v { color: #b91c1c; }
.z-chain .cbox.hl { background: #ecf7f2; border-color: #0e6f4f; }
.z-chain .cop { font-size: 17px; font-weight: 800; color: #6b7280; }

/* ---- status log timeline ---- */
.z-tl { margin: 0; padding: 0; list-style: none; }
.z-tl li { position: relative; padding: 0 22px 14px 0; }
.z-tl li::before {
  content: "";
  position: absolute;
  right: 5px; top: 6px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #0e6f4f;
}
.z-tl li::after {
  content: "";
  position: absolute;
  right: 8.5px; top: 17px; bottom: -2px;
  width: 2px;
  background: #d7efe4;
}
.z-tl li:last-child::after { display: none; }
.z-tl .w { font-size: 13.5px; font-weight: 700; color: #1f2937; }
.z-tl .m { font-size: 12px; color: #6b7280; }

/* ---- truck status pills ---- */
.tk {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.tk.tk-avail  { background: #d7efe4; color: #0a5039; } /* Available — green */
.tk.tk-ontrip { background: #dbeafe; color: #1d4ed8; } /* On Trip — blue */
.tk.tk-maint  { background: #ffedd5; color: #c2410c; } /* In Maintenance — orange */

/* ---- warning badge (license expiry ≤ 30 days) ---- */
.z-badge-warn {
  display: inline-block;
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #f59e0b;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

/* ---- per-$100 exchange-rate helper (DEVIATIONS #5) ---- */
.z-fx-hint {
  font-size: 12.5px;
  font-weight: 700;
  color: #0a5039;
  background: #ecf7f2;
  border-radius: 8px;
  padding: 6px 10px;
  margin-top: 6px;
}

/* ============================================================
   Wave 2 — sales / statement / aging (append-only)
   ============================================================ */

/* ---- async combobox (customer picker) ---- */
.z-combo { position: relative; }
.z-combo-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0; left: 0;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  max-height: 260px;
  overflow-y: auto;
  z-index: 40;
}
.z-combo-item {
  padding: 9px 12px;
  font-size: 13.5px;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
}
.z-combo-item:last-child { border-bottom: none; }
.z-combo-item:hover { background: #ecf7f2; color: #0a5039; }
.z-combo-empty { padding: 12px; font-size: 12.5px; color: #6b7280; text-align: center; }

/* ---- customer statement (spec D.6) ---- */
.stmt-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  border-bottom: 2px solid #0e6f4f;
  padding-bottom: 12px;
  margin-bottom: 14px;
}
.stmt-head img { height: 52px; width: auto; background: #fff; border-radius: 10px; padding: 4px; border: 1px solid #e5e7eb; }
.stmt-co .a { font-size: 19px; font-weight: 800; color: #0e6f4f; line-height: 1.25; }
.stmt-co .e { font-size: 11.5px; color: #6b7280; }
.stmt-meta { margin-inline-start: auto; text-align: left; }
.stmt-meta .t { font-size: 14px; font-weight: 800; color: #374151; }
.stmt-meta .c { font-size: 13px; font-weight: 700; color: #0a5039; margin-top: 2px; }
.stmt-meta .p { font-size: 12px; color: #6b7280; direction: ltr; }

.stmt-wrap { overflow-x: auto; }
table.stmt {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
table.stmt th, table.stmt td {
  border: 1px solid #d1d5db;
  padding: 6px 8px;
  text-align: center;
  white-space: nowrap;
}
table.stmt thead th {
  background: #0e6f4f;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
}
table.stmt thead th .e { font-size: 10px; font-weight: 400; opacity: .8; }
table.stmt thead th.cur { background: #0a5039; letter-spacing: .3px; }
table.stmt td.num { direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
table.stmt td.ltr { direction: ltr; }
table.stmt td.bal { font-weight: 800; background: #f6faf8; }
table.stmt td.stmt-neg { color: #b91c1c; }
table.stmt tr.stmt-open td { background: #eef2f7; font-weight: 700; color: #374151; }
table.stmt tr.stmt-total td { background: #f9fafb; font-weight: 700; }
table.stmt tr.stmt-close td { background: #d7efe4; font-weight: 800; color: #0a5039; }
table.stmt td.stmt-none { color: #6b7280; padding: 22px 8px; }

.stmt-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.stmt-closebox {
  font-size: 13.5px;
  font-weight: 700;
  color: #0a5039;
  background: #ecf7f2;
  border-radius: 10px;
  padding: 8px 14px;
}
.stmt-closebox .ltr, .stmt-closebox b { direction: ltr; unicode-bidi: embed; }
.stmt-sign { text-align: center; font-size: 12.5px; font-weight: 700; color: #374151; min-width: 180px; }
.stmt-sign .ln { border-bottom: 1.5px solid #9ca3af; height: 34px; margin-bottom: 6px; }

/* ---- lite stepper (New Sale, §8.1.5) ---- */
.stepper-lite {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}
.stepper-lite .step {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  background: #eef2f0;
  color: #6b7280;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.stepper-lite .step .n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #d1d5db;
  color: #374151;
  font-size: 11.5px;
}
.stepper-lite .step.done { background: #d7efe4; color: #0a5039; }
.stepper-lite .step.done .n { background: #0e6f4f; color: #fff; }
.stepper-lite .step.on { background: #0e6f4f; color: #fff; }
.stepper-lite .step.on .n { background: #fff; color: #0e6f4f; }
.stepper-lite .sep { color: #9ca3af; font-weight: 800; }

/* ---- aging bars ---- */
.z-bar-fill.aging-b1 { background: #0e6f4f; }
.z-bar-fill.aging-b2 { background: #f59e0b; }
.z-bar-fill.aging-b3 { background: #ea580c; }
.z-bar-fill.aging-b4 { background: #dc2626; }
td.aging-late { color: #b91c1c; font-weight: 800; }
tr.aging-row:hover td { background: #f6faf8; }

/* ---- print (customer statement & friends) ---- */
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  #z-side, #z-tabs, #z-toasts, .z-no-print, .btn { display: none !important; }
  body, #z-app, #z-main { background: #fff !important; }
  #z-main { margin: 0 !important; padding: 0 !important; max-width: none !important; }
  .card, .stmt-card {
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .stmt-wrap, .zt-wrap { overflow: visible !important; }
  table.stmt { font-size: 10.5px; }
  table.stmt th, table.stmt td { padding: 4px 5px; border-color: #000; }
  table.stmt thead th { background: #fff !important; color: #000 !important; border-color: #000; }
  table.stmt tr.stmt-close td { background: #eee !important; color: #000 !important; }
  table.stmt td.bal, table.stmt tr.stmt-open td, table.stmt tr.stmt-total td { background: #fff !important; }
  .stmt-head { border-bottom-color: #000; }
  .stmt-co .a, .stmt-meta .c { color: #000; }
}

/* ============================ wave 5 ============================ */

/* ---- language switcher (i18n, DEVIATIONS #10) ---- */
.z-langs {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.z-lang-btn {
  flex: 1;
  min-width: 38px;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,.85);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.z-lang-btn:hover { background: rgba(255,255,255,.14); color: #fff; }
.z-lang-btn.active { background: #fff; color: #0e6f4f; border-color: #fff; }

/* mobile tab bar: compact vertical stack at the end of the tabs row */
#z-tabs .z-langs {
  flex: 0 0 auto;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  margin: 0;
  padding: 0 4px;
}
#z-tabs .z-lang-btn {
  flex: 0 0 auto;
  min-width: 36px;
  min-height: 0;
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 6px;
}

/* ---- driver mobile (§7.4 / §8.4.5) ---- */
.dv-wrap { max-width: 560px; margin: 0 auto; }
.dv-card { margin-top: 14px; }
.dv-big {
  display: block;
  width: 100%;
  min-height: 56px;
  font-size: 18px;
  font-weight: 800;
  border-radius: 14px;
  margin-top: 12px;
  cursor: pointer;
}
.dv-refresh { min-height: 44px; }
.dv-pod { margin-top: 12px; padding-top: 10px; border-top: 1px dashed #d1d5db; }
.dv-pod input[type="file"] { display: block; width: 100%; font-size: 13px; }
.dv-empty { text-align: center; padding: 34px 16px; }

/* ---- trip manifest print (§8.4.4) ---- */
/* screen: never visible; print: the ONLY thing visible while body has
   .printing-manifest (views_trips.js adds/removes the class around print) */
.manifest-print {
  display: none;
  direction: rtl;
  color: #000;
  font-size: 13px;
}
.manifest-print .mp-head {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 2px solid #000;
  padding-bottom: 10px;
  margin-bottom: 16px;
}
.manifest-print .mp-logo { height: 52px; width: auto; }
.manifest-print .mp-co .a { font-size: 18px; font-weight: 800; line-height: 1.25; }
.manifest-print .mp-co .e { font-size: 10.5px; color: #333; letter-spacing: .5px; }
.manifest-print .mp-title { margin-inline-start: auto; text-align: center; }
.manifest-print .mp-title .t { font-size: 16px; font-weight: 800; }
.manifest-print .mp-title .m { font-size: 12px; color: #333; direction: ltr; }
.manifest-print table.mp { width: 100%; border-collapse: collapse; margin-bottom: 26px; }
.manifest-print table.mp th,
.manifest-print table.mp td {
  border: 1px solid #000;
  padding: 7px 10px;
  font-size: 13px;
  text-align: right;
  vertical-align: middle;
}
.manifest-print table.mp th { width: 34%; background: #eee; font-weight: 700; }
.manifest-print .mp-route { font-weight: 700; }
.manifest-print .mp-signs {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 36px;
}
.manifest-print .mp-sign { flex: 1; text-align: center; font-size: 12.5px; font-weight: 700; }
.manifest-print .mp-sign .ln { border-bottom: 1.5px solid #000; height: 46px; margin-bottom: 6px; }

/* manifest prefers portrait; falls back to the global @page where named
   pages are unsupported */
@page manifest { size: A4 portrait; margin: 14mm; }

@media print {
  body.printing-manifest #z-side,
  body.printing-manifest #z-tabs,
  body.printing-manifest #z-main,
  body.printing-manifest #z-app,
  body.printing-manifest #z-toasts { display: none !important; }
  body.printing-manifest .manifest-print {
    display: block !important;
    page: manifest;
  }
  body.printing-manifest { background: #fff !important; }
  .manifest-print table.mp th { background: #eee !important; }
}

/* ---- wave-5 audit fix: honor the dir set by core.js boot ----
   body/#z-app default to rtl above; when the language switcher picks
   English, boot() sets <html dir="ltr" lang="en"> and these overrides
   let the content direction actually flip (sidebar stays physically
   right-fixed — pragmatic i18n, DEVIATIONS #10). */
html[dir="ltr"] body { direction: ltr; }
html[dir="ltr"] #z-app { direction: ltr; }
