/* LDT — shared styles for the customer portal and admin. Layout uses logical properties so RTL works. */
:root {
  --brand: #0f766e; --accent: #f59e0b; --bg: #f6f7f4; --surface: #ffffff; --text: #1f2937;
  --admin-brand: #0f766e; --admin-sidebar: #12312e; --admin-bg: #f3f4f2;
  --font: 'Tajawal', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Arabic', Arial, sans-serif;
  --muted: color-mix(in srgb, var(--text) 62%, transparent);
  --line: color-mix(in srgb, var(--text) 13%, transparent);
  --soft: color-mix(in srgb, var(--brand) 8%, var(--surface));
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --ok: #15803d; --warn: #b45309; --err: #b91c1c; --info: #1d4ed8;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--text); background: var(--bg); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); }
h2 { font-size: 1.25rem; } .h3 { font-size: 1.08rem; } .h4 { font-size: .98rem; }
p { margin: 0 0 1em; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
pre { white-space: pre-wrap; word-break: break-all; background: var(--soft); padding: .75rem; border-radius: var(--radius-sm); }
.muted { color: var(--muted); } .small { font-size: .875rem; } .center { text-align: center; } .nowrap { white-space: nowrap; } .wrap { word-break: break-word; }
.pre { white-space: pre-wrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: -999px; top: .5rem; background: var(--surface); padding: .5rem 1rem; z-index: 100; border-radius: var(--radius-sm); }
.skip-link:focus { inset-inline-start: .5rem; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, white); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ forms */
.form { display: grid; gap: 1rem; }
.field { display: grid; gap: .35rem; min-width: 0; }
.field > label, .label-like, .q-label { font-weight: 600; }
legend.q-label { padding: 0; margin-bottom: .35rem; }
input:not([type]), input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=url], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid color-mix(in srgb, var(--text) 25%, transparent);
  border-radius: var(--radius-sm); padding: .65rem .75rem; min-height: 44px;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 2px solid color-mix(in srgb, var(--brand) 30%, transparent); outline-offset: 0; }
input[readonly] { background: var(--soft); }
input[type=color] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
[aria-invalid=true] { border-color: var(--err) !important; }
.field-error { color: var(--err); font-size: .9rem; margin: 0; font-weight: 600; }
.hint { color: var(--muted); font-size: .875rem; margin: 0; }
.req { color: var(--err); } .optional { color: var(--muted); font-weight: 400; font-size: .85em; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem 1rem 1rem; }
.fieldset legend { font-weight: 700; padding: 0 .35rem; }
.check { display: flex; gap: .55rem; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: .15rem; flex: none; accent-color: var(--brand); }
.check-lg { padding: .85rem 1rem; background: var(--soft); border-radius: var(--radius-sm); }
.check-inline { display: flex; gap: .4rem; align-items: center; }
.check.is-disabled { opacity: .5; cursor: not-allowed; }
.check-grid { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; }
.check-list { display: grid; gap: .45rem; max-height: 340px; overflow: auto; padding: .25rem; }
.check-list.tall { max-height: 460px; }
.phone-group { display: flex; gap: .5rem; }
.phone-group select { flex: 0 0 auto; width: auto; max-width: 46%; }
.phone-group input { flex: 1; min-width: 0; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.align-start { align-items: start; }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; line-height: 1.2;
  padding: .6rem 1.05rem; min-height: 42px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--soft); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 86%, black); }
.btn-secondary { background: var(--soft); border-color: color-mix(in srgb, var(--brand) 30%, transparent); color: var(--brand); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-danger:hover { background: #991b1b; }
.btn.danger { color: var(--err); }
.btn-lg { padding: .8rem 1.4rem; font-size: 1.05rem; min-height: 50px; }
.btn-sm { padding: .35rem .7rem; min-height: 34px; font-size: .875rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: flex-end; align-items: center; margin-top: .5rem; }
.actions-split { justify-content: space-between; }
.inline { display: inline; } .inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.inline-form input, .inline-form select { width: auto; min-width: 180px; flex: 1 1 180px; }
.inline-forms { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }

/* ------------------------------------------------------------------ alerts, badges */
.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); border: 1px solid; margin: 0 0 1rem; }
.alert ul { margin: .4rem 0 0; padding-inline-start: 1.2rem; }
.alert-success { background: #ecfdf3; border-color: #a6f4c5; color: #05603a; }
.alert-error { background: #fef3f2; border-color: #fecdca; color: #912018; }
.alert-warning { background: #fffaeb; border-color: #fedf89; color: #93370d; }
.alert-info { background: #eff8ff; border-color: #b2ddff; color: #175cd3; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #f2f4f7; color: #344054; vertical-align: middle; white-space: nowrap; }
.badge-published, .badge-submitted, .badge-active, .badge-ok { background: #ecfdf3; color: #067647; }
.badge-draft, .badge-invited, .badge-in_progress { background: #eff8ff; color: #175cd3; }
.badge-started { background: #f4f3ff; color: #5925dc; }
.badge-closed, .badge-archived, .badge-inactive, .badge-abandoned { background: #f2f4f7; color: #475467; }
.badge-revoked { background: #fef3f2; color: #b42318; }
.badge-warning { background: #fffaeb; color: #b54708; }
.badge-src-customer { background: #fdf2fa; color: #c11574; }
.badge-src-admin { background: #f0f9ff; color: #026aa2; }
.badge-src-import { background: #f9f5ff; color: #6941c6; }
.badge-src-collector { background: #fff6ed; color: #c4320a; }

/* ------------------------------------------------------------------ cards, tables */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1rem, .8rem + 1vw, 1.5rem); box-shadow: var(--shadow); margin-bottom: 1.25rem; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.card-center { text-align: center; max-width: 560px; margin-inline: auto; }
.card-warning { border-color: #fedf89; background: #fffcf5; }
.card-danger { border-color: #fecdca; }
.narrow { max-width: 720px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); margin-bottom: 1rem; }
.card .table-wrap { border: 0; border-radius: 0; margin-inline: -.25rem; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { padding: .65rem .8rem; text-align: start; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; background: color-mix(in srgb, var(--text) 3%, var(--surface)); white-space: nowrap; }
.table tbody tr:hover { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.table tr:last-child td { border-bottom: 0; }
.table.compact th, .table.compact td { padding: .45rem .6rem; }
.table .w-check { width: 36px; }
tr.is-new { animation: flash 2.5s ease-out; }
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 30%, transparent); } to { background: transparent; } }
.row-warning td { background: #fffcf5; } .row-muted td { opacity: .6; }
.dl { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: .45rem 1rem; margin: 0 0 1rem; }
.dl dt { color: var(--muted); font-weight: 600; font-size: .9rem; }
.dl dd { margin: 0; min-width: 0; word-break: break-word; }
.dl.answers dt { color: var(--text); }
.dl-inline { grid-template-columns: auto 1fr; }
ul.plain { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .35rem; }
.link-input { width: 260px; max-width: 100%; }
.copy-row { display: flex; gap: .5rem; } .copy-row input { flex: 1; min-width: 0; }
.count { font-size: .9rem; font-weight: 600; color: var(--muted); background: var(--soft); padding: .1rem .55rem; border-radius: 999px; vertical-align: middle; }

/* ------------------------------------------------------------------ portal */
.wrap { width: 100%; max-width: 760px; margin-inline: auto; padding-inline: 16px; }
.portal-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.portal-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); font-weight: 700; min-width: 0; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-logo { max-height: 40px; width: auto; }
.brand-mark { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--brand); color: #fff; font-weight: 800; flex: none; }
.lang-switch { font-weight: 600; text-decoration: none; padding: .4rem .7rem; border-radius: var(--radius-sm); border: 1px solid var(--line); white-space: nowrap; }
.portal-main { padding-block: 1.5rem 3rem; min-height: 60vh; }
.portal-footer { border-top: 1px solid var(--line); padding-block: 1.25rem; font-size: .9rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-bottom: .5rem; }
.assisted-banner { background: var(--accent); color: #1f1300; font-weight: 600; padding-block: .5rem; font-size: .92rem; }
.hero { padding-block: 1rem 1.5rem; }
.lead { font-size: 1.07rem; }
.survey-list { display: grid; gap: 1rem; }
.survey-card { display: block; text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.survey-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.survey-card-cta { color: var(--brand); font-weight: 700; }
.survey-head { margin-bottom: 1rem; }
.eyebrow { font-size: .85rem; font-weight: 700; color: var(--brand); margin-bottom: .35rem; letter-spacing: .01em; }
.eyebrow a { text-decoration: none; }
.progress { height: 8px; background: color-mix(in srgb, var(--brand) 15%, var(--surface)); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--brand); border-radius: 999px; transition: width .3s; }
.progress-label { font-size: .85rem; color: var(--muted); margin: .35rem 0 0; }
.why { background: var(--soft); border-radius: var(--radius-sm); padding: .75rem 1rem; margin-bottom: 1.25rem; }
.why summary { font-weight: 700; cursor: pointer; }
.why p { margin: .5rem 0 0; }
.question { padding-block: .85rem; border-bottom: 1px dashed var(--line); }
.question:last-of-type { border-bottom: 0; }
.choices { display: grid; gap: .5rem; }
.choices-inline { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.choice { display: flex; align-items: center; gap: .65rem; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; min-height: 48px; }
.choice input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--soft); box-shadow: inset 0 0 0 1px var(--brand); }
.rating { display: flex; flex-wrap: wrap; gap: .45rem; }
.rating-opt { position: relative; }
.rating-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.rating-opt span { display: grid; place-items: center; min-width: 46px; height: 46px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-weight: 700; background: var(--surface); }
.rating-opt input:checked + span { background: var(--brand); color: #fff; border-color: var(--brand); }
.rating-opt input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 55%, white); }
.rating-labels { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); margin-top: .35rem; max-width: 560px; }
.review-block { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1rem; }
.review-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.link-edit { font-weight: 600; font-size: .9rem; }
.done-icon { color: var(--ok); margin-bottom: .5rem; }
.reference { display: inline-flex; flex-direction: column; gap: .2rem; padding: .9rem 1.4rem; border: 2px dashed var(--brand); border-radius: var(--radius); margin: .5rem 0 1rem; }
.reference strong { font-size: 1.35rem; letter-spacing: .04em; font-family: ui-monospace, Menlo, Consolas, monospace; }
.auth-card { max-width: 440px; margin: 2rem auto; }
.prose h2 { margin-top: 1.25rem; }

/* map */
.map { height: 380px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #e5e7eb; z-index: 0; }
.map-sm { height: 260px; margin-bottom: 1rem; }
.map-search { display: flex; gap: .5rem; }
.map-search input { flex: 1; min-width: 0; }
.map-results { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); max-height: 220px; overflow: auto; background: var(--surface); }
.map-results button { display: block; width: 100%; text-align: start; padding: .6rem .8rem; border: 0; border-bottom: 1px solid var(--line); background: none; font: inherit; cursor: pointer; }
.map-results button:hover, .map-results button:focus { background: var(--soft); }
.map-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.map-status { font-size: .9rem; color: var(--muted); }
.coords { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; color: var(--muted); margin: 0; }
.leaflet-container { font-family: var(--font); }

/* ------------------------------------------------------------------ install */
.install-steps { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1rem; counter-reset: s; }
.install-steps li { counter-increment: s; font-size: .85rem; padding: .3rem .7rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.install-steps li::before { content: counter(s) '. '; }
.install-steps li.current { background: var(--brand); color: #fff; border-color: var(--brand); }
.install-steps li.done { color: var(--ok); }
.checklist { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .45rem; }
.checklist li { display: flex; gap: .6rem; align-items: flex-start; }
.checklist.left { text-align: start; }
.check-icon { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: .78rem; font-weight: 800; flex: none; background: #f2f4f7; }
.checklist .ok .check-icon { background: #dcfae6; color: var(--ok); }
.checklist .fail .check-icon { background: #fee4e2; color: var(--err); }
.checklist .warn .check-icon { background: #fef0c7; color: var(--warn); }

/* ------------------------------------------------------------------ admin shell */
body.admin { background: var(--admin-bg); }
.admin .btn-primary { background: var(--admin-brand); border-color: var(--admin-brand); }
.admin a { color: var(--admin-brand); }
.admin .btn-primary, .admin .btn-danger { color: #fff; }
.nav-toggle { display: none; }
.sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 240px; background: var(--admin-sidebar); color: #e6f0ee; overflow-y: auto; z-index: 30; padding: 1rem .75rem; }
.sidebar-brand { display: flex; align-items: center; gap: .6rem; color: #fff !important; text-decoration: none; font-weight: 700; padding: .25rem .5rem 1rem; }
.sidebar-brand .brand-logo { max-height: 32px; background: #fff; border-radius: 6px; padding: 2px; }
.sidebar ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.sidebar a { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: var(--radius-sm); color: #cfe0dd !important; text-decoration: none; font-weight: 500; }
.sidebar a:hover { background: rgba(255, 255, 255, .08); color: #fff !important; }
.sidebar a.active { background: rgba(255, 255, 255, .14); color: #fff !important; font-weight: 700; }
.admin-main { margin-inline-start: 240px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .75rem; padding: .6rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-spacer { flex: 1; }
.topbar-user { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--text) !important; }
.topbar-name { display: grid; line-height: 1.2; font-weight: 600; font-size: .9rem; }
.topbar-name small { color: var(--muted); font-weight: 400; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--admin-brand); color: #fff; font-weight: 700; }
.nav-burger { display: none; cursor: pointer; padding: .3rem; }
.nav-scrim { display: none; }
.admin-content { padding: 1.5rem clamp(16px, 2vw, 2rem) 3rem; width: 100%; max-width: 1320px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; margin-bottom: 1rem; }
.filters label { display: grid; gap: .25rem; font-size: .82rem; font-weight: 600; color: var(--muted); min-width: 140px; flex: 0 1 180px; }
.filters label.grow { flex: 1 1 240px; }
.filters label.check-inline { display: flex; align-items: center; min-width: 0; flex: none; padding-bottom: .65rem; }
.filters input, .filters select { min-height: 40px; padding: .45rem .6rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; }
.tabs a { padding: .6rem .9rem; text-decoration: none; color: var(--muted) !important; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--admin-brand) !important; border-bottom-color: var(--admin-brand); }
.pager { display: flex; gap: 1rem; justify-content: center; align-items: center; margin: 1rem 0; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .75rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; }
.bulk-bar select { width: auto; min-height: 36px; padding: .3rem .5rem; }
.definitions { margin: -0.25rem 0 1.25rem; font-size: .9rem; }
.definitions summary { cursor: pointer; color: var(--admin-brand); font-weight: 600; }
.definitions ul { margin: .5rem 0 0; padding-inline-start: 1.2rem; color: var(--muted); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; display: grid; gap: .2rem; text-decoration: none; color: var(--text) !important; box-shadow: var(--shadow); }
.stat-label { font-size: .85rem; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 1.75rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: .82rem; color: var(--muted); }
.stat-accent { border-top: 3px solid var(--admin-brand); }
.live { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--ok); font-weight: 600; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.grid-dash { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
.toast { position: fixed; inset-block-end: 1.25rem; inset-inline-end: 1.25rem; background: #101828; color: #fff; padding: .75rem 1rem; border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0, 0, 0, .2); z-index: 50; font-weight: 600; }

/* charts — single-series, thin bars, rounded data ends, values labelled */
.vbars { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 1.2rem; border-bottom: 1px solid var(--line); direction: ltr; }
.vbar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; min-width: 0; }
.vbar-fill { width: 100%; max-width: 22px; background: var(--admin-brand); border-radius: 4px 4px 0 0; }
.vbar-val { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.vbar-label { position: absolute; bottom: -1.3rem; font-size: .7rem; color: var(--muted); }
.vbar:hover .vbar-fill { filter: brightness(1.15); }
.table-view { margin-top: 1.75rem; font-size: .88rem; }
.table-view summary { cursor: pointer; color: var(--muted); }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 1.25rem; }
.report-card { margin: 0; }
.hbars { list-style: none; padding: 0; margin: 0 0 .75rem; display: grid; gap: .6rem; }
.hbars li { display: grid; grid-template-columns: minmax(80px, 34%) 1fr auto; gap: .6rem; align-items: center; font-size: .9rem; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 12px; background: color-mix(in srgb, var(--admin-brand) 10%, var(--surface)); border-radius: 4px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--admin-brand); border-start-end-radius: 4px; border-end-end-radius: 4px; }
.hbar-val { font-variant-numeric: tabular-nums; white-space: nowrap; }
.samples { margin: 0; padding-inline-start: 1.1rem; display: grid; gap: .35rem; font-size: .92rem; }

/* builder */
.builder-section { border-top: 4px solid var(--admin-brand); }
.builder-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .75rem; }
.builder-head .btn-row { margin-inline-start: auto; }
.builder-head select { width: auto; min-height: 36px; padding: .3rem .5rem; }
.builder-questions { display: grid; gap: .9rem; margin-block: 1rem; }
.builder-question { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .9rem 1rem; background: color-mix(in srgb, var(--admin-bg) 45%, var(--surface)); display: grid; gap: .65rem; }
.builder-question.is-collapsed { padding-block: .4rem; }
.builder-question.is-collapsed .builder-head { margin: 0; }
.q-num { min-width: 2rem; }
.builder-settings { display: grid; gap: .6rem; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: .5rem; align-items: end; }
.builder-condition { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .6rem .75rem; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.builder-condition select, .builder-condition input { width: auto; min-width: 140px; min-height: 36px; padding: .3rem .5rem; flex: 1 1 140px; }
.save-state { font-size: .85rem; color: var(--muted); }
.save-state.ok { color: var(--ok); } .save-state.warn { color: var(--warn); } .save-state.error { color: var(--err); font-weight: 700; }
.preview-banner { background: var(--accent); color: #1f1300; font-weight: 700; padding: .6rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; text-align: center; }

/* settings */
.color-grid { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; margin-bottom: 1rem; }
.color-field { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.logo-thumb { max-height: 48px; display: block; margin-bottom: .35rem; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 3px; }
.logo-thumb.small { max-height: 28px; }
.preview-pane { position: sticky; top: 72px; }
.sticky-actions { position: sticky; bottom: 0; background: color-mix(in srgb, var(--admin-bg) 92%, transparent); padding: .75rem 0; backdrop-filter: blur(4px); }
.theme-preview { --p-brand: var(--brand); --p-accent: var(--accent); --p-bg: var(--bg); --p-surface: var(--surface); --p-text: var(--text);
  --p-admin-brand: var(--admin-brand); --p-admin-sidebar: var(--admin-sidebar); --p-admin-bg: var(--admin-bg);
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: .75rem; }
.tp-public { background: var(--p-bg); color: var(--p-text); }
.tp-header { background: var(--p-surface); padding: .6rem .8rem; font-weight: 700; border-bottom: 1px solid rgba(0,0,0,.08); }
.tp-mark { color: var(--p-brand); }
.tp-body { padding: .8rem; }
.tp-card { background: var(--p-surface); border-radius: 8px; padding: .8rem; display: grid; gap: .5rem; }
.tp-progress { height: 6px; background: rgba(0,0,0,.08); border-radius: 999px; } .tp-progress span { display: block; width: 60%; height: 100%; background: var(--p-brand); border-radius: 999px; }
.tp-choice { border: 1px solid rgba(0,0,0,.15); border-radius: 6px; padding: .35rem .6rem; font-size: .9rem; }
.tp-choice.selected { border-color: var(--p-brand); box-shadow: inset 0 0 0 1px var(--p-brand); }
.tp-btn { display: inline-block; background: var(--p-brand); color: #fff; padding: .35rem .8rem; border-radius: 6px; font-weight: 700; font-size: .9rem; width: max-content; }
.tp-link { color: var(--p-accent); font-weight: 600; font-size: .85rem; }
.tp-admin { display: flex; height: 70px; background: var(--p-admin-bg); }
.tp-side { width: 60px; background: var(--p-admin-sidebar); display: grid; gap: 4px; padding: 8px; align-content: start; }
.tp-side span { height: 6px; background: rgba(255,255,255,.25); border-radius: 3px; } .tp-side span.on { background: rgba(255,255,255,.7); }
.tp-main { flex: 1; padding: .8rem; }
.tp-admin-btn { background: var(--p-admin-brand); }
.perm-groups { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.perm-groups .check { margin-bottom: .5rem; }

/* print */
.print-page { background: #fff; }
.print-sheet { max-width: 800px; margin: 0 auto; padding: 1.5rem; }
.print-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--text); padding-bottom: .75rem; margin-bottom: 1rem; gap: 1rem; }
.print-ref { display: grid; text-align: end; } .print-ref strong { font-size: 1.2rem; font-family: ui-monospace, monospace; }
.debug { text-align: start; max-height: 320px; overflow: auto; }
@media print {
  .no-print, .sidebar, .topbar, .btn { display: none !important; }
  .print-sheet { padding: 0; }
  .dl { grid-template-columns: 34% 1fr; }
  a { color: inherit; text-decoration: none; }
}

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1080px) { .grid-dash { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 30px rgba(0,0,0,.25); }
  [dir=rtl] .sidebar { transform: translateX(100%); }
  .nav-toggle:checked ~ .sidebar { transform: none; }
  .nav-toggle:checked ~ .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
  .admin-main { margin-inline-start: 0; }
  .nav-burger { display: inline-flex; }
  .topbar-name { display: none; }
  .preview-pane { position: static; }
}
@media (max-width: 600px) {
  body { font-size: 15.5px; }
  .dl { grid-template-columns: 1fr; gap: .1rem; }
  .dl dd { margin-bottom: .55rem; }
  .actions { justify-content: stretch; }
  .actions .btn { flex: 1 1 auto; }
  .choice-row { grid-template-columns: 1fr auto auto; }
  .choice-row .field:nth-child(2) { grid-column: 1; }
  .map { height: 320px; }
  .filters label { flex: 1 1 100%; }
  .hbars li { grid-template-columns: 1fr auto; }
  .hbars .hbar-track { grid-column: 1 / -1; grid-row: 2; }
  .page-actions { width: 100%; }
  .card .table-wrap { margin-inline: 0; }
  .phone-group select { max-width: 52%; }
}

/* builder: keep English/Arabic pairs side by side */
.builder .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 700px) { .builder .grid-2 { grid-template-columns: 1fr; } }
.map + .dl, .map-sm + .dl { margin-top: 1rem; }
.dl dd { unicode-bidi: plaintext; }
.card > .grid-2, .card > .grid-3, .card > .field { margin-bottom: 1rem; }
.card > .field + .grid-2 { margin-top: 0; }
.slug-prefix { align-self: center; white-space: nowrap; }

/* highlighted survey question (builder: "Highlight") */
.question.question-highlight { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); border-radius: var(--radius); padding: 1rem; margin-block: .75rem; }
.question.question-highlight .q-label { font-size: 1.08em; }
.question.question-highlight textarea { min-height: 9rem; background: var(--surface); }

/* customer statistics */
.section-title { margin: 1.75rem 0 .75rem; }
.num { text-align: end !important; font-variant-numeric: tabular-nums; }
.split { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .75rem; margin-bottom: .75rem; }
.split-item { display: grid; gap: .1rem; }
.split-value { font-size: 1.6rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.split-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--line); gap: 2px; }
.split-bar .seg { display: block; height: 100%; min-width: 0; }
.seg-0 { background: var(--admin-brand); } .seg-1 { background: color-mix(in srgb, var(--admin-brand) 55%, var(--surface)); } .seg-2 { background: color-mix(in srgb, var(--admin-brand) 28%, var(--surface)); } .seg-3 { background: var(--muted); }
.tone-0 { background: var(--ok); } .tone-1 { background: #84cc16; } .tone-2 { background: var(--warn); } .tone-3 { background: var(--err); }
.sat-list { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; gap: .9rem; }
.sat-head { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .3rem; }
.sat-head strong { font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; color: var(--muted); margin: 0; }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: .35rem; vertical-align: -1px; }
.comments-card { border: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.comments { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; max-height: 34rem; overflow-y: auto; }
.comment { background: var(--surface); border: 1px solid var(--line); border-inline-start: 4px solid var(--accent); border-radius: var(--radius-sm); padding: .8rem 1rem; }
.comment blockquote { margin: 0 0 .5rem; font-size: 1.02rem; line-height: 1.6; white-space: normal; word-break: break-word; }
.comment-meta { display: flex; flex-wrap: wrap; gap: .35rem .5rem; align-items: center; }
.badge-tone-ok { background: #ecfdf3; color: #067647; } .badge-tone-mid { background: #f2f4f7; color: #344054; } .badge-tone-bad { background: #fef3f2; color: #b42318; }
.insights-map { height: 380px; border-radius: var(--radius-sm); border: 1px solid var(--line); margin-bottom: 1rem; }
@media (max-width: 520px) { .split { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); } .split-value { font-size: 1.3rem; } }
