/* RiderWP panel and public pages. No build step (ARCHITECTURE section 3).
   Identity: RiderWP Brand Kit v1.0 (05-design-system/DESIGN.md). Inter for Latin,
   Tajawal for Arabic, both self-hosted under the SIL Open Font License (fonts/OFL-*.txt). */

@font-face { font-family: "Inter"; font-weight: 400 800; font-display: swap; src: url("../fonts/inter-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-weight: 400 800; font-display: swap; src: url("../fonts/inter-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Tajawal"; font-weight: 400; font-display: swap; src: url("../fonts/tajawal-400-arabic.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Tajawal"; font-weight: 500; font-display: swap; src: url("../fonts/tajawal-500-arabic.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Tajawal"; font-weight: 700; font-display: swap; src: url("../fonts/tajawal-700-arabic.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Tajawal"; font-weight: 800; font-display: swap; src: url("../fonts/tajawal-800-arabic.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFC; }

:root {
    /* Brand Kit tokens */
    --purple: #7B3FF2;
    --purple-hover: #6528D7;
    --purple-active: #521AC6;
    --lavender: #C6B4FF;
    --tint: #F0EAFF;
    --ink: #0E0F1A;
    --ink-soft: #4D5062;
    --line: #E8EAF0;
    --field: #85869A;
    --ground: #F7F7FB;
    --paper: #FFFFFF;
    --ok: #166534;
    --ok-bg: #F0FDF4;
    --warn: #92400E;
    --warn-bg: #FFFBEB;
    --danger: #B91C1C;
    --danger-bg: #FEF2F2;
    --accent: var(--purple);
    --accent-ink: #FFFFFF;
    --radius: 12px;
    --radius-input: 10px;
    --radius-card: 16px;
    --shadow: 0 4px 16px rgba(14, 15, 26, .06);
    --shadow-pop: 0 12px 32px rgba(14, 15, 26, .10);
    --space: 16px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --font-ar: "Tajawal", "Inter", "Noto Sans Arabic", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 var(--font); color: var(--ink); background: var(--ground); }
body.public { background: var(--paper); }
[dir="rtl"] body, body:lang(ar) { font-family: var(--font-ar); line-height: 1.7; }
/* Arabic never gets letter spacing (Brand Kit DESIGN.md 4), whatever a later rule says. */
[dir="rtl"] * { letter-spacing: normal !important; }

a { color: var(--purple); }
a:hover { color: var(--purple-hover); }
h1 { font-size: 2rem; line-height: 1.25; font-weight: 800; letter-spacing: -.025em; margin: 0 0 var(--space); }
h2 { font-size: 1.25rem; line-height: 1.4; font-weight: 700; margin: 0 0 12px; }
[dir="rtl"] h1, [dir="rtl"] h2 { line-height: 1.5; }
p { margin: 0 0 12px; }
code { font-size: .875rem; overflow-wrap: anywhere; }
img { max-inline-size: 100%; }

/* Header */
.topbar { display: flex; align-items: center; gap: var(--space); row-gap: 8px; flex-wrap: wrap; padding: 12px 24px; background: var(--paper); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; min-height: 40px; color: var(--ink); text-decoration: none; margin-inline-end: auto; }
.brand img { display: block; height: 30px; width: auto; }
.admin-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.admin-nav a, .admin-nav .link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: var(--radius-input); color: var(--ink-soft); text-decoration: none; font-weight: 500; }
.admin-nav a:hover, .admin-nav .link:hover { color: var(--ink); background: var(--ground); }
.admin-nav a[aria-current="page"] { background: var(--tint); color: var(--purple-active); font-weight: 600; }
.admin-nav form { margin: 0; }

.lang { position: relative; }
.lang summary { list-style: none; cursor: pointer; min-height: 40px; display: inline-flex; align-items: center; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-input); font-weight: 500; }
.lang summary:hover { border-color: var(--field); }
.lang summary::-webkit-details-marker { display: none; }
.lang-menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; min-width: 170px; z-index: 10; box-shadow: var(--shadow-pop); }
.lang-menu form { margin: 0; }
.lang-menu button { width: 100%; text-align: start; min-height: 40px; padding: 0 10px; border: 0; background: none; border-radius: 8px; font: inherit; cursor: pointer; color: var(--ink); }
.lang-menu button:hover { background: var(--ground); }
.lang-menu button[aria-current="true"] { background: var(--tint); color: var(--purple-active); font-weight: 600; }
.lang-menu button[lang="ar"] { font-family: var(--font-ar); }

.content { max-width: 1200px; margin: 0 auto; padding: 32px 24px 48px; }
.footer { max-width: 1200px; margin: 0 auto; padding: 24px 24px 32px; color: var(--ink-soft); font-size: .9rem; border-top: 1px solid var(--line); }
.admin .footer { border-top: 0; }

/* Surfaces */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 24px; margin-bottom: var(--space); }
.panel.narrow { max-width: 460px; margin-inline: auto; box-shadow: var(--shadow); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space); margin-bottom: var(--space); }
.cards .panel { margin-bottom: 0; }

/* Forms */
.form .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 var(--space); }
/* A label on two lines must not push its control out of line with the row. */
.form-grid > .field { justify-content: flex-end; }
label { font-weight: 600; font-size: .925rem; }
[dir="rtl"] label { font-weight: 700; }
input, select, textarea { font: inherit; color: var(--ink); height: 50px; padding: 0 12px; border: 1px solid var(--field); border-radius: var(--radius-input); background: var(--paper); width: 100%; }
input:disabled { background: var(--ground); color: var(--ink-soft); border-color: var(--line); }
input[aria-invalid="true"] { border-color: var(--danger); }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: var(--radius); border: 1px solid var(--field); background: var(--paper); font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); transition: background 150ms ease-out, color 150ms ease-out, border-color 150ms ease-out; }
[dir="rtl"] .btn { font-weight: 700; }
.btn:hover { background: var(--ground); color: var(--ink); }
.btn-primary { background: var(--purple); border-color: var(--purple); color: #FFFFFF; }
.btn-primary:hover { background: var(--purple-hover); border-color: var(--purple-hover); color: #FFFFFF; }
.btn-primary:active { background: var(--purple-active); border-color: var(--purple-active); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #FFFFFF; }
.btn-danger:hover { background: #991B1B; border-color: #991B1B; color: #FFFFFF; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-large { min-height: 56px; padding: 0 28px; font-size: 1.05rem; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }
.link { background: none; border: 0; font: inherit; cursor: pointer; color: var(--ink-soft); }

/* Alerts and badges */
.alert { background: var(--tint); color: var(--purple-active); border-radius: var(--radius); padding: 12px 16px; margin-bottom: var(--space); }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-error p:last-child { margin-bottom: 0; }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .85rem; font-weight: 600; background: var(--tint); color: var(--purple-active); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-muted { background: var(--ground); color: var(--ink-soft); }
.tag { font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); margin-inline-start: 6px; }
.hint { color: var(--ink-soft); font-size: .925rem; }

/* Data */
.kv { margin: 0 0 12px; }
.kv > div { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv dt { min-width: 160px; color: var(--ink-soft); }
.kv dd { margin: 0; }
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap + .panel, .table-wrap + section { margin-top: var(--space); }
table { border-collapse: collapse; width: 100%; font-size: .925rem; }
th, td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th { color: var(--ink-soft); font-weight: 600; background: var(--ground); }
.stat { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: 4px; font-variant-numeric: tabular-nums; }

/* Home hero: copy and one button on one side, the browser picture on the other (DESIGN.md 5, 10). */
.hero { display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 48px; padding: 40px 0 56px; }
.hero h1 { font-size: 3.5rem; line-height: 1.14; letter-spacing: -.035em; max-width: 650px; }
[dir="rtl"] .hero h1 { line-height: 1.45; }
.hero h1 .hl { color: var(--purple); white-space: nowrap; }
.lead { font-size: 1.125rem; line-height: 1.6; color: var(--ink-soft); max-width: 560px; }
.create-form { margin-top: 28px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.hero-art { position: relative; }
.hero-art svg { display: block; width: 100%; height: auto; }
.hero-timer { font-family: var(--font); font-variant-numeric: tabular-nums; direction: ltr; }

/* Public sections */
.skip-link { position: absolute; inset-inline-start: -9999px; top: 8px; }
.skip-link:focus { inset-inline-start: 8px; background: var(--paper); padding: 8px 12px; border-radius: var(--radius); z-index: 20; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: var(--radius-input); color: var(--ink-soft); text-decoration: none; font-weight: 500; }
.site-nav a:hover { color: var(--ink); background: var(--ground); }
.footer-nav { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.footer-nav a { color: var(--ink-soft); }
.steps, .faq-short { margin-top: 24px; }
.steps h2, .faq-short h2 { font-size: 1.75rem; letter-spacing: -.02em; margin-bottom: 20px; }
.step-list { list-style: none; padding: 0; margin: 0 0 40px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space); counter-reset: step; }
.step-list li { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 24px; display: flex; flex-direction: column; gap: 6px; counter-increment: step; }
.step-list li::before { content: counter(step); display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--tint); color: var(--purple-active); font-weight: 800; margin-bottom: 6px; }
.step-list li span { color: var(--ink-soft); }
.faq-short dl, .faq { max-width: 760px; }
.faq-short dt, .faq dt { font-weight: 700; margin-top: 20px; }
.faq-short dd, .faq dd { margin: 4px 0 0; color: var(--ink-soft); }
.prose { max-width: 760px; }
.prose h2 { margin-top: 32px; }
.prose ul { padding-inline-start: 20px; }
.prose li { margin-bottom: 6px; }
.progress-steps { list-style: none; padding: 0; }
.progress-steps li { padding: 6px 0; }
.progress-steps .done::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.progress-steps .now::before { content: "… "; color: var(--purple); font-weight: 700; }
.site-card .site-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.site-card h2 { margin: 0; overflow-wrap: anywhere; font-size: 1rem; }
form.inline, .inline-form { display: inline-flex; gap: 8px; align-items: center; margin: 0; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; min-width: 110px; }
.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; }
textarea { height: auto; padding: 12px; }
.price dd { font-weight: 700; }

/* Header rows: name and language on the first row; the links get their own row when they
   need it (always in admin, which has 12; on phones for the public site). Admin links
   scroll sideways on phones instead of taking five rows. */
.admin-nav { order: 3; flex-basis: 100%; margin-inline: -12px; }

@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; gap: 32px; padding: 16px 0 40px; }
    .hero-art { max-width: 520px; }
}
@media (max-width: 700px) {
    /* Tables keep readable columns and scroll inside their frame. */
    .table-wrap table { min-width: 640px; }
    .site-nav { order: 3; flex-basis: 100%; margin-inline: -10px; }
    .site-nav a { padding: 0 10px; }
    .admin-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .admin-nav::-webkit-scrollbar { display: none; }
    .admin-nav > a, .admin-nav > form { flex-shrink: 0; white-space: nowrap; }
}
@media (max-width: 600px) {
    .topbar { padding: 10px 16px; }
    .brand img { height: 26px; }
    .content { padding: 24px 16px 40px; }
    .footer { padding: 20px 16px 28px; }
    .panel { padding: 16px; }
    .hero h1 { font-size: 2.25rem; line-height: 1.22; }
    .steps h2, .faq-short h2 { font-size: 1.5rem; }
    .kv > div { flex-direction: column; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* The badge every trial site shows (the plugin draws the same one). */
.trial-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--lavender); border-radius: 999px; background: var(--tint); color: var(--ink); font-size: .85rem; font-weight: 600; box-shadow: var(--shadow); }
.trial-badge img { display: block; flex: none; }

/* Admin invite: the authenticator QR and the recovery codes. */
.qr { width: 200px; height: 200px; padding: 8px; background: #FFFFFF; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.qr svg { display: block; width: 100%; height: 100%; }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0 0 var(--space); }
.codes code { display: block; padding: 8px 10px; background: var(--ground); border-radius: 8px; text-align: center; }

/* ------------------------------------------------------------------
   Admin shell (Operate): side navigation, top bar, dense data views.
   ------------------------------------------------------------------ */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; padding: 18px 14px; background: var(--paper); border-inline-end: 1px solid var(--line); }
.sidebar .brand { margin: 0 6px 4px; }
.side-nav { display: flex; flex-direction: column; gap: 14px; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-label { margin: 0 10px 4px; font-size: .75rem; font-weight: 600; color: var(--ink-soft); }
.side-nav a { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; border-radius: var(--radius-input); color: var(--ink-soft); text-decoration: none; font-weight: 500; font-size: .925rem; transition: background 150ms ease-out, color 150ms ease-out; }
.side-nav a:hover { background: var(--ground); color: var(--ink); }
.side-nav a[aria-current="page"] { background: var(--tint); color: var(--purple-active); font-weight: 600; }
.side-nav .icon { width: 18px; height: 18px; flex: none; }
.side-nav .count { margin-inline-start: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--purple); color: #FFFFFF; font-size: .75rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.side-foot .me { margin: 0; display: flex; flex-direction: column; font-size: .9rem; }
.side-foot .me span { color: var(--ink-soft); font-size: .8rem; }
.side-foot form { margin: 0; }
.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-top { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-height: 64px; padding: 10px 28px; background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.app-top .env { margin: 0 auto 0 0; }
[dir="rtl"] .app-top .env { margin: 0 0 0 auto; }
.admin .app .content { max-width: 1320px; width: 100%; margin: 0; padding: 28px 28px 56px; }
.icon { width: 18px; height: 18px; flex: none; }
.btn-small { min-height: 40px; padding: 0 14px; font-size: .875rem; gap: 6px; }
.btn-small .icon { width: 16px; height: 16px; }
.btn-quiet:hover { background: var(--ground); color: var(--ink); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin-bottom: 4px; font-size: 1.75rem; }
.page-head .hint { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.crumbs { margin: 0 0 6px; font-size: .875rem; }
.crumbs a { color: var(--ink-soft); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--ground); border: 1px solid var(--line); border-radius: var(--radius-input); }
.segmented a { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border-radius: 8px; color: var(--ink-soft); text-decoration: none; font-size: .875rem; font-weight: 500; white-space: nowrap; }
.segmented a:hover { color: var(--ink); }
.segmented a[aria-current="true"] { background: var(--paper); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(14, 15, 26, .1); }

.kpi-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-card); margin-bottom: var(--space); overflow: hidden; }
.kpi-strip-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { padding: 18px 20px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi + .kpi { border-inline-start: 1px solid var(--line); }
.kpi-label { margin: 0; font-size: .85rem; font-weight: 600; color: var(--ink-soft); }
.kpi-value { margin: 0; font-size: 1.85rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-meta { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .8rem; }
.kpi-meta .hint { font-size: .8rem; }
.kpi .spark { display: block; width: 100%; height: 34px; margin-top: 6px; }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 999px; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta .icon { width: 14px; height: 14px; }
.delta-up { background: var(--ok-bg); color: var(--ok); }
.delta-down { background: var(--danger-bg); color: var(--danger); }
.delta-flat { background: var(--ground); color: var(--ink-soft); }

.grid-2-1, .grid-1-1 { display: grid; gap: var(--space); margin-bottom: var(--space); }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-1-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-2-1 > .panel, .grid-1-1 > .panel { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: var(--space); min-width: 0; }
.stack > .panel { margin-bottom: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head h2 { margin: 0; font-size: 1.05rem; }
.link-more { font-size: .875rem; font-weight: 500; }
.empty { margin: 0; color: var(--ink-soft); }

.legend { list-style: none; margin: 0; padding: 0; display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-soft); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.swatch-lavender { background: #9D7BF5; }
.swatch-purple { background: var(--purple); }
.swatch-fold { background: var(--purple-active); }
.swatch-amber { background: #D97706; }
.swatch-green { background: #16A34A; }
.chart { display: block; width: 100%; height: auto; }
.chart-axis { font-family: var(--font); font-size: 11px; fill: var(--ink-soft); font-variant-numeric: tabular-nums; }
.chart-scroll { overflow-x: auto; }
.chart-scroll .heatmap { min-width: 620px; }
.share { display: block; width: 100%; height: 6px; }

.funnel, .bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.funnel-row { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 5px; font-size: .9rem; }
.funnel-row strong { font-variant-numeric: tabular-nums; }
.funnel .hint { margin: 4px 0 0; font-size: .78rem; }

.pipeline { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.pipeline a { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-input); text-decoration: none; color: var(--ink); }
.pipeline a:hover { border-color: var(--lavender); background: var(--tint); }
.pipeline .hint { font-size: .78rem; }
.pipeline strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.facts { margin: 0; display: flex; flex-direction: column; }
.facts > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.facts > div:last-child { border-bottom: 0; }
.facts dt { color: var(--ink-soft); }
.facts dd { margin: 0; text-align: end; font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.lead-list { list-style: none; margin: 0; padding: 0; }
.lead-list li + li { border-top: 1px solid var(--line); }
.lead-list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 4px; text-decoration: none; color: var(--ink); min-height: 44px; }
.lead-list a:hover { background: var(--ground); }
.lead-who, .lead-when { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lead-who strong { overflow-wrap: anywhere; }
.lead-when { align-items: flex-end; text-align: end; flex: none; }
.lead-when .hint, .lead-who .hint { font-size: .8rem; }
.overdue { color: var(--danger); font-weight: 600; }

.status-list { list-style: none; margin: 0; padding: 0; }
.status-list li { display: grid; grid-template-columns: 10px 110px minmax(0, 1fr); align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.status-list li:last-child { border-bottom: 0; }
.status-list li > :nth-child(2) { color: var(--ink-soft); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-ok { background: #16A34A; }
.dot-warn { background: #F59E0B; }
.dot-danger { background: #DC2626; }

table.data { font-size: .9rem; }
table.data th { font-size: .8rem; white-space: nowrap; }
table.data td { vertical-align: middle; }
th.num, td.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-bar { display: flex; flex-direction: column; gap: 6px; min-width: 120px; }
table.rows-link tbody tr:hover { background: var(--ground); }
.row-link { color: var(--ink); text-decoration: none; }
.row-link:hover { color: var(--purple); text-decoration: underline; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 12px; color: var(--ink-soft); text-decoration: none; font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--purple-active); border-bottom-color: var(--purple); font-weight: 600; }
.tabs .count { padding: 0 7px; border-radius: 999px; background: var(--ground); color: var(--ink-soft); font-size: .75rem; font-variant-numeric: tabular-nums; }
.filters { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.filters .field { display: flex; flex-direction: column; gap: 6px; min-width: 180px; flex: 1 1 180px; max-width: 280px; }
.filters .check { display: inline-flex; align-items: center; gap: 8px; min-height: 50px; font-weight: 500; }
.filters .check input { width: 18px; height: 18px; }
.filters .btn { min-height: 50px; }
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state p { max-width: 520px; margin-inline: auto; color: var(--ink-soft); }

.timeline { list-style: none; margin: 18px 0 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px; padding-inline-start: 22px; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 4px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--lavender); }
.timeline li::after { content: ""; position: absolute; inset-inline-start: 7.5px; top: 19px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline-stage::before { background: var(--purple) !important; }
.timeline-call::before, .timeline-email::before { background: #16A34A !important; }
.timeline-meta { margin: 0 0 2px; font-size: .8rem; color: var(--ink-soft); }
.timeline-meta strong { color: var(--ink); }
.timeline-body { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.note-form { margin: 0; }
.note-form .inline-form { justify-content: flex-end; width: 100%; }

@media (max-width: 1100px) {
    .kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .kpi-strip-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi:nth-child(4) { border-inline-start: 0; }
    .kpi:nth-child(n+4) { border-top: 1px solid var(--line); }
    .kpi-strip-4 .kpi:nth-child(3) { border-inline-start: 0; border-top: 1px solid var(--line); }
    .grid-2-1, .grid-1-1 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
    .app { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; border-inline-end: 0; border-bottom: 1px solid var(--line); overflow: visible; }
    .side-nav { order: 3; flex-basis: 100%; flex-direction: row; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-inline: -6px; }
    .side-nav::-webkit-scrollbar { display: none; }
    .side-group { flex-direction: row; gap: 2px; flex-shrink: 0; }
    .side-label { display: none; }
    .side-nav a { flex-shrink: 0; white-space: nowrap; min-height: 40px; }
    .side-foot { margin: 0 0 0 auto; padding: 0; border: 0; flex-direction: row; align-items: center; }
    [dir="rtl"] .side-foot { margin: 0 auto 0 0; }
    .side-foot .me { display: none; }
    .app-top { position: static; padding: 10px 16px; min-height: 56px; }
    .admin .app .content { padding: 20px 16px 40px; }
    .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .kpi-strip, .kpi-strip-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi { padding: 14px 14px 10px; }
    .kpi + .kpi { border-inline-start: 0; }
    .kpi:nth-child(even) { border-inline-start: 1px solid var(--line); }
    .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
    .kpi-value { font-size: 1.5rem; }
    .status-list li { grid-template-columns: 10px minmax(0, 1fr); }
    .status-list li > :nth-child(3) { grid-column: 2; }
    .filters .field { max-width: none; }
    .page-head h1 { font-size: 1.5rem; }
}
.table-wrap + .hint { margin-top: 10px; }
/* The sidebar column keeps its white ground and divider down the whole page, not only the first screen. */
.app { background: linear-gradient(90deg, var(--paper) 0 247px, var(--line) 247px 248px, var(--ground) 248px); }
[dir="rtl"] .app { background: linear-gradient(270deg, var(--paper) 0 247px, var(--line) 247px 248px, var(--ground) 248px); }
.sidebar { border-inline-end: 0; }
@media (max-width: 900px) {
    .app, [dir="rtl"] .app { background: var(--ground); }
}
.nowrap { white-space: nowrap; }

/* Analytics choice (consent.js). Above the page, never over the main button for long. */
.consent { position: fixed; inset-inline: 16px; bottom: 16px; z-index: 50; max-width: 560px; margin-inline-start: auto; display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow-pop); font-size: .925rem; }
.consent[hidden] { display: none; }
.consent p { margin: 0; color: var(--ink-soft); }
.consent-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.consent-accept { background: var(--purple); border-color: var(--purple); color: #FFFFFF; }
.consent-accept:hover { background: var(--purple-hover); border-color: var(--purple-hover); color: #FFFFFF; }
.admin .app .content > h1 { font-size: 1.75rem; }
/* On narrow screens the segmented control scrolls inside itself instead of widening the page. */
.segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented a { flex-shrink: 0; }
/* Share and progress bars grow from the reading start: from the right in Arabic. */
[dir="rtl"] .share { transform: scaleX(-1); }
/* Long translated column names wrap instead of pushing the table wider. */
table.data th { white-space: normal; }

/* ---- Content admin (D17 to D22): editor, photo picker, languages, SEO checks ---- */
.rich-editor { border: 1px solid var(--field); border-radius: var(--radius-input); background: var(--paper); }
.rich-editor:focus-within { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(123, 63, 242, .14); }
.rich-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; border-bottom: 1px solid var(--line); background: var(--ground); border-radius: var(--radius-input) var(--radius-input) 0 0; position: sticky; top: 0; z-index: 3; }
.rich-toolbar[hidden] { display: none; }
.rich-group { display: inline-flex; gap: 2px; padding-inline-end: 8px; border-inline-end: 1px solid var(--line); }
.rich-toolbar button { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); font: 600 .85rem/1 var(--font); cursor: pointer; }
.rich-toolbar button:hover { background: var(--paper); border-color: var(--line); }
.rich-toolbar button[aria-pressed="true"] { background: var(--tint); border-color: var(--lavender); color: var(--purple-active); }
.rich-toolbar button:disabled { opacity: .35; cursor: default; background: transparent; border-color: transparent; }
.rich-toolbar .rich-source-toggle { margin-inline-start: auto; font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; }
.rich-surface { min-height: 320px; max-height: 72vh; overflow-y: auto; padding: 18px 22px; outline: none; max-width: none; }
.rich-surface[hidden] { display: none; }
.rich-surface:empty::before { content: attr(data-placeholder); color: var(--field); pointer-events: none; }
.rich-surface img { display: inline-block; max-width: min(100%, 560px); height: auto; border-radius: 8px; }
.rich-editor .rich-source { border: 0; border-radius: 0 0 var(--radius-input) var(--radius-input); min-height: 320px; font: .9rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.rich-editor .rich-source:focus { outline: none; }
.rich-status { display: block; padding: 8px 12px; font-size: .85rem; border-top: 1px solid var(--line); color: var(--ink-soft); }
.rich-status:empty { display: none; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; background: var(--ground); border: 1px solid var(--line); border-radius: 6px; padding: .1em .35em; }
.prose pre { background: #1B1530; color: #F4F2FF; border-radius: 10px; padding: 16px; overflow-x: auto; direction: ltr; text-align: left; }
.prose pre code { background: none; border: 0; padding: 0; color: inherit; }
.prose blockquote { margin: 1em 0; padding: .6em 1em; border-inline-start: 3px solid var(--purple); background: var(--ground); border-radius: 0 8px 8px 0; }
.prose img { max-width: 100%; height: auto; border-radius: 10px; }
.prose table { border-collapse: collapse; width: 100%; margin: 1em 0; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: start; }

.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space); align-items: start; }
.editor-layout > * { min-width: 0; }
.editor-side { display: flex; flex-direction: column; gap: var(--space); position: sticky; top: 16px; }
.editor-side .panel { margin-bottom: 0; padding: 18px; }
.editor-side h2 { font-size: 1rem; margin: 0 0 12px; }
.field-title input { font-weight: 600; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.counter { font-size: .78rem; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.counter-good { color: var(--ok); }
.counter-fix { color: var(--warn); }
.counter-bad { color: var(--danger); }
.lang-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }
.lang-tabs a { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink-soft); text-decoration: none; font-weight: 500; font-size: .9rem; }
.lang-tabs a:hover { border-color: var(--lavender); color: var(--ink); }
.lang-tabs a[aria-current="page"] { border-color: var(--purple); background: var(--tint); color: var(--purple-active); font-weight: 600; }
.state { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex-shrink: 0; }
.state-live { background: #16A34A; }
.state-draft { background: #F59E0B; }
.state-outdated { background: #DC2626; }
.state-scheduled { background: var(--purple); }
.state-missing { background: transparent; border: 1.5px dashed var(--field); }
.state-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--ink-soft); margin: 0; }
.state-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lang-dots { display: inline-flex; gap: 4px; align-items: center; }
.lang-dots .code { font-size: .7rem; font-weight: 600; text-transform: uppercase; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 3px; }
.serp { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--paper); direction: ltr; text-align: left; font-family: Arial, sans-serif; }
[dir="rtl"] .serp.serp-rtl, .serp[dir="rtl"] { direction: rtl; text-align: right; }
.serp-url { color: #202124; font-size: .8rem; margin: 0 0 4px; overflow-wrap: anywhere; }
.serp-title { color: #1A0DAB; font-size: 1.1rem; line-height: 1.3; margin: 0 0 4px; }
.serp-desc { color: #4D5156; font-size: .85rem; line-height: 1.5; margin: 0; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: .88rem; }
.checks li { display: flex; gap: 10px; align-items: flex-start; }
.checks li::before { content: ""; flex-shrink: 0; width: 10px; height: 10px; margin-top: .45em; border-radius: 50%; background: var(--line); }
.checks .check-good::before { background: #16A34A; }
.checks .check-fix::before { background: #F59E0B; }
.checks .check-bad::before { background: #DC2626; }
.score { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 28px; padding: 0 8px; border-radius: 999px; font-weight: 700; font-size: .85rem; font-variant-numeric: tabular-nums; }
.score-good { background: var(--ok-bg); color: var(--ok); }
.score-fix { background: var(--warn-bg); color: var(--warn); }
.score-bad { background: var(--danger-bg); color: var(--danger); }
.media-field { display: flex; flex-direction: column; gap: 10px; }
.media-field [data-media-preview] img, .thumb { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--ground); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.media-card { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.media-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--ground); }
.media-card .meta { font-size: .78rem; color: var(--ink-soft); display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.media-card form { margin: 0; }
.media-card details summary { cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--purple); }
.picker { width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 0; border-radius: 18px; padding: 0; box-shadow: var(--shadow-pop); }
.picker::backdrop { background: rgba(14, 15, 26, .45); }
.picker-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--paper); z-index: 1; }
.picker-head h2 { margin: 0; font-size: 1.1rem; }
.picker-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 20px 0; }
.picker-tools form { display: flex; gap: 8px; flex: 1 1 280px; margin: 0; }
.picker-tools input { height: 44px; }
.picker-tools [aria-pressed="true"] { background: var(--tint); border-color: var(--purple); color: var(--purple-active); }
.picker-body { padding: 16px 20px 20px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.pick { display: flex; flex-direction: column; gap: 6px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); cursor: pointer; text-align: start; font: inherit; font-size: .78rem; color: var(--ink-soft); }
.pick:hover, .pick:focus-visible { border-color: var(--purple); }
.pick img { width: 100%; height: 110px; object-fit: cover; border-radius: 8px; background: var(--ground); }
.pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pexels-credit { font-size: .78rem; color: var(--ink-soft); }
.plugin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space); }
.plugin { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.plugin-head { display: flex; gap: 12px; align-items: flex-start; }
.plugin-icon { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 12px; background: var(--tint); color: var(--purple-active); flex-shrink: 0; }
.plugin-icon .icon { width: 22px; height: 22px; }
.plugin h2 { margin: 0; font-size: 1.05rem; }
.plugin p { margin: 0; color: var(--ink-soft); font-size: .9rem; }
.plugin-foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.plugin.is-off { background: var(--ground); }
.plugin.is-off .plugin-icon { background: var(--line); color: var(--ink-soft); }
.text-rows { display: flex; flex-direction: column; gap: 10px; }
.text-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.text-row.is-edited { border-color: var(--lavender); background: #FCFAFF; }
.text-row .source { font-size: .9rem; color: var(--ink-soft); margin: 0; overflow-wrap: anywhere; }
.text-row .source small { display: block; margin-top: 6px; font-size: .75rem; }
.text-row textarea { min-height: 50px; resize: vertical; }
.text-row .row-tools { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .8rem; color: var(--ink-soft); }
.sticky-save { position: sticky; bottom: 0; z-index: 4; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 16px; margin-top: 12px; background: rgba(255, 255, 255, .94); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); backdrop-filter: blur(6px); }
.repeat-item { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: var(--paper); margin-bottom: 12px; }
.repeat-item summary { cursor: pointer; font-weight: 600; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 12px; }
.lang-grid .field { margin: 0; }
.token-box { display: flex; gap: 8px; align-items: center; padding: 12px; border: 1px dashed var(--purple); border-radius: 12px; background: var(--tint); }
.token-box code, .code-block { font: .85rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; direction: ltr; }
.code-block { display: block; white-space: pre; overflow-x: auto; padding: 14px 16px; background: #1B1530; color: #F4F2FF; border-radius: 12px; text-align: left; margin: 0 0 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; direction: ltr; unicode-bidi: isolate; }
.robots-box { min-height: 260px; font: .9rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; direction: ltr; text-align: left; }
@media (max-width: 1100px) {
    .editor-layout { grid-template-columns: 1fr; }
    .editor-side { position: static; }
}
@media (max-width: 720px) {
    .text-row { grid-template-columns: 1fr; }
    .rich-surface { padding: 14px; }
}
.section-title { margin: 32px 0 16px; font-size: 1.25rem; }
.media-field .label { font-weight: 600; font-size: .9rem; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; font-weight: 500; }
.check input { width: 18px; height: 18px; }
fieldset.field { border: 0; padding: 0; margin: 0 0 var(--space); display: flex; flex-direction: column; gap: 4px; }
fieldset.field legend { font-weight: 600; margin-bottom: 6px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.block { display: block; }
.spread { justify-content: space-between; width: 100%; }
.hint { overflow-wrap: anywhere; }
.field-title input { height: 50px; font-size: 1.15rem; }
@media (max-width: 720px) {
    .rich-toolbar button { min-width: 44px; height: 44px; }
    .lang-tabs a { min-height: 44px; }
}
/* Hidden labels inside a scrolling table stay inside it instead of widening the page. */
.table-wrap { position: relative; }
