/* Fonts are served from the site itself (no Google request): Readex Pro (variable 300–700) and Amiri 400/700,
   Arabic + Latin subsets. */
@font-face { font-family: 'Amiri'; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/fonts/amiri-400-arabic.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1; }
@font-face { font-family: 'Amiri'; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/fonts/amiri-400-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Amiri'; font-style: normal; font-weight: 700; font-display: swap; src: url(/assets/fonts/amiri-700-arabic.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1; }
@font-face { font-family: 'Amiri'; font-style: normal; font-weight: 700; font-display: swap; src: url(/assets/fonts/amiri-700-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Readex Pro'; font-style: normal; font-weight: 300 700; font-display: swap; src: url(/assets/fonts/readex-pro-arabic.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1; }
@font-face { font-family: 'Readex Pro'; font-style: normal; font-weight: 300 700; font-display: swap; src: url(/assets/fonts/readex-pro-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* =====================================================================
   Taatir design system — app.css
   Source of truth: design/mockups/*.html (bento style). RTL, Arabic only.
   Sections:
     1. Tokens            8. Tabs / segmented / chips / tags / badges
     2. Base & a11y       9. Forms (field, ctl, check, switch, radio-card)
     3. Layout            10. Tiles & bento, panels, cards, stats
     4. Header            11. Avatars, post cards, user rows, comments
     5. Footer            12. Document thumbnails ("paper", .doc, .a4)
     6. Bottom nav        13. Table, dropdown, modal/sheet, toast
     7. Buttons           14. Skeleton, empty/error states, misc
                          15. Tool page (shared by all 28 tools)
                          16. Responsive, reduced motion
   ===================================================================== */

/* 1. TOKENS ------------------------------------------------------------ */
:root {
  --feed-gap: 4px; /* between post cards (home, explore, profile, saved) */
  /* surfaces */
  --canvas: #F4F3EE;
  --canvas-2: #EFEDE6;       /* footer, progress tracks */
  --tile: #FFFFFF;
  --field: var(--field);          /* input background */
  --line: #E6E3DA;
  --line-2: #CFCABD;         /* hover borders, dashed outlines */
  /* text */
  --ink: #16171B;
  --muted: #585B63;          /* 7:1 on white — secondary text */
  --soft: #8A8C93;           /* icons/placeholders only (3.4:1) — never small body text */
  /* dark buttons / selected pills (light text on them); light in dark mode */
  --solid: #16171B; --solid-hover: #000; --on-solid: #FFFFFF;
  /* brand palette (fill colours) + tints (-2) + darker text inks (-ink, ≥4.5:1 on their tint) */
  --green: #0E6B55;  --green-2: #E3F1EC;  --green-ink: #0B5A47;
  --mint: #62D6B2;   --mint-ink: #062A20;
  --amber: #C47A12;  --amber-2: #FBEFD9;  --amber-ink: #8A5208;
  --rose: #B8462F;   --rose-2: #F8E4DE;   --rose-ink: #8A3A28;
  --navy: #13203A;   --navy-2: #22355C;   --navy-3: #0E1829;
  --sky: #2F6EA6;    --sky-2: #E2EDF7;    --sky-ink: #245A89;
  --plum: #6B4BA8;   --plum-2: #EEE8F8;   --plum-ink: #553A8A;
  --slate: #3C4250;  --slate-2: #E8EAEE;
  --gold: #F2B84B;
  --on-dark: #FFFFFF; --on-dark-muted: #B9C3D6; --on-dark-soft: #9FAAC0;
  /* gradients (tile variants) */
  --grad-dark: radial-gradient(120% 90% at 85% 0%, #22355C 0%, #13203A 55%, #0E1829 100%);
  --grad-amber: linear-gradient(180deg, #FBEFD9 0%, #FFF8EC 100%);
  --grad-sky: linear-gradient(170deg, #E2EDF7, #F3F8FC);
  --grad-plum: linear-gradient(160deg, #EEE8F8, #F7F4FC);
  --grad-green: linear-gradient(170deg, #E3F1EC, #F2F8F5);
  --grad-rose: linear-gradient(170deg, #F8E4DE, #FCF3F0);
  --grad-text: linear-gradient(90deg, #0E6B55, #2F6EA6 60%, #6B4BA8);
  --grad-ring: linear-gradient(135deg, #9BE8CF, #2FB389);
  /* shape & depth */
  --r: 24px; --r-lg: 32px; --r-md: 20px; --r-sm: 14px; --r-xs: 10px; --pill: 999px;
  --shadow-lift: 0 24px 44px -24px rgba(20, 30, 50, .35);
  --shadow-soft: 0 10px 22px -16px rgba(0, 0, 0, .35);
  --shadow-pop: 0 24px 48px -16px rgba(20, 30, 50, .35), 0 2px 6px rgba(0, 0, 0, .05);
  --shadow-dialog: 0 40px 80px -30px rgba(0, 0, 0, .55);
  --focus: 0 0 0 3px rgba(47, 110, 166, .35);
  /* type & layout */
  --font: "Readex Pro", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --font-serif: "Amiri", "Times New Roman", serif;
  --wrap: 1240px; --gutter: 32px;
  --header-h: 68px; --bnav-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

/* 1b. DARK MODE -----------------------------------------------------------
 * <html data-theme="dark"> (or "auto" with a dark system setting): set by the Worker from the `taatir_theme` cookie
 * (settings «المظهر»). Only the tokens change; documents (A4 sheets) stay white paper. */
:root[data-theme="dark"] {
  --canvas: #111214; --canvas-2: #17181B; --tile: #1B1D21; --field: #22252A; --line: #2D3036; --line-2: #3D4048;
  --ink: #ECEDEF; --muted: #A9ADB5; --soft: #80848D;
  --solid: #ECEDEF; --solid-hover: #FFFFFF; --on-solid: #121316;
  --green-2: #12302A; --green-ink: #7FD6B9; --amber-2: #33270F; --amber-ink: #F0C27A; --rose-2: #3A1F19; --rose-ink: #F2A391;
  --sky-2: #15263A; --sky-ink: #93C1EC; --plum-2: #262035; --plum-ink: #C6B2F0; --slate-2: #262A31;
  --grad-amber: linear-gradient(180deg, #2E2410 0%, #221C10 100%); --grad-sky: linear-gradient(170deg, #15263A, #121C29);
  --grad-plum: linear-gradient(160deg, #262035, #1C1828); --grad-green: linear-gradient(170deg, #12302A, #10221D);
  --grad-rose: linear-gradient(170deg, #3A1F19, #261613);
  --shadow-soft: 0 10px 22px -16px rgba(0, 0, 0, .8); --shadow-pop: 0 24px 48px -16px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --canvas: #111214; --canvas-2: #17181B; --tile: #1B1D21; --field: #22252A; --line: #2D3036; --line-2: #3D4048;
    --ink: #ECEDEF; --muted: #A9ADB5; --soft: #80848D;
    --solid: #ECEDEF; --solid-hover: #FFFFFF; --on-solid: #121316;
    --green-2: #12302A; --green-ink: #7FD6B9; --amber-2: #33270F; --amber-ink: #F0C27A; --rose-2: #3A1F19; --rose-ink: #F2A391;
    --sky-2: #15263A; --sky-ink: #93C1EC; --plum-2: #262035; --plum-ink: #C6B2F0; --slate-2: #262A31;
    --grad-amber: linear-gradient(180deg, #2E2410 0%, #221C10 100%); --grad-sky: linear-gradient(170deg, #15263A, #121C29);
    --grad-plum: linear-gradient(160deg, #262035, #1C1828); --grad-green: linear-gradient(170deg, #12302A, #10221D);
    --grad-rose: linear-gradient(170deg, #3A1F19, #261613);
    --shadow-soft: 0 10px 22px -16px rgba(0, 0, 0, .8); --shadow-pop: 0 24px 48px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
/* things drawn with fixed light colours */
:root[data-theme="dark"] .av-ph, :root[data-theme="dark"] .sg-ph.av-ph, :root[data-theme="dark"] .pf-bigav.av-ph { background: #2A2D33; color: #6E727B; }
:root[data-theme="dark"] .av-ph svg .h, :root[data-theme="dark"] .pf-bigav.av-ph svg .h { fill: #555A63; }
:root[data-theme="dark"] img.logo { filter: invert(1) hue-rotate(180deg); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .av-ph, :root[data-theme="auto"] .sg-ph.av-ph, :root[data-theme="auto"] .pf-bigav.av-ph { background: #2A2D33; color: #6E727B; }
  :root[data-theme="auto"] .av-ph svg .h { fill: #555A63; }
  :root[data-theme="auto"] img.logo { filter: invert(1) hue-rotate(180deg); }
}

/* documents (A4 sheets, previews) stay white paper; header, bottom bar and grey labels follow the theme */
:root[data-theme="dark"] :is(.a4, .doc, .pp-sheet, .print-sheet) { --canvas: #F4F3EE; --canvas-2: #EFEDE6; --tile: #FFFFFF; --field: #FBFAF7; --line: #E6E3DA; --line-2: #CFCABD; --ink: #16171B; --muted: #585B63; --soft: #8A8C93; --solid: #16171B; --on-solid: #FFFFFF; --green-2: #E3F1EC; --green-ink: #0B5A47; --amber-2: #FBEFD9; --amber-ink: #8A5208; --rose-2: #F8E4DE; --rose-ink: #8A3A28; --sky-2: #E2EDF7; --sky-ink: #245A89; --plum-2: #EEE8F8; --plum-ink: #553A8A; --slate-2: #E8EAEE; color-scheme: light; }
:root[data-theme="dark"] .nav { background: rgba(17, 18, 20, .82); }
:root[data-theme="dark"] .bnav { background: rgba(27, 29, 33, .94); border-color: var(--line); }
:root[data-theme="dark"] .tag.n { background: #2A2D33; }
:root[data-theme="dark"] .chip { background: rgba(255, 255, 255, .06); }
:root[data-theme="dark"] .chip:hover { background: rgba(255, 255, 255, .1); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] :is(.a4, .doc, .pp-sheet, .print-sheet) { --canvas: #F4F3EE; --canvas-2: #EFEDE6; --tile: #FFFFFF; --field: #FBFAF7; --line: #E6E3DA; --line-2: #CFCABD; --ink: #16171B; --muted: #585B63; --soft: #8A8C93; --solid: #16171B; --on-solid: #FFFFFF; --green-2: #E3F1EC; --green-ink: #0B5A47; --amber-2: #FBEFD9; --amber-ink: #8A5208; --rose-2: #F8E4DE; --rose-ink: #8A3A28; --sky-2: #E2EDF7; --sky-ink: #245A89; --plum-2: #EEE8F8; --plum-ink: #553A8A; --slate-2: #E8EAEE; color-scheme: light; }
  :root[data-theme="auto"] .nav { background: rgba(17, 18, 20, .82); }
  :root[data-theme="auto"] .bnav { background: rgba(27, 29, 33, .94); border-color: var(--line); }
  :root[data-theme="auto"] .tag.n { background: #2A2D33; }
  :root[data-theme="auto"] .chip { background: rgba(255, 255, 255, .06); }
}

/* dark mode: places drawn with fixed light colours (pages and cards) */
:root[data-theme="dark"] .status.muted, :root[data-theme="dark"] .tag.n { background: #2A2D33; }
:root[data-theme="dark"] .field.has-error .ctl, :root[data-theme="dark"] .ctl[aria-invalid="true"], :root[data-theme="dark"] .otp-row.bad input { background: #2A1B18; }
:root[data-theme="dark"] .radio-card:has(input:checked), :root[data-theme="dark"] .radio-card.on, :root[data-theme="dark"] .drop:hover, :root[data-theme="dark"] .drop.over, :root[data-theme="dark"] .photo.over { background: #12302A; }
:root[data-theme="dark"] .tile-glass, :root[data-theme="dark"] .note-box, :root[data-theme="dark"] .steps-strip li { background: rgba(255, 255, 255, .04); border-color: var(--line); }
:root[data-theme="dark"] .tb-neutral, :root[data-theme="dark"] .doc-mini .th, :root[data-theme="dark"] .n-thumb, :root[data-theme="dark"] .fth { background: #24272C; }
:root[data-theme="dark"] .cm .bub, :root[data-theme="dark"] .thread .tm p, :root[data-theme="dark"] .dr, :root[data-theme="dark"] .pv .nums div, :root[data-theme="dark"] .vislist li { background: #24272C; }
:root[data-theme="dark"] .canvas-a4, :root[data-theme="dark"] .pub-thumb { background-color: #1E2024; background-image: radial-gradient(#2E3138 1px, transparent 1px); }
:root[data-theme="dark"] .skel { background: #24272C; }
:root[data-theme="dark"] .pthumb::after { background: linear-gradient(to top, rgba(27, 29, 33, .95), transparent); }
:root[data-theme="dark"] .ct-plan, :root[data-theme="dark"] .fl-stats .st-draft { background: var(--grad-amber); border-color: #4A3A1A; }
:root[data-theme="dark"] .ct-exam { background: var(--grad-sky); border-color: #23405E; }
:root[data-theme="dark"] .ct-rep { background: var(--grad-plum); border-color: #3A3150; }
:root[data-theme="dark"] .ct-cover { background: var(--grad-green); border-color: #1E4A3D; }
:root[data-theme="dark"] .panel.danger { background: linear-gradient(180deg, var(--tile), #2A1B18); border-color: #4A2A22; }
:root[data-theme="dark"] .pp-gcta { border-color: #4A3A1A; }
:root[data-theme="dark"] .nt.un { background: #15241F; }
:root[data-theme="dark"] .nt.un:hover { background: #1A2C26; }
:root[data-theme="dark"] .ava.ava-stack > .av.more { background: #2A2D33; }
:root[data-theme="dark"] .fth .loc, :root[data-theme="dark"] .fl-bigic, :root[data-theme="dark"] .dc .svb, :root[data-theme="dark"] .acard .cv .ph { background: rgba(27, 29, 33, .9); }
:root[data-theme="dark"] .pp-dtools button { border-color: var(--line); background: var(--tile); color: var(--ink); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .status.muted, :root[data-theme="auto"] .tag.n { background: #2A2D33; }
  :root[data-theme="auto"] .field.has-error .ctl, :root[data-theme="auto"] .ctl[aria-invalid="true"], :root[data-theme="auto"] .otp-row.bad input { background: #2A1B18; }
  :root[data-theme="auto"] .radio-card:has(input:checked), :root[data-theme="auto"] .radio-card.on, :root[data-theme="auto"] .drop:hover, :root[data-theme="auto"] .drop.over, :root[data-theme="auto"] .photo.over { background: #12302A; }
  :root[data-theme="auto"] .tile-glass, :root[data-theme="auto"] .note-box, :root[data-theme="auto"] .steps-strip li { background: rgba(255, 255, 255, .04); border-color: var(--line); }
  :root[data-theme="auto"] .tb-neutral, :root[data-theme="auto"] .doc-mini .th, :root[data-theme="auto"] .n-thumb, :root[data-theme="auto"] .fth { background: #24272C; }
  :root[data-theme="auto"] .cm .bub, :root[data-theme="auto"] .thread .tm p, :root[data-theme="auto"] .dr, :root[data-theme="auto"] .pv .nums div, :root[data-theme="auto"] .vislist li { background: #24272C; }
  :root[data-theme="auto"] .canvas-a4, :root[data-theme="auto"] .pub-thumb { background-color: #1E2024; background-image: radial-gradient(#2E3138 1px, transparent 1px); }
  :root[data-theme="auto"] .skel { background: #24272C; }
  :root[data-theme="auto"] .pthumb::after { background: linear-gradient(to top, rgba(27, 29, 33, .95), transparent); }
  :root[data-theme="auto"] .ct-plan, :root[data-theme="auto"] .fl-stats .st-draft { background: var(--grad-amber); border-color: #4A3A1A; }
  :root[data-theme="auto"] .ct-exam { background: var(--grad-sky); border-color: #23405E; }
  :root[data-theme="auto"] .ct-rep { background: var(--grad-plum); border-color: #3A3150; }
  :root[data-theme="auto"] .ct-cover { background: var(--grad-green); border-color: #1E4A3D; }
  :root[data-theme="auto"] .panel.danger { background: linear-gradient(180deg, var(--tile), #2A1B18); border-color: #4A2A22; }
  :root[data-theme="auto"] .pp-gcta { border-color: #4A3A1A; }
  :root[data-theme="auto"] .nt.un { background: #15241F; }
  :root[data-theme="auto"] .nt.un:hover { background: #1A2C26; }
  :root[data-theme="auto"] .ava.ava-stack > .av.more { background: #2A2D33; }
  :root[data-theme="auto"] .fth .loc, :root[data-theme="auto"] .fl-bigic, :root[data-theme="auto"] .dc .svb, :root[data-theme="auto"] .acard .cv .ph { background: rgba(27, 29, 33, .9); }
  :root[data-theme="auto"] .pp-dtools button { border-color: var(--line); background: var(--tile); color: var(--ink); }
}

/* dark mode: switches (off), the classroom screen stage */
:root[data-theme="dark"] .sw:not(:checked) { background: #3A3D44; }
:root[data-theme="dark"] .cs-stage { background: #1E2024; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .sw:not(:checked) { background: #3A3D44; }
  :root[data-theme="auto"] .cs-stage { background: #1E2024; }
}

/* 2. BASE & A11Y -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body { font-family: var(--font); background: var(--canvas); color: var(--ink); line-height: 1.6; overflow-x: hidden; min-height: 100vh; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }
body > main { flex: 1 0 auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
ul[class], ol[class] { list-style: none; }
h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.3; }
b, strong { font-weight: 600; }
table { border-collapse: collapse; }
hr { border: 0; border-top: 1px solid var(--line); }
[hidden] { display: none !important; }
[data-pending] { visibility: hidden; } /* text the page script fills in (keeps its space, never shows a placeholder) */
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.filled { fill: currentColor; }
.ltr, .num { direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; border-radius: 12px; }
:focus:not(:focus-visible) { outline: none; }
::selection { background: rgba(98, 214, 178, .35); }
.sr, .sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
.skip-link { position: fixed; top: 8px; inset-inline-start: 8px; z-index: 100; background: var(--solid); color: var(--on-solid); padding: 10px 16px; border-radius: 12px; transform: translateY(-160%); transition: transform .2s; }
.skip-link:focus { transform: none; }
.grad-text { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.muted { color: var(--muted); } .soft { color: var(--soft); }
.t-green { color: var(--green); } .t-rose { color: var(--rose-ink); } .t-amber { color: var(--amber-ink); }
.nowrap { white-space: nowrap; }
.clamp-1, .clamp-2, .clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-1 { -webkit-line-clamp: 1; } .clamp-2 { -webkit-line-clamp: 2; } .clamp-3 { -webkit-line-clamp: 3; }

/* 3. LAYOUT ------------------------------------------------------------- */
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); width: 100%; }
.wrap-sm { max-width: 760px; } .wrap-md { max-width: 980px; }
.page { padding-bottom: 24px; }
.stack { display: flex; flex-direction: column; gap: var(--gap, 12px); }
.row { display: flex; align-items: center; gap: var(--gap, 10px); flex-wrap: wrap; }
.spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.layout-side > aside, .sticky-side { position: sticky; top: calc(var(--header-h) + 20px); display: flex; flex-direction: column; gap: 18px; }
/* breadcrumbs */
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); padding: 28px 0 0; flex-wrap: wrap; }
.crumbs a { min-height: 32px; display: inline-flex; align-items: center; }
.crumbs a:hover { color: var(--ink); }
.crumbs svg { width: 14px; height: 14px; }
.crumbs [aria-current] { color: var(--ink); font-weight: 500; }
/* page head (h1 + lede + actions) */
.phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 22px 0 28px; }
.phead h1 { font-size: 44px; font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
.phead p, .phead .lede { color: var(--muted); font-size: 16.5px; font-weight: 300; margin-top: 4px; }
.phead .acts { display: flex; gap: 10px; flex-wrap: wrap; }
/* section head */
section.block { padding: 96px 0 0; }
section.blk { padding: 48px 0 0; }
.sh { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.sh h2 { font-size: 40px; font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
.sh p { color: var(--muted); font-size: 17px; margin-top: 6px; font-weight: 300; }
.sh.sm { align-items: center; margin-bottom: 16px; }
.sh.sm h2 { font-size: 24px; letter-spacing: 0; line-height: 1.3; }
.sh.sm p { font-size: 14.5px; margin-top: 2px; }
.more { display: inline-flex; gap: 6px; align-items: center; color: var(--green); font-weight: 500; min-height: 44px; }
.more svg { width: 18px; height: 18px; }
.more:hover { text-decoration: underline; text-underline-offset: 4px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--green); background: var(--green-2); padding: 6px 14px; border-radius: var(--pill); font-weight: 500; }
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.lnk { color: var(--green); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* 4. HEADER ------------------------------------------------------------- */
.nav { position: sticky; top: 0; z-index: 40; background: rgba(244, 243, 238, .82); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid rgba(0, 0, 0, .05); }
.nav .wrap { display: flex; align-items: center; gap: 28px; height: var(--header-h); }
.nav.signed .wrap { gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; direction: ltr; color: var(--ink); flex: none; min-height: 44px; border-radius: 10px; }
/* Wordmark «Taatir» (Comfortaa 700 outlines, green i-dot): ~34px type in the header, ~28px on phones. */
.brand .logo { display: block; height: 29px; width: auto; }
.brand.sm .logo { height: 22px; }
.brand .role { direction: rtl; font-size: 12px; font-weight: 500; letter-spacing: 0; color: var(--plum-ink); background: var(--plum-2); padding: 2px 10px; border-radius: var(--pill); margin-inline-start: 6px; }
.links { display: flex; gap: 4px; margin-inline-start: 12px; }
.nav.signed .links { margin-inline-start: 8px; }
.links a { padding: 10px 14px; border-radius: 12px; font-size: 15px; color: var(--muted); min-height: 44px; display: flex; align-items: center; }
.links a:hover { color: var(--ink); background: rgba(0, 0, 0, .04); }
.links a.on, .links a[aria-current="page"] { color: var(--ink); font-weight: 500; }
.nav-cta { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; }
.nav.signed .nav-cta { margin-inline-start: 0; }
.nsearch { position: relative; margin-inline-start: auto; display: flex; align-items: center; gap: 8px; background: var(--tile); border: 1px solid var(--line); border-radius: var(--pill); padding: 0 14px; min-height: 44px; width: 300px; color: var(--soft); }
.nsearch input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14.5px; color: var(--ink); min-height: 42px; }
.nsearch input::placeholder { color: #7A7D84; }
.nsearch input::-webkit-search-cancel-button { display: none; }
.nsearch:focus-within { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(47, 110, 166, .2); }
kbd { font: 500 12px var(--font); color: var(--soft); border: 1px solid var(--line); border-radius: 7px; padding: 1px 7px; }
.icon-btn { position: relative; width: 44px; height: 44px; border-radius: var(--pill); border: 0; background: transparent; color: var(--ink); display: inline-grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn:hover { background: rgba(0, 0, 0, .05); }
.icon-btn.line { border: 1px solid var(--line); background: var(--tile); }
.icon-btn .dot { position: absolute; top: 10px; inset-inline-end: 11px; width: 9px; height: 9px; border-radius: 50%; background: var(--rose); box-shadow: 0 0 0 2px var(--canvas); }
.icon-btn .count { position: absolute; top: 4px; inset-inline-end: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--pill); background: var(--rose); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--canvas); direction: ltr; }
.icon-btn.s-only { display: none; }
.me { width: 40px; height: 40px; border-radius: 50%; padding: 0; border: 0; background: transparent; box-shadow: 0 0 0 2px var(--canvas), 0 0 0 3.5px var(--mint); margin-inline-start: 4px; display: grid; place-items: center; cursor: pointer; flex: none; }
.me .av { width: 100%; height: 100%; font-size: 15px; }
.nav-burger { display: none; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--tile); place-items: center; cursor: pointer; flex: none; }
/* typeahead under a search box */
.typeahead { position: absolute; top: calc(100% + 8px); inset-inline: 0; min-width: 300px; background: var(--tile); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-pop); padding: 8px; z-index: 50; text-align: start; max-height: min(70vh, 460px); overflow: auto; color: var(--ink); }
.typeahead h6 { font-size: 12px; font-weight: 500; color: var(--muted); padding: 6px 10px 4px; }
.typeahead a { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; min-height: 48px; }
.typeahead a:hover, .typeahead a.hl { background: var(--canvas); }
.typeahead a .ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.typeahead a .ic svg { width: 18px; height: 18px; }
.typeahead a b { display: block; font-size: 14.5px; font-weight: 500; line-height: 1.35; }
.typeahead a small { display: block; font-size: 12.5px; color: var(--muted); }
.typeahead .none { padding: 12px; font-size: 14px; color: var(--muted); }
.typeahead hr { margin: 6px 4px; }

/* 5. FOOTER ------------------------------------------------------------- */
.site-footer { margin-top: 96px; border-top: 1px solid var(--line); padding: 56px 0 32px; background: var(--canvas-2); }
.fgrid { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 32px; }
.fgrid h5, .fgrid h2 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.fgrid a { display: block; color: var(--muted); font-size: 14px; padding: 5px 0; }
.fgrid a:hover { color: var(--ink); }
.fgrid a.brand { display: flex; color: var(--ink); padding: 0; width: max-content; }
.fgrid p { color: var(--muted); font-size: 14px; max-width: 320px; margin-top: 12px; }
.fgrid .install { margin-top: 16px; }
.fbot { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.site-footer.compact { padding: 26px 0; }
.site-footer.compact .fbot { margin: 0 auto; padding: 0 var(--gutter); border: 0; }
.fbot nav { display: flex; gap: 4px 20px; flex-wrap: wrap; }
.fbot nav a { min-height: 36px; display: inline-flex; align-items: center; }
.fbot nav a:hover { color: var(--ink); }
.fbot .brand { color: var(--ink); }

/* 6. MOBILE BOTTOM NAV (< 768px) ------------------------------------------ */
.bnav { display: none; }
@media (max-width: 767.98px) {
  /* the bottom nav has its own «إنشاء» button, so the header one is redundant */
  body.has-bnav .nav.signed .nav-cta .btn-create { display: none; }
  .bnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; inset-inline: 0; z-index: 45; background: rgba(255, 255, 255, .94); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); min-height: var(--bnav-h); }
  .bnav a, .bnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; border: 0; background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 500; border-radius: 14px; position: relative; }
  .bnav svg.i { width: 22px; height: 22px; }
  .bnav a > svg.i { margin: 6px 0; }
  .bnav [aria-current="page"] { color: var(--ink); }
  .bnav [aria-current="page"] svg.i { stroke-width: 2.2; }
  .bnav [aria-current="page"]::before { content: ""; position: absolute; top: -5px; width: 22px; height: 3px; border-radius: 3px; background: var(--green); }
  .bnav .create span.plus { width: 46px; height: 34px; border-radius: 14px; background: var(--solid); color: var(--on-solid); display: grid; place-items: center; }
  .bnav .create svg.i { width: 20px; height: 20px; }
  .bnav .count { position: absolute; top: 4px; inset-inline-start: calc(50% + 4px); min-width: 16px; height: 16px; border-radius: 9px; background: var(--rose); color: #fff; font-size: 10px; line-height: 16px; padding: 0 4px; direction: ltr; }
  body.has-bnav { padding-bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom)); }
  body.has-bnav .toast-stack { bottom: calc(var(--bnav-h) + 16px + env(safe-area-inset-bottom)); }
}

/* 7. BUTTONS ------------------------------------------------------------ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: var(--pill); font: 500 15px var(--font); border: 0; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; background: transparent; color: var(--ink); }
.btn svg.i { width: 18px; height: 18px; }
.btn-dark { background: var(--solid); color: var(--on-solid); } .btn-dark:hover { background: var(--solid-hover); }
.btn-ghost { color: var(--ink); background: transparent; } .btn-ghost:hover { background: rgba(0, 0, 0, .05); }
.btn-line { background: var(--tile); color: var(--ink); border: 1px solid var(--line); } .btn-line:hover { border-color: #bdb8ab; }
.btn-green { background: var(--green); color: #fff; } .btn-green:hover { background: var(--green-ink); }
.btn-mint { background: var(--mint); color: var(--mint-ink); } .btn-mint:hover { background: #7FE3C4; }
.btn-soft { background: var(--green-2); color: var(--green); } .btn-soft:hover { background: #D3EAE2; }
.btn-danger { background: var(--rose); color: #fff; } .btn-danger:hover { background: var(--rose-ink); }
.btn-danger-soft { background: transparent; color: var(--rose-ink); } .btn-danger-soft:hover { background: var(--rose-2); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn-lg, .btn.big { min-height: 52px; border-radius: 16px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn[disabled], .btn[aria-disabled="true"] { background: #D9E2DE; color: #4F5B57; cursor: not-allowed; border-color: transparent; }
.btn-line[disabled] { background: var(--canvas-2); color: #6E7178; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-color: rgba(255, 255, 255, .9) rgba(255, 255, 255, .9) transparent transparent; animation: spin .7s linear infinite; }
.btn-line.loading::after, .btn-ghost.loading::after, .btn-soft.loading::after { border-color: var(--ink) var(--ink) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
/* "add" pill used in tool editors (mockup .add) */
.add { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--pill); border: 0; background: var(--green-2); color: var(--green); font: 500 14.5px var(--font); cursor: pointer; white-space: nowrap; }
.add:hover { background: #D3EAE2; }
.add.ghost { background: var(--tile); border: 1px solid var(--line); color: var(--ink); }
.add.ghost:hover { border-color: #bdb8ab; }
/* follow button */
.fol { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: var(--pill); border: 0; background: var(--green-2); color: var(--green); font: 500 13.5px var(--font); cursor: pointer; white-space: nowrap; }
.fol:hover { background: #D3EAE2; }
.fol svg.i { width: 16px; height: 16px; }
.fol.done { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.fol.dark { background: var(--solid); color: var(--on-solid); } .fol.dark:hover { background: var(--solid-hover); }
/* row-delete "x" */
.x { width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: var(--soft); display: grid; place-items: center; cursor: pointer; flex: none; }
.x svg.i { width: 18px; height: 18px; }
.x:hover { background: var(--rose-2); color: var(--rose); }

/* 8. TABS / SEGMENTED / CHIPS / TAGS / BADGES ----------------------------- */
.tabs { display: flex; gap: 6px; background: var(--tile); border: 1px solid var(--line); padding: 6px; border-radius: var(--pill); width: fit-content; max-width: 100%; }
.tabs a, .tabs button { min-height: 44px; padding: 0 18px; border-radius: var(--pill); display: inline-flex; align-items: center; gap: 8px; font: 400 14.5px var(--font); color: var(--muted); cursor: pointer; white-space: nowrap; border: 0; background: transparent; }
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs .on, .tabs [aria-selected="true"], .tabs [aria-current="page"] { background: var(--solid); color: var(--on-solid); }
.tabs .on:hover, .tabs [aria-selected="true"]:hover { color: #fff; }
.tabs small { font-size: 12px; color: var(--muted); background: rgba(0, 0, 0, .05); padding: 1px 8px; border-radius: var(--pill); direction: ltr; }
.tabs .on small, .tabs [aria-selected="true"] small, .tabs [aria-current="page"] small { background: rgba(255, 255, 255, .18); color: #fff; }
.tabs .count-dot { width: 8px; height: 8px; border-radius: 50%; }
.seg { display: inline-flex; background: var(--canvas); border-radius: var(--pill); padding: 4px; }
.seg button { font: 500 14px var(--font); border: 0; background: transparent; color: var(--muted); min-height: 40px; padding: 0 16px; border-radius: var(--pill); cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on, .seg button[aria-pressed="true"], .seg button[aria-checked="true"] { background: var(--tile); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg.on-white { background: var(--tile); border: 1px solid var(--line); }
.seg.on-white button.on, .seg.on-white button[aria-pressed="true"] { background: var(--solid); color: var(--on-solid); }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: var(--pill); background: rgba(0, 0, 0, .04); color: var(--muted); font-size: 14px; border: 1px solid transparent; cursor: pointer; white-space: nowrap; }
.chip:hover { background: rgba(0, 0, 0, .08); color: var(--ink); }
.chip.on, .chip[aria-pressed="true"] { background: var(--green-2); color: var(--green-ink); border-color: #BFDDD2; font-weight: 500; }
.chip.line { background: var(--tile); border-color: var(--line); color: var(--ink); }
.chip .x { width: 28px; height: 28px; margin-inline-end: -8px; border-radius: 50%; }
.chip small { font-size: 12px; font-weight: 500; direction: ltr; unicode-bidi: isolate; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; padding: 3px 11px; border-radius: var(--pill); white-space: nowrap; line-height: 1.5; }
.tag.n { background: #F1EFE8; color: var(--muted); font-weight: 400; }
.tag svg.i { width: 14px; height: 14px; }
/* category / doc-type colour pairs (icon chips + tags) */
.c1 { background: var(--green-2); color: var(--green); }
.c2 { background: var(--amber-2); color: var(--amber); }
.c3 { background: var(--sky-2); color: var(--sky); }
.c4 { background: var(--rose-2); color: var(--rose); }
.c5 { background: var(--plum-2); color: var(--plum); }
.c6 { background: var(--slate-2); color: var(--slate); }
.tag.c1 { color: var(--green-ink); } .tag.c2 { color: var(--amber-ink); } .tag.c3 { color: var(--sky-ink); }
.tag.c4 { color: var(--rose-ink); } .tag.c5 { color: var(--plum-ink); }
.ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.ic.sm { width: 34px; height: 34px; border-radius: 11px; } .ic.sm svg.i { width: 18px; height: 18px; }
.ic.lg { width: 64px; height: 64px; border-radius: 20px; } .ic.lg svg.i { width: 30px; height: 30px; }
.ic.dark { background: var(--navy); color: var(--mint); }
/* status badges (draft/saved/published …) */
.status, .sb { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; padding: 3px 10px; border-radius: var(--pill); white-space: nowrap; }
.status::before, .sb::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.draft, .sb.draft { background: var(--amber-2); color: var(--amber-ink); }
.status.saved, .sb.saved { background: var(--sky-2); color: var(--sky-ink); }
.status.pub, .sb.pub, .status.ok { background: var(--green-2); color: var(--green); }
.status.bad { background: var(--rose-2); color: var(--rose-ink); }
.status.local { background: var(--green-2); color: var(--green); }
.status.muted { background: #F1EFE8; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 500; padding: 1px 8px; border-radius: var(--pill); color: var(--green); background: var(--green-2); white-space: nowrap; }
.badge.new { color: var(--green); background: var(--green-2); }
.badge.dark { color: var(--mint); background: rgba(98, 214, 178, .14); font-size: 13px; padding: 5px 12px; }
.count-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--pill); background: var(--rose); color: #fff; font-size: 11.5px; font-weight: 600; direction: ltr; }
.star { display: inline-flex; align-items: center; gap: 4px; font: 600 12.5px var(--font); color: var(--amber-ink); background: var(--amber-2); border-radius: var(--pill); padding: 4px 10px; min-height: 30px; font-size: 12.5px; direction: ltr; }
.star svg.i { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.star.mine { background: var(--amber); color: #fff; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--green); background: var(--green-2); padding: 4px 10px; border-radius: var(--pill); direction: ltr; }
.delta.down { color: var(--rose-ink); background: var(--rose-2); }
.delta svg.i { width: 14px; height: 14px; }
.cat { font-size: 13px; font-weight: 500; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.cat i, .dot-i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* 9. FORMS -------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .field > .lbl, .field > legend { font-size: 14px; font-weight: 500; display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--ink); }
.field > label small, .field .lbl small { font-weight: 400; color: var(--muted); font-size: 13px; }
.field .req { color: var(--rose); }
.field .counter { font-size: 12px; color: var(--muted); font-weight: 400; direction: ltr; }
fieldset.field { border: 0; }
.help { font-size: 13px; color: var(--muted); }
.field-error { display: none; align-items: center; gap: 6px; font-size: 13px; color: var(--rose-ink); font-weight: 500; }
.field-error svg.i { width: 15px; height: 15px; }
.field.has-error .field-error, .field-error.show { display: flex; }
.ctl { width: 100%; min-height: 48px; border: 1px solid var(--line); background: var(--field); border-radius: var(--r-sm); padding: 0 14px; font: 400 15.5px var(--font); color: var(--ink); appearance: none; -webkit-appearance: none; transition: border-color .15s, background-color .15s; }
.ctl::placeholder { color: #7A7D84; }
.ctl:hover { border-color: var(--line-2); }
.ctl:focus { outline: 3px solid rgba(47, 110, 166, .35); outline-offset: 0; border-color: var(--sky); background: var(--tile); }
.ctl[disabled], .ctl[readonly] { background: var(--canvas-2); color: var(--muted); }
.ctl.lg { min-height: 52px; }
.ctl.num, .ctl.ltr { direction: ltr; text-align: center; font-weight: 500; }
textarea.ctl { padding: 12px 14px; min-height: 96px; resize: vertical; line-height: 1.65; display: block; }
select.ctl { cursor: pointer; padding-inline-end: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23585B63' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-size: 18px; background-position: left 14px center; }
.field.has-error .ctl, .ctl[aria-invalid="true"] { border-color: var(--rose); background: #FFF9F7; }
.field.has-error .ctl:focus, .ctl[aria-invalid="true"]:focus { outline-color: rgba(184, 70, 47, .3); }
.field.is-ok .ctl { border-color: #9FD3C1; }
/* input with leading icon / trailing button */
.inp { position: relative; display: flex; align-items: center; }
.inp > svg.i.lead { position: absolute; inset-inline-start: 14px; color: var(--soft); width: 19px; height: 19px; pointer-events: none; }
.inp > svg.i.lead ~ .ctl { padding-inline-start: 44px; }
.inp .ctl.ltr { text-align: right; }
.inp .ctl.ltr::placeholder { text-align: right; }
.inp .trail { position: absolute; inset-inline-end: 4px; width: 44px; height: 44px; border: 0; background: transparent; border-radius: 12px; display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.inp .trail:hover { background: rgba(0, 0, 0, .05); color: var(--ink); }
.inp .trail ~ .ctl, .inp .ctl:has(~ .trail) { padding-inline-end: 52px; }
/* LTR inputs (email, handle…) inside the RTL form: the lead icon sits on the right, the trail button on the left. */
.inp > svg.i.lead ~ .ctl.ltr { padding-left: 14px; padding-right: 44px; }
.inp > svg.i.lead ~ .ctl.ltr:has(~ .trail) { padding-left: 52px; }
.inp .unit { position: absolute; inset-inline-end: 14px; font-style: normal; font-size: 13.5px; color: var(--muted); pointer-events: none; }
/* checkbox */
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--muted); cursor: pointer; line-height: 1.55; min-height: 44px; padding-top: 2px; position: relative; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check .box { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid #BDB8AB; background: var(--tile); display: grid; place-items: center; flex: none; margin-top: 1px; color: #fff; transition: background-color .15s, border-color .15s; }
.check .box svg.i { width: 14px; height: 14px; stroke-width: 2.6; opacity: 0; }
.check input:checked + .box { background: var(--green); border-color: var(--green); }
.check input:checked + .box svg.i { opacity: 1; }
.check input:focus-visible + .box { outline: 3px solid var(--sky); outline-offset: 2px; }
.check a { color: var(--green); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.check b { color: var(--ink); font-weight: 500; }
/* switch: <input type="checkbox" class="sw" role="switch"> */
.sw { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: var(--pill); background: #D9D5CB; position: relative; cursor: pointer; flex: none; transition: background-color .2s; border: 0; }
.sw::after { content: ""; position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: right .2s var(--ease); }
.sw:checked { background: var(--green); }
.sw:checked::after { right: 21px; }
.sw:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
.sw:disabled { opacity: .5; cursor: not-allowed; }
.sw-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.sw-row:last-child { border-bottom: 0; }
.sw-row .txt { flex: 1; min-width: 0; }
.sw-row .txt b { display: block; font-size: 14.5px; font-weight: 500; }
.sw-row .txt small { display: block; font-size: 12.5px; color: var(--muted); }
/* radio cards (publish visibility, onboarding choices) */
.radio-cards { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 8px; }
.radio-card { position: relative; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: 16px; padding: 12px; cursor: pointer; background: var(--tile); }
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card .vt { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; }
.radio-card .vt svg.i { width: 18px; height: 18px; color: var(--muted); }
.radio-card small { font-size: 12px; color: var(--muted); line-height: 1.5; }
.radio-card .rd { margin-inline-start: auto; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid #BDB8AB; flex: none; }
.radio-card:has(input:checked), .radio-card.on { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); background: #F6FBF9; }
.radio-card:has(input:checked) .vt svg.i { color: var(--green); }
.radio-card:has(input:checked) .rd { border: 5px solid var(--green); }
.radio-card:focus-within { outline: 3px solid var(--sky); outline-offset: 2px; }
/* date of birth (day / month / year) and gender (lib/personal-fields.js) */
.dob { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr) minmax(0, 1fr); gap: 8px; }
.dob .ctl { padding-inline: 12px 34px; background-position: left 10px center; }
.radio-cards.gender { --cols: 2; }
.radio-cards.gender .radio-card { min-height: 52px; justify-content: center; padding: 10px 14px; }
.radio-cards.gender .vt { font-size: 15px; }
/* tag input */
.tags-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 52px; padding: 6px 8px; border: 1px solid var(--line); background: var(--field); border-radius: var(--r-sm); }
.tags-input:focus-within { border-color: var(--sky); outline: 3px solid rgba(47, 110, 166, .3); background: var(--tile); }
.tags-input input { flex: 1; min-width: 110px; border: 0; outline: 0; background: transparent; font-size: 14px; min-height: 34px; padding: 0 6px; }
.tgc { display: inline-flex; align-items: center; gap: 4px; background: var(--tile); border: 1px solid var(--line); border-radius: var(--pill); font-size: 13px; padding-inline-start: 12px; min-height: 34px; }
.tgc button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.tgc button:hover { background: var(--rose-2); color: var(--rose); }
.tgc button svg.i { width: 14px; height: 14px; }
.sugg { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); }
.sugg button { border: 1px dashed var(--line-2); background: transparent; border-radius: var(--pill); font: 400 12.5px var(--font); padding: 0 10px; min-height: 32px; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.sugg button svg.i { width: 13px; height: 13px; }
/* consent box (publish) */
.consent { border-radius: 18px; background: var(--amber-2); border: 1px solid #EBD3A6; padding: 14px 16px; }
.consent .check { color: #6E4A12; }
.consent .check b { font-size: 15px; font-weight: 600; display: block; line-height: 1.5; color: #3A2606; }
.consent .check .box { width: 26px; height: 26px; border-radius: 8px; border: 2px solid #A8741E; }
.consent .scan { display: flex; gap: 8px; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #E2C896; font-size: 12.5px; color: #4E5A55; }
.consent .scan svg.i { width: 16px; height: 16px; color: var(--green); stroke-width: 2.2; }
.consent .scan.warn svg.i { color: var(--rose); }
/* file drop */
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; border: 1.5px dashed var(--line-2); background: color-mix(in srgb, var(--tile) 50%, transparent); border-radius: var(--r-md); padding: 24px; cursor: pointer; color: var(--muted); font-size: 14px; }
.drop:hover, .drop.over { border-color: var(--green); background: #F6FBF9; color: var(--ink); }
/* OTP code boxes */
.otp { display: flex; gap: 8px; direction: ltr; justify-content: center; }
.otp input { width: 52px; height: 60px; text-align: center; font-size: 24px; font-weight: 600; border: 1px solid var(--line); background: var(--field); border-radius: var(--r-sm); }
.otp input:focus { outline: 3px solid rgba(47, 110, 166, .35); border-color: var(--sky); background: var(--tile); }

/* 10. TILES & BENTO, PANELS, CARDS, STATS --------------------------------- */
.bento { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 248px; gap: 18px; }
.tile { position: relative; background: var(--tile); border-radius: var(--r); border: 1px solid var(--line); padding: 22px; overflow: hidden; display: flex; flex-direction: column; transition: transform .25s ease, box-shadow .25s ease; }
a.tile:hover, .tile.hover:hover, .tile:has(.stretch):hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.w2 { grid-column: span 2; } .h2 { grid-row: span 2; }
.t-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.t-name { font-size: 19px; font-weight: 600; line-height: 1.35; margin-top: 4px; }
.t-sub { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.t-body { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding-top: 12px; }
.go { width: 36px; height: 36px; border-radius: 50%; background: rgba(0, 0, 0, .05); display: grid; place-items: center; flex: none; transition: .2s; }
.go svg.i { width: 18px; height: 18px; }
.tile:hover .go { background: var(--solid); color: var(--on-solid); }
.stretch { position: absolute; inset: 0; border-radius: inherit; z-index: 2; }
/* tile variants */
.tile-dark { background: var(--grad-dark); color: #fff; border: 0; }
.tile-dark .cat, .tile-dark .t-sub { color: var(--on-dark-muted); }
.tile-dark .go { background: rgba(255, 255, 255, .1); }
.tile-dark:hover .go { background: var(--tile); color: var(--navy); }
.tile-dark .btn-ghost { color: #fff; } .tile-dark .btn-ghost:hover { background: rgba(255, 255, 255, .12); }
.tile-amber { background: var(--grad-amber); border-color: #F0DFBE; }
.tile-sky { background: var(--grad-sky); border-color: #D3E2F0; }
.tile-plum { background: var(--grad-plum); border-color: #E3DAF3; }
.tile-green { background: var(--grad-green); border-color: #CFE5DC; }
.tile-rose { background: var(--grad-rose); border-color: #F0D3CB; }
.tile-glass { background: rgba(255, 255, 255, .55); }
.panel { background: var(--tile); border: 1px solid var(--line); border-radius: var(--r); padding: 28px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.panel-head h2 { font-size: 22px; font-weight: 600; }
.panel-head p { font-size: 14px; color: var(--muted); }
.card { background: var(--tile); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.card > h3 { font-size: 17px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.card > h3 a { font-size: 13px; color: var(--green); font-weight: 500; min-height: 36px; display: inline-flex; align-items: center; }
.note-box { display: flex; gap: 14px; align-items: center; padding: 18px 20px; border-radius: var(--r); background: rgba(255, 255, 255, .55); border: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.note-box b { color: var(--ink); font-weight: 600; }
.note-box .ic { width: 44px; height: 44px; border-radius: 14px; }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); font-size: 14px; }
.callout svg.i { width: 18px; height: 18px; margin-top: 2px; }
.callout.info { background: var(--sky-2); color: var(--sky-ink); }
.callout.warn { background: var(--amber-2); color: var(--amber-ink); }
.callout.error { background: var(--rose-2); color: var(--rose-ink); }
.callout.ok { background: var(--green-2); color: var(--green-ink); }
.stat { background: var(--tile); border: 1px solid var(--line); border-radius: 20px; padding: 12px 18px; min-width: 132px; }
.stat span { font-size: 13px; color: var(--muted); display: block; }
.stat b { font-size: 24px; font-weight: 600; line-height: 1.3; direction: ltr; display: inline-block; }
.stat small { font-size: 12px; color: var(--green-ink); font-weight: 500; margin-inline-start: 6px; }
.stat small span { display: inline; font-size: inherit; color: inherit; }
.mini { background: var(--tile); border: 1px solid var(--line); border-radius: 20px; padding: 16px 18px; }
.mini > span { font-size: 13px; color: var(--muted); display: block; }
.mini > b { font-size: 28px; font-weight: 600; display: block; line-height: 1.3; direction: ltr; text-align: right; }
.mini > small { font-size: 12.5px; color: var(--muted); }
.kpi { background: var(--tile); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; display: flex; flex-direction: column; gap: 6px; }
.kpi .lbl { font-size: 14px; color: var(--muted); }
.kpi .big { font-size: 40px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; direction: ltr; text-align: right; }
.kpi.tile-dark .lbl { color: var(--on-dark-muted); }
/* tool list tile (directory) */
.tools-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tools-grid .tl { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 18px; background: var(--tile); border: 1px solid var(--line); min-height: 76px; transition: border-color .2s, box-shadow .2s; position: relative; }
.tools-grid .tl:hover { border-color: var(--line-2); box-shadow: var(--shadow-soft); }
.tools-grid .tl > div { min-width: 0; }
.tools-grid .tl b { font-size: 14.5px; font-weight: 500; line-height: 1.4; display: block; }
.tools-grid .tl span.s { font-size: 12.5px; color: var(--muted); display: block; }
.tools-grid .tl .meta-s { display: flex; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.tools-grid .tl .meta-s span { display: inline-flex; align-items: center; gap: 3px; }
.tools-grid .tl .meta-s svg.i { width: 12px; height: 12px; }
.tools-grid .tl .badge { margin-inline-start: 6px; vertical-align: 1px; }
.tools-grid .tl.off { opacity: .55; }
/* related tool tiles (tool page) */
.rgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.rt { position: relative; background: var(--tile); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; display: flex; flex-direction: column; justify-content: space-between; gap: 16px; min-height: 180px; transition: transform .25s, box-shadow .25s; }
.rt:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.rt b { display: block; font-size: 18px; font-weight: 600; line-height: 1.4; margin-top: 2px; }
.rt small { display: block; font-size: 14px; color: var(--muted); margin-top: 4px; }
.rt .ic { align-self: flex-end; }
/* progress */
.pr { display: block; height: 8px; border-radius: 9px; background: var(--canvas-2); overflow: hidden; }
.pr > u, .pr > i { display: block; height: 100%; border-radius: 9px; background: #2FB389; transition: width .3s var(--ease); }
.pr.warn > u { background: #E9B04C; } .pr.bad > u { background: #E07A63; }
/* ring (average/score) — see app.js ring() helper */
.ring { position: relative; width: 230px; height: 230px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { transition: stroke-dasharray .45s var(--ease); }
.ring .val { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .val b { font-size: 56px; font-weight: 600; letter-spacing: -.02em; line-height: 1; direction: ltr; }
.ring .val small { font-size: 14px; color: var(--on-dark-muted); margin-top: 6px; }

/* 11. AVATARS, POST CARDS, USER ROWS, COMMENTS ----------------------------- */
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 15px; font-weight: 500; flex: none; overflow: hidden; background: var(--slate); line-height: 1; }
.av img { width: 100%; height: 100%; object-fit: cover; }
/* no photo: a grey silhouette (man / woman / neutral) */
.av-ph { background: #E6E3DC; color: #A9A397; }
.av-ph svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.av-ph svg .h { fill: #8E887C; }
.av.xs { width: 24px; height: 24px; font-size: 10px; }
.av.sm { width: 30px; height: 30px; font-size: 12px; }
.av.lg { width: 64px; height: 64px; font-size: 24px; }
.av.xl { width: 104px; height: 104px; font-size: 38px; box-shadow: 0 0 0 4px var(--tile); }
.av-stack { display: flex; } .av-stack .av { box-shadow: 0 0 0 2px var(--tile); margin-inline-start: -8px; } .av-stack .av:first-child { margin-inline-start: 0; }
/* feed post card (.pc) */
.posts { display: flex; flex-direction: column; gap: var(--feed-gap); }
.pc { background: var(--tile); border: 1px solid var(--line); border-radius: var(--r); padding: 22px 22px 10px; }
.pc .ph { display: flex; align-items: center; gap: 12px; }
.pc .who { line-height: 1.35; min-width: 0; }
.pc .who b { font-size: 15px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.pc .who a:hover { text-decoration: underline; text-underline-offset: 3px; }
.pc .who span { font-size: 13px; color: var(--muted); }
.pc .ph > .dropdown, .pc .ph > .icon-btn { margin-inline-start: auto; }
.pc .ph .icon-btn { color: var(--muted); }
.pc h3 { font-size: 19px; font-weight: 600; line-height: 1.45; margin-top: 14px; }
.pc h3 a:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.pc .desc { font-size: 14.5px; color: var(--muted); margin-top: 4px; }
.ptags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.pthumb { margin-top: 14px; border-radius: 18px; height: 232px; position: relative; overflow: hidden; display: flex; justify-content: center; align-items: flex-start; padding-top: 26px; }
.pthumb .doc { width: min(420px, 78%); transform: rotate(-1.5deg); }
.pthumb::after { content: ""; position: absolute; inset: auto 0 0 0; height: 70px; background: linear-gradient(to top, rgba(255, 255, 255, .7), transparent); z-index: 1; }
.tb-plan { background: var(--grad-amber); } .tb-exam { background: var(--grad-sky); } .tb-rep { background: var(--grad-plum); }
.tb-doc { background: var(--grad-green); } .tb-quiz { background: var(--grad-rose); } .tb-neutral { background: #F6F4EE; }
.pact { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.pact .pviews { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 14px; color: var(--muted); font: 500 14px var(--font); }
@media (max-width: 640px) { .pact .pviews { padding: 0 10px; } }
.pact button, .pact a { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 14px; border-radius: var(--pill); border: 0; background: transparent; color: var(--muted); font: 500 14px var(--font); cursor: pointer; }
.pact button:hover, .pact a:hover { background: rgba(0, 0, 0, .05); color: var(--ink); }
.pact b { font-weight: 600; color: var(--ink); direction: ltr; }
.pact b:empty, .pp-ic b:empty { display: none; } /* no count at 0: the icon alone */
.pact .faces { margin-inline-start: auto; padding: 6px 4px; }
/* faces of who starred (post cards and post page) */
.faces { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 6px 4px; border-radius: var(--pill); cursor: pointer; font: 600 12.5px var(--font); color: var(--muted); min-height: 44px; }
.faces[hidden] { display: none; }
.faces:hover { background: rgba(0, 0, 0, .05); }
.faces .avs { display: flex; flex: none; }
.faces .av { width: 28px; height: 28px; font-size: 11px; box-shadow: 0 0 0 2px var(--tile); margin-inline-start: -8px; }
.faces .av:first-child { margin-inline-start: 0; }
.faces-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; color: var(--ink); font-weight: 500; }
.faces-row:hover { background: var(--canvas); }
.vis-ic { display: inline-flex; vertical-align: -2px; }
.pact .st[aria-pressed="true"] { color: var(--amber); }
.pact .st[aria-pressed="true"] svg.i, .pact .sv[aria-pressed="true"] svg.i { fill: currentColor; }
.pact .sv[aria-pressed="true"] { color: var(--green); }
/* grid post card (.dc — explore, profile, home community) */
.post-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
/* full post cards in one column (explore, saved, «المزيد من…»): the same cards as the home feed */
.feed-col { display: flex; flex-direction: column; gap: var(--feed-gap); max-width: 760px; width: 100%; margin-inline: auto; }
.feed-col > .skel-card { min-height: 420px; }
.dc { position: relative; background: var(--tile); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; min-height: 320px; transition: transform .25s ease, box-shadow .25s ease; color: var(--ink); }
.dc:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.dc .th { position: relative; height: 150px; flex: none; overflow: hidden; display: flex; justify-content: center; padding-top: 22px; }
.dc .th .doc { width: 72%; transform: rotate(-2deg); }
.dc .th > .tag { position: absolute; top: 12px; right: 12px; z-index: 1; background: var(--tile); box-shadow: 0 2px 6px rgba(0, 0, 0, .06); }
.dc .svb { position: absolute; top: 8px; left: 8px; z-index: 3; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .88); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.dc .svb svg.i { width: 18px; height: 18px; }
.dc .svb:hover { background: var(--tile); }
.dc .svb[aria-pressed="true"] { color: var(--green); } .dc .svb[aria-pressed="true"] svg.i { fill: currentColor; }
.dc .bd { padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 0; }
.dc .bd h3 { font-size: 15.5px; font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dc .bd h3 a::after { content: ""; position: absolute; inset: 0; z-index: 2; }
.dc .bd .lv { font-size: 12.5px; color: var(--muted); }
.dc .ft { margin-top: auto; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.dc .ft .nm { color: var(--ink); font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dc .ft .cmt { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: auto; direction: ltr; }
.dc .ft .cmt svg.i { width: 14px; height: 14px; }
.dc .ft button, .dc .ft a { position: relative; z-index: 3; }
.dc .ft .star { border: 0; cursor: pointer; }
/* user row */
.user-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.user-row:last-child { border-bottom: 0; }
.user-row .who { flex: 1; min-width: 0; line-height: 1.35; }
.user-row .who b { font-size: 14.5px; font-weight: 500; display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-row .who a:hover b { text-decoration: underline; text-underline-offset: 3px; }
.user-row .who span { font-size: 12.5px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.verified { color: var(--sky); display: inline-flex; } .verified svg.i { width: 15px; height: 15px; }
/* comments */
.cm { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0 8px; font-size: 14px; }
.cm .bub { background: #F7F7F4; border-radius: 16px 16px 16px 4px; padding: 8px 14px; flex: 1; min-width: 0; }
.cm .bub b { font-weight: 500; font-size: 13.5px; margin-inline-end: 6px; }
.cm .bub span.t { color: var(--muted); font-size: 12px; }
.cm .bub p { color: var(--ink); font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm.reply { margin-inline-start: 46px; }
.cm.reply .bub { background: var(--green-2); }

/* 12. DOCUMENT THUMBNAILS ("paper") ---------------------------------------- */
.doc { background: var(--tile); border-radius: 10px; box-shadow: 0 14px 26px -18px rgba(60, 50, 20, .45), 0 0 0 1px rgba(0, 0, 0, .05); padding: 12px 14px; font-size: 9.5px; color: #3a3a3a; line-height: 1.5; text-align: start; }
.doc .dh { display: flex; justify-content: space-between; align-items: center; border-bottom: 1.5px solid #222; padding-bottom: 6px; margin-bottom: 8px; gap: 8px; }
.doc .dh b { font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc .dh span { font-size: 8.5px; color: #666; white-space: nowrap; }
.doc table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.doc td { border: 1px solid #D9D4C7; padding: 2px 5px; font-size: 8.5px; }
.doc td:first-child { background: #FAF5EA; font-weight: 500; width: 38%; }
.doc h6 { font-size: 9.5px; font-weight: 600; margin: 6px 0 4px; }
.doc h6.amber { color: var(--amber-ink); } .doc h6.sky { color: var(--sky-ink); } .doc h6.plum { color: var(--plum-ink); }
.ln { height: 5px; border-radius: 5px; background: #EDE9E0; margin: 5px 0; }
.ln.w90 { width: 90%; } .ln.w80 { width: 80%; } .ln.w70 { width: 70%; } .ln.w60 { width: 60%; } .ln.w50 { width: 50%; }
.exq { display: flex; align-items: center; gap: 7px; margin-top: 6px; }
.exq b { font-size: 9px; font-weight: 600; white-space: nowrap; }
.exq .ln { flex: 1; margin: 0; }
.exq em { font-style: normal; font-size: 8.5px; background: var(--sky-2); color: var(--sky-ink); border-radius: 6px; padding: 0 6px; white-space: nowrap; }
.dbars { display: flex; gap: 6px; align-items: flex-end; height: 46px; border-bottom: 1px solid #E4E0D6; padding: 0 4px; margin: 6px 0 4px; }
.dbars u { flex: 1; background: #C9D9EA; border-radius: 4px 4px 1px 1px; }
.dbars u:nth-child(even) { background: var(--sky); }
.dsteps { display: grid; grid-template-columns: auto 1fr; gap: 4px 7px; align-items: center; }
.dsteps i { width: 14px; height: 14px; border-radius: 4px; background: var(--amber-2); color: var(--amber-ink); font-style: normal; font-size: 8px; display: grid; place-items: center; font-weight: 600; }
/* bigger paper (home bento lesson plan) */
.paper { background: var(--tile); border-radius: 12px; box-shadow: 0 18px 30px -18px rgba(120, 80, 10, .45), 0 0 0 1px rgba(0, 0, 0, .04); padding: 16px 16px 18px; font-size: 10px; color: #3a3a3a; }
/* live A4 preview canvas (tool previews) */
.canvas-a4 { background: #ECE9E1; border-radius: 18px; padding: 30px 34px; background-image: radial-gradient(#DAD5C9 1px, transparent 1px); background-size: 16px 16px; overflow: auto; }
.a4 { background: var(--tile); border-radius: 6px; box-shadow: 0 30px 50px -30px rgba(60, 40, 10, .45), 0 0 0 1px rgba(0, 0, 0, .05); padding: 34px 38px 26px; font-size: 12.5px; line-height: 1.7; color: #232323; max-width: 794px; margin: 0 auto; }
.a4 .top { display: flex; justify-content: space-between; gap: 16px; font-size: 11.5px; color: #555; line-height: 1.55; }
.a4 .top b { color: #222; font-weight: 600; }
.a4 h3 { text-align: center; font-size: 22px; font-weight: 600; margin: 14px 0 2px; color: var(--ink); }
.a4 .sub { text-align: center; font-size: 12px; color: #6A6A6A; }
.a4 .sub::after { content: ""; display: block; width: 56px; height: 3px; border-radius: 3px; background: var(--amber); margin: 10px auto 0; }
.a4 h4 { font-size: 13px; font-weight: 600; color: var(--amber-ink); margin: 12px 0 6px; display: flex; align-items: center; gap: 8px; }
.a4 h4::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--amber); }
.a4 table { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 11.8px; line-height: 1.6; }
.a4 th { background: #FAF5EA; font-weight: 600; text-align: start; padding: 7px 9px; border: 1px solid #D9D4C7; font-size: 11.5px; }
.a4 td { border: 1px solid #E1DCCF; padding: 7px 9px; vertical-align: top; }
.a4 .ft { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 10px; border-top: 1px solid #E6E1D5; font-size: 10.5px; color: #777; }
.print-area { display: none; }

/* 13. TABLE, DROPDOWN, MODAL/SHEET, TOAST ----------------------------------- */
.table-wrap { background: var(--tile); border: 1px solid var(--line); border-radius: var(--r); overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-size: 13px; font-weight: 500; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FCFBF8; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--field); }
.table .num { text-align: left; }
.table .acts { text-align: left; white-space: nowrap; }
/* dropdown menu: wrap trigger + .pop in .dropdown */
.dropdown { position: relative; display: inline-flex; }
.pop { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; min-width: 220px; background: var(--tile); border: 1px solid var(--line); border-radius: 18px; padding: 6px; box-shadow: var(--shadow-pop); z-index: 60; text-align: start; animation: pop-in .14s var(--ease); }
.pop.start { inset-inline-end: auto; inset-inline-start: 0; }
.pop .pop-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; line-height: 1.4; }
.pop .pop-head b { display: block; font-size: 14.5px; font-weight: 600; }
.pop .pop-head span { font-size: 12.5px; color: var(--muted); direction: ltr; display: block; text-align: right; overflow: hidden; text-overflow: ellipsis; }
.pop h6 { font-size: 12px; font-weight: 500; color: var(--muted); padding: 6px 10px 4px; }
.pop hr { margin: 5px 6px; }
.pop a, .pop button { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 0; background: transparent; font-size: 14.5px; cursor: pointer; text-align: start; color: var(--ink); }
.pop a svg.i, .pop button svg.i { width: 18px; height: 18px; color: var(--muted); }
.pop .ic-gap { width: 18px; flex: none; }
.pop [aria-checked=true] { font-weight: 500; } .pop [aria-checked=true] svg.i { color: var(--green); }
.pop a:hover, .pop button:hover, .pop a:focus-visible, .pop button:focus-visible { background: var(--canvas); outline-offset: -2px; }
.pop .danger, .pop .danger svg.i { color: var(--rose-ink); }
.pop kbd { margin-inline-start: auto; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }
/* modal (native <dialog class="modal">) → bottom sheet under 640px */
dialog.modal { margin: auto; padding: 0; border: 0; background: var(--canvas); color: var(--ink); width: min(var(--modal-w, 560px), calc(100% - 48px)); max-height: calc(100vh - 48px); border-radius: 28px; box-shadow: var(--shadow-dialog); overflow: hidden; }
dialog.modal[open] { display: flex; flex-direction: column; animation: modal-in .2s var(--ease); }
dialog.modal::backdrop { background: rgba(15, 20, 32, .56); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
dialog.modal.lg { --modal-w: 940px; } dialog.modal.sm { --modal-w: 440px; }
/* «تحقّق سريع» (Cloudflare Turnstile): only shown when Cloudflare needs a click; the widget stays rendered inside */
.ts-layer { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; background: rgba(20, 20, 20, .35); }
/* closed: rendered but off-screen (Turnstile does not run in hidden boxes) */
.ts-layer:not(.open) { inset: 0 auto auto -10000px; width: 420px; height: 320px; background: transparent; pointer-events: none; }
.ts-card { position: relative; width: min(380px, 100%); display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 22px 24px; background: var(--tile); border-radius: var(--r); text-align: center; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .35); outline: none; }
.ts-card .ts-x { position: absolute; top: 10px; inset-inline-end: 10px; }
.ts-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--green-2); color: var(--green); }
.ts-card h2 { margin: 4px 0 0; font: 700 18px var(--font); }
.ts-card p { margin: 0; color: var(--muted); font-size: 14px; }
.ts-slot { min-height: 65px; max-width: 100%; margin-top: 4px; }
.modal-head { display: flex; align-items: center; gap: 14px; padding: 20px 24px; background: var(--tile); border-bottom: 1px solid var(--line); }
.modal-head .ic { width: 46px; height: 46px; border-radius: 15px; }
.modal-head h2 { font-size: 21px; font-weight: 600; line-height: 1.3; }
.modal-head p { font-size: 13.5px; color: var(--muted); }
.modal-head .x { margin-inline-start: auto; border: 1px solid var(--line); border-radius: 50%; }
.modal-head .x:hover { background: var(--canvas); color: var(--ink); }
.modal-body { padding: 20px 24px; overflow: auto; flex: 1; min-height: 0; }
.modal-body.white { background: var(--tile); }
.modal-body > p { color: var(--muted); font-size: 15px; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 16px 24px; background: var(--tile); border-top: 1px solid var(--line); justify-content: flex-start; flex-wrap: wrap; }
.modal-foot .nt { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-inline-start: auto; }
.modal-foot .nt svg.i { width: 16px; height: 16px; }
body.modal-open { overflow: hidden; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
/* publish dialog layout */
.pub-body { display: grid; grid-template-columns: 1fr 268px; gap: 18px; }
.pub-form { background: var(--tile); border: 1px solid var(--line); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.pub-side { display: flex; flex-direction: column; gap: 12px; }
.pub-thumb { background: #ECE9E1; border-radius: 20px; padding: 18px 18px 0; overflow: hidden; height: 300px; background-image: radial-gradient(#DAD5C9 1px, transparent 1px); background-size: 14px 14px; position: relative; }
.pub-thumb > * { transform-origin: top center; }
.pub-thumb .a4 { transform: scale(.32); width: 794px; margin: 0; transform-origin: top right; padding: 34px; }
.card-prev { background: var(--tile); border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.card-prev .k { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.card-prev h4 { font-size: 13.5px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.card-prev .tag { align-self: flex-start; }
.card-prev .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.card-prev .meta b { display: block; color: var(--ink); font-weight: 500; font-size: 12.5px; line-height: 1.3; }
.why { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--rose-ink); }
.why svg.i { width: 15px; height: 15px; }
/* create menu (grid of tool shortcuts) */
.create-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.create-grid a { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 18px; background: var(--tile); border: 1px solid var(--line); min-height: 72px; }
.create-grid a:hover { border-color: var(--line-2); box-shadow: var(--shadow-soft); }
.create-grid b { display: block; font-size: 14.5px; font-weight: 500; line-height: 1.4; }
.create-grid small { display: block; font-size: 12.5px; color: var(--muted); }
.nav-sheet a { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; border-radius: 14px; font-size: 16px; }
.nav-sheet a:hover, .nav-sheet a[aria-current="page"] { background: var(--tile); }
.nav-sheet a svg.i { color: var(--muted); }
/* toast */
.toast-stack { position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translateX(50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: var(--solid); color: var(--on-solid); padding: 12px 16px; border-radius: 16px; box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .45); font-size: 14.5px; line-height: 1.5; animation: toast-in .22s var(--ease); max-width: 520px; }
.toast svg.i { width: 18px; height: 18px; flex: none; }
.toast.success svg.i { color: var(--mint); }
.toast.error { background: #3A1610; } .toast.error svg.i { color: #FF9B85; }
.toast.warn svg.i { color: var(--gold); }
.toast a, .toast button.act { color: var(--mint); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; background: none; border: 0; padding: 0 4px; min-height: 32px; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* 14. SKELETON, EMPTY/ERROR STATES, MISC ---------------------------------- */
.skel { position: relative; overflow: hidden; background: #ECEAE3; border-radius: 10px; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(-100%); } }
.skel-line { height: 12px; margin: 8px 0; } .skel-line.w60 { width: 60%; } .skel-line.w40 { width: 40%; }
.skel-circle { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.skel-card { background: var(--tile); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.skel-card .skel-block { height: 140px; border-radius: 14px; margin-top: 8px; }
.skel-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; }
.skel-row > div { flex: 1; }
.skel-tile { height: 76px; border-radius: 18px; }
.skel-fold { min-height: 100vh; align-content: start; } /* static placeholders reaching past the fold: nothing below them moves on screen */
.tool-off { padding-block: 40px 24px; max-width: 640px; }
.empty { border: 1.5px dashed var(--line-2); background: color-mix(in srgb, var(--tile) 45%, transparent); border-radius: 22px; padding: 32px 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; }
.empty .ei { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; position: relative; background: var(--amber-2); color: var(--amber); }
.empty .ei::after { content: ""; position: absolute; inset: -8px; border-radius: 26px; border: 1.5px dashed #E0C99E; }
.empty .ei svg.i { width: 28px; height: 28px; }
.empty h3 { font-size: 16px; font-weight: 600; margin-top: 8px; }
.empty p { font-size: 14px; color: var(--muted); max-width: 340px; }
.empty .btn { margin-top: 4px; }
.empty.error .ei { background: var(--rose-2); color: var(--rose); } .empty.error .ei::after { border-color: #EDB9AC; }
.empty.on-dark { background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .18); }
.empty.on-dark p { color: var(--on-dark-muted); }
.loadmore { display: flex; justify-content: center; margin-top: 18px; }
.divider-label { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; margin: 24px 0 12px; }
.divider-label::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.offline-bar { position: fixed; top: var(--header-h); inset-inline: 0; z-index: 39; background: var(--amber-2); color: var(--amber-ink); font-size: 13.5px; text-align: center; padding: 6px 16px; display: flex; gap: 8px; align-items: center; justify-content: center; }
.offline-bar svg.i { width: 16px; height: 16px; }
/* rating widget */

/* 15. TOOL PAGE (shared skeleton for all tools) ------------------------------ */
.thead { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 22px 0 32px; }
.ttl { display: flex; gap: 18px; align-items: center; }
.tic { width: 64px; height: 64px; border-radius: 20px; background: var(--navy); color: var(--mint); display: grid; place-items: center; flex: none; }
.tic svg.i { width: 30px; height: 30px; }
.thead h1 { font-size: 44px; font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
.thead p { color: var(--muted); font-size: 16.5px; font-weight: 300; margin-top: 4px; max-width: 720px; }
.tool-grid { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 18px; align-items: start; }
.tool-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: calc(var(--header-h) + 20px); }
.tool-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tool-note { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); justify-content: center; text-align: center; }
.tool-note svg.i { width: 15px; height: 15px; flex: none; }
.save-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.save-status svg.i { width: 16px; height: 16px; }
.save-status.ok { color: var(--green); } .save-status.err { color: var(--rose-ink); }
.save-status.busy svg.i { animation: spin 1s linear infinite; }
/* document status badge filled by tool-kit ([data-doc-status]): «مسودة» / «محفوظ» / «منشور» (link to the post) */
.doc-status { display: inline-flex; align-items: center; }
.doc-status a { display: inline-flex; border-radius: var(--pill); text-decoration: none; }
.doc-status a:hover .status { box-shadow: inset 0 0 0 1px currentColor; }
.actions-row { display: flex; gap: 10px; align-items: center; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.actions-row .hint { margin-inline-start: auto; font-size: 14px; color: var(--muted); }
.actions-row .hint b { color: var(--ink); direction: ltr; display: inline-block; }
.steps-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.steps-strip li { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; border-radius: var(--r); background: rgba(255, 255, 255, .55); border: 1px solid var(--line); }
.steps-strip li > i { width: 32px; height: 32px; border-radius: 10px; background: var(--solid); color: var(--on-solid); font-style: normal; font-weight: 600; display: grid; place-items: center; flex: none; font-size: 14px; }
.steps-strip b { display: block; font-size: 15px; font-weight: 600; }
.steps-strip span { font-size: 13.5px; color: var(--muted); }
.result-dark { background: var(--grad-dark); color: #fff; border-radius: var(--r); padding: 24px; text-align: center; }
.result-dark .rtop { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--on-dark-muted); }
.live { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--mint); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(98, 214, 178, .2); }
.live.light { color: var(--green); background: var(--green-2); padding: 3px 10px; border-radius: var(--pill); font-weight: 500; }
.live.light i { background: var(--green); box-shadow: 0 0 0 3px rgba(14, 107, 85, .18); }

/* 16. RESPONSIVE ------------------------------------------------------------ */
@media (max-width: 1100px) {
  .links { display: none; }
  .nav-burger { display: grid; }
  .nsearch { width: 240px; }
  .bento { grid-template-columns: repeat(2, 1fr); }
  .tools-grid, .post-grid, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout-side, .tool-grid { grid-template-columns: minmax(0, 1fr); }
  .layout-side > aside, .tool-side, .sticky-side { position: static; }
  .rgrid { grid-template-columns: 1fr 1fr; }
  .fgrid { grid-template-columns: 1.2fr repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .pub-body { grid-template-columns: 1fr; }
  .pub-side { flex-direction: row; flex-wrap: wrap; order: -1; }
  .pub-thumb { width: 150px; height: 180px; flex: none; padding: 12px 12px 0; }
  .pub-thumb .a4 { transform: scale(.16); }
  .pub-side .card-prev { flex: 1; min-width: 0; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 767.98px) {
  .nav.signed .nav-burger { display: none; }
}
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .nav .wrap, .nav.signed .wrap { gap: 6px; }
  .nav-cta .btn-ghost.hide-sm { display: none; }
  .nav-cta .btn { padding: 0 16px; font-size: 14px; }
  .nsearch { display: none; }
  .icon-btn.s-only { display: inline-grid; margin-inline-start: auto; }
  .nav.signed .nav-cta { margin-inline-start: auto; } /* the search field is hidden here; keep the avatar at the far edge */
  .nav.signed .nav-cta .btn-create { padding: 0; width: 44px; }
  .nav.signed .nav-cta .btn-create span { display: none; }
  .me { width: 36px; height: 36px; }
  .brand .role { display: none; }
  .brand .logo { height: 24px; }
  .brand.sm .logo { height: 20px; }
  .crumbs { padding-top: 18px; }
  .phead { flex-direction: column; align-items: flex-start; padding: 14px 0 20px; gap: 14px; }
  .phead h1 { font-size: 30px; }
  .phead p { font-size: 15px; }
  section.block { padding-top: 64px; }
  section.blk { padding-top: 36px; }
  .sh { flex-direction: column; align-items: flex-start; gap: 6px; }
  .sh.sm { flex-direction: row; align-items: center; }
  .sh h2 { font-size: 28px; }
  .sh.sm h2 { font-size: 20px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; border-radius: 18px; }
  .tabs::-webkit-scrollbar { display: none; }
  .bento { grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(190px, auto); grid-auto-flow: dense; gap: 12px; }
  .tile { padding: 16px; border-radius: 20px; }
  .t-name { font-size: 15.5px; }
  .go { display: none; }
  .w2, .h2 { grid-column: auto; grid-row: auto; }
  .tools-grid, .post-grid, .grid-2, .grid-3, .grid-4, .rgrid { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 18px; border-radius: 20px; }
  .panel-head { flex-direction: column; align-items: flex-start; }
  .card { border-radius: 20px; }
  .pc { padding: 16px 16px 6px; border-radius: 20px; }
  .pc h3 { font-size: 16.5px; }
  .pthumb { height: 176px; padding-top: 18px; border-radius: 14px; }
  .pthumb .doc { width: 84%; }
  .pact button, .pact a { padding: 0 10px; }
  .pact .lbl { display: none; }
  .site-footer { margin-top: 64px; padding-top: 40px; }
  .fgrid { grid-template-columns: 1fr 1fr; }
  .fgrid > div:first-child { grid-column: 1 / -1; }
  .fbot { flex-direction: column; align-items: flex-start; gap: 6px; }
  .site-footer.compact .fbot nav { margin-inline-start: 0; }
  /* Anchor the sheet to the visible bottom and size it by the dynamic viewport: on iOS Safari
     100vh is taller than the visible area, which pushed the sheet body below the screen. */
  dialog.modal { position: fixed; inset: auto 0 0 0; width: 100%; max-width: 100%; max-height: 85vh; max-height: 85dvh; height: auto; margin: 0; border-radius: 26px 26px 0 0; }
  dialog.modal .modal-body:last-child { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  dialog.modal[open] { animation: sheet-in .25s var(--ease); }
  dialog.modal::before { content: ""; width: 40px; height: 5px; border-radius: 5px; background: var(--line-2); margin: 8px auto -4px; display: block; position: relative; z-index: 1; flex: none; }
  .modal-head { padding: 14px 16px; }
  .modal-head .ic { display: none; }
  .modal-head h2 { font-size: 18px; }
  .modal-body { padding: 14px 16px; }
  .modal-foot { padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
  .modal-foot .nt { width: 100%; justify-content: center; order: 3; margin: 0; }
  .modal-foot .btn { flex: 1; min-height: 50px; }
  .radio-cards { gap: 6px; }
  .radio-card { padding: 10px 8px; min-height: 52px; justify-content: center; }
  .radio-card small { display: none; }
  .create-grid { grid-template-columns: 1fr; }
  .thead { flex-direction: column; align-items: flex-start; padding: 16px 0 20px; }
  .thead h1 { font-size: 30px; }
  .tic { width: 52px; height: 52px; border-radius: 16px; }
  .tool-actions { grid-template-columns: 1fr; }
  .steps-strip { grid-template-columns: 1fr; gap: 10px; }
  .toast-stack { bottom: 16px; }
  .otp input { width: 44px; height: 54px; font-size: 21px; }
  .kpi .big { font-size: 32px; }
}
@keyframes sheet-in { from { transform: translateY(40px); opacity: .4; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .tile:hover, a.tile:hover, .dc:hover, .rt:hover, .tile:has(.stretch):hover { transform: none; }
}
@media (forced-colors: active) {
  .btn, .tabs .on, .seg button.on { border: 1px solid CanvasText; }
}

/* Profile cover banner (lib/cover.js): the teacher's image, or a plain palette banner. Decorative. */
.cover-banner { position: relative; overflow: hidden; background-color: var(--navy); isolation: isolate; }
.cover-banner.is-default {
  background-image:
    radial-gradient(60% 120% at 12% 110%, rgba(98, 214, 178, .28) 0%, transparent 60%),
    radial-gradient(50% 110% at 92% -10%, rgba(47, 110, 166, .45) 0%, transparent 65%),
    radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.2px),
    var(--grad-dark);
  background-size: auto, auto, 22px 22px, auto;
}
.cover-banner .cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; z-index: -1; }
.cover-banner.has-img::after { content: ""; position: absolute; inset: auto 0 0; height: 45%; background: linear-gradient(to top, rgba(14, 24, 41, .45), transparent); pointer-events: none; }


/* test site marker (taatir-preview.*) */
.preview-flag { background: var(--amber-2); color: var(--amber-ink); border-bottom: 1px solid #F0DFBE; text-align: center; font-size: 12.5px; font-weight: 600; padding: 4px 12px; }

/* Content pages: the footer starts below the fold, so lists and panels filling in after load never push it
   (or anything else) around on screen. Sign-in / sign-up pages (data-bnav="off") keep their fitted layout. */
body:not([data-bnav="off"]) #main, body[data-page="tool"] #main { min-height: 100vh; min-height: 100svh; }
/* Tool pages: the tool itself (drawn by its script) reaches past the fold, so «أدوات مشابهة» and the notes
   below it never jump down when it appears. */
[data-tool-root] > :not(.blk, .related):has(+ .blk, + .related) { min-height: 100vh; min-height: 100svh; }
/* Tool pages: the tool area is hidden while its script draws it (tool-kit.js `toolReady()`), then shown complete.
   Shown anyway after 2 s if the script never says so. */
body[data-page="tool"]:not(.tool-ready) [data-tool-root] > :not(.crumbs) { visibility: hidden; animation: tool-reveal 0s 2s forwards; }
@keyframes tool-reveal { to { visibility: visible; } }

/* «نقل إلى مجموعة» window (lib/collections.js) */
.col-list { display: flex; flex-direction: column; gap: 4px; }
.col-row { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 10px; border: 0; border-radius: 12px; background: transparent; font: 500 15px var(--font); color: var(--ink); cursor: pointer; text-align: start; }
.col-row:hover { background: var(--canvas); }
.col-row[aria-pressed="true"] { background: var(--green-2); }
.col-row small { margin-inline-start: auto; color: var(--muted); font-size: 12.5px; }
.col-new { display: flex; gap: 8px; }
.col-new .ctl { flex: 1; min-width: 0; }

/* a reposted post inside a card / the post page */
.nt-quote { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--canvas); color: var(--ink); }
.nt-quote:hover { border-color: #D6D2C8; }
.nt-quote .qh { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.nt-quote .qh small { color: var(--muted); margin-inline-start: auto; }
.nt-quote .qt { font-weight: 600; font-size: 15px; }
.nt-quote .qd { font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nt-quote.gone { flex-direction: row; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); }

/* «تواصل معنا» chat (contact page for signed-in teachers, and admin «المحادثات») */
.ch { background: var(--tile); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; overflow: hidden; height: min(820px, calc(100svh - var(--header-h) - 32px)); min-height: 520px; }
.ch-h { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.ch-h .lg { width: 44px; height: 44px; border-radius: 14px; background: var(--solid); color: var(--on-solid); display: grid; place-items: center; font: 800 18px var(--font); flex: none; }
.ch-h b { display: block; font-size: 16px; }
.ch-h small { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.ch-h small i { width: 8px; height: 8px; border-radius: 50%; background: #2FB389; }
.ch-h .ch-close { margin-inline-start: auto; }
.ch-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; background: var(--canvas); }
.ch-day { align-self: center; font-size: 12px; color: var(--muted); background: var(--tile); border: 1px solid var(--line); border-radius: var(--pill); padding: 2px 12px; }
.ch .msg { max-width: 80%; padding: 10px 14px; border-radius: 18px; font-size: 14.5px; line-height: 1.7; }
.ch .msg p { white-space: pre-line; overflow-wrap: anywhere; }
.ch .msg small { display: block; font-size: 11.5px; margin-top: 4px; opacity: .75; direction: rtl; }
.ch .msg.mine { align-self: flex-start; background: var(--solid); color: var(--on-solid); border-start-start-radius: 6px; }
.ch .msg.team { align-self: flex-end; background: var(--tile); border: 1px solid var(--line); border-start-end-radius: 6px; }
.ch .msg .who { display: block; font-size: 12px; color: var(--green); font-weight: 600; margin-bottom: 2px; }
.ch .msg .shot { display: block; margin-bottom: 6px; }
.ch .msg .shot img { display: block; max-width: 100%; width: auto; height: auto; max-height: 240px; border-radius: 12px; object-fit: contain; }
.ch-empty { margin: auto; text-align: center; color: var(--muted); font-size: 14px; max-width: 340px; line-height: 1.8; }
.ch-empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.ch-sugg { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.ch-sugg button { border: 1px solid var(--line); background: var(--tile); color: var(--ink); border-radius: var(--pill); min-height: 36px; padding: 0 12px; font: 400 13px var(--font); cursor: pointer; }
.ch-note { flex: none; display: flex; gap: 8px; align-items: center; margin: 8px 14px 0; padding: 8px 12px; border-radius: 12px; background: var(--amber-2); color: var(--amber-ink); font-size: 13px; line-height: 1.5; }
.ch-note[hidden] { display: none; }
.ch-note svg.i { flex: none; margin-top: 2px; }
.ch-f { flex: none; display: flex; gap: 8px; align-items: flex-end; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--tile); margin-top: 10px; }
.ch-in { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--field); }
.ch-in:focus-within { border-color: var(--sky); box-shadow: var(--focus); }
.ch-in textarea { display: block; width: 100%; min-height: 46px; max-height: 160px; border: 0; background: transparent; padding: 12px 14px; font: 400 15px/1.5 var(--font); color: var(--ink); resize: none; outline: 0; }
.ch-in textarea:disabled { opacity: .6; }
.ch-prev { position: relative; padding: 10px 10px 0; }
.ch-prev[hidden] { display: none; }
.ch-prev img { display: block; max-height: 110px; border-radius: 10px; }
.ch-prev .x { position: absolute; top: 4px; inset-inline-start: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .6); color: #fff; display: grid; place-items: center; cursor: pointer; }
.ch-send, .ch-att { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; }
.ch-send { background: var(--green); color: #fff; }
.ch-send:disabled { background: var(--line-2); cursor: default; }
.ch-send.loading { opacity: .6; }
.ch-att { background: transparent; color: var(--muted); }
.ch-att:hover:not(:disabled) { background: var(--canvas); color: var(--ink); }
.ch-att:disabled { opacity: .4; cursor: default; }
@media (max-width: 640px) {
  .ch { height: calc(100svh - var(--header-h) - var(--bnav-h) - 24px); min-height: 440px; }
  .ch .msg { max-width: 88%; }
  .ch .msg .shot img { max-height: 200px; }
  .ch-h { padding: 10px 14px; }
  .ch-h .lg { width: 38px; height: 38px; border-radius: 12px; }
}
/* support chat: list of conversations, new conversation */
.ch-ht { min-width: 0; }
.ch-ht b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-h > .btn, .ch-h > .ch-close { margin-inline-start: auto; flex: none; }
.ch-back { flex: none; }
.ch-limit { display: flex; align-items: center; gap: 8px; margin: 10px 14px 0; padding: 8px 12px; border-radius: 12px; background: var(--sky-2); color: var(--sky-ink); font-size: 13px; }
.ch-list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.ch-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border: 0; border-radius: 14px; background: transparent; text-align: start; font: inherit; color: var(--ink); cursor: pointer; }
.ch-row:hover { background: var(--canvas); }
.ch-row.open { background: var(--green-2); }
.ch-row-ic { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--canvas); color: var(--muted); }
.ch-row.open .ch-row-ic { background: var(--tile); color: var(--green); }
.ch-row-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ch-row-t b { font-weight: 600; }
.ch-row-t small, .ch-row-m small { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-row-m { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ch-st { font-style: normal; font-size: 11.5px; font-weight: 600; border-radius: var(--pill); padding: 1px 9px; }
.ch-st.w { background: var(--amber-2); color: var(--amber-ink); } .ch-st.a { background: var(--green-2); color: var(--green-ink); } .ch-st.c { background: var(--canvas); color: var(--muted); }
.ch-new { justify-content: flex-start; }
.ch-lbl { font-weight: 600; font-size: 14px; }
.ch-subj { display: flex; flex-wrap: wrap; gap: 8px; }
.ch-subj button { min-height: 40px; padding: 0 14px; border-radius: var(--pill); border: 1px solid var(--line); background: var(--tile); color: var(--ink); font: 500 14px var(--font); cursor: pointer; }
.ch-subj button[aria-checked="true"] { background: var(--solid); border-color: var(--solid); color: var(--on-solid); }
.ch-help { font-size: 13px; color: var(--muted); margin-top: 6px; }
.ch-closed { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
