/* Miaad — app pages that keep layout.html (onboarding, billing, legal, error, admin).
   Same look as the website (tailwind/input.css): white or black page, near-black
   actions, one coral accent, hairline lines, fine "aceternity" shadows. The theme is
   set on <html data-theme> by static/theme.js (system setting as the fallback).
   Every text/background pair below passes WCAG AA (checked with contrast.py). */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/static/fonts/inter-latin.woff2") format("woff2");
}
/* Arabic (SIL OFL 1.1, Noto). unicode-range keeps them off Latin pages: the browser
   only downloads them for Arabic text, which Inter does not cover. */
@font-face {
  font-family: "Noto Sans Arabic";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/notosans-arabic-vf.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41;
}
@font-face {
  font-family: "Noto Kufi Arabic";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/notokufi-arabic-vf.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41;
}

:root {
  /* colour roles */
  --bg: #ffffff;
  --surface: #fafafa;
  --surface-2: #f5f5f5;
  --border: #ececec;
  --border-input: #d4d4d4;
  --text: #202020;
  --text-muted: #5f5f5f;
  --accent: #202020;
  --accent-hover: #3a3a3a;
  --on-accent: #ffffff;
  --brand: #c94a36;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --success: #15803d;
  --ok-bg: #ecfdf3;
  --warn-text: #8a4b00;
  --warn-bg: #fff4e5;
  --chart: #f17463;
  --focus: rgba(241, 116, 99, .35);
  --bar: rgba(255, 255, 255, .8);
  --pill: #fdeeeb;
  --nav-text: #5f5f5f;
  --display: Inter, "Noto Kufi Arabic", ui-sans-serif, system-ui, sans-serif;
  --ring: 0 2px 3px -1px rgba(0, 0, 0, .1), 0 1px 0 0 rgba(25, 28, 33, .02), 0 0 0 1px rgba(25, 28, 33, .08);

  /* shape */
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
  --shadow-sm: var(--ring);
  --shadow-card: var(--ring);
  --shadow-pop: 0 1px 1px rgba(0, 0, 0, .04), 0 0 0 1px rgba(25, 28, 33, .06), 0 12px 40px -8px rgba(25, 28, 33, .14);

  font-family: Inter, "Noto Sans Arabic", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Dark: the visitor's choice (theme.js), else the system setting. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #000000; --surface: #0a0a0a; --surface-2: #111111; --border: #262626; --border-input: #404040;
    --text: #f5f5f5; --text-muted: #a3a3a3; --accent: #ffffff; --accent-hover: #e5e5e5; --on-accent: #000000;
    --brand: #f17463; --danger: #ff8b84; --danger-bg: #2a1413; --success: #4ade80; --ok-bg: #0c2617;
    --warn-text: #fbbf6b; --warn-bg: #2b1f0d; --chart: #f17463; --focus: rgba(241, 116, 99, .45);
    --bar: rgba(0, 0, 0, .8); --pill: #2a1612; --nav-text: #a3a3a3;
    --ring: 0 0 0 1px #262626, 0 1px 0 0 rgba(255, 255, 255, .04) inset;
    color-scheme: dark;
  }
}
:root[data-theme=dark] {
    --bg: #000000; --surface: #0a0a0a; --surface-2: #111111; --border: #262626; --border-input: #404040;
    --text: #f5f5f5; --text-muted: #a3a3a3; --accent: #ffffff; --accent-hover: #e5e5e5; --on-accent: #000000;
    --brand: #f17463; --danger: #ff8b84; --danger-bg: #2a1413; --success: #4ade80; --ok-bg: #0c2617;
    --warn-text: #fbbf6b; --warn-bg: #2b1f0d; --chart: #f17463; --focus: rgba(241, 116, 99, .45);
    --bar: rgba(0, 0, 0, .8); --pill: #2a1612; --nav-text: #a3a3a3;
    --ring: 0 0 0 1px #262626, 0 1px 0 0 rgba(255, 255, 255, .04) inset;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; font-size: 16px; line-height: 1.5; }
main { flex: 1; }
a { color: var(--text); text-underline-offset: 3px; }
h1, h2, h3 { margin: 0 0 .5em; letter-spacing: -0.025em; line-height: 1.15; font-weight: 500; }
p { margin: 0 0 1em; }
.muted { color: var(--text-muted); }
.small { font-size: .85rem; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- top bar: a floating rounded strip ---------- */
.topbar { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--border); background: var(--bar); backdrop-filter: blur(10px); }
.topbar > .wrap { max-width: 1280px; padding: 0 24px; }
.topbar-inner { display: flex; align-items: center; gap: 16px; height: 72px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 12px; background: transparent; color: var(--text-muted); cursor: pointer; }
.icon-btn:hover { box-shadow: var(--ring); }
.theme-toggle .i-moon, [data-theme=dark] .theme-toggle .i-sun { display: none; }
[data-theme=dark] .theme-toggle .i-moon { display: block; }
.logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-family: var(--display); font-weight: 600; font-size: 1.6rem; letter-spacing: -0.01em; }
.logo img { display: block; }
.logo-mark { display: block; height: 24px; width: auto; }
.logo-mark-sm { height: 18px; }
.auth-logo { display: block; height: 30px; width: auto; margin: 0 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.nav-links { display: flex; gap: 32px; margin-inline: auto; }
.nav-links a { color: var(--nav-text); text-decoration: none; font-size: 1rem; font-weight: 500; transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.nav { display: flex; align-items: center; gap: 6px; }
.nav form { margin: 0; }
.nav-link { color: var(--nav-text); text-decoration: none; font-weight: 500; font-size: .95rem; padding: 8px 14px; border-radius: var(--r-sm); }
.nav-link:hover { background: rgba(0, 0, 0, .05); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; white-space: nowrap; height: 40px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; font: inherit; font-size: .93rem; font-weight: 500; text-decoration: none; cursor: pointer; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn-sm { height: 36px; padding: 0 18px; font-size: .93rem; font-weight: 500; border-radius: 12px; }
.btn-lg { height: 52px; padding: 0 26px; font-size: 1.05rem; border-radius: 12px; }
.btn-xl { height: 64px; min-width: 312px; padding: 0 28px; font-size: 1.3rem; font-weight: 500; border-radius: 14px; letter-spacing: -0.01em; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn:active { transform: scale(.98); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary, .btn-outline, .btn-google { background: var(--bg); color: var(--text); border-color: transparent; box-shadow: var(--ring); }
.btn-secondary:hover, .btn-outline:hover, .btn-google:hover { background: var(--surface-2); }
.btn-google.btn-primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn-google.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: rgba(0, 0, 0, .05); }
.btn img { display: block; }

/* ---------- landing: hero ---------- */
.hero { padding: 160px 0 88px; text-align: center; }
.hero-inner { display: flex; flex-direction: column; align-items: center; }
.pill { white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px 0 4px; border: 1px solid #f7f8f9; border-radius: 999px; background: var(--pill); color: var(--text); text-decoration: none; font-size: .9rem; font-weight: 500; margin-bottom: 30px; }
.pill:hover { background: #e6e8eb; }
.pill-tag { background: var(--bg); border-radius: 999px; padding: 2px 9px; font-size: .7rem; font-weight: 500; text-transform: uppercase; letter-spacing: .03em; }
.display { font-family: var(--display); font-size: clamp(2.6rem, 6.4vw, 5.6rem); line-height: 1.02; letter-spacing: -0.025em; font-weight: 600; margin: 0 0 36px; color: var(--text); }
.display .line { display: flex; align-items: center; justify-content: center; gap: .16em; flex-wrap: wrap; }
/* inline chips inside the headline */
.chip { display: inline-flex; align-items: center; vertical-align: middle; background: var(--surface); border: 1px solid #eceef1; border-radius: 14px; font-family: Inter, sans-serif; letter-spacing: 0; line-height: 1; }
.chip-faces { height: 72px; padding: 0 14px; gap: 0; }
.chip-faces i { width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--surface); margin-inline-start: -12px; display: grid; place-items: center; font-style: normal; font-size: 14px; font-weight: 650; color: #fff; }
.chip-faces i:first-child { margin-inline-start: 0; }
.chip-faces .f1 { background: #c2410c; }
.chip-faces .f2 { background: #0f766e; }
.chip-faces .f3 { background: #4338ca; }
.chip-clock { height: 72px; padding: 0 16px 0 10px; gap: 10px; }
.chip-clock svg { width: 54px; height: 54px; }
.chip-clock b { font-size: 17px; font-weight: 600; color: var(--text); }
.chip-card { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px; font-size: 1rem; border-radius: 14px; align-self: flex-start; margin-top: .02em; }
.chip-card .t { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; padding: 0 2px; }
.chip-card .t small { background: #e9ebee; border-radius: 6px; padding: 2px 6px; font-size: 12px; font-weight: 500; color: var(--text-muted); }
.chip-card .s { display: flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; font-size: 15px; font-weight: 500; }
.chip-card .s::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #22a35a; }
.lead { font-size: 1.3rem; line-height: 1.5; color: var(--text-muted); max-width: 36em; margin: 0 auto 36px; letter-spacing: -0.01em; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.fine { font-size: .95rem; color: var(--text-muted); margin-top: 18px; }
.fine strong { color: var(--text); font-weight: 500; white-space: nowrap; }
.fine a { text-decoration: none; }

/* ---------- landing: showcase frame ---------- */
.showcase { padding: 24px 0 80px; }
.frame { background: var(--surface); border-radius: var(--r-xl); padding: clamp(16px, 4vw, 56px); display: flex; justify-content: center; background-image: radial-gradient(rgba(0, 0, 0, .07) 1px, transparent 1px); background-size: 18px 18px; }

/* booking mock (our own illustration, built in HTML) */
.mock { display: grid; grid-template-columns: 0.9fr 1.35fr 0.85fr; width: 100%; max-width: 860px; background: var(--bg); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); border: 1px solid var(--border); overflow: hidden; font-size: .82rem; text-align: start; }
.mock-side { padding: 22px; border-inline-end: 1px solid var(--border); }
.mock-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .75rem; margin-bottom: 12px; }
.mock-host { color: var(--text-muted); margin: 0 0 4px; }
.mock-title { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; margin: 0 0 14px; }
.mock-meta { color: var(--text-muted); margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.mock-meta svg { flex: none; }
.mock-cal { padding: 22px; }
.mock-h { font-weight: 650; margin: 0 0 12px; }
.mock-month { color: var(--text-muted); margin-bottom: 10px; }
.mock-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.mock-grid span { color: var(--text-muted); font-size: .66rem; font-weight: 600; text-transform: uppercase; padding-bottom: 4px; }
.mock-grid b { font-weight: 500; aspect-ratio: 1; display: grid; place-items: center; border-radius: var(--r-sm); color: #a3a3a3; }
.mock-grid b.on { background: var(--surface); color: var(--text); font-weight: 650; }
.mock-grid b.sel { background: var(--accent); color: #fff; }
.mock-slots { padding: 22px 16px; border-inline-start: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.slot { border: 1px solid var(--border); color: var(--text); border-radius: var(--r-sm); padding: 8px; text-align: center; font-weight: 600; }
.slot-pick { display: grid; grid-template-columns: 1fr 1fr; padding: 0; border: 0; gap: 4px; }
.slot-pick em { font-style: normal; background: var(--surface); border-radius: var(--r-sm); padding: 8px 2px; }
.slot-pick em.go { background: var(--accent); color: #fff; }

/* ---------- landing: sections ---------- */
.section { padding: 72px 0; }
.section-head { max-width: 640px; margin-bottom: 40px; }
.section-head h2 { font-family: var(--display); font-size: clamp(2.1rem, 4.4vw, 3.4rem); line-height: 1.04; letter-spacing: -0.025em; font-weight: 600; }
.section-head p { color: var(--text-muted); font-size: 1.1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-sm); }
.step .num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r-sm); background: var(--surface); font-weight: 700; font-size: .9rem; margin-bottom: 18px; }
.step h3, .feature h3 { font-size: 1.05rem; letter-spacing: -0.015em; margin-bottom: 6px; }
.step p, .feature p { color: var(--text-muted); margin: 0; font-size: .95rem; }
.features-panel { background: var(--surface); border-radius: var(--r-xl); padding: clamp(24px, 4vw, 48px); }
.feature { background: var(--bg); border-radius: var(--r-lg); padding: 22px; border: 1px solid var(--border); }
.feature-icon { width: 36px; height: 36px; border-radius: var(--r-sm); border: 1px solid var(--border); display: grid; place-items: center; margin-bottom: 16px; }
.cta { padding: 24px 0 88px; }
.cta-inner { background: var(--accent); color: #fff; border-radius: var(--r-xl); padding: clamp(32px, 6vw, 72px); text-align: center; }
.cta-inner h2 { font-family: var(--display); font-size: clamp(2rem, 4.4vw, 3.2rem); letter-spacing: -0.025em; font-weight: 600; line-height: 1.05; margin-bottom: 14px; }
.cta-inner p { color: #d4d4d4; margin-bottom: 28px; font-size: 1.1rem; }
.btn-light { background: #fff; color: var(--text); }
.btn-light:hover { background: #ededed; }

/* ---------- auth pages ---------- */
body.auth-page { background: var(--bg); background-image: radial-gradient(rgba(32, 32, 32, .1) 1px, transparent 1px); background-size: 14px 14px; }
.auth { display: flex; justify-content: center; padding: 48px 20px 64px; }
.auth-card { background: var(--bg); border: 0; border-radius: 16px; box-shadow: var(--shadow-pop); width: 100%; max-width: 420px; overflow: hidden; }
.auth-card.wide { max-width: 560px; }
.auth-body { padding: 32px; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 18px; }
.auth-card h1 { font-family: var(--display); font-size: 1.6rem; letter-spacing: -0.025em; font-weight: 500; text-align: center; margin-bottom: 6px; }
.auth-wordmark { font-family: var(--display); font-size: 1.45rem; font-weight: 600; text-align: center; margin: 0 0 4px; letter-spacing: -0.01em; }
.auth-card .sub { text-align: center; color: var(--text-muted); margin: 0 0 24px; font-size: .9rem; }
.auth-card .btn, .split-form .btn { height: 40px; border-radius: 12px; font-size: .93rem; font-weight: 500; }
.auth-card .field input, .auth-card .field select, .split-form .field input { height: 36px; }
.auth-card .field > span, .split-form .field > span { font-weight: 500; font-size: .87rem; }
.auth-card.wide h1, .auth-card.wide .sub, .auth-card.wide .eyebrow { text-align: start; }
.auth-foot { background: var(--surface-2); border-top: 1px solid var(--border); padding: 14px 24px; text-align: center; font-size: .9rem; color: var(--text-muted); }
.auth-foot a { color: var(--text); font-weight: 600; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }
.or { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: .85rem; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* signup: form left, illustration panel right */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 40px; align-items: center; padding: 40px 0 64px; }
.split-form { max-width: 400px; width: 100%; justify-self: center; }
.split-form h1 { font-family: var(--display); font-size: 1.85rem; letter-spacing: -0.02em; font-weight: 600; margin-bottom: 6px; }
.split-form .sub { color: var(--text-muted); margin-bottom: 28px; }
.split-form .switch { margin-top: 24px; color: var(--text-muted); font-size: .93rem; }
.split-form .switch a { font-weight: 600; text-decoration: none; }
.split-aside { background: var(--surface); border-radius: var(--r-xl); padding: 40px 32px 32px; background-image: radial-gradient(rgba(0, 0, 0, .06) 1px, transparent 1px); background-size: 18px 18px; }
.split-aside .mock { grid-template-columns: 1fr 1.3fr; font-size: .78rem; }
.split-aside .mock-slots { display: none; }
.aside-points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 28px; }
.aside-points h3 { font-size: .93rem; margin: 10px 0 4px; letter-spacing: -0.01em; }
.aside-points p { font-size: .85rem; color: var(--text-muted); margin: 0; line-height: 1.45; }

/* ---------- forms ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > legend, .label-row { font-weight: 600; font-size: .9rem; padding: 0; }
fieldset.field > legend { margin-bottom: 8px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.label-row a { font-weight: 500; color: var(--text-muted); text-decoration: none; font-size: .85rem; }
.field input, .field select { height: 40px; border: 1px solid transparent; border-radius: 10px; padding: 0 12px; font: inherit; font-size: .95rem; background: var(--bg); color: var(--text); width: 100%; box-shadow: var(--shadow-sm); }
.field input:hover, .field select:hover { border-color: var(--border-input); }
.field input:focus, .field select:focus { outline: none; border-color: transparent; box-shadow: var(--ring), 0 0 0 3px var(--focus); }
.field small { font-size: .82rem; }
.alert { background: var(--danger-bg); border: 1px solid #fecdca; color: var(--danger); padding: 10px 14px; border-radius: var(--r-sm); margin-bottom: 18px; font-size: .92rem; }
.alert-info { background: var(--surface); border-color: var(--border); color: var(--text); }
.alert code { font-size: .85em; }

.link-input { display: flex; align-items: stretch; height: 40px; border: 1px solid transparent; border-radius: 10px; background: var(--bg); overflow: hidden; box-shadow: var(--shadow-sm); }
.link-input:focus-within { box-shadow: var(--ring), 0 0 0 3px var(--focus); }
.link-input input { border: 0; border-radius: 0; box-shadow: none; height: auto; padding: 0 2px; min-width: 0; flex: 1; outline: none; }
.link-input input:focus { box-shadow: none; }
.link-pre, .link-post { color: var(--text-muted); white-space: nowrap; padding: 0 10px; background: var(--surface-2); display: flex; align-items: center; font-size: .9rem; }
.link-pre { border-inline-end: 1px solid var(--border); }
.link-post { border-inline-start: 1px solid var(--border); }
.hint { color: var(--text-muted); }
.hint.ok { color: var(--success); }
.hint.bad { color: var(--danger); }
.forgot { align-self: flex-end; margin-top: -6px; font-size: .88rem; color: var(--text-muted); text-decoration: none; }
.forgot:hover { color: var(--text); text-decoration: underline; }

.days { display: flex; flex-wrap: wrap; gap: 6px; }
.day input { position: absolute; opacity: 0; pointer-events: none; }
.day span { display: inline-block; min-width: 52px; text-align: center; padding: 8px 10px; border: 1px solid transparent; box-shadow: var(--ring); border-radius: 10px; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--text); user-select: none; background: var(--bg); }
.day span:hover { background: var(--surface-2); }
.day input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.day input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.hours { display: flex; align-items: center; gap: 12px; }
.hours select { width: auto; flex: 1; }
.eyebrow { color: var(--brand); font-weight: 500; font-size: .9rem; margin-bottom: .6em; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 28px 0; font-size: .88rem; background: var(--bg); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.footer .logo { font-size: 1rem; }

/* ---------- admin dashboard ---------- */
body.admin-page { background: var(--surface-2); }
.admin { padding-top: 24px; padding-bottom: 56px; }
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.admin-head h1 { font-family: var(--display); font-size: 1.9rem; letter-spacing: -0.02em; font-weight: 600; margin: 0; }
.admin-head-actions { display: flex; align-items: center; gap: 12px; }
.admin .alert { margin: 0 0 20px; }
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--bg); border: 0; border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.kpi p { margin: 0; }
.kpi-label { font-size: .85rem; color: var(--text-muted); font-weight: 550; }
.kpi-value { font-size: 2rem; font-weight: 750; letter-spacing: -0.03em; margin: 6px 0 2px !important; font-variant-numeric: tabular-nums; }
.kpi-unit { font-size: 1.1rem; font-weight: 600; color: var(--text-muted); margin-inline-start: 2px; }
.kpi-sub { font-size: .82rem; color: var(--text-muted); line-height: 1.4; }
.panel { background: var(--bg); border: 0; border-radius: var(--r-lg); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { font-size: 1.05rem; letter-spacing: -0.015em; margin: 0; }
.panel-head p { margin: 0; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-base { stroke: var(--border); stroke-width: 1; }
.bar-mark { fill: var(--chart); }
.bar-hit { fill: transparent; }
.bar { outline: none; cursor: default; }
.bar.on .bar-hit { fill: rgba(0, 0, 0, .04); }
.bar:focus-visible .bar-hit { stroke: var(--accent); stroke-width: 1.5; }
.bar-peak { font-size: 11px; font-weight: 700; fill: var(--text); }
.chart-axis { display: flex; justify-content: space-between; font-size: .8rem; color: var(--text-muted); margin-top: 6px; }
.chart-tip { position: absolute; transform: translateX(-50%); background: var(--accent); color: #fff; font-size: .82rem; font-weight: 600; padding: 6px 10px; border-radius: var(--r-sm); white-space: nowrap; pointer-events: none; }
.chart-table { margin-top: 8px; font-size: .9rem; }
.chart-table summary { cursor: pointer; color: var(--text-muted); }
.chart-table table { margin-top: 8px; max-width: 320px; }
.search { height: 38px; border: 1px solid var(--border-input); border-radius: var(--r-sm); padding: 0 12px; font: inherit; font-size: .92rem; width: min(340px, 100%); box-shadow: var(--shadow-sm); }
.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: start; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table.compact td, .table.compact th { padding: 6px 10px; }
.table .num { text-align: end; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: .82rem; color: var(--text-muted); margin-top: 2px; }
.empty { text-align: center; padding: 24px !important; }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.tag-ok { background: var(--ok-bg); color: var(--success); }
.tag-warn { background: var(--warn-bg); color: var(--warn-text); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .split { grid-template-columns: 1fr; }
  .split-aside { display: none; }
}
@media (max-width: 860px) {
  .chip { display: none; }
  .hero { padding-top: 88px; }
  .nav-links { display: none; }
  .grid-3 { grid-template-columns: 1fr; }
  .mock { grid-template-columns: 1fr 1fr; }
  .mock-side { display: none; }
}
@media (max-width: 560px) {
  .topbar-inner { padding: 0 6px 0 12px; gap: 8px; }
  .nav .nav-link { display: none; }
  .hero { padding: 48px 0 32px; }
  .hero-cta { flex-direction: column; width: 100%; }
  .hero-cta .btn { width: 100%; min-width: 0; }
  .btn-xl { height: 56px; font-size: 1.1rem; }
  .auth { padding: 20px 12px 40px; }
  .auth-body { padding: 24px; }
  .link-pre { display: none; }
  .mock { grid-template-columns: 1fr; }
  .mock-slots { border-inline-start: 0; border-top: 1px solid var(--border); }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi-value { font-size: 1.6rem; }
  .bar-peak { display: none; } /* too small once the chart is scaled down; tooltip and table carry it */
  .admin-head-actions { width: 100%; justify-content: space-between; }
}

/* dark-mode component tweaks: last, so they win over the rules above */
[data-theme=dark] .alert { border-color: rgba(255, 139, 132, .3); }
[data-theme=dark] .btn-light { background: #f5f5f5; color: #000; }
[data-theme=dark] .table tbody tr:hover td { background: #111; }
[data-theme=dark] body.auth-page, [data-theme=dark] .split-aside, [data-theme=dark] .frame { background-image: radial-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px); }

/* Legal pages (templates/legal.html) */
.legal { max-width: 760px; padding-top: 48px; padding-bottom: 72px; line-height: 1.65; }
.legal h1 { font-size: 2rem; margin: 0 0 6px; }
.legal h2 { font-size: 1.15rem; margin: 32px 0 8px; }
.legal ul { padding-inline-start: 1.2em; }
.legal li { margin: 6px 0; }
.legal a { color: var(--brand); }
.legal .missing { color: var(--danger); font-weight: 600; }
.legal h3 { font-size: 1rem; margin: 22px 0 6px; }
.legal h2, .legal h3 { scroll-margin-top: 96px; } /* anchors land below the sticky header */
.legal code { font-size: .88em; }
.legal .caps { font-size: .88rem; letter-spacing: .01em; }
.legal .table-wrap { overflow-x: auto; margin: 12px 0; }
.legal table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.legal th, .legal td { text-align: start; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.legal th { font-weight: 600; }
.legal-links { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--border); font-size: .9rem; }

/* "En créant un compte, vous acceptez…" under the signup buttons */
.terms-note { font-size: .85rem; line-height: 1.5; margin: 4px 0 0; }
.terms-note a { color: inherit; text-decoration: underline; }
.footer-legal { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .88rem; }
.footer-legal a { color: inherit; }

/* ---- language menu (layout.html "langmenu") ---- */
.langmenu { position: relative; }
.nav-links + .langmenu, .topbar-inner > .logo + .langmenu { margin-inline-start: auto; }
.langmenu summary { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border-radius: var(--r-md); cursor: pointer; list-style: none; font-size: .9rem; font-weight: 500; color: var(--nav-text); }
.langmenu summary::-webkit-details-marker { display: none; }
.langmenu summary:hover { background: var(--surface); }
.langmenu ul { position: absolute; inset-inline-end: 0; top: 42px; z-index: 50; min-width: 150px; margin: 0; padding: 4px; list-style: none; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-pop); }
.langmenu a { display: block; padding: 8px 12px; border-radius: var(--r-sm); color: var(--text); text-decoration: none; font-size: .9rem; }
.langmenu a:hover { background: var(--surface); }
.langmenu a[aria-current] { font-weight: 600; }
@media (max-width: 560px) { .langmenu summary span { display: none; } }

/* ---- right-to-left (Arabic) ---- */
/* Arabic letters join: tracking that tightens Latin headlines would pull them apart. */
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] .display, [dir="rtl"] .logo,
[dir="rtl"] .auth-card h1, [dir="rtl"] .split-form h1, [dir="rtl"] .admin-head h1 { letter-spacing: 0; }
[dir="rtl"] .display, [dir="rtl"] .split-form h1, [dir="rtl"] .auth-card h1 { line-height: 1.35; }
/* Addresses, emails, links and times read left to right, even in an Arabic sentence. */
[dir="rtl"] input[type="email"], [dir="rtl"] input[type="password"], [dir="rtl"] input[type="url"] { direction: ltr; text-align: right; }
.link-input { direction: ltr; }

/* Billing (/billing, /billing/pay/{id}) */
.tag-danger { background: var(--danger-bg); color: var(--danger); }
.alert-ok { background: var(--ok-bg); border-color: transparent; color: var(--success); }
.bill-status { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); margin: 8px 0 24px; }
.bill-status p { margin: 0; }
.bill-h2 { font-size: 1.05rem; letter-spacing: -0.015em; margin: 24px 0 6px; }
.auth-card.bill-wide { max-width: 1040px; }
.auth-card.bill-wide h1, .auth-card.bill-wide .sub, .auth-card.bill-wide .eyebrow { text-align: start; }
.bill-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-top: 12px; }
.bill-plan { display: flex; flex-direction: column; gap: 10px; padding: 18px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); box-shadow: var(--shadow-sm); }
.bill-plan-current { border-color: var(--success); }
.bill-plan-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bill-plan form { margin: 0; }
.bill-plan-name { font-weight: 600; }
.bill-plan-price { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.bill-plan-price small { font-size: .85rem; font-weight: 500; color: var(--text-muted); letter-spacing: 0; }
.bill-features { list-style: none; margin: 0 0 auto; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--text-muted); }
.bill-features li::before { content: "✓"; color: var(--success); margin-inline-end: 6px; }
.bill-card { min-height: 120px; margin-bottom: 16px; }

/* My account (privacy.go): profile, data export, danger zone. */
.account-card { margin-top: 24px; padding: 20px; border-radius: var(--r-lg); background: var(--bg); box-shadow: var(--ring); }
.account-card .bill-h2 { margin-top: 0; }
.account-card p { margin: 0 0 12px; }
.account-dl { display: grid; gap: 10px; margin: 0; }
.account-dl div { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.account-dl dt { min-inline-size: 120px; color: var(--text-muted); }
.account-dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.account-danger { box-shadow: 0 0 0 1px var(--danger); }
.account-danger .bill-h2 { color: var(--danger); }
.account-list { margin: 0 0 16px; padding-inline-start: 1.2em; display: grid; gap: 4px; }
.account-pending { margin-top: 16px; }
.btn-danger { background: var(--danger); color: var(--bg); }
.btn-danger:hover { opacity: .9; }
.erase-form { display: grid; gap: 12px; align-items: end; margin-top: 12px; }
@media (min-width: 720px) { .erase-form { grid-template-columns: 1fr 1fr auto; } }
