/* HTG GPS — dizajn profesional (enterprise). Tema e çelët si parazgjedhje, tema e errët opsionale. */
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #f9fafb;
  --panel-3: #f2f4f7;
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --line: #e4e7ec;
  --line-2: #d0d5dd;
  --brand: #1e56d6;
  --brand-h: #1849a9;
  --brand-soft: #eef4ff;
  --brand-line: #b2ccff;
  --side: #0c111d;
  --side-2: #161b26;
  --side-3: #1f242f;
  --side-text: #cecfd2;
  --side-muted: #85888e;
  --green: #12b76a; --green-t: #067647; --green-b: #ecfdf3; --green-l: #abefc6;
  --amber: #f79009; --amber-t: #b54708; --amber-b: #fffaeb; --amber-l: #fedf89;
  --red: #f04438; --red-t: #b42318; --red-b: #fef3f2; --red-l: #fecdca;
  --blue: #2e90fa; --blue-t: #175cd3; --blue-b: #eff8ff; --blue-l: #b2ddff;
  --purple: #7a5af8; --purple-t: #5925dc; --purple-b: #f4f3ff; --purple-l: #d9d6fe;
  --grey-t: #344054; --grey-b: #f2f4f7; --grey-l: #e4e7ec;
  --radius: 10px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 16px -4px rgba(16, 24, 40, .08), 0 4px 6px -2px rgba(16, 24, 40, .03);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  /* Zonat e sigurta (notch, shiriti i statusit, home indicator). Android/Capacitor i jep si --safe-area-inset-* */
  --sat: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --sab: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0c111d;
  --panel: #161b26;
  --panel-2: #1a202c;
  --panel-3: #1f242f;
  --text: #f5f5f6;
  --text-2: #cecfd2;
  --muted: #94969c;
  --line: #262b36;
  --line-2: #333741;
  --brand: #3b7bf6;
  --brand-h: #528bff;
  --brand-soft: rgba(59, 123, 246, .12);
  --brand-line: rgba(59, 123, 246, .45);
  --side: #0a0d14;
  --green-t: #75e0a7; --green-b: rgba(18, 183, 106, .12); --green-l: rgba(18, 183, 106, .35);
  --amber-t: #fec84b; --amber-b: rgba(247, 144, 9, .12); --amber-l: rgba(247, 144, 9, .35);
  --red-t: #fda29b; --red-b: rgba(240, 68, 56, .12); --red-l: rgba(240, 68, 56, .35);
  --blue-t: #84caff; --blue-b: rgba(46, 144, 250, .12); --blue-l: rgba(46, 144, 250, .35);
  --purple-t: #bdb4fe; --purple-b: rgba(122, 90, 248, .14); --purple-l: rgba(122, 90, 248, .38);
  --grey-t: #cecfd2; --grey-b: #1f242f; --grey-l: #333741;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
small, .muted { color: var(--muted); }
code, pre { font-family: var(--mono); font-size: 12.5px; }
.ic { flex: none; vertical-align: -3px; }
.hidden { display: none !important; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; height: 100vh; height: 100dvh; }
.sidebar { background: var(--side); color: var(--side-text); display: flex; flex-direction: column; overflow-y: auto; border-right: 1px solid #1f242f; }
.brand { display: flex; gap: 11px; align-items: center; padding: 18px 18px 16px; }
.brand .logo { width: 34px; height: 34px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; letter-spacing: .3px; }
.brand b { color: #fff; display: block; font-size: 15px; font-weight: 600; }
.brand small { color: var(--side-muted); font-size: 12px; }
.tenant-box { margin: 0 12px 6px; padding: 9px 11px; border-radius: 8px; background: var(--side-2); border: 1px solid #262b36; font-size: 12.5px; }
.tenant-box .t { color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tenant-box .s { color: var(--side-muted); font-size: 11.5px; }
.sidebar nav { padding: 6px 12px 12px; display: flex; flex-direction: column; gap: 1px; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 6px; color: var(--side-text); font-weight: 500; font-size: 13.5px; }
.sidebar nav a .ic { color: var(--side-muted); }
.sidebar nav a:hover { background: var(--side-2); color: #fff; }
.sidebar nav a.active { background: var(--side-3); color: #fff; }
.sidebar nav a.active .ic { color: #fff; }
.sidebar nav a .count { margin-left: auto; background: #2a2f3a; color: #fff; border-radius: 99px; font-size: 11px; font-weight: 600; padding: 0 7px; line-height: 18px; font-variant-numeric: tabular-nums; }
.sidebar nav a .count.alert { background: var(--red); }
.sidebar nav .sep { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--side-muted); padding: 16px 10px 6px; }
.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid #1f242f; }
.side-user { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 8px; }
.side-user .nm { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .rl { color: var(--side-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .avatar { background: #2a2f3a; color: #fff; }
.side-user button { margin-left: auto; background: none; border: none; color: var(--side-muted); cursor: pointer; padding: 6px; border-radius: 6px; }
.side-user button:hover { color: #fff; background: var(--side-2); }

main { display: flex; flex-direction: column; min-width: 0; height: 100vh; height: 100dvh; }
.imp-bar { background: var(--amber-b); color: var(--amber-t); border-bottom: 1px solid var(--amber-l); padding: 8px 22px; font-size: 13px; display: flex; gap: 10px; align-items: center; }
.imp-bar .btn { margin-left: auto; }
.topbar { display: flex; align-items: center; gap: 14px; padding: var(--sat) 24px 0; box-sizing: content-box; background: var(--panel); border-bottom: 1px solid var(--line); min-height: 60px; }
.topbar h1 { font-size: 18px; white-space: nowrap; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.clock { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; }
.clock.srv { color: var(--brand); font-weight: 500; }
.clock.srv .pdot { background: var(--brand); }
.clock .pdot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }
#menuBtn { display: none; }

.view { flex: 1; overflow: auto; padding: 24px; }
.view.full { padding: 0; overflow: hidden; }
.page-h { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-h p { margin: 4px 0 0; color: var(--muted); }
.page-h .actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------- Controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text-2); padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-xs); transition: background .12s, border-color .12s; }
.btn:hover { background: var(--panel-2); color: var(--text); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-h); border-color: var(--brand-h); }
.btn.danger { color: var(--red-t); }
.btn.danger:hover { background: var(--red-b); border-color: var(--red-l); }
.btn.ghost { border-color: transparent; box-shadow: none; background: transparent; }
.btn.ghost:hover { background: var(--panel-3); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { position: relative; border: 1px solid transparent; background: transparent; color: var(--muted); width: 36px; height: 36px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--panel-3); color: var(--text); }
.icon-btn .badge { position: absolute; top: -4px; right: -8px; background: var(--red); color: #fff; border: 2px solid var(--panel); font-size: 10px; border-radius: 99px; padding: 0 5px; font-weight: 700; line-height: 14px; }
input, select, textarea { font: inherit; font-size: 14px; color: var(--text); background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 11px; outline: none; box-shadow: var(--shadow-xs); }
input:focus, select:focus, textarea:focus { border-color: var(--brand-line); box-shadow: 0 0 0 4px var(--brand-soft); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); padding: 0; box-shadow: none; margin: 0; }
input[type="range"] { accent-color: var(--brand); padding: 0; border: none; box-shadow: none; }
input[type="color"] { padding: 3px; height: 38px; }
label.fld { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); font-weight: 500; }
label.fld input, label.fld select, label.fld textarea { font-weight: 400; width: 100%; min-width: 0; max-width: 100%; }
select { text-overflow: ellipsis; }
label.fld .row { font-weight: 400; }
.fld-hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid .span2 { grid-column: span 2; }
.form-grid.add-dev { grid-template-columns: repeat(5, minmax(0, 1fr)) auto; align-items: end; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-2); background: var(--panel); border-radius: 7px; padding: 4px 10px; font-size: 12.5px; font-weight: 500; cursor: pointer; color: var(--text-2); display: inline-flex; gap: 6px; align-items: center; }
.chip:hover { background: var(--panel-2); }
.chip b { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); }
.chip.on { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.chip.on b { color: var(--brand); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { background: none; border: none; padding: 10px 12px; font: inherit; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow-xs); }
.seg button { border: none; border-right: 1px solid var(--line-2); background: var(--panel); padding: 7px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text-2); flex: 1; }
.seg button:last-child { border-right: none; }
.seg button:hover { background: var(--panel-2); }
.seg button.on { background: var(--panel-3); color: var(--text); }
.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 99px; cursor: pointer; transition: background .15s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(16, 24, 40, .2); transition: transform .15s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-xs); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; min-height: 56px; }
.card-h h2 { display: inline-flex; gap: 8px; align-items: center; }
.card-h h2 .ic { color: var(--muted); }
.card-h .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-h .actions input, .card-h .actions select { padding: 6px 10px; font-size: 13px; }
.card-b { padding: 18px; }
.card-b.flush { padding: 0; }
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.mb { margin-bottom: 20px; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { --c: var(--brand); position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow-xs); min-height: 108px; }
.kpi .lbl { color: var(--muted); font-size: 13px; font-weight: 500; padding-right: 44px; }
.kpi .lbl .ic { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; padding: 9px; border-radius: 8px; color: var(--c); background: color-mix(in srgb, var(--c) 11%, transparent); border: 1px solid color-mix(in srgb, var(--c) 22%, transparent); }
.kpi .lbl .dot { display: none; }
.kpi .val { font-size: 26px; font-weight: 600; margin-top: 8px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* Tables */
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 13.5px; }
td { color: var(--text-2); }
td b { color: var(--text); font-weight: 600; }
th { font-size: 12px; color: var(--muted); font-weight: 500; background: var(--panel-2); position: sticky; top: 0; z-index: 1; }
tbody tr:hover { background: var(--panel-2); }
tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 16px; color: var(--muted); font-size: 12.5px; }
td .ic { color: var(--muted); }

/* Badges & dots */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 500; background: var(--grey-b); border: 1px solid var(--grey-l); color: var(--grey-t); white-space: nowrap; line-height: 18px; }
.badge.green { background: var(--green-b); color: var(--green-t); border-color: var(--green-l); }
.badge.orange { background: var(--amber-b); color: var(--amber-t); border-color: var(--amber-l); }
.badge.red { background: var(--red-b); color: var(--red-t); border-color: var(--red-l); }
.badge.blue { background: var(--blue-b); color: var(--blue-t); border-color: var(--blue-l); }
.badge.grey { background: var(--grey-b); color: var(--grey-t); border-color: var(--grey-l); }
.badge.purple { background: var(--purple-b); color: var(--purple-t); border-color: var(--purple-l); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; vertical-align: 1px; }
.stars { color: #fdb022; letter-spacing: 1px; }

/* ---------- Maps ---------- */
.map { width: 100%; height: 100%; min-height: 300px; border-radius: 12px; z-index: 0; }
.map.flat { border-radius: 0; }
.leaflet-container { font: inherit; background: #e9ecf1; }
:root[data-theme="dark"] .leaflet-container { background: #10141d; }
/* Filtri i errët i hartës kërkon shumë memorie grafike – në aplikacionin Android nuk përdoret (përndryshe WebView nuk e vizaton faqen) */
html:not(.native-android)[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) grayscale(.55) brightness(.82) contrast(.9); }
.leaflet-bar { border: 1px solid var(--line-2) !important; border-radius: 8px !important; overflow: hidden; box-shadow: var(--shadow-xs) !important; }
.leaflet-bar a { background: var(--panel) !important; color: var(--text-2) !important; border-color: var(--line) !important; }
.leaflet-control-attribution { font-size: 10px; background: color-mix(in srgb, var(--panel) 80%, transparent) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-tooltip { background: var(--panel); color: var(--text); border: 1px solid var(--line-2); border-radius: 6px; box-shadow: var(--shadow-lg); font-size: 12px; }
.live { display: grid; grid-template-columns: 340px 1fr; height: 100%; }
.live-side { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.live-side .head { padding: 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.vlist { overflow-y: auto; flex: 1; }
.vitem { display: flex; gap: 11px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.vitem:hover { background: var(--panel-2); }
.vitem.sel { background: var(--brand-soft); box-shadow: 3px 0 0 var(--brand) inset; }
.vitem .p { font-weight: 600; font-size: 13.5px; }
.vitem .p small { font-weight: 500; }
.vitem .m { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vitem .r { margin-left: auto; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.vitem .r b { color: var(--text); font-size: 13.5px; }
.vitem .r .ic { width: 12px; height: 12px; }
.map-wrap { position: relative; min-width: 0; }
.drawer { position: absolute; top: 12px; right: 12px; bottom: 12px; width: 350px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 500; display: flex; flex-direction: column; overflow: hidden; }
.drawer .dh { padding: 16px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.drawer .db { padding: 16px; overflow-y: auto; flex: 1; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.kv > div { display: flex; flex-direction: column; gap: 2px; }
.kv .k { font-size: 12px; color: var(--muted); }
.kv .v { font-weight: 500; font-variant-numeric: tabular-nums; display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kv .v .ic { color: var(--muted); }
.section-t { font-size: 12px; font-weight: 600; color: var(--text-2); margin: 20px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.legend { position: absolute; left: 12px; bottom: 12px; z-index: 400; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; display: flex; gap: 14px; font-size: 12px; color: var(--text-2); box-shadow: var(--shadow-xs); flex-wrap: wrap; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.map-tools { position: absolute; top: 12px; left: 56px; z-index: 400; display: flex; gap: 6px; }
.replay-bar { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 450; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow-lg); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.replay-bar input[type=range] { flex: 1; min-width: 160px; }
.replay-bar select { padding: 5px 8px; font-size: 13px; }
.veh-arrow { width: 26px; height: 26px; display: grid; place-items: center; }
.veh-arrow svg { filter: drop-shadow(0 1px 2px rgba(16, 24, 40, .35)); }

/* Alarm list */
.alist { display: flex; flex-direction: column; }
.aitem { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.aitem:hover { background: var(--panel-2); }
.aitem > .ic { display: grid; place-items: center; width: 32px; height: 32px; padding: 7px; border-radius: 8px; background: var(--panel-3); color: var(--text-2); flex: none; }
.aitem .t { font-weight: 600; font-size: 13.5px; }
.aitem .d { font-size: 12.5px; color: var(--muted); }
.aitem.warning > .ic { background: var(--amber-b); color: var(--amber-t); }
.aitem.critical > .ic { background: var(--red-b); color: var(--red-t); }
.aitem.info > .ic { background: var(--blue-b); color: var(--blue-t); }
.aitem.critical { box-shadow: 3px 0 0 var(--red) inset; }
.aitem.acked { opacity: .55; }

/* Modal & toasts */
.modal { position: fixed; inset: 0; background: rgba(12, 17, 29, .55); display: flex; align-items: flex-start; justify-content: center; z-index: 2000; padding: 48px 16px; overflow-y: auto; }
.modal.hidden { display: none; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: min(720px, 100%); position: relative; box-shadow: 0 24px 48px -12px rgba(16, 24, 40, .25); }
.modal-box.wide { width: min(1000px, 100%); }
.modal-close { position: absolute; top: 14px; right: 14px; border: none; background: none; cursor: pointer; color: var(--muted); z-index: 2; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; }
.modal-close:hover { background: var(--panel-3); color: var(--text); }
.modal-h { padding: 20px 24px 16px; border-bottom: 1px solid var(--line); }
.modal-h h2 { font-size: 17px; display: flex; gap: 8px; align-items: center; }
.modal-h .muted { margin-top: 2px; }
.modal-b { padding: 20px 24px; }
.modal-f { padding: 14px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: var(--panel-2); border-radius: 0 0 14px 14px; }
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 12px 16px; box-shadow: var(--shadow-lg); width: 360px; cursor: pointer; display: flex; gap: 12px; animation: slidein .2s ease; }
.toast .ti { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand); }
.toast.critical .ti { background: var(--red-b); color: var(--red-t); }
.toast.warning .ti { background: var(--amber-b); color: var(--amber-t); }
.toast.ok .ti { background: var(--green-b); color: var(--green-t); }
.toast b { display: block; font-size: 13.5px; }
.toast span { font-size: 13px; }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } }

/* Rent */
.car-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.car { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--panel); display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-xs); font-size: 13px; }
.car .t { font-weight: 600; font-size: 14px; }
.bar { height: 6px; background: var(--panel-3); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.contract { font-size: 13px; line-height: 1.6; }
.contract h2 { text-align: center; margin-bottom: 4px; letter-spacing: .04em; }
.contract table td { white-space: normal; border: 1px solid var(--line-2); }
.sign { display: flex; justify-content: space-between; margin-top: 40px; }
.sign div { border-top: 1px solid var(--text); width: 40%; text-align: center; padding-top: 6px; }

/* Phones */
.phones { display: flex; gap: 32px; flex-wrap: wrap; justify-content: center; }
.phone-col { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.phone-col h3 { color: var(--muted); font-size: 13px; font-weight: 600; }
.phone { width: 330px; height: 660px; border: 10px solid #1d2939; border-radius: 42px; background: var(--bg); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); position: relative; }
.phone .notch { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 90px; height: 24px; background: #1d2939; border-radius: 16px; z-index: 5; }
.phone .ph { background: var(--brand); color: #fff; padding: 38px 16px 12px; display: flex; align-items: center; gap: 8px; }
.phone .pb { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.phone .pnav { display: flex; border-top: 1px solid var(--line); background: var(--panel); }
.phone .pnav button { flex: 1; background: none; border: none; padding: 9px 0 12px; font-size: 11px; font-weight: 500; color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.phone .pnav button.on { color: var(--brand); }
.phone .pcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 13px; }
.phone .bigbtn { width: 100%; padding: 12px; border-radius: 10px; border: none; font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; gap: 8px; justify-content: center; align-items: center; }
.phone .mini-map { height: 180px; flex: none; border-radius: 12px; border: 1px solid var(--line); }
.phone .seg { display: flex; }
.phone .seg button.on { color: #fff; }
.chat { display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 85%; padding: 8px 11px; border-radius: 12px; font-size: 13px; }
.msg.me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.them { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }

/* API docs */
.endpoint { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.method { font-family: var(--mono); font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 5px; min-width: 56px; text-align: center; }
.method.GET { color: var(--green-t); background: var(--green-b); }
.method.POST { color: var(--blue-t); background: var(--blue-b); }
.method.PUT { color: var(--amber-t); background: var(--amber-b); }
.method.DELETE { color: var(--red-t); background: var(--red-b); }
pre.code { background: #0c111d; color: #cecfd2; padding: 16px; border-radius: 10px; overflow: auto; margin: 0; max-height: 360px; border: 1px solid #1f242f; }
.flow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; padding: 8px 0; }
.flow .node { border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 16px; background: var(--panel-2); font-weight: 600; text-align: center; font-size: 13px; }
.flow .node small { font-weight: 400; }
.flow .node.main { background: var(--brand); color: #fff; border-color: var(--brand); }
.flow .node.main small { color: rgba(255, 255, 255, .8); }
.flow .arrow { color: var(--muted); }

.empty { padding: 36px; text-align: center; color: var(--muted); }
.hint { font-size: 13px; color: var(--text-2); background: var(--panel-2); border: 1px solid var(--line); padding: 10px 12px; border-radius: 8px; }
.perm td, .perm th { text-align: center; }
.perm td:first-child, .perm th:first-child { text-align: left; }
.perm .ic { color: var(--green); }

/* ---------- Super Admin: modulet ---------- */
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.mod { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.mod.on { border-color: var(--brand-line); background: var(--brand-soft); }
.mod .mi { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: var(--panel-3); color: var(--text-2); flex: none; }
.mod.on .mi { background: var(--brand); color: #fff; }
.mod .mt { font-weight: 600; font-size: 13.5px; }
.mod .md { font-size: 12.5px; color: var(--muted); }
.mod .switch { margin-left: auto; }
.mod-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.mod-check { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; cursor: pointer; }
.mod-check:has(input:checked) { border-color: var(--brand-line); background: var(--brand-soft); }
.mod-check.dis { opacity: .5; cursor: not-allowed; }
.mod-check .ic { color: var(--muted); }
.mods-inline { display: flex; gap: 4px; flex-wrap: wrap; }
.mods-inline .ic { width: 26px; height: 26px; padding: 5px; border-radius: 6px; background: var(--panel-3); color: var(--text-2); }
.co-cell { display: flex; gap: 10px; align-items: center; }
.co-logo { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; flex: none; }

/* ---------- Login ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; background: var(--panel); }
.login-art { background: #0c111d; color: #cecfd2; padding: 48px 56px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.login-art svg.routes { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; }
.login-art > * { position: relative; }
.login-art .brand { padding: 0; }
.login-art h1 { color: #fff; font-size: 34px; line-height: 1.2; margin: auto 0 16px; max-width: 520px; letter-spacing: -.02em; }
.login-art p { font-size: 15px; color: #94969c; max-width: 480px; margin: 0 0 32px; }
.login-feats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; max-width: 520px; margin-bottom: auto; }
.login-feats div { display: flex; gap: 10px; align-items: center; font-size: 14px; color: #cecfd2; }
.login-feats .ic { width: 32px; height: 32px; padding: 7px; border-radius: 8px; background: #161b26; border: 1px solid #262b36; color: #84adff; }
.login-art .foot { font-size: 12.5px; color: #61646c; margin-top: 32px; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 48px 24px; background: var(--panel); }
.login-form form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 18px; }
.login-form h2 { font-size: 26px; letter-spacing: -.02em; }
.login-form .err { background: var(--red-b); color: var(--red-t); border: 1px solid var(--red-l); padding: 9px 12px; border-radius: 8px; font-size: 13px; }
.demo-acc { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.demo-acc .h { padding: 9px 12px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel-2); border-bottom: 1px solid var(--line); }
.demo-acc button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border: none; border-bottom: 1px solid var(--line); background: var(--panel); cursor: pointer; font: inherit; text-align: left; color: var(--text); }
.demo-acc button:last-child { border-bottom: none; }
.demo-acc button:hover { background: var(--panel-2); }
.demo-acc button small { display: block; }

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g-2-1, .g-1-2 { grid-template-columns: minmax(0, 1fr); }
  .form-grid.add-dev { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* ---------- Telefon & aplikacioni mobil ---------- */
html { -webkit-tap-highlight-color: transparent; }
button, a, .chip, .vitem, tr.clickable { touch-action: manipulation; }
.m-only, .tabbar, .scrim, .side-close { display: none; }
.imp-bar { padding-top: max(8px, var(--sat)); }
.imp-bar:not(.hidden) + .topbar { padding-top: 0; }

@media (max-width: 900px) {
  html, body { overscroll-behavior: none; }
  .m-only { display: block; }
  .btn.m-only { display: inline-flex; }
  .d-only { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); z-index: 1500; transform: translateX(-102%); transition: transform .22s ease; padding-top: var(--sat); padding-bottom: var(--sab); }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .45); }
  .side-close { display: grid; margin-left: auto; color: var(--side-muted); }
  .side-close:hover { background: var(--side-2); color: #fff; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(12, 17, 29, .5); z-index: 1400; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .scrim.on { opacity: 1; pointer-events: auto; }
  .sidebar nav a { padding: 11px 10px; font-size: 15px; }
  #menuBtn { display: none; }
  .topbar { padding: var(--sat) 12px 0 16px; min-height: 54px; gap: 8px; }
  .topbar h1 { font-size: 17px; overflow: hidden; text-overflow: ellipsis; }
  .clock, #companySel { display: none; }
  .view { padding: 14px 14px 20px; -webkit-overflow-scrolling: touch; }

  /* Shiriti i poshtëm */
  .tabbar { display: flex; flex-direction: row; flex: none; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: var(--sab); z-index: 900; user-select: none; -webkit-user-select: none; }
  .tabbar a, .tabbar button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 8px 2px 7px; min-height: 56px; color: var(--muted); font: inherit; font-size: 11px; font-weight: 500; background: none; border: none; cursor: pointer; position: relative; }
  .tabbar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tabbar .active { color: var(--brand); }
  .tabbar .tb-badge { position: absolute; top: 5px; left: calc(50% + 6px); background: var(--red); color: #fff; font-style: normal; font-size: 10px; font-weight: 700; line-height: 15px; padding: 0 5px; border-radius: 99px; border: 2px solid var(--panel); }

  /* Forma: 16px që iOS të mos zmadhojë faqen */
  input, select, textarea { font-size: 16px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span2 { grid-column: auto; }
  .form-grid.add-dev { grid-template-columns: minmax(0, 1fr); }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .modal-box { overflow-x: hidden; }
  .kv { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .grid { gap: 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
  .kpi { padding: 14px; min-height: 0; }
  .kpi .lbl { font-size: 12.5px; padding-right: 36px; }
  .kpi .lbl .ic { top: 12px; right: 12px; width: 30px; height: 30px; padding: 7px; }
  .kpi .val { font-size: 21px; }
  .card-h { padding: 12px 14px; }
  .card-h .actions { margin-left: 0; width: 100%; }
  .card-h .actions input, .card-h .actions select { flex: 1; min-width: 0; font-size: 16px; }
  .card-b { padding: 14px; }
  .page-h .actions { margin-left: 0; }
  th, td { padding: 10px 12px; }
  .mb { margin-bottom: 14px; }

  /* Dritaret (modal) në ekran të plotë */
  .modal { padding: 0; align-items: stretch; }
  .modal-box, .modal-box.wide { width: 100%; min-height: 100%; border-radius: 0; border: none; padding-top: var(--sat); display: flex; flex-direction: column; }
  #modalBody { flex: 1; display: flex; flex-direction: column; }
  .modal-b { flex: 1; padding: 16px; }
  .modal-h { padding: 16px 56px 12px 16px; }
  .modal-close { top: calc(10px + var(--sat)); right: 8px; }
  .modal-f { position: sticky; bottom: 0; border-radius: 0; padding: 12px 16px calc(12px + var(--sab)); flex-wrap: wrap; }
  .modal-f .btn { flex: 1; }

  #toasts { left: 12px; right: 12px; bottom: auto; top: calc(10px + var(--sat)); }
  .toast { width: auto; }

  /* Live Map: harta në ekran të plotë, lista si panel */
  .live { grid-template-columns: 1fr; grid-template-rows: 1fr; position: relative; }
  .live-side { position: absolute; inset: 0; z-index: 700; border: none; transform: translateX(-100%); transition: transform .22s ease; }
  .live.show-list .live-side { transform: none; }
  .map-tools { left: 54px; right: 12px; flex-wrap: wrap; }
  .drawer { width: auto; left: 8px; right: 8px; top: auto; bottom: 8px; max-height: 62%; border-radius: 16px; }
  .drawer .dh::before { content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--line-2); }
  .drawer .dh { position: relative; padding-top: 18px; }
  .legend { display: none; }
  .replay-bar { left: 8px; right: 8px; bottom: 8px; gap: 8px; }

  /* Faqe specifike */
  .tx-map { height: 340px !important; }
  .tx-orders { height: auto !important; max-height: 70vh; }
  .geo-layout { height: auto !important; min-height: 0 !important; }
  .geo-layout .geo-map { height: 60vh; }
  .dash-map { height: 300px !important; }
  .phones { gap: 20px; }
  .phone { width: 100%; max-width: 360px; height: 620px; border-width: 6px; }
  .car-grid { grid-template-columns: 1fr; }
  .mod-grid, .mod-list { grid-template-columns: 1fr; }
  .imp-bar { flex-wrap: wrap; padding-left: 14px; padding-right: 14px; }
  .imp-bar .btn { margin-left: 0; }
  .endpoint { flex-wrap: wrap; row-gap: 4px; }
  .endpoint > span.muted { margin-left: 0 !important; text-align: left !important; flex-basis: 100%; }
  .endpoint code { word-break: break-all; }

  /* Hyrja */
  .login { grid-template-columns: 1fr; min-height: 100dvh; }
  .login-art { display: none; }
  .login-form { align-items: flex-start; padding: calc(28px + var(--sat)) 20px calc(24px + var(--sab)); }
  .login-form .m-only.brand { display: flex; padding: 0 0 8px; }
  .login-form .brand b { color: var(--text); }
}

@media print {
  :root { --bg: #fff; --panel: #fff; --panel-2: #fff; --text: #000; --muted: #444; --line: #ccc; --line-2: #999; }
  .sidebar, .topbar, .imp-bar, .modal-close, .modal-f, #toasts { display: none !important; }
  .modal { position: static; background: none; padding: 0; }
  .modal-box { box-shadow: none; width: 100%; border: none; }
}
