/* ===== السيرة النبوية — الخريطة الزمنية ===== */
:root {
    --bg: #f6f1e6;
    --bg-2: #efe7d6;
    --panel: #fffdf8;
    --card: #ffffff;
    --ink: #1d2a2c;
    --ink-2: #5a6566;
    --line: #e2d8c3;
    --line-2: #cfc2a6;
    --accent: #0e5a43;
    --accent-2: #0b4535;
    --gold: #b08a35;
    --gold-soft: #f3e6c4;
    --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 4px 14px rgba(40, 30, 10, .06);
    --shadow-lg: 0 10px 40px rgba(30, 20, 5, .18);
    --radius: 10px;
    --label-w: 168px;
    --col-w: 158px;
    --top-h: 64px;
    --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
    --font-title: "Amiri", "Traditional Arabic", serif;
}
[data-theme="dark"] {
    --bg: #12181a;
    --bg-2: #182124;
    --panel: #1a2326;
    --card: #1f2a2e;
    --ink: #e8e4da;
    --ink-2: #9aa6a4;
    --line: #2b383b;
    --line-2: #3a4a4d;
    --accent: #43b58c;
    --accent-2: #5fd0a6;
    --gold: #d9b55e;
    --gold-soft: #3a3220;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.6;
    overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
a { color: var(--accent); }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
[hidden] { display: none !important; }

/* ---------- الشريط العلوي ---------- */
.top {
    height: var(--top-h);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 18px;
    background: var(--accent-2);
    background: linear-gradient(90deg, #0b4535, #0e5a43 60%, #12684e);
    color: #fdf8ea;
    position: relative;
    z-index: 30;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 50%;
    display: grid; place-items: center;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(217, 181, 94, .6);
    color: #e9c977; font-size: 20px; flex: none;
}
.brand h1 { margin: 0; font-family: var(--font-title); font-size: 22px; line-height: 1.2; font-weight: 700; white-space: nowrap; }
.brand p { margin: 0; font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search { flex: 1; max-width: 460px; margin-inline-start: auto; position: relative; }
.search input {
    width: 100%; padding: 9px 14px; border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .25);
    background: rgba(255, 255, 255, .12); color: #fff; outline: none;
}
.search input::placeholder { color: rgba(255, 255, 255, .65); }
.search input:focus { background: rgba(255, 255, 255, .2); border-color: #e9c977; }
.q-results {
    position: absolute; top: calc(100% + 6px); inset-inline: 0;
    background: var(--panel); color: var(--ink);
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); max-height: 60vh; overflow: auto; padding: 6px;
}
.q-results button {
    display: flex; gap: 8px; align-items: baseline; width: 100%;
    text-align: start; background: none; border: 0; padding: 7px 9px; border-radius: 7px;
}
.q-results button:hover, .q-results button.active { background: var(--bg-2); }
.q-results .kind { font-size: 11px; color: var(--ink-2); flex: none; min-width: 52px; }
.q-results .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; align-self: center; }
.q-results .empty { padding: 10px; color: var(--ink-2); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
    width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
    background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2);
    color: #fff; text-decoration: none; font-size: 17px;
}
.icon-btn:hover { background: rgba(255, 255, 255, .2); }
.seg { display: flex; background: rgba(0, 0, 0, .18); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; color: #e8f1ec; padding: 6px 12px; border-radius: 8px; font-size: 13px; }
.seg button.on { background: #fdf8ea; color: var(--accent-2); font-weight: 600; }
.only-mobile { display: none; }

/* ---------- التخطيط ---------- */
html { overflow: hidden; }
.app { display: flex; height: calc(100% - var(--top-h)); position: relative; overflow: hidden; }
.side {
    width: 290px; flex: none; background: var(--panel); border-inline-end: 1px solid var(--line);
    display: flex; flex-direction: column; overflow: hidden; z-index: 20;
}
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; background: none; padding: 11px 0; color: var(--ink-2); border-bottom: 2px solid transparent; font-weight: 500; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.tab-pane { padding: 14px 16px 30px; overflow: auto; flex: 1; }
.tab-pane h3 { font-size: 13px; margin: 18px 0 8px; color: var(--ink-2); font-weight: 600; letter-spacing: .2px; }
.pane-head { display: flex; align-items: center; justify-content: space-between; }
.pane-head h3 { margin-top: 0; }
.mini-actions button { background: none; border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; font-size: 12px; color: var(--ink-2); }
.mini-actions button:hover { border-color: var(--accent); color: var(--accent); }

.cats { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.cats label {
    display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 8px; cursor: pointer;
    user-select: none; transition: background .15s;
}
.cats label:hover { background: var(--bg-2); }
.cats input { display: none; }
.cats .sw {
    width: 18px; height: 18px; border-radius: 5px; flex: none; display: grid; place-items: center;
    font-size: 11px; color: #fff; border: 2px solid var(--c); background: var(--c);
}
.cats input:not(:checked) ~ .sw { background: transparent; color: var(--c); }
.cats input:not(:checked) ~ .nm { color: var(--ink-2); text-decoration: line-through; text-decoration-color: var(--line-2); }
.cats .nm { flex: 1; }
.cats .ct { font-size: 11px; color: var(--ink-2); background: var(--bg-2); border-radius: 999px; padding: 0 7px; }
.cats .only { opacity: 0; font-size: 11px; border: 0; background: none; color: var(--accent); padding: 0 2px; }
.cats label:hover .only { opacity: 1; }

.switch { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.switch input { accent-color: var(--accent); width: 16px; height: 16px; }
.jumps { display: flex; flex-wrap: wrap; gap: 6px; }
.jumps button {
    border: 1px solid var(--line); background: var(--card); padding: 4px 10px; border-radius: 999px; font-size: 12px;
}
.jumps button:hover { border-color: var(--gold); background: var(--gold-soft); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stats div { background: var(--bg-2); border-radius: 8px; padding: 7px 9px; }
.stats b { display: block; font-size: 18px; color: var(--accent); font-family: var(--font-title); }
.stats span { font-size: 11px; color: var(--ink-2); }

.pane-search { width: 100%; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); outline: none; }
.pane-search:focus { border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0; }
.chip {
    display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--card);
    padding: 2px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip:hover { border-color: var(--accent); }
.people-list h4 { margin: 14px 0 6px; font-size: 12px; color: var(--gold); font-weight: 700; }
.person-row {
    display: flex; align-items: center; gap: 8px; width: 100%; text-align: start;
    background: none; border: 0; padding: 5px 6px; border-radius: 7px;
}
.person-row:hover { background: var(--bg-2); }
.avatar {
    width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
    font-size: 13px; font-weight: 700; color: #fff; background: var(--gc, #777);
}
.person-row .pn { flex: 1; min-width: 0; }
.person-row .pn small { display: block; color: var(--ink-2); font-size: 11px; line-height: 1.3; }
.person-row .cnt { font-size: 11px; color: var(--ink-2); }

.verses-list .vrow {
    display: block; width: 100%; text-align: start; border: 1px solid var(--line); background: var(--card);
    border-radius: 8px; padding: 8px 10px; margin-bottom: 6px;
}
.verses-list .vrow:hover { border-color: var(--accent); }
.vref { font-weight: 700; color: var(--accent); font-size: 13px; }
.vtext { font-family: var(--font-title); font-size: 16px; line-height: 1.7; display: block; }
.vyear { font-size: 11px; color: var(--ink-2); }

/* ---------- الخط الزمني ---------- */
.main { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; }
.scroller { flex: 1; overflow: auto; position: relative; scroll-behavior: smooth; }
.tl { position: relative; min-width: 100%; width: max-content; padding-bottom: 80px; }
.links { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 1; overflow: visible; }

.tl-head {
    position: sticky; top: 0; z-index: 12; display: grid;
    background: var(--bg); border-bottom: 1px solid var(--line-2);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .04);
}
.tl-head > div { padding: 8px 6px; text-align: center; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.tl-head .corner { position: sticky; inset-inline-start: 0; background: var(--bg); z-index: 2; color: var(--accent); }
.tl-head .mo-0 { color: var(--line-2); }
.layout-months .tl-head, .layout-months .yr { grid-template-columns: var(--label-w) repeat(13, var(--col-w)); }
.layout-flow { width: 100%; }
.layout-flow .tl-head { display: none; }
.layout-flow .yr { grid-template-columns: var(--label-w) minmax(0, 1fr); }
.scroller { cursor: grab; }
.scroller.dragging { cursor: grabbing; user-select: none; }
.scroller.dragging .ev { pointer-events: none; }
.pan-btns {
    position: absolute; bottom: 18px; inset-inline-end: 18px; z-index: 14;
    display: flex; gap: 6px;
}
.pan-btns button {
    width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2);
    background: var(--panel); color: var(--accent); font-size: 18px; box-shadow: var(--shadow);
}
.pan-btns button:hover { background: var(--accent); color: #fff; }
.layout-flow ~ .pan-btns, .main:has(.layout-flow) .pan-btns { display: none; }

.era {
    position: relative; display: flex; align-items: center; gap: 14px;
    padding: 22px 18px 12px; z-index: 3;
}
.era-inner { position: sticky; inset-inline-start: 14px; display: flex; align-items: center; gap: 12px; }
.era h2 {
    margin: 0; font-family: var(--font-title); font-size: 24px; color: var(--accent); font-weight: 700;
}
.era .era-range { font-size: 12px; color: var(--ink-2); background: var(--gold-soft); border-radius: 999px; padding: 2px 10px; }
.era p { margin: 0; font-size: 12px; color: var(--ink-2); max-width: 640px; }

.yr { display: grid; position: relative; min-height: 64px; }
.yr::after { /* الخط الأفقي للسنة */
    content: ""; position: absolute; inset-inline: var(--label-w) 0; top: 50%;
    border-top: 1px dashed var(--line); z-index: 0;
}
/* مسافة واضحة بين كل سنة وأحداثها والسنة التالية */
.yr.has {
    padding-block: 20px; margin-block: 10px;
    border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2);
    background: color-mix(in srgb, var(--panel) 55%, transparent);
}
.yr.has.alt { background: color-mix(in srgb, var(--bg-2) 60%, transparent); }
.yr.has::after { border-top: 2px solid color-mix(in srgb, var(--accent) 25%, var(--line)); }
.yr.has + .yr.has { margin-top: 18px; }
.yr.empty { min-height: 26px; }
.yr.empty .ylabel { padding-block: 3px; }
.yr.empty .ylabel .yh { font-size: 13px; }
.yr.empty .ylabel .ym, .yr.empty .ylabel .yt { display: none; }

.ylabel {
    position: sticky; inset-inline-start: 0; z-index: 8;
    background: var(--bg); border-inline-end: 3px solid var(--line-2);
    padding: 10px 12px 10px 10px; display: flex; flex-direction: column; justify-content: center;
}
.ylabel::before { /* عقدة على المحور الرأسي */
    content: ""; position: absolute; inset-inline-end: -8px; top: 50%; width: 13px; height: 13px;
    margin-top: -6.5px; border-radius: 50%; background: var(--bg); border: 3px solid var(--line-2);
}
.yr.has .ylabel { border-inline-end-color: var(--accent); }
.yr.has .ylabel::before { border-color: var(--accent); background: var(--panel); }
.yr.key .ylabel::before { background: var(--gold); border-color: var(--gold); }
.ylabel .yh { font-weight: 700; font-size: 16px; font-family: var(--font-title); color: var(--ink); line-height: 1.2; }
.ylabel .ym { font-size: 11px; color: var(--ink-2); line-height: 1.4; }
.ylabel .yb { font-size: 11px; color: var(--accent); font-weight: 600; line-height: 1.4; }
.yr.empty .ylabel { flex-direction: row; align-items: baseline; gap: 8px; }
.yr.empty .ylabel .yb { font-size: 10px; font-weight: 500; opacity: .8; }
.ylabel .yt { font-size: 11px; color: var(--gold); font-weight: 700; line-height: 1.3; margin-top: 2px; }

.cell { position: relative; z-index: 2; padding: 6px 5px; display: flex; flex-direction: column; gap: 5px; justify-content: center; }
.layout-months .cell:nth-child(even) { background: color-mix(in srgb, var(--bg-2) 35%, transparent); }
.layout-flow .cell { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px 10px; }

.ev {
    --c: #888;
    position: relative; display: flex; align-items: flex-start; gap: 6px;
    text-align: start; width: 100%;
    background: color-mix(in srgb, var(--c) 9%, var(--card));
    border: 1px solid color-mix(in srgb, var(--c) 30%, var(--line));
    border-inline-start: 4px solid var(--c);
    border-radius: 8px; padding: 5px 7px; font-size: 12.5px; line-height: 1.35;
    box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s, opacity .2s, filter .2s;
}
.layout-flow .ev { width: auto; max-width: 240px; }
.ev:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); z-index: 4; }
.ev .ic {
    flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--c); color: #fff;
    font-size: 10px; display: grid; place-items: center; margin-top: 1px;
}
.ev .tt { flex: 1; min-width: 0; }
.ev .mo { display: none; font-size: 10.5px; color: var(--ink-2); }
.layout-flow .ev .mo { display: block; }
.ev.imp-3 { font-weight: 700; font-size: 13.5px; border-width: 1.5px; border-inline-start-width: 5px; }
.ev.imp-3 .ic { width: 22px; height: 22px; font-size: 12px; }
.ev.imp-1 { font-size: 12px; }
.ev.sel { outline: 3px solid var(--gold); outline-offset: 1px; z-index: 5; }
.ev.hit { outline: 2px dashed var(--accent); outline-offset: 1px; }
.tl.focus .ev:not(.lit) { opacity: .22; filter: grayscale(.7); }
.tl.focus .ev.lit { z-index: 5; }
.ev .pdots { position: absolute; top: -5px; inset-inline-end: 4px; display: flex; gap: 2px; }
.ev .pdots i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--card); }
.ev.flash { animation: flash 1.2s ease 2; }
@keyframes flash { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--gold) 50%, transparent); } }

/* شريط الأشخاص المُتتبَّعين */
.threads {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 7px 14px;
    background: var(--panel); border-bottom: 1px solid var(--line); font-size: 12px; z-index: 15;
}
.threads .lbl { color: var(--ink-2); }
.thread-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 10px; border-radius: 999px;
    background: color-mix(in srgb, var(--tc) 15%, var(--card)); border: 1.5px solid var(--tc); font-weight: 600;
}
.thread-chip button { border: 0; background: var(--tc); color: #fff; border-radius: 50%; width: 18px; height: 18px; line-height: 1; padding: 0; }
.threads .clear { border: 0; background: none; color: var(--accent); text-decoration: underline; }

/* ---------- اللوحة الجانبية للتفاصيل ---------- */
.drawer {
    position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: min(440px, 100%);
    background: var(--panel); border-inline-start: 1px solid var(--line); box-shadow: var(--shadow-lg);
    transform: translateX(-105%); transition: transform .25s ease, visibility .25s; z-index: 25; overflow: auto;
    padding: 22px 22px 40px; visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
/* على الشاشات الكبيرة: اللوحة عمود جانبي يزيح الخريطة بدل أن يغطيها */
@media (min-width: 1100px) {
    .drawer {
        position: relative; inset: auto; transform: none; transition: none;
        width: 0; flex: none; padding: 0; border: 0; box-shadow: none; overflow: hidden;
    }
    .drawer.open {
        width: min(420px, 34vw); padding: 22px 22px 40px; overflow: auto;
        border-inline-start: 1px solid var(--line); box-shadow: 0 0 24px rgba(30, 20, 5, .08);
    }
}
.drawer-close {
    position: sticky; top: 0; float: left; width: 32px; height: 32px; border-radius: 50%;
    border: 1px solid var(--line); background: var(--card); font-size: 20px; line-height: 1; z-index: 2;
}
.d-cat {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px;
    background: color-mix(in srgb, var(--c) 15%, var(--card)); color: var(--c); font-weight: 700; font-size: 12px;
    border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
}
[data-theme="dark"] .d-cat { color: color-mix(in srgb, var(--c) 60%, #fff); }
.drawer h2 { font-family: var(--font-title); font-size: 26px; line-height: 1.35; margin: 12px 0 6px; }
.d-date { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.d-date span { background: var(--bg-2); border-radius: 6px; padding: 2px 8px; font-size: 12px; }
.d-desc { font-size: 15px; line-height: 1.9; white-space: pre-line; }
.d-note {
    border-inline-start: 3px solid var(--gold); background: var(--gold-soft); padding: 7px 11px;
    border-radius: 6px; font-size: 13px; margin: 12px 0;
}
.d-sec { margin-top: 20px; }
.d-sec h4 { margin: 0 0 8px; font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.d-sec h4::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.d-people { display: flex; flex-wrap: wrap; gap: 6px; }
.d-people .chip { padding: 3px 10px 3px 4px; }
.d-people .chip .avatar { width: 22px; height: 22px; font-size: 11px; }
.d-people .chip small { color: var(--ink-2); }
.d-verse {
    background: var(--bg-2); border-radius: 8px; padding: 10px 12px; margin-bottom: 7px;
    border-inline-start: 3px solid var(--accent);
}
.d-verse .vtext { font-size: 19px; }
.d-verse .vtopic { font-size: 12.5px; color: var(--ink-2); display: block; margin-top: 3px; }
.d-related button {
    display: flex; gap: 8px; align-items: center; width: 100%; text-align: start; border: 1px solid var(--line);
    background: var(--card); padding: 6px 10px; border-radius: 8px; margin-bottom: 5px;
}
.d-related button:hover { border-color: var(--gold); }
.d-related .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.d-related small { color: var(--ink-2); margin-inline-start: auto; white-space: nowrap; }
.d-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.btn {
    border: 1px solid var(--accent); background: var(--accent); color: #fff; padding: 7px 14px; border-radius: 8px;
    font-weight: 600; font-size: 13px;
}
.btn.ghost { background: transparent; color: var(--accent); }
.btn:hover { filter: brightness(1.08); }
.p-head { display: flex; gap: 14px; align-items: center; margin-top: 8px; }
.p-head .avatar { width: 58px; height: 58px; font-size: 24px; }
.p-head h2 { margin: 0; }
.p-full { color: var(--ink-2); font-size: 13px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0; }
.tag { font-size: 11.5px; background: var(--gold-soft); color: var(--ink); border-radius: 999px; padding: 1px 9px; border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); }
.p-events { list-style: none; padding: 0; margin: 0; position: relative; }
.p-events::before { content: ""; position: absolute; inset-inline-start: 6px; top: 6px; bottom: 6px; border-inline-start: 2px solid var(--line); }
.p-events li button {
    display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: start; background: none; border: 0; padding: 5px 0;
}
.p-events li button:hover .pe-t { color: var(--accent); }
.p-events .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; border: 3px solid var(--panel); margin-top: 3px; position: relative; }
.pe-y { font-size: 11px; color: var(--ink-2); display: block; }
.pe-t { font-weight: 500; }
.pe-r { font-size: 11px; color: var(--gold); }

.loading {
    position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg);
    font-family: var(--font-title); font-size: 22px; color: var(--accent); z-index: 100;
}

/* ---------- الشاشات الصغيرة ---------- */
@media (max-width: 960px) {
    :root { --label-w: 96px; --col-w: 140px; }
    .only-mobile { display: grid; }
    .brand p, .seg { display: none; }
    .brand h1 { font-size: 17px; }
    .side {
        position: absolute; top: 0; bottom: 0; inset-inline-start: 0; transform: translateX(105%);
        transition: transform .25s; box-shadow: var(--shadow-lg);
    }
    .side.open { transform: none; }
    .layout-flow .yr { grid-template-columns: var(--label-w) minmax(0, calc(100vw - var(--label-w) - 10px)); }
}
@media (max-width: 600px) {
    .top { gap: 8px; padding: 0 10px; }
    .brand-mark { display: none; }
    .brand h1 { white-space: normal; font-size: 15px; }
    .search { max-width: none; }
}
@media print {
    .top, .side, .drawer, .threads { display: none !important; }
    body { overflow: visible; }
    .app, .scroller { height: auto; overflow: visible; }
}

/* ---------- الخريطة المكانية ---------- */
.map-view { position: absolute; inset: 0; display: flex; flex-direction: column; z-index: 10; }
.main:has(.threads:not([hidden])) .map-view { top: 38px; }
.geo-map { flex: 1; background: #0f1a1c; }
body.view-map .scroller, body.view-map .pan-btns, body.view-map .layout-seg { display: none !important; }
.leaflet-container { font-family: var(--font); }
.map-legend {
    position: absolute; bottom: 26px; inset-inline-start: 12px; z-index: 500; max-width: 330px;
    background: color-mix(in srgb, var(--panel) 94%, transparent); border: 1px solid var(--line); border-radius: 10px;
    padding: 9px 12px; font-size: 11.5px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow);
}
.map-legend b { font-size: 12.5px; color: var(--accent); }
.map-legend span { display: flex; align-items: center; gap: 7px; }
.lg-pin { width: 14px; height: 14px; border-radius: 50%; background: #c0392b; border: 2px solid #fff; box-shadow: 0 0 0 1px #c0392b; flex: none; }
.lg-pin.approx { border-style: dashed; background: #e67e22; }
.lg-line { width: 22px; border-top: 3px dashed #d9b55e; flex: none; }

.gpin-wrap { background: none; border: 0; }
.gpin {
    border-radius: 50%; display: grid; place-items: center; box-sizing: border-box;
    background: var(--c); color: #fff; font-weight: 700; font-size: 12px; font-family: var(--font);
    border: 2.5px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .45), 0 0 0 1px var(--c);
    transition: transform .15s, opacity .2s; cursor: pointer;
}
.gpin:hover { transform: scale(1.15); }
.gpin.approx { border-style: dashed; }
.gpin.dim { opacity: .35; filter: grayscale(.6); }
.gpin.lit { box-shadow: 0 0 0 4px rgba(217, 181, 94, .75), 0 2px 10px rgba(0, 0, 0, .5); }
.gtip { font-family: var(--font); font-weight: 600; font-size: 12px; padding: 2px 7px; border-radius: 6px; }
.gtip.small { font-size: 10.5px; padding: 0 5px; opacity: .9; }
.gpop .leaflet-popup-content { margin: 12px 14px; font-family: var(--font); direction: rtl; text-align: right; }
.gpop .leaflet-popup-content-wrapper { border-radius: 10px; }
.gp-t { font-family: var(--font-title); font-size: 18px; color: #0b4535; }
.gp p { margin: 4px 0 8px; font-size: 12px; color: #555; }
.gp ul { list-style: none; margin: 0; padding: 0; max-height: 230px; overflow: auto; }
.gp li button {
    display: flex; align-items: baseline; gap: 6px; width: 100%; text-align: right; background: none; border: 0;
    padding: 4px 3px; border-radius: 5px; font-size: 12.5px; color: #1d2a2c; cursor: pointer;
}
.gp li button:hover { background: #f3ecdc; }
.gp li i { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.gp li small { color: #888; white-space: nowrap; }
.gp .gp-more { margin-top: 8px; background: #0e5a43; color: #fff; border: 0; border-radius: 6px; padding: 5px 10px; font-size: 12px; cursor: pointer; width: 100%; }
.gp .tag { font-size: 10.5px; }

/* خريطة مصغّرة داخل لوحة التفاصيل */
.d-place { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.mini-map { height: 210px; background: #0f1a1c; }
.mini-map.wide { height: 240px; border-radius: 10px; border: 1px solid var(--line); margin: 10px 0; }
.d-place-info { padding: 9px 12px 11px; font-size: 13px; }
.d-place-info p { margin: 4px 0 8px; color: var(--ink-2); font-size: 12.5px; }
.d-place-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.d-place-actions .btn { padding: 4px 10px; font-size: 12px; }
@media (max-width: 960px) {
    .seg.view-seg { display: flex; }
    .seg.view-seg button { padding: 6px 8px; font-size: 12px; }
    .map-legend { display: none; }
}
