/* =====================================================
   RAMZ — لوحة التحكم
   ===================================================== */
@font-face { font-family: "Thmanyah Display"; src: url("fonts/thmanyahserifdisplay-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Thmanyah Display"; src: url("fonts/thmanyahserifdisplay-Black.woff2") format("woff2"); font-weight: 900; font-display: swap; }
@font-face { font-family: "Thmanyah Sans"; src: url("fonts/thmanyahsans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Thmanyah Sans"; src: url("fonts/thmanyahsans-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Thmanyah Sans"; src: url("fonts/thmanyahsans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --burgundy: #3E101F;
  --burgundy-deep: #280812;
  --burgundy-ink: #1C050C;
  --cream: #FFF6E5;
  --paper: #F8EBD2;
  --sand: #EFDCB8;
  --gold: #E3C38A;
  --surface: #FFFFFF;
  --bg: #FBF4E6;
  --ink: #2A0914;
  --ink-2: #5C3E48;
  --muted: #8A727A;
  --line: rgba(62, 16, 31, .10);
  --grid: #EEE6DA;

  /* chart series (validated: lightness, chroma, CVD, contrast on white) */
  --s-reg: #9A3456;
  --s-att: #B8863A;

  /* status (always paired with an icon + label) */
  --ok: #2F7D4A;  --ok-bg: #E6F2EA;
  --warn: #9A6212; --warn-bg: #FBF0DC;
  --bad: #B3261E;  --bad-bg: #FBE7E5;

  --display: "Thmanyah Display", serif;
  --sans: "Thmanyah Sans", "Segoe UI", Tahoma, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --r: 18px;
  --shadow: 0 1px 2px rgba(40, 8, 18, .05), 0 8px 24px -16px rgba(40, 8, 18, .25);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { margin: 0; font-family: var(--sans); font-size: 15px; line-height: 1.6; color: var(--ink); background: var(--bg); overflow-x: clip; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; line-height: 1.3; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; transition: background .2s, border-color .2s, transform .2s; }
.btn:hover { border-color: rgba(62, 16, 31, .3); }
.btn:active { transform: scale(.97); }
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn--primary { background: var(--burgundy); color: var(--cream); border-color: var(--burgundy); }
.btn--primary:hover { background: #5B2436; }
.btn--gold { background: var(--gold); color: var(--burgundy-ink); border-color: var(--gold); }
.btn--ghost-light { background: rgba(255, 246, 229, .08); color: var(--cream); border-color: rgba(255, 246, 229, .18); }
.btn--ghost-light:hover { background: rgba(255, 246, 229, .16); border-color: rgba(255, 246, 229, .3); }
.btn--sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 10px; }
.btn.is-spinning svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Login ---------- */
.login { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 24px 16px; background: rgba(40, 8, 18, .92); backdrop-filter: blur(6px); overflow: hidden; isolation: isolate; }
.login__card { position: relative; }
.login__close { position: absolute; top: 12px; left: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--paper); color: var(--burgundy); font-size: 22px; cursor: pointer; line-height: 1; }
.login::before { content: ""; position: absolute; inset: -30%; z-index: -1; background: url("assets/pattern-r.png") 0 0 / 700px; filter: brightness(2.6); opacity: .07; transform: rotate(-8deg); }
.login__card { width: min(420px, 100%); background: var(--cream); border-radius: 24px; padding: 34px 30px; box-shadow: 0 40px 100px -40px rgba(0, 0, 0, .7); text-align: center; }
.login__card img { width: 120px; margin: 0 auto 18px; display: block; }
.login__card h1 { font-size: 26px; margin-bottom: 6px; color: var(--burgundy-deep); }
.login__card p { color: var(--muted); margin: 0 0 22px; }
.login__card input { width: 100%; height: 54px; border-radius: 14px; border: 1.5px solid rgba(62, 16, 31, .18); background: #fff; text-align: center; font: 700 22px var(--mono); letter-spacing: 6px; margin-bottom: 12px; }
.login__card input:focus { outline: none; border-color: var(--burgundy); box-shadow: 0 0 0 4px rgba(62, 16, 31, .1); }
.login__card .btn { width: 100%; justify-content: center; height: 50px; font-size: 16px; }
.login__err { color: var(--bad); font-weight: 700; font-size: 14px; min-height: 1.4em; margin: 10px 0 0 !important; }
.login__demo { background: none; border: 0; color: var(--ink-2); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; margin-top: 12px; font-size: 14px; }

/* ---------- Top bar ---------- */
.top { background: var(--burgundy); color: var(--cream); position: sticky; top: 0; z-index: 40; box-shadow: 0 10px 30px -20px rgba(0, 0, 0, .6); }
.top__inner { max-width: 1360px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.top__brand { display: flex; align-items: center; gap: 14px; margin-inline-end: auto; }
.top__brand img { height: 38px; }
.top__brand h1 { font-size: 19px; }
.top__brand small { display: block; font-family: var(--sans); font-size: 12.5px; opacity: .65; font-weight: 400; }
.top__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.demo-badge { background: var(--gold); color: var(--burgundy-ink); font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; margin-inline-start: 8px; vertical-align: 2px; font-family: var(--sans); }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #7FD19B; margin-inline-end: 5px; box-shadow: 0 0 0 0 rgba(127, 209, 155, .6); animation: ping 2s infinite; }
@keyframes ping { 70%, 100% { box-shadow: 0 0 0 7px rgba(127, 209, 155, 0); } }

/* ---------- Layout ---------- */
.wrap { max-width: 1360px; margin: 0 auto; padding: 24px 20px 60px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 34px 0 14px; }
.section-title h2 { font-size: 22px; color: var(--burgundy-deep); }
.section-title p { margin: 0; color: var(--muted); font-size: 14px; }
.grid { display: grid; gap: 16px; }
.grid--kpi { grid-template-columns: repeat(6, 1fr); }
.grid--2 { grid-template-columns: 1.4fr 1fr; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.card__head h3 { font-size: 17px; color: var(--burgundy-deep); }
.card__head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.card__tools { display: flex; gap: 6px; flex: none; }
.toggle-table { height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.toggle-table[aria-pressed="true"] { background: var(--burgundy); color: var(--cream); border-color: var(--burgundy); }
.card.show-table .chart { display: none; }
.card:not(.show-table) .data-table { display: none; }
.empty { color: var(--muted); text-align: center; padding: 36px 10px; font-size: 14px; }

/* ---------- KPI ---------- */
.kpi { position: relative; overflow: hidden; }
.kpi__label { font-size: 13px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.kpi__icon { width: 26px; height: 26px; border-radius: 8px; background: var(--paper); display: grid; place-items: center; flex: none; }
.kpi__icon svg { width: 15px; height: 15px; fill: none; stroke: var(--burgundy); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kpi__value { font-family: var(--display); font-weight: 900; font-size: 36px; line-height: 1.1; margin-top: 10px; color: var(--burgundy-deep); font-variant-numeric: tabular-nums; }
.kpi__value small { font-family: var(--sans); font-size: 14px; font-weight: 500; color: var(--muted); margin-inline-start: 4px; }
.kpi__sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.kpi__meter { height: 6px; border-radius: 6px; background: var(--grid); margin-top: 12px; overflow: hidden; }
.kpi__meter span { display: block; height: 100%; border-radius: 6px; transition: width 1s var(--ease); }
.kpi--hero { background: var(--burgundy); border-color: var(--burgundy); color: var(--cream); }
.kpi--hero .kpi__label, .kpi--hero .kpi__sub { color: rgba(255, 246, 229, .7); }
.kpi--hero .kpi__value { color: var(--cream); }
.kpi--hero .kpi__icon { background: rgba(255, 246, 229, .12); }
.kpi--hero .kpi__icon svg { stroke: var(--gold); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.delta--up { color: var(--ok); }
.kpi--hero .delta--up { color: #9FE0B3; }

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { font-family: var(--sans); font-size: 11.5px; fill: var(--muted); }
.chart .val-label { font-weight: 700; fill: var(--ink); font-size: 12px; }
.chart .ref-label { fill: var(--ink-2); font-weight: 700; font-size: 11.5px; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .bar { transition: opacity .15s; }
.chart.is-hovering .bar:not(.is-hot) { opacity: .45; }

.hbars { display: grid; gap: 10px; }
.hb { display: grid; grid-template-columns: minmax(84px, 34%) 1fr; align-items: center; gap: 12px; cursor: default; border-radius: 8px; padding: 2px 4px; margin: -2px -4px; }
.hb:hover { background: #FBF6EE; }
.hb__label { font-size: 13.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb__track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hb__bar { height: 14px; border-radius: 4px 0 0 4px; background: var(--s-reg); min-width: 3px; transition: width .9s var(--ease); }
.hb__val { font-size: 13px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hb__val small { font-weight: 400; color: var(--muted); margin-inline-start: 4px; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--ink-2) 0 4px, transparent 4px 7px) !important; height: 2px; }

.tooltip { position: fixed; z-index: 100; pointer-events: none; background: var(--burgundy-ink); color: var(--cream); padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5); transform: translate(-50%, calc(-100% - 12px)); white-space: nowrap; opacity: 0; transition: opacity .12s; }
.tooltip.show { opacity: 1; }
.tooltip b { font-size: 15px; }
.tooltip small { opacity: .7; display: block; font-size: 12px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th, .data-table td { padding: 7px 8px; text-align: right; border-bottom: 1px solid var(--line); }
.data-table th { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.data-table td:last-child, .data-table th:last-child { text-align: left; font-variant-numeric: tabular-nums; }
.data-wrap { max-height: 280px; overflow: auto; }

/* ---------- Registrants ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.search { position: relative; flex: 1 1 260px; }
.search input { width: 100%; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 40px 0 14px; }
.search svg { position: absolute; right: 13px; top: 12px; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input:focus, .toolbar select:focus { outline: none; border-color: var(--burgundy); box-shadow: 0 0 0 3px rgba(62, 16, 31, .08); }
.toolbar select { height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 12px; cursor: pointer; }
.result-count { font-size: 13.5px; color: var(--muted); margin-inline-start: auto; }

.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.reg { width: 100%; border-collapse: collapse; min-width: 980px; }
.reg th { position: sticky; top: 0; background: #FBF7F0; font-size: 12.5px; font-weight: 700; color: var(--ink-2); text-align: right; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
.reg th[data-sort] { cursor: pointer; }
.reg th[data-sort]:hover { color: var(--burgundy); }
.reg th .arrow { opacity: .35; margin-inline-start: 4px; font-size: 11px; }
.reg th.sorted .arrow { opacity: 1; color: var(--burgundy); }
.reg td { padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; white-space: nowrap; }
.reg tbody tr { cursor: pointer; transition: background .15s; }
.reg tbody tr:hover { background: #FDF9F2; }
.reg .name { font-weight: 700; color: var(--burgundy-deep); }
.reg .sub { font-size: 12.5px; color: var(--muted); display: block; }
.reg .code { font-family: var(--mono); font-size: 13px; color: var(--burgundy); background: var(--paper); padding: 2px 7px; border-radius: 6px; }
.reg .idx { color: var(--muted); font-size: 12.5px; width: 1%; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 700; }
.pill svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.pill--ok { background: var(--ok-bg); color: var(--ok); }
.pill--warn { background: var(--warn-bg); color: var(--warn); }
.pill--muted { background: #F3EEE8; color: var(--muted); }

.att-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 9px; border: 1px dashed rgba(62, 16, 31, .25); background: transparent; cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.att-btn:hover { border-style: solid; border-color: var(--burgundy); color: var(--burgundy); }
.att-btn.is-in { border: 1px solid transparent; background: var(--ok-bg); color: var(--ok); }
.att-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.att-btn:disabled { opacity: .5; cursor: progress; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; font-size: 13.5px; color: var(--muted); flex-wrap: wrap; }
.pager__btns { display: flex; gap: 6px; }

/* ---------- Questions ---------- */
.questions { display: grid; gap: 10px; max-height: 420px; overflow: auto; }
.q { background: #FBF7F0; border-radius: 12px; padding: 12px 14px; }
.q p { margin: 0 0 4px; font-size: 14.5px; }
.q small { color: var(--muted); font-size: 12.5px; }

/* ---------- Drawer ---------- */
.drawer { border: 0; padding: 0; margin: 0 0 0 auto; height: 100%; max-height: 100%; width: min(440px, 100%); background: var(--surface); color: var(--ink); box-shadow: -20px 0 60px -20px rgba(0, 0, 0, .4); }
.drawer::backdrop { background: rgba(28, 5, 12, .45); backdrop-filter: blur(3px); }
.drawer[open] { animation: slideIn .35s var(--ease); }
@keyframes slideIn { from { transform: translateX(-100%); } }
.drawer__head { background: var(--burgundy); color: var(--cream); padding: 22px 24px; position: relative; }
.drawer__head h3 { font-size: 24px; padding-inline-end: 44px; }
.drawer__head .code { font-family: var(--mono); color: var(--gold); letter-spacing: 1px; }
.drawer__close { position: absolute; top: 16px; left: 16px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 246, 229, .12); color: var(--cream); font-size: 22px; cursor: pointer; }
.drawer__body { padding: 20px 24px; }
.drawer dl { display: grid; grid-template-columns: 110px 1fr; gap: 10px 14px; margin: 0 0 20px; font-size: 14.5px; }
.drawer dt { color: var(--muted); }
.drawer dd { margin: 0; overflow-wrap: anywhere; }
.drawer__actions { display: grid; gap: 8px; }
.drawer__actions .btn { justify-content: center; height: 44px; }
.drawer__links { display: flex; gap: 8px; margin-bottom: 18px; }
.drawer__links .btn { flex: 1; justify-content: center; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 20px); background: var(--burgundy-ink); color: var(--cream); padding: 12px 20px; border-radius: 12px; font-weight: 700; font-size: 14px; opacity: 0; transition: all .3s var(--ease); z-index: 200; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--bad); }

.skeleton { background: linear-gradient(90deg, #F3ECE1 25%, #FAF5EC 50%, #F3ECE1 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Tabs ---------- */
.tabs { border-top: 1px solid rgba(255, 246, 229, .1); }
.tabs__inner { max-width: 1360px; margin: 0 auto; padding: 0 20px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs__inner::-webkit-scrollbar { display: none; }
.tab { appearance: none; border: 0; background: none; color: rgba(255, 246, 229, .7); font: inherit; font-weight: 700; font-size: 15px; padding: 14px 16px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; position: relative; white-space: nowrap; transition: color .2s; }
.tab svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tab i { font-style: normal; font: 700 12px var(--mono); background: rgba(255, 246, 229, .12); padding: 1px 8px; border-radius: 99px; }
.tab i:empty { display: none; }
.tab:hover { color: var(--cream); }
.tab.is-on { color: var(--cream); }
.tab.is-on::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--gold); }
.tab.is-on i { background: var(--gold); color: var(--burgundy-ink); }
.panel { animation: panelIn .35s var(--ease); }
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } }
.panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 6px 0 18px; }
.panel-head h2 { font-size: 24px; color: var(--burgundy-deep); }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; max-width: 60ch; }

.demo-bar { background: var(--gold); color: var(--burgundy-ink); display: flex; align-items: center; justify-content: center; gap: 14px; padding: 10px 16px; font-size: 14px; flex-wrap: wrap; text-align: center; }

/* ---------- Quick summary chips ---------- */
.quick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 18px; }
.qchip { appearance: none; font: inherit; text-align: right; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); transition: border-color .2s, transform .2s; }
.qchip:hover { border-color: rgba(62, 16, 31, .3); transform: translateY(-2px); }
.qchip small { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.qchip b { font-family: var(--display); font-weight: 900; font-size: 28px; color: var(--burgundy-deep); line-height: 1.2; font-variant-numeric: tabular-nums; }
.qchip.is-on { border-color: var(--burgundy); box-shadow: 0 0 0 2px var(--burgundy); }
.qchip .dot { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- Segmented ---------- */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { appearance: none; border: 0; background: none; font: inherit; font-weight: 700; font-size: 13.5px; padding: 7px 12px; border-radius: 9px; cursor: pointer; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.seg button i { font-style: normal; font: 700 11.5px var(--mono); background: var(--paper); padding: 0 7px; border-radius: 99px; }
.seg button.is-on { background: var(--burgundy); color: var(--cream); }
.seg button.is-on i { background: rgba(255, 246, 229, .18); color: var(--cream); }
.seg--sm button { padding: 5px 10px; font-size: 12.5px; }

/* ---------- Questions ---------- */
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.qcard { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 18px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; position: relative; transition: border-color .2s; }
.qcard.is-starred { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), var(--shadow); }
.qcard.is-answered { background: #FAFBF9; }
.qcard.is-answered .qcard__q { color: var(--muted); }
.qcard__q { font-family: var(--display); font-weight: 700; font-size: 18px; line-height: 1.6; color: var(--burgundy-deep); margin: 0; }
.qcard__q::before { content: "“"; color: var(--gold); font-size: 28px; line-height: 0; vertical-align: -8px; margin-inline-end: 4px; }
.qcard__who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.qcard__av { width: 32px; height: 32px; border-radius: 50%; background: var(--paper); color: var(--burgundy); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.qcard__who b { color: var(--ink); font-size: 14px; display: block; }
.qcard__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.qcard__tags span { font-size: 12px; background: #F6F0E6; color: var(--ink-2); padding: 2px 9px; border-radius: 99px; }
.qcard__actions { display: flex; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto; }
.qbtn { appearance: none; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 10px; padding: 6px 11px; display: inline-flex; align-items: center; gap: 6px; }
.qbtn:hover { border-color: rgba(62, 16, 31, .3); }
.qbtn[aria-pressed="true"].qbtn--star { background: var(--gold); border-color: var(--gold); color: var(--burgundy-ink); }
.qbtn[aria-pressed="true"].qbtn--ans { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.qbtn--copy { margin-inline-start: auto; }

/* ---------- Content manager ---------- */
.content-grid { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
.content-main { display: grid; gap: 16px; min-width: 0; }
.content-side { position: sticky; top: 130px; }
.types { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 18px; }
.types button { appearance: none; font: inherit; font-weight: 700; font-size: 13.5px; cursor: pointer; border: 1.5px solid var(--line); background: #FDFBF7; border-radius: 14px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink-2); transition: all .2s; }
.types svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.types button:hover { border-color: rgba(62, 16, 31, .35); }
.types button.is-on { background: var(--burgundy); border-color: var(--burgundy); color: var(--cream); }
.types button.is-on svg { stroke: var(--gold); }
.iform { display: grid; gap: 12px; }
.iform .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.f { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; font-weight: 700; color: var(--ink-2); }
.f em { font-style: normal; color: var(--bad); }
.f input, .f textarea, .f select { font: inherit; font-weight: 400; font-size: 15px; color: var(--ink); background: var(--field); border: 1.5px solid rgba(62, 16, 31, .15); border-radius: 12px; padding: 10px 12px; width: 100%; }
.f textarea { resize: vertical; min-height: 80px; }
.f input:focus, .f textarea:focus, .f select:focus { outline: none; border-color: var(--burgundy); box-shadow: 0 0 0 3px rgba(62, 16, 31, .08); }
.f.is-invalid input { border-color: var(--bad); }
.f small { font-weight: 400; color: var(--muted); font-size: 12px; }
.upload { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1.5px dashed rgba(62, 16, 31, .22); border-radius: 14px; background: #FDFBF7; cursor: pointer; transition: border-color .2s; }
.upload:hover { border-color: var(--burgundy); }
.upload__prev { width: 64px; height: 64px; border-radius: 12px; background: var(--paper) center / cover no-repeat; flex: none; display: grid; place-items: center; overflow: hidden; }
.upload__prev svg { width: 26px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.upload__txt { display: flex; flex-direction: column; font-size: 13.5px; font-weight: 700; color: var(--ink-2); }
.upload__txt small { font-weight: 400; color: var(--muted); }
.upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 42px; height: 24px; border-radius: 99px; background: #D9CFC2; position: relative; transition: background .2s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(-18px); }
.switch input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.iform__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.btn--block { width: 100%; justify-content: center; }

.items { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: #FDFBF7; transition: opacity .2s; }
.item.is-hidden-item { opacity: .55; }
.item__thumb { width: 52px; height: 52px; border-radius: 12px; background: var(--paper) center / cover no-repeat; display: grid; place-items: center; }
.item__thumb svg { width: 22px; fill: none; stroke: var(--burgundy); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.item__body { min-width: 0; }
.item__body b { display: block; font-size: 15px; color: var(--burgundy-deep); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item__body small { color: var(--muted); font-size: 12.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item__type { display: inline-block; font-size: 11.5px; font-weight: 700; background: var(--paper); color: var(--burgundy); padding: 1px 8px; border-radius: 99px; margin-inline-end: 6px; }
.item__actions { display: flex; gap: 4px; align-items: center; }
.ibtn { appearance: none; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; display: grid; place-items: center; color: var(--ink-2); }
.ibtn:hover { border-color: rgba(62, 16, 31, .35); color: var(--burgundy); }
.ibtn--del:hover { color: var(--bad); border-color: var(--bad); }
.ibtn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Registration (inside dashboard) ---------- */
.btn--reg { height: 42px; padding: 0 18px; font-size: 15px; box-shadow: 0 0 0 0 rgba(227, 195, 138, .6); animation: regPulse 2.4s infinite; }
.btn--reg svg { width: 19px; height: 19px; }
@keyframes regPulse { 70%, 100% { box-shadow: 0 0 0 10px rgba(227, 195, 138, 0); } }
.tab--reg { color: var(--gold); }
.tab--reg.is-on { color: var(--gold); }
.btn--lg { height: 50px; padding: 0 24px; font-size: 16px; border-radius: 14px; }
.reg-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.reg-card { padding: 26px 28px; }
.reg-card__head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 22px; }
.reg-card__head h2 { font-size: 24px; color: var(--burgundy-deep); }
.reg-card__head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.reg-card__icon { width: 52px; height: 52px; border-radius: 16px; background: var(--burgundy); display: grid; place-items: center; flex: none; }
.reg-card__icon svg { width: 26px; fill: none; stroke: var(--gold); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pick label { position: relative; cursor: pointer; }
.pick input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pick span { display: inline-block; padding: 9px 16px; border-radius: 12px; border: 1.5px solid rgba(62, 16, 31, .15); background: #fff; font-weight: 700; font-size: 14px; color: var(--ink-2); transition: all .2s; }
.pick label:hover span { border-color: var(--burgundy); }
.pick input:checked + span { background: var(--burgundy); border-color: var(--burgundy); color: var(--cream); }
.pick input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.reg-err { color: var(--bad); font-weight: 700; font-size: 14px; margin: 4px 0 0; min-height: 1.2em; }
.reg-err:empty { display: none; }
.reg-result { text-align: center; animation: panelIn .45s var(--ease); }
.reg-result__badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px; border-radius: 99px; font-weight: 700; font-size: 14px; margin-bottom: 12px; }
.reg-result__badge svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.reg-result h3 { font-size: 28px; color: var(--burgundy-deep); margin-bottom: 4px; }
.reg-result__sub { color: var(--muted); margin: 0 0 20px; font-size: 14.5px; }
.reg-ticket { display: inline-flex; align-items: center; gap: 22px; background: var(--burgundy); color: var(--cream); border-radius: 22px; padding: 18px 22px 18px 26px; margin-bottom: 20px; text-align: right; }
.reg-ticket__qr { width: 132px; height: 132px; background: var(--cream); border-radius: 14px; padding: 9px; flex: none; }
.reg-ticket__qr svg { width: 100%; height: 100%; display: block; }
.reg-ticket small { display: block; color: var(--gold); font-size: 13px; }
.reg-ticket b { display: block; font: 700 30px var(--mono); letter-spacing: 3px; direction: ltr; text-align: right; margin: 2px 0 8px; }
.reg-ticket span { font-size: 13px; opacity: .75; }
.reg-result__actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.recent { display: grid; gap: 6px; max-height: 560px; overflow: auto; }
.recent__row { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; cursor: pointer; transition: background .15s; }
.recent__row:hover { background: #FBF6EE; }
.recent__av { width: 36px; height: 36px; border-radius: 50%; background: var(--paper); color: var(--burgundy); display: grid; place-items: center; font-weight: 700; }
.recent__row b { display: block; font-size: 14px; color: var(--burgundy-deep); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent__row small { color: var(--muted); font-size: 12px; font-family: var(--mono); }
.recent__row.is-new { background: var(--ok-bg); }

/* ================== v7 additions ================== */
.login__lbl { display: block; text-align: right; font-weight: 700; font-size: 13.5px; color: var(--ink-2); margin: 0 0 6px; }
.login__ep { text-align: right; margin-bottom: 14px; }
.login__ep label { display: block; font-weight: 700; font-size: 13.5px; color: var(--ink-2); margin-bottom: 6px; }
.login__ep input { font: 500 13px var(--mono) !important; letter-spacing: 0 !important; text-align: left !important; height: 46px !important; margin-bottom: 4px !important; }
.login__ep small { color: var(--muted); font-size: 12px; }
.login__link { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; margin-top: 10px; font-size: 13px; }
.edition-badge { background: var(--gold); color: var(--burgundy-ink); font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; margin-inline-start: 8px; vertical-align: 3px; font-family: var(--sans); }
.btn--sync { height: 42px; }
.btn--sync.is-spinning svg { animation: spin .9s linear infinite; }
.tab--scan { color: var(--gold); }
.tab--scan.is-on { color: var(--gold); }

/* status pills & select */
.pill--registered { background: #F3EEE8; color: #5C3E48; }
.pill--confirmed { background: var(--warn-bg); color: var(--warn); }
.pill--attended { background: var(--ok-bg); color: var(--ok); }
.st-select { appearance: none; -webkit-appearance: none; font: inherit; font-weight: 700; font-size: 12.5px; border: 0; border-radius: 99px; padding: 5px 26px 5px 12px; cursor: pointer; background-repeat: no-repeat; background-position: left 9px center; background-size: 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%235C3E48' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E"); }
.st-select.st--registered { background-color: #F3EEE8; color: #5C3E48; }
.st-select.st--confirmed { background-color: var(--warn-bg); color: var(--warn); }
.st-select.st--attended { background-color: var(--ok-bg); color: var(--ok); }
.st-select:focus-visible { outline: 3px solid var(--gold); }
.st-btn--confirmed { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.st-btn--attended { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.origin { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--paper); color: var(--burgundy); margin-top: 3px; }
.reg .chk { width: 1%; }
.reg input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--burgundy); cursor: pointer; }
.reg tr.is-sel { background: #FBF3E4; }
.bulk { position: sticky; top: 118px; z-index: 5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--burgundy); color: var(--cream); padding: 10px 14px; border-radius: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.bulk > span { margin-inline-end: auto; font-size: 14px; }
.bulk .btn { height: 34px; }
.btn--ghost { background: transparent; color: var(--cream); border-color: rgba(255, 246, 229, .25); }
.quick { grid-template-columns: repeat(5, 1fr); }

/* scanner */
.scan-layout { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
.scan-main { display: grid; gap: 16px; min-width: 0; }
.scan-side { display: grid; gap: 16px; position: sticky; top: 130px; }
.scan-card { padding: 14px; display: grid; gap: 12px; }
.scan-view { position: relative; aspect-ratio: 4 / 3; max-height: 460px; width: 100%; border-radius: 16px; overflow: hidden; background: var(--burgundy-ink); }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.scan-frame span { width: min(62%, 280px); aspect-ratio: 1; border-radius: 24px; box-shadow: 0 0 0 999px rgba(28, 5, 12, .45); border: 3px solid var(--gold); position: relative; overflow: hidden; }
.scan-frame span::after { content: ""; position: absolute; inset-inline: 0; height: 2px; background: var(--gold); box-shadow: 0 0 12px var(--gold); top: 0; animation: scanLine 2s ease-in-out infinite; }
@keyframes scanLine { 50% { top: calc(100% - 2px); } }
.scan-view:not(.on) .scan-frame { display: none; }
.scan-idle { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; color: rgba(255, 246, 229, .7); text-align: center; padding: 20px; background: radial-gradient(rgba(255, 246, 229, .08) 1px, transparent 1.3px) 0 0 / 12px 12px; }
.scan-idle svg { width: 70px; fill: none; stroke: var(--gold); stroke-width: 1.5; stroke-linecap: round; }
.scan-idle p { margin: 0; }
.scan-view.on .scan-idle { display: none; }
.code-form { display: flex; gap: 10px; }
.code-form input { background: #fff; color: var(--ink); flex: 1; min-width: 0; height: 50px; border-radius: 14px; border: 1.5px solid rgba(62, 16, 31, .18); font: 700 20px var(--mono); letter-spacing: 3px; text-align: center; text-transform: uppercase; }
.code-form input:focus { outline: none; border-color: var(--burgundy); box-shadow: 0 0 0 4px rgba(62, 16, 31, .08); }
.search--full { display: block; margin-bottom: 10px; }
.find-list { display: grid; gap: 6px; }
.find-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: #FBF7F0; }
.find-row b { display: block; font-size: 14.5px; color: var(--burgundy-deep); }
.find-row small { color: var(--muted); font-size: 12.5px; }
.scan-result { border-radius: 22px; padding: 26px 22px; text-align: center; background: var(--burgundy); color: var(--cream); min-height: 220px; display: grid; place-content: center; gap: 6px; box-shadow: var(--shadow); transition: background .3s; }
.scan-result__idle b { font: 900 64px/1 var(--display); color: var(--gold); display: block; }
.scan-result__idle span { opacity: .8; }
.scan-result__idle em { font-style: normal; font-weight: 700; }
.scan-result.ok { background: var(--ok); }
.scan-result.warn { background: #B7791F; }
.scan-result.bad { background: var(--bad); }
.scan-result .sr-icon { font-size: 48px; line-height: 1; }
.scan-result .sr-name { font: 900 30px/1.3 var(--display); }
.scan-result .sr-sub { opacity: .9; font-size: 14.5px; }
.scan-result .sr-count { margin-top: 10px; font-size: 13px; opacity: .85; }
.scan-result.pop { animation: panelIn .35s var(--ease); }

/* content sub tabs */
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; padding: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; width: fit-content; max-width: 100%; }
.subtabs button { appearance: none; border: 0; background: none; font: inherit; font-weight: 700; font-size: 14px; padding: 9px 14px; border-radius: 10px; cursor: pointer; color: var(--ink-2); white-space: nowrap; }
.subtabs button:hover { background: #FBF6EE; }
.subtabs button.is-on { background: var(--burgundy); color: var(--cream); }
.sub { animation: panelIn .3s var(--ease); }
.row--3 { grid-template-columns: repeat(3, 1fr) !important; }
.switch--inline { height: 44px; }
.switch--inline em { font-style: normal; }
.preview { background: #FBF6EE; border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--ink-2); margin: 0; }
.preview b { color: var(--burgundy); }
.muted-note { color: var(--muted); font-size: 13px; }
.tracks-edit { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 14px; }
.trk { border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: #FDFBF7; display: grid; gap: 10px; position: relative; }
.trk__no { position: absolute; top: 12px; left: 12px; font: 700 12px var(--mono); color: var(--muted); }
.trk__del { position: absolute; top: 8px; left: 40px; }
.content-grid { grid-template-columns: 1fr; }

/* dialog */
.dlg { width: min(620px, calc(100% - 24px)); border: 0; border-radius: 22px; padding: 22px 24px; background: var(--surface); color: var(--ink); box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .6); }
.dlg::backdrop { background: rgba(28, 5, 12, .5); backdrop-filter: blur(3px); }
.dlg[open] { animation: panelIn .3s var(--ease); }
.dlg__head { display: flex; justify-content: space-between; align-items: center; }
.dlg__head h3 { font-size: 22px; color: var(--burgundy-deep); }
.dlg__close { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--paper); font-size: 22px; cursor: pointer; color: var(--burgundy); }
.dlg__sub { margin: 2px 0 6px; color: var(--muted); font-size: 13.5px; }
.dlg__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.add-done { text-align: center; }
.add-done .reg-ticket { margin: 10px 0 16px; }

/* connect bar (open mode) */
.connect-bar { background: var(--gold); color: var(--burgundy-ink); padding: 14px 20px; }
.connect-bar__in { max-width: 1360px; margin: 0 auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.connect-bar__icon { width: 40px; height: 40px; border-radius: 12px; background: var(--burgundy); display: grid; place-items: center; flex: none; }
.connect-bar__icon svg { width: 20px; fill: none; stroke: var(--gold); stroke-width: 2; stroke-linecap: round; }
.connect-bar p { margin: 0; font-weight: 700; font-size: 14.5px; flex: 1 1 280px; }
.connect-bar__row { display: flex; gap: 8px; flex: 1 1 420px; }
.connect-bar__row input { flex: 1; min-width: 0; height: 42px; border-radius: 12px; border: 1.5px solid rgba(62, 16, 31, .25); background: #fff; color: var(--ink); padding: 0 12px; font: 500 13px var(--mono); }
.connect-bar__row input:focus { outline: none; border-color: var(--burgundy); }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) { .grid--kpi { grid-template-columns: repeat(3, 1fr); } .content-grid { grid-template-columns: 1fr 320px; } }
@media (max-width: 980px) {
  .grid--2, .grid--3 { grid-template-columns: 1fr 1fr; } .grid--2 > :first-child { grid-column: 1 / -1; }
  .content-grid, .reg-layout { grid-template-columns: 1fr; }
  .content-side { position: static; order: -1; }
  .quick { grid-template-columns: repeat(3, 1fr); }
  .types { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 980px) {
  .scan-layout { grid-template-columns: 1fr; }
  .scan-side { position: static; order: -1; }
  .tracks-edit { grid-template-columns: 1fr; }
  .quick { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 680px) {
  .row--3 { grid-template-columns: 1fr !important; }
  .scan-result { min-height: 150px; padding: 18px; }
  .scan-result__idle b { font-size: 46px; }
  .code-form { flex-direction: column; }
  .bulk { top: 8px; }
  .subtabs { flex-wrap: nowrap; overflow-x: auto; width: 100%; }
  .top__actions .btn--sync span { display: inline; }
  .top__actions .btn--sync { flex: 1; justify-content: center; order: -1; }
  .top__actions { width: 100%; }
  .quick { grid-template-columns: 1fr 1fr; }
  .qchip b { font-size: 24px; }
  .qgrid { grid-template-columns: 1fr; }
  .iform .row { grid-template-columns: 1fr; }
  .types { grid-template-columns: repeat(2, 1fr); }
  .tab { padding: 12px 12px; font-size: 14px; }
  .tabs__inner { padding: 0 8px; }
  .item { grid-template-columns: 44px 1fr; }
  .item__thumb { width: 44px; height: 44px; }
  .item__actions { grid-column: 1 / -1; justify-content: flex-end; }
  .seg { width: 100%; }
  .wrap { padding: 16px 16px 50px; }
  .grid--kpi { grid-template-columns: 1fr 1fr; gap: 10px; }
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
  .kpi__value { font-size: 28px; }
  .card { padding: 14px 16px; }
  .top__inner { padding: 10px 16px; }
  .top__actions .btn span { display: none; }
  .top__actions .btn { padding: 0 11px; }
  .top__actions .btn--reg span { display: inline; }
  .top__actions { width: 100%; }
  .top__actions .btn--reg { flex: 1; justify-content: center; order: -1; }
  .reg-card { padding: 18px 16px; }
  .reg-ticket { flex-direction: column; text-align: center; padding: 20px; }
  .reg-ticket b { text-align: center; }
  .iform__foot .btn--lg { width: 100%; justify-content: center; }
  .result-count { width: 100%; margin: 0; }
  .toolbar select { flex: 1 1 30%; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ================== v9 additions ================== */
.auto-sync { opacity: .8; }
.btn--icon { width: 42px; padding: 0; justify-content: center; }
.btn--icon .i-sun { display: none; }
[data-theme="dark"] .btn--icon .i-sun { display: block; }
[data-theme="dark"] .btn--icon .i-moon { display: none; }
.btn--danger { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.btn--danger:hover { background: var(--bad); color: #fff; border-color: var(--bad); }
.bulk .btn--danger { background: #E9A29B; color: #3A0B07; }
.subtabs { width: 100%; }
.subtabs__grp { align-self: center; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 0 8px 0 4px; letter-spacing: .03em; }
.subtabs__grp:not(:first-child) { border-inline-start: 1px solid var(--line); margin-inline-start: 6px; padding-inline-start: 12px; }
.f--narrow { max-width: 360px; }
.sub > form { display: grid; gap: 16px; }
code { font: 600 12.5px var(--mono); background: var(--paper); color: var(--burgundy); padding: 1px 6px; border-radius: 6px; direction: ltr; unicode-bidi: isolate; }

/* whatsapp status */
.wa-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-start: 8px; vertical-align: 1px; background: #CFC4B8; }
.wa-dot--ok { background: var(--ok); } .wa-dot--bad { background: var(--bad); } .wa-dot--wait { background: #D39B2A; }
.wa-box { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 18px; display: grid; gap: 6px; }
.wa-box > p { margin: 0 0 2px; font-weight: 700; font-size: 13px; color: var(--muted); }
.wa-row { display: grid; grid-template-columns: auto 1fr auto auto auto; gap: 8px; align-items: center; font-size: 14px; }
.wa-row .wa-dot { margin: 0; }
.wa-row small { color: var(--muted); }
.wa-test { display: flex; gap: 8px; flex: 1 1 320px; }
.wa-test input { flex: 1; min-width: 0; height: 40px; border-radius: 12px; border: 1.5px solid rgba(62, 16, 31, .15); background: var(--field); color: var(--ink); padding: 0 12px; font: inherit; }
.howto { background: var(--paper); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.howto summary { cursor: pointer; font-weight: 700; color: var(--burgundy); }
.howto ol { margin: 10px 0 2px; padding-inline-start: 20px; line-height: 1.9; color: var(--ink-2); }
.msg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.msg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.msg textarea { font-size: 13.5px !important; line-height: 1.7; }
.wa-bubble { background: #DCF8C6; color: #111B21; border-radius: 12px 12px 4px 12px; padding: 10px 12px; font-size: 13.5px; line-height: 1.65; box-shadow: 0 1px 1px rgba(0, 0, 0, .12); margin-top: 24px; max-height: 360px; overflow: auto; overflow-wrap: anywhere; position: relative; }
.msg { position: relative; }
.msg::after { content: "معاينة واتساب"; position: absolute; top: 14px; left: 14px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
[data-theme="dark"] .wa-bubble { background: #005C4B; color: #E9EDEF; }

/* transport editor */
.routes-edit { display: grid; gap: 12px; margin-bottom: 10px; }
.rte { --rc: #C9A15E; border: 1px solid var(--line); border-inline-start: 5px solid var(--rc); border-radius: 16px; padding: 12px; background: var(--surface-2); display: grid; gap: 10px; }
.rte__head { display: grid; grid-template-columns: 44px 1fr 180px auto; gap: 8px; align-items: center; }
.rte input { height: 40px; border-radius: 10px; border: 1.5px solid rgba(62, 16, 31, .15); background: var(--field); color: var(--ink); padding: 0 10px; font: inherit; font-size: 14px; min-width: 0; }
.rte input[type=color] { padding: 3px; cursor: pointer; }
.rte input[data-rk=name] { font-weight: 700; }
.rte__stops { margin: 0; padding: 0 22px 0 0; display: grid; gap: 6px; }
.rte__stops li { display: grid; grid-template-columns: 1fr 1.3fr 110px 34px; gap: 6px; align-items: center; }
.rte__stops li::marker { color: var(--muted); font: 700 12px var(--mono); }
.rte input.is-ok { border-color: var(--ok); }
.rte input.is-bad { border-color: var(--bad); }
.rte > .btn { justify-self: start; }
.tr-sum { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.qchip--static { cursor: default; padding: 10px 14px; }
.qchip--static b { font-size: 22px; }
.reg--mini { min-width: 820px; }
.reg--mini tbody tr { cursor: default; }

/* ================== Dark theme ================== */
:root { --field: #fff; --surface-2: #FDFBF7; }
[data-theme="dark"] {
  color-scheme: dark;
  --surface: #221419; --surface-2: #2A1A20; --bg: #150B0E; --field: #1A0F13;
  --ink: #F3E9EC; --ink-2: #CDBBC1; --muted: #9C868D;
  --line: rgba(255, 246, 229, .10); --grid: #3A2A30;
  --paper: #33222A; --sand: #3E2A31; --burgundy-deep: #F3E4C8;
  --s-reg: #D06B8C; --s-att: #E0B25E;
  --ok: #6FCF8F; --ok-bg: rgba(111, 207, 143, .14);
  --warn: #E7B45C; --warn-bg: rgba(231, 180, 92, .14);
  --bad: #F07F76; --bad-bg: rgba(240, 127, 118, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 26px -18px rgba(0, 0, 0, .8);
}
[data-theme="dark"] body { background: var(--bg); }
[data-theme="dark"] .top { background: #1F0910; }
[data-theme="dark"] .btn { color: var(--ink); }
[data-theme="dark"] .btn--primary { background: var(--gold); color: var(--burgundy-ink); border-color: var(--gold); }
[data-theme="dark"] .btn--primary:hover { background: #EDD3A3; }
[data-theme="dark"] .btn--gold { color: var(--burgundy-ink); }
[data-theme="dark"] .btn--ghost-light, [data-theme="dark"] .btn--ghost { color: var(--cream); }
[data-theme="dark"] .btn--danger { color: var(--bad); }
[data-theme="dark"] .btn:hover, [data-theme="dark"] .qchip:hover, [data-theme="dark"] .ibtn:hover { border-color: rgba(255, 246, 229, .3); }
[data-theme="dark"] .f input, [data-theme="dark"] .f textarea, [data-theme="dark"] .f select,
[data-theme="dark"] .code-form input, [data-theme="dark"] .connect-bar__row input, [data-theme="dark"] .rte input, [data-theme="dark"] .wa-test input { background: var(--field); color: var(--ink); border-color: rgba(255, 246, 229, .14); }
[data-theme="dark"] .f input:focus, [data-theme="dark"] .f textarea:focus, [data-theme="dark"] .f select:focus, [data-theme="dark"] .search input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(227, 195, 138, .15); }
[data-theme="dark"] .ibtn, [data-theme="dark"] .pick span, [data-theme="dark"] .qbtn { background: var(--surface-2); color: var(--ink-2); }
[data-theme="dark"] .pick input:checked + span, [data-theme="dark"] .subtabs button.is-on, [data-theme="dark"] .seg button.is-on, [data-theme="dark"] .toggle-table[aria-pressed="true"], [data-theme="dark"] .qchip.is-on { background: var(--gold); color: var(--burgundy-ink); border-color: var(--gold); }
[data-theme="dark"] .qchip.is-on b, [data-theme="dark"] .qchip.is-on small { color: var(--burgundy-ink); }
[data-theme="dark"] .item, [data-theme="dark"] .trk, [data-theme="dark"] .upload, [data-theme="dark"] .types button { background: var(--surface-2); }
[data-theme="dark"] .reg th { background: #2A1A20; }
[data-theme="dark"] .reg tbody tr:hover, [data-theme="dark"] .hb:hover, [data-theme="dark"] .recent__row:hover, [data-theme="dark"] .subtabs button:hover { background: rgba(255, 246, 229, .04); }
[data-theme="dark"] .reg tr.is-sel { background: rgba(227, 195, 138, .08); }
[data-theme="dark"] .reg .code, [data-theme="dark"] .origin, [data-theme="dark"] .item__type, [data-theme="dark"] code { background: var(--paper); color: var(--gold); }
[data-theme="dark"] .reg input[type=checkbox] { accent-color: var(--gold); }
[data-theme="dark"] .find-row, [data-theme="dark"] .q, [data-theme="dark"] .preview, [data-theme="dark"] .howto { background: var(--surface-2); }
[data-theme="dark"] .howto summary, [data-theme="dark"] .preview b { color: var(--gold); }
[data-theme="dark"] .pill--registered, [data-theme="dark"] .st-select.st--registered, [data-theme="dark"] .pill--muted { background: rgba(255, 246, 229, .08); color: var(--ink-2); }
[data-theme="dark"] .st-select { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22%3E%3Cpath d=%22m6 9 6 6 6-6%22 fill=%22none%22 stroke=%22%23CDBBC1%22 stroke-width=%223%22 stroke-linecap=%22round%22/%3E%3C/svg%3E"); }
[data-theme="dark"] .switch span { background: #4A3A40; }
[data-theme="dark"] .kpi__icon svg, [data-theme="dark"] .item__thumb svg { stroke: var(--gold); }
[data-theme="dark"] .recent__av, [data-theme="dark"] .qcard__av { color: var(--gold); }
[data-theme="dark"] .kpi--hero, [data-theme="dark"] .scan-result, [data-theme="dark"] .drawer__head, [data-theme="dark"] .bulk, [data-theme="dark"] .reg-ticket { background: #3A1220; border-color: #3A1220; }
[data-theme="dark"] .dlg__close, [data-theme="dark"] .login__close { background: var(--paper); color: var(--gold); }
[data-theme="dark"] .login__card { background: #221419; }
[data-theme="dark"] .login__card input { background: var(--field); color: var(--ink); border-color: rgba(255, 246, 229, .18); }
[data-theme="dark"] .login__card h1 { color: var(--cream); }
[data-theme="dark"] .skeleton { background: linear-gradient(90deg, #2A1A20 25%, #33222A 50%, #2A1A20 75%); background-size: 200% 100%; }
[data-theme="dark"] .connect-bar { color: var(--burgundy-ink); }

@media (max-width: 980px) {
  .msg-grid { grid-template-columns: 1fr; }
  .rte__head { grid-template-columns: 44px 1fr auto; }
  .rte__head input[data-rk=time] { grid-column: 2 / -1; }
}
@media (max-width: 640px) {
  .msg { grid-template-columns: 1fr; }
  .rte__stops li { grid-template-columns: 1fr 34px; }
  .wa-row { grid-template-columns: auto 1fr auto; }
}
[data-theme="dark"] .chart line { stroke: #3A2A30; }
[data-theme="dark"] .chart .cross line { stroke: #6E5A60; }
.mail-note { margin: 0 0 12px; padding: 12px 14px; border-radius: 12px; background: var(--soft, rgba(227, 195, 138, .14)); font-size: 14px; line-height: 1.8; }
.role-badge { display: inline-block; vertical-align: middle; font: 700 12px var(--sans, sans-serif); padding: 3px 10px; border-radius: 99px; border: 1px solid rgba(227, 195, 138, .45); color: #E3C38A; }
.role-badge:empty { display: none; }
