/* «بتلات» (petals): the site-wide look the teacher chose on 2026-11-06 (mockup: .superpowers/design/redesign,
   direction ج). It is the SHAPE only: a floating rounded sidebar, soft tinted page headers, pill buttons, rounder
   cards with a soft glow, one gradient (the primary button, the chosen tab and filter chip), calm tables and
   dialogs, and one page-open motion. Every colour still comes from the active design's tokens (tokens.css ×
   html[data-design] × html.dark), so «المظهر» recolours all of it.
   Scope: the teacher app (.t-app, .t-modal, .t-menu) and the student screens (.st-view, .dlg-scrim). The login
   screens (#modal-student-login, #modal-teacher-auth) and the install prompt are never styled here.
   Loaded last (after tw.css). Rules start with `html[data-design]` (or `html`) so they outrank design-d/e. */

/* ===================== tokens of the look ===================== */
html {
    --pt-r-card: 24px; --pt-r-dlg: 28px; --pt-r-ctl: 14px;
    --pt-grad: linear-gradient(to left, var(--primary), color-mix(in srgb, var(--primary) 72%, var(--deep)));
    --pt-on: var(--on-primary);
    --pt-head: linear-gradient(105deg, color-mix(in srgb, var(--primary) 9%, var(--surface)), color-mix(in srgb, var(--accent) 8%, var(--surface)));
    --pt-glow: 0 1px 2px color-mix(in srgb, var(--primary) 6%, transparent), 0 14px 32px -18px color-mix(in srgb, var(--primary) 38%, transparent);
    --pt-lift: 0 10px 22px -10px color-mix(in srgb, var(--primary) 60%, transparent);
    --pt-ease: cubic-bezier(.2, .8, .2, 1);
}
html[data-design="d"], html:not([data-design]) { --pt-grad: var(--d-btn); --pt-on: #FFFFFF; }
html[data-design="e"] { --pt-grad: var(--e-btn); --pt-on: #FFFFFF; }
html.dark {
    --pt-head: linear-gradient(105deg, color-mix(in srgb, var(--primary) 20%, var(--surface)), color-mix(in srgb, var(--accent) 12%, var(--surface)));
    --pt-glow: 0 1px 2px rgb(0 0 0 / .35), 0 16px 32px -18px rgb(0 0 0 / .7);
    --pt-lift: 0 10px 22px -12px rgb(0 0 0 / .7);
}

/* ===================== teacher: sidebar (a floating panel on a laptop) ===================== */
@media (min-width: 1024px) {
    html[data-design] .t-app { --side: 280px; }
    html[data-design] .t-app[data-rail] { --side: 100px; }
    html[data-design] .t-app .t-side {
        top: 16px; height: calc(100vh - 32px); height: calc(100dvh - 32px); margin: 16px; margin-inline-end: 0;
        border: 1px solid var(--card-border); border-radius: var(--pt-r-card);
        background: color-mix(in srgb, var(--surface) 90%, transparent); box-shadow: var(--pt-glow);
        -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); padding: 18px 14px 14px;
    }
}
/* the brand block: a plain title beside the gradient logo (design د / هـ used a gradient bar here) */
html[data-design] .t-app .t-brand { background: none; box-shadow: none; padding: 2px 4px 14px; border-radius: 0; border-block-end: 1px solid var(--border); }
html[data-design] .t-app .t-brand-t b { color: var(--text); font-weight: 800; }
html[data-design] .t-app .t-brand-t small { color: var(--muted); }
html[data-design] .t-app .t-logo { background: var(--pt-grad); border: 0; color: var(--pt-on); border-radius: 14px; box-shadow: var(--pt-lift); }
html[data-design] .t-app .t-brand .t-icon-btn, html[data-design] .t-app .t-brand .theme-toggle, html[data-design] .t-app .t-brand .btn-ghost { background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
html[data-design] .t-app .t-brand .t-icon-btn:hover, html[data-design] .t-app .t-brand .btn-ghost:hover:not(:disabled) { background: var(--tint); color: var(--on-tint); }
/* the tabs: a calm list, the chosen one is the gradient pill */
html[data-design] .t-app .t-nav { gap: 3px; }
html[data-design] .t-app .t-nav a { border-radius: var(--pt-r-ctl); color: var(--muted); transition: background-color .18s, color .18s, box-shadow .18s; }
html[data-design] .t-app .t-nav a:hover { background: var(--surface-2); color: var(--text); }
html[data-design] .t-app .t-nav a[aria-current="page"] { background: var(--pt-grad); color: var(--pt-on); box-shadow: var(--pt-lift); }
html[data-design] .t-app .t-nav a[aria-current="page"] i { color: var(--pt-on); }
html[data-design] .t-app .t-nav a[aria-current="page"] .t-badge { background: var(--pt-on); color: var(--primary); }
html[data-design] .t-app .t-foot { border-block-start-color: var(--border); }
html[data-design] .t-app .t-me .av { background: var(--tint); color: var(--on-tint); }
/* below 1024px the sidebar is the top bar: keep it calm, the tabs a row of pills */
@media (max-width: 1023.98px) {
    html[data-design] .t-app .t-side { background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-block-end: 1px solid var(--card-border); box-shadow: 0 8px 20px -18px color-mix(in srgb, var(--primary) 60%, transparent); }
    html[data-design] .t-app .t-brand { border-block-end: 0; padding: 0 var(--s4); margin-block-end: 0; }
    html[data-design] .t-app .t-nav { padding-block: 2px 10px; }
    html[data-design] .t-app .t-nav a { border-radius: var(--r-pill); }
}

/* ===================== teacher: the pane ===================== */
@media (min-width: 1024px) { html[data-design] .t-app .t-pane { padding: 32px 36px 120px; } }
/* a 1366px laptop: the floating sidebar and the pane give the tables back the room they had before */
@media (min-width: 1024px) and (max-width: 1439.98px) {
    html[data-design] .t-app { --side: 256px; }
    html[data-design] .t-app .t-side { margin: 12px; margin-inline-end: 0; top: 12px; height: calc(100vh - 24px); height: calc(100dvh - 24px); }
    html[data-design] .t-app .t-pane { padding: 24px 24px 120px; }
}
/* page header: a soft tinted card (no strong gradient bar), dark title, normal buttons */
html[data-design] .t-app .t-ph {
    background: var(--pt-head); border: 1px solid var(--card-border); border-radius: var(--pt-r-card);
    padding: 20px 26px; align-items: center; min-height: 88px; box-shadow: none;
}
html[data-design] .t-app .t-ph h1 { color: var(--text); font-weight: 900; font-size: 28.5px; line-height: 1.3; }
html[data-design] .t-app .t-ph p { color: var(--muted); font-size: 16px; margin-block-start: 2px; }
html[data-design] .t-app .t-ph .btn-ghost { background: var(--surface); border: 1px solid var(--card-border); color: var(--text); }
html[data-design] .t-app .t-ph .btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
html[data-design] .t-app .t-ph .btn-primary { background: var(--pt-grad); color: var(--pt-on); box-shadow: var(--pt-lift); }
html[data-design] .t-app .t-ph .t-ph-acts { color: var(--text); }
html[data-design] .t-app .t-ph .se-now { background: var(--surface); color: var(--on-tint); border: 1px solid var(--card-border); }
html.dark[data-design] .t-app .t-ph .se-now { color: var(--text); }
@media (max-width: 767.98px) {
    html[data-design] .t-app .t-ph { padding: 14px 16px; min-height: 0; border-radius: 20px; }
    html[data-design] .t-app .t-ph h1 { font-size: 24px; }
    html[data-design] .t-app .t-ph .t-ph-acts { min-width: 0; max-width: 100%; }
    html[data-design] .t-app .t-ph .se-now { white-space: normal; max-width: 100%; }
}

/* cards: rounder, a soft glow instead of a grey shadow */
html[data-design] .t-app .card, html[data-design] .st-view .card { border-radius: var(--pt-r-card); border: 1px solid var(--card-border); box-shadow: var(--pt-glow); }
html[data-design] .t-app .t-panel-h h2 { font-weight: 800; font-size: 18px; }
html[data-design] .t-app .t-panel-h h2 i { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--tint); color: var(--primary); font-size: 20px; }
html.dark[data-design] .t-app .t-panel-h h2 i { color: var(--on-tint); }

/* stat cards: the number leads, the icon sits in a soft round badge (each design keeps its own card colours) */
html[data-design] .t-app .t-kpis { gap: 16px; }
html[data-design] .t-app .t-kpi { padding: 18px 20px; gap: 14px; min-height: 96px; }
html[data-design] .t-app .t-kpi .ic { width: 48px; height: 48px; border-radius: 50%; font-size: 26.5px; }
html[data-design] .t-app .t-kpi b { font-size: 29.5px; font-weight: 900; line-height: 1.15; letter-spacing: -.01em; }
html[data-design] .t-app .t-kpi > div > span { font-size: 15px; margin-block-start: 2px; }
@media (max-width: 767.98px) {
    html[data-design] .t-app .t-kpis { gap: 10px; }
    html[data-design] .t-app .t-kpi { padding: 12px 14px; min-height: 0; gap: 10px; }
    html[data-design] .t-app .t-kpi .ic { width: 38px; height: 38px; font-size: 22px; }
    html[data-design] .t-app .t-kpi b { font-size: 23px; }
}

/* ===================== buttons, chips, fields (one anatomy everywhere) ===================== */
html[data-design] :is(.t-app, .t-modal, .st-view, .dlg-scrim) .btn { border-radius: var(--r-pill); }
html[data-design] :is(.t-app, .t-modal, .st-view, .dlg-scrim) .btn.btn-icon,
html[data-design] :is(.t-app, .t-modal) .t-icon-btn { border-radius: 50%; }
html[data-design] :is(.t-app, .t-modal, .st-view, .dlg-scrim) .btn-primary { background: var(--pt-grad); color: var(--pt-on); box-shadow: var(--pt-lift); }
html[data-design] :is(.t-app, .t-modal, .st-view, .dlg-scrim) .btn-primary:not(:disabled):hover { filter: brightness(1.06); }
html[data-design] :is(.t-app, .t-modal, .st-view, .dlg-scrim) .btn-ghost { background: var(--surface); border-color: var(--card-border); }
html[data-design] :is(.t-app, .t-modal, .st-view, .dlg-scrim) .btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
html[data-design] :is(.t-app, .t-modal) .t-btn-danger { border-radius: var(--r-pill); }
html[data-design] :is(.t-app, .t-modal) .ap-btn { border-radius: var(--r-pill); }
html[data-design] :is(.t-app, .t-modal) .ap-btn--primary { background: var(--pt-grad); color: var(--pt-on); }
/* filter chips: the chosen one is the gradient */
html[data-design] :is(.t-app, .t-modal) .fchip { border-color: var(--card-border); }
html[data-design] :is(.t-app, .t-modal) .fchip[aria-pressed="true"], html[data-design] :is(.t-app, .t-modal) .fchip[aria-checked="true"] { background: var(--pt-grad); border-color: transparent; color: var(--pt-on); box-shadow: var(--pt-lift); }
/* fields and the search box: pill outline, a soft focus ring */
html[data-design] :is(.t-app, .t-modal) .t-toolbar .field { border-radius: var(--r-pill); border-width: 1px; border-color: var(--card-border); }
html[data-design] :is(.t-app, .t-modal) .field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent); }
html[data-design] .t-modal .ap-input:focus, html[data-design] .t-modal .t-txt:focus, html[data-design] .t-app .ap-input:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent); }
/* switches: a little larger, the gradient when on */
html[data-design] :is(.t-app, .t-modal) .t-sw[aria-checked="true"], html[data-design] :is(.t-app, .t-modal) .t-sw-row[aria-checked="true"] .t-sw { background: var(--pt-grad); }
/* keyboard focus is always visible */
html[data-design] :is(.t-app, .t-modal, .t-menu, .st-view, .dlg-scrim) :is(a, button, input, select, textarea, [tabindex]):focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }

/* ===================== tables ===================== */
html[data-design] .t-app .t-tbl th { background: var(--surface-2); color: var(--muted); font-weight: 700; height: 44px; }
html[data-design] .t-app .t-tbl thead th:first-child { border-start-start-radius: 14px; border-end-start-radius: 14px; }
html[data-design] .t-app .t-tbl thead th:last-child { border-start-end-radius: 14px; border-end-end-radius: 14px; }
html[data-design] .t-app .t-tbl th { border-block-end: 0; }
html[data-design] .t-app .t-tbl td { height: 56px; }
html[data-design] .t-app .t-tbl tbody tr:hover, html[data-design] .t-app .t-tbl tbody tr.sel { background: color-mix(in srgb, var(--tint) 55%, transparent); }
html[data-design] .t-app .t-tbl .av { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--card-border); }
html[data-design] .t-app .st { height: 26px; font-weight: 600; }
/* the ranking rows (design د draws them as bordered pills: keep that, rounder) */
html[data-design] .t-app .t-rk li { border-radius: 16px; }
html[data-design] .t-app .bar { border-radius: var(--r-pill); }

/* ===================== settings ===================== */
@media (min-width: 1024px) {
    html[data-design] .t-app .t-subnav { background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--pt-r-card); padding: 8px; box-shadow: var(--pt-glow); }
    html[data-design] .t-app .t-subnav a { border-radius: var(--pt-r-ctl); color: var(--muted); }
    html[data-design] .t-app .t-subnav a[aria-current="page"] { background: var(--tint); color: var(--on-tint); box-shadow: none; font-weight: 800; }
    html[data-design] .t-app .t-subnav a[aria-current="page"] i { color: inherit; }
}
@media (max-width: 1023.98px) {
    html[data-design] .t-app .t-subnav a { border-color: var(--card-border); }
    html[data-design] .t-app .t-subnav a[aria-current="page"] { background: var(--pt-grad); border-color: transparent; color: var(--pt-on); }
    html[data-design] .t-app .t-subnav a[aria-current="page"] i { color: var(--pt-on); }
}
html[data-design] .t-app .t-spanel > h2 { font-weight: 800; font-size: 20px; }

/* ===================== dialogs and the row menu ===================== */
html[data-design] .t-modal .t-dlg { border-radius: var(--pt-r-dlg); border: 1px solid var(--card-border); box-shadow: 0 30px 80px -24px rgb(20 5 30 / .45); }
html.dark[data-design] .t-modal .t-dlg { box-shadow: 0 30px 80px -24px rgb(0 0 0 / .75); }
html[data-design] .t-modal .t-dlg-h h3 { font-weight: 800; }
html[data-design] .t-modal .t-dlg-h h3 > i:first-child { width: 40px; height: 40px; flex: none; border-radius: 50%; display: inline-grid; place-items: center; background: var(--tint); color: var(--primary); font-size: 24px; }
html.dark[data-design] .t-modal .t-dlg-h h3 > i:first-child { color: var(--on-tint); }
html[data-design] .t-modal .t-dlg .t-sec { border-radius: 18px; }
html[data-design] .t-menu { border-radius: 20px; border-color: var(--card-border); }
html[data-design] .t-menu li button { border-radius: 12px; }
html[data-design] .t-app .t-bulk { border-radius: var(--r-pill); }

/* ===================== the student's screens ===================== */
html[data-design] .st-view .ch-top { border-radius: var(--pt-r-card); }
html[data-design] .st-view .eqcard { border-radius: var(--pt-r-card); }
html[data-design] .st-view .ans { border-radius: 20px; }
html[data-design] .st-view .chip { border-radius: var(--r-pill); }
/* the bottom tab bar floats as a rounded glass bar above the home indicator */
html[data-design] .st-view { padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }
html[data-design] .st-view #st-nav {
    inset-inline: 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); max-width: 616px;
    border: 1px solid var(--card-border); border-radius: var(--pt-r-card); padding-block: 4px;
    background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    box-shadow: 0 14px 34px -14px color-mix(in srgb, var(--primary) 45%, transparent);
}
html.dark[data-design] .st-view #st-nav { box-shadow: 0 14px 34px -14px rgb(0 0 0 / .8); }
html[data-design] .st-view #st-nav button[aria-current="page"] .pill { background: var(--pt-grad); color: var(--pt-on); box-shadow: var(--pt-lift); }
html[data-design] .st-view #st-nav button[aria-current="page"] .pill i { color: var(--pt-on); }
/* the student's windows (a right answer, a new certificate, a message) */
html[data-design] .dlg-scrim .dlg, html[data-design] .dlg-scrim .lcard { border-radius: var(--pt-r-dlg); }
html[data-design] .st-view .st-panel:not(.hidden) { animation: ptIn .32s var(--pt-ease) both; }

/* ===================== the math symbols pad (math-pad.js: teacher bank form, homework questions and answers) =====
   Same keys, groups and behaviour; only the shape. Keys stay ≥ 44px (48px on a touch screen). */
html[data-design] .math-pad-toggle {
    border-radius: var(--r-pill); background: var(--surface); color: var(--text); border: 1px solid var(--card-border);
    font-weight: 800; display: inline-flex; align-items: center; gap: 8px; box-shadow: var(--pt-glow);
}
html[data-design] .math-pad-toggle i { color: var(--primary); font-size: 22px; }
html.dark[data-design] .math-pad-toggle i { color: var(--on-tint); }
html[data-design] .math-pad-toggle[aria-expanded="true"] { background: var(--pt-grad); color: var(--pt-on); border-color: transparent; box-shadow: var(--pt-lift); }
html[data-design] .math-pad-toggle[aria-expanded="true"] i { color: var(--pt-on); }
html[data-design] .math-pad {
    margin-top: 10px; padding: 14px; gap: 12px; border-radius: 20px;
    background: var(--pt-head); border: 1px solid var(--card-border); box-shadow: var(--pt-glow);
}
html[data-design] .math-pad-label { font-size: 14.5px; font-weight: 800; color: var(--muted); margin-bottom: 6px; }
html[data-design] .math-pad-keys { gap: 8px; }
html[data-design] .math-key {
    border-radius: var(--pt-r-ctl); background: var(--surface); color: var(--text); border: 1px solid var(--card-border);
    font-weight: 700; box-shadow: 0 2px 0 color-mix(in srgb, var(--primary) 16%, var(--card-border));
    transition: background-color .15s, border-color .15s, transform .12s;
}
@media (hover: hover) { html[data-design] .math-key:hover { background: var(--tint); border-color: color-mix(in srgb, var(--primary) 45%, var(--card-border)); } }
html[data-design] .math-key:active { transform: translateY(2px) scale(.94); box-shadow: none; }
html[data-design] .math-pad-toggle:focus-visible, html[data-design] .math-key:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
@media (pointer: coarse) { html[data-design] .math-key { min-width: 48px; min-height: 48px; } }

/* ===================== motion: the sidebar arrives once, each section opens softly ===================== */
@keyframes ptIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes ptSide { from { opacity: 0; transform: translateX(10px); } }
@media (min-width: 1024px) {
    html[data-design] .t-app:not(.hidden) .t-side { animation: ptSide .45s var(--pt-ease) both; }
    html[data-design] .t-app:not(.hidden) .t-nav a { animation: ptSide .4s var(--pt-ease) both; }
    html[data-design] .t-app .t-nav a:nth-child(2) { animation-delay: .03s; } html[data-design] .t-app .t-nav a:nth-child(3) { animation-delay: .06s; }
    html[data-design] .t-app .t-nav a:nth-child(4) { animation-delay: .09s; } html[data-design] .t-app .t-nav a:nth-child(5) { animation-delay: .12s; }
    html[data-design] .t-app .t-nav a:nth-child(6) { animation-delay: .15s; } html[data-design] .t-app .t-nav a:nth-child(7) { animation-delay: .18s; }
    html[data-design] .t-app .t-nav a:nth-child(8) { animation-delay: .21s; } html[data-design] .t-app .t-nav a:nth-child(n+9) { animation-delay: .24s; }
}
html[data-design] .t-app .t-view:not([hidden]) { animation: ptIn .36s var(--pt-ease) both; }
html[data-design] .t-app .t-view:not([hidden]) .t-kpi { animation: ptIn .42s var(--pt-ease) both; }
html[data-design] .t-app .t-view:not([hidden]) .t-kpi:nth-child(2) { animation-delay: .05s; }
html[data-design] .t-app .t-view:not([hidden]) .t-kpi:nth-child(3) { animation-delay: .1s; }
html[data-design] .t-app .t-view:not([hidden]) .t-kpi:nth-child(4) { animation-delay: .15s; }
@media (prefers-reduced-motion: reduce) {
    html[data-design] .t-app .t-side, html[data-design] .t-app .t-nav a, html[data-design] .t-app .t-view, html[data-design] .t-app .t-kpi, html[data-design] .st-view .st-panel { animation: none !important; }
}
html.no-motion .t-app .t-side, html.no-motion .t-app .t-nav a, html.no-motion .t-app .t-view, html.no-motion .t-app .t-kpi, html.no-motion .st-view .st-panel { animation: none !important; }
