/* CareFlow — Mystery Shopping Platform
   One design system for admin + shopper, light/dark themes, RTL (ar) + LTR (en). */

:root {
  --brand: #046264;
  --brand-ink: #034B4D;
  --brand-2: #50A7A1;
  --on-brand: #FFFFFF;
  --on-brand-2: #CFE5E3;
  --link: #046264;
  --tint: #EEF6F5;
  --tint-2: #E1EFEE;
  --ink: #0F2A2B;
  --ink-2: #314A4B;
  --muted: #4F6465;
  --line: #D5E2E2;
  --line-2: #E3ECEC;
  --bg: #F3F7F7;
  --surface: #FFFFFF;
  --field: #F9FBFB;
  --hero: #046264;
  --side: #04585A;
  --side-ink: #DCEDEB;
  --ok-bg: #E5F4EA; --ok: #1B6B3A; --ok-solid: #2E9D5B;
  --warn-bg: #FDF0D5; --warn: #7A4F00; --warn-solid: #E0A33A;
  --bad-bg: #FCEBE9; --bad: #A3241A; --bad-solid: #C8372C;
  --info-bg: #E8EFFB; --info: #1D4F99;
  --bar-track: #E6EEEE;
  --shadow: 0 1px 3px rgba(15, 42, 43, 0.08);
  --shadow-lg: 0 10px 40px rgba(15, 42, 43, 0.10);
  --radius: 18px;
  --font: 'IBM Plex Sans Arabic', 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand: #137C78;
  --brand-ink: #6FD0C6;
  --brand-2: #50A7A1;
  --on-brand-2: #BFDCD9;
  --link: #6FD0C6;
  --tint: #163333;
  --tint-2: #1C4040;
  --ink: #E4EFEE;
  --ink-2: #C3D4D3;
  --muted: #94ACAB;
  --line: #2B4242;
  --line-2: #213535;
  --bg: #0B1616;
  --surface: #122121;
  --field: #0E1B1B;
  --hero: #0D4B4D;
  --side: #083B3D;
  --side-ink: #CFE3E1;
  --ok-bg: #12321F; --ok: #86D9A6;
  --warn-bg: #3A2C0E; --warn: #F2C670;
  --bad-bg: #3D1916; --bad: #F4A59C;
  --info-bg: #15294A; --info: #A3C2F3;
  --bar-track: #1E3333;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.6; }
a { color: var(--link); }
a:hover { color: var(--brand-2); }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.35; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .ltr.text-end { text-align: right; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(var(--min, 240px), 100%), 1fr)); }
.split { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.split > .wide { flex: 2 1 520px; min-width: 0; }
.split > .side { flex: 1 1 320px; min-width: 0; }
.spacer { flex: 1; }
.flip { display: inline-flex; }
[dir="ltr"] .flip { transform: scaleX(-1); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1.5px solid var(--line); font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer; background: var(--surface); color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--brand-2); color: var(--ink); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
:root[data-theme="dark"] .btn-primary:hover { background: #1A928D; border-color: #1A928D; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn-dark:hover { color: var(--surface); opacity: .92; }
.btn-danger { color: var(--bad); border-color: var(--bad-bg); }
.btn-danger:hover { color: var(--bad); border-color: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--link); }
.btn-soft { background: var(--tint); border-color: var(--tint); color: var(--link); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { min-height: 54px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn[disabled], .btn:disabled { background: var(--line-2); border-color: var(--line-2); color: var(--muted); cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; padding: 0; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.input, .select, .textarea { width: 100%; min-height: 44px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px; background: var(--field); font-size: 15px; font-weight: 400; color: var(--ink); }
.textarea { padding: 10px 12px; min-height: 90px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-2); outline: none; background: var(--surface); box-shadow: 0 0 0 3px rgba(80, 167, 161, 0.25); }
.input-lg { min-height: 52px; border-radius: 14px; font-size: 16px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.pw-wrap { position: relative; display: flex; }
.pw-wrap .input { padding-inline-end: 56px; }
.pw-wrap .icon-btn { position: absolute; inset-inline-end: 4px; top: 4px; }

/* ---------- Alerts & pills ---------- */
.alert { border-radius: 12px; padding: 12px 14px; font-size: 14px; font-weight: 500; }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-bad, .alert-error { background: var(--bad-bg); color: var(--bad); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.alert-info { background: var(--tint); color: var(--ink-2); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-brand { background: var(--tint-2); color: var(--link); }
.pill-muted { background: var(--line-2); color: var(--ink-2); }

/* ---------- Cards / tables ---------- */
.card { min-width: 0; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card-tight { padding: 16px; }
.card h2 { font-size: 18px; }
.card-soft { background: var(--bg); border: 0; box-shadow: none; border-radius: 14px; padding: 12px 14px; }
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi .label { font-size: 14px; color: var(--muted); }
.kpi .value { font-size: 30px; font-weight: 700; line-height: 1.2; }
.table-wrap { overflow-x: auto; position: relative; min-width: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-weight: 500; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.bar { height: 8px; background: var(--bar-track); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand-2); border-radius: 4px; }
.bar > span.low { background: var(--warn-solid); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 14px; text-decoration: none; cursor: pointer; }
.tab:hover { color: var(--ink); border-color: var(--brand-2); }
.tab.active { background: var(--ink); border-color: var(--ink); color: var(--surface); font-weight: 700; }
.map { width: 100%; height: 220px; border: 0; border-radius: 14px; background: var(--line-2); display: block; }
:root[data-theme="dark"] .map { filter: invert(.9) hue-rotate(180deg) saturate(.6); }
.icon-tile { width: 46px; height: 46px; flex: none; border-radius: 14px; background: var(--tint); color: var(--link); display: flex; align-items: center; justify-content: center; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border-radius: 999px; padding: 5px 10px; text-decoration: none; color: var(--ink-2); }
a.chip:hover { color: var(--link); }
.chip-brand { background: var(--tint); color: var(--link); font-weight: 600; }
.list-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list-row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 16px; border: 0; border-bottom: 1px solid var(--line-2); text-decoration: none; color: var(--ink); background: none; width: 100%; text-align: start; }
.list-row:last-child { border-bottom: 0; }
.section-title { margin: 6px 4px 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: var(--line); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 4px; inset-inline-start: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: inset-inline-start .15s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { inset-inline-start: 24px; }

/* ---------- Hero (page header, shared by admin + shopper) ---------- */
.hero { position: relative; overflow: hidden; background: var(--hero); color: var(--on-brand); padding: 24px 26px; border-radius: 24px; display: flex; flex-direction: column; gap: 16px; isolation: isolate; }
.hero::before { content: ""; position: absolute; top: -80px; inset-inline-end: -70px; width: 220px; height: 220px; border-radius: 50%; border: 24px solid var(--brand-2); opacity: .28; z-index: -1; }
.hero::after { content: ""; position: absolute; bottom: -60px; inset-inline-end: 24%; width: 140px; height: 140px; border-radius: 50%; border: 16px solid var(--brand-2); opacity: .16; z-index: -1; }
.hero h1 { font-size: 26px; }
.hero .sub, .hero .muted { color: var(--on-brand-2); }
.hero a:not(.btn):not(.tab) { color: #fff; }
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.hero .btn { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .22); color: #fff; }
.hero .btn:hover { background: rgba(255, 255, 255, .22); color: #fff; }
.hero .btn-primary { background: #fff; border-color: #fff; color: #034B4D; }
.hero .btn-primary:hover { background: #EAF4F3; color: #034B4D; }
.hero .tab { background: transparent; border-color: rgba(255, 255, 255, .3); color: #fff; }
.hero .tab.active { background: #fff; border-color: #fff; color: #034B4D; }
.hero .pill { background: rgba(255, 255, 255, .16); color: #fff; }
.hero .select { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .25); color: #fff; }
.hero .select option { color: #0F2A2B; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(125px, 100%), 1fr)); gap: 10px; }
.stat-tile { background: rgba(255, 255, 255, 0.12); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-tile b { font-size: 22px; line-height: 1.25; }
.stat-tile span { font-size: 12.5px; color: var(--on-brand-2); }
.stat-tile a { font-size: 12.5px; font-weight: 600; }
.hero-btn { width: 44px; height: 44px; border-radius: 14px; background: rgba(255, 255, 255, 0.14); border: 0; color: #fff; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; position: relative; cursor: pointer; flex: none; }
.hero-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.22); }
.dot { position: absolute; top: 4px; inset-inline-end: 4px; min-width: 18px; height: 18px; border-radius: 9px; background: #F5B83D; color: #0F2A2B; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* ---------- Shell: decorated sidebar + page ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; width: 272px; flex: none; overflow: hidden auto; isolation: isolate;
  background-color: var(--side); background-image: url("../img/pattern.svg"); background-size: 88px 88px;
  color: #fff; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; z-index: 40; }
.sidebar::before { content: ""; position: absolute; bottom: -120px; inset-inline-end: -130px; width: 320px; height: 320px; border-radius: 50%; border: 30px solid var(--brand-2); opacity: .22; z-index: -1; }
.sidebar::after { content: ""; position: absolute; bottom: 30px; inset-inline-end: -60px; width: 160px; height: 160px; border-radius: 50%; border: 18px solid var(--brand-2); opacity: .16; z-index: -1; }
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-logo { width: 44px; height: 44px; border-radius: 14px; background: #fff; display: flex; align-items: center; justify-content: center; flex: none; box-shadow: 0 0 0 4px rgba(255, 255, 255, .12), 0 6px 16px rgba(0, 0, 0, .2); }
.brand-logo img { width: 32px; height: 32px; }
.brand b { font-size: 19px; display: block; letter-spacing: .3px; }
.brand small { font-size: 12px; color: var(--on-brand-2); display: block; }
.ornament { display: flex; align-items: center; gap: 8px; margin: 14px 10px; }
.ornament::before, .ornament::after { content: ""; flex: 1; height: 1px; background: rgba(255, 255, 255, .28); }
.ornament i { width: 9px; height: 9px; transform: rotate(45deg); border: 1.5px solid var(--brand-2); flex: none; }
.ornament i.fill { width: 6px; height: 6px; background: #F5B83D; border-color: #F5B83D; }
.nav-label { font-size: 11.5px; font-weight: 600; letter-spacing: .4px; color: var(--on-brand-2); opacity: .85; padding: 10px 12px 4px; }
.nav-link { position: relative; display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 12px; color: var(--side-ink); text-decoration: none; font-size: 15px; }
.nav-link svg { flex: none; opacity: .9; }
.nav-link:hover { background: rgba(255, 255, 255, 0.10); color: #fff; }
.nav-link.active { background: #fff; color: #034B4D; font-weight: 700; box-shadow: 0 6px 16px rgba(0, 0, 0, .18); }
.nav-link.active::before { content: ""; position: absolute; inset-inline-start: -14px; top: 10px; bottom: 10px; width: 4px; border-radius: 4px; background: #F5B83D; }
.nav-link .badge { margin-inline-start: auto; background: #F5B83D; color: #0F2A2B; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 0 8px; }
.side-foot { margin-top: auto; padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.toggles { display: flex; gap: 6px; }
.toggle { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .08); color: #fff; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.toggle:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.theme-dark-only { display: none; }
:root[data-theme="dark"] .theme-dark-only { display: inline; }
:root[data-theme="dark"] .theme-light-only { display: none; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: rgba(0, 0, 0, .16); font-size: 13px; color: var(--side-ink); }
.me .avatar { width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #034B4D; display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.me b { display: block; color: #fff; font-size: 14px; }
.me .who-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me a { margin-inline-start: auto; color: #fff; display: inline-flex; }
.page { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main { flex: 1; min-width: 0; padding: 28px; display: flex; flex-direction: column; gap: 22px; width: 100%; max-width: 1480px; margin-inline: auto; }
.topbar { display: none; }
.scrim { display: none; }
.bottom-nav { display: none; }
.narrow { width: 100%; max-width: 760px; margin-inline: auto; }

@media (max-width: 900px) {
  .topbar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 30; padding: 10px 14px; background-color: var(--side); background-image: url("../img/pattern.svg"); background-size: 88px 88px; color: #fff; }
  .topbar .brand { padding: 0; flex: 1; min-width: 0; }
  .topbar .brand-logo { width: 36px; height: 36px; border-radius: 11px; }
  .topbar .brand-logo img { width: 26px; height: 26px; }
  .topbar .brand b { font-size: 17px; }
  .topbar .hero-btn { width: 40px; height: 40px; border-radius: 12px; }
  .sidebar { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: min(300px, 86vw); height: 100%; transform: translateX(100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  [dir="ltr"] .sidebar { transform: translateX(-100%); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 35; }
  .main { padding: 16px 14px 24px; gap: 16px; }
  .hero { padding: 20px; border-radius: 20px; }
  .hero h1 { font-size: 22px; }
  .role-portal .menu-btn { display: none; }
  .role-portal .main { padding-bottom: 104px; }
  .bottom-nav { display: grid; position: fixed; inset-inline: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line-2); grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 8px 8px calc(10px + env(safe-area-inset-bottom)); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 52px; justify-content: center; text-decoration: none; color: var(--muted); font-size: 12px; position: relative; }
  .bottom-nav a .ic { width: 56px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; }
  .bottom-nav a.active { color: var(--link); font-weight: 700; }
  .bottom-nav a.active .ic { background: var(--tint-2); }
  .bottom-nav .dot { top: 0; inset-inline-end: calc(50% - 26px); background: var(--bad-solid); color: #fff; }
}

/* ---------- Shopper pieces ---------- */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); align-content: start; }
.task-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); min-width: 0; }
.task-head { display: flex; align-items: center; gap: 12px; }

/* Focused flow (assessment): no sidebar, own header and footer */
.focus-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.focus-head { background-color: var(--hero); background-image: url("../img/pattern.svg"); background-size: 88px 88px; color: #fff; padding: 14px 16px 16px; }
.focus-head .inner { display: flex; flex-direction: column; gap: 12px; }
.focus-head .inner, .focus-body, .focus-foot .inner { width: 100%; max-width: 760px; margin-inline: auto; }
.focus-body { flex: 1; padding: 26px 20px 16px; display: flex; flex-direction: column; gap: 22px; }
.focus-foot { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line-2); padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); z-index: 5; }
.focus-foot .inner { display: flex; gap: 10px; }
.progress { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.progress > span { display: block; height: 100%; background: #fff; border-radius: 3px; transition: width .2s; }
.q-title { font-size: 21px; font-weight: 700; line-height: 1.5; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 58px; padding: 0 18px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-size: 16px; font-weight: 600; cursor: pointer; text-align: start; width: 100%; }
.opt[aria-pressed="true"] { border: 2px solid var(--brand-2); background: var(--tint-2); color: var(--link); }
.opt .radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--muted); flex: none; }
.opt[aria-pressed="true"] .radio { border: 7px solid var(--brand-2); }
.yn { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.yn .opt { min-height: 96px; flex-direction: column; justify-content: center; font-size: 18px; }
.scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.scale .opt { min-height: 52px; justify-content: center; padding: 0; font-size: 17px; }
.scale .opt[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.dropzone { min-height: 170px; border-radius: 20px; border: 2px dashed var(--brand-2); background: var(--tint); color: var(--link); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; cursor: pointer; text-align: center; padding: 16px; }
.dropzone .circle { width: 64px; height: 64px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.thumb { position: relative; border-radius: 12px; overflow: hidden; background: var(--line-2); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); text-align: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 4px; inset-inline-end: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(15, 42, 43, .75); color: #fff; cursor: pointer; }

/* ---------- Auth (one login for admin + shopper) ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.auth-top { position: relative; overflow: hidden; isolation: isolate; padding: 18px 24px 56px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; color: #fff;
  background-color: var(--side); background-image: url("../img/pattern.svg"); background-size: 88px 88px; }
.auth-top::before { content: ""; position: absolute; top: -90px; inset-inline-end: -110px; width: 300px; height: 300px; border-radius: 50%; border: 28px solid var(--brand-2); opacity: .32; z-index: -1; }
.auth-top::after { content: ""; position: absolute; top: 40px; inset-inline-end: -40px; width: 160px; height: 160px; border-radius: 50%; border: 18px solid var(--brand-2); opacity: .22; z-index: -1; }
.auth-bar { align-self: stretch; display: flex; justify-content: flex-end; gap: 6px; margin-bottom: 18px; }
.auth-bar .toggle { flex: none; }
.auth-logo { width: 80px; height: 80px; border-radius: 24px; background: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 6px rgba(255, 255, 255, .12), 0 8px 24px rgba(0, 0, 0, .2); }
.auth-logo img { width: 56px; height: 56px; }
.auth-title { font-size: 30px; font-weight: 700; letter-spacing: .4px; }
.auth-tag { color: var(--on-brand-2); }
.auth-points { display: none; }
.auth-form-wrap { position: relative; flex: 1; margin-top: -28px; background: var(--surface); border-radius: 28px 28px 0 0; display: flex; justify-content: center; }
.auth-card { padding: 28px 24px 32px; display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 440px; }
.who { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.who div { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--tint); color: var(--ink-2); font-size: 13px; }
.who svg { color: var(--link); flex: none; }
@media (min-width: 900px) {
  .auth { flex-direction: row; }
  .auth-top { flex: 0 0 46%; justify-content: center; padding: 40px 56px; gap: 18px; }
  .auth-bar { position: absolute; top: 24px; inset-inline: 28px; margin: 0; }
  .auth-top::before { top: auto; bottom: -140px; width: 460px; height: 460px; border-width: 40px; inset-inline-end: -140px; }
  .auth-top::after { top: -80px; inset-inline-end: auto; inset-inline-start: -80px; width: 260px; height: 260px; border-width: 26px; }
  .auth-logo { width: 108px; height: 108px; border-radius: 30px; }
  .auth-logo img { width: 76px; height: 76px; }
  .auth-title { font-size: 46px; }
  .auth-tag { font-size: 20px; }
  .auth-points { display: flex; flex-direction: column; gap: 14px; margin: 20px 0 0; padding: 0; list-style: none; text-align: start; max-width: 380px; }
  .auth-points li { display: flex; align-items: center; gap: 12px; font-size: 16px; color: #E7F3F2; }
  .auth-points li span { width: 38px; height: 38px; flex: none; border-radius: 12px; background: rgba(255, 255, 255, .14); display: flex; align-items: center; justify-content: center; }
  .auth-form-wrap { margin: 0; border-radius: 0; align-items: center; padding: 40px 24px; background: var(--bg); }
  .auth-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 24px; padding: 40px 36px; box-shadow: var(--shadow-lg); }
}

.dev-notice { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-size: 13.5px; line-height: 1.6; border: 1px solid color-mix(in srgb, var(--warn-solid) 40%, transparent); }
.dev-notice svg { flex: none; margin-top: 2px; }

.stars { display: inline-flex; gap: 1px; line-height: 1; vertical-align: middle; }
.star { color: var(--line); }
.star.full { color: #E0A33A; }
.star.half { background: linear-gradient(90deg, #E0A33A 50%, var(--line) 50%); -webkit-background-clip: text; background-clip: text; color: transparent; }
[dir="rtl"] .star.half { background: linear-gradient(270deg, #E0A33A 50%, var(--line) 50%); -webkit-background-clip: text; background-clip: text; }
.star-input { display: flex; gap: 6px; }
.star-btn { width: 56px; height: 56px; border: 0; background: none; font-size: 46px; line-height: 1; color: var(--line); cursor: pointer; padding: 0; transition: transform .1s; }
.star-btn.on { color: #E0A33A; }
.star-btn:hover { transform: scale(1.1); }
.hero .star:not(.full):not(.half) { color: rgba(255, 255, 255, .35); }

/* ---------- Builder ---------- */
.builder { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.builder .palette { flex: 1 1 210px; position: sticky; top: 16px; }
.builder .canvas { flex: 3 1 460px; min-width: 0; }
.builder .props { flex: 1 1 260px; position: sticky; top: 16px; }
.sec-card { border: 1.5px solid var(--line); border-radius: 16px; background: var(--surface); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.sec-card.active { border: 2px solid var(--brand-2); }
.q-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; background: var(--surface); color: var(--ink); cursor: pointer; text-align: start; width: 100%; }
.q-card.active { border: 2px solid var(--brand-2); background: var(--tint); }
.add-btn { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 1.5px dashed var(--muted); border-radius: 12px; background: var(--surface); color: var(--ink); cursor: pointer; width: 100%; font-size: 14px; text-align: start; }
.add-btn .plus { width: 26px; height: 26px; border-radius: 7px; background: var(--tint-2); color: var(--link); display: flex; align-items: center; justify-content: center; font-weight: 700; }

/* ---------- Heatmap ---------- */
.heat { border-collapse: separate; border-spacing: 4px; }
.heat td.h { text-align: center; border-radius: 6px; font-weight: 600; }
.h4 { background: #046264; color: #fff; }
.h3 { background: #7FB9B2; color: #0F2A2B; }
.h2 { background: #F3C98B; color: #0F2A2B; }
.h1 { background: #D98A1E; color: #0F2A2B; }
.h0 { background: var(--line-2); color: var(--muted); }

/* ---------- Final report document (client + staff, PDF) ---------- */
.report-doc { background: var(--surface); border: 1px solid var(--line-2); border-radius: 22px; padding: 28px; display: flex; flex-direction: column; gap: 22px; box-shadow: var(--shadow); max-width: 1100px; width: 100%; margin-inline: auto; }
.report-head { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; padding-bottom: 18px; border-bottom: 2px solid var(--brand-2); }
.rh-biz { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; font-size: 14px; color: var(--ink-2); }
.rh-company { font-size: 20px; color: var(--ink); }
.rh-logo { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.rh-logo img { width: 64px; height: 64px; }
.rh-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; color: var(--muted); text-align: end; }
.rh-score { font-size: 34px; font-weight: 700; color: var(--link); line-height: 1.1; }
.report-visual { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.report-visual figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.report-visual figure > img, .report-visual .ph { width: 100%; height: 240px; object-fit: cover; border-radius: 16px; background: var(--line-2); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.report-visual figcaption { font-size: 12.5px; color: var(--muted); }
.static-map { position: relative; overflow: hidden; border-radius: 16px; background: #E4ECEC; }
.static-map-inner { position: absolute; width: 768px; height: 768px; }
.static-pin { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -30px 0 0 -15px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: #C8372C; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.static-pin::after { content: ""; position: absolute; left: 9px; top: 9px; width: 12px; height: 12px; border-radius: 50%; background: #fff; }
.static-credit { position: absolute; right: 6px; bottom: 4px; font-size: 10px; background: rgba(255,255,255,.85); color: #333; padding: 1px 5px; border-radius: 4px; }
.report-block { display: flex; flex-direction: column; gap: 12px; }
.report-block h2 { font-size: 18px; display: flex; align-items: center; gap: 8px; }
.axis-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px 20px; }
.axis { display: flex; flex-direction: column; gap: 6px; }
.finding-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); gap: 14px; }
.finding { margin: 0; border: 1px solid var(--line-2); border-radius: 14px; overflow: hidden; background: var(--bg); display: flex; flex-direction: column; }
.finding img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--line-2); }
.finding figcaption { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.answer-sec { border: 1px solid var(--line-2); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.answer-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line-2); font-size: 14px; }
.answer-row b { text-align: end; flex: none; max-width: 50%; }
.improve-block { background: var(--tint); border-radius: 18px; padding: 18px 20px; }
.improve-list { display: flex; flex-direction: column; gap: 10px; }
.improve-item { background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.report-foot { text-align: center; border-top: 1px solid var(--line-2); padding-top: 12px; }
.timeline { display: flex; gap: 8px; flex-wrap: wrap; }
.timeline .step { flex: 1 1 140px; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--bg); color: var(--muted); font-size: 13px; font-weight: 600; }
.timeline .step i { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--line); color: var(--surface); display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 12px; }
.timeline .step.done { background: var(--tint); color: var(--link); }
.timeline .step.done i { background: var(--brand); color: #fff; }
.pkg { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1.5px solid var(--line); border-radius: 16px; background: var(--surface); cursor: pointer; }
.pkg input { position: absolute; opacity: 0; }
.pkg:has(input:checked) { border: 2px solid var(--brand-2); background: var(--tint); }
.pkg .price { font-size: 22px; font-weight: 700; color: var(--link); }
@media (max-width: 700px) {
  .report-doc { padding: 16px; border-radius: 16px; }
  .report-head { grid-template-columns: 1fr; text-align: center; }
  .rh-biz, .rh-meta { align-items: center; text-align: center; }
  .rh-logo { order: -1; }
  .report-visual { grid-template-columns: 1fr; }
}
/* PDF/print: always light, A4-friendly */
.pdf-mode .report-doc, .pdf-mode .report-doc * { color-scheme: light; }
.pdf-mode .report-doc { --surface: #fff; --bg: #F3F7F7; --ink: #0F2A2B; --ink-2: #314A4B; --muted: #4F6465; --line: #D5E2E2; --line-2: #E3ECEC; --tint: #EEF6F5; --tint-2: #E1EFEE; --link: #046264; --bar-track: #E6EEEE;
  --ok-bg: #E5F4EA; --ok: #1B6B3A; --warn-bg: #FDF0D5; --warn: #7A4F00; --bad-bg: #FCEBE9; --bad: #A3241A; box-shadow: none; border: 0; max-width: 780px; }
@media print {
  .report-doc { box-shadow: none; border: 0; max-width: none; padding: 0; }
  .finding, .improve-item, .report-visual, .report-head { break-inside: avoid; }
}

/* ---------- Print (PDF export via browser) ---------- */
@media print {
  .sidebar, .topbar, .no-print, .bottom-nav, .btn, .scrim { display: none !important; }
  body { background: #fff; color: #000; }
  .main { padding: 0; }
  .hero { background: #fff !important; color: #000; border: 1px solid #ccc; }
  .hero::before, .hero::after { display: none; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}
