/* ==========================================================================
   فنّي (Fanni) — Industrial / Operations-control-room design system
   يُحمَّل بعد ../../../shared/css/base.css ويعيد تعريف ما يلزم.
   الهوية: كحلي عميق للقضبان والرؤوس · أصفر إشارة للإجراءات · برتقالي سلامة للعاجل
           سماوي "في الطريق" · أخضر للمكتمل · رمادي بارد للخلفية · زوايا شبه مربعة.
   ========================================================================== */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap");

:root {
  --navy: #0b1b33; --navy-2: #0f2342; --steel: #12284a; --steel-2: #1b355e; --steel-3: #27497a;
  --yellow: #ffc928; --yellow-2: #f2b705; --yellow-soft: #fff5d1;
  --orange: #ff7a1a; --orange-soft: #ffeadb;
  --cyan: #22b8cf; --cyan-soft: #dcf5f9;
  --green: #2fbf71; --green-soft: #dcf6e8;
  --red: #e5484d; --red-soft: #fde4e4;
  --violet: #a78bfa; --blue: #7aa2ff; --blue-soft: #e5ecff;

  --brand: var(--yellow); --brand-600: var(--yellow-2); --brand-soft: var(--yellow-soft);
  --bg: #eef1f5; --surface: #ffffff; --surface-2: #f5f7fa; --surface-3: #e9edf3;
  --border: #d5dbe3; --border-2: #e5e9ef;
  --text: #0e1a2b; --text-2: #4f5f76; --muted: #8a97ab;
  --success: var(--green); --warning: var(--orange); --danger: var(--red); --info: var(--cyan);

  --radius-sm: 3px; --radius: 5px; --radius-lg: 6px;
  --shadow-sm: 0 1px 0 rgba(11, 27, 51, .04);
  --shadow: 0 2px 8px rgba(11, 27, 51, .08);
  --shadow-lg: 0 18px 50px rgba(11, 27, 51, .28);
  --font: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --rail: 64px; --sb-h: 58px;
}

body { font-family: var(--font); font-size: 14px; line-height: 1.55; background: var(--bg); color: var(--text); }
a { color: var(--steel-3); }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: 0; }
.mono, .num { font-family: var(--mono); font-feature-settings: "tnum" 1; letter-spacing: -.01em; }
.num { text-align: left; direction: ltr; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.text-2 { color: var(--text-2); } .text-muted { color: var(--muted); }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.hide { display: none !important; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* ---------------------------------------------------------------- Buttons */
.btn { border-radius: var(--radius-sm); padding: 8px 14px; font-size: 13.5px; font-weight: 600; border: 1px solid transparent; gap: 7px; line-height: 1.3; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--yellow); color: #0b1b33; border-color: #e8b10b; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12); }
.btn-primary:hover { background: #ffd451; color: #0b1b33; }
.btn-dark { background: var(--navy); color: #fff; }
.btn-dark:hover { background: var(--steel-2); }
.btn-cyan { background: var(--cyan); color: #04212a; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #cf3338; }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--navy); color: var(--navy); background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-ghost.danger, .btn.danger { color: var(--red); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-xs { padding: 4px 8px; font-size: 12px; gap: 4px; }
.btn-xs svg { width: 13px; height: 13px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled, .btn.is-locked, .is-locked { opacity: .5; cursor: not-allowed; }
.btn-icon, .icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: inherit; cursor: pointer; position: relative; }
.btn-icon:hover { background: var(--surface-3); }
.btn-icon svg, .icon-btn svg { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- Desktop shell: icon rail + status bar */
body.shell-desk { padding-right: var(--rail); min-height: 100vh; }
.rail { position: fixed; inset: 0 0 0 auto; width: var(--rail); background: var(--navy); color: #c5d0e2; display: flex; flex-direction: column; align-items: stretch; z-index: 60; border-left: 1px solid #000; }
.rail-brand { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px 0 10px; color: #fff; font-weight: 700; font-size: 12px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.rail-brand svg { width: 34px; height: 34px; }
.brand-logo { display: block; object-fit: contain; flex: 0 0 auto; }
.rail-brand .brand-logo { width: 38px; height: 38px; background: #fff; padding: 3px; border-radius: 6px; }
.rail-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 8px 0; overflow-y: auto; scrollbar-width: none; }
.rail-link { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px 8px; color: #93a3bd; font-size: 10.5px; font-weight: 500; line-height: 1.2; text-align: center; background: none; border: 0; cursor: pointer; font-family: inherit; width: 100%; }
.rail-link svg { width: 20px; height: 20px; stroke-width: 1.8; }
.rail-link:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.rail-link.active { color: var(--yellow); background: linear-gradient(270deg, rgba(255, 201, 40, .16), transparent); }
.rail-link.active::before { content: ""; position: absolute; right: 0; top: 6px; bottom: 6px; width: 3px; background: var(--yellow); }
.rail-count { position: absolute; top: 4px; left: 9px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 2px; background: var(--orange); color: #111; font-size: 10px; line-height: 17px; font-weight: 600; }
.rail-foot { border-top: 1px solid rgba(255, 255, 255, .08); padding: 6px 0 10px; display: flex; flex-direction: column; align-items: center; }
.rail-by { display: grid; place-items: center; padding: 8px 0 0; opacity: .6; }
.rail-by:hover { opacity: 1; }
.rail-by img { width: 26px; height: 26px; object-fit: contain; filter: brightness(0) invert(1); }

.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.statusbar { position: sticky; top: 0; z-index: 50; min-height: var(--sb-h); background: var(--steel); color: #e6edf8; display: flex; align-items: center; gap: 16px; padding: 0 18px; border-bottom: 2px solid var(--yellow); }
.sb-id { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.sb-co { font-size: 12px; color: #8ea3c4; white-space: nowrap; }
.sb-co em { font-style: normal; color: #4c6a96; margin-inline-start: 4px; }
.sb-id h1 { font-size: 17px; margin: 0; color: #fff; white-space: nowrap; }
.sb-counters { display: flex; gap: 6px; margin-inline-start: auto; overflow-x: auto; scrollbar-width: none; }
.sb-ctr { display: flex; align-items: center; gap: 7px; padding: 5px 10px; background: rgba(0, 0, 0, .22); border: 1px solid rgba(255, 255, 255, .08); border-radius: var(--radius-sm); color: #c9d5e8; white-space: nowrap; }
a.sb-ctr:hover { border-color: rgba(255, 255, 255, .25); color: #fff; }
.sb-ctr b { font-size: 17px; color: #fff; font-weight: 600; }
.sb-ctr small { font-size: 11.5px; }
.led { width: 8px; height: 8px; border-radius: 50%; background: var(--c, #8a97ab); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, #8a97ab) 25%, transparent), 0 0 8px var(--c, #8a97ab); }
.c-green { --c: var(--green); } .c-cyan { --c: var(--cyan); } .c-yellow { --c: var(--yellow); } .c-orange { --c: var(--orange); } .c-red { --c: var(--red); }
.sb-ctr.c-red b { color: #ff9b9e; }
.sb-ctr.blink .led { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }
.sb-clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; padding-inline: 12px; border-inline: 1px solid rgba(255, 255, 255, .1); }
.sb-clock b { font-size: 18px; color: var(--yellow); font-weight: 500; }
.sb-clock small { font-size: 11px; color: #8ea3c4; white-space: nowrap; }
.live { color: var(--green); } .live i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-inline-end: 4px; animation: blink 1.4s infinite; }
.sb-actions { display: flex; align-items: center; gap: 4px; }
.statusbar .icon-btn { color: #c9d5e8; }
.statusbar .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.dot-count { position: absolute; top: 3px; left: 3px; min-width: 16px; height: 16px; border-radius: 2px; background: var(--orange); color: #111; font-size: 10px; font-weight: 700; display: grid; place-items: center; font-family: var(--mono); }
.user-btn { display: flex; align-items: center; gap: 8px; background: none; border: 0; color: inherit; cursor: pointer; padding: 4px 6px; border-radius: var(--radius-sm); font-family: inherit; text-align: right; }
.user-btn:hover { background: rgba(255, 255, 255, .08); }
.user-btn .meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-btn .meta b { font-size: 13px; } .user-btn .meta small { font-size: 11px; color: #8ea3c4; }
.user-btn > svg { width: 14px; height: 14px; opacity: .6; }
.content { flex: 1; padding: 20px; min-width: 0; }
.app-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 20px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--border); background: var(--surface); }
.app-foot a { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.app-foot img { width: 16px; height: 16px; object-fit: contain; }
.app-foot .sep { color: var(--border); }

/* Dropdowns & notifications */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 8px); left: 0; min-width: 250px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 80; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu .item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); font: inherit; font-size: 13px; background: none; border: 0; cursor: pointer; text-align: right; }
.dropdown-menu a:hover, .dropdown-menu .item:hover { background: var(--surface-2); }
.dropdown-menu svg { width: 16px; height: 16px; color: var(--text-2); }
.dropdown-menu .danger, .dropdown-menu .danger svg { color: var(--red); }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--border-2); margin: 6px 0; }
.dropdown-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px 10px; border-bottom: 1px solid var(--border-2); margin-bottom: 6px; }
.notif-menu { width: 340px; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { align-items: flex-start !important; }
.notif-item.unread { background: var(--yellow-soft); }
.notif-item b { display: block; font-size: 13px; } .notif-item p { margin: 0; font-size: 12px; color: var(--text-2); } .notif-item small { font-size: 11px; color: var(--muted); }
.n-ic { flex: 0 0 30px; height: 30px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--surface-3); }
.n-ic.n-danger { background: var(--red-soft); color: var(--red); } .n-ic.n-warning { background: var(--orange-soft); color: var(--orange); } .n-ic.n-info { background: var(--cyan-soft); color: #0e7f91; } .n-ic.n-success { background: var(--green-soft); color: #198a4f; }
.n-ic svg { width: 15px !important; height: 15px !important; color: inherit !important; }
.search-empty { padding: 20px; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------------- Page head, cards, panels */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h2 { margin: 0; font-size: 20px; }
.page-head p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border-2); }
.card-head h3 { margin: 0; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.card-head h3 svg { width: 16px; height: 16px; color: var(--steel-3); }
.card-head .kicker { margin-inline-start: auto; }
.card-body { padding: 14px; }
.card-body.flush { padding: 0; }
.panel-dark { background: var(--navy); color: #d6e0f0; border-color: #000; }
.panel-dark .card-head { border-color: rgba(255, 255, 255, .08); }
.panel-dark .card-head h3 { color: #fff; } .panel-dark .card-head h3 svg { color: var(--yellow); }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 190px; }
.hazard { background: repeating-linear-gradient(-45deg, var(--yellow) 0 10px, var(--navy) 10px 20px); height: 6px; }

/* KPI instrument tiles */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--k, var(--muted)); }
a.kpi:hover { border-color: var(--navy); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-top small { font-size: 12px; color: var(--text-2); font-weight: 500; }
.kpi-top svg { width: 17px; height: 17px; color: var(--k, var(--muted)); }
.kpi-v { font-size: 26px; font-weight: 500; line-height: 1.15; }
.kpi-v em { font-style: normal; font-size: 13px; color: var(--muted); margin-inline-start: 4px; font-family: var(--font); }
.kpi-foot { font-size: 11.5px; color: var(--muted); }
.kpi-foot .up { color: #198a4f; } .kpi-foot .down { color: var(--red); }
.kpi-spark { position: absolute; left: 12px; bottom: 10px; color: var(--k); opacity: .7; }
.k-yellow { --k: var(--yellow-2); } .k-cyan { --k: var(--cyan); } .k-green { --k: var(--green); } .k-orange { --k: var(--orange); } .k-red { --k: var(--red); } .k-steel { --k: var(--steel-3); } .k-blue { --k: var(--blue); }

/* ---------------------------------------------------------------- Badges, chips */
.badge { border-radius: 2px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; gap: 5px; white-space: nowrap; background: var(--surface-3); color: var(--text-2); line-height: 1.5; }
.badge svg { width: 12px; height: 12px; }
.b-green { background: var(--green-soft); color: #157a45; } .b-yellow { background: var(--yellow-soft); color: #8a6300; } .b-red { background: var(--red-soft); color: #b8262b; }
.b-orange { background: var(--orange-soft); color: #b44f05; } .b-cyan { background: var(--cyan-soft); color: #0b6f7f; } .b-blue { background: var(--blue-soft); color: #2d4fb0; } .b-steel { background: var(--surface-3); color: var(--text-2); }
.b-navy { background: var(--navy); color: #fff; }
.badge.st, .badge.ts { background: color-mix(in srgb, var(--c) 14%, #fff); color: color-mix(in srgb, var(--c) 70%, #0b1b33); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.prio { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 2px; letter-spacing: .02em; white-space: nowrap; }
.prio svg { width: 12px; height: 12px; }
.prio-normal { background: var(--surface-3); color: var(--text-2); }
.prio-urgent { background: var(--orange); color: #1a0a00; }
.prio-emergency { background: var(--red); color: #fff; animation: prioPulse 1.6s ease-in-out infinite; }
@keyframes prioPulse { 50% { box-shadow: 0 0 0 4px rgba(229, 72, 77, .25); } }
.skills { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.skill { font-size: 10.5px; padding: 0 6px; border: 1px solid var(--border); border-radius: 2px; color: var(--text-2); background: var(--surface); white-space: nowrap; }
.sk-ac { border-color: #9be2ec; } .sk-hvac { border-color: #b9cbff; } .sk-elec { border-color: #ffe08a; } .sk-plumb { border-color: #a8dcf7; }
.ct-tag { color: #8a6300 !important; font-weight: 600; }

/* SLA chips */
.sla { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 2px; font-size: 11.5px; font-weight: 600; border: 1px solid; white-space: nowrap; }
.sla svg { width: 12px; height: 12px; }
.sla b { font-weight: 600; font-size: 12px; }
.sla-ok { color: #157a45; border-color: #a8e3c3; background: #f1fbf5; }
.sla-warn { color: #8a4100; border-color: #ffc08f; background: #fff3e8; }
.sla-breach { color: #fff; border-color: var(--red); background: var(--red); animation: prioPulse 1.6s infinite; }
.sla-met { color: #157a45; border-color: transparent; background: var(--green-soft); }
.sla-missed { color: #b8262b; border-color: transparent; background: var(--red-soft); }

/* Avatars & people */
.avatar { --av: var(--steel); display: inline-grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--av); color: #fff; font-weight: 700; font-size: 13px; }
.avatar-xs { width: 22px; height: 22px; font-size: 10px; } .avatar-sm { width: 30px; height: 30px; font-size: 12px; } .avatar-lg { width: 48px; height: 48px; font-size: 17px; } .avatar-xl { width: 68px; height: 68px; font-size: 24px; }
.person { display: flex; align-items: center; gap: 9px; min-width: 0; }
.person-t { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.person-t b { font-size: 13px; } .person-t small { font-size: 11.5px; color: var(--muted); }
.tech-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 8px 2px 3px; border: 1px solid var(--border); border-radius: 2px; background: var(--surface); white-space: nowrap; border-right: 3px solid var(--c, var(--muted)); }
.tech-chip small { color: var(--muted); }
.tech-chip.none { color: var(--muted); border-style: dashed; border-right-width: 1px; padding: 2px 8px; }
.tech-chip.none svg { width: 13px; height: 13px; }

/* Barcode & QR */
.barcode { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; color: var(--navy); }
.barcode svg { display: block; width: auto; max-width: 140px; fill: currentColor; }
.barcode small { font-size: 9.5px; letter-spacing: .12em; color: var(--text-2); }
.qr { display: grid; grid-template-columns: repeat(21, 1fr); width: 84px; height: 84px; background: #fff; padding: 4px; border: 1px solid var(--border); }
.qr i { display: block; } .qr i.on { background: #0b1b33; }

/* Empty */
.empty-mini { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; text-align: center; color: var(--text-2); }
.empty-mini span { width: 46px; height: 46px; display: grid; place-items: center; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); }
.empty-mini b { color: var(--text); font-size: 14px; } .empty-mini small { font-size: 12px; }

/* ---------------------------------------------------------------- Work-order cards (ticket) */
.wo { --stripe: var(--muted); position: relative; background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--stripe); border-radius: var(--radius-sm); padding: 9px 11px 9px; display: flex; flex-direction: column; gap: 5px; transition: border-color .15s, box-shadow .15s, transform .15s; }
.wo::after { content: ""; position: absolute; left: -5px; top: 50%; width: 9px; height: 18px; margin-top: -9px; background: var(--bg); border-radius: 0 9px 9px 0; border: 1px solid var(--border); border-left: 0; }
.wo:hover { box-shadow: var(--shadow); border-color: #b9c3d1; border-left-color: var(--stripe); }
.wo.sel { box-shadow: 0 0 0 2px var(--yellow), var(--shadow); }
.wo[draggable="true"] { cursor: grab; }
.wo.dragging { opacity: .45; transform: scale(.98); }
.wo.is-new { animation: woIn .8s ease; }
@keyframes woIn { from { background: var(--yellow-soft); transform: translateY(-6px); } }
.wo.p-urgent.s-new { --stripe: var(--orange); } .wo.p-emergency.s-new { --stripe: var(--red); } .wo.p-normal.s-new { --stripe: #8a97ab; }
.wo.s-assigned { --stripe: var(--blue); } .wo.s-enroute { --stripe: var(--cyan); } .wo.s-arrived { --stripe: var(--violet); } .wo.s-inprogress { --stripe: var(--yellow); }
.wo.s-parts { --stripe: var(--orange); } .wo.s-done, .wo.s-invoiced { --stripe: var(--green); } .wo.s-cancelled { --stripe: var(--red); opacity: .75; }
.wo-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wo-id { font-size: 12px; font-weight: 600; color: var(--navy); background: var(--surface-3); padding: 0 6px; border-radius: 2px; }
.wo-title { margin: 0; font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.wo-meta { display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: 11.5px; color: var(--text-2); }
.wo-meta span { display: inline-flex; align-items: center; gap: 4px; }
.wo-meta svg { width: 13px; height: 13px; color: var(--muted); }
.wo-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 6px; margin-top: 2px; border-top: 1px dashed var(--border); }
.wo-foot .barcode svg { max-width: 64px; opacity: .8; }
.wo-src { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.wo-src svg { width: 12px; height: 12px; }
.wo-acts { display: flex; gap: 5px; margin-inline-start: auto; }
.wo-compact { padding: 8px 10px; }
.wo-list { display: flex; flex-direction: column; gap: 8px; }

/* ---------------------------------------------------------------- Tables (dense) */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: right; font-size: 11.5px; font-weight: 600; color: var(--text-2); background: var(--surface-2); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; text-transform: none; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
.tbl tbody tr:hover td { background: #fafbfd; }
.tbl tr.row-alert td { background: #fff7f0; }
.tbl th.num, .tbl td.num { text-align: left; }
.tbl tfoot td { font-weight: 600; background: var(--surface-2); }
.tbl tfoot tr.tot td { background: var(--navy); color: #fff; }
.tbl-mini td, .tbl-mini th { padding: 5px 8px; font-size: 12px; }
.tbl a.mono, .tbl .id-link { color: var(--navy); font-weight: 600; text-decoration: underline; text-decoration-color: var(--yellow); text-underline-offset: 3px; }
.pager { display: flex; gap: 4px; justify-content: center; padding: 10px; }
.pager button { min-width: 30px; height: 30px; border: 1px solid var(--border); background: var(--surface); border-radius: 2px; font-family: var(--mono); cursor: pointer; }
.pager button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 12px; font-size: 12px; color: var(--muted); }
.bar-cell { display: flex; align-items: center; gap: 8px; }
.bar { flex: 1; height: 6px; background: var(--surface-3); border-radius: 1px; overflow: hidden; min-width: 50px; }
.bar i { display: block; height: 100%; background: var(--b, var(--steel-3)); }

/* ---------------------------------------------------------------- Forms, toolbars, tabs */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--border-2); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.input, .select, select.input, textarea.input { width: 100%; font: inherit; font-size: 13.5px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); outline: none; min-width: 0; }
.input:focus, .select:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(255, 201, 40, .45); }
.input.sm, .select.sm { padding: 6px 8px; font-size: 12.5px; }
.search-box { position: relative; flex: 1 1 220px; max-width: 340px; }
.search-box svg { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.search-box .input { padding-right: 32px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); margin-top: 12px; cursor: pointer; }
.check-line input { accent-color: var(--navy); width: 16px; height: 16px; }
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab { padding: 10px 14px; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tab.active { color: var(--navy); border-bottom-color: var(--yellow); }
.tab .mono { font-size: 11px; background: var(--surface-3); padding: 0 5px; border-radius: 2px; }
.tab-panel { display: none; } .tab-panel.active { display: block; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 12px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; border-left: 1px solid var(--border); }
.seg button:last-child { border-left: 0; }
.seg button.active { background: var(--navy); color: var(--yellow); }
.chip-filter { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 2px; background: var(--surface); font: inherit; font-size: 12px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.chip-filter .led { width: 7px; height: 7px; box-shadow: none; }
.chip-filter.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #c7cfdb; border-radius: 2px; cursor: pointer; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; right: 3px; top: 3px; background: #fff; border-radius: 1px; transition: .15s; }
.switch input:checked + span { background: var(--navy); }
.switch input:checked + span::before { transform: translateX(-16px); background: var(--yellow); }

/* ---------------------------------------------------------------- Modal, drawer, toast */
body.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(6, 14, 28, .62); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; transition: opacity .18s; }
.modal-backdrop.show { opacity: 1; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); border-top: 4px solid var(--yellow); transform: translateY(10px); transition: transform .18s; }
.modal-backdrop.show .modal { transform: none; }
.modal.sm { max-width: 420px; } .modal.lg { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border-2); }
.modal-head h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.modal-head h3 svg { width: 18px; height: 18px; color: var(--steel-3); }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--border-2); background: var(--surface-2); }
.drawer-backdrop { justify-content: flex-start; padding: 0; }
.drawer { width: 100%; max-width: 640px; height: 100%; display: flex; flex-direction: column; background: var(--bg); box-shadow: var(--shadow-lg); border-right: 4px solid var(--yellow); transform: translateX(-30px); transition: transform .2s; }
.drawer-backdrop.show .drawer { transform: none; }
.drawer .modal-head { background: var(--navy); color: #fff; border: 0; }
.drawer .modal-head h3 svg { color: var(--yellow); }
.drawer .modal-head .btn-icon { color: #fff; } .drawer .modal-head .btn-icon:hover { background: rgba(255, 255, 255, .1); }
.drawer .modal-body { flex: 1; }
.drawer .modal-foot { background: var(--surface); }
.toast-wrap { position: fixed; bottom: 18px; left: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; max-width: min(400px, calc(100vw - 36px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; background: var(--navy); color: #e6edf8; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); border-right: 4px solid var(--green); font-size: 13px; animation: toastIn .22s ease; }
.toast.hide { opacity: 0; transform: translateX(-20px); transition: .25s; }
.toast .t-icon { flex: 0 0 22px; height: 22px; display: grid; place-items: center; background: var(--green); color: #04210f; border-radius: 2px; }
.toast .t-icon svg { width: 14px; height: 14px; }
.toast.t-error { border-color: var(--red); } .toast.t-error .t-icon { background: var(--red); color: #fff; }
.toast.t-warning { border-color: var(--orange); } .toast.t-warning .t-icon { background: var(--orange); color: #1a0a00; }
.toast.t-info { border-color: var(--cyan); } .toast.t-info .t-icon { background: var(--cyan); color: #04212a; }
.toast b { color: var(--yellow); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
.success-box { text-align: center; padding: 6px 0; }
.success-mark { width: 60px; height: 60px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--green); color: #fff; border-radius: var(--radius); }
.success-mark svg { width: 30px; height: 30px; }
.info-list { display: grid; gap: 1px; background: var(--border-2); border: 1px solid var(--border-2); margin-top: 14px; }
.info-list > div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; background: var(--surface); font-size: 13px; }
.info-list small { color: var(--muted); }

/* Employee badge (profile & login) */
.id-badge { --rc: var(--yellow); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.idb-strip { height: 10px; background: var(--rc); }
.idb-body { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px; text-align: center; }
.idb-body h3 { margin: 8px 0 0; } .idb-body p { margin: 0; color: var(--text-2); font-size: 13px; }

/* ---------------------------------------------------------------- Job details (drawer & job pages) */
.jd-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.jd-top h3 { margin: 4px 0 6px; font-size: 17px; }
.jd-id { font-size: 12px; background: var(--navy); color: var(--yellow); padding: 1px 7px; border-radius: 2px; }
.jd-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.jd-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.jd-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.jd-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; margin-bottom: 10px; }
.jd-grid .jd-box { margin: 0; }
.jd-box h5 { margin: 0 0 6px; font-size: 11.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; text-transform: uppercase; letter-spacing: .03em; }
.jd-box h5 svg { width: 14px; height: 14px; }
.jd-box h5 .mono { margin-inline-start: auto; color: var(--text); }
.jd-box small { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.jd-box small svg { width: 12px; height: 12px; }
.eta-line { color: #0b6f7f !important; font-weight: 600; }
.jd-note { display: flex; gap: 8px; align-items: flex-start; padding: 9px 12px; background: var(--yellow-soft); border: 1px solid #f3dc8b; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 10px; }
.jd-note.warn { background: var(--orange-soft); border-color: #ffc79e; }
.jd-note svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 2px; }
.track { list-style: none; margin: 0; padding: 10px 0 0; display: grid; grid-template-columns: repeat(7, 1fr); counter-reset: s; }
.track li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; }
.track li::before { content: ""; position: absolute; top: 7px; right: 50%; width: 100%; height: 3px; background: var(--border); z-index: 0; }
.track li:first-child::before { display: none; }
.track li i { position: relative; z-index: 1; width: 17px; height: 17px; border-radius: 2px; background: var(--surface); border: 2px solid var(--border); }
.track li small { font-size: 10.5px; color: var(--muted); line-height: 1.2; }
.track li.past::before, .track li.cur::before { background: var(--navy); }
.track li.past i { background: var(--navy); border-color: var(--navy); }
.track li.cur i { background: var(--yellow); border-color: var(--navy); box-shadow: 0 0 0 4px rgba(255, 201, 40, .35); }
.track li.cur small { color: var(--text); font-weight: 700; }
.track.is-cancelled { opacity: .45; filter: grayscale(1); }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.checklist li { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.checklist li svg { width: 15px; height: 15px; color: var(--muted); }
.checklist li.on { color: var(--text); } .checklist li.on svg { color: var(--green); }
.photo-row { display: flex; gap: 6px; margin-bottom: 6px; }
.ph { flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px; height: 54px; border: 1px dashed var(--border); border-radius: var(--radius-sm); font-size: 12px; color: var(--muted); background: repeating-linear-gradient(45deg, var(--surface-2) 0 6px, var(--surface) 6px 12px); }
.ph svg { width: 15px; height: 15px; }
.ph.on { border-style: solid; color: var(--navy); background: linear-gradient(135deg, #cfe4ef, #9ab7cc); }
.sig-line { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.sig-line svg { width: 15px; height: 15px; color: var(--steel-3); }
.stars { color: var(--yellow-2); letter-spacing: 2px; font-size: 15px; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 50px 1fr; gap: 10px; padding: 6px 0; border-right: 2px solid var(--border); padding-right: 12px; position: relative; font-size: 12.5px; }
.timeline li::before { content: ""; position: absolute; right: -6px; top: 11px; width: 10px; height: 10px; background: var(--surface); border: 2px solid var(--steel-3); border-radius: 1px; }
.timeline li.tl-done::before, .timeline li.tl-invoiced::before { border-color: var(--green); background: var(--green); }
.timeline li.tl-enroute::before { border-color: var(--cyan); } .timeline li.tl-cancelled::before { border-color: var(--red); background: var(--red); } .timeline li.tl-parts::before { border-color: var(--orange); }
.timeline li > span { color: var(--muted); font-size: 12px; }
.timeline b { display: block; font-weight: 600; } .timeline small { color: var(--muted); font-size: 11.5px; }

/* Suggestions (assign) */
.sug-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 14px 0 8px; }
.sug-head small { color: var(--muted); font-size: 12px; }
.sug-list { display: flex; flex-direction: column; gap: 6px; }
.sug { display: grid; grid-template-columns: auto minmax(0, 1fr) repeat(4, 56px) auto; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.sug.best { border-color: var(--navy); box-shadow: inset -4px 0 0 var(--yellow); }
.sug.nomatch { opacity: .6; }
.sug.hover { background: var(--yellow-soft); }
.sug-t { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sug-t b { font-size: 13px; } .sug-t small { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.best-tag { font-size: 10px; background: var(--yellow); color: #111; padding: 0 5px; border-radius: 2px; }
.sug-n { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.sug-n b { font-size: 15px; font-weight: 600; } .sug-n small { font-size: 10px; color: var(--muted); }

/* ---------------------------------------------------------------- Map (stylized SVG city) */
.fmap { position: relative; overflow: hidden; background: #0a182d; border-radius: var(--radius-sm); --zs: 1; user-select: none; -webkit-user-select: none; }
.fmap-svg { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.fmap.panning .fmap-svg { cursor: grabbing; }
.m-bg { fill: #0a182d; }
.m-gridline { stroke: rgba(122, 162, 255, .06); stroke-width: 1; }
.m-water.wadi { fill: none; stroke: #0f4a55; stroke-width: 16; stroke-linecap: round; opacity: .9; }
.m-water.sea { fill: #0b3446; stroke: #13566e; stroke-width: 2; }
.m-district { fill: #11264a; stroke: #1c3b6a; stroke-width: 1; }
.m-street { stroke: #19335c; stroke-width: 1.2; fill: none; }
.m-road { fill: none; stroke: #1d3964; stroke-width: 5; }
.m-road.major { stroke: #284c80; stroke-width: 9; }
.m-road-center { fill: none; stroke: rgba(255, 201, 40, .35); stroke-width: 1; stroke-dasharray: 8 10; }
.m-dlabel { fill: #6f88b0; font-family: var(--font); font-size: 13px; font-weight: 600; text-anchor: middle; pointer-events: none; opacity: .85; }
.m-rlabel { fill: #a7b9d6; font-family: var(--font); font-size: 9.5px; text-anchor: middle; pointer-events: none; opacity: .75; paint-order: stroke; stroke: #0a182d; stroke-width: 3px; }
.m-wlabel { fill: #3f9bb0; font-family: var(--font); font-size: 12px; text-anchor: middle; pointer-events: none; }
.m-base rect { fill: var(--yellow); }
.m-base path { fill: #0b1b33; }
.m-base text { fill: var(--yellow); font-family: var(--font); font-size: 10px; text-anchor: middle; font-weight: 600; }
.route { stroke: var(--cyan); stroke-width: 2; stroke-dasharray: 5 5; fill: none; animation: dash 1s linear infinite; opacity: .85; }
.route-sug { stroke: var(--yellow); stroke-width: 1.5; stroke-dasharray: 3 5; opacity: .55; }
.route-sug.first { stroke-width: 2.5; opacity: 1; }
@keyframes dash { to { stroke-dashoffset: -10; } }
/* pins: positioned with CSS transform → smooth movement */
.pin-tech, .pin-job { transition: transform 1.4s linear; cursor: pointer; outline: none; }
.pin-tech .body { fill: #0b1b33; stroke: var(--tc, #8a97ab); stroke-width: 3; }
.pin-tech .halo { fill: none; stroke: transparent; stroke-width: 2; }
.pin-tech .ini { fill: #fff; font-family: var(--font); font-size: 10px; font-weight: 700; text-anchor: middle; pointer-events: none; }
.pin-tech .pulse { fill: var(--tc); opacity: 0; transform-box: fill-box; transform-origin: center; }
.pin-tech.ts-available { --tc: var(--green); } .pin-tech.ts-enroute { --tc: var(--cyan); } .pin-tech.ts-onsite { --tc: var(--yellow); } .pin-tech.ts-break { --tc: #8a97ab; } .pin-tech.ts-off { --tc: #4b5a73; }
.pin-tech.ts-enroute .pulse, .pin-tech.ts-available .pulse { animation: pinPulse 2s ease-out infinite; }
.pin-tech.ts-break { opacity: .65; }
.pin-tech:hover .body, .pin-tech.sel .body, .pin-tech.hl .body { stroke-width: 4; }
.pin-tech.sel .halo, .pin-tech.hl .halo { stroke: #fff; }
.pin-tech.hl .halo { stroke: var(--yellow); stroke-dasharray: 3 3; }
.pin-tech.dim { opacity: .28; }
.pin-tech.drop-hover .halo { stroke: var(--yellow); stroke-width: 4; }
.pin-job .mk { fill: var(--jc, #8a97ab); stroke: #0b1b33; stroke-width: 1.5; }
.pin-job .mk-dot { fill: #0b1b33; }
.pin-job .pulse { fill: var(--jc); opacity: 0; transform-box: fill-box; transform-origin: center; }
.pin-job.st-new { --jc: #c4cede; } .pin-job.st-new.p-urgent { --jc: var(--orange); } .pin-job.st-new.p-emergency { --jc: var(--red); }
.pin-job.st-new.p-emergency .pulse, .pin-job.st-new.p-urgent .pulse, .pin-job.sla-breach .pulse { animation: pinPulse 1.4s ease-out infinite; }
.pin-job.st-assigned { --jc: var(--blue); } .pin-job.st-enroute { --jc: var(--cyan); } .pin-job.st-arrived { --jc: var(--violet); } .pin-job.st-inprogress { --jc: var(--yellow); } .pin-job.st-parts { --jc: var(--orange); }
.pin-job.st-inprogress .mk, .pin-job.st-arrived .mk { opacity: .9; }
.pin-job.sel .mk { stroke: #fff; stroke-width: 2.5; }
.pin-job.sel { filter: drop-shadow(0 0 6px rgba(255, 201, 40, .8)); }
@keyframes pinPulse { 0% { opacity: .55; transform: scale(.6); } 100% { opacity: 0; transform: scale(2.4); } }
.fmap-ctrl { position: absolute; left: 10px; bottom: 34px; display: flex; flex-direction: column; border: 1px solid #22426f; border-radius: var(--radius-sm); overflow: hidden; }
.fmap-ctrl button { width: 32px; height: 32px; display: grid; place-items: center; background: #0f2342; color: #c9d5e8; border: 0; border-bottom: 1px solid #22426f; cursor: pointer; }
.fmap-ctrl button:last-child { border-bottom: 0; }
.fmap-ctrl button:hover { background: var(--steel-2); color: var(--yellow); }
.fmap-ctrl svg { width: 16px; height: 16px; }
.fmap-compass { position: absolute; left: 12px; top: 12px; width: 32px; height: 32px; border: 1px solid #22426f; background: rgba(11, 27, 51, .8); color: var(--yellow); display: grid; place-items: center; font-size: 11px; font-weight: 600; border-radius: 50%; }
.fmap-scale { position: absolute; left: 10px; bottom: 10px; font-size: 10px; color: #8ea3c4; display: flex; align-items: center; gap: 5px; }
.fmap-scale i { display: inline-block; width: 50px; height: 5px; border: 1px solid #8ea3c4; border-top: 0; }
.map-legend { position: absolute; right: 10px; bottom: 10px; display: flex; flex-wrap: wrap; gap: 4px 10px; max-width: calc(100% - 140px); padding: 6px 10px; background: rgba(11, 27, 51, .88); border: 1px solid #22426f; border-radius: var(--radius-sm); font-size: 11px; color: #c9d5e8; }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.map-legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); border: 2px solid #0b1b33; box-shadow: 0 0 0 1px var(--c); }
.map-legend i.sq { border-radius: 1px 50% 50% 50%; transform: rotate(45deg); }

/* ---------------------------------------------------------------- Dispatch screen (map-centric) */
body.page-full .content { padding: 0; display: flex; flex-direction: column; }
body.page-full .app-foot { display: none; }
.dispatch { flex: 1; display: grid; grid-template-columns: 380px minmax(0, 1fr); height: calc(100vh - var(--sb-h) - 2px); min-height: 520px; background: var(--navy); }
.dq { display: flex; flex-direction: column; min-height: 0; background: var(--bg); border-left: 1px solid #000; }
.dq-head { padding: 10px 12px 0; background: var(--surface); border-bottom: 1px solid var(--border); }
.dq-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.dq-title h2 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 7px; }
.dq-title h2 svg { width: 17px; height: 17px; color: var(--orange); }
.dq-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.dq-hint { font-size: 11.5px; color: var(--muted); padding: 0 12px 8px; display: flex; align-items: center; gap: 5px; }
.dq-hint svg { width: 13px; height: 13px; }
.map-panel { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.map-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 10px; background: var(--navy-2); border-bottom: 1px solid #000; color: #c9d5e8; }
.map-toolbar .seg { background: transparent; border-color: #22426f; }
.map-toolbar .seg button { color: #a7b9d6; border-color: #22426f; }
.map-toolbar .seg button.active { background: var(--yellow); color: #0b1b33; }
.map-toolbar .chip-filter { background: transparent; border-color: #22426f; color: #a7b9d6; }
.map-toolbar .chip-filter.active { background: #1b355e; color: #fff; border-color: #3a5d92; }
.map-toolbar select { background: #0f2342; color: #c9d5e8; border-color: #22426f; }
.map-toolbar .sep { width: 1px; height: 22px; background: #22426f; }
.map-panel .fmap { flex: 1; border-radius: 0; min-height: 0; }
.sug-panel { position: absolute; top: 56px; right: 12px; width: min(400px, calc(100% - 24px)); max-height: calc(100% - 120px); overflow-y: auto; background: var(--surface); border-radius: var(--radius); border-top: 4px solid var(--yellow); box-shadow: var(--shadow-lg); z-index: 5; }
.sug-panel .sp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border-2); }
.sug-panel .sp-body { padding: 10px 12px; }
.sug-panel .sug { grid-template-columns: auto minmax(0, 1fr) 46px 46px auto; gap: 7px; padding: 7px 8px; }
.sug-panel .sug .sug-n:nth-of-type(4), .sug-panel .sug .sug-n:nth-of-type(5) { display: none; }
.roster { display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px; background: var(--navy-2); border-top: 1px solid #000; scrollbar-width: thin; }
.roster-item { flex: 0 0 auto; display: flex; align-items: center; gap: 7px; padding: 5px 9px 5px 6px; background: #0b1b33; border: 1px solid #22426f; border-right: 3px solid var(--c); border-radius: var(--radius-sm); color: #d6e0f0; font-size: 12px; cursor: pointer; font-family: inherit; }
.roster-item:hover, .roster-item.sel { border-color: var(--yellow); border-right-color: var(--c); }
.roster-item.drop-hover { background: #1b355e; border-color: var(--yellow); }
.roster-item small { display: block; color: #8ea3c4; font-size: 10.5px; }
.roster-item .avatar { --av: #1b355e; }

/* ---------------------------------------------------------------- Phone shell (technician & customer apps) */
body.shell-phone { min-height: 100vh; background: var(--navy); background-image: linear-gradient(rgba(122, 162, 255, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(122, 162, 255, .07) 1px, transparent 1px); background-size: 28px 28px; }
.phone-stage { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 48px; padding: 28px 20px; }
.stage-note { max-width: 330px; color: #c9d5e8; display: flex; flex-direction: column; gap: 14px; }
.stage-kicker { font-size: 11px; letter-spacing: .18em; color: var(--yellow); }
.stage-note h2 { margin: 0; color: #fff; font-size: 30px; }
.stage-note p { margin: 0; font-size: 14px; color: #a7b9d6; }
.stage-user { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid #22426f; border-radius: var(--radius); background: rgba(0, 0, 0, .2); }
.stage-user b { display: block; color: #fff; } .stage-user b small { color: var(--yellow); font-weight: 500; } .stage-user small { color: #8ea3c4; font-size: 12px; }
.stage-meta { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.stage-meta span { display: flex; align-items: center; gap: 7px; } .stage-meta svg { width: 15px; height: 15px; color: var(--yellow); }
.stage-links { display: flex; flex-wrap: wrap; gap: 6px; }
.stage-links a, .stage-links button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid #22426f; border-radius: var(--radius-sm); color: #c9d5e8; font: inherit; font-size: 12.5px; background: none; cursor: pointer; }
.stage-links a:hover, .stage-links button:hover { border-color: var(--yellow); color: #fff; }
.stage-links svg { width: 14px; height: 14px; }
.stage-by { display: inline-flex; align-items: center; gap: 7px; color: #8ea3c4; font-size: 12px; }
.stage-by img { width: 18px; height: 18px; object-fit: contain; filter: brightness(0) invert(1); opacity: .7; }
.phone { position: relative; width: 390px; height: min(820px, calc(100vh - 56px)); min-height: 600px; display: flex; flex-direction: column; background: var(--bg); border: 10px solid #050c18; border-radius: 42px; overflow: hidden; box-shadow: 0 0 0 2px #22426f, 0 40px 80px rgba(0, 0, 0, .5); }
.phone-notch { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 120px; height: 24px; background: #050c18; border-radius: 0 0 14px 14px; z-index: 30; }
.m-bar { display: flex; align-items: center; gap: 10px; padding: 30px 14px 10px; background: var(--navy); color: #fff; border-bottom: 2px solid var(--yellow); }
.m-brand svg { width: 32px; height: 32px; display: block; }
.m-brand .brand-logo { width: 34px; height: 34px; background: #fff; padding: 3px; border-radius: 6px; }
.m-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.m-title b { font-size: 16px; } .m-title small { font-size: 11px; color: #8ea3c4; }
.m-bar .icon-btn { color: #c9d5e8; }
.m-bar .dropdown-menu { left: 0; width: 300px; max-width: calc(100vw - 30px); }
.m-content { flex: 1; overflow-y: auto; padding: 14px; overscroll-behavior: contain; }
.m-tabs { display: flex; background: var(--navy); border-top: 1px solid #000; padding: 6px 4px 12px; }
.m-tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; color: #8ea3c4; font-size: 11px; }
.m-tabs .tb-ic { width: 38px; height: 28px; display: grid; place-items: center; border-radius: var(--radius-sm); }
.m-tabs svg { width: 20px; height: 20px; }
.m-tabs a.active { color: var(--yellow); } .m-tabs a.active .tb-ic { background: rgba(255, 201, 40, .14); }
.m-tabs a.fab .tb-ic { background: var(--yellow); color: #0b1b33; width: 46px; height: 34px; margin-top: -10px; box-shadow: 0 4px 0 #b88a00; }
/* technician app = high-contrast dark */
body.role-technician .phone { background: #08142a; color: #e6edf8; }
body.role-technician .m-content { color: #e6edf8; }
/* phone content components */
.m-section { margin-bottom: 16px; }
.m-section > h4 { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .04em; display: flex; align-items: center; justify-content: space-between; }
.m-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; color: var(--text); }
body.role-technician .m-card { background: #0f2342; border-color: #22426f; color: #e6edf8; }
body.role-technician .m-card small, body.role-technician .text-2 { color: #a7b9d6; }
.m-hero { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 14px; border-left: 6px solid var(--stripe, var(--yellow)); position: relative; overflow: hidden; }
.m-hero h3 { margin: 6px 0 4px; font-size: 18px; line-height: 1.35; }
.m-hero .mono { color: var(--yellow); }
.m-hero small { color: #a7b9d6; }
.m-list { display: flex; flex-direction: column; gap: 8px; }
.m-row { display: flex; align-items: center; gap: 10px; padding: 11px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); }
body.role-technician .m-row { background: #0f2342; border-color: #22426f; color: #e6edf8; }
.m-row .grow b { display: block; font-size: 14px; } .m-row .grow small { font-size: 12px; color: var(--muted); }
.m-row > svg { width: 18px; height: 18px; color: var(--muted); }
.m-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.m-kpi { padding: 10px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); text-align: center; }
body.role-technician .m-kpi { background: #0f2342; border-color: #22426f; }
.m-kpi b { display: block; font-family: var(--mono); font-size: 22px; font-weight: 500; color: var(--k, inherit); }
.m-kpi small { font-size: 11px; color: var(--muted); }
/* big yellow step buttons */
.step-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 60px; padding: 14px 18px; border: 0; border-radius: var(--radius); background: var(--yellow); color: #0b1b33; font: inherit; font-size: 18px; font-weight: 700; cursor: pointer; box-shadow: 0 5px 0 #b88a00; transition: transform .08s, box-shadow .08s; }
.step-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #b88a00; }
.step-btn svg { width: 24px; height: 24px; }
.step-btn.cyan { background: var(--cyan); box-shadow: 0 5px 0 #127d8d; }
.step-btn.green { background: var(--green); box-shadow: 0 5px 0 #1b8a4f; color: #04210f; }
.step-btn.ghost { background: transparent; color: inherit; border: 2px solid #22426f; box-shadow: none; font-size: 15px; min-height: 48px; }
.step-btn:disabled { opacity: .4; cursor: not-allowed; }
.m-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.m-steps li { flex: 1; height: 6px; background: #22426f; border-radius: 1px; }
.m-steps li.past { background: var(--green); } .m-steps li.cur { background: var(--yellow); }
.m-steps-labels { display: flex; justify-content: space-between; font-size: 10.5px; color: #8ea3c4; margin-top: 5px; }
.check-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 12px; margin-bottom: 6px; background: #0f2342; border: 2px solid #22426f; border-radius: var(--radius-sm); color: #e6edf8; font: inherit; font-size: 14.5px; text-align: right; cursor: pointer; }
.check-item .box { flex: 0 0 26px; height: 26px; display: grid; place-items: center; border: 2px solid #3a5d92; border-radius: 3px; }
.check-item .box svg { width: 18px; height: 18px; opacity: 0; }
.check-item.on { border-color: var(--green); background: rgba(47, 191, 113, .1); }
.check-item.on .box { background: var(--green); border-color: var(--green); color: #04210f; }
.check-item.on .box svg { opacity: 1; }
.photo-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-slot { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 2px dashed #3a5d92; border-radius: var(--radius-sm); background: rgba(255, 255, 255, .03); color: #8ea3c4; font: inherit; font-size: 11.5px; cursor: pointer; }
.photo-slot svg { width: 24px; height: 24px; }
.photo-slot.on { border-style: solid; border-color: var(--green); color: #fff; background: linear-gradient(135deg, #2c5576, #13314f); }
.sig-pad { display: block; width: 100%; height: 170px; background: #fff; border: 2px dashed #8ea3c4; border-radius: var(--radius-sm); touch-action: none; cursor: crosshair; }
.sig-pad.signed { border-style: solid; border-color: var(--green); }
.rate-stars { display: flex; justify-content: center; gap: 6px; direction: ltr; }
.rate-stars button { background: none; border: 0; font-size: 34px; line-height: 1; color: #3a5d92; cursor: pointer; padding: 0 2px; }
.rate-stars button.on { color: var(--yellow); }

/* ---------------------------------------------------------------- Print (work order & invoice) */
.doc { background: #fff; color: #0b1b33; font-size: 12.5px; }
.doc-head { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 3px solid #0b1b33; margin-bottom: 12px; }
.doc-brand { display: flex; gap: 10px; align-items: flex-start; }
.doc-brand svg { width: 40px; height: 40px; flex: 0 0 auto; }
.doc-brand .brand-logo { width: 44px; height: 44px; }
.doc-brand b { display: block; font-size: 15px; } .doc-brand small { display: block; font-size: 11px; color: #4f5f76; }
.doc-title { text-align: left; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.doc-title h2 { margin: 0; font-size: 17px; } .doc-title b { font-size: 15px; background: #ffc928; padding: 0 8px; }
.doc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.doc-grid > div { border: 1px solid #d5dbe3; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.doc-grid small { font-size: 10.5px; color: #8a97ab; } .doc-grid span { font-size: 11.5px; color: #4f5f76; }
.doc-tbl { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.doc-tbl th { background: #0b1b33; color: #fff; text-align: right; padding: 6px 8px; font-size: 11.5px; }
.doc-tbl td { border-bottom: 1px solid #e5e9ef; padding: 6px 8px; }
.doc-tbl tfoot td { font-weight: 700; background: #f5f7fa; }
.doc-tbl tfoot tr.tot td { background: #ffc928; }
.doc-sign { display: flex; gap: 14px; align-items: flex-end; }
.doc-sign > div { flex: 1; border-top: 1px solid #0b1b33; padding-top: 4px; display: flex; flex-direction: column; min-height: 50px; justify-content: flex-end; }
.doc-sign small { color: #8a97ab; font-size: 10.5px; }
.doc-foot { margin-top: 12px; padding-top: 8px; border-top: 1px dashed #d5dbe3; font-size: 10.5px; color: #8a97ab; text-align: center; }
.doc-modal .modal-body { background: var(--surface-3); }
.doc-modal .doc { padding: 22px; border: 1px solid var(--border); box-shadow: var(--shadow); }
#printArea { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff !important; padding: 0 !important; }
  body.print-mode > *:not(#printArea) { display: none !important; }
  body.print-mode #printArea { display: block; }
  body:not(.print-mode) .rail, body:not(.print-mode) .statusbar, body:not(.print-mode) .app-foot, body:not(.print-mode) .toast-wrap, body:not(.print-mode) .no-print { display: none !important; }
  body.shell-desk { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  .doc-grid { grid-template-columns: repeat(3, 1fr) !important; }
}

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1280px) {
  .sb-ctr small { display: none; }
  .sb-ctr { padding: 5px 8px; }
  .dispatch { grid-template-columns: 340px minmax(0, 1fr); }
}
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .grid-3 { grid-template-columns: 1fr; }
  .user-btn .meta { display: none; }
  .jd-grid { grid-template-columns: 1fr 1fr; }
  .stage-note { display: none; }
}
@media (max-width: 900px) {
  .dispatch { grid-template-columns: 1fr; height: auto; }
  .map-panel { order: -1; height: 64vh; min-height: 380px; }
  .dq { border-left: 0; border-top: 2px solid var(--yellow); }
  .dq-list { max-height: none; overflow: visible; }
  .sb-clock { display: none; }
}
@media (max-width: 760px) {
  :root { --sb-h: auto; }
  body.shell-desk { padding-right: 0; padding-bottom: 62px; }
  .rail { inset: auto 0 0 0; width: auto; height: 62px; flex-direction: row; border-left: 0; border-top: 2px solid var(--yellow); }
  .rail-brand, .rail-foot .rail-by, .rail-foot button { display: none; }
  .rail-nav { flex-direction: row; padding: 0; overflow-x: auto; overflow-y: hidden; }
  .rail-link { min-width: 64px; flex: 1 0 64px; padding: 8px 2px 6px; }
  .rail-link.active::before { top: 0; bottom: auto; left: 8px; right: 8px; width: auto; height: 3px; }
  .rail-foot { flex-direction: row; border-top: 0; border-right: 1px solid rgba(255, 255, 255, .08); padding: 0; }
  .rail-foot .rail-link { min-width: 56px; flex-basis: 56px; }
  .statusbar { flex-wrap: wrap; gap: 6px 10px; padding: 8px 12px; }
  .sb-id { flex: 1; } .sb-co { display: none; }
  .sb-counters { order: 3; width: 100%; margin: 0; }
  .sb-ctr { flex: 1 0 auto; justify-content: center; }
  .content { padding: 14px 12px; }
  .grid-2, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .jd-grid, .jd-grid.two { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-v { font-size: 22px; }
  .drawer { max-width: 100%; border-right: 0; }
  .sug, .sug-panel .sug { grid-template-columns: auto minmax(0, 1fr) 44px auto; }
  .sug .sug-n { display: none; }
  .sug .sug-n:nth-of-type(3) { display: flex; }
  .track small { font-size: 9px; }
  .notif-menu { width: 300px; max-width: calc(100vw - 24px); }
  .dropdown-menu { position: fixed; top: 60px; left: 12px; }
  .table-cards thead { display: none; }
  .table-cards tr { display: block; border-bottom: 1px solid var(--border); padding: 6px 0; }
  .table-cards td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 4px 12px; }
  .table-cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; }
  .table-cards td.num { text-align: left; }
  .map-panel { height: 58vh; min-height: 340px; }
  .map-legend { display: none; }
  .doc-grid { grid-template-columns: 1fr; }
  .doc-head { flex-direction: column; }
  .doc-title { align-items: flex-start; text-align: right; }
  .toast-wrap { left: 12px; right: 12px; bottom: 74px; max-width: none; }
}
@media (max-width: 600px) {
  body.shell-phone { background: var(--navy); }
  .phone-stage { padding: 0; display: block; min-height: 0; }
  .phone { width: 100%; height: 100vh; height: 100dvh; min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
  .phone-notch { display: none; }
  .m-bar { padding-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .pin-tech, .pin-job { transition: none; }
  .pulse, .route, .blink, .prio-emergency, .sla-breach { animation: none !important; }
}

/* layout safety: grid/flex children may shrink; the page never scrolls sideways */
html { overflow-x: clip; }
.grid-2 > *, .grid-3 > *, .grid-4 > *, .grid-main > *, .stack > *, .row > * { min-width: 0; }
.tabs { max-width: 100%; }
.fmap svg { max-width: 100%; }
.track { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.track li { min-width: 0; }
.track li > * { max-width: 100%; overflow-wrap: anywhere; }
.track { overflow: clip; }
