/* =====================================================================
   SAHAL AI — THE design.md LAYER  (#DS-1, docs/DESIGN_ROLLOUT_PLAN_2026-11-26.md)
   Source of truth for every value here: /design.md (owner-confirmed).

   NOTHING in this file applies unless <html> carries a rollout class, set
   by views/partials/design-v3-head.ejs from the switch (shared/designV3.js):

     html.ds3        some part of the new design is active on this page
                     → tokens (--ds-*) and shared components (.ds-*)
     html.ds3-frame  the app frame is released            → frame rules (#DS-2)
     html.ds3-page   this page's content is released      → the bridge + page rules

   The classes are never present together with `dark` (dark mode is #DS-D),
   so this file is light-theme only.

   Rules of the file
   - Every selector starts with html.ds3, html.ds3-frame or html.ds3-page.
   - Tokens are named --ds-<design.md name> (design.md §2.2 `--brand` is
     `--ds-brand` here): the generic names would collide with the admin's
     `--brand` and with page-local variables.
   - Components are built from the tokens only: no raw hex below section 2.
   - Logical properties only (RTL-native, design.md §8).
   - Do not edit --ty-* / --mono-* / --ct-* (tailwind.src.css): section 9
     re-points them, for released pages only.

   Sections: 1 fonts · 2 tokens · 3 type roles · 4 icons · 5 buttons ·
             6 fields · 7 surfaces (menu, card, stat, tabs, badge, empty,
             modal, skeleton) · 8 touch sizes · 9 the bridge
   ===================================================================== */

/* ── 1. Fonts (design.md §3.1) ─────────────────────────────────────────
   Self-hosted. A browser downloads a face only when a rule that uses it
   matches, so with the switch off these cost nothing.
   Speed plan PG-12 (2026-11-30): the -subset files carry Arabic, Latin, digits
   and punctuation with the shaping features and no unused alternates
   (scripts/build-ds3-font-subsets.py; ~58 KB instead of ~78 KB each). The same
   URLs are preloaded by views/layout.ejs, partials/admin-head.ejs and
   admin/design-kit.ejs: a new cut = a new file name in all four places. */
@font-face {
    font-family: "Thmanyah Sans";
    src: url("/fonts/thmanyah/ThmanyahSans-Regular-subset.woff2?v=2") format("woff2");
    font-weight: 400; font-style: normal; font-display: swap;
    unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+0160-0161, U+0178, U+017D-017E, U+0192, U+02C6, U+02DC, U+0600-06FF, U+0750-077F, U+08A0-08FF, U+2000-206F, U+20AC, U+20C1, U+2122, U+2212, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
    font-family: "Thmanyah Sans";
    src: url("/fonts/thmanyah/ThmanyahSans-Medium-subset.woff2?v=2") format("woff2");
    font-weight: 500; font-style: normal; font-display: swap;
    unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+0160-0161, U+0178, U+017D-017E, U+0192, U+02C6, U+02DC, U+0600-06FF, U+0750-077F, U+08A0-08FF, U+2000-206F, U+20AC, U+20C1, U+2122, U+2212, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
    font-family: "Thmanyah Sans";
    src: url("/fonts/thmanyah/ThmanyahSans-Bold-subset.woff2?v=2") format("woff2");
    font-weight: 600 700; font-style: normal; font-display: swap;
    unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+0160-0161, U+0178, U+017D-017E, U+0192, U+02C6, U+02DC, U+0600-06FF, U+0750-077F, U+08A0-08FF, U+2000-206F, U+20AC, U+20C1, U+2122, U+2212, U+FB50-FDFF, U+FE70-FEFF;
}
/* Inter: Latin letters and digits the Arabic face does not carry. */
@font-face {
    font-family: "Inter";
    src: url("/fonts/inter/Inter-Latin-Variable.woff2?v=1") format("woff2");
    font-weight: 400 600; font-style: normal; font-display: swap;
    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;
}

/* ── 2. Tokens (design.md §2.2, §3.1, §4) ───────────────────────────── */
html.ds3 {
    /* Brand */
    --ds-brand: #FA4F00;
    --ds-brand-hover: #E04700;
    --ds-brand-active: #C73F00;
    --ds-brand-foreground: #FFFFFF;
    --ds-brand-soft: #FDF3C9;
    --ds-brand-softer: #FFFBEB;

    /* Surfaces */
    --ds-background: #FFFFFF;
    --ds-card: #FFFFFF;
    --ds-popover: #FFFFFF;
    --ds-sidebar: #F5F5F7;
    --ds-sidebar-shell: #FBFAF9;   /* owner 11-30: the app's side menu keeps its colour from before the frame (§10.2) */
    --ds-muted: #F1F5F9;
    --ds-muted-hover: #E2E8F0;
    --ds-sidebar-accent: #E8E8ED;
    --ds-accent: rgba(56, 67, 82, 0.08);
    --ds-overlay: rgba(29, 29, 31, 0.35);

    /* Text */
    --ds-foreground: #384352;
    --ds-foreground-strong: #1D1D1F;
    --ds-muted-foreground: #65758B;
    --ds-meta-foreground: #86868B;
    --ds-placeholder: #AEAEB2;

    /* Lines */
    --ds-border: #E2E8F0;
    --ds-border-subtle: #E8E8ED;
    --ds-border-active: #CBD5E1;
    --ds-hairline: rgba(5, 5, 5, 0.08);
    --ds-ring: var(--ds-brand);
    --ds-focus-glow: 0 0 0 3px rgba(250, 79, 0, 0.35);

    /* Status */
    --ds-destructive: #EF4444;
    --ds-destructive-hover: #DC2626;
    --ds-destructive-foreground: #FFFFFF;
    --ds-destructive-muted: #FEE2E2;      /* derived: failed-state badge */
    --ds-success: #16A34A;
    --ds-success-muted: #DCFCE7;
    --ds-warning: #F59E0B;
    --ds-warning-muted: #FFFBEB;
    --ds-warning-foreground: #B45309;     /* derived: readable amber text on the muted tint */
    --ds-live: #12D986;

    /* Font */
    --ds-font: "Thmanyah Sans", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    /* Radius (§4.3) */
    --ds-radius-sm: 6px;
    --ds-radius: 8px;
    --ds-radius-md: 10px;
    --ds-radius-lg: 12px;
    --ds-radius-xl: 16px;
    --ds-radius-2xl: 24px;
    --ds-radius-full: 9999px;

    /* Elevation (§4.4) */
    --ds-shadow-xs: 0 1px 2px rgba(5, 5, 5, .04);
    --ds-shadow-sm: 0 1px 3px rgba(5, 5, 5, .06), 0 1px 2px rgba(5, 5, 5, .04);
    --ds-shadow-md: 0 4px 12px rgba(5, 5, 5, .08), 0 2px 4px rgba(5, 5, 5, .04);
    --ds-shadow-lg: 0 12px 32px rgba(5, 5, 5, .12), 0 4px 8px rgba(5, 5, 5, .04);
    --ds-shadow-menu: 0 4px 16px rgba(5, 5, 5, .08);
    --ds-shadow-modal: 0 10px 30px rgba(0, 0, 0, .15);
    --ds-shadow-floating: 0 0 0 1px rgba(16, 16, 16, .06), 0 3px 7px rgba(16, 16, 16, .11), 0 9px 25px rgba(16, 16, 16, .21);
    --ds-ring-inset: inset 0 0 0 1px var(--ds-hairline);

    /* Motion (§4.5) */
    --ds-duration-fast: .15s;
    --ds-duration: .2s;
    --ds-duration-slow: .3s;
    --ds-duration-flow: .48s;
    --ds-ease: cubic-bezier(.22, 1, .36, 1);
    --ds-ease-expo: cubic-bezier(.16, 1, .3, 1);
    --ds-ease-snap: cubic-bezier(.2, 0, 0, 1);
    --ds-ease-drawer: cubic-bezier(.32, .72, 0, 1);

    /* Control sizes (§4.2). Touch screens raise them in section 8. */
    --ds-control-h: 32px;        /* button, secondary nav row, tab uses its own 36 */
    --ds-field-h: 36px;          /* input, select, menu row, tab */
    --ds-icon-btn: 30px;
    --ds-icon-btn-sm: 28px;

    /* Layout (§5) */
    --ds-gutter: 32px;
    --ds-sidebar-w: 248px;
    --ds-rail-w: 56px;
    --ds-form-max: 760px;
}

/* ── 3. Type roles (design.md §3.2) ─────────────────────────────────── */
html.ds3 :where([class^="ds-"], [class*=" ds-"]) { font-family: var(--ds-font); -webkit-font-smoothing: antialiased; box-sizing: border-box; }

html.ds3 .ds-editor-title  { font-size: 36px; font-weight: 600; line-height: 54px;   letter-spacing: -0.6px; color: var(--ds-foreground); margin: 0; }
html.ds3 .ds-h1            { font-size: 26px; font-weight: 500; line-height: 31.2px; letter-spacing: -0.4px; color: var(--ds-foreground); margin: 0; }
html.ds3 .ds-stat-number   { font-size: 24px; font-weight: 500; line-height: 34.8px; letter-spacing: -0.4px; color: var(--ds-foreground); }
html.ds3 .ds-dialog-title  { font-size: 20px; font-weight: 600; line-height: 30px;   letter-spacing: -0.5px; color: var(--ds-foreground); margin: 0; }
html.ds3 .ds-panel-title   { font-size: 18px; font-weight: 500; line-height: 27px;   letter-spacing: -0.2px; color: var(--ds-foreground); margin: 0; }
html.ds3 .ds-editor-body   { font-size: 17px; font-weight: 400; line-height: 25.5px; color: var(--ds-foreground); }
html.ds3 .ds-h2            { font-size: 15px; font-weight: 500; line-height: 22.5px; color: var(--ds-foreground); margin: 0; }
html.ds3 .ds-page-desc     { font-size: 15px; font-weight: 400; line-height: 22.5px; color: var(--ds-meta-foreground); margin: 0; }
html.ds3 .ds-body          { font-size: 14px; font-weight: 400; line-height: 21px;   color: var(--ds-foreground); }
html.ds3 .ds-body-strong   { font-size: 14px; font-weight: 500; line-height: 21px;   color: var(--ds-foreground); }
html.ds3 .ds-dialog-body   { font-size: 14px; font-weight: 400; line-height: 22.75px; color: var(--ds-muted-foreground); }
html.ds3 .ds-small         { font-size: 13.5px; font-weight: 400; line-height: 20.25px; color: var(--ds-muted-foreground); }
html.ds3 .ds-card-title    { font-size: 13px; font-weight: 500; line-height: 19.5px; color: var(--ds-foreground); }
html.ds3 .ds-caption       { font-size: 12px; font-weight: 400; line-height: 18px;   color: var(--ds-muted-foreground); }
html.ds3 .ds-overline      { font-size: 11px; font-weight: 500; line-height: 16.5px; color: var(--ds-meta-foreground); opacity: .8; }
/* Arabic never takes letter-spacing (§3.2): the tracking above is for Latin headings. */
html.ds3 :where(.ds-editor-title, .ds-h1, .ds-stat-number, .ds-dialog-title, .ds-panel-title):lang(ar) { letter-spacing: 0; }
/* Numbers, links, emails, code and prices stay left-to-right (§8). */
html.ds3 .ds-ltr { direction: ltr; unicode-bidi: plaintext; }

/* ── 4. Icons (design.md §4.6) ────────────────────────────────────────
   <svg class="ds-icon"><use href="/icons/admin-icons.svg#i-check"/></svg>
   The sprite's paths carry no stroke of their own, so this class draws them. */
html.ds3 .ds-icon { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: -3px; }
html.ds3 .ds-icon--12 { width: 12px; height: 12px; vertical-align: -1px; stroke-width: 2; }
html.ds3 .ds-icon--24 { width: 24px; height: 24px; vertical-align: -6px; }
/* Arrows, chevrons and "back" point the other way in RTL; logos, checks and clocks never mirror. */
html.ds3 [dir="rtl"] .ds-icon--dir, html.ds3[dir="rtl"] .ds-icon--dir { transform: scaleX(-1); }

/* ── 5. Buttons (design.md §6.1, §4.2) ──────────────────────────────── */
html.ds3 .ds-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: var(--ds-control-h); padding: 0 12px;
    border: 1px solid transparent; border-radius: var(--ds-radius-md);
    background: transparent; color: var(--ds-foreground);
    font-family: var(--ds-font); font-size: 14px; font-weight: 500; line-height: 21px;
    white-space: nowrap; text-decoration: none; cursor: pointer; user-select: none;
    transition: background-color var(--ds-duration-fast) var(--ds-ease), border-color var(--ds-duration-fast) var(--ds-ease), color var(--ds-duration-fast) var(--ds-ease), box-shadow var(--ds-duration-fast) var(--ds-ease);
}
html.ds3 .ds-btn:focus-visible { outline: none; box-shadow: var(--ds-focus-glow); }
html.ds3 .ds-btn:disabled, html.ds3 .ds-btn[aria-disabled="true"], html.ds3 .ds-btn.is-disabled { opacity: .5; pointer-events: none; }

/* Primary — one per view. Label ≥14px, weight 500 (§2.4 contrast rule). */
html.ds3 .ds-btn--primary { background: var(--ds-brand); color: var(--ds-brand-foreground); }
html.ds3 .ds-btn--primary:hover { background: var(--ds-brand-hover); }
html.ds3 .ds-btn--primary:active { background: var(--ds-brand-active); }

html.ds3 .ds-btn--secondary { background: var(--ds-muted); color: var(--ds-foreground); font-size: 13.5px; line-height: 20.25px; }
html.ds3 .ds-btn--secondary:hover { background: var(--ds-muted-hover); }

html.ds3 .ds-btn--outline { background: var(--ds-background); color: var(--ds-foreground); border-color: var(--ds-border); }
html.ds3 .ds-btn--outline:hover { background: var(--ds-muted); }

html.ds3 .ds-btn--ghost { color: var(--ds-muted-foreground); font-size: 13.5px; line-height: 20.25px; }
html.ds3 .ds-btn--ghost:hover { background: var(--ds-accent); }

html.ds3 .ds-btn--link { height: auto; padding: 0; border: 0; border-radius: var(--ds-radius-sm); color: var(--ds-muted-foreground); font-size: 13px; font-weight: 400; line-height: 19.5px; }
html.ds3 .ds-btn--link:hover { color: var(--ds-foreground); text-decoration: underline; }

/* Destructive — delete confirmations only; red, never orange. */
html.ds3 .ds-btn--destructive { background: var(--ds-destructive); color: var(--ds-destructive-foreground); }
html.ds3 .ds-btn--destructive:hover { background: var(--ds-destructive-hover); }

html.ds3 .ds-btn--block { display: flex; width: 100%; }

/* Icon-only buttons: always give them an aria-label. */
html.ds3 .ds-btn--icon { width: var(--ds-icon-btn); height: var(--ds-icon-btn); padding: 0; border-radius: var(--ds-radius); color: var(--ds-meta-foreground); }
html.ds3 .ds-btn--icon:hover { background: var(--ds-accent); color: var(--ds-foreground); }
html.ds3 .ds-btn--icon-sm { width: var(--ds-icon-btn-sm); height: var(--ds-icon-btn-sm); }
html.ds3 .ds-btn--round { width: var(--ds-control-h); height: var(--ds-control-h); padding: 0; border-radius: var(--ds-radius-full); background: var(--ds-muted); color: var(--ds-muted-foreground); }
html.ds3 .ds-btn--round:hover { background: var(--ds-muted-hover); }

/* ── 6. Fields (design.md §6.2): filled grey, the border appears on hover/focus ── */
html.ds3 .ds-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
html.ds3 .ds-label { font-size: 14px; font-weight: 500; line-height: 21px; color: var(--ds-foreground); }
html.ds3 .ds-help { font-size: 13px; font-weight: 400; line-height: 19.5px; color: var(--ds-meta-foreground); }

html.ds3 .ds-input, html.ds3 .ds-select, html.ds3 .ds-textarea {
    display: block; width: 100%; min-width: 0;
    height: var(--ds-field-h); padding: 8px 14px;
    border: 1px solid transparent; border-radius: var(--ds-radius-md);
    background-color: var(--ds-muted); color: var(--ds-foreground);
    font-family: var(--ds-font); font-size: 14px; font-weight: 400; line-height: 18px;
    outline: none; appearance: none; -webkit-appearance: none;
    transition: background-color var(--ds-duration-fast) var(--ds-ease), border-color var(--ds-duration-fast) var(--ds-ease), box-shadow var(--ds-duration-fast) var(--ds-ease);
}
html.ds3 .ds-textarea { height: auto; min-height: 88px; line-height: 21px; resize: vertical; }
html.ds3 .ds-input::placeholder, html.ds3 .ds-textarea::placeholder { color: var(--ds-placeholder); opacity: 1; }
html.ds3 .ds-input:hover, html.ds3 .ds-select:hover, html.ds3 .ds-textarea:hover { border-color: var(--ds-border-active); }
html.ds3 .ds-input:focus, html.ds3 .ds-select:focus, html.ds3 .ds-textarea:focus,
html.ds3 .ds-input:focus-visible, html.ds3 .ds-select:focus-visible, html.ds3 .ds-textarea:focus-visible {
    background-color: var(--ds-background); border-color: var(--ds-brand); box-shadow: var(--ds-focus-glow);
}
html.ds3 .ds-input:disabled, html.ds3 .ds-select:disabled, html.ds3 .ds-textarea:disabled { opacity: .5; cursor: not-allowed; }
/* Select: the same box with a trailing chevron (inline-end in RTL = left). */
html.ds3 .ds-select {
    padding-inline-end: 36px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2386868B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: left 12px center; background-size: 16px 16px;
}
html.ds3 [dir="ltr"] .ds-select { background-position: right 12px center; }
/* Error: red border, red helper text. */
html.ds3 .ds-field.is-error .ds-input, html.ds3 .ds-field.is-error .ds-select, html.ds3 .ds-field.is-error .ds-textarea,
html.ds3 .ds-input[aria-invalid="true"], html.ds3 .ds-select[aria-invalid="true"], html.ds3 .ds-textarea[aria-invalid="true"] { border-color: var(--ds-destructive); }
html.ds3 .ds-field.is-error .ds-help { color: var(--ds-destructive); }

/* ── 7. Surfaces ────────────────────────────────────────────────────── */

/* 7.1 Dropdown menu / popover (§6.3) */
html.ds3 .ds-menu { min-width: 200px; padding: 4px; background: var(--ds-popover); border: 1px solid var(--ds-border); border-radius: var(--ds-radius); box-shadow: var(--ds-shadow-menu); }
html.ds3 .ds-menu-item {
    display: flex; align-items: center; gap: 8px; width: 100%;
    height: var(--ds-field-h); padding: 0 8px; border: 0; border-radius: var(--ds-radius);
    background: transparent; color: var(--ds-foreground);
    font-family: var(--ds-font); font-size: 15px; font-weight: 400; line-height: 22.5px;
    text-align: start; text-decoration: none; cursor: pointer;
}
html.ds3 .ds-menu-item .ds-icon { color: var(--ds-muted-foreground); }
html.ds3 .ds-menu-item:hover, html.ds3 .ds-menu-item:focus-visible { background: var(--ds-accent); outline: none; }
html.ds3 .ds-menu-sep { height: 1px; margin: 4px 0; background: var(--ds-border); border: 0; }
html.ds3 .ds-menu.is-entering { animation: ds-menu-in var(--ds-duration-slow) var(--ds-ease); }
@keyframes ds-menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* 7.2 Card (§6.4): 1px border, no shadow */
html.ds3 .ds-card { background: var(--ds-card); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); padding: 16px; }
html.ds3 .ds-card--flush { padding: 0; }
html.ds3 .ds-card-head { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; line-height: 22.5px; color: var(--ds-foreground); }
html.ds3 .ds-card--floating { background: var(--ds-sidebar); border: 0; border-radius: var(--ds-radius-xl); box-shadow: var(--ds-ring-inset), var(--ds-shadow-md); }
/* Rows inside a flush card: hairlines between them, no box per row. */
html.ds3 .ds-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 16px; border-top: 1px solid var(--ds-border); color: var(--ds-foreground); text-decoration: none; }
html.ds3 .ds-row:first-child { border-top: 0; }

/* 7.3 Stat strip (§6.4): selected = white + border; the others sit flat, split by vertical rules */
html.ds3 .ds-stats { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
html.ds3 .ds-stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid transparent; border-inline-start-color: var(--ds-border); }
html.ds3 .ds-stat:first-child, html.ds3 .ds-stat.is-selected, html.ds3 .ds-stat.is-selected + .ds-stat { border-inline-start-color: transparent; }
html.ds3 .ds-stat.is-selected { background: var(--ds-card); border-color: var(--ds-border); border-radius: var(--ds-radius-lg); }
html.ds3 .ds-stat-label { font-size: 13.5px; font-weight: 400; line-height: 20.25px; color: var(--ds-muted-foreground); }
html.ds3 .ds-stat-value { display: flex; align-items: center; gap: 8px; }
html.ds3 .ds-delta { display: inline-flex; align-items: center; gap: 2px; padding: 0 6px; border-radius: var(--ds-radius-sm); background: var(--ds-success-muted); color: var(--ds-success); font-size: 12px; font-weight: 500; line-height: 18px; direction: ltr; }
html.ds3 .ds-delta--down { background: var(--ds-muted); color: var(--ds-muted-foreground); }

/* 7.4 Tabs (§5.5): underline style */
html.ds3 .ds-tabs { display: flex; align-items: flex-end; border-bottom: 1px solid var(--ds-border); overflow-x: auto; scrollbar-width: none; }
html.ds3 .ds-tabs::-webkit-scrollbar { display: none; }
html.ds3 .ds-tab {
    flex-shrink: 0; height: var(--ds-field-h); padding: 0 12px; margin-bottom: -1px;
    border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--ds-meta-foreground);
    font-family: var(--ds-font); font-size: 14px; font-weight: 500; line-height: 21px;
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; text-decoration: none; cursor: pointer;
    transition: color var(--ds-duration-fast) var(--ds-ease), border-color var(--ds-duration-fast) var(--ds-ease);
}
html.ds3 .ds-tab:hover { color: var(--ds-foreground); }
html.ds3 .ds-tab.is-active, html.ds3 .ds-tab[aria-selected="true"] { color: var(--ds-foreground); border-bottom-color: var(--ds-foreground); }
html.ds3 .ds-tab:focus-visible { outline: none; box-shadow: var(--ds-focus-glow); border-radius: var(--ds-radius-sm); }

/* 7.5 Badges and status dots (§6.9) */
html.ds3 .ds-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--ds-radius-full); background: var(--ds-muted); color: var(--ds-muted-foreground); font-size: 12px; font-weight: 500; line-height: 18px; white-space: nowrap; }
html.ds3 .ds-badge--brand { background: var(--ds-brand-soft); color: var(--ds-brand); }
html.ds3 .ds-badge--success { background: var(--ds-success-muted); color: var(--ds-success); }
html.ds3 .ds-badge--warning { background: var(--ds-warning-muted); color: var(--ds-warning-foreground); }
html.ds3 .ds-badge--destructive { background: var(--ds-destructive-muted); color: var(--ds-destructive-hover); }
html.ds3 .ds-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
html.ds3 .ds-dot--live { background: var(--ds-live); box-shadow: 0 0 0 2px var(--ds-background); }
html.ds3 .ds-dot--notify { background: var(--ds-destructive); }
html.ds3 .ds-dot--brand { background: var(--ds-brand); }

/* 7.6 Empty state (§6.5) */
html.ds3 .ds-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 16px; }
html.ds3 .ds-empty-tile { width: 52px; height: 52px; margin-bottom: 16px; border-radius: var(--ds-radius-lg); background: var(--ds-muted); color: var(--ds-meta-foreground); display: flex; align-items: center; justify-content: center; }
html.ds3 .ds-empty-title { font-size: 15px; font-weight: 600; line-height: 22.5px; color: var(--ds-foreground); margin: 0 0 4px; }
html.ds3 .ds-empty-body { max-width: 320px; font-size: 14px; font-weight: 400; line-height: 21px; color: var(--ds-muted-foreground); margin: 0 0 16px; }
html.ds3 .ds-empty .ds-btn--link { margin-top: 16px; }

/* 7.7 Modal (§6.7): a scrim with no blur, an inset hairline, no outer border */
html.ds3 .ds-scrim { position: fixed; inset: 0; background: var(--ds-overlay); display: flex; align-items: center; justify-content: center; padding: 16px; }
html.ds3 .ds-modal { width: 100%; max-width: 480px; background: var(--ds-popover); border-radius: var(--ds-radius-lg); box-shadow: var(--ds-ring-inset), var(--ds-shadow-modal); padding: 24px; display: flex; flex-direction: column; gap: 8px; }
html.ds3 .ds-modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px; }

/* 7.8 Skeleton (§6.4) */
html.ds3 .ds-skeleton { height: 10px; border-radius: var(--ds-radius-full); background: var(--ds-muted); animation: ds-pulse 1.6s ease-in-out infinite; }
@keyframes ds-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

/* 7.9 Page title row (§5.1): title on the start side, the page's main button on the end side */
html.ds3 .ds-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
html.ds3 .ds-title-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
html.ds3 .ds-title-row-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Calm motion (§4.5): drop movement, keep opacity. */
@media (prefers-reduced-motion: reduce) {
    html.ds3 .ds-menu.is-entering, html.ds3 .ds-skeleton { animation: none; }
    html.ds3 .ds-btn, html.ds3 .ds-input, html.ds3 .ds-select, html.ds3 .ds-textarea, html.ds3 .ds-tab { transition: none; }
}

/* ── 8. Touch sizes (design.md §9): 44px targets, 16px field text (iOS zooms into smaller fields) ── */
@media (pointer: coarse) {
    html.ds3 { --ds-control-h: 44px; --ds-field-h: 44px; --ds-icon-btn: 44px; --ds-icon-btn-sm: 44px; }
    html.ds3 .ds-input, html.ds3 .ds-select, html.ds3 .ds-textarea { font-size: 16px; }
    html.ds3 .ds-btn--link { min-height: 44px; }
}
/* Phone widths get the same sizes whatever the browser says about its pointer. */
@media (max-width: 767px) {
    html.ds3 { --ds-gutter: 16px; --ds-control-h: 44px; --ds-field-h: 44px; --ds-icon-btn: 44px; --ds-icon-btn-sm: 44px; }
    html.ds3 .ds-input, html.ds3 .ds-select, html.ds3 .ds-textarea { font-size: 16px; }
    html.ds3 .ds-btn--link { min-height: 44px; }
    /* The page header stacks: title, then a full-width main button (§5.7). */
    html.ds3 .ds-title-row { flex-direction: column; align-items: stretch; gap: 12px; }
    html.ds3 .ds-title-row-actions .ds-btn--primary { flex: 1 1 auto; }
    /* Dialogs become bottom sheets. */
    html.ds3 .ds-scrim { align-items: flex-end; padding: 0; }
    html.ds3 .ds-modal { max-width: none; border-radius: var(--ds-radius-xl) var(--ds-radius-xl) 0 0; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}

/* ── 9. The bridge — released pages only (html.ds3-page) ───────────────
   Re-points today's shared tokens (--mono-*, --ct-*, --ty-* in
   tailwind.src.css) at the design.md values, so a page that already uses
   them moves most of the way without edits. An unreleased page inside the
   new frame (html.ds3-frame alone) is untouched. Each page ticket finishes
   its own page; nothing here targets a specific page. */
html.ds3-page {
    --mono-bg-page: var(--ds-background);
    --mono-bg-card: var(--ds-card);
    --mono-border: var(--ds-border);
    --mono-text-primary: var(--ds-foreground);
    --mono-text-secondary: var(--ds-muted-foreground);
    --mono-text-muted: var(--ds-placeholder);

    --ct-radius-sm: var(--ds-radius-sm);
    --ct-radius-md: var(--ds-radius-md);
    --ct-radius-lg: var(--ds-radius-lg);
    --ct-control-h: var(--ds-field-h);
    --ct-shadow-sm: none;
    --ct-shadow-md: var(--ds-shadow-menu);
    --ct-shadow-lg: var(--ds-shadow-modal);

    --ty-heading-size: 15px;     --ty-heading-weight: 500;     --ty-heading-lh: 1.5;
    --ty-body-size: 14px;        --ty-body-weight: 400;        --ty-body-lh: 1.5;
    --ty-body-strong-size: 14px; --ty-body-strong-weight: 500; --ty-body-strong-lh: 1.5;
    --ty-small-size: 13.5px;     --ty-small-weight: 400;       --ty-small-lh: 1.5;
    --ty-caption-size: 12px;     --ty-caption-weight: 400;     --ty-caption-lh: 1.5;
    --ty-badge-size: 12px;       --ty-badge-weight: 500;       --ty-badge-lh: 1.5;
    --ty-cta-size: 14px;         --ty-cta-weight: 500;
    --ty-cta-lg-size: 14px;
    --ty-label-size: 14px;       --ty-label-weight: 500;       --ty-label-lh: 1.5;
    --ty-input-size: 14px;       --ty-input-weight: 400;
    --ty-prompt-size: 14px;
    --ty-search-size: 14px;
    --ty-figure-size: 24px;      --ty-figure-weight: 500;      --ty-figure-lh: 1.45;
    --ty-hero-size: 26px;        --ty-hero-weight: 500;        --ty-hero-lh: 1.2;
}
/* Field text is 16px on phones, as today: iOS zooms into anything smaller. */
@media (max-width: 640px) {
    html.ds3-page { --ty-input-size: 16px; --ty-prompt-size: 16px; --ty-search-size: 16px; }
}
/* The page's own content takes the new font; the frame takes it in #DS-2. */
html.ds3-page #main-content { font-family: var(--ds-font); -webkit-font-smoothing: antialiased; }

/* 9.1 The setup / settings side panel (views/partials/account-settings-shell.ejs, design.md §5.4
   "secondary navigation"): 248px, a back link, a title, 32px rows. Shown beside «الهوية»,
   «جهّز حسابك من موقعك», «المنتجات» and every account settings page, so it lives here and
   not in one page's stylesheet. It draws from its own --as-* tokens. */
html.ds3-page .as-shell {
    --as-accent-ink: var(--ds-foreground);
    --as-tint: var(--ds-sidebar-accent);
    --as-ink: var(--ds-foreground);
    --as-ink-2: var(--ds-muted-foreground);
    --as-ink-3: var(--ds-meta-foreground);
    --as-icon: var(--ds-muted-foreground);
    --as-line: var(--ds-border-subtle);
    --as-side-bg: var(--ds-sidebar);
    --as-hover: var(--ds-accent);
}
html.ds3-page .as-side,
html.ds3-page .as-bar { font-family: var(--ds-font); }
html.ds3-page .as-back { min-height: 32px; padding: 0 8px; gap: 6px; border-radius: var(--ds-radius); font-size: 14px; font-weight: 400; color: var(--ds-muted-foreground); }
html.ds3-page .as-back svg { width: 16px; height: 16px; stroke-width: 1.5; }
html.ds3-page .as-side-title { margin: 16px 0 8px; padding: 0 8px; font-size: 18px; font-weight: 500; line-height: 27px; letter-spacing: 0; color: var(--ds-foreground-strong); }
html.ds3-page .as-group { margin-top: 12px; }
html.ds3-page .as-group-label { padding: 0 8px; font-size: 11px; font-weight: 500; color: var(--ds-meta-foreground); }
html.ds3-page .as-item { min-height: 32px; padding: 0 8px; gap: 9px; border-radius: var(--ds-radius-lg); font-size: 14px; font-weight: 400; line-height: 21px; color: var(--ds-foreground); }
html.ds3-page .as-item.is-active,
html.ds3-page .as-item.is-active:hover { background: var(--ds-sidebar-accent); color: var(--ds-foreground); font-weight: 500; }
html.ds3-page .as-ic svg { width: 16px; height: 16px; stroke-width: 1.5; }
html.ds3-page .as-item.is-active .as-ic svg { color: var(--ds-foreground); }
html.ds3-page .as-item:focus-visible,
html.ds3-page .as-back:focus-visible,
html.ds3-page .as-open:focus-visible,
html.ds3-page .as-close:focus-visible { outline: none; box-shadow: var(--ds-focus-glow); }
html.ds3-page .as-close { width: var(--ds-icon-btn); height: var(--ds-icon-btn); border-radius: var(--ds-radius); color: var(--ds-meta-foreground); }
@media (min-width: 1024px) {
    html.ds3-page .as-side { padding: 12px 10px 24px; border-inline-end: 1px solid var(--ds-border-subtle); }
}
@media (max-width: 1023.98px) {
    html.ds3-page .as-open {
        min-height: 44px; padding: 0 12px; border: 1px solid transparent; border-radius: var(--ds-radius-md); background: var(--ds-muted);
        color: var(--ds-foreground); font-size: 13.5px; font-weight: 500; box-shadow: none;
    }
    html.ds3-page .as-open svg { width: 16px; height: 16px; stroke-width: 1.5; }
    html.ds3-page .as-scrim { background: var(--ds-overlay); }
    html.ds3-page .as-side { box-shadow: none; border-inline-end: 1px solid var(--ds-border-subtle); }
    html.ds3-page .as-side .as-item,
    html.ds3-page .as-back,
    html.ds3-page .as-close { min-height: 44px; }
    html.ds3-page .as-close { width: 44px; height: 44px; }
}

/* Emoji → line icon (owner 2026-11-26). A restyled page prints both: the old emoji in
   .ds-emoji and the new icon as svg.ds-swap with the hidden attribute (dsIcon in
   server/ds3ViewHelpers.js, SahalDS3.icon in page scripts). Only here does the icon
   show, so dark mode and a page whose switch is off keep the emoji. */
html.ds3-page .ds-emoji { display: none !important; }
html.ds3-page svg.ds-swap { display: inline-block; vertical-align: -0.15em; }
/* the same pair for the shared pieces (#DS-S: dsIconShared / SahalDS3.iconShared), under their own switch */
html.ds3-shared .ds-emoji-s { display: none !important; }
html.ds3-shared svg.ds-swap-s { display: inline-block; vertical-align: -0.15em; }

/* ── 10. The app frame — html.ds3-frame (#DS-2, design.md §5) ──────────
   Restyle only: every element, id, class hook and click handler of
   views/layout.ejs stays; these rules change how the frame looks.
   Today's frame carries many inline styles and !important rules (colours
   are printed inline per active state), so !important is used here where a
   rule must beat them.

   10.1 widths · 10.2 sidebar shell and head · 10.3 brand switcher ·
   10.4 «رابطي» card · 10.5 rows (groups, items, tools, favourites) ·
   10.6 foot · 10.7 collapsed rail · 10.8 phone bar · 10.9 phone menu */

/* 10.1 Widths (§5.1): 248px open, 56px rail. --sb-w is the layout's own variable. */
@media (min-width: 1024px) {
    html.ds3-frame body.has-sidebar { --sb-w: 248px; }
    html.ds3-frame body.has-sidebar.sidebar-collapsed { --sb-w: 56px; }
    html.ds3-frame body:not(.sidebar-collapsed) .desktop-sidebar > * { min-width: 247px; }
}

/* 10.2 Shell and head. Owner 11-30: the sidebar keeps its colour from before the new
   frame (--ds-sidebar-shell, as in layout.ejs), not design.md's grey. The token is re-pointed here, so
   anything inside the sidebar that matches its background (the bell dots' ring) follows. */
html.ds3-frame .desktop-sidebar {
    --ds-sidebar: var(--ds-sidebar-shell);
    background: var(--ds-sidebar) !important; border: 0 !important; border-inline-end: 1px solid var(--ds-border-subtle) !important; box-shadow: none !important;
    font-family: var(--ds-font) !important; color: var(--ds-foreground); -webkit-font-smoothing: antialiased;
}
html.ds3-frame .desktop-sidebar :where(a, button, span, div, p, h1, h2, h3, input, label) { font-family: var(--ds-font) !important; }
html.ds3-frame .desktop-sidebar .sb-head { padding: 12px 10px 8px !important; border-bottom: 0 !important; min-height: 0; }
/* the collapse button sits at the head's far corner; the row leaves it room */
html.ds3-frame .desktop-sidebar .sb-head-row { margin-bottom: 0 !important; padding-inline: 8px 40px; min-height: 30px; }
html.ds3-frame body:not(.sidebar-collapsed) .desktop-sidebar .sidebar-toggle-btn { top: 12px !important; left: 10px !important; }
html.ds3-frame .desktop-sidebar .sb-head h1 { font-size: 16px !important; font-weight: 500 !important; line-height: 24px !important; color: var(--ds-foreground-strong) !important; }
html.ds3-frame .desktop-sidebar .sb-head h1 a { color: inherit !important; }
html.ds3-frame .desktop-sidebar .sb-head > p { padding-inline: 8px; font-size: 12px !important; line-height: 18px !important; color: var(--ds-muted-foreground) !important; }
html.ds3-frame .desktop-sidebar .theme-toggle-btn,
html.ds3-frame .desktop-sidebar .sidebar-toggle-btn {
    width: var(--ds-icon-btn) !important; height: var(--ds-icon-btn) !important; padding: 0 !important;
    border: 0 !important; border-radius: var(--ds-radius) !important; background: transparent !important; box-shadow: none !important;
    color: var(--ds-meta-foreground) !important; display: inline-flex; align-items: center; justify-content: center;
}
html.ds3-frame .desktop-sidebar .theme-toggle-btn:hover,
html.ds3-frame .desktop-sidebar .sidebar-toggle-btn:hover { background: var(--ds-accent) !important; color: var(--ds-foreground) !important; }
html.ds3-frame .desktop-sidebar .theme-toggle-btn svg,
html.ds3-frame .desktop-sidebar .sidebar-toggle-btn svg { width: 16px !important; height: 16px !important; stroke-width: 1.5; }
html.ds3-frame .desktop-sidebar :where(a, button):focus-visible { outline: none !important; box-shadow: var(--ds-focus-glow) !important; }

/* 10.3 Brand switcher (§5.2-1): 44px, radius 10, ghost hover — no card */
html.ds3-frame .desktop-sidebar .sb-brand { padding: 0 10px 8px !important; border: 0 !important; }
html.ds3-frame .desktop-sidebar .brand-switcher-btn,
html.ds3-frame .desktop-sidebar .sb-ident-btn,
html.ds3-frame .desktop-sidebar .sb-ident-link {
    min-height: 44px; padding: 6px 8px !important; border: 0 !important; border-radius: var(--ds-radius-md) !important;
    background: transparent !important; box-shadow: none !important; color: var(--ds-foreground) !important;
}
html.ds3-frame .desktop-sidebar .brand-switcher-btn:hover,
html.ds3-frame .desktop-sidebar .sb-ident-btn:hover,
html.ds3-frame .desktop-sidebar .sb-ident-link:hover,
html.ds3-frame .desktop-sidebar .sb-ident > div:has(> .sb-ident-home:hover) > .sb-ident-btn { background: var(--ds-accent) !important; }
/* the home link over the logo + name (more than one brand, layout.ejs .sb-ident-home): the button's radius for its focus glow */
html.ds3-frame .desktop-sidebar .sb-ident-home { border-radius: var(--ds-radius-md); }
html.ds3-frame .desktop-sidebar #currentBrandName,
html.ds3-frame .desktop-sidebar .sb-ident-name { font-size: 16px !important; font-weight: 400 !important; line-height: 21px !important; color: var(--ds-foreground) !important; }
html.ds3-frame .desktop-sidebar #brandDropdownArrow, html.ds3-frame .desktop-sidebar .sb-ident-arrow { color: var(--ds-meta-foreground) !important; }
html.ds3-frame .desktop-sidebar #brandDropdown { border: 1px solid var(--ds-border) !important; border-radius: var(--ds-radius) !important; box-shadow: var(--ds-shadow-menu) !important; background: var(--ds-popover) !important; }

/* The «رحلة البداية» entry (views/partials/sidebar-setup-resume.ejs): a white card (1px border,
   radius 12), with the brand dot instead of today's terracotta one. */
html.ds3-frame .desktop-sidebar .sb-resume { padding: 4px 10px 0 !important; }
html.ds3-frame .desktop-sidebar .qs-resume-card {
    min-height: 44px; padding: 6px 8px; gap: 10px; border: 1px solid var(--ds-border-subtle); border-radius: var(--ds-radius-lg);
    background: var(--ds-background); color: var(--ds-foreground); font-family: var(--ds-font);
}
html.ds3-frame .desktop-sidebar .qs-resume-card:hover { background: var(--ds-background); border-color: var(--ds-border-active); }
html.ds3-frame .desktop-sidebar .qs-resume-card:focus-visible { outline: none; box-shadow: var(--ds-focus-glow); }
html.ds3-frame .desktop-sidebar .qs-resume-card-ic { width: 28px; height: 28px; border-radius: var(--ds-radius); background: var(--ds-muted); }
html.ds3-frame .desktop-sidebar .qs-resume-card-ic img { width: 16px; height: 16px; }
html.ds3-frame .desktop-sidebar .qs-resume-card-dot { background: var(--ds-brand); box-shadow: 0 0 0 2px var(--ds-background); }
html.ds3-frame .desktop-sidebar .qs-resume-card-title { font-size: 14px; font-weight: 500; line-height: 21px; color: var(--ds-foreground-strong); }
html.ds3-frame .desktop-sidebar .qs-resume-card-sub { font-size: 12px; line-height: 18px; color: var(--ds-muted-foreground); }
html.ds3-frame .desktop-sidebar .qs-resume-card-arrow { width: 14px; height: 14px; color: var(--ds-meta-foreground); stroke-width: 1.5; }
@media (min-width: 1024px) {
    /* in the rail: a 36px tile like the «رابطي» card */
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sb-resume { padding: 4px 0 0 !important; display: flex; justify-content: center; }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .qs-resume-card { width: 36px; min-height: 36px; height: 36px; padding: 0; gap: 0; justify-content: center; }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .qs-resume-card-ic { background: transparent; }
}

/* 10.5 Rows (§5.2-3, §5.4)
   A group header and a direct link are primary rows: 34px, radius 8, a 20px icon tile.
   A page inside a group is a secondary row: 32px, a plain 16px icon. */
html.ds3-frame .desktop-sidebar .sidebar-scroll { padding: 4px 10px 8px !important; }
html.ds3-frame .desktop-sidebar .sidebar-group { margin-bottom: 2px !important; border-radius: var(--ds-radius) !important; }
html.ds3-frame .desktop-sidebar .sidebar-group-header,
html.ds3-frame .desktop-sidebar .sb-direct > .sidebar-item,
html.ds3-frame .desktop-sidebar .helper-tool {
    display: flex !important; align-items: center; gap: 10px !important; width: 100%;
    min-height: 34px; height: 34px; padding: 0 8px !important; margin: 0 0 2px !important;
    border: 0 !important; border-radius: var(--ds-radius) !important; background: transparent !important; box-shadow: none !important;
    color: var(--ds-muted-foreground) !important; text-decoration: none; cursor: pointer;
    transition: background-color var(--ds-duration-fast) var(--ds-ease) !important;
}
html.ds3-frame .desktop-sidebar .sidebar-group-header:hover,
html.ds3-frame .desktop-sidebar .sb-direct > .sidebar-item:hover,
html.ds3-frame .desktop-sidebar .helper-tool:hover { background: var(--ds-sidebar-accent) !important; color: var(--ds-foreground) !important; }
/* the label */
html.ds3-frame .desktop-sidebar .sidebar-group-header > span.flex-1 > span,
html.ds3-frame .desktop-sidebar .sidebar-item .flex-1 > div,
html.ds3-frame .desktop-sidebar .helper-tool .tool-text {
    font-size: 14px !important; font-weight: 500 !important; line-height: 21px !important; color: inherit !important; letter-spacing: 0 !important;
}
/* the icon tile: 20px, radius 6, a 12px icon */
html.ds3-frame .desktop-sidebar .sb-group-ico,
html.ds3-frame .desktop-sidebar .sb-direct .sb-ico,
html.ds3-frame .desktop-sidebar .tool-icon-box {
    width: 20px !important; height: 20px !important; min-width: 20px; border-radius: var(--ds-radius-sm) !important;
    background: var(--ds-muted) !important; border: 0 !important; box-shadow: none !important;
    color: var(--ds-muted-foreground) !important; display: flex !important; align-items: center; justify-content: center;
}
html.ds3-frame .desktop-sidebar .sb-group-ico svg,
html.ds3-frame .desktop-sidebar .sb-direct .sb-ico svg,
html.ds3-frame .desktop-sidebar .tool-icon-box .tool-icon { width: 12px !important; height: 12px !important; color: inherit !important; stroke-width: 2; }
html.ds3-frame .desktop-sidebar .sb-direct > .sidebar-item > .flex { gap: 10px !important; width: 100%; }
html.ds3-frame .desktop-sidebar .helper-tool > .flex { gap: 10px !important; width: 100%; }
/* The «المفضلة» rail star (.sb-rail-fav) is a .helper-tool too, so the display:flex !important above
   would show it in the open sidebar as an empty grey tile; it belongs to the collapsed rail only
   (sidebar-rail.css). */
html.ds3-frame body:not(.sidebar-collapsed) .desktop-sidebar .sb-rail-fav { display: none !important; }
/* active: label in the text colour, row filled, tile in the brand colour with a white icon */
html.ds3-frame .desktop-sidebar .sidebar-group.active-group > .sidebar-group-header,
html.ds3-frame .desktop-sidebar .sb-direct > .sidebar-item.active { color: var(--ds-foreground) !important; }
html.ds3-frame .desktop-sidebar .sb-direct > .sidebar-item.active { background: var(--ds-sidebar-accent) !important; }
html.ds3-frame .desktop-sidebar .sidebar-group.active-group > .sidebar-group-header .sb-group-ico,
html.ds3-frame .desktop-sidebar .sb-direct > .sidebar-item.active .sb-ico { background: var(--ds-brand) !important; color: var(--ds-brand-foreground) !important; }
html.ds3-frame .desktop-sidebar .sidebar-item.active::before { display: none !important; }
html.ds3-frame .desktop-sidebar .sidebar-group-header .group-chevron { width: 12px; height: 12px; color: var(--ds-meta-foreground) !important; stroke-width: 2; }
/* secondary rows: the pages of a group */
html.ds3-frame .desktop-sidebar .sidebar-group-content .sidebar-item {
    display: flex !important; align-items: center; min-height: 32px; height: 32px; padding: 0 8px !important; margin: 0 0 2px !important;
    border: 0 !important; border-radius: var(--ds-radius-lg) !important; background: transparent !important; box-shadow: none !important;
    color: var(--ds-muted-foreground) !important; text-decoration: none;
}
/* today's favourite star sits at the row's end on hover: keep its room */
html.ds3-frame .desktop-sidebar .sb-fav-wrap > .sidebar-item { padding-inline-end: 40px !important; }
html.ds3-frame .desktop-sidebar .sidebar-group-content .sidebar-item > .flex { gap: 9px !important; width: 100%; }
html.ds3-frame .desktop-sidebar .sidebar-group-content .sidebar-item .flex-1 > div { font-weight: 400 !important; }
html.ds3-frame .desktop-sidebar .sidebar-group-content .sidebar-item:hover { background: var(--ds-sidebar-accent) !important; color: var(--ds-foreground) !important; }
html.ds3-frame .desktop-sidebar .sidebar-group-content .sidebar-item.active { background: var(--ds-sidebar-accent) !important; color: var(--ds-foreground) !important; }
html.ds3-frame .desktop-sidebar .sidebar-group-content .sidebar-item.active .flex-1 > div { font-weight: 500 !important; }
html.ds3-frame .desktop-sidebar .sidebar-group-content .sb-ico { width: 20px !important; height: 20px !important; min-width: 20px; background: transparent !important; border-radius: 0 !important; color: inherit !important; }
html.ds3-frame .desktop-sidebar .sidebar-group-content .sb-ico svg { width: 16px !important; height: 16px !important; color: inherit !important; stroke-width: 1.5; }
/* section titles: overline (§5.4) */
html.ds3-frame .desktop-sidebar .sb-tools,
html.ds3-frame .desktop-sidebar #sidebarFavSection { margin-top: 8px !important; padding-top: 8px !important; border-top: 1px solid var(--ds-border-subtle) !important; }
html.ds3-frame .desktop-sidebar .sb-section-title { margin-bottom: 4px !important; padding: 0 8px; gap: 6px !important; }
html.ds3-frame .desktop-sidebar .sb-section-title > span { font-size: 11px !important; font-weight: 500 !important; line-height: 16.5px !important; color: var(--ds-meta-foreground) !important; opacity: .8; }
html.ds3-frame .desktop-sidebar .sb-section-title > svg { display: none; }

/* 10.6 Foot: the dark-mode row and the account button become ghost rows (§5.2-5) */
html.ds3-frame .desktop-sidebar .sb-foot { padding: 8px 10px 10px !important; border-top: 1px solid var(--ds-border-subtle) !important; background: transparent !important; }
html.ds3-frame .desktop-sidebar .sb-foot > div { border: 0 !important; margin-bottom: 2px !important; padding: 0 !important; }
html.ds3-frame .desktop-sidebar .dark-theme-sidebar-btn {
    min-height: 34px; padding: 0 8px !important; border: 0 !important; border-radius: var(--ds-radius) !important;
    background: transparent !important; box-shadow: none !important; color: var(--ds-muted-foreground) !important;
}
html.ds3-frame .desktop-sidebar .dark-theme-sidebar-btn:hover { background: var(--ds-sidebar-accent) !important; color: var(--ds-foreground) !important; }
html.ds3-frame .desktop-sidebar .dark-theme-sidebar-btn > div:first-child { gap: 10px !important; }
html.ds3-frame .desktop-sidebar .dark-theme-sidebar-btn > div:first-child > div { width: 20px !important; height: 20px !important; border-radius: var(--ds-radius-sm) !important; background: var(--ds-muted) !important; color: var(--ds-muted-foreground); }
html.ds3-frame .desktop-sidebar .dark-theme-sidebar-btn > div:first-child > div svg { width: 12px; height: 12px; }
html.ds3-frame .desktop-sidebar .dark-theme-sidebar-btn > div:first-child > span { font-size: 14px !important; font-weight: 500 !important; line-height: 21px; color: inherit !important; }
html.ds3-frame .desktop-sidebar .dark-theme-sidebar-btn .theme-toggle-track { background: var(--ds-muted-hover) !important; }
html.ds3-frame .desktop-sidebar #accountMenuBtn {
    min-height: 40px; padding: 4px 8px !important; border: 0 !important; border-radius: var(--ds-radius-md) !important;
    background: transparent !important; box-shadow: none !important; color: var(--ds-foreground) !important;
}
html.ds3-frame .desktop-sidebar #accountMenuBtn:hover { background: var(--ds-accent) !important; }
html.ds3-frame .desktop-sidebar #accountMenuBtn .ty-body-strong { font-size: 14px !important; font-weight: 400 !important; line-height: 21px !important; color: var(--ds-foreground) !important; }

/* 10.7 Collapsed rail (§5.3): 56px, icon tiles only, centred, same order.
   The active page gets a brand tile and a 2px brand bar on the outer edge.
   Tooltips and the open/close motion are today's (public/css/sidebar-rail.css). */
@media (min-width: 1024px) {
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sb-head { padding: 0 !important; min-height: 84px !important; }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sidebar-toggle-btn { top: 10px !important; left: 13px !important; }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sb-rail-logo { top: 44px !important; width: 36px; height: 36px; border-radius: var(--ds-radius-md); }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sb-rail-logo img { width: 24px; height: 24px; }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sb-ident { padding: 46px 10px 8px !important; }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sb-brand { padding: 0 10px 8px !important; }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar #brandSwitcherBtn,
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sb-ident-link { width: 36px; min-height: 36px; padding: 0 !important; justify-content: center; }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sidebar-scroll { padding: 4px 10px 8px !important; }

    /* group headers fold away, as today */
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sidebar-group-header { height: 0 !important; min-height: 0 !important; margin: 0 !important; }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sidebar-group { margin-bottom: 0 !important; }

    /* every row is a centred 36px row holding one tile */
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sidebar-item,
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sb-direct > .sidebar-item,
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .helper-tool,
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sb-rail-fav {
        position: relative; width: 36px !important; height: 34px; min-height: 34px; padding: 0 !important; justify-content: center;
        border-radius: var(--ds-radius) !important;
    }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sb-fav-wrap > .sidebar-item { padding-inline-end: 0 !important; }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sidebar-item > .flex,
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .helper-tool > .flex { gap: 0 !important; justify-content: center; width: auto; }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sidebar-item .flex-1,
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .helper-tool .flex-1 { flex: 0 0 0px !important; width: 0; }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sidebar-group-content .sb-ico {
        border-radius: var(--ds-radius-sm) !important; background: var(--ds-muted) !important; color: var(--ds-muted-foreground) !important;
    }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sidebar-group-content .sb-ico svg { width: 12px !important; height: 12px !important; stroke-width: 2; }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sidebar-item.active .sb-ico { background: var(--ds-brand) !important; color: var(--ds-brand-foreground) !important; }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sidebar-item.active::before {
        content: "" !important; display: block !important; position: absolute; top: 7px !important; bottom: 7px !important;
        inset-inline-start: 0 !important; inset-inline-end: auto !important; width: 2px !important; height: auto !important;
        border-radius: 2px; background: var(--ds-brand) !important; opacity: 1 !important; transform: none !important;
    }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sidebar-group + .sidebar-group::before,
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sb-direct::before { right: 0; left: 0; background: var(--ds-border-subtle); }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sb-tools,
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar #sidebarFavSection { margin-top: 4px !important; padding-top: 6px !important; }

    /* foot */
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .sb-foot { padding: 8px 10px 10px !important; }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar .dark-theme-sidebar-btn { width: 36px !important; height: 34px; min-height: 34px; padding: 0 !important; justify-content: center !important; }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar #accountMenuBtn { width: 36px !important; min-height: 44px; padding: 0 !important; display: flex; justify-content: center; }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar #accountMenuBtn > .flex { gap: 0 !important; justify-content: center; }
    html.ds3-frame body.sidebar-collapsed .desktop-sidebar #accountMenuBtn .flex-1 { flex: 0 0 0px !important; width: 0; }
}

/* 10.8 Phone bar (§5.7 and the owner's header map)
   The 48px bar keeps its height (pages are offset by it) and its buttons.
   On a page marked "no header" (html.ds3-hdr-none: the studios, voice-over,
   inbox, the رابطي editor) it loses its title and its line: the menu button
   and the theme button stay, and the page reads as one surface. */
@media (max-width: 1023px) {
    html.ds3-frame body > header.lg\:hidden { background: var(--ds-background) !important; border-bottom: 1px solid var(--ds-border-subtle) !important; box-shadow: none !important; font-family: var(--ds-font) !important; }
    html.ds3-frame body > header.lg\:hidden > div { padding-inline: 6px !important; }
    html.ds3-frame body > header.lg\:hidden .hamburger-btn,
    html.ds3-frame body > header.lg\:hidden .mobile-theme-toggle {
        width: 44px !important; height: 44px !important; padding: 0 !important; border: 0 !important; border-radius: var(--ds-radius) !important;
        background: transparent !important; box-shadow: none !important; color: var(--ds-foreground) !important;
        display: inline-flex !important; align-items: center; justify-content: center;
    }
    html.ds3-frame body > header.lg\:hidden .mobile-theme-toggle { color: var(--ds-meta-foreground) !important; }
    html.ds3-frame body > header.lg\:hidden .hamburger-btn svg { width: 20px !important; height: 20px !important; color: inherit !important; }
    html.ds3-frame body > header.lg\:hidden .hamburger-btn svg path { stroke-width: 1.5; }
    html.ds3-frame body > header.lg\:hidden .mobile-theme-toggle svg { width: 18px !important; height: 18px !important; stroke-width: 1.5; }
    html.ds3-frame body > header.lg\:hidden .mobile-header-title { font-family: var(--ds-font) !important; font-size: 15px !important; font-weight: 500 !important; letter-spacing: 0 !important; color: var(--ds-foreground) !important; }
    html.ds3-frame.ds3-hdr-none body > header.lg\:hidden { border-bottom-color: transparent !important; }
    html.ds3-frame.ds3-hdr-none body > header.lg\:hidden .mobile-header-title { visibility: hidden; }
}

/* 10.9 Phone menu (§5.7): the sidebar as a drawer from the right, same rows, 44px tall.
   Owner 11-30: it keeps its colour from before the new frame (white), like the desktop sidebar. */
html.ds3-frame #mobileMenu { --ds-sidebar: var(--ds-background); background: var(--ds-sidebar) !important; box-shadow: var(--ds-shadow-lg) !important; font-family: var(--ds-font) !important; color: var(--ds-foreground); }
html.ds3-frame #mobileMenu :where(a, button, span, div, p, h2) { font-family: var(--ds-font) !important; }
html.ds3-frame #mobileMenu .mobile-menu-scroll > div:first-child { padding: 14px 18px 10px !important; border-bottom: 0 !important; }
html.ds3-frame #mobileMenu .mobile-menu-scroll > div:first-child h2 { font-size: 16px !important; font-weight: 500 !important; line-height: 24px; color: var(--ds-foreground-strong) !important; }
html.ds3-frame #mobileMenu .mobile-menu-scroll > div:first-child p { font-size: 12px !important; line-height: 18px; color: var(--ds-muted-foreground) !important; }
html.ds3-frame #mobileMenu nav { padding: 4px 10px 12px !important; }
html.ds3-frame #mobileMenu nav > * + * { margin-top: 2px !important; }
/* rows */
html.ds3-frame #mobileMenu [data-mobile-group-header],
html.ds3-frame #mobileMenu .mobile-menu-item {
    min-height: 44px; padding: 0 8px !important; margin: 0 !important; border: 0 !important; border-radius: var(--ds-radius) !important;
    background: transparent !important; box-shadow: none !important; color: var(--ds-muted-foreground) !important;
    display: flex !important; align-items: center; width: 100%; text-decoration: none;
}
html.ds3-frame #mobileMenu [data-mobile-group-header] > * + *,
html.ds3-frame #mobileMenu .mobile-menu-item > .flex > * + * { margin-inline: 10px 0 !important; }
html.ds3-frame #mobileMenu .mobile-menu-item > .flex { width: 100%; }
html.ds3-frame #mobileMenu [data-mobile-group-header] .flex-1 > span,
html.ds3-frame #mobileMenu .mobile-menu-item .flex-1 > div,
html.ds3-frame #mobileMenu .mobile-menu-item > span { font-size: 15px !important; font-weight: 500 !important; line-height: 22.5px !important; color: inherit !important; }
html.ds3-frame #mobileMenu .mobile-group-content .mobile-menu-item .flex-1 > div { font-weight: 400 !important; }
/* tiles */
html.ds3-frame #mobileMenu [data-mobile-group-header] > span:first-of-type,
html.ds3-frame #mobileMenu .mobile-menu-item .w-8 {
    width: 24px !important; height: 24px !important; min-width: 24px; border-radius: var(--ds-radius-sm) !important;
    background: var(--ds-muted) !important; color: var(--ds-muted-foreground) !important;
}
html.ds3-frame #mobileMenu [data-mobile-group-header] > span:first-of-type svg,
html.ds3-frame #mobileMenu .mobile-menu-item .w-8 svg,
html.ds3-frame #mobileMenu .mobile-menu-item .w-8 img { width: 14px !important; height: 14px !important; color: inherit !important; }
html.ds3-frame #mobileMenu .mobile-group-content .mobile-menu-item .w-8 { background: transparent !important; }
html.ds3-frame #mobileMenu .mobile-group-content .mobile-menu-item .w-8 svg { width: 18px !important; height: 18px !important; stroke-width: 1.5; }
html.ds3-frame #mobileMenu .mobile-group-content > div { padding-inline-start: 0 !important; padding-right: 0 !important; }
html.ds3-frame #mobileMenu .mobile-group-chevron { width: 14px !important; height: 14px !important; color: var(--ds-meta-foreground) !important; }
/* active: the row fills, the label takes the text colour, a group's tile takes the brand colour */
html.ds3-frame #mobileMenu .sahal-active-bg { background: var(--ds-sidebar-accent) !important; color: var(--ds-foreground) !important; }
html.ds3-frame #mobileMenu [data-mobile-group-header].sahal-active-bg { background: transparent !important; }
html.ds3-frame #mobileMenu [data-mobile-group-header].sahal-active-bg > span:first-of-type { background: var(--ds-brand) !important; color: var(--ds-brand-foreground) !important; }
html.ds3-frame #mobileMenu .sahal-active-text { color: var(--ds-foreground) !important; }
html.ds3-frame #mobileMenu .sahal-active-icon-bg { background: transparent !important; color: var(--ds-foreground) !important; }
/* the pinned account block */
html.ds3-frame #mobileMenu .mobile-account-pin { background: var(--ds-sidebar) !important; border-top: 1px solid var(--ds-border-subtle) !important; padding: 8px 10px max(10px, env(safe-area-inset-bottom)) !important; }
html.ds3-frame #mobileMenu .mobile-account-pin button { border: 0 !important; background: transparent !important; box-shadow: none !important; border-radius: var(--ds-radius-md) !important; }

/* ── 11. The notifications bell — html.ds3-frame.ds3-bell (#DS-3, design.md §5.2) ──
   The bell replaces «إنتاجاتي» while its switch is on inside the frame. The panel is
   the «إنتاجاتي» drawer with two parts (public/js/shared/notifications-bell.js):
   generations (untouched cards) and notices. Everything here needs BOTH classes, so
   the frame alone, dark mode and today's design keep «إنتاجاتي» exactly as it is.
   11.1 the bell · 11.2 what it replaces · 11.3 the panel · 11.4 notices */

/* 11.1 The bell: a 30px icon button beside the collapse toggle; 44px in the phone bar */
html.ds3-frame.ds3-bell .ds-bell {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: var(--ds-icon-btn); height: var(--ds-icon-btn); padding: 0; border: 0; border-radius: var(--ds-radius);
    background: transparent; color: var(--ds-meta-foreground); cursor: pointer;
    transition: background var(--ds-duration-fast) ease, color var(--ds-duration-fast) ease;
}
html.ds3-frame.ds3-bell .ds-bell:hover { background: var(--ds-accent); color: var(--ds-foreground); }
html.ds3-frame.ds3-bell .ds-bell:focus-visible { outline: none; box-shadow: var(--ds-focus-glow); }
html.ds3-frame.ds3-bell .ds-bell .ds-icon { width: 16px; height: 16px; }
html.ds3-frame.ds3-bell .ds-bell--sidebar { position: absolute; top: 12px; left: 44px; z-index: 2; }
html.ds3-frame.ds3-bell .desktop-sidebar .sb-head-row { padding-inline-end: 74px; }
/* With the identity block on (sidebar_identity_block_enabled) the block IS the header: its brand
   button stops before the toggle + bell instead of running under the bell (owner 11-30: the bell
   covered the brand arrow), and the two icons sit centred on the brand row. The block's side
   padding matches the rows under it (10px), which gives back part of the width. */
@media (min-width: 1024px) {
    html.ds3-frame.ds3-bell body:not(.sidebar-collapsed) .desktop-sidebar .sb-ident { padding-inline: 10px !important; }
    html.ds3-frame.ds3-bell body:not(.sidebar-collapsed) .desktop-sidebar .sb-ident > .sb-ident-link,
    html.ds3-frame.ds3-bell body:not(.sidebar-collapsed) .desktop-sidebar .sb-ident > div > #brandSwitcherBtn { width: calc(100% - 68px); }
    /* the home link over the logo + name follows the button, less its 31px arrow end */
    html.ds3-frame.ds3-bell body:not(.sidebar-collapsed) .desktop-sidebar .sb-ident > div > .sb-ident-home { width: calc(100% - 68px - 31px); }
    html.ds3-frame.ds3-bell body:not(.sidebar-collapsed) .desktop-sidebar .sb-ident > .sidebar-toggle-btn,
    html.ds3-frame.ds3-bell body:not(.sidebar-collapsed) .desktop-sidebar .sb-ident > .ds-bell--sidebar { top: 24px !important; }
}
html.ds3-frame.ds3-bell .ds-bell-dot {
    position: absolute; width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 2px var(--ds-sidebar);
    font-size: 0; line-height: 0; pointer-events: none;
}
html.ds3-frame.ds3-bell .ds-bell-dot[hidden] { display: none; }
html.ds3-frame.ds3-bell .ds-bell-dot--notice { top: 4px; inset-inline-start: 5px; background: var(--ds-destructive); }
html.ds3-frame.ds3-bell .ds-bell-dot--active { bottom: 4px; inset-inline-end: 5px; background: var(--ds-warning); animation: ds-bell-live 1.6s ease-in-out infinite; }
html.ds3-frame.ds3-bell .ds-bell-dot--ready { bottom: 4px; inset-inline-end: 5px; background: var(--ds-live); }
@keyframes ds-bell-live { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { html.ds3-frame.ds3-bell .ds-bell-dot--active { animation: none; } }
@media (min-width: 1024px) {
    /* the rail: the bell gets its own row under the mark / the brand tile */
    html.ds3-frame.ds3-bell body.sidebar-collapsed .ds-bell--sidebar { top: 88px; left: 13px; }
    html.ds3-frame.ds3-bell body.sidebar-collapsed .desktop-sidebar .sb-head { min-height: 124px !important; }
    /* the rail hides the old header's other children (public/css/sidebar-rail.css): not the bell */
    html.ds3-frame.ds3-bell body.sidebar-collapsed .desktop-sidebar .sb-head > .ds-bell { opacity: 1 !important; visibility: visible !important; max-height: none !important; }
    html.ds3-frame.ds3-bell body.sidebar-collapsed .desktop-sidebar .sb-ident { padding-bottom: 44px !important; }
}
@media (max-width: 1023px) {
    html.ds3-frame.ds3-bell .ds-bell--phone { width: 44px; height: 44px; color: var(--ds-meta-foreground); flex-shrink: 0; }
    html.ds3-frame.ds3-bell .ds-bell--phone .ds-icon { width: 18px; height: 18px; }
    html.ds3-frame.ds3-bell .ds-bell--phone .ds-bell-dot { box-shadow: 0 0 0 2px var(--ds-background); }
    html.ds3-frame.ds3-bell .ds-bell--phone .ds-bell-dot--notice { top: 10px; inset-inline-start: 11px; }
    html.ds3-frame.ds3-bell .ds-bell--phone .ds-bell-dot--active,
    html.ds3-frame.ds3-bell .ds-bell--phone .ds-bell-dot--ready { bottom: 10px; inset-inline-end: 11px; }
}

/* 11.2 What the bell replaces: the «إنتاجاتي» row (sidebar and phone menu), its floating
   button and its docked phone button. They stay in the page (their scripts keep running). */
html.ds3-frame.ds3-bell .desktop-sidebar .helper-tool[data-rail-label="إنتاجاتي"],
html.ds3-frame.ds3-bell #mobileMenu .mobile-menu-item[onclick*="openAiCenterDrawer"],
html.ds3-frame.ds3-bell #aiCenterContainer,
html.ds3-frame.ds3-bell #mobileHeaderAiSlot { display: none !important; }

/* 11.3 The panel (design.md §6.4 drawer): white, hairline, radius 12, no glass */
html.ds3-frame.ds3-bell #aiCenterDrawer { background: var(--ds-overlay) !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
html.ds3-frame.ds3-bell #aiCenterDrawerContent {
    background: var(--ds-popover) !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
    border: 1px solid var(--ds-border) !important; border-radius: var(--ds-radius-lg) !important; box-shadow: var(--ds-shadow-modal) !important;
    font-family: var(--ds-font) !important; color: var(--ds-foreground); display: flex; flex-direction: column;
}
html.ds3-frame.ds3-bell #aiCenterDrawerContent > div:first-of-type { padding: 16px 16px 12px !important; border-bottom: 0 !important; }
html.ds3-frame.ds3-bell #aiCenterDrawerContent h2 { font-size: 0 !important; line-height: 0 !important; letter-spacing: 0 !important; }
html.ds3-frame.ds3-bell #aiCenterDrawerContent h2::after {
    content: "الإشعارات"; font-family: var(--ds-font); font-size: 18px; line-height: 27px; font-weight: 500; color: var(--ds-foreground-strong);
}
html.ds3-frame.ds3-bell #aiCenterDrawerContent > div:first-of-type > p { display: none; }
html.ds3-frame.ds3-bell #closeAiDrawer {
    width: var(--ds-icon-btn) !important; height: var(--ds-icon-btn) !important; border-radius: var(--ds-radius) !important;
    background: transparent !important; color: var(--ds-meta-foreground) !important;
}
html.ds3-frame.ds3-bell #closeAiDrawer:hover { background: var(--ds-accent) !important; color: var(--ds-foreground) !important; }
html.ds3-frame.ds3-bell #closeAiDrawer svg { stroke-width: 1.5; }
html.ds3-frame.ds3-bell #markAllReadBtn {
    height: 28px; padding: 0 10px !important; border-radius: var(--ds-radius) !important; background: var(--ds-muted) !important;
    color: var(--ds-foreground) !important; font-family: var(--ds-font); font-size: 12.5px !important; font-weight: 500 !important;
}
html.ds3-frame.ds3-bell #aiCenterDrawer[data-ds-part="notices"] #markAllReadBtn { display: none !important; }
/* the two parts: underline tabs (§6.3) */
html.ds3-frame.ds3-bell .ds-bell-parts { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--ds-border); flex-shrink: 0; }
html.ds3-frame.ds3-bell .ds-bell-part {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent;
    background: transparent; color: var(--ds-muted-foreground); font-family: var(--ds-font); font-size: 14px; font-weight: 500; cursor: pointer;
}
html.ds3-frame.ds3-bell .ds-bell-part:hover { color: var(--ds-foreground); }
html.ds3-frame.ds3-bell .ds-bell-part.is-active { color: var(--ds-foreground); border-bottom-color: var(--ds-foreground); }
html.ds3-frame.ds3-bell .ds-bell-part:focus-visible { outline: none; box-shadow: var(--ds-focus-glow); border-radius: var(--ds-radius-sm); }
html.ds3-frame.ds3-bell .ds-bell-count {
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--ds-radius-full); background: var(--ds-destructive); color: var(--ds-destructive-foreground);
    font-family: "Inter", var(--ds-font); font-size: 11px; line-height: 18px; font-weight: 600; text-align: center; direction: ltr;
}
html.ds3-frame.ds3-bell .ds-bell-count[hidden] { display: none; }
/* the generations part: «إنتاجاتي»'s own filter (جارية / مكتملة / الكل) as a quiet segmented row */
html.ds3-frame.ds3-bell #aiCenterTabs { padding: 12px 16px 8px !important; }
html.ds3-frame.ds3-bell #aiCenterTabs > div { background: var(--ds-muted) !important; border-radius: var(--ds-radius-md) !important; padding: 3px !important; gap: 2px !important; }
html.ds3-frame.ds3-bell #aiCenterDrawerContent .ai-tab {
    height: 28px; padding: 0 8px !important; border-radius: 7px !important; background: transparent !important; box-shadow: none !important;
    color: var(--ds-muted-foreground) !important; font-family: var(--ds-font); font-size: 13px !important; font-weight: 500 !important;
}
html.ds3-frame.ds3-bell #aiCenterDrawerContent .ai-tab.active { background: var(--ds-background) !important; color: var(--ds-foreground) !important; box-shadow: var(--ds-shadow-xs) !important; }
html.ds3-frame.ds3-bell #aiCenterListWrap { height: auto !important; flex: 1 1 auto; min-height: 0; }
html.ds3-frame.ds3-bell #aiCenterDrawer[data-ds-part="notices"] #aiCenterTabs,
html.ds3-frame.ds3-bell #aiCenterDrawer[data-ds-part="notices"] #bulkActionsBar,
html.ds3-frame.ds3-bell #aiCenterDrawer[data-ds-part="notices"] #aiCenterListWrap { display: none !important; }

/* 11.4 Notices: a title, one line, a time; unread ones carry a dot (§6.5: an empty list is one line) */
html.ds3-frame.ds3-bell #aiCenterDrawer[data-ds-part="notices"] .ds-notices { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
html.ds3-frame.ds3-bell .ds-notices-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 8px 16px 4px; }
html.ds3-frame.ds3-bell .ds-notices-hint { font-size: 12.5px; line-height: 18px; color: var(--ds-muted-foreground); }
html.ds3-frame.ds3-bell .ds-notices-readall {
    height: 28px; padding: 0 10px; border: 0; border-radius: var(--ds-radius); background: var(--ds-muted); color: var(--ds-foreground);
    font-family: var(--ds-font); font-size: 12.5px; font-weight: 500; cursor: pointer; flex-shrink: 0;
}
html.ds3-frame.ds3-bell .ds-notices-readall[hidden] { display: none; }
html.ds3-frame.ds3-bell .ds-notices-readall:hover { background: var(--ds-muted-hover); }
html.ds3-frame.ds3-bell .ds-notices-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 8px 12px; }
html.ds3-frame.ds3-bell .ds-notices-empty { margin: 0; padding: 28px 16px; text-align: center; font-size: 14px; line-height: 21px; color: var(--ds-muted-foreground); }
html.ds3-frame.ds3-bell .ds-notice {
    display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px 8px; border: 0; border-radius: var(--ds-radius-md);
    background: transparent; color: var(--ds-foreground); font-family: var(--ds-font); text-align: start; text-decoration: none; cursor: pointer;
}
html.ds3-frame.ds3-bell .ds-notice:hover { background: var(--ds-accent); }
html.ds3-frame.ds3-bell .ds-notice:focus-visible { outline: none; box-shadow: var(--ds-focus-glow); }
html.ds3-frame.ds3-bell .ds-notice + .ds-notice { margin-top: 2px; }
html.ds3-frame.ds3-bell .ds-notice-ico {
    display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--ds-radius);
    background: var(--ds-muted); color: var(--ds-muted-foreground); flex-shrink: 0;
}
html.ds3-frame.ds3-bell .ds-notice-ico .ds-icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
html.ds3-frame.ds3-bell .ds-notice-ico--failure { background: var(--ds-destructive-muted); color: var(--ds-destructive-hover); }
html.ds3-frame.ds3-bell .ds-notice-ico--points { background: var(--ds-warning-muted); color: var(--ds-warning-foreground); }
html.ds3-frame.ds3-bell .ds-notice-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
html.ds3-frame.ds3-bell .ds-notice-title { font-size: 14px; line-height: 21px; font-weight: 500; color: var(--ds-foreground-strong); }
html.ds3-frame.ds3-bell .ds-notice:not(.is-unread) .ds-notice-title { font-weight: 400; color: var(--ds-foreground); }
html.ds3-frame.ds3-bell .ds-notice-body { font-size: 13px; line-height: 19.5px; color: var(--ds-muted-foreground); }
html.ds3-frame.ds3-bell .ds-notice-time { font-size: 12px; line-height: 18px; color: var(--ds-meta-foreground); }
html.ds3-frame.ds3-bell .ds-notice-dot { width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--ds-brand); flex-shrink: 0; }
@media (max-width: 767px) {
    html.ds3-frame.ds3-bell .ds-bell-part { height: 44px; font-size: 15px; }
    html.ds3-frame.ds3-bell .ds-notice { padding: 12px 8px; }
    html.ds3-frame.ds3-bell .ds-notices-readall, html.ds3-frame.ds3-bell #markAllReadBtn { height: 36px; }
    html.ds3-frame.ds3-bell #aiCenterDrawerContent .ai-tab { height: 36px; }
    html.ds3-frame.ds3-bell #closeAiDrawer { width: 44px !important; height: 44px !important; }
}

/* ── 12. The floating getting-started card — html.ds3-frame.ds3-gs (#DS-4, design.md §7.2) ──
   Replaces the «رحلتك مع سهل» window while its switch is on inside the frame
   (public/js/shared/getting-started-card.js, views/partials/getting-started-card.ejs).
   It never blocks the page: a 340px card in the bottom corner opposite the sidebar,
   or a 44px round button when minimised. Needs BOTH classes. */
html.ds3-frame.ds3-gs .ds-gs:not([hidden]) {
    position: fixed; z-index: 45; left: 64px; bottom: 20px; font-family: var(--ds-font); color: var(--ds-foreground);
    pointer-events: none; /* only its own boxes take clicks */
}
html.ds3-frame.ds3-gs .ds-gs-panel:not([hidden]) {
    pointer-events: auto; width: 340px; max-width: calc(100vw - 32px); max-height: calc(100vh - 96px); overflow-y: auto; padding: 16px;
    background: var(--ds-popover); border-radius: var(--ds-radius-xl); box-shadow: var(--ds-shadow-floating);
    animation: ds-gs-in var(--ds-duration-slow) var(--ds-ease) both;
}
@keyframes ds-gs-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { html.ds3-frame.ds3-gs .ds-gs-panel:not([hidden]) { animation: none; } }
html.ds3-frame.ds3-gs .ds-gs-head { display: flex; align-items: flex-start; gap: 4px; }
html.ds3-frame.ds3-gs .ds-gs-head-text { flex: 1 1 auto; min-width: 0; }
html.ds3-frame.ds3-gs .ds-gs-title { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; color: var(--ds-foreground-strong); }
html.ds3-frame.ds3-gs .ds-gs-count { margin: 0; font-size: 13px; line-height: 19.5px; color: var(--ds-muted-foreground); }
html.ds3-frame.ds3-gs .ds-gs-icon-btn {
    display: inline-flex; align-items: center; justify-content: center; width: var(--ds-icon-btn-sm); height: var(--ds-icon-btn-sm); padding: 0; border: 0;
    border-radius: var(--ds-radius); background: transparent; color: var(--ds-meta-foreground); cursor: pointer; flex-shrink: 0;
}
html.ds3-frame.ds3-gs .ds-gs-icon-btn:hover { background: var(--ds-accent); color: var(--ds-foreground); }
html.ds3-frame.ds3-gs .ds-gs-icon-btn:focus-visible,
html.ds3-frame.ds3-gs .ds-gs-step:focus-visible,
html.ds3-frame.ds3-gs .ds-gs-fab:focus-visible,
html.ds3-frame.ds3-gs .ds-gs-dismiss:focus-visible,
html.ds3-frame.ds3-gs .ds-gs-celebrate-btn:focus-visible { outline: none; box-shadow: var(--ds-focus-glow); }
html.ds3-frame.ds3-gs .ds-gs-why { margin: 10px 0 8px; font-size: 13.5px; line-height: 20.25px; color: var(--ds-muted-foreground); }
html.ds3-frame.ds3-gs .ds-gs-steps { list-style: none; margin: 0 -6px; padding: 0; }
html.ds3-frame.ds3-gs .ds-gs-steps > li[hidden] { display: none; }
html.ds3-frame.ds3-gs .ds-gs-step {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 6px; border: 0; border-radius: var(--ds-radius);
    background: transparent; color: var(--ds-foreground); font-family: var(--ds-font); font-size: 14px; line-height: 21px; font-weight: 400; text-align: start; cursor: pointer;
}
html.ds3-frame.ds3-gs .ds-gs-step:hover { background: var(--ds-accent); }
html.ds3-frame.ds3-gs .ds-gs-step-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
html.ds3-frame.ds3-gs .ds-gs-when { font-size: 12px; line-height: 18px; color: var(--ds-muted-foreground); }
html.ds3-frame.ds3-gs .ds-gs-when[hidden] { display: none; }
/* the mark: an empty ring; the next step's ring is the brand colour; a finished step is a filled brand check */
html.ds3-frame.ds3-gs .ds-gs-mark {
    display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%;
    border: 1.5px solid var(--ds-border-active); color: transparent; flex-shrink: 0;
}
html.ds3-frame.ds3-gs .ds-gs-mark .ds-icon { width: 12px; height: 12px; stroke-width: 2.5; }
html.ds3-frame.ds3-gs .ds-gs-step[data-state="active"] .ds-gs-mark { border-color: var(--ds-brand); }
html.ds3-frame.ds3-gs .ds-gs-step[data-state="active"] .ds-gs-label { font-weight: 500; color: var(--ds-foreground-strong); }
html.ds3-frame.ds3-gs .ds-gs-step[data-state="done"] .ds-gs-mark { border-color: var(--ds-brand); background: var(--ds-brand); color: var(--ds-brand-foreground); }
html.ds3-frame.ds3-gs .ds-gs-step[data-state="done"] .ds-gs-label { color: var(--ds-meta-foreground); text-decoration: line-through; }
html.ds3-frame.ds3-gs .ds-gs-step[data-state="locked"] .ds-gs-label { color: var(--ds-muted-foreground); }
html.ds3-frame.ds3-gs .ds-gs-go, html.ds3-frame.ds3-gs .ds-gs-lock { width: 14px; height: 14px; color: var(--ds-meta-foreground); flex-shrink: 0; display: none; }
html.ds3-frame.ds3-gs .ds-gs-step[data-state="active"] .ds-gs-go,
html.ds3-frame.ds3-gs .ds-gs-step[data-state="open"] .ds-gs-go { display: inline-block; }
html.ds3-frame.ds3-gs .ds-gs-step[data-state="active"] .ds-gs-go { color: var(--ds-brand); }
html.ds3-frame.ds3-gs .ds-gs-step[data-state="locked"] .ds-gs-lock { display: inline-block; }
html.ds3-frame.ds3-gs .ds-gs-msg { margin: 6px 0 0; padding: 6px 10px; border-radius: var(--ds-radius); background: var(--ds-warning-muted); color: var(--ds-warning-foreground); font-size: 13px; line-height: 19.5px; }
html.ds3-frame.ds3-gs .ds-gs-msg[hidden] { display: none; }
html.ds3-frame.ds3-gs .ds-gs-gain { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--ds-border-subtle); font-size: 13px; line-height: 19.5px; color: var(--ds-muted-foreground); }
html.ds3-frame.ds3-gs .ds-gs-dismiss {
    display: inline-block; margin-top: 6px; padding: 4px 0; border: 0; background: transparent; color: var(--ds-meta-foreground);
    font-family: var(--ds-font); font-size: 12.5px; line-height: 18px; cursor: pointer; border-radius: var(--ds-radius-sm);
}
html.ds3-frame.ds3-gs .ds-gs-dismiss:hover { color: var(--ds-foreground); text-decoration: underline; }
/* the celebration (the roadmap's own words) */
html.ds3-frame.ds3-gs .ds-gs-celebrate:not([hidden]) { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0 4px; text-align: center; }
html.ds3-frame.ds3-gs .ds-gs-badge { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--ds-brand); color: var(--ds-brand-foreground); }
html.ds3-frame.ds3-gs .ds-gs-badge .ds-icon { width: 20px; height: 20px; stroke-width: 2; }
html.ds3-frame.ds3-gs .ds-gs-celebrate h3 { margin: 6px 0 0; font-size: 16px; line-height: 24px; font-weight: 600; color: var(--ds-foreground-strong); }
html.ds3-frame.ds3-gs .ds-gs-celebrate p { margin: 0; font-size: 13.5px; line-height: 20.25px; color: var(--ds-muted-foreground); }
html.ds3-frame.ds3-gs .ds-gs-celebrate-btn {
    margin-top: 8px; height: var(--ds-control-h); padding: 0 14px; border: 0; border-radius: var(--ds-radius-md); background: var(--ds-brand); color: var(--ds-brand-foreground);
    font-family: var(--ds-font); font-size: 14px; font-weight: 500; cursor: pointer;
}
html.ds3-frame.ds3-gs .ds-gs-celebrate-btn:hover { background: var(--ds-brand-hover); }
/* minimised: a 44px round button with a brand dot while steps remain */
html.ds3-frame.ds3-gs .ds-gs-fab:not([hidden]) {
    pointer-events: auto; position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0;
    border-radius: 50%; background: var(--ds-popover); color: var(--ds-foreground); box-shadow: var(--ds-shadow-floating); cursor: pointer;
}
html.ds3-frame.ds3-gs .ds-gs-fab:hover { background: var(--ds-muted); }
html.ds3-frame.ds3-gs .ds-gs-fab .ds-icon { width: 18px; height: 18px; }
html.ds3-frame.ds3-gs .ds-gs-fab-dot { position: absolute; top: 2px; inset-inline-start: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--ds-brand); box-shadow: 0 0 0 2px var(--ds-popover); }
html.ds3-frame.ds3-gs .ds-gs-fab-dot[hidden] { display: none; }
@media (max-width: 767px) {
    /* phones: full width above the bottom edge; 44px rows */
    html.ds3-frame.ds3-gs .ds-gs:not([hidden]) { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
    html.ds3-frame.ds3-gs .ds-gs[data-view="min"]:not([hidden]) { right: auto; left: 64px; }
    html.ds3-frame.ds3-gs .ds-gs-panel:not([hidden]) { width: auto; max-width: none; max-height: calc(100vh - 120px); }
    html.ds3-frame.ds3-gs .ds-gs-step { min-height: 44px; font-size: 15px; }
    html.ds3-frame.ds3-gs .ds-gs-icon-btn { width: 44px; height: 44px; }
    html.ds3-frame.ds3-gs .ds-gs-celebrate-btn { height: 44px; }
    html.ds3-frame.ds3-gs .ds-gs-dismiss { padding: 12px 0; font-size: 14px; }
}

