/* ==========================================================================
   الإدارة — أداة عمل تُقرأ من قريب: سلّم خطّ أصغر وأكثف من صفحة الهبوط،
   ومحصور في هذه المنطقة وحدها (body.admin).
   ========================================================================== */

body.admin { font-size: 14px; line-height: 1.6; }
.admin .shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

/* ---------- الشريط الجانبي (لون العلامة في الوضعين) ---------- */
.sidebar {
    position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
    background: var(--navy-800); color: #DDE6F0; padding: 18px 14px; overflow-y: auto;
}
.sidebar .brand { color: #fff; padding: 4px 8px 18px; }
.sidebar .brand-mark { width: 34px; height: 34px; }
.side-label { font-size: 11px; letter-spacing: .4px; color: #7F95AD; padding: 14px 10px 6px; font-weight: 700; }
.side-nav { display: grid; gap: 2px; }
.side-nav a {
    position: relative; display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 11px; text-decoration: none; font-weight: 600; color: #C3D1E0;
}
.side-nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.side-nav a.active { background: rgba(245, 165, 36, .12); color: #fff; }
/* المؤشر: قوس من الحلقة الكهرمانية على حافة البداية */
.side-nav a.active::before {
    content: ""; position: absolute; inset-inline-start: -14px; top: 8px; bottom: 8px; width: 4px;
    border-start-end-radius: 4px; border-end-end-radius: 4px; background: var(--amber);
}
.side-nav .count { margin-inline-start: auto; min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11.5px; text-align: center; font-weight: 700; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 14px; display: grid; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.me-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--navy-600); color: var(--amber); font-weight: 800; }
.me small { display: block; color: #7F95AD; font-size: 11.5px; direction: ltr; text-align: end; }
.side-actions { display: flex; gap: 8px; }
.side-actions .btn { flex: 1; min-height: 34px; font-size: 12.5px; }
.theme-btn .i-moon { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-moon { display: inline; }

/* ---------- المحتوى ---------- */
.main { min-width: 0; padding: 22px 28px 48px; }
.scrim { display: none; }
.topbar { display: none; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 21px; font-weight: 800; }
.page-head p { color: var(--muted); font-size: 13px; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: 8px; }

.flash {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; margin-bottom: 16px;
    background: var(--ok-soft); color: var(--ok); font-weight: 700;
}
.flash-warn { background: var(--amber-soft); color: var(--amber-strong); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; }
.card-head h2 { font-size: 14.5px; font-weight: 800; }
.card-head .muted { font-size: 12px; margin-inline-start: auto; }
.card-body { padding: 14px 16px 16px; }

/* بطاقات الأرقام */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.kpi { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.kpi .ring { flex: none; }
.kpi-label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi-value { font-size: 24px; font-weight: 800; line-height: 1.25; }
.kpi-delta { font-size: 11.5px; font-weight: 700; }
.kpi-delta.up { color: var(--ok); }
.kpi-delta.down { color: var(--danger); }
.kpi.alert { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.kpi.alert .ring .ring-fill { stroke: var(--danger); }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-bottom: 14px; }

/* الرسوم */
.chart { width: 100%; height: 180px; display: block; }
.grid-2 > .card:first-child .chart { height: 230px; }
.chart .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--ff); }
.chart .stroke { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; }
.chart .yes { fill: var(--ok); }
.chart .no { fill: var(--danger); }
.chart .empty { fill: var(--line); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 5px; vertical-align: -1px; }

.bars { display: grid; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 30px 1fr 40px; align-items: center; gap: 10px; }
.bar-row .type-badge { width: 30px; height: 30px; border-radius: 10px; }
.bar-name { font-size: 13px; font-weight: 600; }
.bar-track { height: 7px; border-radius: 6px; background: var(--card-hi); margin-top: 3px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--tone); }
.bar-row .num { font-weight: 800; text-align: end; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list b { display: block; font-size: 13.5px; }
.list small { color: var(--muted); font-size: 12px; }

.empty-state { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty-state svg { color: var(--line); }
.empty-state b { display: block; color: var(--text); font-size: 15px; margin-top: 8px; }

/* ---------- الجداول ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px; border-bottom: 1px solid var(--line); }
.tabs { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--card-hi); border: 1px solid var(--line); }
.tabs a { padding: 5px 12px; border-radius: 9px; text-decoration: none; font-weight: 700; font-size: 12.5px; color: var(--muted); }
.tabs a.active { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }
.field, select.field, input.field {
    font: inherit; font-size: 13px; color: var(--text); background: var(--card);
    border: 1.5px solid var(--line); border-radius: 11px; min-height: 36px; padding: 0 12px;
}
.field:focus { outline: none; border-color: var(--amber); box-shadow: var(--focus); }
.search { position: relative; flex: 1; min-width: 180px; }
.search svg { position: absolute; inset-inline-start: 10px; top: 9px; color: var(--muted); }
.search .field { width: 100%; padding-inline-start: 34px; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: start; font-size: 11.5px; color: var(--muted); font-weight: 700; padding: 9px 12px; background: var(--card-hi); white-space: nowrap; }
.table td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: color-mix(in srgb, var(--card-hi) 60%, transparent); }
.cell-type { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.cell-type b { display: block; font-size: 13px; }
.cell-type small { color: var(--muted); font-size: 11.5px; }
.votes { display: inline-flex; gap: 6px; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-actions form { display: contents; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--card-hi); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.pager .btns { display: flex; gap: 6px; }

/* ---------- النموذج ---------- */
.form-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; }
.form-row { display: grid; gap: 6px; margin-bottom: 14px; }
.form-row label { font-weight: 700; font-size: 12.5px; }
.form-row .hint { color: var(--muted); font-size: 11.5px; }
.form-row .field { width: 100%; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.type-pick label {
    display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 12px; cursor: pointer;
    border: 1.5px solid var(--line); background: var(--card); font-weight: 600; font-size: 12.5px;
}
.type-pick input { position: absolute; opacity: 0; pointer-events: none; }
.type-pick label:has(input:checked) { border-color: var(--amber); background: var(--amber-soft); }
.type-pick label:has(input:focus-visible) { box-shadow: var(--focus); }
.type-pick .type-badge { width: 30px; height: 30px; border-radius: 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--line); font-weight: 700; font-size: 12.5px; }
.seg input:checked + span { background: var(--amber); border-color: var(--amber); color: var(--on-accent); }
.seg input:focus-visible + span { box-shadow: var(--focus); }
.errors { color: var(--danger); font-weight: 700; font-size: 12.5px; margin-bottom: 10px; }
.errors ul { margin: 0; padding-inline-start: 18px; }
.field-error { color: var(--danger); font-size: 11.5px; }

/* بوصلة الاتجاه */
.compass { position: relative; width: 150px; height: 150px; margin: 6px auto 4px; }
.compass .dial { width: 100%; height: 100%; }
.compass .dial circle { fill: var(--card-hi); stroke: var(--line); stroke-width: 2; }
.compass .dial text { fill: var(--muted); font-size: 11px; font-family: var(--ff); font-weight: 700; }
.compass .needle { position: absolute; inset: 0; display: grid; place-items: center; color: var(--amber); transition: transform .3s var(--ease); }
.compass.both .needle { color: var(--muted); }

/* ---------- المراجعة ---------- */
.review-list { display: grid; gap: 12px; }
.review { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; }
.review h3 { font-size: 14.5px; }
.review .meta { color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.ratio { display: flex; height: 7px; border-radius: 6px; overflow: hidden; background: var(--card-hi); margin-top: 8px; max-width: 320px; }
.ratio .y { background: var(--ok); }
.ratio .n { background: var(--danger); }
.review .acts { display: flex; gap: 8px; }
.review form { display: contents; }

/* ---------- الدخول ---------- */
.auth {
    min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
    background: radial-gradient(700px 400px at 80% 0%, rgba(43, 86, 131, .5), transparent 60%), var(--navy-800);
}
.auth-card { width: min(400px, 100%); background: var(--card); border-radius: 24px; padding: 30px 26px; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6); }
.auth-card .brand { justify-content: center; width: 100%; margin-bottom: 6px; }
.auth-card h1 { text-align: center; font-size: 19px; margin-bottom: 4px; }
.auth-card p.muted { text-align: center; font-size: 13px; margin-bottom: 20px; }
.auth-card .btn { width: 100%; margin-top: 6px; }
.auth-back { display: block; text-align: center; margin-top: 16px; color: var(--muted); font-size: 12.5px; }

/* ---------- الجوال ---------- */
@media (max-width: 1100px) {
    .kpis { grid-template-columns: repeat(2, 1fr); }
    .grid-2, .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .admin .shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 260px; z-index: 40; transform: translateX(100%); transition: transform .25s var(--ease); }
    .menu-open .sidebar { transform: none; }
    .menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 30; }
    .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; padding: 10px 16px; background: var(--navy-800); color: #fff; }
    .topbar .brand { color: #fff; }
    .topbar .brand-mark { width: 30px; height: 30px; }
    .topbar .btn { margin-inline-start: auto; }
    .main { padding: 16px 16px 40px; }
    .page-head .actions { margin-inline-start: 0; width: 100%; }
    .page-head .actions .btn { flex: 1; }

    /* الجدول يصير بطاقات */
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { padding: 10px 12px; border-top: 1px solid var(--line); }
    .table td { border: 0; padding: 3px 0; }
    .table td[data-label]::before { content: attr(data-label) " · "; color: var(--muted); font-size: 11.5px; }
    .row-actions { justify-content: flex-start; margin-top: 6px; }
    .review { grid-template-columns: auto 1fr; }
    .review .acts { grid-column: 1 / -1; }
    .review .acts .btn { flex: 1; }
}
@media (max-width: 520px) {
    .kpis { grid-template-columns: 1fr; }
    .two { grid-template-columns: 1fr; }
}

/* ---------- إضافات: العملاء، الأدمنز، الرسائل ---------- */
.me-link { text-decoration: none; color: inherit; }
.me-link:hover b { color: var(--amber); }
code.secret { background: rgba(0, 0, 0, .12); padding: 2px 8px; border-radius: 8px; user-select: all; font-size: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; object-fit: cover; display: grid; place-items: center; background: var(--navy-600); color: var(--amber); font-weight: 800; }
.avatar.lg { width: 64px; height: 64px; font-size: 24px; }
.cell-user { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.cell-user b { display: block; font-size: 13px; }
.cell-user small { color: var(--muted); font-size: 11.5px; direction: ltr; display: block; text-align: end; }
.profile { display: flex; align-items: center; gap: 16px; padding: 18px; flex-wrap: wrap; }
.profile h2 { font-size: 18px; }
.profile .muted { font-size: 12.5px; }
.profile .acts { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.profile form { display: contents; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.mini-stats .card { padding: 12px 14px; }
.mini-stats b { display: block; font-size: 20px; }
.mini-stats span { color: var(--muted); font-size: 12px; }
.timeline-list { list-style: none; margin: 0; padding: 0; }
.timeline-list li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); align-items: center; }
.timeline-list li:first-child { border-top: 0; }
.timeline-list .grow { flex: 1; min-width: 0; }
.timeline-list b { font-size: 13px; }
.timeline-list small { display: block; color: var(--muted); font-size: 11.5px; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 13px; font-weight: 600; }
.banner-danger { background: var(--danger-soft); color: var(--danger); }
.banner-info { background: var(--amber-soft); color: var(--amber-strong); }
.msg { padding: 14px 16px; }
.msg.unread { border-inline-start: 4px solid var(--amber); }
.msg header { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.msg h3 { font-size: 14px; }
.msg p { margin-top: 8px; white-space: pre-wrap; font-size: 13.5px; }
.msg .acts { display: flex; gap: 6px; margin-top: 10px; }
.msg form { display: contents; }
.role-form { display: inline-flex; gap: 6px; align-items: center; }
.role-form .field { min-height: 30px; font-size: 12px; padding: 0 8px; }
.section-title { font-size: 15px; font-weight: 800; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.stack { display: grid; gap: 12px; }
@media (max-width: 860px) {
    .mini-stats { grid-template-columns: repeat(2, 1fr); }
    .profile .acts { margin-inline-start: 0; width: 100%; }
}

/* ==========================================================================
   الخريطة (الرئيسية): الخريطة تملأ الشاشة، واللوحة تطفو فوقها.
   ========================================================================== */
.admin-map .main { padding: 0; display: flex; flex-direction: column; height: 100vh; }
.map-page { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.admin-map .flash { margin: 12px 16px 0; }

.map-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--card); }
.map-bar h1 { font-size: 19px; font-weight: 800; }
.map-bar .map-country { width: auto; min-width: 120px; padding-block: 6px; }
.map-search { position: relative; flex: 1 1 280px; max-width: 420px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--card); color: var(--muted); }
.map-search:focus-within { border-color: var(--amber); box-shadow: var(--focus); }
.map-search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: var(--text); padding: 8px 0; outline: none; }
.map-results { position: absolute; top: calc(100% + 6px); inset-inline: 0; z-index: 1200; list-style: none; margin: 0; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); max-height: 320px; overflow: auto; }
.map-results button { display: block; width: 100%; text-align: start; border: 0; background: none; font: inherit; font-size: 13px; color: var(--text); padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.map-results button:hover { background: var(--card-hi); }
.map-results .muted { padding: 8px 10px; }

.map-filters, .map-attn { display: flex; gap: 6px; flex-wrap: wrap; }
.map-attn { margin-inline-start: auto; }
.map-filters .chip { cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 700; padding: 5px 11px; opacity: .55; }
.map-filters .chip.on { opacity: 1; background: var(--card); }
.map-filters .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--tone); }
.map-attn .chip { font-size: 12.5px; padding: 5px 11px; text-decoration: none; }
.chip-warn { background: var(--amber-soft); color: var(--amber-strong); border-color: transparent; }

.map-wrap { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; background: var(--card-hi); }
.map-wrap.picking #map, .map-wrap.picking .leaflet-interactive { cursor: crosshair; }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 10.5px; }
/* الوضع الداكن: نعتّم مربعات الخريطة نفسها */
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.82) contrast(.9) saturate(.6); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.82) contrast(.9) saturate(.6); }
}

.map-hint { position: absolute; z-index: 800; top: 14px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--navy-800); color: #fff; font-weight: 700; font-size: 13px; box-shadow: var(--shadow); pointer-events: none; white-space: nowrap; }
.map-hint svg { color: var(--amber); }

/* الدبابيس */
.lm-host { background: none; border: 0; }
.lm { position: relative; width: 34px; height: 34px; }
.lm-face { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 50%; background: var(--tone); color: #fff; border: 2.5px solid #fff; box-shadow: 0 3px 8px rgba(11, 30, 49, .35); transition: transform .15s var(--ease); }
.lm.tone-hazard .lm-face { color: #2A2100; }
/* السرعة القانونية: شاخصة صغيرة فوق الدبوس */
.lm-speed { position: absolute; z-index: 2; top: -9px; inset-inline-start: -11px; min-width: 22px; height: 22px; padding: 0 2px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: #111; border: 2.5px solid #E5484D; font-size: 10.5px; font-weight: 800; line-height: 1; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
/* من بعيد: نقطة بلون التصنيف */
.lm-dot { display: block; width: 12px; height: 12px; border-radius: 50%; background: var(--tone); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(11, 30, 49, .45); }
.lm-dot.pending { border-style: dashed; }
.lm-face svg { width: 17px; height: 17px; }
.lm:hover .lm-face { transform: scale(1.12); }
.lm.selected .lm-face, .lm.draft .lm-face { transform: scale(1.22); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tone) 35%, transparent), 0 4px 12px rgba(11, 30, 49, .4); }
.lm.pending .lm-face { border-style: dashed; opacity: .8; }
.lm.pending::after { content: ""; position: absolute; top: -3px; inset-inline-end: -3px; width: 11px; height: 11px; border-radius: 50%; background: #8E7CC3; border: 2px solid #fff; }
.lm-new { --tone: var(--navy-800); }
/* سهم اتجاه السير حول الدبوس */
.lm-dir { position: absolute; inset: -11px; pointer-events: none; }
.lm-dir::before { content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top: 0; border-bottom: 9px solid var(--tone); filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .35)); }

/* اللوحة العائمة */
.map-panel { position: absolute; z-index: 900; top: 14px; max-height: calc(100% - 28px); inset-inline-end: 14px; width: 360px; overflow-y: auto; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.map-panel[hidden] { display: none; }
.mp-head { display: flex; align-items: center; gap: 10px; }
.mp-head > div { flex: 1; min-width: 0; }
.mp-head b { display: block; font-size: 15px; font-weight: 800; }
.mp-head small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-badge.lm-new { --tone: var(--muted); }
.mp-note { color: var(--muted); font-size: 12px; margin: -4px 0 0; }
.mp-label { display: flex; align-items: baseline; gap: 6px; font-weight: 800; font-size: 13px; margin-bottom: 6px; }
.mp-label small { color: var(--muted); font-weight: 600; font-size: 11.5px; }
.mp-row[hidden] { display: none; }
.mp-row .field { width: 100%; }
.mp-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--card-hi); border: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--muted); }
.tag svg { width: 13px; height: 13px; }
.tag-warn { background: #EFEAFB; color: #6B58A8; border-color: transparent; }
/* السرعة المحددة: حلقة حمراء كإشارة السرعة */
.tag-speed { border: 2px solid var(--danger); color: var(--text); background: transparent; }
.mp-meta { display: grid; gap: 6px; margin: 0; font-size: 13px; }
.mp-meta > div { display: flex; justify-content: space-between; gap: 10px; }
.mp-meta dt { color: var(--muted); }
.mp-meta dd { margin: 0; font-weight: 700; }
.mp-meta .yes { color: var(--ok); }
.mp-meta .no { color: var(--danger); }
.mp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mp-actions .btn { flex: 1; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* شبكة الأنواع */
.tp-group small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 700; margin-bottom: 5px; }
.tp-group + .tp-group { margin-top: 8px; }
.tp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.tp { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border: 1.5px solid var(--line); border-radius: 13px; background: var(--card); color: var(--text); font: inherit; font-size: 10.5px; font-weight: 700; line-height: 1.25; text-align: center; cursor: pointer; }
.tp:hover { background: var(--card-hi); }
.tp.on { border-color: var(--amber); background: var(--amber-soft); }
.tp .type-badge { width: 28px; height: 28px; border-radius: 9px; }
.tp .type-badge svg { width: 16px; height: 16px; }
.seg-sm button { font: inherit; font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; }
.seg-sm button svg { width: 15px; height: 15px; }
.seg-sm button.on { background: var(--amber); border-color: var(--amber); color: var(--on-accent); }

.map-toast { position: absolute; z-index: 1000; bottom: 22px; left: 50%; transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; background: var(--ok); color: #fff; font-weight: 700; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.map-toast[hidden] { display: none; }
.map-toast.bad { background: var(--danger); }

/* أدوات الإضافة: إضافة سريعة واستيراد */
.map-tools { display: flex; gap: 6px; }
.map-tools .btn.on { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.map-wrap.quick #map { cursor: crosshair; }
.map-wrap.quick .map-toast { bottom: 150px; }

/* خريطة / قمر صناعي */
.map-base { position: absolute; z-index: 800; top: 14px; inset-inline-start: 14px; display: flex; padding: 3px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.map-base button { border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 5px 12px; border-radius: 999px; cursor: pointer; }
.map-base button.on { background: var(--amber); color: var(--on-accent); }

/* شريط الإضافة السريعة */
.quick-bar { position: absolute; z-index: 950; bottom: 16px; left: 50%; transform: translateX(-50%); width: min(920px, calc(100% - 24px)); padding: 10px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.quick-bar[hidden] { display: none; }
.qb-types { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
.qt { flex: 0 0 auto; display: flex; align-items: center; gap: 7px; padding: 5px 10px 5px 6px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card-hi); font: inherit; font-size: 13px; font-weight: 700; color: var(--text); cursor: pointer; }
.qt .type-badge { width: 28px; height: 28px; }
.qt kbd { font: inherit; font-size: 11px; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; }
.qt.on { border-color: var(--amber); background: var(--amber-soft); }
.qb-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qb-hint { flex: 1 1 260px; font-weight: 700; font-size: 13.5px; }
.qb-speed[hidden] { display: none; }
.qb-speed .field { min-height: 32px; padding: 0 8px; font-size: 12.5px; }
.qb-count { color: var(--muted); font-size: 13px; }
.linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--info); cursor: pointer; text-decoration: underline; }

/* نافذة الاستيراد */
.import-dlg { border: 1px solid var(--line); border-radius: 18px; padding: 0; width: min(560px, calc(100% - 24px)); background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.import-dlg::backdrop { background: rgba(11, 30, 49, .45); }
.imp { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.imp header { display: flex; flex-direction: column; gap: 4px; }
.imp header b { font-size: 17px; }
.imp header small, .imp-note { color: var(--muted); font-size: 12.5px; line-height: 1.7; margin: 0; }
.imp textarea { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; resize: vertical; }
.imp-file { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1.5px dashed var(--line); border-radius: 12px; cursor: pointer; font-weight: 700; color: var(--muted); }
.imp-file input { flex: 1; min-width: 0; font: inherit; font-size: 12px; }
.imp-opts { display: flex; gap: 10px; flex-wrap: wrap; }
.imp-opts label { flex: 1 1 200px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.imp-summary { margin: 0; font-weight: 700; }

@media (max-width: 860px) {
    .admin-map .main { height: calc(100dvh - 58px); }
    .map-bar { padding: 10px 12px; gap: 8px; }
    .map-bar h1 { display: none; }
    .map-search { flex-basis: 100%; max-width: none; }
    .map-attn { margin-inline-start: 0; }
    .map-hint { font-size: 12px; }
    /* اللوحة تصير ورقة من الأسفل */
    .map-panel { top: auto; bottom: 0; inset-inline: 0; width: auto; max-height: 72%; border-radius: 18px 18px 0 0; }
    .map-wrap.has-panel .leaflet-bottom { display: none; }
}
@media (max-width: 520px) {
    .map-filters { display: none; }
}
