/* لطائف الأشواق — التنسيق */

@font-face { font-family: 'iptikar2'; src: url(/fonts/iptikar2.woff) format('woff'); font-display: swap; }
@font-face { font-family: 'iptikar3'; src: url(/fonts/iptikar3.woff) format('woff'); font-display: swap; }
@font-face { font-family: 'amiri'; src: url(/fonts/amiri.woff) format('woff'); font-display: swap; }
@font-face { font-family: 'hacen'; src: url(/fonts/hacen.woff) format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'hacen'; src: url(/fonts/hacen-bold.woff) format('woff'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'hafs'; src: url(/fonts/hafs.woff) format('woff'); font-display: swap; }
@font-face { font-family: 'music'; src: url(/fonts/music.woff) format('woff'); font-display: block; }

/* ------------------------------------------------------------------ الألوان */
:root {
  color-scheme: light;
  --bg: #f6f2e9;
  --card: #fffdf8;
  --card-2: #faf6ec;
  --ink: #23201b;
  --ink-2: #3d382f;
  --muted: #72695a;
  --line: #e4dccb;
  --line-2: #d6ccb6;
  --teal: #0e6f72;
  --teal-2: #1c8d8f;
  --teal-soft: #e2efed;
  --crimson: #ac1736;
  --crimson-soft: #f8e7ea;
  --mark: #ffe17d;
  --sel: #dcefed;
  --hover: rgba(14, 111, 114, .06);
  --bar: rgba(255, 253, 248, .9);
  --shadow: 0 1px 2px rgba(60, 45, 15, .06), 0 6px 20px rgba(60, 45, 15, .07);
  --shadow-lg: 0 10px 40px rgba(40, 30, 10, .18);
  --warn: #9a5b00;
  --warn-soft: #fbf0d9;
  --ok: #1d7a43;
  --ok-soft: #e3f3e8;
  --no: #a12a2a;
  --no-soft: #f8e5e3;

  --scale: 1;
  --ui-font: 'hacen', 'Segoe UI', Tahoma, 'Noto Sans Arabic', sans-serif;
  --title-font: 'iptikar2', 'amiri', serif;
  --read-font: 'iptikar2', 'amiri', serif;
  --radius: 14px;
  --top: 58px;
  --tabbar: 0px;
}
:root[data-font='light'] { --read-font: 'iptikar3', 'amiri', serif; }
:root[data-font='amiri'] { --read-font: 'amiri', serif; }
:root[data-font='system'] { --read-font: system-ui, 'Segoe UI', Tahoma, 'Noto Naskh Arabic', sans-serif; }

:root[data-theme='sepia'] {
  --bg: #ede2c6;
  --card: #f7efd9;
  --card-2: #f1e7cc;
  --ink: #3a2e1d;
  --ink-2: #4b3d27;
  --muted: #7a6a4f;
  --line: #d8c9a4;
  --line-2: #c9b88f;
  --sel: #e3dab9;
  --bar: rgba(247, 239, 217, .92);
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #111718;
  --card: #192122;
  --card-2: #1d2627;
  --ink: #ebe5d8;
  --ink-2: #d4cdbf;
  --muted: #9aa39f;
  --line: #2a3536;
  --line-2: #364344;
  --teal: #5cbfc0;
  --teal-2: #4aa9aa;
  --teal-soft: #1c3233;
  --crimson: #f0798e;
  --crimson-soft: #3b1f26;
  --mark: #6d5b0f;
  --sel: #1e3a3b;
  --hover: rgba(92, 191, 192, .08);
  --bar: rgba(22, 30, 31, .9);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --warn: #f0b85a;
  --warn-soft: #3a2d14;
  --ok: #6fd49a;
  --ok-soft: #173123;
  --no: #f08a80;
  --no-soft: #3a1d1b;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme='auto'] {
    color-scheme: dark;
    --bg: #111718;
    --card: #192122;
    --card-2: #1d2627;
    --ink: #ebe5d8;
    --ink-2: #d4cdbf;
    --muted: #9aa39f;
    --line: #2a3536;
    --line-2: #364344;
    --teal: #5cbfc0;
    --teal-2: #4aa9aa;
    --teal-soft: #1c3233;
    --crimson: #f0798e;
    --crimson-soft: #3b1f26;
    --mark: #6d5b0f;
    --sel: #1e3a3b;
    --hover: rgba(92, 191, 192, .08);
    --bar: rgba(22, 30, 31, .9);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --warn: #f0b85a;
    --warn-soft: #3a2d14;
    --ok: #6fd49a;
    --ok-soft: #173123;
    --no: #f08a80;
    --no-soft: #3a1d1b;
  }
}

.m1 { --tint: #0e6f72; } .m2 { --tint: #946116; } .m3 { --tint: #6b4fa0; } .m4 { --tint: #2d6ea6; }
.m5 { --tint: #ac1736; } .m6 { --tint: #3b7a37; } .m7 { --tint: #96386f; } .m8 { --tint: #b4610f; }
:root[data-theme='dark'] .m1, :root[data-theme='dark'] .m2, :root[data-theme='dark'] .m3, :root[data-theme='dark'] .m4,
:root[data-theme='dark'] .m5, :root[data-theme='dark'] .m6, :root[data-theme='dark'] .m7, :root[data-theme='dark'] .m8 { filter: saturate(.9) brightness(1.35); }

/* ------------------------------------------------------------------ الأساس */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui-font);
  font-size: 16px;
  line-height: 1.75;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }
h1, h2, h3 { margin: 0; line-height: 1.5; }
p { margin: .4em 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--teal-2); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.offscreen { position: fixed; inset-inline-start: -9999px; }
.noscript { padding: 2rem; text-align: center; }
bdi { unicode-bidi: isolate; }

.ic { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* شاشة الإقلاع */
#app.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-mark {
  width: 76px; height: 76px; border-radius: 22px; background: var(--teal); color: #faf5e8;
  display: grid; place-items: center; font: 56px/1 var(--title-font); padding-bottom: 8px;
  animation: breathe 1.6s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: scale(.94); opacity: .75; } }

/* ------------------------------------------------------------------ الإطار */
.skip { position: absolute; inset-inline-start: -999px; top: 0; z-index: 100; background: var(--card); padding: .5em 1em; }
.skip:focus { inset-inline-start: 8px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--top);
  display: flex; align-items: center; gap: 12px;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: var(--bar);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none !important; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; background: var(--teal); color: #faf5e8;
  display: grid; place-items: center; font: 27px/1 var(--title-font); padding-bottom: 5px; flex: none;
}
.brand-mark.big { width: 64px; height: 64px; border-radius: 19px; font-size: 48px; padding-bottom: 8px; margin: 0 auto 10px; }
.brand-name { font: 23px/1 var(--title-font); color: var(--crimson); padding-top: 3px; }
.topnav { display: none; margin-inline-start: auto; gap: 4px; }
.topnav-link {
  display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px; color: var(--ink-2);
  position: relative; text-decoration: none !important;
}
.topnav-link:hover { background: var(--hover); }
.topnav-link.on { background: var(--teal-soft); color: var(--teal); }
.top-search { margin-inline-start: auto; color: var(--ink-2); padding: 8px; border-radius: 10px; }
.top-search .ic { width: 24px; height: 24px; }

main { display: block; outline: none; }
.page, .home {
  max-width: 980px; margin: 0 auto;
  padding: 18px 16px calc(28px + var(--tabbar) + env(safe-area-inset-bottom));
}

.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  background: var(--bar);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-top: 1px solid var(--line);
}
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 2px 4px; border-radius: 12px; color: var(--muted); font-size: 12px; text-decoration: none !important;
}
.tab .ic { width: 23px; height: 23px; }
.tab.on { color: var(--teal); }
.tab.on .ic { stroke-width: 2.2; }
.tab .badge, .topnav-link .badge { position: absolute; top: 2px; inset-inline-end: calc(50% - 22px); }
.topnav-link .badge { top: 0; inset-inline-end: 0; }

:root { --tabbar: 62px; }
@media (min-width: 900px) {
  :root { --tabbar: 0px; }
  .tabbar { display: none; }
  .topnav { display: flex; }
  .top-search { display: none; }
  .page, .home { padding-top: 26px; }
}

.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--crimson); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700;
}

/* ------------------------------------------------------------------ عناصر عامّة */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; padding: 0 16px; border-radius: 11px;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
  cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--card-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-2); }
:root[data-theme='dark'] .btn.primary { color: #0d1d1e; }
@media (prefers-color-scheme: dark) { :root[data-theme='auto'] .btn.primary { color: #0d1d1e; } }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--no); }
.btn.primary.danger { background: var(--no); border-color: var(--no); color: #fff; }
.btn.sm { min-height: 36px; padding: 0 11px; border-radius: 10px; font-size: .94rem; }
.btn.icon-only { padding: 0; width: 42px; }
.btn.sm.icon-only { width: 36px; }
.btn.wide { width: 100%; }
.btn.busy { opacity: .7; pointer-events: none; }
.btn.busy::after { content: ''; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; animation: spin .7s linear infinite; }
.btn.dim { opacity: .55; }
.btn.pulse { box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 30%, transparent); }
.btn .badge { margin-inline-start: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 11px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--card); color: var(--ink-2); font-size: .92rem; line-height: 1.8; text-decoration: none !important;
}
a.chip:hover { border-color: var(--teal); color: var(--teal); }
.chip.sm { font-size: .8rem; padding: 0 8px; line-height: 1.75; }
.chip.big { padding: 6px 16px; font-size: 1rem; }
.chip.tint { background: var(--teal-soft); border-color: transparent; color: var(--teal); }
.chip.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.chip .n { color: var(--muted); font-size: .85em; }
.chip.removable { padding-inline-end: 4px; }
.chip-x { border: 0; background: none; padding: 2px; border-radius: 50%; cursor: pointer; color: var(--muted); display: grid; }
.chip-x:hover { background: var(--hover); color: var(--no); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin: 0 0 16px; }
.note { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--teal-soft); color: var(--ink); margin: 10px 0; }
.note.ok { background: var(--ok-soft); }
.note.warn { background: var(--warn-soft); color: var(--ink); }
.empty { text-align: center; padding: 40px 16px; color: var(--ink-2); }
.empty p:first-child { font-size: 1.1rem; }

.loading { display: flex; justify-content: center; gap: 6px; padding: 48px 0; }
.loading span { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); opacity: .3; animation: dot 1s infinite; }
.loading span:nth-child(2) { animation-delay: .15s; }
.loading span:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 40% { opacity: 1; transform: translateY(-4px); } }

.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: .9rem; color: var(--muted); margin-bottom: 6px; }
.crumbs .sep { width: 14px; height: 14px; opacity: .6; }
.page-head { margin-bottom: 16px; }
.page-title { font: 400 2rem/1.45 var(--title-font); color: var(--crimson); }
.h2 { font: 400 1.45rem/1.5 var(--title-font); color: var(--teal); margin: 0 0 12px; }
.h3 { font-size: 1.08rem; font-weight: 700; display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--ink); }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.block { margin: 26px 0; }

/* الحقول */
input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 11px;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
}
textarea { line-height: 1.8; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--teal); margin: 0; flex: none; }
input[type=range] { width: 100%; accent-color: var(--teal); }
.field { display: flex; flex-direction: column; gap: 5px; margin: 0 0 14px; }
.field-label { font-size: .92rem; font-weight: 700; color: var(--ink-2); }
.field-hint { color: var(--muted); font-size: .82rem; }
.row2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 620px) { .row2 { grid-template-columns: 1fr 1fr; } }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0; cursor: pointer; }
.text-edit { font-family: var(--read-font); font-size: 1.2rem; line-height: 2; }

.filter { position: relative; display: flex; align-items: center; margin: 0 0 14px; }
.filter > .ic { position: absolute; inset-inline-start: 12px; color: var(--muted); width: 18px; height: 18px; pointer-events: none; }
.filter input { padding-inline-start: 38px !important; }
.filter.sticky { position: sticky; top: calc(var(--top) + 8px); z-index: 5; }
.filter.sticky input { box-shadow: var(--shadow); }

.seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line); width: fit-content; }
.seg-btn { border: 0; background: none; padding: 6px 14px; border-radius: 9px; cursor: pointer; color: var(--ink-2); text-decoration: none !important; }
.seg-btn.on { background: var(--card); color: var(--teal); box-shadow: var(--shadow); font-weight: 700; }
.seg.small .seg-btn { padding: 3px 11px; font-size: .92rem; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 16px; }
.tabs.scroll { overflow-x: auto; scrollbar-width: none; }
.tabs.scroll::-webkit-scrollbar { display: none; }
.tab-btn {
  display: flex; align-items: center; gap: 6px; padding: 9px 14px; white-space: nowrap;
  color: var(--ink-2); border-bottom: 2.5px solid transparent; margin-bottom: -1px; text-decoration: none !important;
}
.tab-btn.on { color: var(--teal); border-bottom-color: var(--teal); font-weight: 700; }
.tab-btn .n { color: var(--muted); font-size: .82rem; font-weight: 400; }

/* ------------------------------------------------------------------ النوافذ والقوائم والرسائل */
dialog.modal {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px);
  padding: 0; border: 1px solid var(--line); border-radius: 18px;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow-lg);
}
dialog.modal.wide { width: min(760px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(20, 16, 8, .42); backdrop-filter: blur(2px); }
.modal-in { display: flex; flex-direction: column; max-height: calc(100dvh - 34px); }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px 6px; }
.modal-head h2 { flex: 1; font-size: 1.15rem; }
.modal-body { padding: 4px 16px 8px; overflow: auto; }
.modal-err { color: var(--no); padding: 0 16px; min-height: 0; }
.modal-err:not(:empty) { padding: 4px 16px; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px 16px; border-top: 1px solid var(--line); }
@media (max-width: 560px) {
  dialog.modal, dialog.modal.wide { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .modal-in { max-height: 92dvh; }
  .modal-foot { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
}

.menu {
  position: absolute; z-index: 70; min-width: 220px; max-width: calc(100vw - 16px);
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px;
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: 9px;
  background: none; color: var(--ink); text-align: start; cursor: pointer; text-decoration: none !important;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item.danger { color: var(--no); }
.menu-item.on { color: var(--teal); font-weight: 700; }
.menu-item .tick { margin-inline-start: auto; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.menu-head { padding: 6px 12px 2px; font-size: .8rem; color: var(--muted); }

.toasts { position: fixed; z-index: 90; inset-inline: 0; bottom: calc(var(--tabbar) + 14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.has-selbar .toasts { bottom: calc(var(--tabbar) + 86px + env(safe-area-inset-bottom)); }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 14px; max-width: 520px;
  background: #23302f; color: #f4efe3; padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow-lg);
  animation: up .25s ease-out; transition: opacity .35s, transform .35s;
}
.toast.err { background: #6d1c22; }
.toast.out { opacity: 0; transform: translateY(8px); }
.toast-act { color: #8fe3e1; font-weight: 700; white-space: nowrap; }
@keyframes up { from { opacity: 0; transform: translateY(10px); } }

.popover {
  position: absolute; z-index: 60; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 12px 14px; line-height: 1.9; animation: up .18s ease-out;
}
.pop-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; color: var(--teal); }
.pop-n { min-width: 24px; height: 24px; border-radius: 12px; background: var(--teal-soft); display: grid; place-items: center; font-size: .82rem; padding: 0 6px; }
.pop-text { font-family: var(--read-font); font-size: calc(1.08rem * min(var(--scale), 1.3)); }

/* ------------------------------------------------------------------ الدخول */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; position: relative; overflow: hidden; }
.auth-art {
  position: absolute; inset: 0; z-index: -1; opacity: .5;
  background:
    radial-gradient(circle at 15% 10%, var(--teal-soft) 0, transparent 40%),
    radial-gradient(circle at 85% 90%, var(--crimson-soft) 0, transparent 40%);
}
.auth-card { width: min(440px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 26px 22px; box-shadow: var(--shadow); }
.auth-brand { text-align: center; margin-bottom: 18px; }
.auth-brand h1 { font: 400 1.75rem/1.5 var(--title-font); color: var(--crimson); }
.auth-sub { color: var(--teal); font-family: var(--title-font); font-size: 1.05rem; }
.auth-form .btn.wide { margin-top: 6px; min-height: 48px; font-size: 1.05rem; }
.auth-alt { text-align: center; margin-top: 14px; color: var(--muted); }
.form-err { color: var(--no); min-height: 0; margin: 0 0 8px; }
.pw { position: relative; }
.pw input { padding-inline-end: 44px !important; }
.pw-toggle { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; padding: 8px; border-radius: 8px; color: var(--muted); cursor: pointer; }
.pw-toggle.on { color: var(--teal); }

/* ------------------------------------------------------------------ الرئيسة */
.hero { text-align: center; padding: 22px 0 6px; }
.hero-title { font: 400 clamp(1.9rem, 6vw, 2.9rem)/1.4 var(--title-font); color: var(--crimson); }
.hero-sub { font: 400 1.15rem/1.6 var(--title-font); color: var(--teal); margin: 2px 0; }
.hero-editor { color: var(--muted); font-size: .95rem; }
.hero-stats { color: var(--muted); font-size: .92rem; margin-top: 10px; }
.home-search {
  display: flex; align-items: center; gap: 8px; max-width: 620px; margin: 18px auto 0;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 16px; padding: 5px 5px 5px 5px; padding-inline-start: 14px; box-shadow: var(--shadow);
}
.home-search > .ic { color: var(--muted); }
.home-search input { border: 0 !important; box-shadow: none !important; background: none !important; padding: 0 !important; min-height: 42px; font-size: 1.05rem; }
.home-search .btn { flex: none; }

.admin-note { text-decoration: none !important; color: var(--ink); background: var(--warn-soft); }
.admin-note span { flex: 1; }

.quote { position: relative; margin: 22px 0; padding: 18px 20px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-align: center; box-shadow: var(--shadow); }
.quote blockquote { margin: 0; font: 400 1.3rem/1.9 var(--title-font); color: var(--ink); }
.quote figcaption { color: var(--teal); font-size: .95rem; margin-top: 4px; }
.quote-ic { position: absolute; top: 10px; inset-inline-start: 12px; color: var(--line-2); width: 26px; height: 26px; }

.sec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.sec-card {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); text-decoration: none !important;
  transition: transform .15s, border-color .15s;
}
.sec-card:hover { border-color: var(--teal); transform: translateY(-1px); }
.sec-title { font: 400 1.3rem/1.5 var(--title-font); color: var(--teal); }
.sec-card.alt .sec-title { color: var(--crimson); }
.sec-count { color: var(--muted); font-size: .88rem; }

.maqam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.maqam-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  border-top: 4px solid var(--tint);
}
.maqam-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 12px 16px 6px; text-decoration: none !important; }
.maqam-name { font: 400 1.75rem/1.4 var(--title-font); color: var(--tint); }
.maqam-count { color: var(--muted); font-size: .85rem; }
.maqam-subs { display: flex; flex-direction: column; padding: 0 8px 8px; }
.maqam-subs a { display: flex; justify-content: space-between; padding: 6px 8px; border-radius: 9px; color: var(--ink-2); text-decoration: none !important; }
.maqam-subs a:hover { background: var(--hover); color: var(--tint); }
.maqam-subs .n { color: var(--muted); font-size: .88rem; }

.index-links { display: flex; flex-wrap: wrap; gap: 8px; }
.shared-list { display: flex; flex-direction: column; gap: 6px; }
.shared-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none !important; }
.shared-item.unseen { border-color: var(--teal); background: var(--teal-soft); }
.shared-title { flex: 1; font-weight: 700; }

/* ------------------------------------------------------------------ القوائم */
.item-list { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.item-row { display: flex; flex-direction: column; gap: 1px; padding: 11px 16px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none !important; }
.item-row:first-child { border-top: 0; }
.item-row:hover { background: var(--hover); }
.item-title { font: 400 1.28rem/1.55 var(--title-font); color: var(--crimson); }
.item-row.is-text .item-title { color: var(--teal); }
.item-lead { color: var(--ink-2); font-family: var(--read-font); font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .84rem; color: var(--muted); }
.meta-t.place { color: var(--teal); }

.sec-part { margin: 0 0 22px; }
.part-title { display: flex; align-items: center; gap: 10px; font: 400 1.5rem/1.5 var(--title-font); margin: 6px 0 10px; }
.part-title a { color: var(--teal); }
.part-title .n, .wasla + .n { font: .85rem var(--ui-font); color: var(--muted); }
.wasla { font-size: .95rem; font-weight: 700; color: var(--ink-2); margin: 16px 4px 8px; display: flex; align-items: center; gap: 8px; }
.wasla::before { content: ''; width: 8px; height: 8px; transform: rotate(45deg); background: var(--crimson); border-radius: 1px; flex: none; }

/* ------------------------------------------------------------------ صفحة القصيدة */
.reader { max-width: 900px; }
.poem-head { text-align: center; margin: 8px 0 12px; }
.poem-group { color: var(--muted); font-size: .92rem; margin: 0; }
.poem-title { font: 400 clamp(1.9rem, 5.5vw, 2.6rem)/1.45 var(--title-font); color: var(--crimson); }
.poem-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin: 8px auto 2px; max-width: 760px; }
.meta-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.meta-label { font-size: .82rem; color: var(--muted); }
.meta-vals { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.poem-info { color: var(--crimson); font-family: var(--title-font); }
.poem-src { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: .82rem; margin-top: 6px; }

.reader-tools {
  position: sticky; top: calc(var(--top) + 6px); z-index: 20;
  display: flex; align-items: center; justify-content: center; gap: 2px; flex-wrap: wrap;
  width: fit-content; max-width: 100%; margin: 6px auto 14px; padding: 4px;
  background: var(--bar); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.reader-tools .btn.on { background: var(--teal-soft); color: var(--teal); }
.zoom { display: flex; align-items: center; border-inline-end: 1px solid var(--line); padding-inline-end: 2px; margin-inline-end: 2px; }
.size-lbl { min-width: 46px; text-align: center; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.poem-body {
  --vfs: calc(1.45rem * var(--scale));
  container-type: inline-size;
  font-family: var(--read-font);
  font-size: var(--vfs);
  line-height: 2.05;
  color: var(--ink);
}
.reader .poem-body { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: .5em .9em; box-shadow: var(--shadow); }
.blk { border-radius: 10px; scroll-margin: calc(var(--top) + 70px); transition: background .2s; }
.verse { display: grid; grid-template-columns: 1.7em 1fr; align-items: baseline; padding: .12em 0; }
.vnum { font: .55em/1 var(--ui-font); color: var(--muted); text-align: center; align-self: center; }
.hemis { display: grid; grid-template-columns: 1fr 1fr; column-gap: 1.6em; }
.hemi { text-align: center; }
.parts-1 .hemis { grid-template-columns: 1fr; }
.parts-3 .hemis { grid-template-columns: 1fr 1fr 1fr; }
.parts-4 .hemis { grid-template-columns: 1fr 1fr; }
/* البيت ذو الأسطر (الموشّح) يُفصل عمّا قبله */
.parts-3, .parts-4 { padding: .3em 0; }
.parts-3 + .verse, .parts-4 + .verse { border-top: 1px dashed color-mix(in srgb, var(--line) 80%, transparent); }
.para { margin: .35em 0; padding: 0 .2em; text-align: justify; text-justify: inter-word; line-height: 2.05; font-size: .9em; }
.para.center { text-align: center; }
.is-text .para { font-size: .84em; }

/* الشاشة الضيّقة: كلّ شطرٍ في سطر، الأوّل إلى اليمين والثاني إلى اليسار */
@container (max-width: 25em) {
  .verse { grid-template-columns: 1.4em 1fr; }
  .hemis, .parts-3 .hemis, .parts-4 .hemis { grid-template-columns: 1fr; }
  .hemi { text-align: start; }
  .parts-2 .hemi.hm2, .parts-4 .hemi.hm2, .parts-4 .hemi.hm4 { text-align: end; padding-inline-start: 1.2em; }
  .verse + .verse { border-top: 1px dashed color-mix(in srgb, var(--line) 70%, transparent); }
}

.gref {
  font: 700 .5em/0 var(--ui-font); color: var(--teal); cursor: pointer; padding: 0 .12em;
  vertical-align: super; border-radius: 4px;
}
.gref:hover { background: var(--teal-soft); }
.quran { font-family: 'hafs', var(--read-font); font-size: 1.02em; color: var(--teal); }
.music { font-family: 'music'; font-size: 1.1em; letter-spacing: 0; }
.lead { color: var(--crimson); font-weight: 400; font-family: var(--title-font); }
mark { background: var(--mark); color: inherit; border-radius: 4px; padding: 0 .08em; }
.flash { animation: flash 2.4s ease-out; }
@keyframes flash { 0%, 30% { background: var(--mark); } 100% { background: transparent; } }

.selecting .blk { cursor: pointer; border-inline-start: 3px solid transparent; }
.selecting .blk:hover { background: var(--hover); }
.blk.sel { background: var(--sel) !important; border-inline-start-color: var(--teal); }
.selecting .vnum::before { content: ''; display: block; width: .9em; height: .9em; margin: 0 auto 2px; border: 1.5px solid var(--line-2); border-radius: 4px; }
.blk.sel .vnum::before { background: var(--teal); border-color: var(--teal); box-shadow: inset 0 0 0 2px var(--card); }
.pick .blk { font-size: .9em; }

.selbar {
  position: fixed; z-index: 45; inset-inline: 8px; bottom: calc(var(--tabbar) + 8px + env(safe-area-inset-bottom));
  max-width: 760px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 8px 10px; box-shadow: var(--shadow-lg);
  animation: up .2s ease-out;
}
.sel-count { font-weight: 700; color: var(--teal); padding: 0 6px; }
.selbar-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.has-selbar .pager { margin-bottom: 90px; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 0; }
.pg {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--card);
  border: 1px solid var(--line); color: var(--ink); text-decoration: none !important; min-width: 0;
}
.pg span { display: flex; flex-direction: column; min-width: 0; font-family: var(--title-font); color: var(--crimson); line-height: 1.5; }
.pg span, .pg small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg small { font: .78rem var(--ui-font); color: var(--muted); }
.pg.next { justify-content: flex-end; text-align: end; }
.pg:hover { border-color: var(--teal); }

.orig { margin: 0 0 12px; }
.orig-text { font-family: var(--read-font); font-size: 1.15rem; line-height: 2; padding: 8px 12px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--line); }

/* ------------------------------------------------------------------ الفهارس */
.maqam-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.mi { background: var(--card); border: 1px solid var(--line); border-inline-start: 4px solid var(--tint); border-radius: var(--radius); padding: 10px 14px 12px; box-shadow: var(--shadow); }
.mi-head { display: flex; align-items: baseline; justify-content: space-between; text-decoration: none !important; }
.mi-name { font: 400 1.7rem/1.4 var(--title-font); color: var(--tint); }
.mi-n { color: var(--muted); font-size: .85rem; }
.mi-subs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.entry-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; }
.entry { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 11px; background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none !important; }
.entry:hover { border-color: var(--teal); color: var(--teal); }
.entry .n { color: var(--muted); font-size: .85rem; }
.bio { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 18px; box-shadow: var(--shadow); }
.bio p { font-family: var(--read-font); font-size: calc(1.12rem * min(var(--scale), 1.4)); line-height: 2; margin: 0; text-align: justify; }

/* ------------------------------------------------------------------ البحث */
.search-form { position: relative; }
.search-line { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line-2); border-radius: 16px; padding: 5px; padding-inline-start: 14px; box-shadow: var(--shadow); }
.search-line:focus-within { border-color: var(--teal); }
.search-line > .ic { color: var(--muted); }
.search-line input { border: 0 !important; box-shadow: none !important; background: none !important; padding: 0 !important; font-size: 1.1rem; }
.suggest { position: absolute; z-index: 30; inset-inline: 0; top: calc(100% + 6px); background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; max-height: 60vh; overflow: auto; }
.sug { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--ink); text-decoration: none !important; }
.sug:hover, .sug.on { background: var(--hover); }
.sug .ic { color: var(--muted); width: 18px; height: 18px; }
.sug-label { flex: 1; font-family: var(--title-font); font-size: 1.1rem; color: var(--crimson); }
.sug-type { font-size: .8rem; color: var(--muted); }
.filters { margin: 10px 0 14px; }
.filters summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--teal); padding: 4px 2px; list-style: none; }
.filters summary::-webkit-details-marker { display: none; }
.filters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-top: 8px; align-items: center; }
.res-count { color: var(--ink-2); margin: 4px 0 14px; }
.res { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 10px; box-shadow: var(--shadow); }
.res-title { font: 400 1.35rem/1.5 var(--title-font); color: var(--crimson); }
.res-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .85rem; color: var(--ink-2); margin: 2px 0 6px; }
.res-snip { display: block; padding: 6px 10px; margin: 4px 0; border-radius: 10px; background: var(--card-2); color: var(--ink); text-decoration: none !important; font-family: var(--read-font); font-size: calc(1.08rem * min(var(--scale), 1.4)); line-height: 2; }
.res-snip:hover { background: var(--hover); }
.snip-verse { display: flex; flex-wrap: wrap; gap: 0 1.6em; justify-content: center; }
.snip-info { color: var(--crimson); font-size: .92em; }
.res-more { font-size: .88rem; }
.res-extra { margin: 0 0 16px; }
.res-gloss { display: flex; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); margin: 0 0 6px; color: var(--ink); text-decoration: none !important; font-family: var(--read-font); font-size: 1.05rem; line-height: 1.9; }
.gn { flex: none; min-width: 30px; height: 30px; border-radius: 15px; display: grid; place-items: center; background: var(--teal-soft); color: var(--teal); font: 700 .8rem var(--ui-font); padding: 0 6px; }
.more-wrap { display: flex; justify-content: center; margin: 14px 0; }
.tips { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-top: 14px; }
.tips ul { margin: 0; padding-inline-start: 1.2em; }
.tips li { margin: 4px 0; }

/* ------------------------------------------------------------------ المختارات */
.col-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }
.col-card {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); text-decoration: none !important;
}
a.col-card:hover { border-color: var(--teal); }
.col-card.unseen { border-color: var(--teal); background: linear-gradient(var(--teal-soft), var(--card) 60%); }
.col-title { font: 400 1.35rem/1.5 var(--title-font); color: var(--crimson); }
.col-note { color: var(--ink-2); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.col-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: .85rem; color: var(--ink-2); margin-top: auto; }
.col-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.col-meta .ic { width: 15px; height: 15px; }
.col-meta .row-actions { margin-inline-start: auto; }
.col-desc { color: var(--ink-2); }
.shares-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--ink-2); font-size: .9rem; }
.shares-line .ic { width: 16px; height: 16px; color: var(--teal); }
.ci { margin: 0 0 16px; }
.ci-head { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; }
.ci-n { width: 28px; height: 28px; border-radius: 14px; background: var(--teal-soft); color: var(--teal); display: grid; place-items: center; font-size: .85rem; font-weight: 700; flex: none; }
.ci-title { font: 400 1.35rem/1.5 var(--title-font); color: var(--crimson); flex: 1; min-width: 0; }
.ci-what { font-size: .85rem; }
.ci .poem-body { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: .35em .8em; box-shadow: var(--shadow); }
.ci-note { display: flex; gap: 8px; align-items: flex-start; color: var(--ink-2); font-size: .92rem; margin: 6px 4px 0; }
.ci-note .ic { color: var(--teal); margin-top: 4px; width: 16px; height: 16px; }

.choice-list { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow: auto; padding: 2px; }
.choice { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.choice.on { border-color: var(--teal); background: var(--teal-soft); }
.choice-title { flex: 1; font-weight: 700; }
.choice.new input:not([type=radio]) { flex-basis: 100%; }
.picker { margin: 4px 0 10px; }
.pick-list { display: flex; flex-direction: column; gap: 2px; max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.pick-list.short { max-height: 170px; margin-bottom: 12px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.pick:hover { background: var(--hover); }
.pick.on { background: var(--teal-soft); }
.pick-name { flex: 1; }
.share-current { margin: 0 0 12px; }
.share-current .chips { margin-top: 6px; }

/* ------------------------------------------------------------------ المزيد والحساب */
.profile-card { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.avatar { width: 52px; height: 52px; border-radius: 26px; background: var(--teal); color: #fff; display: grid; place-items: center; font: 26px/1 var(--title-font); padding-bottom: 4px; flex: none; }
.more-group { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin: 0 0 14px; }
.more-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 16px; border: 0; border-top: 1px solid var(--line);
  background: none; color: var(--ink); text-align: start; cursor: pointer; text-decoration: none !important;
}
.more-row:first-child { border-top: 0; }
.more-row:hover { background: var(--hover); }
.more-row > .ic:first-child { color: var(--teal); }
.more-row.danger, .more-row.danger .ic { color: var(--no) !important; }
.more-label { flex: 1; display: flex; flex-direction: column; line-height: 1.5; }
.more-label small { color: var(--muted); }
.more-row .chev { color: var(--muted); width: 18px; height: 18px; }
.size-row { display: flex; align-items: center; gap: 8px; }
.sample { margin-top: 10px; background: var(--card-2); border: 1px dashed var(--line-2); border-radius: 12px; padding: .3em .6em; }

/* الاقتراحات */
.sug-list { display: flex; flex-direction: column; gap: 10px; }
.sug-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); }
.sug-card.pending { border-inline-start: 4px solid var(--warn); }
.sug-card.accepted { border-inline-start: 4px solid var(--ok); }
.sug-card.rejected { border-inline-start: 4px solid var(--no); }
.sug-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sug-item { font: 400 1.25rem/1.5 var(--title-font); color: var(--crimson); flex: 1; min-width: 0; }
.status { font-size: .8rem; padding: 0 9px; border-radius: 999px; line-height: 1.9; font-weight: 700; }
.status.wait { background: var(--warn-soft); color: var(--warn); }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.no { background: var(--no-soft); color: var(--no); }
.diff { display: block; white-space: pre-wrap; font-family: var(--read-font); font-size: 1.1rem; line-height: 2.1; padding: 8px 12px; border-radius: 10px; background: var(--card-2); margin: 6px 0; }
.diff del { background: var(--no-soft); color: var(--no); text-decoration: line-through; text-decoration-thickness: 1.5px; border-radius: 4px; }
.diff ins { background: var(--ok-soft); color: var(--ok); text-decoration: none; border-radius: 4px; }
.sug-msg, .sug-reply { display: flex; gap: 8px; align-items: flex-start; font-size: .95rem; color: var(--ink-2); margin: 6px 0 0; }
.sug-msg .ic { color: var(--teal); width: 16px; height: 16px; margin-top: 5px; }
.sug-reply { background: var(--teal-soft); padding: 6px 10px; border-radius: 10px; display: block; }
.sug-admin { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.edit-prop summary { cursor: pointer; color: var(--teal); font-size: .92rem; }
.edit-prop textarea { margin-top: 6px; }
.pre { white-space: pre-wrap; font-family: var(--read-font); }

/* لوحة المشرف */
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); }
.user-card.row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 8px 10px 8px 16px; }
.user-card.row .user-main { flex: 1; }
.user-card.disabled, .user-card.rejected { opacity: .7; }
.user-main { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.user-note { display: flex; gap: 8px; align-items: flex-start; background: var(--card-2); padding: 6px 10px; border-radius: 10px; margin: 8px 0; }
.user-note .ic { color: var(--teal); margin-top: 5px; width: 16px; height: 16px; }
.secret { display: flex; align-items: center; gap: 10px; margin: 12px 0; padding: 10px 14px; border-radius: 12px; background: var(--card-2); border: 1px dashed var(--line-2); }
.secret code { flex: 1; font-size: 1.3rem; letter-spacing: .06em; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: center; box-shadow: var(--shadow); }
.stat strong { display: block; font-size: 1.7rem; color: var(--teal); line-height: 1.3; }
.stat span { font-size: .85rem; color: var(--muted); }

.editor { max-width: 1200px; }
.ed-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 1000px) { .ed-grid { grid-template-columns: 1.1fr 1fr; } .ed-side { position: sticky; top: calc(var(--top) + 12px); align-self: start; max-height: calc(100vh - var(--top) - 24px); overflow: auto; } }
.ed-blocks { display: flex; flex-direction: column; gap: 8px; }
.ed-block { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
.ed-block.p { border-style: dashed; }
.ed-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin-bottom: 4px; }
.ed-tools select { width: auto; min-height: 34px; padding: 2px 8px; }
.ed-num { width: 60px !important; min-height: 34px !important; padding: 2px 8px !important; text-align: center; }
.ed-block textarea { min-height: 0; }
.ed-preview .poem-body { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .4em .8em; }

.rev-list { display: flex; flex-direction: column; gap: 10px; }
.rev { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; box-shadow: var(--shadow); }
.rev-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rev-head .btn { margin-inline-start: auto; }
.rev-ch { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin: 6px 0; }
.rev-ch .diff { flex: 1; margin: 0; min-width: 220px; font-size: 1rem; }

/* شرح المفردات */
.dict { display: flex; flex-direction: column; gap: 6px; }
.dict-entry { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; scroll-margin: calc(var(--top) + 80px); }
.dict-entry p { margin: 0; font-family: var(--read-font); font-size: calc(1.1rem * min(var(--scale), 1.5)); line-height: 2; text-align: justify; }

/* ------------------------------------------------------------------ الطباعة */
@media print {
  :root { --bg: #fff; --card: #fff; --ink: #000; --line: #ccc; }
  .topbar, .tabbar, .reader-tools, .selbar, .pager, .crumbs, .head-actions, .btn, .toasts, .filter, .skip { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; max-width: none; }
  .reader .poem-body, .ci .poem-body { border: 0; box-shadow: none; padding: 0; }
  .verse { break-inside: avoid; }
  .ci { break-inside: avoid-page; }
  a { color: inherit; }
  .gref { color: #555; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
