/* Police platform - Thervise look: dark navy bar, green actions, red for stolen. */
:root {
  --bg: #f1f5f9; --card: #ffffff; --ink: #0f172a; --muted: #64748b; --line: #e2e8f0;
  --navy: #0b1220; --navy2: #111a2e; --green: #10b981; --green-d: #059669; --red: #ef4444; --red-bg: #fef2f2;
  --amber: #f59e0b; --radius: 14px; --shadow: 0 10px 30px rgba(15, 23, 42, .12);
  font-family: 'Geist', 'Noto Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
html[lang="ar"] { font-family: 'Noto Sans Arabic', 'Geist', system-ui, sans-serif; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); display: flex; flex-direction: column; font-size: 15px; }
body.booting main { visibility: hidden; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: 'Geist', ui-monospace, Consolas, monospace; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }

/* bar */
#bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 18px; background: var(--navy); color: #e2e8f0; flex: none; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.brand-sub { font-size: 12px; color: #94a3b8; }
.bar-end { display: flex; align-items: center; gap: 14px; }
.langs { display: flex; background: var(--navy2); border-radius: 10px; padding: 3px; }
.langs button { border: 0; background: transparent; color: #94a3b8; padding: 5px 10px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.langs button.on { background: #1e293b; color: #fff; }
.who { display: flex; align-items: center; gap: 12px; }
.who-name { font-weight: 600; font-size: 14px; }
.who-scope { font-size: 12px; color: #94a3b8; }

/* buttons, forms */
.btn { border: 1px solid transparent; border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 600; background: #e2e8f0; }
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-d); }
.btn.good { background: var(--green); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line); }
#bar .btn.ghost { border-color: #334155; color: #e2e8f0; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn.danger { color: var(--red); border-color: #fecaca; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .item:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 12px; flex: 1; }
input, select, textarea { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; color: var(--ink); font-size: 15px; }
textarea.mono { font-size: 12px; }
.err { background: var(--red-bg); color: #b91c1c; border-radius: 10px; padding: 9px 12px; margin-bottom: 12px; font-size: 14px; }
.msg { border-radius: 10px; padding: 10px 12px; margin: 4px 0 12px; font-size: 14px; }
.msg.ok { background: #ecfdf5; color: #065f46; }
.msg.err { background: var(--red-bg); color: #b91c1c; }
.msg pre { margin: 8px 0 0; white-space: pre-wrap; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card h1 { margin: 0 0 6px; font-size: 22px; }
.card h2 { margin: 0 0 14px; font-size: 17px; }
.card p { margin: 0 0 18px; }
.narrow { width: min(400px, calc(100vw - 32px)); }
.center-view { flex: 1; display: grid; place-items: center; padding: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }

/* police view */
.police { flex: 1; display: flex; min-height: 0; }
.side { width: 380px; flex: none; background: var(--card); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-head { padding: 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.tabs { display: flex; gap: 6px; background: var(--bg); padding: 4px; border-radius: 12px; }
.tab { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--muted); font-size: 14px; }
.tab.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.tab b { background: var(--red); color: #fff; border-radius: 99px; padding: 0 7px; font-size: 12px; margin-inline-start: 4px; }
.live-line { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(16, 185, 129, .2); }
.list { overflow: auto; flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.item:hover { border-color: #cbd5e1; }
.item.sel { border-color: var(--red); box-shadow: 0 0 0 2px rgba(239, 68, 68, .15); }
.item.closed { opacity: .85; }
.item-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--red-bg); color: var(--red); flex: none; }
.item-ic.moving { background: var(--red); color: #fff; }
.item-ic.ok { background: #ecfdf5; color: var(--green-d); }
.item-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.item-title { font-weight: 700; font-size: 15px; direction: ltr; unicode-bidi: plaintext; text-align: start; }
.item-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.item-ago { font-size: 12px; color: var(--muted); }
.item-inst { font-size: 11px; color: #94a3b8; max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { padding: 30px 20px; text-align: center; color: var(--muted); }

.mapwrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: #e5e7eb; }
.detail { position: absolute; top: 14px; inset-inline-start: 14px; width: 360px; max-height: calc(100% - 28px); overflow: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; z-index: 500; }
.detail .x { position: absolute; top: 8px; inset-inline-end: 8px; border: 0; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 6px; }
.dhead { margin-bottom: 12px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.badge.stolen { background: var(--red); color: #fff; }
.badge.ok { background: #ecfdf5; color: var(--green-d); }
.dtitle { font-size: 22px; font-weight: 800; margin-top: 8px; direction: ltr; unicode-bidi: plaintext; text-align: start; }
.dsub { color: var(--muted); font-size: 14px; }
.dphoto { width: 100%; max-height: 180px; object-fit: cover; border-radius: 10px; margin-bottom: 12px; background: var(--bg); }
.dlive { display: flex; gap: 14px; align-items: center; background: var(--bg); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.dspeed { width: 64px; height: 64px; border-radius: 50%; border: 4px solid #cbd5e1; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; background: #fff; }
.dspeed.moving { border-color: var(--red); }
.dspeed b { font-size: 20px; line-height: 1; }
.dspeed small { font-size: 10px; color: var(--muted); }
.dstate { font-weight: 700; }
.dlive-text { font-size: 13px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.drows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.drow { display: flex; gap: 10px; font-size: 14px; }
.dk { width: 96px; flex: none; color: var(--muted); }
.dv { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.phone { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.phone a { color: var(--green-d); font-weight: 700; direction: ltr; unicode-bidi: isolate; }
.dactions { display: flex; flex-wrap: wrap; gap: 8px; }
.dactions .btn { flex: 1 1 auto; }

/* map marks */
.pmark-wrap { background: transparent; border: 0; }
.pmark { display: flex; align-items: center; gap: 6px; transform: translate(0, 0); }
.pmark-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--red); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); flex: none; }
.pmark.moving .pmark-dot { animation: pulse 1.6s infinite; }
.pmark.sel .pmark-dot { width: 22px; height: 22px; }
.pmark-label { background: #7f1d1d; color: #fff; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; white-space: nowrap; direction: ltr; unicode-bidi: plaintext; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .6); } 70% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
.ptrack { stroke: #dc2626; stroke-dasharray: 8 6; }

/* admin */
.admin { flex: 1; overflow: auto; padding: 18px; max-width: 1200px; width: 100%; margin: 0 auto; }
.admin-tabs { max-width: 520px; }
.adm-note { margin: 10px 0 16px; font-size: 13px; }
.adm-sec .card { margin-bottom: 16px; }
.tbl { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); font-size: 14px; }
.tbl th, .tbl td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 13px; }
.tbl tr.dim td { color: #94a3b8; }
.tbl td.acts { display: flex; gap: 6px; flex-wrap: wrap; }

.toast { position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); z-index: 2000; font-weight: 600; max-width: calc(100vw - 32px); }
html[dir="rtl"] .toast { transform: translateX(50%); }

/* phone */
@media (max-width: 820px) {
  #bar { padding: 8px 10px; gap: 8px; }
  .brand-sub, .brand-name, .who-scope { display: none; }
  .bar-end { gap: 8px; min-width: 0; }
  .langs button { padding: 4px 7px; }
  .who { gap: 8px; min-width: 0; }
  .who-name { max-width: 30vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
  .police { flex-direction: column-reverse; }
  .side { width: 100%; height: 42%; border: 0; border-top: 1px solid var(--line); }
  .mapwrap { height: 58%; flex: none; }
  .detail { inset-inline: 10px; width: auto; top: 10px; max-height: calc(100% - 20px); }
  .tbl { display: block; overflow-x: auto; white-space: nowrap; }
}
