/* Bundled free Persian font (Vazirmatn — OFL, the maintained successor to the
   Vakil family by the same author). Falls back to Tahoma if the user removes it. */
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel2: #eef1f8;
  --line: #d8deea;
  --txt: #1f2533;
  --muted: #6b7385;
  --accent: #3b6bff;
  --accent2: #0ea5a0;
  --danger: #e23744;
  --ok: #1aa260;
  --warn: #c98a00;
  --shadow: 0 1px 3px rgba(20, 30, 60, 0.08), 0 4px 16px rgba(20, 30, 60, 0.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Vazirmatn, Tahoma, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--txt);
  font-size: 14px;
}
.hidden { display: none !important; }
.ltr { direction: ltr; text-align: left; }
button {
  font-family: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
}
button:hover { filter: brightness(0.96); }
button.secondary { background: var(--panel2); color: var(--txt); border: 1px solid var(--line); }
button.danger { background: var(--danger); }
button.ghost { background: transparent; color: var(--muted); }
button:disabled { opacity: 0.5; cursor: default; }
input, select, textarea {
  font-family: inherit;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--txt);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(59, 107, 255, 0.35); border-color: var(--accent); }
input.invalid, select.invalid, textarea.invalid { border-color: var(--danger); outline-color: rgba(226, 55, 68, 0.3); }
/* lighter placeholder so it doesn't read like real entered text */
input::placeholder, textarea::placeholder { color: #b6bdcc; opacity: 1; }
.err { color: var(--danger); min-height: 18px; margin-top: 6px; }
.field-err { color: var(--danger); font-size: 11px; min-height: 14px; }

/* Login */
.login-wrap { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-card {
  background: var(--panel);
  padding: 32px;
  border-radius: 16px;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.login-card h1 { font-size: 20px; margin: 0; }
.login-card .sub { color: var(--muted); margin: 0 0 8px; font-size: 12px; }
.login-card input { direction: ltr; text-align: left; }

/* Shell */
#app { display: flex; height: 100vh; }
.sidebar {
  width: 210px;
  background: var(--panel);
  border-inline-start: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 4px;
  box-shadow: var(--shadow);
}
.brand { font-size: 18px; font-weight: 700; padding: 8px 12px 16px; color: var(--accent); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 8px;
}
.sidebar nav a:hover { background: var(--panel2); color: var(--txt); }
.sidebar nav a.active { background: var(--accent); color: #fff; }
/* Blocked-license: waybills item stays visible but looks/acts disabled. */
.sidebar nav a.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.logout { background: var(--panel2); color: var(--txt); border: 1px solid var(--line); }
/* `position: relative` so the queue page's draggable STOP/START button can be
   absolutely positioned in the SCROLLED CONTENT (it scrolls with the page). */
main { flex: 1; overflow: auto; padding: 24px 28px; position: relative; }

/* Page header */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: 22px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Table */
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
th, td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); }
th { background: var(--panel2); color: var(--muted); font-weight: 600; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fafbff; }
td .row-actions { display: flex; gap: 6px; }
td .row-actions button { padding: 5px 10px; font-size: 12px; }
td.num, th.num { direction: ltr; text-align: left; }
.empty { color: var(--muted); padding: 30px; text-align: center; }

/* Form grid in modal */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { color: var(--muted); font-size: 12px; }
.field input.ltr, .field select.ltr { direction: ltr; text-align: left; }
.req-star { color: var(--danger); }
/* Plate displayed as a single RTL chunk, e.g. «39ع488ایران42». */
.plate { direction: rtl; unicode-bidi: isolate; white-space: nowrap; font-feature-settings: "ss01"; }
.field.inline-check { flex-direction: row; align-items: center; gap: 8px; }
.field.inline-check label { font-size: 14px; color: var(--txt); }
.field.inline-check input { width: auto; }
.modal-actions { display: flex; justify-content: flex-start; gap: 8px; margin-top: 18px; }

/* Live plate-shape preview (vehicle create/edit modal, bottom of form) */
.field.custom-field { display: block; }
.plate-preview-wrap { margin-top: 4px; }
.plate-preview-label { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.plate-preview {
  display: flex; align-items: stretch; direction: ltr;
  border: 2px solid #1f2533; border-radius: 10px; overflow: hidden;
  background: #fff; width: fit-content; box-shadow: var(--shadow);
}
.pp-flag {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #239f40 0 33%, #fff 33% 67%, #da0000 67% 100%);
  color: #1f2533; padding: 4px 8px; gap: 1px;
  border-inline-end: 2px solid #1f2533;
}
.pp-flag-ir { font-size: 12px; font-weight: 700; line-height: 1; }
.pp-flag-fa { font-size: 9px; line-height: 1; }
.pp-box {
  position: relative; min-width: 46px; display: flex; align-items: center; justify-content: center;
  padding: 10px 10px; border-inline-end: 1px solid var(--line);
  font-size: 20px; font-weight: 700; direction: ltr;
}
.pp-char { font-size: 17px; }
.pp-val { position: relative; z-index: 1; }
.pp-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #d8deea; }
.pp-box.pp-filled .pp-ph { display: none; }
.pp-sep { width: 10px; display: flex; align-items: center; justify-content: center; }
.pp-sep::before { content: ''; width: 2px; height: 55%; background: var(--line); margin: auto; }
.pp-city-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px 10px; gap: 2px; }
.pp-city-label { color: var(--muted); font-size: 10px; }
.pp-city-wrap .pp-box { min-width: 34px; padding: 2px 6px; font-size: 16px; border-inline-end: 0; }

/* Working-hours settings section */
.work-hours { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; }
.work-hours h3 { margin: 0 0 10px; font-size: 15px; }
.work-hours .form-grid { margin-top: 12px; }
.days-row { display: flex; flex-wrap: wrap; gap: 12px; }
.day-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--txt); cursor: pointer; }
.day-check input { width: auto; }

/* dual-listbox (bulk-create driver picker) */
.dual-list { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.dual-col { display: flex; flex-direction: column; gap: 6px; }
.dual-col label { color: var(--muted); font-size: 12px; }
.dual-col select { height: auto; }
.dual-col button { margin-top: 4px; }
.dual-list-search { margin-bottom: 2px; }

/* search-select: a text input standing in for a <select>, matching driver (or
   other) names by substring anywhere in the label as the operator types. */
.search-select { position: relative; }
.search-select-list {
  position: absolute; z-index: 40; top: 100%; inset-inline: 0; margin-top: 4px;
  max-height: 240px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: var(--shadow, 0 8px 24px rgba(20, 30, 60, .18));
}
.search-select-list.hidden { display: none; }
.search-select-item { padding: 8px 10px; cursor: pointer; font-size: 14px; }
.search-select-item:hover, .search-select-item.active { background: var(--panel2); }
.search-select-empty { padding: 8px 10px; color: var(--muted); font-size: 13px; }
.search-select.invalid .search-select-input { border-color: var(--danger); outline-color: rgba(226, 55, 68, 0.3); }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(20, 30, 60, 0.35); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-back-2 { z-index: 60; background: rgba(20, 30, 60, 0.45); }
.modal { background: var(--panel); border-radius: 16px; width: min(720px, 94vw); max-height: 90vh; overflow: auto; border: 1px solid var(--line); box-shadow: 0 12px 48px rgba(20, 30, 60, 0.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); font-size: 17px; font-weight: 700; }
.modal-head button { background: transparent; color: var(--muted); font-size: 22px; padding: 0 6px; }
.modal-body { padding: 20px; }

/* Badges */
.badge { padding: 3px 9px; border-radius: 20px; font-size: 12px; }
.badge.pending { background: #e7ebf3; color: var(--muted); }
.badge.issuing { background: #fff4d6; color: var(--warn); }
.badge.issued { background: #d8f3e3; color: var(--ok); }
.badge.error { background: #fde0e3; color: var(--danger); }

/* Issue progress console */
.console { background: #0f1420; color: #d7e0f0; border: 1px solid var(--line); border-radius: 10px; padding: 12px; height: 220px; overflow: auto; font-family: Consolas, monospace; font-size: 12px; direction: ltr; text-align: left; }
.console .ok { color: #4ade80; }
.console .bad { color: #ff7a85; }
.console .info { color: #9aa3c4; }

/* Logs page: date listbox on the side + the day's log text. */
.logs-layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.logs-dates { display: flex; flex-direction: column; gap: 6px; }
.logs-dates label { color: var(--muted); font-size: 12px; }
.logs-dates select { height: auto; }
.log-view { background: #0f1420; color: #d7e0f0; border: 1px solid var(--line); border-radius: 10px; padding: 12px; height: 70vh; overflow: auto; font-family: Consolas, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-word; margin: 0; }
@media (max-width: 720px) { .logs-layout { grid-template-columns: 1fr; } .log-view { height: 50vh; } }

/* checkbox cells */
td.check, th.check { width: 34px; text-align: center; }
input[type="checkbox"] { width: auto; }

/* waybills table: compact date + merged sender/receiver cell */
td.wb-date { font-size: 11px; white-space: nowrap; }
td.wb-contacts { font-size: 7pt; line-height: 1.5; }
.wb-code { display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-code.copyable { cursor: pointer; }
.wb-code.copyable:hover { text-decoration: underline; }
.wb-code.copied { color: var(--ok); }

/* table pagination */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
.pager button[disabled] { opacity: 0.5; cursor: default; }
.pager-info { color: var(--muted); font-size: 12px; }

/* map modal */
#mapPick { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
/* Mapbox GL controls are LTR widgets; keep them positioned correctly in the RTL modal. */
#mapPick .mapboxgl-ctrl-group { direction: ltr; }
.map-note { color: var(--muted); font-size: 12px; margin: 8px 0; }

/* jalali datepicker */
.jdp { position: relative; }
.jdp-cal { position: absolute; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; width: 240px; top: 100%; margin-top: 4px; box-shadow: var(--shadow); }
.jdp-cal .jdp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.jdp-cal .jdp-head button { padding: 2px 8px; background: var(--panel2); color: var(--txt); }
.jdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.jdp-grid span { text-align: center; color: var(--muted); font-size: 11px; padding: 3px 0; }
.jdp-grid button { background: transparent; color: var(--txt); padding: 6px 0; border-radius: 6px; font-size: 12px; }
.jdp-grid button:hover { background: var(--panel2); }
.jdp-grid button.today { outline: 1px solid var(--accent2); }
.jdp-grid button.sel { background: var(--accent); color: #fff; }
.pill-info { color: var(--muted); font-size: 12px; margin-bottom: 8px; }

/* Auto-launch countdown pinned to the bottom of the waybills page. */
.auto-countdown {
  position: sticky;
  bottom: 0;
  margin-top: 16px;
  width: 50%;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  font-size: 13px;
}
.auto-countdown .ac-icon { font-size: 16px; line-height: 1; }
.auto-countdown .ac-text { font-variant-numeric: tabular-nums; }
/* Push Start/Stop to the trailing edge of the bar. */
.auto-countdown .ac-actions { margin-inline-start: auto; display: flex; gap: 8px; }
.auto-countdown .ac-actions button { padding: 6px 14px; }
.auto-countdown .ac-actions button:disabled { opacity: 0.5; cursor: default; }
/* live = a launch is scheduled / imminent; hold = due but blocked; off = disabled/unconfigured. */
.auto-countdown.ac-live { border-color: var(--accent2); color: var(--accent2); }
.auto-countdown.ac-hold { border-color: var(--warn); color: var(--warn); }
.auto-countdown.ac-off { color: var(--muted); }

/* ---- mobile-method captcha modal (app-wide, over everything) ---- */
.wbm-cap-overlay {
  position: fixed; inset: 0; z-index: 2147483000;
  background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center;
  direction: rtl; font-family: inherit;
}
.wbm-cap-box {
  position: relative;
  background: var(--card, #fff); color: var(--text, #111);
  border-radius: 14px; padding: 22px; width: min(92vw, 420px);
  box-shadow: 0 16px 50px rgba(0,0,0,.45); text-align: center;
}
.wbm-cap-close {
  position: absolute; top: 8px; left: 8px;
  width: 32px; height: 32px; line-height: 1; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; cursor: pointer;
  background: transparent; color: inherit; opacity: .55;
  font-size: 1.5rem; font-family: inherit;
}
.wbm-cap-close:hover { opacity: 1; background: rgba(128,128,128,.15); }
.wbm-cap-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 6px; }
.wbm-cap-help { font-size: .85rem; opacity: .75; margin-bottom: 14px; }
.wbm-cap-img {
  width: 100%; max-width: 320px; image-rendering: pixelated;
  background: #fff; border: 1px solid rgba(128,128,128,.35); border-radius: 8px; padding: 6px;
}
.wbm-cap-input {
  width: 100%; margin-top: 14px; padding: 12px; font-size: 1.4rem; text-align: center;
  letter-spacing: .15em; border: 1px solid var(--border, #ccc); border-radius: 8px;
  background: var(--input-bg, #fff); color: inherit; box-sizing: border-box;
}
.wbm-cap-err { color: var(--warn, #c0392b); font-size: .82rem; min-height: 1.1em; margin-top: 6px; }
.wbm-cap-actions { margin-top: 12px; }
.wbm-cap-btn {
  background: var(--accent, #3b6bff); color: #fff; border: 0; border-radius: 8px;
  padding: 10px 22px; font-size: 1rem; cursor: pointer; font-family: inherit;
}
.wbm-cap-btn:disabled { opacity: .6; cursor: default; }

/* ---- icon row-action buttons (edit / delete) --------------------------- */
td .row-actions button.icon-btn { padding: 5px 8px; line-height: 0; }
.icon-btn svg { display: block; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; }

/* ---- weekly-plan widget presets --------------------------------------- */
.plan-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.plan-presets button { padding: 4px 12px; font-size: 12px; }

/* ---- grouped waybills table (driver master / waybill detail) ---------- */
.wb-grouped .group-row { cursor: pointer; background: var(--panel2); }
.wb-grouped .group-row:hover { background: #eef2fb; }
.wb-grouped .group-row td { border-top: 1px solid var(--line); font-weight: 600; }
.group-driver { display: flex; align-items: center; gap: 8px; }
.group-toggle {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  font-size: 13px; padding: 0 4px; line-height: 1;
}
.gd-name { color: var(--txt); }
.gd-count { color: var(--muted); font-weight: 400; font-size: 12px; }
.wb-progress { font-variant-numeric: tabular-nums; font-weight: 600; }
.wb-grouped .detail-row td { background: var(--panel, #fff); font-weight: 400; }
.wb-grouped .detail-row .wb-sub { color: var(--muted); }
.wb-grouped .detail-row .wb-id { color: var(--accent); font-weight: 600; }
/* a disabled waybill: greyed out + a small "off" tag; still visible/editable. */
.wb-grouped .detail-row.wb-disabled td { opacity: .5; }
.wb-grouped .detail-row.wb-disabled .row-actions { opacity: 1; }
.wb-off-tag { display: inline-block; margin-inline-start: 6px; padding: 1px 7px; border-radius: 20px;
  font-size: 11px; background: #fde0e3; color: var(--danger); font-weight: 600; }
/* پیمایش opted-in marker — this waybill auto-registers start/end of shipment
   after issuing, which shortens its driver's next-issue gap. */
.wb-pm-tag { display: inline-block; margin-inline-start: 6px; padding: 1px 7px; border-radius: 20px;
  font-size: 11px; background: #dcfce7; color: #15803d; font-weight: 600; }

/* ---- issue-queue page ------------------------------------------------- */
/* Driver name on the queue page when that waybill has پیمایش ticked. Keyed on
   the per-waybill opt-in only — NOT on whether the last shipment succeeded. */
.q-drv-pm { color: #15803d; font-weight: 700; }
/* "!" next to a driver who shares his mobile number (spacing on purpose). Soft amber. */
.q-phone-warn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; margin-inline-start: 6px; vertical-align: middle;
  border-radius: 50%; border: 1px solid #f5d48a; background: #fdf6e3; color: #b7791f;
  font-size: 10px; font-weight: 700; line-height: 1; cursor: help;
}
.q-phone-warn.active { background: #fbe7b5; border-color: #e9b949; }
/* highlight the whole row on hover (stronger than the global tr:hover) */
.queue-table tbody tr:hover td { background: #eef2ff; }
.queue-table .queue-processing td { background: #fff4d6; box-shadow: inset 3px 0 0 var(--warn); }
/* keep the processing row's amber tint even while hovered */
.queue-table .queue-processing:hover td { background: #ffedc2; }
.icon-btn.ok { background: var(--ok); color: #fff; border: 0; }
.icon-btn.ok:hover { filter: brightness(0.95); }
.icon-btn.info { background: var(--accent); color: #fff; border: 0; }
.icon-btn.info:hover { filter: brightness(0.95); }
/* «زمان دقیق» — pin the next processing time to an exact HH:MM */
.icon-btn.pin { background: var(--warn); color: #fff; border: 0; }
.icon-btn.pin:hover { filter: brightness(0.95); }
.badge.pinned { background: #fff1cc; color: #8a5d00; margin-inline-start: 4px; }
/* spinning refresh icon while a fetch/inquire job runs */
.icon-btn.spin svg { animation: q-spin 0.9s linear infinite; }
@keyframes q-spin { to { transform: rotate(360deg); } }
.queue-table td .row-actions button[disabled] { opacity: .35; cursor: default; }
/* ---- STOP/START toggle (queue page) -----------------------------------
   A plain toolbar button sitting next to «بروزرسانی»: metrics deliberately mirror
   `button` + `.secondary` (same radius, padding, font-size, and a transparent 1px
   border so both boxes are the same height), and it SCROLLS AWAY with the page like
   any other content — it is NOT viewport-fixed. Dragging it adds `.placed`, which
   positions it absolutely inside `main`'s SCROLLED CONTENT, so a parked button
   still scrolls with the page instead of hovering over the table. Red = the
   scheduler is running (press to STOP), green = it's off (press to START),
   grey+spinner = a stop is unwinding (disabled). */
.queue-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border: 1px solid transparent; border-radius: 8px; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: normal; color: #fff;
  background: var(--danger);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
/* dragged out of the toolbar → laid out in main's scrolled content */
.queue-toggle.placed { position: absolute; z-index: 20; cursor: grab; box-shadow: 0 2px 8px rgba(15, 20, 35, .18); }
.queue-toggle:hover { filter: brightness(0.96); }
.queue-toggle.dragging { cursor: grabbing; box-shadow: 0 8px 22px rgba(15, 20, 35, .34); }
.queue-toggle.is-stop { background: var(--danger); }
.queue-toggle.is-start { background: var(--ok); }
.queue-toggle.is-busy { background: var(--muted); cursor: default; opacity: .95; }
.queue-toggle:disabled { opacity: .95; cursor: default; }
.queue-toggle .qt-ico { display: inline-flex; }
.queue-toggle.is-busy .qt-ico svg { animation: q-spin 0.9s linear infinite; }

.queue-removed { margin-top: 22px; }
.queue-removed h3 { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.queue-removed .detail-row td { color: var(--muted); }

/* ---- waybills control bar (search + actions) -------------------------- */
.wb-controls { display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.search-bar, .action-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-bar input, .search-bar select { width: auto; }
.search-bar #wbSearchDate { width: 160px; }
.search-bar select { width: 150px; }
.search-bar #wbSearchDriver { width: 200px; }
.action-bar .icon-btn { padding: 8px 12px; }
/* generic resource-page quick search (e.g. vehicles → by driver name) */
.resource-search { width: 280px; max-width: 100%; margin-bottom: 12px; }

/* ---- hamburger + off-canvas drawer (desktop: hidden) ------------------ */
.hamburger { display: none; }
.nav-backdrop { display: none; }


/* ---- provider-error policy table (Settings → «مدیریت خطاهای سامانه») ----
   The error text is long Persian prose and MUST wrap (the mobile rule below
   sets nowrap on every #view table, which would turn each row into a single
   unreadable line), while the three number boxes stay narrow and LTR. */
.err-policy { table-layout: auto; margin-top: 4px; }
.err-policy th.th-tip { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }
.err-policy td, .err-policy th { vertical-align: top; white-space: normal; }
.err-policy td:first-child { max-width: 620px; }
.err-policy td:nth-child(2) { white-space: nowrap; }
.err-policy .err-label { font-weight: 600; margin-bottom: 3px; }
.err-policy .err-msg { font-size: 12px; line-height: 1.7; color: var(--text, #1f2430); }
.err-policy .err-hint { font-size: 11px; line-height: 1.7; color: var(--muted); margin-top: 4px; }
.err-policy input.num { width: 92px; text-align: center; }
.err-policy input[readonly] { background: var(--panel2); color: var(--muted); cursor: not-allowed; }
@media (max-width: 900px) {
  /* keep the text column readable when the table starts scrolling horizontally */
  #view table.err-policy { white-space: normal; }
  .err-policy td:first-child { min-width: 260px; }
}

@media (max-width: 820px) {
  .hamburger {
    display: inline-flex; align-items: center; justify-content: center;
    position: fixed; top: 10px; inset-inline-start: 10px; z-index: 60;
    width: 42px; height: 42px; font-size: 20px; border-radius: 10px;
    background: var(--panel); color: var(--accent); border: 1px solid var(--line);
    box-shadow: var(--shadow); padding: 0;
  }
  .sidebar {
    position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: 240px;
    transform: translateX(100%); transition: transform .22s ease; z-index: 70;
  }
  #app.nav-open .sidebar { transform: translateX(0); }
  .nav-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(15, 20, 35, .45);
    z-index: 65; opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  #app.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  main { padding: 64px 14px 18px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .wb-controls { flex-direction: column; align-items: stretch; }
  .search-bar, .action-bar { flex-wrap: wrap; }
  .search-bar #wbSearchDate, .search-bar select { flex: 1; min-width: 130px; }
  /* wide tables scroll horizontally instead of breaking the layout */
  #view table { display: block; overflow-x: auto; white-space: nowrap; }
}
