/* ============================================================
   Royex Library – site.css
   Brand tokens (--brand, --accent, --bg, --surface, --text, fonts,
   radius) are injected per page from dbo.BrandingSettings.
   Layout uses logical properties so RTL (Arabic) works without
   a separate stylesheet.
   ============================================================ */

:root {
  --ink-2: color-mix(in srgb, var(--text) 62%, transparent);
  --ink-3: color-mix(in srgb, var(--text) 40%, transparent);
  --line: color-mix(in srgb, var(--text) 11%, transparent);
  --line-2: color-mix(in srgb, var(--text) 6%, transparent);
  --brand-soft: color-mix(in srgb, var(--brand) 10%, transparent);
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px -12px rgba(0,0,0,.18);
  --font: var(--font-en);
  --sidebar-w: 248px;
  --topbar-h: 64px;
}
[dir="rtl"] { --font: var(--font-ar); }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--text); background: var(--bg); min-height: 100vh; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75em; }
small, .muted { color: var(--ink-2); }
.muted { font-size: .9rem; }
.link { color: var(--brand); font-weight: 500; }
.link:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

svg.ic, .icon-btn svg, .sidenav svg, .ai-fab svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
svg.ic.star { fill: #F5B301; stroke: #F5B301; width: 13px; height: 13px; }
svg.ic.danger { color: var(--danger); } svg.ic.muted { color: var(--ink-3); }
.only-dark { display: none; } [data-theme="dark"] .only-light { display: none; } [data-theme="dark"] .only-dark { display: inline; }
@media (prefers-color-scheme: dark) { [data-theme="system"] .only-light { display: none; } [data-theme="system"] .only-dark { display: inline; } }
.logo-dark { display: none; } [data-theme="dark"] .logo-light { display: none; } [data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) { [data-theme="system"] .logo-light { display: none; } [data-theme="system"] .logo-dark { display: block; } }

.wrap { width: min(1240px, 100% - 2rem); margin-inline: auto; }
.section { padding-block: 2rem 1rem; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-head p { margin: .2rem 0 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; }
@media (max-width: 1000px) { .grid-3, .grid-2-1 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-2-1 { grid-template-columns: 1fr; } }
.mt { margin-top: 1.25rem; }

/* ---------- buttons, fields, tags ---------- */
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .65rem 1.1rem; border-radius: calc(var(--radius) - 2px); font: inherit; font-weight: 600; font-size: .92rem; border: 1px solid transparent; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 86%, #000); }
.hero-cta { background: #2563eb; }
.hero-cta:hover { background: #1d4ed8; }
.btn-outline { background: transparent; border-color: var(--line); color: var(--text); }
.btn-outline:hover { border-color: var(--text); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--line-2); }
.btn-sm { padding: .45rem .8rem; font-size: .85rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { display: inline-flex; align-items: center; gap: .35rem; padding: .5rem; border-radius: 999px; background: transparent; border: 0; color: var(--text); cursor: pointer; font: inherit; font-size: .85rem; position: relative; }
.icon-btn:hover { background: var(--line-2); }
.lang-label { font-weight: 600; }
@media (max-width: 720px) { .lang-label { display: none; } }
.field { display: block; margin-bottom: 1rem; }
.field > span { display: block; font-size: .85rem; font-weight: 500; margin-bottom: .35rem; color: var(--ink-2); }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], input[type="date"], input[type="datetime-local"], input[type="url"], input[type="color"], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: calc(var(--radius) - 2px); padding: .65rem .85rem; transition: border-color .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; font-size: .9rem; }
.check { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }
.form-error { color: var(--danger); font-size: .9rem; margin-bottom: .75rem; }
.tag { display: inline-flex; align-items: center; gap: .25rem; padding: .15rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.tag-text { background: var(--brand-soft); color: var(--brand); } .tag-audio { background: #eef; color: #3b3bb3; } .tag-video { background: #e9f7ef; color: #1e7a45; } .tag-document { background: #fdf2e0; color: #9a6300; }
[data-theme="dark"] .tag-audio { background: #262649; color: #aeaeff; } [data-theme="dark"] .tag-video { background: #163a26; color: #7fdba3; } [data-theme="dark"] .tag-document { background: #3d2f12; color: #f2c46d; }
.tag-warn { background: #fff4d6; color: #8a5a00; } .tag-danger { background: #fde3e3; color: var(--danger); } .tag-positive { background: #e3f6ea; color: #1e7a45; } .tag-negative { background: #fde3e3; color: var(--danger); } .tag-neutral { background: var(--line-2); }
[data-theme="dark"] .tag-warn { background: #3d2f12; color: #f2c46d; } [data-theme="dark"] .tag-danger, [data-theme="dark"] .tag-negative { background: #3f1717; color: #ff9c9c; } [data-theme="dark"] .tag-positive { background: #163a26; color: #7fdba3; }
.tag-muted { background: var(--line-2); color: var(--ink-2); }
.badge-dot { position: absolute; top: 2px; inset-inline-end: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--brand); color: #fff; font-size: .65rem; font-weight: 700; display: grid; place-items: center; }
.toast { position: fixed; bottom: 1.25rem; inset-inline-start: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: .75rem 1.25rem; border-radius: 999px; z-index: 50; box-shadow: var(--shadow); transition: opacity .3s; }
[dir="rtl"] .toast { transform: translateX(50%); }
.toast.ok { background: var(--ok); color: #fff; } .toast.err { background: var(--danger); color: #fff; } .toast.hide { opacity: 0; pointer-events: none; }
.empty { text-align: center; padding: 4rem 1rem; display: grid; gap: 1rem; justify-items: center; }

/* ---------- menus ---------- */
details.menu { position: relative; }
details.menu summary { list-style: none; cursor: pointer; }
details.menu summary::-webkit-details-marker { display: none; }
.avatar-btn { display: inline-flex; align-items: center; gap: .6rem; }
.avatar-btn img, .avatar-initial { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.avatar-initial { display: inline-grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700; font-size: .95rem; }
.avatar-initial.sm { width: 28px; height: 28px; font-size: .8rem; flex: none; }
.avatar-name { display: flex; flex-direction: column; line-height: 1.15; font-size: .85rem; font-weight: 600; }
.avatar-name small { font-weight: 400; font-size: .72rem; }
.menu-panel { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; min-width: 220px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: .4rem; z-index: 40; display: grid; }
.menu-head { padding: .6rem .8rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; display: grid; }
.menu-head small { font-size: .78rem; }
.menu-panel a, .menu-panel button { display: block; width: 100%; text-align: start; padding: .55rem .8rem; border-radius: 8px; background: none; border: 0; font: inherit; color: inherit; cursor: pointer; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--line-2); }

/* ============================================================
   PORTAL
   ============================================================ */
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 1.25rem; height: var(--topbar-h); }
.logo img { height: 34px; width: auto; max-width: 180px; object-fit: contain; }
.mainnav { display: flex; gap: .25rem; }
.mainnav a { padding: .45rem .75rem; border-radius: 999px; font-weight: 500; font-size: .92rem; color: var(--ink-2); }
.mainnav a:hover { color: var(--text); background: var(--line-2); }
.mainnav a.active { color: var(--brand); font-weight: 600; }
.search { flex: 1; max-width: 420px; margin-inline-start: auto; position: relative; }
.search svg { position: absolute; inset-inline-start: .85rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; stroke: var(--ink-3); fill: none; stroke-width: 2; }
.search input { padding-inline-start: 2.4rem; border-radius: 999px; background: var(--surface); border-color: transparent; }
.search input:focus { background: var(--bg); }
.topbar-actions { display: flex; align-items: center; gap: .25rem; }
.nav-toggle { display: none; }
@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; }
  .mainnav { display: none; position: absolute; top: var(--topbar-h); inset-inline: 0; flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--line); padding: .5rem 1rem 1rem; }
  .mainnav.open { display: flex; }
  .search { display: none; }
}

.portal-main { min-height: calc(100vh - var(--topbar-h) - 80px); padding-bottom: 5rem; }

/* hero */
.hero { position: relative; background: var(--brand-2); color: #fff; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; background: var(--hero-img, none) center/cover no-repeat; opacity: .35; }
.hero::after { content: ""; position: absolute; inset-inline-end: -10%; top: -40%; width: 60%; aspect-ratio: 1; border-radius: 50%; background: var(--brand); opacity: .35; filter: blur(80px); }
.hero-inner { position: relative; display: grid; grid-template-columns: 1.3fr 1fr; gap: 2rem; padding-block: 3.5rem; align-items: center; }
.hero h1 { font-size: clamp(1.8rem, 3.5vw, 2.8rem); max-width: 18ch; margin-bottom: .75rem; }
.hero p { font-size: 1.05rem; opacity: .85; max-width: 46ch; margin-bottom: 1.5rem; }
.hero-side { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.hero-side a { display: grid; gap: .15rem; padding: 1rem 1.15rem; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius); transition: background .15s; }
.hero-side a:hover { background: rgba(255,255,255,.14); }
.hero-side span { font-size: .85rem; opacity: .75; }
@media (max-width: 800px) { .hero-inner { grid-template-columns: 1fr; padding-block: 2.5rem; } .hero-side { display: none; } }

/* continue reading */
.continue-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .9rem; }
.continue-card { display: flex; gap: .9rem; align-items: center; padding: .75rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color .15s; }
.continue-card:hover { border-color: var(--brand); }
.continue-card img { width: 56px; height: 80px; object-fit: cover; border-radius: 6px; flex: none; }
.continue-body { display: grid; gap: .2rem; flex: 1; min-width: 0; }
.continue-body strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.continue-card > svg { color: var(--ink-3); flex: none; }
.progress { display: block; height: 5px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }

/* shelves & cards */
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: 168px; gap: 1.1rem; overflow-x: auto; padding-bottom: .75rem; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.shelf > .card { scroll-snap-align: start; }
.card { display: grid; gap: .35rem; align-content: start; }
.cover { position: relative; display: block; aspect-ratio: 2/3; border-radius: 10px; overflow: hidden; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.08); transition: transform .2s, box-shadow .2s; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.card:hover .cover { transform: translateY(-3px); box-shadow: 0 12px 24px -12px rgba(0,0,0,.35); }
.cover-type { position: absolute; bottom: .5rem; inset-inline-start: .5rem; display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .5rem; border-radius: 999px; font-size: .7rem; font-weight: 600; background: rgba(0,0,0,.65); color: #fff; backdrop-filter: blur(4px); }
.cover-type svg { width: 12px; height: 12px; }
.cover-flag { position: absolute; top: .5rem; inset-inline-start: .5rem; padding: .15rem .5rem; border-radius: 4px; font-size: .68rem; font-weight: 700; background: var(--brand); color: #fff; }
.cover-flag.alt { background: #111; }
.cover-progress { position: absolute; bottom: 0; inset-inline: 0; height: 4px; background: rgba(255,255,255,.4); }
.cover-progress span { display: block; height: 100%; background: var(--brand); }
.card-title { font-size: .9rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-author { font-size: .8rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { display: flex; gap: .6rem; font-size: .75rem; color: var(--ink-3); }
.card-meta .lang { margin-inline-start: auto; font-weight: 600; }

/* categories */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; }
.cat { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .15s, background .15s; }
.cat:hover { border-color: var(--cat); background: color-mix(in srgb, var(--cat) 6%, transparent); }
.cat-swatch { width: 10px; height: 36px; border-radius: 4px; background: var(--cat); flex: none; }
.cat strong { flex: 1; font-size: .92rem; font-weight: 500; }
.cat small { color: var(--ink-3); }

/* campaigns & events */
.campaign-card, .event-card { display: block; padding: 1rem 1.15rem; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .75rem; transition: border-color .15s; }
.campaign-card:hover, .event-card:hover { border-color: var(--brand); }
.campaign-card strong { display: block; margin-bottom: .25rem; }
.campaign-card p { color: var(--ink-2); font-size: .9rem; margin-bottom: .4rem; }
.event-card { display: flex; gap: 1rem; align-items: center; }
.event-date { flex: none; width: 54px; text-align: center; border-radius: 10px; background: var(--brand-soft); color: var(--brand); padding: .4rem 0; line-height: 1.1; }
.event-date b { display: block; font-size: 1.4rem; }
.event-date small { font-size: .72rem; font-weight: 600; text-transform: uppercase; color: inherit; }
.event-card > span:last-child { display: grid; }
.event-card small { color: var(--ink-2); }

.footer { border-top: 1px solid var(--line); padding: 1.5rem 0; font-size: .85rem; color: var(--ink-2); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.footer a { color: var(--brand); }
.offline-banner { position: fixed; bottom: 0; inset-inline: 0; background: var(--warn); color: #111; text-align: center; padding: .5rem; font-size: .85rem; z-index: 60; }

/* AI floating assistant */
.ai-fab { position: fixed; bottom: 1.5rem; inset-inline-end: 1.5rem; z-index: 45; display: inline-flex; align-items: center; gap: .5rem; padding: .8rem 1.1rem; border-radius: 999px; border: 0; background: var(--brand); color: #fff; font: inherit; font-weight: 600; box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--brand) 60%, transparent); cursor: pointer; }
.ai-fab svg { width: 20px; height: 20px; }
.ai-fab.on { background: var(--text); color: var(--bg); }
.ai-panel { position: fixed; bottom: 5.25rem; inset-inline-end: 1.5rem; width: min(400px, calc(100vw - 2rem)); height: min(620px, calc(100vh - 7rem)); background: var(--bg); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 48px -16px rgba(0,0,0,.35); z-index: 45; overflow: hidden; display: flex; flex-direction: column; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-page { background: var(--bg); }
.login-split { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-visual { position: relative; background: var(--brand-2) center/cover; color: #fff; padding: 2.5rem; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.login-visual::after { content: ""; position: absolute; inset-inline-start: -20%; bottom: -30%; width: 70%; aspect-ratio: 1; border-radius: 50%; background: var(--brand); opacity: .5; filter: blur(90px); }
.login-logo { height: 44px; width: auto; max-width: 240px; align-self: flex-start; object-fit: contain; position: relative; z-index: 1; }
.login-visual-text { position: relative; z-index: 1; max-width: 40ch; }
.login-visual-text h2 { font-size: 2.2rem; margin-bottom: .5rem; }
.login-visual-text p { font-size: 1.1rem; opacity: .8; }
.login-shelf { position: absolute; inset-inline-end: 2.5rem; bottom: 0; display: flex; gap: 10px; align-items: flex-end; height: 62%; z-index: 1; }
.login-shelf span { width: 44px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); border-bottom: 0; border-radius: 6px 6px 0 0; }
.login-shelf span:nth-child(1) { height: 60%; } .login-shelf span:nth-child(2) { height: 85%; background: var(--brand); } .login-shelf span:nth-child(3) { height: 70%; } .login-shelf span:nth-child(4) { height: 95%; } .login-shelf span:nth-child(5) { height: 55%; } .login-shelf span:nth-child(6) { height: 78%; }
.login-form { display: grid; grid-template-rows: auto 1fr; padding: 1.25rem 2rem 2rem; }
.login-form-top { display: flex; justify-content: flex-end; gap: .25rem; }
.login-card { width: min(400px, 100%); margin: auto; }
.login-logo-small { height: 34px; width: auto; max-width: 200px; object-fit: contain; margin-bottom: 2rem; }
.login-card h1 { font-size: 1.6rem; margin-bottom: .35rem; }
.login-card > .muted { margin-bottom: 1.5rem; }
.login-card form { margin-bottom: 1rem; }
.demo-accounts { margin-top: 1.5rem; font-size: .85rem; color: var(--ink-2); }
.demo-accounts summary { cursor: pointer; font-weight: 500; }
.demo-accounts ul { margin: .5rem 0; padding-inline-start: 1rem; }
.demo-accounts code { background: var(--surface); padding: .05rem .35rem; border-radius: 4px; }
@media (max-width: 860px) { .login-split { grid-template-columns: 1fr; } .login-visual { min-height: 220px; padding: 1.5rem; } .login-visual-text h2 { font-size: 1.5rem; } .login-shelf { display: none; } }

/* ============================================================
   ADMIN
   ============================================================ */
body.admin { background: var(--surface); }
.sidebar { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: var(--sidebar-w); background: #141416; color: #d5d5da; display: flex; flex-direction: column; z-index: 35; transition: transform .2s; }
.sidebar-logo { display: block; padding: 1.35rem 1.4rem .6rem; }
.sidebar-logo img { height: 30px; width: auto; max-width: 180px; object-fit: contain; }
.sidebar-app { padding: 0 1.4rem 1.2rem; font-size: .8rem; color: #8b8b93; display: grid; }
.sidebar-app span { font-weight: 600; color: #fff; }
.sidenav { display: grid; gap: 1px; padding: 0 .75rem .75rem; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: #333 transparent; }
.sidenav a { display: flex; align-items: center; gap: .75rem; padding: .5rem .8rem; border-radius: 10px; font-size: .9rem; font-weight: 500; color: #b3b3bb; position: relative; }
.sidenav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidenav a.active { background: rgba(255,255,255,.08); color: #fff; }
.sidenav a.active::before { content: ""; position: absolute; inset-inline-start: 0; top: 25%; height: 50%; width: 3px; border-radius: 3px; background: var(--brand); }
.sidenav svg, .sidebar-link svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-group { display: block; padding: 1rem .8rem .35rem; font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #6f6f78; }
.nav-group:first-child { padding-top: .25rem; }
.sidebar-foot { padding: .75rem; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-link { display: flex; align-items: center; gap: .75rem; padding: .55rem .8rem; border-radius: 10px; font-size: .85rem; color: #b3b3bb; }
.sidebar-link:hover { color: #fff; }
.admin-shell { margin-inline-start: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.admin-top { position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: 1rem; padding: 0 1.75rem; background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.admin-title { font-size: 1.25rem; flex: 1; }
.admin-top-actions { display: flex; align-items: center; gap: .35rem; }
.admin-main { padding: 1.5rem 1.75rem 3rem; display: grid; gap: 1.25rem; align-content: start; }
@media (max-width: 1000px) {
  .sidebar { transform: translateX(-100%); } [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: none; }
  .admin-shell { margin-inline-start: 0; }
  .admin-main { padding: 1rem; }
}

.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.segmented { display: inline-flex; gap: .25rem; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.segmented a { padding: .4rem .9rem; border-radius: 999px; font-size: .85rem; font-weight: 500; color: var(--ink-2); }
.segmented a.on { background: var(--text); color: var(--bg); }
.segmented .btn { margin-inline-start: .25rem; }

.attention { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: center; padding: .75rem 1.1rem; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); border-inline-start: 4px solid var(--warn); font-size: .9rem; }
.attention-title { font-weight: 600; display: inline-flex; gap: .4rem; align-items: center; color: var(--warn); filter: brightness(.8); }
[data-theme="dark"] .attention-title { filter: none; }
.attention a { color: var(--ink-2); } .attention a:hover { color: var(--text); } .attention b { color: var(--text); }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.kpi { position: relative; display: grid; gap: .25rem; align-content: start; padding: 1.1rem 1.25rem; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.kpi-label { font-size: .8rem; font-weight: 500; color: var(--ink-2); }
.kpi-value { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .8rem; color: var(--ink-3); }
.kpi-sub .warn { color: var(--danger); }
.kpi-hero { grid-column: span 1; grid-row: span 2; background: var(--brand); color: #fff; border: 0; overflow: hidden; }
.kpi-hero .kpi-label, .kpi-hero .kpi-sub { color: rgba(255,255,255,.75); }
.kpi-hero .kpi-value { font-size: 2.6rem; }
.kpi-delta { display: inline-flex; align-items: center; gap: .3rem; font-size: .9rem; font-weight: 600; }
.kpi-delta small { font-weight: 400; opacity: .75; }
.kpi-hero canvas { position: absolute; bottom: 0; inset-inline: 0; width: 100% !important; height: 60px !important; }
@media (max-width: 1200px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px) { .kpis { grid-template-columns: 1fr 1fr; } .kpi-hero { grid-column: span 2; grid-row: span 1; padding-bottom: 4rem; } }

.panel { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; min-width: 0; }
.panel-warn { border-inline-start: 4px solid var(--warn); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.panel-head h3 { font-size: 1rem; }
.panel canvas { max-width: 100%; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }

.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: start; font-weight: 600; font-size: .76rem; color: var(--ink-2); padding: .4rem .5rem; border-bottom: 1px solid var(--line); }
.table td { padding: .55rem .5rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table.compact td { padding: .38rem .5rem; }
.title-cell { display: flex; align-items: center; gap: .6rem; }
.title-cell img { width: 28px; height: 40px; object-fit: cover; border-radius: 4px; flex: none; background: var(--surface); }
.bar-cell { width: 40%; } .bar { height: 6px; border-radius: 999px; background: var(--brand); min-width: 2px; }
.row-link { cursor: pointer; } .row-link:hover td { background: var(--line-2); }

.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; max-height: 440px; overflow: auto; }
.feed li { display: grid; grid-template-columns: auto 1fr auto; gap: .7rem; align-items: center; padding: .45rem .25rem; border-bottom: 1px solid var(--line-2); font-size: .86rem; }
.feed li:last-child { border: 0; }
.feed-text i { font-style: normal; color: var(--brand); }
.feed-meta { display: inline-flex; gap: .4rem; align-items: center; font-size: .75rem; color: var(--ink-3); white-space: nowrap; }
.legend { font-size: .8rem; color: var(--ink-2); }

/* ============================================================
   LIBRARY LIST & DETAIL
   ============================================================ */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1.25rem 1.1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; align-items: center; padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--line); font-size: .82rem; font-weight: 500; color: var(--ink-2); background: var(--bg); cursor: pointer; }
.chip:hover { border-color: var(--text); color: var(--text); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.filters { display: grid; gap: .6rem; margin-bottom: 1.5rem; padding: 1rem 1.15rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.filter-group > span { font-size: .8rem; font-weight: 600; color: var(--ink-2); min-width: 70px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 2rem; }
.narrow { width: min(760px, 100% - 2rem); }
.notice { padding: .8rem 1rem; border-radius: var(--radius); background: #fff4d6; color: #8a5a00; font-size: .88rem; }
[data-theme="dark"] .notice { background: #3d2f12; color: #f2c46d; }

.detail { display: grid; grid-template-columns: 280px 1fr; gap: 2.5rem; align-items: start; }
.detail-cover { position: sticky; top: calc(var(--topbar-h) + 1rem); display: grid; gap: .6rem; }
.detail-cover > img { border-radius: 12px; aspect-ratio: 2/3; object-fit: cover; box-shadow: 0 20px 40px -20px rgba(0,0,0,.45); margin-bottom: .5rem; }
.detail-actions { display: grid; gap: .5rem; }
.detail-actions .btn.on { border-color: var(--brand); color: var(--brand); }
.detail-actions .btn.on svg { fill: var(--brand); }
.yourprogress { display: grid; gap: .3rem; }
.list-menu .menu-panel { position: static; margin-top: .25rem; }
.newlist { display: flex; gap: .4rem; padding: .4rem; }
.detail-body h1 { font-size: 2rem; margin: .5rem 0 .25rem; }
.detail-body .lead { font-size: 1.1rem; color: var(--ink-2); }
.byline { font-size: 1rem; color: var(--brand); font-weight: 500; }
.stats-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; padding: .9rem 0; border-block: 1px solid var(--line); margin-bottom: 1.5rem; font-size: .9rem; color: var(--ink-2); }
.stats-row b { color: var(--text); }
.detail-body h3 { margin: 1.5rem 0 .6rem; }
.desc { max-width: 70ch; white-space: pre-line; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; font-size: .9rem; margin: 0; }
.dl dt { color: var(--ink-2); } .dl dd { margin: 0; }
.chapters { margin: 0; padding-inline-start: 1.25rem; font-size: .9rem; display: grid; gap: .3rem; }
.chapters li { display: flex; justify-content: space-between; gap: 1rem; } .chapters small { color: var(--ink-3); }
.rate { display: flex; gap: .2rem; }
.rate .star { background: none; border: 0; cursor: pointer; padding: .15rem; }
.rate .star svg { width: 26px; height: 26px; fill: none; stroke: var(--ink-3); }
.rate .star.on svg { fill: #F5B301; stroke: #F5B301; }
.reviews { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
.reviews li { display: flex; gap: .75rem; } .reviews p { margin: .25rem 0 0; font-size: .92rem; } .reviews .stars { color: #F5B301; font-size: .8rem; margin-inline-start: .5rem; }
@media (max-width: 800px) { .detail { grid-template-columns: 1fr; } .detail-cover { position: static; grid-template-columns: 140px 1fr; align-items: start; } .detail-cover > img { grid-row: span 4; } }

/* ============================================================
   READER (EPUB / PDF) & PLAYERS
   ============================================================ */
.reader-page { overflow: hidden; height: 100vh; display: flex; flex-direction: column; }
.rd-top { display: flex; align-items: center; gap: .75rem; height: 56px; padding: 0 .75rem; border-bottom: 1px solid var(--line); background: var(--bg); z-index: 5; }
.rd-top > .icon-btn:first-child svg { transform: scaleX(-1); } [dir="rtl"] .rd-top > .icon-btn:first-child svg { transform: none; }
.rd-title { flex: 1; min-width: 0; display: grid; line-height: 1.15; }
.rd-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .95rem; }
.rd-title small { font-size: .75rem; }
.rd-actions { display: flex; align-items: center; gap: .1rem; }
.rd-shell { flex: 1; position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.rd-shell.theme-sepia .rd-stage { background: #F4ECD8; } .rd-shell.theme-dark .rd-stage { background: #121214; } .rd-shell.theme-light .rd-stage { background: #fff; }
.rd-stage { flex: 1; position: relative; display: flex; align-items: stretch; min-height: 0; }
.rd-view { flex: 1; min-width: 0; position: relative; overflow: auto; display: flex; justify-content: center; }
.rd-view iframe { border: 0; width: 100%; height: 100%; background: #fff; }
#rd-canvas { margin: 8px auto; box-shadow: 0 2px 12px rgba(0,0,0,.15); background: #fff; }
.rd-nav { flex: none; width: 56px; border: 0; background: transparent; cursor: pointer; color: var(--ink-3); display: grid; place-items: center; }
.rd-nav:hover { color: var(--brand); background: var(--line-2); }
.rd-nav.prev svg { transform: scaleX(-1); } [dir="rtl"] .rd-nav.prev svg { transform: none; } [dir="rtl"] .rd-nav.next svg { transform: scaleX(-1); }
.rd-nav svg { width: 22px; height: 22px; }
@media (max-width: 720px) { .rd-nav { display: none; } }
.rd-bottom { display: flex; align-items: center; gap: .75rem; padding: .5rem 1rem; border-top: 1px solid var(--line); background: var(--bg); font-size: .85rem; }
.rd-bottom input[type="range"] { flex: 1; accent-color: var(--brand); }
#rd-pos { min-width: 40px; text-align: end; font-variant-numeric: tabular-nums; }
.rd-panel { position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: min(360px, 100%); background: var(--bg); border-inline-start: 1px solid var(--line); z-index: 6; padding: 1rem; overflow: auto; box-shadow: -12px 0 30px -20px rgba(0,0,0,.4); }
.rd-panel h3 { margin-bottom: .75rem; }
.rd-toc { margin: 0; padding: 0; list-style: none; font-size: .9rem; } .rd-toc li { border-bottom: 1px solid var(--line-2); } .rd-toc a { display: block; padding: .5rem .25rem; } .rd-toc a:hover { color: var(--brand); }
.rd-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.rd-notes li { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; padding: .6rem; border-radius: 10px; border: 1px solid var(--line); border-inline-start: 4px solid var(--hl, #FFEB3B); cursor: pointer; font-size: .85rem; }
.rd-notes q { display: block; color: var(--ink-2); font-style: italic; } .rd-notes p { margin: .25rem 0 0; } .rd-notes small { color: var(--ink-3); }
.rd-del { padding: .2rem .4rem; font-size: .8rem; }
.rd-results { list-style: none; margin: .75rem 0 0; padding: 0; font-size: .85rem; display: grid; gap: .25rem; } .rd-results a { display: block; padding: .4rem; border-radius: 6px; } .rd-results a:hover { background: var(--line-2); }
.rd-font, .rd-themes { display: flex; align-items: center; gap: .5rem; }
.rd-font button, .rd-themes button { font: inherit; padding: .45rem .8rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); cursor: pointer; color: inherit; }
.rd-font b { min-width: 36px; text-align: center; }
.t-sepia { background: #F4ECD8 !important; color: #3b2f1e !important; } .t-dark { background: #121214 !important; color: #eee !important; } .t-light { background: #fff !important; color: #111 !important; }
.rd-popup { position: fixed; z-index: 9; display: flex; gap: .4rem; align-items: center; padding: .4rem; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); }
.rd-popup [data-hl] { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; cursor: pointer; box-shadow: 0 0 0 1px var(--line); }
.rd-notebox { position: fixed; bottom: 70px; inset-inline: 0; margin: auto; width: min(420px, 90%); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: .75rem; display: grid; gap: .5rem; z-index: 9; box-shadow: var(--shadow); }
.rd-toast { position: fixed; top: 66px; inset-inline-end: 1rem; background: var(--text); color: var(--bg); padding: .35rem .8rem; border-radius: 999px; font-size: .8rem; z-index: 10; }

.pl-shell { flex: 1; position: relative; overflow: auto; }
.pl-shell.audio { display: grid; grid-template-columns: minmax(220px, 360px) 1fr; gap: 3rem; align-items: center; padding: 2rem clamp(1rem, 6vw, 5rem); background: radial-gradient(ellipse at 20% 0%, var(--brand-soft), transparent 55%), var(--bg); }
.pl-art { position: relative; } .pl-art img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 18px; box-shadow: 0 30px 60px -30px rgba(0,0,0,.6); }
.pl-bars { position: absolute; bottom: 14px; inset-inline-start: 14px; display: flex; gap: 3px; align-items: flex-end; height: 22px; opacity: 0; transition: opacity .2s; }
.pl-bars.on { opacity: 1; } .pl-bars span { width: 4px; background: #fff; border-radius: 2px; animation: eq .9s ease-in-out infinite alternate; height: 40%; }
.pl-bars span:nth-child(2) { animation-delay: .15s } .pl-bars span:nth-child(3) { animation-delay: .3s } .pl-bars span:nth-child(4) { animation-delay: .45s } .pl-bars span:nth-child(5) { animation-delay: .6s }
@keyframes eq { to { height: 100%; } }
.pl-main h2 { font-size: 1.7rem; margin: .25rem 0; }
.pl-chapter { color: var(--brand); font-weight: 500; min-height: 1.4em; }
.pl-seek { display: flex; align-items: center; gap: .75rem; font-variant-numeric: tabular-nums; font-size: .85rem; margin: 1rem 0; }
.pl-seek input { flex: 1; accent-color: var(--brand); }
.pl-controls { display: flex; align-items: center; justify-content: center; gap: .75rem; margin: .5rem 0 1rem; }
.pl-controls.inline { justify-content: flex-start; }
.pl-btn { font: inherit; font-weight: 600; font-size: .85rem; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; display: grid; place-items: center; }
.pl-btn:hover { border-color: var(--text); }
.pl-play { width: 68px; height: 68px; background: var(--brand); color: #fff; border: 0; }
.pl-play svg { width: 28px; height: 28px; }
.pl-extra { display: flex; gap: 1.5rem; font-size: .85rem; color: var(--ink-2); }
.pl-extra select { width: auto; padding: .3rem .5rem; margin-inline-start: .3rem; }
.pl-panel { top: 0; }
.pl-chapters { list-style: none; margin: 0; padding: 0; counter-reset: ch; }
.pl-chapters li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem .5rem; border-bottom: 1px solid var(--line-2); cursor: pointer; font-size: .9rem; counter-increment: ch; }
.pl-chapters li::before { content: counter(ch) "."; color: var(--ink-3); margin-inline-end: .5rem; }
.pl-chapters li.on { color: var(--brand); font-weight: 600; } .pl-chapters small { color: var(--ink-3); }
@media (max-width: 800px) { .pl-shell.audio { grid-template-columns: 1fr; gap: 1.25rem; padding: 1.25rem; align-content: start; } .pl-art { max-width: 260px; margin: 0 auto; } .pl-main { text-align: center; } .pl-extra { justify-content: center; } }
.pl-shell.video { display: grid; grid-template-rows: auto 1fr; background: #000; color: #eee; }
.pl-video { position: relative; background: #000; max-height: 72vh; display: grid; }
.pl-video video { width: 100%; max-height: 72vh; margin: 0 auto; cursor: pointer; }
.pl-vbar { display: flex; align-items: center; gap: .6rem; padding: .5rem 1rem; background: #111; font-size: .8rem; font-variant-numeric: tabular-nums; }
.pl-vbar input[type="range"] { flex: 1; accent-color: var(--brand); } .pl-vbar select { width: auto; padding: .25rem .4rem; background: #222; color: #eee; border-color: #333; }
.pl-vbar .pl-btn { width: 36px; height: 36px; background: #222; border-color: #333; color: #eee; } .pl-vbar .pl-play { width: 42px; height: 42px; background: var(--brand); }
.pl-vinfo { padding: 1.25rem clamp(1rem, 4vw, 3rem); background: var(--bg); color: var(--text); }
.pl-vinfo h2 { margin-bottom: .25rem; }

/* ============================================================
   MY LIBRARY / NOTIFICATIONS / PROFILE
   ============================================================ */
.my-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.my-stats .kpi { background: var(--surface); }
.kpi-goal .kpi-value small { font-size: .9rem; font-weight: 500; color: var(--ink-2); }
@media (max-width: 720px) { .my-stats { grid-template-columns: 1fr 1fr; } }
.inline-form { display: flex; gap: .4rem; } .inline-form input { width: 200px; padding: .45rem .7rem; }
.list-block { margin-bottom: 1.5rem; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .9rem; }
.badge { display: grid; gap: .2rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.badge.locked { opacity: .45; filter: grayscale(1); }
.badge-icon { font-size: 1.8rem; }
.notifs { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.notifs li a { display: block; padding: .9rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); }
.notifs li.unread a { border-inline-start: 4px solid var(--brand); background: var(--brand-soft); }
.notifs p { margin: .2rem 0 .4rem; font-size: .9rem; color: var(--ink-2); }
.profile-form { display: grid; gap: 1rem; }
.profile-form .panel h3 { margin-bottom: .9rem; }
.profile-form .check { display: flex; margin-bottom: .5rem; }
.profile-id { display: flex; gap: .9rem; align-items: center; margin-bottom: 1rem; }

/* ============================================================
   AI ASSISTANT PANEL
   ============================================================ */
.ai-head { display: flex; align-items: center; gap: .7rem; padding: .9rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.ai-head div { flex: 1; display: grid; line-height: 1.2; } .ai-head small { font-size: .75rem; }
.ai-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; } .ai-avatar svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.ai-voice-toggle { display: inline-flex; align-items: center; cursor: pointer; padding: .4rem; border-radius: 50%; color: var(--ink-3); } .ai-voice-toggle input { display: none; } .ai-voice-toggle:has(input:checked) { color: var(--brand); background: var(--brand-soft); } .ai-voice-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.ai-messages { flex: 1; overflow: auto; padding: 1rem; display: grid; gap: .6rem; align-content: start; }
.ai-msg { max-width: 88%; padding: .6rem .85rem; border-radius: 14px; font-size: .9rem; line-height: 1.5; position: relative; }
.ai-msg p { margin: 0; }
.ai-msg.user { justify-self: end; background: var(--brand); color: #fff; border-end-end-radius: 4px; }
.ai-msg.bot { justify-self: start; background: var(--surface); border-end-start-radius: 4px; }
.ai-msg.thinking { color: var(--ink-2); }
.dots i { display: inline-block; width: 5px; height: 5px; margin: 0 1px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite; } .dots i:nth-child(2) { animation-delay: .2s } .dots i:nth-child(3) { animation-delay: .4s }
@keyframes blink { 0%, 80%, 100% { opacity: .2 } 40% { opacity: 1 } }
.ai-suggestions { display: flex; flex-wrap: wrap; gap: .4rem; }
.ai-suggestions button { font: inherit; font-size: .8rem; padding: .35rem .7rem; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; text-align: start; }
.ai-suggestions button:hover { border-color: var(--brand); color: var(--brand); }
.ai-action { display: inline-block; margin-top: .4rem; font-size: .78rem; color: var(--ok); font-weight: 600; }
.ai-cards { display: grid; gap: .4rem; margin-top: .5rem; }
.ai-card { display: flex; gap: .6rem; align-items: center; padding: .4rem; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.ai-card img { width: 36px; height: 52px; object-fit: cover; border-radius: 4px; } .ai-card span { display: grid; line-height: 1.2; } .ai-card small { color: var(--ink-3); font-size: .72rem; }
.ai-rate { display: flex; gap: .2rem; justify-content: flex-end; margin-top: .3rem; font-size: .8rem; } .ai-rate button { background: none; border: 0; cursor: pointer; opacity: .5; padding: 0 .15rem; } .ai-rate button:hover { opacity: 1; }
.ai-input { display: flex; align-items: center; gap: .35rem; padding: .6rem; border-top: 1px solid var(--line); }
.ai-input input { flex: 1; border-radius: 999px; }
.ai-mic.rec { color: #fff; background: var(--danger); animation: pulse 1.2s infinite; }
.ai-send { background: var(--brand); color: #fff; } .ai-send:hover { background: var(--brand); } [dir="rtl"] .ai-send svg { transform: scaleX(-1); }

/* ============================================================
   EVENTS / CAMPAIGNS / NEWS
   ============================================================ */
h2.sub { margin: 1.5rem 0 .75rem; font-size: 1.1rem; }
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .9rem; }
.event-tile { display: flex; gap: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); transition: border-color .15s; }
.event-tile:hover { border-color: var(--brand); } .event-grid.past .event-tile { opacity: .7; }
.event-tile-body { display: grid; gap: .2rem; align-content: start; } .event-tile-body .tag { justify-self: start; } .event-tile-body small { color: var(--ink-2); }
.event-hero, .campaign-hero { position: relative; margin: 1rem 0 1.5rem; padding: 2rem; border-radius: 18px; background: var(--brand-2); color: #fff; overflow: hidden; }
.event-hero::before, .campaign-hero::before { content: ""; position: absolute; inset: 0; background: var(--img, none) center/cover; opacity: .3; }
.event-hero > *, .campaign-hero > * { position: relative; }
.event-hero h1, .campaign-hero h1 { font-size: 1.9rem; margin: .5rem 0; } .event-hero .lead, .campaign-hero .lead { opacity: .85; }
.event-cta { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-top: 1rem; }
.campaign-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.campaign-tile { position: relative; display: grid; gap: .3rem; padding: 1.5rem; border-radius: var(--radius); background: var(--brand-2); color: #fff; overflow: hidden; min-height: 150px; align-content: end; }
.campaign-tile::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.6), transparent), var(--img, none) center/cover; }
.campaign-tile > * { position: relative; } .campaign-tile p { opacity: .85; font-size: .9rem; margin: 0; } .campaign-tile small { opacity: .75; }
.campaign-grid.past .campaign-tile { min-height: 90px; opacity: .7; }
.camp-progress { display: grid; gap: .4rem; max-width: 360px; margin-top: 1rem; }
.leaders { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; counter-reset: l; }
.leaders li { display: flex; align-items: center; gap: .75rem; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 10px; counter-increment: l; }
.leaders li::before { content: counter(l); width: 22px; color: var(--ink-3); font-weight: 600; } .leaders li > span:not(.avatar-initial) { flex: 1; display: grid; line-height: 1.2; } .leaders small { color: var(--ink-2); }
.leaders li:first-child { border-color: #F5B301; }
.news-list { display: grid; gap: 1rem; } .news-item { padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); } .news-item h3 { margin: .3rem 0 .4rem; }

/* about page */
.about-banner { position: relative; margin-bottom: 0; overflow: hidden; background: var(--brand-2); }
.about-banner img { width: 100%; height: min(46vw, 420px); object-fit: cover; transition: transform 0.6s ease; }
.about-banner:hover img { transform: scale(1.04); }
.about-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(17,17,17,0.15) 0%, rgba(17,17,17,0.55) 60%, rgba(17,17,17,0.85) 100%), linear-gradient(120deg, color-mix(in srgb, var(--brand) 55%, transparent) 0%, transparent 55%); pointer-events: none; }
.about-banner-text { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; justify-content: center; color: #fff; animation: about-fade-up 0.7s ease both; }
.about-banner-text h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: .5rem; text-shadow: 0 2px 18px rgba(0,0,0,0.35); }
.about-banner-text .lead { font-size: 1.1rem; opacity: .92; max-width: 56ch; margin: 0; }

@keyframes about-fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.about-page .section { padding-block: 3.5rem 2rem; }
.about-body { max-width: 70ch; margin-bottom: 2.25rem; animation: about-fade-up 0.7s ease 0.1s both; }
.about-body p { font-size: 1.05rem; color: var(--ink-2); }
.about-split { display: grid; grid-template-columns: 1fr 1.3fr; gap: 1.75rem; align-items: start; }
.about-split-img { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); animation: about-fade-up 0.7s ease 0.2s both; }
.about-split-img img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); transition: transform 0.4s ease; }
.about-split-img:hover img { transform: scale(1.05); }
.about-split-cards { display: grid; gap: 1.25rem; align-content: start; }
.about-split-cards .panel { padding: 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease; animation: about-fade-up 0.7s ease 0.3s both; }
.about-split-cards .panel:nth-child(2) { animation-delay: 0.4s; }
.about-split-cards .panel:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--brand); }
.about-split-cards h2 { margin-bottom: .5rem; }
.about-split-cards .btn { margin-top: .5rem; transition: transform 0.15s ease, background 0.15s ease; }
.about-split-cards .btn:hover { transform: translateY(-2px); }
@media (max-width: 800px) { .about-split { grid-template-columns: 1fr; } .about-split-img { max-height: 260px; } .about-banner img { height: 260px; } }
@media (prefers-reduced-motion: reduce) {
  .about-banner-text, .about-body, .about-split-img, .about-split-cards .panel { animation: none !important; }
}

/* ============================================================
   ADMIN – forms, tables, branding page, transcript
   ============================================================ */
.filters-inline { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filters-inline input[type="search"], .filters-inline input[type="date"] { width: auto; min-width: 200px; padding: .45rem .7rem; } .filters-inline select { width: auto; padding: .45rem .7rem; }
.actions-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.status-tabs { display: flex; flex-wrap: wrap; gap: .25rem; }
.status-tabs a { padding: .35rem .75rem; border-radius: 8px; font-size: .85rem; color: var(--ink-2); } .status-tabs a b { color: var(--text); margin-inline-start: .25rem; } .status-tabs a.on { background: var(--bg); border: 1px solid var(--line); color: var(--text); }
.row-actions { display: flex; gap: .3rem; align-items: center; justify-content: flex-end; white-space: nowrap; } .row-actions form { display: inline-flex; gap: .3rem; }
.tag[class*="st-"] { text-transform: capitalize; }
.st-published { background: #e3f6ea; color: #1e7a45; } .st-inreview, .st-pendingapproval { background: #fff4d6; color: #8a5a00; } .st-draft { background: var(--line-2); } .st-scheduled, .st-approved { background: #e6eefc; color: #1f4fb3; } .st-withdrawn, .st-cancelled, .st-archived { background: #fde3e3; color: var(--danger); } .st-active, .st-sent, .st-completed { background: #e3f6ea; color: #1e7a45; } .st-open { background: #fff4d6; color: #8a5a00; } .st-inprogress { background: #e6eefc; color: #1f4fb3; } .st-resolved, .st-closed { background: var(--line-2); }
[data-theme="dark"] .st-published, [data-theme="dark"] .st-active, [data-theme="dark"] .st-sent, [data-theme="dark"] .st-completed { background: #163a26; color: #7fdba3; } [data-theme="dark"] .st-inreview, [data-theme="dark"] .st-pendingapproval, [data-theme="dark"] .st-open { background: #3d2f12; color: #f2c46d; } [data-theme="dark"] .st-scheduled, [data-theme="dark"] .st-approved, [data-theme="dark"] .st-inprogress { background: #1b2a4d; color: #9dbbff; } [data-theme="dark"] .st-withdrawn, [data-theme="dark"] .st-cancelled, [data-theme="dark"] .st-archived { background: #3f1717; color: #ff9c9c; }
.edit-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.25rem; align-items: start; } .edit-main { display: grid; gap: 1.25rem; } .edit-side { display: grid; gap: 1.25rem; position: sticky; top: calc(var(--topbar-h) + 1rem); }
@media (max-width: 1000px) { .edit-layout { grid-template-columns: 1fr; } .edit-side { position: static; } }
.panel h3 + .grid-2, .panel h3 + .grid-3 { margin-top: .75rem; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .3rem .75rem; } .check-row { display: flex; flex-wrap: wrap; gap: 1.25rem; margin: .5rem 0 1rem; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; }
.field input[type="file"] { margin-top: .35rem; font-size: .8rem; }
.add-file { margin: .5rem 0 1rem; } .mb { margin-bottom: 1rem; }
.timeline { list-style: none; padding: 0; margin: 1rem 0; border-inline-start: 2px solid var(--line); } .timeline li { padding: .3rem 0 .3rem .9rem; font-size: .85rem; position: relative; } .timeline li::before { content: ""; position: absolute; inset-inline-start: -6px; top: .7rem; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); } .timeline small { display: block; color: var(--ink-3); } .timeline p { margin: .2rem 0 0; color: var(--ink-2); }
.wf-actions { display: grid; gap: .4rem; } .btn.danger { color: var(--danger); }
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; max-height: 560px; overflow: auto; } .pick-list li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .4rem .5rem; border-bottom: 1px solid var(--line-2); font-size: .88rem; }
.kpis.four { grid-template-columns: repeat(4, 1fr); } .kpi-alert { border-color: var(--warn); } .kpi-alert .kpi-value { color: var(--danger); }
.danger-bar { border-inline-start-color: var(--danger); } .danger-bar .attention-title { color: var(--danger); filter: none; }
.tpl { padding: .6rem 0; border-bottom: 1px solid var(--line-2); } .tpl summary { cursor: pointer; }
.preview-panel .phone { border: 1px solid var(--line); border-radius: 22px; padding: 1rem .8rem; background: var(--surface); display: grid; gap: .6rem; } .push { background: var(--bg); border-radius: 12px; padding: .7rem .8rem; font-size: .85rem; box-shadow: var(--shadow); } .push b { display: block; } .push p { margin: .15rem 0; color: var(--ink-2); } .push small { color: var(--ink-3); font-size: .7rem; }
.setting-row { display: grid; grid-template-columns: 1fr 1.2fr; gap: 1rem; align-items: center; padding: .7rem 0; border-bottom: 1px solid var(--line-2); } .setting-row b { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; } .switch input { display: none; } .switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: .2s; } .switch span::before { content: ""; position: absolute; width: 18px; height: 18px; inset-inline-start: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; } .switch input:checked + span { background: var(--ok); } .switch input:checked + span::before { transform: translateX(20px); } [dir="rtl"] .switch input:checked + span::before { transform: translateX(-20px); }
.modal { border: 0; border-radius: var(--radius); padding: 0; max-width: 760px; width: 94vw; box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); background: var(--bg); color: var(--text); } .modal::backdrop { background: rgba(0,0,0,.45); } .modal-form { padding: 1.5rem; } .modal-form h3 { margin-bottom: 1rem; }
.inline-details summary { cursor: pointer; font-size: .8rem; } .inline-details pre { white-space: pre-wrap; font-size: .75rem; background: var(--surface); padding: .5rem; border-radius: 6px; max-width: 480px; }
.sev-critical td { background: #fde3e3; } [data-theme="dark"] .sev-critical td { background: #3f1717; }
.upload-box { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; padding: 1rem; border: 2px dashed var(--line); border-radius: var(--radius); margin: .75rem 0; }
.kb-row { margin-bottom: 1rem; }
.narrow-form { max-width: 980px; }
/* branding page */
.logo-grid { align-items: start; } .logo-field { display: grid; gap: .35rem; } .logo-box { display: grid; place-items: center; height: 90px; border-radius: 10px; border: 1px solid var(--line); padding: .6rem; } .logo-box.light { background: #fff; } .logo-box.dark { background: #141416; } .logo-box.icon { background: var(--surface); } .logo-box img { max-height: 100%; max-width: 100%; object-fit: contain; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; } .color-field { display: grid; grid-template-columns: 44px 1fr; gap: .2rem .6rem; align-items: center; font-size: .85rem; } .color-field input[type="color"] { width: 44px; height: 44px; padding: 2px; border-radius: 10px; grid-row: span 2; cursor: pointer; } .color-field code { font-size: .72rem; color: var(--ink-3); }
.presets { display: flex; gap: .35rem; } .preset { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); cursor: pointer; } .preset i, .preset-swatch i { display: inline-block; width: 14px; height: 22px; border-radius: 3px; } .preset-swatch { display: inline-flex; gap: 2px; }
.preset-row { display: flex; align-items: center; gap: .75rem; padding: .4rem 0; border-bottom: 1px solid var(--line-2); font-size: .88rem; } .preset-row span:nth-child(3) { flex: 1; }
.sticky { position: sticky; top: calc(var(--topbar-h) + 1rem); }
.brand-preview { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--bg); font-size: .8rem; }
.pv-top { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border-bottom: 1px solid var(--line); } .pv-top img { height: 20px; } .pv-name { font-weight: 600; }
.pv-hero { background: var(--brand-2); color: #fff; padding: 1.1rem .9rem; display: grid; gap: .5rem; } .pv-hero b { font-size: 1rem; } .pv-btn { justify-self: start; background: var(--brand); padding: .3rem .7rem; border-radius: calc(var(--radius) - 4px); font-weight: 600; font-size: .75rem; }
.pv-cards { display: flex; gap: .5rem; padding: .8rem; } .pv-cards i { flex: 1; aspect-ratio: 2/3; border-radius: calc(var(--radius) - 4px); background: var(--surface); border: 1px solid var(--line); } .pv-cards i:first-child { background: var(--brand); opacity: .85; }
.pv-phone { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border-top: 1px solid var(--line); background: var(--surface); } .pv-phone img { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; }
/* transcript */
.transcript { display: grid; gap: .6rem; align-content: start; } .tr-msg { max-width: 85%; } .tr-msg.user { justify-self: end; } .tr-msg.assistant { justify-self: start; }
.tr-bubble { padding: .6rem .85rem; border-radius: 14px; background: var(--surface); font-size: .9rem; } .tr-msg.user .tr-bubble { background: var(--brand); color: #fff; } .tr-bubble p { margin: 0; } .tr-bubble audio { display: block; margin-top: .4rem; height: 32px; width: 100%; }
.tr-meta { display: block; margin-top: .2rem; font-size: .72rem; color: var(--ink-3); } .tr-msg.user .tr-meta { text-align: end; }

.card-wrap { display: grid; gap: .3rem; } .card-wrap form { justify-self: start; }
.news-article h1 { margin: .3rem 0 1rem; } .news-image { border-radius: var(--radius); margin-bottom: 1rem; } .news-article .lead { font-size: 1.1rem; color: var(--ink-2); }

.demo-accounts.open h3 { font-size: .9rem; margin: 1.5rem 0 .5rem; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; margin-bottom: .5rem; }
.demo-btn { display: grid; text-align: start; padding: .45rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; line-height: 1.2; }
.demo-btn b { font-size: .8rem; } .demo-btn span { font-size: .72rem; color: var(--ink-2); }
.demo-btn:hover { border-color: var(--brand); color: var(--brand); }

.ai-close { font-size: 1rem; color: var(--ink-2); order: 3; } .ai-head .ai-voice-toggle { order: 2; }
.ai-fab.on::after { content: '✕'; font-weight: 700; margin-inline-start: .2rem; }
