@font-face { font-family: "Tajawal"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/tajawal-arabic-400-normal.woff2") format("woff2"); unicode-range: U+0600-06FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE80-FEFC; }
@font-face { font-family: "Tajawal"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/tajawal-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Tajawal"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/tajawal-arabic-500-normal.woff2") format("woff2"); unicode-range: U+0600-06FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE80-FEFC; }
@font-face { font-family: "Tajawal"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/tajawal-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Tajawal"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/tajawal-arabic-700-normal.woff2") format("woff2"); unicode-range: U+0600-06FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE80-FEFC; }
@font-face { font-family: "Tajawal"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/tajawal-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #1b2333;
  --muted: #6a7489;
  --line: #e4e9f2;
  --brand: #1f4e8c;
  --brand-2: #142f5a;
  --brand-soft: #e4ecf8;
  --on-brand: #ffffff;
  --me: #d9eefb;
  --them: #ffffff;
  --danger: #dc3f4a;
  --ok: #1a9a62;
  --warn: #c98100;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(28, 48, 88, .08);
  --shadow-sm: 0 2px 8px rgba(28, 48, 88, .06);
  --chat-bg: #e9eff7;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --font: "Tajawal", system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif;
  color-scheme: light;
}
/* الثيمات: بناتي · ولادي · ليلي (تحددها الموجهة، وللمستخدم اختيار خاص) */
:root[data-ui="girly"] {
  --bg: #fdf2f7; --card: #ffffff; --text: #43303a; --muted: #8f6b7d; --line: #f3dce7;
  --brand: #cf5a8d; --brand-2: #a8396a; --brand-soft: #fbe4ee;
  --me: #f8d9e6; --them: #ffffff; --chat-bg: #fbeaf1;
  --shadow: 0 6px 24px rgba(168, 57, 106, .09); --shadow-sm: 0 2px 8px rgba(168, 57, 106, .07);
}
:root[data-ui="boyish"] {
  --bg: #f1f5fb; --card: #ffffff; --text: #1f2d44; --muted: #66789a; --line: #dce6f4;
  --brand: #3b7bd0; --brand-2: #25549a; --brand-soft: #e2edfb;
  --me: #d3e4fa; --them: #ffffff; --chat-bg: #e6eef9;
}
:root[data-ui="night"] {
  --bg: #121829; --card: #1b2238; --text: #dfe4f3; --muted: #8e99b8; --line: #2a3352;
  --brand: #8f9bff; --brand-2: #6470e0; --brand-soft: #232c4a; --on-brand: #101528;
  --me: #2c386b; --them: #1f2742; --chat-bg: #0e1322;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35); --shadow-sm: 0 2px 8px rgba(0, 0, 0, .28);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: calc(16px * var(--fs, 1)); line-height: 1.55; }
body { overscroll-behavior-y: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--brand-2); }
[hidden] { display: none !important; }
svg.ic { width: 1em; height: 1em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; flex: none; }
.ic-wrap { display: inline-flex; align-items: center; justify-content: center; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 8px; }

/* ───── الهيكل ───── */
#app { height: 100%; }
.shell { height: 100dvh; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; background: var(--bg); position: relative; }
.topbar { display: flex; align-items: center; gap: 8px; padding: calc(10px + var(--sat)) 14px 10px; background: var(--bg); position: sticky; top: 0; z-index: 5; min-height: 58px; }
.topbar h1 { font-size: calc(20px * var(--fs, 1)); margin: 0; flex: 1; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: calc(22px * var(--fs, 1)); color: var(--text); background: var(--card); box-shadow: var(--shadow-sm); }
.icon-btn:active { transform: scale(.94); }
.content { flex: 1; overflow-y: auto; padding: 4px 14px 24px; -webkit-overflow-scrolling: touch; }
.tabbar { display: flex; background: var(--card); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + var(--sab)); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 12px; color: var(--muted); font-size: calc(12px * var(--fs, 1)); position: relative; text-decoration: none; }
.tab .ic { font-size: calc(22px * var(--fs, 1)); }
.tab.active { color: var(--brand); font-weight: 700; }
.badge { min-width: 18px; height: 18px; border-radius: 9px; background: var(--danger); color: #fff; font-size: calc(11px * var(--fs, 1)); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.tab .badge { position: absolute; top: 0; inset-inline-start: calc(50% + 6px); }
.fab { position: absolute; inset-inline-start: 18px; bottom: calc(82px + var(--sab)); width: 56px; height: 56px; border-radius: 18px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-size: calc(26px * var(--fs, 1)); display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 24px rgba(31, 95, 174, .35); z-index: 6; }

/* ───── المصادقة ───── */
.auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 18px calc(24px + var(--sab)); background: radial-gradient(1200px 500px at 50% -10%, var(--brand-soft), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border-radius: 26px; padding: 26px 22px 22px; box-shadow: var(--shadow); }
.logo { width: 76px; height: 76px; border-radius: 22px; display: block; margin: 0 auto 10px; box-shadow: 0 10px 26px rgba(31, 95, 174, .3); }
.auth h1 { text-align: center; margin: 4px 0 2px; font-size: calc(26px * var(--fs, 1)); }
.auth .sub { text-align: center; color: var(--muted); margin: 0 0 18px; font-size: calc(14px * var(--fs, 1)); }
.seg { display: flex; background: var(--bg); border-radius: 14px; padding: 4px; gap: 4px; margin-bottom: 16px; }
.seg button { flex: 1; padding: 9px 6px; border-radius: 11px; color: var(--muted); font-weight: 500; font-size: calc(15px * var(--fs, 1)); display: inline-flex; gap: 6px; align-items: center; justify-content: center; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 700; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: calc(13px * var(--fs, 1)); color: var(--muted); margin: 0 4px 5px; }
.input { width: 100%; padding: 13px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); outline: none; transition: border-color .15s, background .15s; }
.input:focus { border-color: var(--brand); background: var(--card); }
.input[dir="ltr"] { text-align: right; }
textarea.input { resize: vertical; min-height: 110px; }
.pw { position: relative; }
.pw button { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: var(--brand); font-size: calc(13px * var(--fs, 1)); padding: 6px 8px; }
.pw .input { padding-left: 64px; padding-right: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 18px; border-radius: 14px; font-weight: 700; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: var(--on-brand); width: 100%; box-shadow: 0 8px 18px rgba(31, 95, 174, .22); }
.btn:disabled { opacity: .55; box-shadow: none; }
.btn.ghost { background: var(--bg); color: var(--text); box-shadow: none; border: 1px solid var(--line); }
.btn.danger { background: var(--danger); box-shadow: none; }
.btn.small { width: auto; padding: 8px 14px; font-size: calc(14px * var(--fs, 1)); border-radius: 12px; box-shadow: none; }
.err { color: var(--danger); font-size: calc(14px * var(--fs, 1)); min-height: 22px; margin: 4px 4px 8px; }
.hint { color: var(--muted); font-size: calc(13px * var(--fs, 1)); text-align: center; margin: 12px 4px 0; }
.banner { display: flex; gap: 10px; align-items: center; background: var(--brand-soft); border-radius: 16px; padding: 11px 12px; margin: 0 0 14px; font-size: calc(14px * var(--fs, 1)); }
.banner .grow { flex: 1; }
.center-card { text-align: center; padding: 30px 12px; }
.center-card .big { font-size: calc(54px * var(--fs, 1)); line-height: 1; }

/* ───── الرئيسية والأقسام ───── */
.hero { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-radius: 22px; padding: 18px 18px 16px; margin: 4px 0 16px; box-shadow: 0 12px 28px rgba(31, 95, 174, .25); }
.hero .hi { font-size: calc(14px * var(--fs, 1)); opacity: .85; }
.hero .nm { font-size: calc(22px * var(--fs, 1)); font-weight: 700; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.cat { background: var(--card); border-radius: var(--radius); padding: 16px 14px; text-align: start; box-shadow: var(--shadow-sm); position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 118px; text-decoration: none; color: inherit; }
.cat:active { transform: scale(.98); }
.cat .ico { width: 46px; height: 46px; border-radius: 15px; display: flex; align-items: center; justify-content: center; font-size: calc(24px * var(--fs, 1)); }
.cat .t { font-weight: 700; font-size: calc(16px * var(--fs, 1)); }
.cat .c { color: var(--muted); font-size: calc(13px * var(--fs, 1)); }
.cat .badge { position: absolute; top: 12px; inset-inline-end: 12px; background: var(--brand); }
.cat.wide { grid-column: span 2; min-height: 0; flex-direction: row; align-items: center; }
.post { background: var(--card); border-radius: var(--radius); padding: 15px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.post.pinned { border: 1.5px solid var(--brand-soft); }
.post h3 { margin: 0 0 4px; font-size: calc(18px + var(--post-step, 0px)); line-height: 1.4; }
.post h3.ptitle { margin: 0 0 10px; }
.post h3.orn { display: flex; align-items: center; justify-content: center; gap: 10px; text-align: center; --orn: color-mix(in srgb, currentColor 45%, transparent); }
.post h3.orn::before, .post h3.orn::after { content: ''; flex: 1 1 14px; min-width: 14px; height: 7px; }
.post h3.orn::before { background: radial-gradient(circle at 3px 50%, var(--orn) 2.6px, transparent 3.2px) no-repeat, linear-gradient(to left, transparent, var(--orn)) no-repeat 0 50% / 100% 1px; }
.post h3.orn::after { background: radial-gradient(circle at calc(100% - 3px) 50%, var(--orn) 2.6px, transparent 3.2px) no-repeat, linear-gradient(to right, transparent, var(--orn)) no-repeat 0 50% / 100% 1px; }
.post .meta { color: var(--muted); font-size: calc(12.5px * var(--fs, 1)); margin-bottom: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.post .body { font-size: calc(16px + var(--post-step, 0px)); white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.pin-tag { color: var(--brand); font-weight: 700; display: inline-flex; gap: 3px; align-items: center; }
.post .more { margin-inline-start: auto; color: var(--muted); font-size: calc(20px * var(--fs, 1)); padding: 2px 6px; }
.linkchip { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); text-decoration: none; font-size: calc(14px * var(--fs, 1)); overflow: hidden; }
.linkchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; unicode-bidi: plaintext; }
.empty { text-align: center; color: var(--muted); padding: 50px 10px; }
.empty .big { font-size: calc(46px * var(--fs, 1)); }
a.lnk { unicode-bidi: isolate; overflow-wrap: anywhere; word-break: normal; }

/* ───── المرفقات ───── */
.atts { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.atts .imgs { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; }
.atts img { width: 100%; max-height: 340px; object-fit: cover; border-radius: 12px; display: block; background: var(--line); cursor: zoom-in; }
.atts .imgs.one img { max-height: 420px; }
.atts video { width: 100%; max-height: 380px; border-radius: 12px; background: #000; }
.filecard { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(120, 140, 170, .14); text-decoration: none; color: inherit; }
.filecard .fi { width: 38px; height: 38px; border-radius: 10px; background: #e5484d; color: #fff; display: flex; align-items: center; justify-content: center; font-size: calc(20px * var(--fs, 1)); flex: none; }
.filecard .fn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: calc(14px * var(--fs, 1)); font-weight: 500; }
.filecard .fs { font-size: calc(12px * var(--fs, 1)); color: var(--muted); }
.filecard .fx { min-width: 0; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .92); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 10px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lightbox button { position: absolute; top: calc(14px + var(--sat)); inset-inline-start: 14px; width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 255, 255, .18); color: #fff; font-size: calc(22px * var(--fs, 1)); }
.tray { display: flex; gap: 8px; padding: 8px 10px 0; overflow-x: auto; }
.chip { display: flex; align-items: center; gap: 6px; padding: 5px 6px 5px 8px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: calc(12.5px * var(--fs, 1)); flex: none; max-width: 190px; }
.chip img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; }
.chip-ic { font-size: calc(20px * var(--fs, 1)); color: var(--muted); }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 90px; }
.chip.err { border-color: var(--danger); }
.chip-err { color: var(--danger); }
.chip-pct { color: var(--muted); }
.chip-x { width: 22px; height: 22px; border-radius: 50%; background: var(--bg); display: inline-flex; align-items: center; justify-content: center; }

/* ───── المحادثة ───── */
.chat { height: 100dvh; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; background: var(--chat-bg); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--sat)) 12px 8px; background: var(--card); box-shadow: var(--shadow-sm); z-index: 3; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; flex: none; }
.chat-head .who { flex: 1; min-width: 0; }
.chat-head .who b { display: block; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .who small { color: var(--muted); font-size: calc(12px * var(--fs, 1)); direction: ltr; unicode-bidi: plaintext; }
.msgs { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; -webkit-overflow-scrolling: touch; }
.day { align-self: center; background: rgba(120, 140, 170, .22); color: var(--muted); font-size: calc(12px * var(--fs, 1)); padding: 3px 12px; border-radius: 12px; margin: 10px 0 6px; }
.msg { max-width: 82%; padding: 7px 10px 5px; border-radius: 16px; box-shadow: 0 1px 2px rgba(20, 30, 50, .08); position: relative; word-break: break-word; overflow-wrap: anywhere; }
.msg.mine { align-self: flex-start; background: var(--me); border-end-start-radius: 5px; }
.msg.theirs { align-self: flex-end; background: var(--them); border-end-end-radius: 5px; }
.msg .txt { white-space: pre-wrap; }
.msg .who-name { font-size: calc(12px * var(--fs, 1)); font-weight: 700; color: var(--brand); margin-bottom: 1px; }
.msg .foot { display: flex; justify-content: flex-end; gap: 4px; align-items: center; font-size: calc(11px * var(--fs, 1)); color: var(--muted); margin-top: 1px; }
.msg .tick { font-size: calc(13px * var(--fs, 1)); }
.msg .tick.read { color: #2aa3ff; }
.msg.deleted .txt { color: var(--muted); font-style: italic; }
.msg.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 3px var(--brand); } 100% { box-shadow: 0 1px 2px rgba(20, 30, 50, .08); } }
.quote { border-inline-start: 3px solid var(--brand); background: rgba(120, 140, 170, .16); border-radius: 8px; padding: 4px 8px; margin: 2px 0 5px; font-size: calc(13px * var(--fs, 1)); cursor: pointer; }
.quote b { display: block; color: var(--brand); font-size: calc(12px * var(--fs, 1)); }
.quote span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.older { align-self: center; color: var(--brand); font-size: calc(13px * var(--fs, 1)); padding: 6px 14px; background: var(--card); border-radius: 12px; margin-bottom: 6px; }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--card); border-top: 1px solid var(--line); }
.reply-bar .quote { flex: 1; margin: 0; cursor: default; min-width: 0; }
.composer-wrap { background: var(--chat-bg); padding-bottom: var(--sab); }
.composer { display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px; }
.composer .field-box { flex: 1; display: flex; align-items: flex-end; background: var(--card); border-radius: 22px; padding: 3px 4px; box-shadow: var(--shadow-sm); min-width: 0; }
.composer textarea { flex: 1; border: 0; outline: none; background: transparent; resize: none; max-height: 120px; padding: 9px 6px; line-height: 1.4; min-width: 0; }
.composer .tool { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: calc(22px * var(--fs, 1)); color: var(--muted); flex: none; }
.composer .send { width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: calc(21px * var(--fs, 1)); flex: none; }
.composer .send:disabled { opacity: .45; }
.composer .send svg { transform: scaleX(-1); }
.emoji-panel { background: var(--card); border-top: 1px solid var(--line); height: 250px; display: flex; flex-direction: column; }
.emoji-tabs { display: flex; border-bottom: 1px solid var(--line); }
.emoji-tabs button { flex: 1; padding: 8px 0; font-size: calc(20px * var(--fs, 1)); opacity: .55; }
.emoji-tabs button.on { opacity: 1; border-bottom: 2px solid var(--brand); }
.emoji-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(8, 1fr); padding: 6px; align-content: start; }
.emoji-grid button { font-size: calc(26px * var(--fs, 1)); padding: 5px 0; border-radius: 10px; }
.emoji-grid button:active { background: var(--bg); }

/* ───── القوائم ───── */
.search { position: relative; margin-bottom: 12px; }
.search .s-ic { position: absolute; display: inline-flex; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-inline-start: 40px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--card); border-radius: 16px; margin-bottom: 8px; box-shadow: var(--shadow-sm); text-decoration: none; color: inherit; }
.row .mid { flex: 1; min-width: 0; }
.row .nm { font-weight: 700; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row .sub { color: var(--muted); font-size: calc(13.5px * var(--fs, 1)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .end { text-align: end; font-size: calc(12px * var(--fs, 1)); color: var(--muted); display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.tag { font-size: calc(11.5px * var(--fs, 1)); padding: 2px 8px; border-radius: 9px; font-weight: 700; background: var(--brand-soft); color: var(--brand); }
.tag.warn { background: #fff2d6; color: var(--warn); }
.tag.bad { background: #fde4e6; color: var(--danger); }
.tag.own { background: #e8e4fd; color: #5b43d6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag.warn { background: #3a2d0d; } :root:not([data-theme="light"]) .tag.bad { background: #3b1a1e; } :root:not([data-theme="light"]) .tag.own { background: #2a2350; color: #b3a6ff; } }
:root[data-theme="dark"] .tag.warn { background: #3a2d0d; } :root[data-theme="dark"] .tag.bad { background: #3b1a1e; } :root[data-theme="dark"] .tag.own { background: #2a2350; color: #b3a6ff; }
.ucard { background: var(--card); border-radius: 16px; padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.ucard .top { display: flex; gap: 12px; align-items: center; }
.ucard .acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.panel { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.panel h4 { margin: 0 0 8px; font-size: calc(15px * var(--fs, 1)); }
.switch-row { display: flex; align-items: center; gap: 12px; }
.switch-row .grow { flex: 1; }
.switch-row small { color: var(--muted); display: block; }
.switch { width: 52px; height: 30px; border-radius: 15px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(-22px); }
.invite { display: flex; gap: 8px; align-items: center; direction: ltr; }
.invite code { flex: 1; background: var(--bg); padding: 10px; border-radius: 12px; font-size: calc(13px * var(--fs, 1)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pills { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.pill { padding: 7px 14px; border-radius: 20px; background: var(--card); color: var(--muted); font-size: calc(14px * var(--fs, 1)); white-space: nowrap; box-shadow: var(--shadow-sm); display: inline-flex; gap: 6px; align-items: center; }
.pill.on { background: var(--brand); color: #fff; font-weight: 700; }

/* ───── النوافذ ───── */
.backdrop { position: fixed; inset: 0; background: rgba(8, 14, 26, .5); z-index: 50; display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .18s; }
.backdrop.show { opacity: 1; }
.sheet { width: 100%; max-width: 720px; background: var(--card); border-radius: 24px 24px 0 0; padding: 8px 16px calc(18px + var(--sab)); max-height: 92dvh; overflow-y: auto; transform: translateY(30px); transition: transform .2s; }
.backdrop.show .sheet { transform: none; }
.grab { width: 42px; height: 5px; background: var(--line); border-radius: 3px; margin: 4px auto 10px; }
.sheet-title { margin: 4px 2px 12px; font-size: calc(18px * var(--fs, 1)); }
.act { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 8px; border-radius: 12px; font-size: calc(16px * var(--fs, 1)); text-align: start; }
.act:active { background: var(--bg); }
.act.danger { color: var(--danger); }
.act .ic { font-size: calc(20px * var(--fs, 1)); }
.sheet .btns { display: flex; gap: 10px; margin-top: 12px; }
.toast { position: fixed; inset-inline: 16px; bottom: calc(90px + var(--sab)); margin: 0 auto; max-width: 420px; background: #1b2333; color: #fff; padding: 12px 16px; border-radius: 14px; z-index: 200; text-align: center; box-shadow: var(--shadow); animation: pop .2s ease; font-size: calc(15px * var(--fs, 1)); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
.spin { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: sp .8s linear infinite; margin: 40px auto; }
@keyframes sp { to { transform: rotate(360deg); } }
.skeleton { height: 96px; border-radius: var(--radius); background: linear-gradient(90deg, var(--card), var(--line), var(--card)); background-size: 200% 100%; animation: sh 1.2s infinite; margin-bottom: 12px; }
@keyframes sh { to { background-position: -200% 0; } }
@media (min-width: 721px) { .shell, .chat { border-inline: 1px solid var(--line); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.row .sub { unicode-bidi: plaintext; }

.entry { background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 12px 12px 2px; margin-bottom: 10px; }
.entry-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: var(--brand); }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }

.req { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; background: var(--card); border: 1.5px solid var(--brand); border-radius: 18px; padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow, 0 6px 18px rgba(0,0,0,.06)); color: inherit; font: inherit; cursor: pointer; }
.req-ic { font-size: calc(26px * var(--fs, 1)); }
.req-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.req-tx small { color: var(--muted); font-size: calc(13.5px * var(--fs, 1)); }
.req-tx small.ok { color: #16a34a; }
.req-tx small.wait { color: #d97706; }

.pfoot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.pbtn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--brand); font: inherit; font-size: calc(13.5px * var(--fs, 1)); font-weight: 700; text-decoration: none; cursor: pointer; }
.pbtn.wa { background: #16a34a; border-color: #16a34a; color: #fff; }

/* ── 2026-10: صور الأعضاء، النسخ واللصق، المعاينة ── */
.msg .txt, .post .body { user-select: text; -webkit-user-select: text; -webkit-touch-callout: default; }
.msg .who-row { display: flex; align-items: center; gap: 6px; }
.msg .who-row .avatar { font-size: calc(11px * var(--fs, 1)); }
.msg .mini-copy { color: var(--muted); opacity: .75; padding: 2px 4px; font-size: calc(14px * var(--fs, 1)); border-radius: 6px; }
.msg .mini-copy:active { background: rgba(0,0,0,.08); }
.ed-tools { display: flex; gap: 8px; margin: 2px 0 10px; flex-wrap: wrap; }
.ed-tools .pbtn { flex: 1 1 auto; justify-content: center; }
.preview { margin: 14px 0 10px; padding: 10px; border: 1.5px dashed var(--brand); border-radius: 16px; background: var(--bg); }
.preview-h { font-weight: 700; font-size: calc(13px * var(--fs, 1)); color: var(--brand); margin-bottom: 8px; }
.preview .post { margin-bottom: 0; }
.preview .pv-empty { color: var(--muted); text-align: center; padding: 14px 0; font-size: calc(14px * var(--fs, 1)); }
.preview .pv-img { display: block; max-width: 100%; max-height: 260px; border-radius: 12px; margin-top: 8px; }
.av-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.msg .foot .edited { font-size: calc(11px * var(--fs, 1)); opacity: .7; margin-inline-end: 6px; }
/* ── خلفيات المنشورات ── */
.post.has-bg { border: 1px solid rgba(0,0,0,.07); }
.post.has-bg .meta { color: inherit; opacity: .78; }
.post.has-bg .more { color: inherit; }
.post.has-bg .pfoot { border-top-color: color-mix(in srgb, currentColor 28%, transparent); }
.post.has-bg .pbtn { background: rgba(255,255,255,.62); border-color: rgba(0,0,0,.08); }
.post.has-bg.tone-dark .pbtn { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.28); color: #fff; }
.post.has-bg .pbtn.wa { background: #16a34a; border-color: #16a34a; color: #fff; }
.post.has-bg .linkchip { background: rgba(255,255,255,.6); }
.post.has-bg.tone-dark .linkchip { background: rgba(255,255,255,.14); color: #fff; }
.post.has-bg a { color: inherit; }
.bg-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; }
.bg-sw { flex: none; width: 66px; background: none; border: 0; padding: 0; font: inherit; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.bg-sw small { font-size: calc(11px * var(--fs, 1)); text-align: center; line-height: 1.3; }
.bg-chip { width: 58px; height: 42px; border-radius: 12px; border: 2px solid transparent; box-shadow: 0 0 0 1px var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 700; overflow: hidden; }
.bg-sw.on .bg-chip { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.bg-sw.on small { color: var(--brand); font-weight: 700; }
/* ── مناسبات أهل البيت ── */
.banner.today { display: block; border-radius: 16px; padding: 12px 14px; margin-bottom: 10px; background: linear-gradient(135deg,#fffaf0,#f6e7c1); border: 1px solid #e5cf94; color: #3b2a0b; text-decoration: none; }
.banner.today.sorrow { background: linear-gradient(135deg,#2a1215,#0f0708); border-color: #4a2a2f; color: #f7e9c6; }
.banner.today div { font-size: calc(13.5px * var(--fs, 1)); margin-top: 4px; }
.occ-box { margin-bottom: 4px; }
.occ-row { position: relative; }
.occ-row .banner.today { padding: 10px 14px; padding-inline-end: 44px; margin-bottom: 8px; font-size: calc(14.5px * var(--fs, 1)); line-height: 1.5; }
.occ-row .banner.today b { font-weight: 800; }
.occ-x { position: absolute; top: 8px; inset-inline-end: 8px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.08); color: #3b2a0b; font-size: calc(20px * var(--fs, 1)); line-height: 1; cursor: pointer; display: grid; place-items: center; }
.occ-x.dark { background: rgba(255,255,255,.14); color: #f7e9c6; }
.btns[hidden] { display: none; }
.pcontact { font-size: calc(12.5px * var(--fs, 1)); color: var(--muted); text-align: center; line-height: 1.8; margin: 4px 0 8px; }
.pcontact a { color: inherit; text-decoration: none; }
.pcontact .u { direction: ltr; unicode-bidi: embed; display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.post.has-bg .pcontact { color: inherit; opacity: .8; }
.card.occ-home { display: flex; justify-content: space-between; align-items: center; text-decoration: none; color: inherit; margin-bottom: 12px; }
.card.occ-home small { display: block; color: var(--muted); margin-top: 3px; font-size: calc(12.5px * var(--fs, 1)); }
.card.occ-home .chev { font-size: calc(22px * var(--fs, 1)); color: var(--brand); }
.occ-nav { background: var(--card); border-radius: 14px; padding: 10px 14px; margin-bottom: 10px; text-align: center; font-size: calc(16px * var(--fs, 1)); box-shadow: var(--shadow-sm); }
.occ-month { font-weight: 700; color: var(--muted); margin: 14px 4px 6px; font-size: calc(14px * var(--fs, 1)); }
.card.occ-card { display: flex; gap: 12px; align-items: center; width: 100%; text-align: start; font: inherit; color: inherit; border: 0; cursor: pointer; margin-bottom: 10px; padding: 12px 14px; }
.occ-card.nextocc { outline: 2px solid var(--brand); }
.occ-card.todayocc { outline: 2px solid #e0b43c; }
.occ-day { width: 54px; min-width: 54px; height: 60px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; }
.occ-day b { font-size: calc(22px * var(--fs, 1)); line-height: 1; }
.occ-day span { font-size: calc(11px * var(--fs, 1)); margin-top: 3px; text-align: center; }
.occ-day.d-joy { background: var(--brand-soft); color: var(--brand); }
.occ-day.d-sad { background: #2b3442; color: #fff; }
.occ-mid { flex: 1; min-width: 0; }
.occ-t { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-weight: 700; font-size: calc(15px * var(--fs, 1)); }
.occ-p { font-size: calc(12.5px * var(--fs, 1)); color: var(--muted); margin-top: 3px; }
.tag.joy { background: #dff5e8; color: #157347; }
.tag.sad { background: #2b3442; color: #f1f4f9; }
.tag.joy, .tag.sad { display: inline-block; font-size: calc(11px * var(--fs, 1)); padding: 2px 9px; border-radius: 10px; font-weight: 700; }
.occ-hero { border-radius: 18px; padding: 18px 16px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.occ-hero h3 { margin: 4px 0 2px; font-size: calc(20px * var(--fs, 1)); line-height: 1.5; }
.occ-hero.joy { background: linear-gradient(135deg,#fffaf0,#f6e7c1); color: #3b2a0b; }
.occ-hero.sad { background: linear-gradient(135deg,#2a1215,#0f0708); color: #f7e9c6; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; }
.btnrow .pbtn { flex: 1 1 auto; justify-content: center; }
.seg { display: flex; gap: 8px; }
.segb { flex: 1; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; cursor: pointer; }
.segb.on.joy { background: #dff5e8; border-color: #157347; color: #157347; font-weight: 700; }
.segb.on.sad { background: #2b3442; border-color: #2b3442; color: #fff; font-weight: 700; }
/* ── الإعلان المنبثق ورقم الإصدار ── */
.pop-back { position: fixed; inset: 0; z-index: 90; background: rgba(8,12,20,.62); display: flex; align-items: center; justify-content: center; padding: 18px; }
.pop-card { position: relative; width: 100%; max-width: 420px; max-height: 88vh; overflow-y: auto; background: var(--card); color: var(--text); border-radius: 22px; box-shadow: 0 18px 50px #0007; }
.pop-img { display: block; width: 100%; max-height: 62vh; object-fit: contain; background: #0001; border-radius: 22px 22px 0 0; }
.pop-body { padding: 16px 18px 4px; }
.pop-body h3 { margin: 0 0 6px; font-size: calc(19px * var(--fs, 1)); line-height: 1.5; }
.pop-txt { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.9; font-size: calc(15px * var(--fs, 1)); }
.pop-btns { display: flex; flex-direction: column; gap: 8px; padding: 14px 18px 18px; }
.pop-btns .btn { text-align: center; text-decoration: none; }
.pop-x { position: absolute; top: 10px; inset-inline-end: 10px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(0,0,0,.45); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.ver { text-align: center; color: var(--muted); font-size: calc(12.5px * var(--fs, 1)); margin: 6px 0 24px; }

.occ-card.k-joy { border-inline-start: 5px solid #157347; }
.occ-card.k-sad { border-inline-start: 5px solid #2b3442; background: color-mix(in srgb, var(--card) 94%, #2b3442); }
.occ-t .tag.sad { background: #2b3442; color: #fff; }

.tag.oth { background: #e8ecf1; color: #4a5565; display: inline-block; font-size: calc(11px * var(--fs, 1)); padding: 2px 9px; border-radius: 10px; font-weight: 700; }
.occ-day.d-oth { background: #eceff3; color: #4a5565; }
.occ-card.k-oth { border-inline-start: 5px solid #b4bcc8; }
.segb.on.oth { background: #eceff3; border-color: #b4bcc8; color: #3d4757; font-weight: 700; }
.banner.today.other { background: linear-gradient(135deg,#f4f6f9,#e6eaf0); border-color: #cfd6e0; color: #2f3846; }

.contact-wa { display: flex; justify-content: center; margin: 16px 0 8px; padding: 12px 14px; font-size: calc(15px * var(--fs, 1)); }

.dpick { display: flex; gap: 8px; margin-bottom: 8px; }
.dpick select { flex: 1 1 0; min-width: 0; padding-inline: 8px; }
.dpick select:nth-child(2) { flex: 1.6 1 0; }
.tplbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 4px 0 10px; }
.tplbar .input { width: auto; flex: 1 1 120px; min-width: 100px; }
.lnk.tel { direction: ltr; unicode-bidi: isolate; font-weight: 700; }

.frow { display: flex; gap: 12px; flex-wrap: wrap; }
.fcol { flex: 1 1 140px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.fcol small { color: var(--muted); font-size: calc(12.5px * var(--fs, 1)); margin-bottom: 4px; }

/* تحديد الكل في شاشات التصميم: يشمل مربع الكتابة فقط لا الصفحة كلها */
body:has(.ed) *, body:has(.ed) .post .body, body:has(.ed) .msg .txt { -webkit-user-select: none !important; user-select: none !important; }
body:has(.ed) input, body:has(.ed) textarea { -webkit-user-select: text !important; user-select: text !important; }

/* القائمة السفلية ثابتة: الصفحة نفسها لا تتحرك، والمحتوى وحده يمرَّر */
html, body { overflow: hidden; overscroll-behavior: none; position: fixed; inset: 0; width: 100%; }
.shell { position: fixed; inset: 0; height: auto; margin-inline: auto; width: 100%; max-width: 720px; }
.chat { position: fixed; inset: 0; height: auto; width: 100%; margin-inline: auto; }
.auth { position: fixed; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* الشاشة الرئيسية: مدمجة (عمودان) أو ثلاثة أعمدة */
.grid.compact { gap: 9px; }
.grid.compact .cat { flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; min-height: 64px; }
.grid.compact .cat .ico { width: 38px; height: 38px; font-size: calc(20px * var(--fs, 1)); border-radius: 12px; flex: none; }
.grid.compact .cat .t { font-size: calc(14.5px * var(--fs, 1)); line-height: 1.25; }
.grid.compact .cat .c { font-size: calc(11.5px * var(--fs, 1)); }
.grid.compact .cat .badge { top: 6px; inset-inline-end: 8px; font-size: calc(10.5px * var(--fs, 1)); height: 17px; min-width: 17px; }
.grid.g3 { grid-template-columns: repeat(3, 1fr); gap: 9px; }
.grid.g3 .cat { align-items: center; justify-content: center; text-align: center; gap: 5px; padding: 10px 4px; min-height: 96px; }
.grid.g3 .cat .ico { width: 42px; height: 42px; font-size: calc(23px * var(--fs, 1)); border-radius: 13px; }
.grid.g3 .cat .t { font-size: calc(12.5px * var(--fs, 1)); line-height: 1.25; }
.grid.g3 .cat .c { font-size: calc(10.5px * var(--fs, 1)); }
.grid.g3 .cat .badge { top: 5px; inset-inline-end: 6px; font-size: calc(10.5px * var(--fs, 1)); height: 17px; min-width: 17px; }
.hero { padding: 11px 16px 10px; margin: 2px 0 10px; border-radius: 18px; display: flex; align-items: baseline; gap: 8px; }
.hero .nm { font-size: calc(18px * var(--fs, 1)); }
.hero .hi { font-size: calc(13.5px * var(--fs, 1)); }

/* إشعار علوي داخل التطبيق: ينزل ثم ينطوي للأعلى */
.ntf-wrap { position: fixed; top: 0; inset-inline: 0; z-index: 300; display: flex; justify-content: center; pointer-events: none; padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 0; }
.ntf { pointer-events: auto; width: 100%; max-width: 460px; display: flex; gap: 10px; align-items: center; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 30px rgba(10, 20, 40, .28); padding: 10px 12px; transform: translateY(-140%); opacity: 0; transition: transform .32s cubic-bezier(.2, .8, .2, 1), opacity .25s; text-align: start; cursor: pointer; }
.ntf.show { transform: translateY(0); opacity: 1; }
.ntf .ni { width: 38px; height: 38px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: calc(19px * var(--fs, 1)); flex: none; }
.ntf .nt { min-width: 0; flex: 1; }
.ntf .nt b { display: block; font-size: calc(14.5px * var(--fs, 1)); }
.ntf .nt span { display: block; font-size: calc(13px * var(--fs, 1)); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* العلامة المائية */
.chip-wm { font-size: calc(12px * var(--fs, 1)); padding: 3px 8px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); font-weight: 700; white-space: nowrap; }
.wm-row { margin-top: 10px; padding: 10px 12px; background: var(--bg); border-radius: 14px; }
.wm-ctl { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.wm-ctl select { flex: 1; min-width: 0; padding-block: 8px; }
.wm-op { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.wm-op input[type=range] { flex: 1; min-width: 0; }
.wm-row small { color: var(--muted); min-width: 34px; text-align: end; }
.wm-prev { display: block; width: 100%; max-height: 260px; object-fit: contain; border-radius: 12px; background: var(--bg); }
.sheet input[type=range] { width: 100%; }

/* ── إحصائيات الأعضاء (للمسؤول) ── */
.ustats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 12px; }
.ust { background: var(--card); border-radius: 14px; padding: 10px 8px; text-align: center; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 2px; }
.ust b { font-size: calc(22px * var(--fs, 1)); line-height: 1.2; color: var(--brand); }
.ust span { font-size: calc(12.5px * var(--fs, 1)); color: var(--text); }
.ust small { font-size: calc(11px * var(--fs, 1)); color: var(--muted); }
.ust.wide { grid-column: 1 / -1; flex-direction: row; justify-content: center; align-items: baseline; gap: 10px; }
.ust.wide b { font-size: calc(26px * var(--fs, 1)); }
.ust.warn b { color: #b45309; }

/* ── رأس النافذة المنبثقة وزر الرجوع ── */
.sheet-head { display: flex; align-items: center; gap: 10px; margin: 2px 0 8px; min-height: 36px; }
.sheet-head .sheet-title { margin: 0; flex: 1; }
.sheet-head .grab { flex: 1; margin: 0 auto; max-width: 60px; }
.sheet-head .grab:first-of-type { margin-inline: auto; }
.sheet-back { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(127,127,127,.16); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.sheet-sp { flex: none; width: 36px; }
.sheet-head:has(.grab) { justify-content: space-between; }
.draft-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--brand-soft); border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; font-size: calc(14px * var(--fs, 1)); }

/* ── التسجيل الصوتي ── */
.voice { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 16px; padding: 8px 12px; margin: 0 0 8px; box-shadow: var(--shadow-sm); }
.voice[hidden] { display: none; }
.v-dot { width: 11px; height: 11px; border-radius: 50%; background: #dc2626; animation: vpulse 1s infinite; flex: none; }
@keyframes vpulse { 50% { opacity: .25; } }
.v-time { font-size: calc(17px * var(--fs, 1)); font-variant-numeric: tabular-nums; }
.v-max { color: var(--muted); }
.v-sp { flex: 1; }
.v-stop { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 12px; background: #dc2626; color: #fff; padding: 9px 14px; font: inherit; font-weight: 700; cursor: pointer; }
.v-audio { flex: 1; min-width: 0; height: 38px; }
.v-status { color: var(--muted); font-variant-numeric: tabular-nums; }
.voice-msg { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; min-width: 220px; }
.voice-msg .vm-t { font-size: calc(13px * var(--fs, 1)); color: var(--muted); }
.voice-msg audio { width: 100%; height: 38px; }

/* ── وقت القراءة الحسينية ── */
.slotw { display: flex; flex-direction: column; gap: 8px; }
.dpick[hidden] { display: none; }

/* ───── شاشة الترحيب عند التشغيل ───── */
#splash { position: fixed; inset: 0; z-index: 99999; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: #fff; background: linear-gradient(160deg, #12c46f 0%, #0b8f9e 50%, #0a4fc4 100%); overflow: hidden; transition: opacity .55s ease, visibility .55s; }
#splash.out { opacity: 0; visibility: hidden; }
.sp-lw { position: relative; width: 132px; height: 132px; display: flex; align-items: center; justify-content: center; }
.sp-glow { position: absolute; width: 300px; height: 300px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.55) 0%, rgba(255,255,255,0) 68%); animation: spGlow 2s ease-in-out infinite; }
.sp-logo { position: relative; width: 132px; height: 132px; border-radius: 50%; background: #fff; padding: 0; object-fit: cover; box-sizing: border-box; box-shadow: 0 18px 40px rgba(0,0,0,.28); animation: spSpin 1.15s cubic-bezier(.16,.84,.24,1) both; }
.sp-t { font-size: calc(30px * var(--fs, 1)); font-weight: 700; margin: 26px 0 4px; }
.sp-t span { display: inline-block; opacity: 0; transform: translateY(18px); animation: spUp .6s ease forwards; }
.sp-t span:nth-child(1) { animation-delay: .65s; }
.sp-t span:nth-child(2) { animation-delay: .85s; }
.sp-t span:nth-child(3) { animation-delay: 1.05s; }
.sp-s { font-size: calc(23px * var(--fs, 1)); font-weight: 400; margin: 0; opacity: 0; transform: translateY(18px); animation: spUp .6s ease 1.3s forwards; }
.sp-bar { width: 54px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.55); margin-top: 30px; opacity: 0; animation: spUp .5s ease 1.6s forwards; }
@keyframes spSpin { from { opacity: 0; transform: rotate(-270deg) scale(.45); } to { opacity: 1; transform: rotate(0) scale(1); } }
@keyframes spUp { to { opacity: 1; transform: none; } }
@keyframes spGlow { 0%, 100% { transform: scale(.85); opacity: .55; } 50% { transform: scale(1.12); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #splash *, #splash { animation: none !important; } .sp-t span, .sp-s, .sp-bar { opacity: 1 !important; transform: none !important; } }

/* ── التوجيه الطلابي ── */
button.row { width: 100%; text-align: start; border: 0; font: inherit; color: inherit; cursor: pointer; }
button.row:active { transform: scale(.99); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag.ok { background: #dff5e8; color: #157347; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag.ok { background: #12301f; color: #6ee7a0; } }
:root[data-theme="dark"] .tag.ok { background: #12301f; color: #6ee7a0; }
.imp-sum { background: var(--bg); border-radius: 14px; padding: 6px 12px; margin: 12px 0; }
.imp-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: calc(14.5px * var(--fs, 1)); }
.imp-row:last-child { border-bottom: 0; }
.imp-row.good b { color: var(--ok); }
.imp-row.warn b { color: var(--warn); }
.panel textarea.input { min-height: 90px; }
.row .nm { overflow-wrap: anywhere; }
/* الصفحة الرئيسية */
.phero { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 18px 14px 14px; margin: 4px 0 14px; box-shadow: var(--shadow-sm); }
.phero .pt { font-size: calc(24px * var(--fs, 1)); font-weight: 700; color: var(--brand); }
.phero .ps { font-size: calc(17px * var(--fs, 1)); margin-top: 8px; }
.phero .pg { color: var(--muted); font-size: calc(14.5px * var(--fs, 1)); margin-top: 6px; }
.ptitle2 { font-size: calc(18px * var(--fs, 1)); margin: 4px 4px 12px; }
.grid .cat { border: 1.5px solid var(--line); box-shadow: none; }
.grid .cat .ico { font-size: calc(24px * var(--fs, 1)); }
.grid .cat .c { font-size: calc(13px * var(--fs, 1)); line-height: 1.5; }

/* المحادثة: شريط القفل والميكروفون */
.lockbar { margin: 8px 10px; padding: 12px 14px; border-radius: 14px; background: #fff4e5; color: #8a5300; text-align: center; font-weight: 700; line-height: 1.8; white-space: pre-line; }
:root[data-ui="night"] .lockbar { background: #2a2140; color: #f1d9a8; }
.composer .send.mic { background: var(--brand-soft); color: var(--brand); }
.composer .send.mic svg { transform: none; }
.composer .send[hidden], .composer .send.mic[hidden] { display: none; }
.composer-wrap [hidden] { display: none !important; }

/* بطاقات الأقسام: عمودان أو ثلاثة، وتعديل يدوي */
.grid.cols2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols3 { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid.cols3 .cat { padding: 12px 4px; }
.grid.cols3 .cat .ico { width: 44px; height: 44px; font-size: calc(24px * var(--fs, 1)); }
.grid.cols3 .cat .t { font-size: calc(12.5px * var(--fs, 1)); }
.cat.dim { opacity: .55; }
.cat.editing { position: relative; padding-bottom: 46px; }
.cat-tools { position: absolute; inset-inline: 6px; bottom: 6px; display: flex; gap: 6px; justify-content: center; }
.cat-tools button { flex: 1; height: 32px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.icon-btn.on { background: var(--brand); color: var(--on-brand); }
.emo-pal { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin-top: 8px; }
.emo-pal button { font-size: calc(22px * var(--fs, 1)); padding: 4px 0; border-radius: 10px; background: var(--bg); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; }
.swatches button.on { border-color: var(--text); }
.check-row { display: flex; gap: 10px; align-items: center; margin: 8px 2px 14px; }
.phero-logo { display: block; width: 64px; height: 64px; object-fit: contain; margin: 0 auto 8px; background: #fff; border-radius: 50%; padding: 4px; }

/* الإرسال بالتصنيف */
.send-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 2px 0 12px; }
.send-head small { flex-basis: 100%; color: var(--muted); }
.sel-card { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 16px; padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm); cursor: pointer; }
.sel-card b { flex: 1; font-size: calc(16px * var(--fs, 1)); }
.sel-card b small { display: block; color: var(--muted); font-weight: 400; font-size: calc(12.5px * var(--fs, 1)); }
.sel-card .chev { color: var(--muted); font-size: calc(22px * var(--fs, 1)); }
.sel-card.stu b { font-size: calc(15px * var(--fs, 1)); }
.sel-card.all { background: var(--brand-soft); }
.chk { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); background: var(--card); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; font-weight: 700; }
.chk.on { background: var(--brand); border-color: var(--brand); }
.chk.part { background: var(--brand); border-color: var(--brand); opacity: .6; }
.send-bar { padding: 10px 14px calc(10px + var(--sab)); background: var(--card); border-top: 1px solid var(--line); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
