/* Themes: light is the default; dark applies via [data-theme="dark"] (set by script from the saved choice or the OS setting). */
:root {
  color-scheme: light;
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #f8f9fc;
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b;
  --line: #e4e8f0; --line-strong: #cfd6e2; --line-hover: #b5bfd0;
  --accent: #2457d6; --accent-hover: #1b45ad; --accent-soft: #e9effd; --accent-ink: #ffffff;
  --side: #0f172a; --side-ink: #94a3b8; --side-ink-strong: #f1f5f9; --side-line: rgba(255,255,255,.08);
  --ok: #0f7b55;   --ok-bg: #e2f5ec;   --ok-line: #b7e3cf;
  --bad: #b42318;  --bad-bg: #fdecea;  --bad-line: #f5c3be;
  --warn: #8a5208; --warn-bg: #fdf2d9; --warn-line: #f1dba5;
  --none: #475467; --none-bg: #eceff4;
  --info: #1c3f93; --info-bg: #e8effd; --info-line: #c9d9f7;
  --ph: #94a3b8; --chart-grid: #e6eaf1; --chart-text: #64748b; --chart-neutral: #9aa6b8;
  --hero-glow: rgba(36,87,214,.12);
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06);
  --shadow-lg: 0 16px 40px rgba(15,23,42,.18);
  --font: "Inter", "Noto Sans Arabic", "Segoe UI", Tahoma, "Helvetica Neue", Arial, sans-serif;
  --control-h: 38px;
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0f1d; --surface: #111a2e; --surface-2: #15203a;
  --ink: #e8edf7; --ink-2: #c4cde0; --muted: #8e9bb6;
  --line: #222d49; --line-strong: #324163; --line-hover: #46577d;
  --accent: #6b97ff; --accent-hover: #8cb0ff; --accent-soft: rgba(107,151,255,.15); --accent-ink: #08101f;
  --side: #080c18; --side-ink: #8e9bb6; --side-ink-strong: #eef2fa; --side-line: rgba(255,255,255,.07);
  --ok: #4fd6a3;   --ok-bg: rgba(52,211,153,.13);  --ok-line: rgba(52,211,153,.35);
  --bad: #ff8f86;  --bad-bg: rgba(255,107,95,.13); --bad-line: rgba(255,107,95,.38);
  --warn: #f4c562; --warn-bg: rgba(245,175,45,.13); --warn-line: rgba(245,175,45,.36);
  --none: #b3bdd3; --none-bg: rgba(148,163,184,.14);
  --info: #a5beff; --info-bg: rgba(107,151,255,.13); --info-line: rgba(107,151,255,.35);
  --ph: #66748f; --chart-grid: #1f2a45; --chart-text: #8e9bb6; --chart-neutral: #5f6e8d;
  --hero-glow: rgba(107,151,255,.16);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.3);
  --shadow-lg: 0 18px 44px rgba(0,0,0,.55);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%238e9bb6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 14px; line-height: 1.55;
  font-feature-settings: "cv11", "ss01"; /* Inter: single-storey a, cleaner digits */
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
/* Arabic needs more line height, and negative tracking breaks letter joining */
html[lang="ar"] body { line-height: 1.75; font-feature-settings: normal; }
[dir="rtl"] * { letter-spacing: 0 !important; }

h1 { font-size: 24px; line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -.015em; color: var(--ink); }
h2 { font-size: 16px; line-height: 1.35; margin: 0 0 12px; font-weight: 600; letter-spacing: -.005em; }
h3 { font-size: 14px; line-height: 1.4; margin: 0 0 12px; font-weight: 600; color: var(--ink-2); }
p { margin: 0 0 8px; }
strong { font-weight: 600; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; line-height: 1.5; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; min-width: 0;
  box-shadow: var(--shadow);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--control-h); padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-2);
  cursor: pointer; font-weight: 500; font-size: 13.5px; white-space: nowrap;
  box-shadow: 0 1px 1px rgba(15, 23, 42, .05);
  transition: background-color .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-hover); }
.btn:active { background: var(--none-bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--bad); border-color: var(--bad-line); }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad-line); }
.btn.small { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ---------- form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], select {
  width: 100%; height: var(--control-h); padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  text-align: start; transition: border-color .12s, box-shadow .12s;
}
input::placeholder { color: var(--ph); }
input:hover, select:hover { border-color: var(--line-hover); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-inline-end: 32px;
  background-image: var(--chev);
  background-repeat: no-repeat; background-position: right 12px center;
}
[dir="rtl"] select { background-position: left 12px center; }
input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
label.row { cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 16px; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip {
  display: inline-flex; align-items: center; height: 28px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface);
  color: var(--ink-2); cursor: pointer; font-size: 12.5px; font-weight: 500; user-select: none;
  transition: background-color .12s, border-color .12s;
}
.chip:hover { background: var(--surface-2); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---------- banners, badges ---------- */
.banner { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 10px; border: 1px solid transparent; line-height: 1.5; }
.banner.err { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.banner.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.banner.info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
  border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; line-height: 1;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-bad { background: var(--bad-bg); color: var(--bad); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-none { background: var(--none-bg); color: var(--none); }

/* ---------- progress, spinner, busy ---------- */
.progress { height: 6px; background: var(--none-bg); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.spinner {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin .8s linear infinite; vertical-align: middle; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.busy-line { display: none; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.busy .busy-line { display: inline-flex; }
div.busy > .busy-line { display: flex; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg); }
.login-card { width: 100%; max-width: 400px; padding: 32px 28px; box-shadow: var(--shadow-lg); }
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card p { margin-bottom: 20px; }

/* ---------- app shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 244px; flex: 0 0 244px; background: var(--side); color: var(--side-ink);
  padding: 20px 14px 16px; display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand {
  color: var(--side-ink-strong); font-weight: 650; font-size: 15.5px; line-height: 1.35;
  padding: 2px 12px 18px; margin-bottom: 8px; border-bottom: 1px solid var(--side-line);
}
.sidebar .nav-btn {
  display: block; width: 100%; text-align: start; padding: 9px 12px; border: 0;
  border-inline-start: 3px solid transparent; border-radius: 6px;
  background: transparent; color: var(--side-ink); cursor: pointer; font-weight: 500; font-size: 13.5px;
  transition: background-color .12s, color .12s;
}
.sidebar .nav-btn:hover { background: rgba(255, 255, 255, .06); color: var(--side-ink-strong); }
.sidebar .nav-btn.active { background: rgba(255, 255, 255, .09); color: #fff; border-inline-start-color: #7aa2ff; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 14px 4px 0; border-top: 1px solid var(--side-line); }
.side-foot .small { color: var(--side-ink); padding-inline: 8px; }
.side-foot .btn { background: transparent; color: var(--side-ink); border-color: rgba(255, 255, 255, .18); box-shadow: none; }
.side-foot .btn:hover { background: var(--side-line); color: #fff; }
.topbar {
  display: none; align-items: center; gap: 12px; padding: 10px 16px; min-height: 52px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.main { padding: 28px 32px 40px; max-width: 1480px; margin-inline: auto; width: 100%; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 20px; }

/* ---------- grids, KPIs, charts ---------- */
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid.kpis { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid.charts { grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); }
.grid.kpis.k5 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi { padding: 16px 18px; }
.kpi .label { color: var(--muted); font-size: 13px; font-weight: 500; line-height: 1.4; }
.kpi .value { font-size: 30px; font-weight: 650; line-height: 1.15; letter-spacing: -.02em; margin: 8px 0 4px; color: var(--ink); }
.kpi .sub { color: var(--muted); font-size: 12.5px; min-height: 18px; line-height: 1.4; }
.chart-box { position: relative; height: 300px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
th, td { padding: 11px 14px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
th.sortable { cursor: pointer; user-select: none; transition: color .12s; }
th.sortable:hover { color: var(--ink); }
td.wrap, th.wrap { white-space: normal; min-width: 200px; line-height: 1.5; }
tbody tr { transition: background-color .1s; }
tbody tr:hover { background: var(--surface-2); }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; white-space: normal; line-height: 1.6; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.card > .row:first-child { margin-bottom: 4px; }

/* ---------- tabs, details, key/value ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab {
  padding: 10px 16px; border: 0; background: transparent; cursor: pointer; font-weight: 500; font-size: 13.5px;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  transition: color .12s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.quiz-card { margin-bottom: 12px; }
.quiz-card summary { cursor: pointer; font-weight: 600; font-size: 14.5px; padding: 2px 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; align-items: baseline; }

/* ---------- employee profile ---------- */
.suggest-wrap { position: relative; max-width: 480px; }
.suggest {
  position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto; padding: 4px;
}
.suggest .nav-btn {
  display: block; width: 100%; text-align: start; padding: 9px 12px; border: 0; border-radius: 6px;
  background: transparent; cursor: pointer; color: var(--ink);
}
.suggest .nav-btn:hover { background: var(--accent-soft); }
.emp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.emp-meta { display: flex; gap: 32px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.emp-meta > div { display: flex; flex-direction: column; gap: 2px; }

/* ---------- toasts, modal ---------- */
#toasts { position: fixed; bottom: 20px; inset-inline-end: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(92vw, 400px); }
.toast { padding: 11px 16px; border-radius: var(--radius-sm); background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); line-height: 1.5; font-size: 13.5px; }
.toast.ok { background: var(--ok); color: var(--accent-ink); }
.toast.err { background: var(--bad); color: var(--accent-ink); }
.modal-bg { position: fixed; inset: 0; background: rgba(5, 9, 20, .62); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 200; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; width: 100%; max-width: 460px; box-shadow: var(--shadow-lg); }
.modal h2 { margin-bottom: 8px; font-size: 17px; }
.modal p { color: var(--ink-2); line-height: 1.6; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---------- scrollbars ---------- */
.table-wrap, .sidebar, .suggest { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .main { padding: 22px 20px 32px; }
}
@media (max-width: 860px) {
  .topbar { display: flex; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; inset-inline-start: 0; z-index: 50; height: auto;
    transform: translateX(-100%); transition: transform .18s ease; box-shadow: var(--shadow-lg);
  }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open, [dir="rtl"] .sidebar.open { transform: none; }
  .main { padding: 16px 14px 28px; }
  h1 { font-size: 21px; }
  .card { padding: 16px; }
  .kpi .value { font-size: 26px; }
  .chart-box { height: 260px; }
  .grid { gap: 12px; }
  th, td { padding: 10px 12px; }
}
@media (max-width: 520px) {
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-card { padding: 24px 20px; }
}


/* ---------- alignment system ---------- */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 14px; min-height: var(--control-h); }
.card-head > h2, .card-head > h3 { margin: 0; }
.card-head > .row, .card-head > .chips { margin: 0; }
.view-head { min-height: 44px; }
.view-head > .row { gap: 10px; }
.view-head h1 { display: flex; align-items: center; }
.filters { align-items: end; }
.filters .field > span, .form-grid .field > span { min-height: 18px; display: flex; align-items: center; }
.chips { margin-top: 8px; }
.chips:empty { display: none; }
.grid.kpis { align-items: stretch; }
.kpi { display: flex; flex-direction: column; justify-content: space-between; }
.kpi .value { text-align: start; }
.btn svg, .nav-btn svg { width: 16px; height: 16px; flex: none; }
.nav-btn { display: flex !important; align-items: center; gap: 10px; }
.side-foot .btn { width: 100%; justify-content: center; }
.side-foot .foot-row { display: flex; gap: 8px; }
.side-foot .foot-row .btn { flex: 1; }
.pager > .row { gap: 6px; }
.table-wrap table { min-width: 100%; }
thead th:first-child { border-top-left-radius: var(--radius-sm); } 
td .badge, td .btn { vertical-align: middle; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card h2 + .table-wrap, .card h2 + .banner { margin-top: 2px; }
.icon-btn { width: var(--control-h); padding: 0; }
.icon-btn.small { width: 30px; }
html[data-theme="dark"] .sun, html:not([data-theme="dark"]) .moon { display: none; }
html[data-theme="dark"] .moon { display: block; }
.logo { width: 30px; height: 30px; flex: none; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { width: 28px; height: 28px; }
.brand span { line-height: 1.25; }

/* ---------- login ---------- */
.login-wrap { position: relative; flex-direction: column; gap: 16px; }
.login-wrap::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(60% 50% at 50% 0%, var(--hero-glow), transparent 70%); }
.login-card { position: relative; z-index: 1; }
.login-card .brandmark { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-top { position: absolute; top: 16px; inset-inline: 20px; display: flex; justify-content: space-between; align-items: center; z-index: 2; }

/* ---------- landing page ---------- */
.lp { background: var(--bg); min-height: 100vh; position: relative; overflow-x: hidden; }
.lp-nav { position: sticky; top: 0; z-index: 30; backdrop-filter: saturate(1.4) blur(10px); background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom: 1px solid var(--line); }
.lp-wrap { max-width: 1160px; margin-inline: auto; padding-inline: 24px; }
.lp-nav .lp-wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.lp-brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15.5px; }
.lp-links { display: flex; align-items: center; gap: 22px; }
.lp-links a { color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 13.5px; }
.lp-links a:hover { color: var(--accent); }
.lp-actions { display: flex; align-items: center; gap: 8px; }
.lp-hero { position: relative; padding-block: 72px 56px; }
.lp-hero::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(55% 60% at 70% 0%, var(--hero-glow), transparent 70%),
  linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 56px, linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 56px 100%;
  -webkit-mask-image: radial-gradient(70% 80% at 60% 20%, #000, transparent 75%); mask-image: radial-gradient(70% 80% at 60% 20%, #000, transparent 75%); opacity: .55; }
.lp-hero .lp-wrap { position: relative; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.lp-eyebrow { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 600; margin-bottom: 18px; }
.lp-hero h1 { font-size: clamp(32px, 4.6vw, 52px); line-height: 1.12; letter-spacing: -.03em; font-weight: 700; margin-bottom: 18px; }
html[lang="ar"] .lp-hero h1 { line-height: 1.35; letter-spacing: 0; }
.lp-hero h1 em { font-style: normal; color: var(--accent); }
.lp-lead { font-size: 17px; line-height: 1.65; color: var(--ink-2); max-width: 540px; margin-bottom: 28px; }
.lp-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 14.5px; border-radius: 10px; }
.lp-trust { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 26px; color: var(--muted); font-size: 13px; }
.lp-trust span { display: inline-flex; align-items: center; gap: 6px; }
.lp-trust svg { width: 15px; height: 15px; color: var(--ok); }
.lp-preview { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 18px; direction: ltr; }
[dir="rtl"] .lp-preview { direction: rtl; }
.lp-pv-bar { display: flex; gap: 6px; margin-bottom: 14px; } .lp-pv-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.lp-pv-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.lp-pv-kpi { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.lp-pv-kpi b { display: block; font-size: 22px; letter-spacing: -.02em; } .lp-pv-kpi small { color: var(--muted); font-size: 11.5px; }
.lp-pv-chart { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--surface-2); display: flex; align-items: flex-end; gap: 8px; height: 130px; margin-bottom: 12px; }
.lp-pv-chart i { flex: 1; border-radius: 5px 5px 0 0; background: var(--accent); opacity: .9; } .lp-pv-chart i:nth-child(even) { background: var(--ok); opacity: .85; }
.lp-pv-q { display: grid; gap: 8px; }
.lp-pv-row { display: grid; grid-template-columns: 1fr 64px 38px; gap: 10px; align-items: center; font-size: 12px; color: var(--ink-2); }
.lp-pv-row .meter { min-width: 0; }
.lp-sec { padding-block: 64px; }
.lp-sec.alt { background: var(--surface); border-block: 1px solid var(--line); }
.lp-sec-head { text-align: center; max-width: 640px; margin: 0 auto 40px; }
.lp-sec-head h2 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -.02em; margin-bottom: 10px; font-weight: 700; }
html[lang="ar"] .lp-sec-head h2 { letter-spacing: 0; }
.lp-sec-head p { color: var(--muted); font-size: 15.5px; line-height: 1.65; margin: 0; }
.lp-feats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 18px; }
.lp-feat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; transition: border-color .15s, transform .15s, box-shadow .15s; }
.lp-sec.alt .lp-feat { background: var(--surface-2); }
.lp-feat:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.lp-ico { width: 42px; height: 42px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.lp-ico svg { width: 21px; height: 21px; }
.lp-feat h3 { font-size: 15.5px; margin-bottom: 6px; color: var(--ink); }
.lp-feat p { color: var(--muted); margin: 0; line-height: 1.65; font-size: 13.5px; }
.lp-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 18px; counter-reset: st; }
.lp-step { position: relative; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.lp-step::before { counter-increment: st; content: counter(st); width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font-weight: 700; margin-bottom: 12px; }
.lp-step h3 { margin-bottom: 4px; } .lp-step p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.65; }
.lp-final { text-align: center; padding-block: 64px; }
.lp-final h2 { font-size: clamp(24px, 3vw, 32px); margin-bottom: 18px; letter-spacing: -.02em; }
.lp-foot { border-top: 1px solid var(--line); padding-block: 22px; color: var(--muted); font-size: 12.5px; }
.lp-foot .lp-wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
@media (max-width: 900px) {
  .lp-hero { padding-block: 40px 32px; }
  .lp-hero .lp-wrap { grid-template-columns: 1fr; gap: 32px; }
  .lp-links { display: none; }
  .lp-sec { padding-block: 44px; }
}
@media (max-width: 520px) { .lp-wrap { padding-inline: 16px; } .lp-pv-kpis { grid-template-columns: repeat(2, 1fr); } .lp-pv-kpi:last-child { display: none; } }

/* ---- answer review / question analysis ---- */
.rv-sum { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.rv-list { display: grid; gap: 10px; }
.rv-q { border: 1px solid var(--line); border-inline-start: 4px solid var(--line-strong); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface); }
.rv-q.c { border-inline-start-color: var(--ok); }
.rv-q.w { border-inline-start-color: var(--bad); background: var(--bad-bg); }
.rv-q.p { border-inline-start-color: var(--warn); }
.rv-q-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.rv-q-title { font-weight: 600; line-height: 1.45; }
.rv-q-n { color: var(--muted); font-weight: 500; margin-inline-end: 6px; }
.rv-ans { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin-top: 8px; font-size: 13.5px; }
.rv-ans dt { color: var(--muted); }
.rv-ans dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.rv-ans .a-bad { color: var(--bad); font-weight: 600; }
.rv-ans .a-ok { color: var(--ok); font-weight: 600; }
.meter { position: relative; height: 8px; min-width: 90px; background: var(--none-bg); border-radius: 99px; overflow: hidden; }
.meter > i { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--bad); border-radius: 99px; }
.meter.lo > i { background: var(--ok); } .meter.mid > i { background: var(--warn); }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: var(--accent-soft); }
tr.sel td { background: var(--accent-soft); }
.q-detail { margin-top: 14px; border-top: 1px dashed var(--line-strong); padding-top: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 12px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
details.adv > summary { cursor: pointer; font-weight: 600; color: var(--accent); padding: 4px 0; list-style: none; }
details.adv > summary::before { content: "+ "; } details.adv[open] > summary::before { content: "− "; }
.sticky-head { position: sticky; top: 0; z-index: 5; background: var(--bg); padding-block: 8px; }
.linkish { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; text-align: start; }
.linkish:hover { text-decoration: underline; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .spinner { animation-duration: 2s; }
}

/* hidden in the Supabase version: these features stay in the Apps Script admin app */
.no-admin-ui { display: none !important; }
