/* ==========================================================================
   Design system – dark fintech theme. All colours are CSS variables; the admin
   panel overrides them at runtime (Appearance). Logical properties are used
   everywhere so RTL (Arabic) mirrors automatically.
   ========================================================================== */

@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("../fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("../fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("../fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("../fonts/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700; font-display: swap; src: url("../fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url("../fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --bg: #0A0A0A;
  --surface: #121212;
  --surface-2: #1A1A1A;
  --surface-3: #202020;
  --border: #262626;
  --border-strong: #333333;
  --text: #FAFAFA;
  --text-muted: #A3A3A3;
  --text-subtle: #8A8A8A;
  --primary: #00E676;
  --primary-hover: #00C853;
  --primary-contrast: #04140B;
  --primary-soft: rgba(0, 230, 118, 0.12);
  --primary-glow: 0 0 0 1px rgba(0, 230, 118, 0.35), 0 8px 28px -6px rgba(0, 230, 118, 0.45);
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #38BDF8;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --font-latin: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-arabic: "IBM Plex Sans Arabic", "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font: var(--font-latin);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --sidebar-w: 260px;
  --topbar-h: 64px;
  color-scheme: dark;
}

html[dir="rtl"] { --font: var(--font-arabic); }

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; min-height: 100vh;
}
html[dir="rtl"] body { font-size: 15.5px; line-height: 1.75; }
img, svg { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--primary-hover); }
h1, h2, h3, h4, h5 { margin: 0 0 .5em; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3 { letter-spacing: 0; line-height: 1.4; }
h1 { font-size: clamp(1.75rem, 3vw + 1rem, 3.25rem); }
h2 { font-size: clamp(1.4rem, 1.5vw + 1rem, 2.1rem); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.02rem; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
code, kbd, pre, .mono { font-family: var(--font-mono); }
.mono { font-size: .92em; letter-spacing: 0; direction: ltr; unicode-bidi: embed; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: .1em .4em; font-size: .88em; }
pre { background: #0D0D0D; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; overflow-x: auto; font-size: 13px; line-height: 1.6; direction: ltr; text-align: start; }
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
::selection { background: var(--primary); color: var(--primary-contrast); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; inset-inline-start: 8px; top: -60px; background: var(--primary); color: var(--primary-contrast); padding: 8px 14px; border-radius: 8px; z-index: 1000; font-weight: 600; }
.skip-link:focus { top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: middle; }
.icon-lg { width: 24px; height: 24px; }
html[dir="rtl"] .icon-flip { transform: scaleX(-1); }

/* ---------- Layout utilities ---------- */
.container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 20px; }
.container-sm { max-width: 760px; }
.container-md { max-width: 960px; }
.flex { display: flex; } .inline-flex { display: inline-flex; }
.items-center { align-items: center; } .items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; } .justify-center { justify-content: center; } .justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; } .flex-1 { flex: 1; } .shrink-0 { flex-shrink: 0; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; } .gap-8 { gap: 32px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.col-span-2 { grid-column: span 2; }
.stack > * + * { margin-top: 16px; } .stack-sm > * + * { margin-top: 8px; } .stack-lg > * + * { margin-top: 24px; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.ms-auto { margin-inline-start: auto; }
.p-0 { padding: 0 !important; }
.w-full { width: 100%; }
.text-center { text-align: center; } .text-end { text-align: end; } .text-start { text-align: start; }
.text-sm { font-size: 13px; } .text-xs { font-size: 12px; } .text-lg { font-size: 17px; } .text-xl { font-size: 20px; }
.muted { color: var(--text-muted); } .subtle { color: var(--text-subtle); }
.text-primary { color: var(--primary); } .text-success { color: var(--success); } .text-warning { color: var(--warning); } .text-danger { color: var(--danger); }
.fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break-all { word-break: break-all; }
.hidden { display: none !important; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.nowrap { white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface-2); --btn-fg: var(--text); --btn-border: var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--btn-border);
  background: var(--btn-bg); color: var(--btn-fg); font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none;
  transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .2s var(--ease), transform .08s var(--ease), color .15s;
}
.btn:hover { --btn-bg: var(--surface-3); --btn-border: var(--border-strong); color: var(--btn-fg); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { --btn-bg: var(--primary); --btn-fg: var(--primary-contrast); --btn-border: var(--primary); }
.btn-primary:hover { --btn-bg: var(--primary-hover); --btn-border: var(--primary-hover); --btn-fg: var(--primary-contrast); box-shadow: var(--primary-glow); }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; }
.btn-ghost:hover { --btn-bg: var(--surface-2); --btn-border: transparent; }
.btn-outline { --btn-bg: transparent; }
.btn-danger { --btn-bg: rgba(239, 68, 68, .12); --btn-fg: #FCA5A5; --btn-border: rgba(239, 68, 68, .35); }
.btn-danger:hover { --btn-bg: var(--danger); --btn-fg: #fff; --btn-border: var(--danger); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn .spinner { width: 16px; height: 16px; }
.btn.is-loading { pointer-events: none; opacity: .8; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
.label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.label .optional { color: var(--text-subtle); font-weight: 400; }
.help { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; font: inherit; font-size: 14px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s;
}
.input::placeholder, .textarea::placeholder { color: #6B6B6B; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.input-mono { font-family: var(--font-mono); font-size: 13px; direction: ltr; text-align: start; }
html[dir="rtl"] .input-mono { text-align: right; }
.textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-end: 34px; }
html[dir="rtl"] .select { background-position: 13px 50%, 18px 50%; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-group .btn { border-start-start-radius: 0; border-end-start-radius: 0; margin-inline-start: -1px; min-height: 42px; }
.input-addon { display: inline-flex; align-items: center; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--border); border-inline-start: 0; border-start-end-radius: 10px; border-end-end-radius: 10px; color: var(--text-muted); font-size: 13px; font-weight: 600; }
.field-error { color: #FCA5A5; font-size: 12.5px; margin: 6px 0 0; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 40px; height: 22px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; transition: background .2s var(--ease); flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-muted); transition: transform .2s var(--ease), background .2s; }
.switch input:checked + .track { background: var(--primary-soft); border-color: var(--primary); }
.switch input:checked + .track::after { background: var(--primary); transform: translateX(18px); }
html[dir="rtl"] .switch input:checked + .track::after { transform: translateX(-18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--primary); outline-offset: 2px; }
.radio-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.radio-card { position: relative; display: block; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card:hover { border-color: var(--border-strong); }
.radio-card:has(input:checked) { border-color: var(--primary); background: linear-gradient(180deg, var(--primary-soft), transparent); }
.radio-card:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.radio-card .title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
fieldset { border: 0; padding: 0; margin: 0; }
.color-input { display: flex; align-items: center; gap: 8px; }
.color-input input[type=color] { width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 3px; cursor: pointer; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-body { padding: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-header h2, .card-header h3 { margin: 0; font-size: 16px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.card-hover { transition: border-color .2s var(--ease), transform .2s var(--ease); }
.card-hover:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.card-glow { position: relative; }
.card-glow::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; background: linear-gradient(140deg, rgba(0,230,118,.55), transparent 40%, transparent 60%, rgba(0,230,118,.25)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }

/* ---------- Stats ---------- */
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat { padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.stat .stat-label { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.stat .stat-value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .stat-sub { font-size: 12.5px; color: var(--text-subtle); margin-top: 4px; }
.stat-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: inline-grid; place-items: center; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface); white-space: nowrap; position: sticky; top: 0; }
html[dir="rtl"] .table th { text-transform: none; letter-spacing: 0; font-size: 13px; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: rgba(255,255,255,.02); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table a.row-link { color: var(--text); font-weight: 500; }
.table a.row-link:hover { color: var(--primary); }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-muted); border: 1px solid transparent; }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: rgba(34,197,94,.12); color: #4ADE80; border-color: rgba(34,197,94,.25); }
.badge-warning { background: rgba(245,158,11,.12); color: #FBBF24; border-color: rgba(245,158,11,.25); }
.badge-danger { background: rgba(239,68,68,.12); color: #F87171; border-color: rgba(239,68,68,.25); }
.badge-info { background: rgba(56,189,248,.12); color: #7DD3FC; border-color: rgba(56,189,248,.25); }
.badge-primary { background: var(--primary-soft); color: var(--primary); border-color: rgba(0,230,118,.3); }
.badge-muted { background: var(--surface-2); color: var(--text-subtle); border-color: var(--border); }
.badge-neutral { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); font-size: 14px; }
.alert .icon { margin-top: 2px; }
.alert-title { font-weight: 600; margin-bottom: 2px; }
.alert p:last-child { margin-bottom: 0; }
.alert-success { border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.07); }
.alert-success .icon { color: var(--success); }
.alert-warning { border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.07); }
.alert-warning .icon { color: var(--warning); }
.alert-danger { border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.08); }
.alert-danger .icon { color: var(--danger); }
.alert-info { border-color: rgba(56,189,248,.35); background: rgba(56,189,248,.06); }
.alert-info .icon { color: var(--info); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 1100; inset-block-end: 20px; inset-inline-end: 20px; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 40px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: 14px; animation: toast-in .3s var(--ease); }
.toast.is-leaving { animation: toast-out .25s var(--ease) forwards; }
.toast-success { border-inline-start: 3px solid var(--success); }
.toast-error { border-inline-start: 3px solid var(--danger); }
.toast-warning { border-inline-start: 3px solid var(--warning); }
.toast-info { border-inline-start: 3px solid var(--info); }
.toast-close { margin-inline-start: auto; background: none; border: 0; color: var(--text-muted); cursor: pointer; padding: 0; line-height: 1; font-size: 18px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 1050; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.7); backdrop-filter: blur(4px); }
.modal.is-open { display: flex; animation: fade-in .2s var(--ease); }
.modal-dialog { width: 100%; max-width: 520px; max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: 0 24px 64px -12px rgba(0,0,0,.8); animation: pop-in .25s var(--ease); }
.modal-lg .modal-dialog { max-width: 760px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab { padding: 10px 14px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-muted); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.is-active, .tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { padding-top: 18px; }
.tab-panel[hidden] { display: none; }
.pills { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; flex-wrap: wrap; }
.pill { padding: 6px 12px; border-radius: 7px; color: var(--text-muted); font-size: 13px; font-weight: 600; border: 0; background: none; cursor: pointer; font-family: inherit; }
.pill:hover { color: var(--text); }
.pill.is-active { background: var(--surface-3); color: var(--text); }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; z-index: 60; display: none; }
.dropdown.is-open .dropdown-menu { display: block; animation: pop-in .15s var(--ease); }
.dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; color: var(--text); font-size: 14px; background: none; border: 0; cursor: pointer; text-align: start; font-family: inherit; }
.dropdown-item:hover { background: var(--surface-3); color: var(--text); }
.dropdown-sep { height: 1px; background: var(--border); margin: 6px 0; }

/* ---------- Skeleton / empty / spinner ---------- */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; min-height: 14px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.empty { text-align: center; padding: 48px 20px; }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--text-muted); max-width: 420px; margin: 0 auto 18px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(255,255,255,.2); border-top-color: currentColor; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Copy field ---------- */
.copy-field { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 8px 8px 14px; }
html[dir="rtl"] .copy-field { padding: 8px 14px 8px 8px; }
.copy-field .value { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 13px; direction: ltr; text-align: left; word-break: break-all; }
.copy-btn.is-copied { --btn-bg: var(--primary-soft); --btn-fg: var(--primary); --btn-border: var(--primary); }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; padding: 16px; }
.page-link { min-width: 36px; height: 36px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid var(--border); color: var(--text-muted); font-size: 13px; font-weight: 600; }
.page-link:hover { color: var(--text); border-color: var(--border-strong); }
.page-link.is-current { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.page-link.is-disabled { opacity: .4; }

/* ---------- Steps (wizard) ---------- */
.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 28px; counter-reset: step; flex-wrap: wrap; }
.steps li { flex: 1; min-width: 110px; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; color: var(--text-subtle); counter-increment: step; }
.steps li::before { content: ""; height: 4px; border-radius: 4px; background: var(--surface-3); }
.steps li.is-done::before, .steps li.is-current::before { background: var(--primary); }
.steps li.is-current { color: var(--text); font-weight: 600; }
.steps li.is-done { color: var(--text-muted); }

/* ---------- Filters bar ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.filters .form-group { margin: 0; min-width: 150px; flex: 1; }
.filters .form-group.grow-2 { flex: 2; }

/* ---------- Page header ---------- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header h1 { font-size: 24px; margin: 0; }
.page-header p { margin: 4px 0 0; color: var(--text-muted); }
.breadcrumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-subtle); margin-bottom: 6px; flex-wrap: wrap; }
.breadcrumbs a { color: var(--text-muted); }

/* ---------- Definition list ---------- */
.dl { display: grid; grid-template-columns: minmax(130px, 200px) 1fr; gap: 0; }
.dl dt, .dl dd { padding: 11px 0; border-bottom: 1px solid var(--border); margin: 0; font-size: 14px; }
.dl dt { color: var(--text-muted); padding-inline-end: 16px; }
.dl dd { min-width: 0; word-break: break-word; }
.dl > :nth-last-child(-n+2) { border-bottom: 0; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding-inline-start: 26px; padding-bottom: 18px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 5px; top: 8px; bottom: -8px; width: 1px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; inset-inline-start: 0; top: 5px; width: 11px; height: 11px; border-radius: 50%; background: var(--surface-3); border: 2px solid var(--border-strong); }
.timeline li.is-success::after { background: var(--success); border-color: var(--success); }
.timeline li.is-primary::after { background: var(--primary); border-color: var(--primary); }
.timeline li.is-danger::after { background: var(--danger); border-color: var(--danger); }

/* ==========================================================================
   App shell (merchant dashboard + admin panel)
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-inline-end: 1px solid var(--border); display: flex; flex-direction: column; z-index: 40; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 20px; border-bottom: 1px solid var(--border); color: var(--text); font-weight: 700; font-size: 17px; }
.sidebar-brand:hover { color: var(--text); }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--primary); color: var(--primary-contrast); display: grid; place-items: center; font-weight: 800; box-shadow: var(--primary-glow); flex: none; }
.brand-logo { max-height: 32px; width: auto; }
.nav { padding: 14px 12px; flex: 1; }
.nav-section { font-size: 11px; font-weight: 700; color: var(--text-subtle); text-transform: uppercase; letter-spacing: .08em; padding: 16px 10px 6px; }
html[dir="rtl"] .nav-section { letter-spacing: 0; font-size: 12px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 10px; margin-bottom: 2px; border-radius: 9px; color: var(--text-muted); font-size: 14px; font-weight: 500; transition: background .15s, color .15s; position: relative; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.is-active { background: var(--primary-soft); color: var(--primary); }
.nav-link.is-active::before { content: ""; position: absolute; inset-inline-start: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
html[dir="rtl"] .nav-link.is-active::before { border-radius: 3px 0 0 3px; }
.nav-count { margin-inline-start: auto; font-size: 11px; background: var(--danger); color: #fff; border-radius: 999px; padding: 1px 7px; font-weight: 700; }
.sidebar-footer { padding: 14px 12px; border-top: 1px solid var(--border); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 24px; background: rgba(10,10,10,.82); backdrop-filter: saturate(140%) blur(10px); border-bottom: 1px solid var(--border); }
.topbar .menu-toggle { display: none; }
.content { padding: 28px 24px 48px; width: 100%; max-width: 1320px; margin-inline: auto; flex: 1; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #00796B); color: var(--primary-contrast); display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.env-badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: rgba(245,158,11,.15); color: var(--warning); border: 1px solid rgba(245,158,11,.3); }
.banner { padding: 10px 24px; font-size: 13.5px; display: flex; align-items: center; gap: 10px; justify-content: center; text-align: center; flex-wrap: wrap; }
.banner-warning { background: rgba(245,158,11,.12); color: #FCD34D; border-bottom: 1px solid rgba(245,158,11,.3); }
.banner-danger { background: rgba(239,68,68,.12); color: #FCA5A5; border-bottom: 1px solid rgba(239,68,68,.3); }
.banner-info { background: rgba(56,189,248,.1); color: #7DD3FC; border-bottom: 1px solid rgba(56,189,248,.25); }
.sidebar-backdrop { display: none; }
.notif-dot { position: absolute; top: 6px; inset-inline-end: 6px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; border: 2px solid var(--bg); }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 200px; }

/* ==========================================================================
   Auth pages
   ========================================================================== */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: radial-gradient(1000px 500px at 50% -10%, rgba(0,230,118,.10), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 440px; }
.auth-card .card-body { padding: 32px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 24px; color: var(--text); font-weight: 700; font-size: 19px; }
.auth-title { font-size: 22px; text-align: center; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--text-muted); margin-bottom: 24px; font-size: 14px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 14px; color: var(--text-muted); }
.otp-input { font-family: var(--font-mono); font-size: 24px; letter-spacing: .5em; text-align: center; direction: ltr; }
.qr-box { background: #fff; padding: 12px; border-radius: 12px; display: inline-block; }
.qr-box img { width: 180px; height: 180px; }
.lang-switch { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; font-weight: 600; }
.lang-switch a { color: var(--text-muted); padding: 4px 8px; border-radius: 6px; }
.lang-switch a:hover, .lang-switch a.is-active { color: var(--text); background: var(--surface-2); }

/* ==========================================================================
   Public website
   ========================================================================== */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(10,10,10,.75); backdrop-filter: saturate(140%) blur(12px); border-bottom: 1px solid rgba(38,38,38,.7); }
.site-header .container { display: flex; align-items: center; gap: 24px; height: 68px; }
.site-brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 18px; }
.site-brand:hover { color: var(--text); }
.site-nav { display: flex; gap: 4px; flex: 1; }
.site-nav a { color: var(--text-muted); font-weight: 500; font-size: 14.5px; padding: 8px 12px; border-radius: 8px; }
.site-nav a:hover, .site-nav a.is-active { color: var(--text); }
.site-actions { display: flex; gap: 8px; align-items: center; }
.site-menu-toggle { display: none; }
.hero { position: relative; padding: 96px 0 72px; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: -20% -10% auto; height: 640px; background: radial-gradient(600px 300px at 50% 0%, rgba(0,230,118,.18), transparent 70%); pointer-events: none; }
.hero-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 75%); pointer-events: none; }
.hero .container { position: relative; text-align: center; }
.hero h1 { max-width: 880px; margin-inline: auto; }
.hero h1 .accent { color: var(--primary); }
.hero p.lead { font-size: clamp(1rem, .5vw + .95rem, 1.2rem); color: var(--text-muted); max-width: 680px; margin: 0 auto 32px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 600; margin-bottom: 22px; border: 1px solid rgba(0,230,118,.25); }
.hero-visual { margin: 56px auto 0; max-width: 980px; }
.section { padding: 80px 0; }
.section-alt { background: linear-gradient(180deg, transparent, rgba(255,255,255,.015), transparent); }
.section-head { text-align: center; max-width: 720px; margin: 0 auto 48px; }
.section-head p { color: var(--text-muted); font-size: 16.5px; }
.feature { padding: 24px; }
.feature-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin-bottom: 16px; }
.feature h3 { font-size: 17px; }
.feature p { color: var(--text-muted); margin: 0; font-size: 14.5px; }
.steps-row { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); counter-reset: hstep; }
.step-card { padding: 24px; position: relative; counter-increment: hstep; }
.step-card::before { content: counter(hstep); display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--primary); color: var(--primary); font-weight: 700; margin-bottom: 14px; }
.step-card p { color: var(--text-muted); margin: 0; font-size: 14.5px; }
.pricing { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: stretch; }
.price-card { padding: 28px; display: flex; flex-direction: column; }
.price-card.is-featured { border-color: var(--primary); box-shadow: var(--primary-glow); }
.price { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; margin: 14px 0 4px; }
.price small { font-size: 15px; color: var(--text-muted); font-weight: 500; }
.price-fee { color: var(--primary); font-weight: 600; font-size: 14px; }
.price-features { list-style: none; padding: 0; margin: 22px 0 26px; flex: 1; }
.price-features li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; font-size: 14.5px; color: var(--text-muted); }
.price-features li .icon { color: var(--primary); margin-top: 3px; }
.faq { max-width: 820px; margin: 0 auto; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 10px; transition: border-color .2s; }
.faq details[open] { border-color: var(--border-strong); }
.faq summary { cursor: pointer; padding: 18px 20px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 22px; color: var(--primary); transition: transform .2s var(--ease); line-height: 1; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .answer { padding: 0 20px 18px; color: var(--text-muted); }
.testimonial { padding: 24px; }
.testimonial blockquote { margin: 0 0 16px; font-size: 15.5px; }
.testimonial .who { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.cta-band { padding: 56px 32px; text-align: center; border-radius: var(--radius-lg); background: radial-gradient(600px 200px at 50% 0%, rgba(0,230,118,.18), transparent 70%), var(--surface); border: 1px solid var(--border); }
.cta-band p { color: var(--text-muted); max-width: 560px; margin: 0 auto 24px; }
.site-footer { border-top: 1px solid var(--border); padding: 56px 0 28px; margin-top: 40px; background: var(--surface); }
.footer-grid { display: grid; gap: 32px; grid-template-columns: 2fr repeat(3, 1fr); }
.footer-grid h4 { font-size: 13px; color: var(--text); margin-bottom: 14px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 9px; }
.footer-grid a { color: var(--text-muted); font-size: 14px; }
.footer-grid a:hover { color: var(--text); }
.footer-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--border); margin-top: 40px; padding-top: 22px; font-size: 13px; color: var(--text-subtle); }
.prose { font-size: 16px; line-height: 1.8; color: #E5E5E5; }
.prose h2 { margin-top: 1.8em; font-size: 1.5rem; }
.prose h3 { margin-top: 1.5em; }
.prose ul, .prose ol { padding-inline-start: 1.4em; }
.prose li { margin-bottom: .4em; }
.prose img { border-radius: var(--radius); margin: 1.5em 0; }
.prose blockquote { margin: 1.5em 0; padding: 12px 20px; border-inline-start: 3px solid var(--primary); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; color: var(--text-muted); }
.prose table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: 14.5px; }
.prose th, .prose td { border: 1px solid var(--border); padding: 10px 12px; text-align: start; }
.prose th { background: var(--surface-2); }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.page-hero { padding: 64px 0 32px; text-align: center; }
.page-hero p { color: var(--text-muted); max-width: 640px; margin-inline: auto; }
.post-card { overflow: hidden; display: flex; flex-direction: column; }
.post-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.post-card .card-body { flex: 1; display: flex; flex-direction: column; }
.post-card h3 a { color: var(--text); }
.post-card h3 a:hover { color: var(--primary); }

/* Mock dashboard in hero */
.mock { border-radius: var(--radius-lg); border: 1px solid var(--border-strong); background: var(--surface); box-shadow: 0 40px 120px -40px rgba(0,230,118,.35); overflow: hidden; text-align: start; }
.mock-bar { display: flex; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.mock-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); }
.mock-body { padding: 20px; display: grid; gap: 16px; grid-template-columns: 1.2fr 1fr; }
.mock-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.mock-row:last-child { border-bottom: 0; }

/* ==========================================================================
   Checkout
   ========================================================================== */
.checkout { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 24px 16px 40px; background: radial-gradient(700px 360px at 50% -10%, rgba(0,230,118,.10), transparent 60%), var(--bg); }
.checkout-top { width: 100%; max-width: 460px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.checkout-card { width: 100%; max-width: 460px; overflow: hidden; }
.checkout-merchant { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.merchant-logo { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: var(--surface-2); flex: none; display: grid; place-items: center; font-weight: 700; color: var(--primary); }
.checkout-amount { text-align: center; padding: 24px 20px 8px; }
.checkout-amount .amount { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; direction: ltr; display: inline-flex; gap: 8px; align-items: baseline; font-variant-numeric: tabular-nums; }
.checkout-amount .amount small { font-size: 16px; color: var(--text-muted); font-weight: 600; }
.network-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; font-weight: 600; margin-top: 8px; }
.network-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.checkout-qr { display: flex; justify-content: center; padding: 16px 20px; }
.checkout-qr .qr-box img { width: 200px; height: 200px; }
.checkout-section { padding: 0 20px 16px; }
.timer { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px; margin: 0 20px 16px; border-radius: 10px; background: var(--surface-2); font-size: 14px; color: var(--text-muted); }
.timer .time { font-family: var(--font-mono); font-weight: 600; color: var(--text); font-size: 16px; direction: ltr; }
.timer.is-urgent .time { color: var(--warning); }
.progress { height: 4px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); transition: width 1s linear; }
.checkout-status { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 14px; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 0 rgba(0,230,118,.6); animation: pulse 1.8s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(0,230,118,.55); } 70% { box-shadow: 0 0 0 12px rgba(0,230,118,0); } 100% { box-shadow: 0 0 0 0 rgba(0,230,118,0); } }
.result { text-align: center; padding: 36px 24px; }
.result-icon { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 18px; }
.result-icon .icon { width: 34px; height: 34px; stroke-width: 2.4; }
.result-success .result-icon { background: rgba(34,197,94,.15); color: var(--success); box-shadow: 0 0 0 8px rgba(34,197,94,.06); }
.result-warning .result-icon { background: rgba(245,158,11,.15); color: var(--warning); }
.result-muted .result-icon { background: var(--surface-2); color: var(--text-muted); }
.checkout-foot { margin-top: 18px; font-size: 12.5px; color: var(--text-subtle); text-align: center; display: flex; align-items: center; gap: 6px; }
.checkmark-draw { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .6s .2s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ==========================================================================
   Docs
   ========================================================================== */
.docs { display: grid; grid-template-columns: 260px minmax(0, 1fr) 220px; gap: 40px; max-width: 1400px; margin: 0 auto; padding: 32px 20px 64px; }
.docs-nav { position: sticky; top: 92px; align-self: start; max-height: calc(100vh - 110px); overflow-y: auto; }
.docs-nav h5 { font-size: 12px; color: var(--text-subtle); text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 8px; }
html[dir="rtl"] .docs-nav h5 { letter-spacing: 0; text-transform: none; font-size: 13px; }
.docs-nav a { display: block; padding: 6px 10px; border-radius: 7px; color: var(--text-muted); font-size: 14px; }
.docs-nav a:hover { color: var(--text); background: var(--surface); }
.docs-nav a.is-active { color: var(--primary); background: var(--primary-soft); }
.docs-search { margin-bottom: 8px; }
.docs-toc { position: sticky; top: 92px; align-self: start; font-size: 13px; }
.docs-toc a { display: block; color: var(--text-muted); padding: 4px 0; }
.docs-toc a:hover { color: var(--text); }
.docs-content { min-width: 0; }
.code-tabs { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin: 1.5em 0; background: #0D0D0D; }
.code-tabs .tabs { background: var(--surface); padding: 0 8px; }
.code-tabs pre { border: 0; border-radius: 0; margin: 0; }
.code-tabs .code-copy { position: absolute; top: 8px; inset-inline-end: 8px; }
.code-panel { position: relative; }
.endpoint { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 14px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; direction: ltr; }
.method { font-weight: 700; font-size: 12px; padding: 2px 8px; border-radius: 5px; }
.method-get { background: rgba(56,189,248,.15); color: #7DD3FC; }
.method-post { background: var(--primary-soft); color: var(--primary); }
.method-delete { background: rgba(239,68,68,.15); color: #FCA5A5; }
.tryit { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-top: 1.5em; }
.tryit-head { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tryit-body { padding: 16px; }
.tryit-response { margin-top: 12px; max-height: 360px; overflow: auto; }
.tok-key { color: #7DD3FC; } .tok-str { color: #86EFAC; } .tok-num { color: #FBBF24; } .tok-kw { color: #F0ABFC; } .tok-com { color: #6B7280; }

/* ==========================================================================
   Rich text editor (admin CMS)
   ========================================================================== */
.rte { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.rte:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.rte-toolbar button { min-width: 32px; height: 30px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: var(--text-muted); cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; }
.rte-toolbar button:hover { background: var(--surface-3); color: var(--text); }
.rte-toolbar .sep { width: 1px; background: var(--border); margin: 4px 4px; }
.rte-area { min-height: 260px; max-height: 620px; overflow-y: auto; padding: 16px; outline: none; }
.rte-source { width: 100%; min-height: 260px; border: 0; border-radius: 0; font-family: var(--font-mono); font-size: 13px; background: #0D0D0D; color: var(--text); padding: 16px; direction: ltr; }
.sortable-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; }
.sortable-item.is-dragging { opacity: .5; border-style: dashed; }
.drag-handle { cursor: grab; color: var(--text-subtle); display: grid; place-items: center; }
.theme-preview { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; background: var(--bg); }
.swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(255,255,255,.15); display: inline-block; }

/* ==========================================================================
   Installer
   ========================================================================== */
.install { min-height: 100vh; padding: 40px 16px; background: radial-gradient(900px 400px at 50% -10%, rgba(0,230,118,.10), transparent 60%), var(--bg); }
.install .card { max-width: 760px; margin: 0 auto; }
.req-list { list-style: none; padding: 0; margin: 0; }
.req-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.req-ok { color: var(--success); font-weight: 600; }
.req-fail { color: var(--danger); font-weight: 600; }
.req-warn { color: var(--warning); font-weight: 600; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1200px) {
  .docs { grid-template-columns: 240px minmax(0, 1fr); }
  .docs-toc { display: none; }
}
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .mock-body { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--shadow); }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 35; }
  .topbar .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px 40px; }
  .docs { grid-template-columns: 1fr; }
  .docs-nav { position: static; max-height: none; border-bottom: 1px solid var(--border); padding-bottom: 16px; }
  .site-nav { display: none; position: absolute; top: 68px; inset-inline: 0; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 20px; }
  body.site-menu-open .site-nav { display: flex; }
  .site-menu-toggle { display: inline-flex; margin-inline-start: auto; }
  .site-actions .hide-mobile { display: none; }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: auto; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { border-bottom: 0; padding-bottom: 0; }
  .footer-grid { grid-template-columns: 1fr; }
  .section { padding: 56px 0; }
  .hero { padding: 64px 0 48px; }
  .page-header h1 { font-size: 21px; }
  .auth-card .card-body { padding: 24px 20px; }
  .table-responsive thead { display: none; }
  .table-responsive tr { display: block; padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table-responsive td { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; text-align: end; }
  .table-responsive td::before { content: attr(data-label); color: var(--text-muted); font-size: 13px; text-align: start; }
  .table-responsive .num { text-align: end; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .sidebar, .topbar, .site-header, .site-footer, .btn { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ---------- Additional layout helpers ---------- */
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
@media (max-width: 960px) { .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; } }
.prose .alert-box { border: 1px solid rgba(245,158,11,.35); background: rgba(245,158,11,.07); border-radius: var(--radius); padding: 12px 16px; margin: 1.2em 0; }
.prose .alert-box p { margin: 0; }
.secret-box { border: 1px dashed var(--primary); background: var(--primary-soft); border-radius: var(--radius); padding: 16px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--text-muted); }
.chat { display: flex; flex-direction: column; gap: 12px; }
.chat-msg { max-width: 80%; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.chat-msg.is-mine { align-self: flex-end; background: var(--primary-soft); border-color: rgba(0,230,118,.3); }
.chat-meta { font-size: 12px; color: var(--text-subtle); margin-bottom: 4px; }
.health-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--danger); flex: none; }
.health-dot.is-ok { background: var(--success); box-shadow: 0 0 0 4px rgba(34,197,94,.12); }
.health-dot.is-warn { background: var(--warning); }
.json-view { max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-all; }
.list-inline { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.tr-missing { background: rgba(245,158,11,.06); }
.tr-missing td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
html[dir="rtl"] .tr-missing td:first-child { box-shadow: inset -3px 0 0 var(--warning); }
.pill:has(input:checked) { background: var(--surface-3); color: var(--text); }
.repeater-row { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) auto; align-items: end; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; background: var(--surface-2); }
.input.is-dirty, .textarea.is-dirty { border-color: var(--warning); }
.section-type { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); }
.hide-desktop { display: none; }
@media (max-width: 900px) { .site-nav .hide-desktop { display: block; } }
.docs-content .prose pre { position: relative; }
.code-copy { z-index: 2; opacity: .8; }
.code-copy:hover { opacity: 1; }

/* ---------- Checkout refinements ---------- */
.address-value { font-family: var(--font-mono); font-size: 13.5px; line-height: 1.8; letter-spacing: .02em; word-break: break-all; white-space: normal; }
.fee-note { display: flex; align-items: flex-start; gap: 8px; margin: 14px auto 0; max-width: 360px; font-size: 12.5px; line-height: 1.5; color: var(--text-muted); text-align: center; justify-content: center; }
.fee-note .icon { color: var(--primary); margin-top: 2px; }
.checkout-amount .amount { font-variant-numeric: tabular-nums; }
