:root {
    --bg: #1A1D24;
    --card: #242830;
    --elevated: #2C313B;
    --border: #3C4350;
    --cream: #F4EFE6;
    --cream-soft: #E8E1D4;
    --ink: #1A1712;
    --primary: #FF6B00;
    --primary-ink: #1A0E04;
    --text: #F4F1EA;
    --muted: #B8B3A8;
    --danger: #E0B4A8;
    --ok: #3DDC97;
    --warn: #FFB020;
    --info: #8EB4FF;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
    --line: rgba(244, 239, 230, 0.12);
    --line-strong: rgba(244, 239, 230, 0.2);
    --radius: 12px;
    --sidebar: 272px;
    --ease: 160ms ease;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
html { color-scheme: dark; }
body {
    font-family: "IBM Plex Sans Arabic", "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;
    background:
        linear-gradient(180deg, rgba(244, 239, 230, 0.03), transparent 180px),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.55;
    letter-spacing: 0.01em;
}

a { color: var(--cream); text-decoration: none; transition: color var(--ease); }
a:hover { color: #fff; }
a.btn, a.btn:hover, a.btn:focus-visible { color: var(--ink); }
a.btn.secondary, a.btn.secondary:hover, a.btn.secondary:focus-visible { color: var(--cream); }
a.btn.danger, a.btn.danger:hover, a.btn.danger:focus-visible { color: #F6E6E0; }
img { max-width: 100%; display: block; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Login — single centered card */
.auth-stage, .auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px 16px;
    background:
        radial-gradient(520px 280px at 50% 18%, rgba(255, 107, 0, 0.16), transparent 62%),
        var(--bg);
}
.auth-card {
    width: min(420px, 100%);
    background: #21252D;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 36px 32px 28px;
    box-shadow: none;
    animation: auth-rise 420ms ease both;
}
.auth-card .brand-logo {
    width: 132px;
    height: auto;
    max-height: 132px;
    margin: 0 auto 18px;
    border-radius: 22px;
    background: #fff;
    padding: 10px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}
.auth-card h1, .auth-card h2 {
    margin: 0;
    text-align: center;
    font-size: 26px;
    letter-spacing: -0.02em;
}
.auth-card .lede {
    text-align: center;
    color: var(--muted);
    margin: 8px 0 4px;
}
.auth-card .btn.block { margin-top: 18px; height: 48px; font-size: 16px; }
@keyframes auth-rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}
.brand-mark, .avatar {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 700;
    background: linear-gradient(160deg, #ff8a33, var(--primary) 55%, #c2410c);
    color: var(--primary-ink);
    box-shadow: 0 8px 24px rgba(255, 107, 0, 0.28);
}

/* Shell */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
}
.sidebar {
    background: #16191F;
    border-inline-end: 1px solid var(--line);
    padding: 16px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
    min-width: 0;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 10px; flex: 0 0 auto; min-width: 0; }
.brand-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 14px;
    background: #fff;
    padding: 4px;
    flex: none;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}
.brand strong { font-size: 16px; display: block; }
.brand > div:last-child { min-width: 0; }
.nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-block: 4px 8px;
    padding-inline: 2px 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 107, 0, 0.45) transparent;
}
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-track {
    background: transparent;
    margin-block: 8px;
}
.nav::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 0, 0.38);
    border-radius: 999px;
}
.nav::-webkit-scrollbar-thumb:hover { background: rgba(255, 107, 0, 0.7); }
.nav a span { min-width: 0; }
.nav-group {
    margin: 16px 8px 6px;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: #C4BBAE;
    font-weight: 600;
}
.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #D5CFC4;
    padding: 9px 12px;
    border-radius: 12px;
    margin-bottom: 2px;
    border: 1px solid transparent;
    transition: background var(--ease), color var(--ease), border-color var(--ease), box-shadow var(--ease);
    white-space: normal;
    line-height: 1.35;
    overflow: visible;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: 0.9; }
.nav a:hover {
    background: rgba(244, 239, 230, 0.1);
    color: var(--cream);
}
.nav a.active {
    background: var(--cream);
    color: var(--ink);
    border-color: var(--cream-soft);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}
.nav a.active svg { opacity: 1; color: var(--primary); }
.sidebar-foot {
    flex: 0 0 auto;
    margin-top: 0;
    padding-top: 12px;
    border-top: 1px solid rgba(244, 239, 230, 0.1);
}
.sidebar-foot .btn { width: 100%; }

.workspace { min-width: 0; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 28px 16px;
    background: rgba(26, 29, 36, 0.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    min-width: 0;
}
.topbar h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 650;
    letter-spacing: -0.03em;
}
.topbar .grow .muted {
    margin-top: 2px;
    font-size: 13px;
}
.topbar .grow { flex: 1; min-width: 0; }
.topbar .grow h1,
.topbar .grow .muted {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.admin-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    background: var(--cream);
    color: var(--ink);
    border: 1px solid var(--cream-soft);
    border-radius: 999px;
    padding: 6px 12px 6px 6px;
    max-width: min(240px, 40vw);
}
.admin-chip .hidden-note { color: #6F685C; }
.admin-chip > div:last-child { min-width: 0; }
.admin-chip strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.avatar.sm { width: 32px; height: 32px; border-radius: 50%; font-size: 13px; box-shadow: none; }
.main { padding: 22px 28px 56px; }
.icon-btn {
    display: none;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--elevated);
    color: var(--text);
    cursor: pointer;
}
.nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 20;
}

.muted { color: var(--muted); }
.stack > * + * { margin-top: 16px; }
.page-intro { margin: 0 0 16px; color: var(--muted); }

.grid { display: grid; gap: 18px; min-width: 0; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid > * { min-width: 0; }

.card, .stat, form.card, .wallet-card {
    min-width: 0;
    background: #21252D;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0;
    box-shadow: none;
    transition: border-color var(--ease);
    overflow: hidden;
}
.card, form.card { padding: 0 0 4px; }
.card > h3:first-child,
form.card > h3:first-child {
    margin: 0;
    padding: 14px 18px;
    font-size: 13px;
    font-weight: 650;
    letter-spacing: 0.04em;
    color: var(--cream);
    background: #1B1F26;
    border-bottom: 1px solid var(--line);
}
.card:not(form):not(.form-card) > :not(h3):not(.table-wrap):not(.pagination) {
    margin-inline: 18px;
}
.card > .table-wrap { margin: 0; }
.card > p,
.card > .muted,
.card > .stack,
.card > pre,
.card > .empty,
.card > .actions {
    margin-top: 14px;
}
.card > .actions { margin-bottom: 14px; }
.card:hover, .stat:hover { border-color: var(--line-strong); }
form.card { padding: 16px 18px 18px; }
form.card > h3:first-child { margin: -16px -18px 14px; }
form.card > h3:not(:first-child) {
    margin: 22px 0 8px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 14px;
    color: var(--cream);
}
form.card > button,
form.card > .btn { margin-top: 16px; }

.stat {
    position: relative;
    overflow: hidden;
    padding: 16px 18px 14px;
    background:
        linear-gradient(180deg, #262B34 0%, #21252D 100%);
}
.stat .accent {
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--cream);
}
.stat span, .kicker {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
}
.stat strong {
    display: inline-block;
    font-size: 28px;
    margin-top: 10px;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
}
.stat a {
    display: inline-flex;
    margin-top: 14px;
    font-size: 12px;
    font-weight: 650;
    color: var(--cream);
}

.wallet-card {
    position: relative;
    min-height: 128px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 18px;
    padding-inline-start: 20px;
    background: #1C1F26;
    border-color: var(--line-strong);
}
.wallet-card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 16px;
    bottom: 16px;
    width: 2px;
    background: var(--cream);
}
.wallet-card .amount {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    color: var(--cream);
}
.wallet-card .currency-pill {
    align-self: flex-start;
    border: 1px solid var(--cream-soft);
    background: var(--cream);
    color: var(--ink);
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
}
.wallet-card.syp .currency-pill {
    background: transparent;
    color: var(--cream);
}

.shortcut {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text);
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    padding: 12px 0;
    transition: color var(--ease);
}
.stack > .shortcut:first-child { padding-top: 4px; }
.stack > .shortcut:last-child { border-bottom: 0; padding-bottom: 8px; }
.shortcut:hover {
    background: transparent;
    border-color: var(--line);
    color: var(--cream);
    transform: none;
}
.shortcut:hover span { color: #9C9588; }
.shortcut strong { font-size: 14px; }
.shortcut span { color: var(--muted); font-size: 12px; }

h3 { margin: 0 0 12px; font-size: 15px; font-weight: 650; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 0;
    direction: rtl;
}
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
    direction: rtl;
}
.table-wrap > table { min-width: 100%; }
th, td {
    text-align: start;
    padding: 13px 18px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
th {
    font-size: 11px;
    color: #9C9588;
    font-weight: 700;
    letter-spacing: 0.08em;
    white-space: nowrap;
    background: #181C22;
}
tbody td { background: transparent; }
tbody tr:last-child td { border-bottom: 0; }
td.mono, td:has(.mono) { font-variant-numeric: tabular-nums; }
.cell-inline {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    vertical-align: middle;
    max-width: 100%;
}
td:has(> a.row-link),
td:has(> .btn),
td:has(> .row-actions),
td:has(> form),
th:empty {
    text-align: end;
    width: 1%;
    white-space: nowrap;
}
tbody tr { transition: background var(--ease); }
tbody tr:nth-child(even) td { background: rgba(244, 239, 230, 0.02); }
tbody tr:hover td { background: rgba(244, 239, 230, 0.06); }
td a.row-link { font-weight: 600; }
td .stack > * + * { margin-top: 8px; }
td input:not([type="checkbox"]):not([type="radio"]), td select { min-width: 7rem; }
td.mono { white-space: normal; word-break: break-word; max-width: 28rem; }

.thumb {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border);
    background: var(--elevated);
}
.identity { display: flex; align-items: center; gap: 10px; }
.identity small { display: block; color: var(--muted); }

.btn, button, input[type="submit"] {
    border: 1px solid var(--cream-soft);
    background: var(--cream);
    color: var(--ink);
    border-radius: 12px;
    padding: 10px 16px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 650;
    transition: transform var(--ease), filter var(--ease), background var(--ease), box-shadow var(--ease);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}
.btn:hover, button:hover, input[type="submit"]:hover {
    background: #fffaf2;
    color: var(--ink);
    filter: none;
}
.btn:active, button:active, input[type="submit"]:active { transform: translateY(1px) scale(0.985); }
.btn.secondary, button.secondary {
    background: rgba(244, 239, 230, 0.1);
    color: var(--cream);
    border: 1px solid rgba(244, 239, 230, 0.16);
    box-shadow: none;
}
.btn.secondary:hover, button.secondary:hover {
    background: rgba(244, 239, 230, 0.18);
    color: var(--cream);
}
.btn.danger, button.danger {
    background: #5C3A34;
    color: #F6E6E0;
    border-color: #8A5C52;
    box-shadow: none;
}
.btn.danger:hover, button.danger:hover {
    background: #6B4540;
    color: #F6E6E0;
}
.btn.ghost, button.ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}
.btn.small, button.small { padding: 6px 10px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }

label { display: block; margin: 12px 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
select { color-scheme: dark; }
input, select, textarea {
    width: 100%;
    border: 1px solid rgba(244, 239, 230, 0.14);
    background: #1E222A;
    border-radius: 12px;
    padding: 11px 12px;
    font-family: inherit;
    color: var(--text);
    transition: border-color var(--ease), box-shadow var(--ease);
}
input::placeholder, textarea::placeholder { color: #6e7480; }
input:hover, select:hover, textarea:hover { border-color: #3c4352; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.18);
}
textarea { min-height: 96px; resize: vertical; }
select option { background: #171A21; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--primary); padding: 0; }
input[type="file"] { padding: 8px; background: var(--elevated); }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
    background: #1B1F26;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 18px;
}
.filters input, .filters select, .filters .select-wrap { min-width: 180px; width: auto; flex: 1; }
.filters label { margin: 0; }
.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-weight: 500; margin: 10px 0; }
.field { position: relative; }
.field .reveal {
    position: absolute;
    inset-inline-start: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    color: var(--muted);
    border: 0;
    box-shadow: none;
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 600;
}
.field input { padding-inline-start: 72px; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    background: rgba(244, 239, 230, 0.08);
    color: var(--cream);
    border: 1px solid var(--line);
}
.badge.ok { background: rgba(61, 220, 151, 0.12); color: var(--ok); }
.badge.warn { background: rgba(255, 176, 32, 0.14); color: var(--warn); }
.badge.danger { background: rgba(92, 58, 52, 0.55); color: #F0D4CE; }
.badge.info { background: rgba(142, 180, 255, 0.14); color: var(--info); }
.badge.brand { background: rgba(255, 107, 0, 0.16); color: #ffb27a; }

.flash, .errors {
    padding: 12px 14px;
    border-radius: 14px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}
.flash { background: rgba(61, 220, 151, 0.1); color: var(--ok); }
.errors { background: rgba(255, 93, 108, 0.1); color: #ffc1c7; }
.empty {
    padding: 28px 12px;
    text-align: center;
    color: var(--muted);
}

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { box-shadow: none; }
.card > .pagination { margin: 0; padding: 12px 16px; border-top: 1px solid var(--line); }
.pagination { margin-top: 16px; }
.pagination nav, .pagination { display: block; }
.pagination .pagination { display: flex; gap: 6px; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
.page-link {
    display: inline-flex;
    min-width: 36px;
    justify-content: center;
    padding: 7px 10px;
    border-radius: 10px;
    background: var(--elevated);
    color: var(--text);
    border: 1px solid var(--border);
}
.page-item.active .page-link { background: var(--cream); color: var(--ink); border-color: var(--cream-soft); }
.page-item.disabled .page-link { opacity: 0.4; }

.banner-row {
    display: grid;
    grid-template-columns: 92px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.banner-row:last-child { border-bottom: 0; }
.banner-row img { width: 92px; height: 52px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.proof-frame {
    margin-top: 12px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #10131a;
}
.proof-frame img, .proof-frame object { width: 100%; max-height: 360px; object-fit: contain; }
pre.mono, .mono-block {
    background: #1E222A;
    border: 1px solid rgba(244, 239, 230, 0.1);
    border-radius: 12px;
    padding: 12px;
    overflow: auto;
    color: #E6E1D6;
    white-space: pre-wrap;
}
.rule {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: rgba(255, 107, 0, 0.08);
    border: 1px solid rgba(255, 107, 0, 0.28);
    color: #ffd7b8;
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 16px;
}
.actions { display: grid; gap: 12px; }
.hidden-note { font-size: 12px; color: var(--muted); }

@media (max-width: 1100px) {
    .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
    .auth-card { padding: 28px 20px 22px; }
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        z-index: 30;
        top: 0;
        bottom: 0;
        inset-inline-start: 0;
        width: min(300px, 88vw);
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        transform: translateX(105%);
        transition: transform 220ms ease;
        box-shadow: var(--shadow);
        overflow: hidden;
    }
    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open .nav-backdrop { display: block; }
    .icon-btn { display: inline-grid; place-items: center; }
    .grid.cols-3, .grid.cols-2, .grid.cols-4, .link-cards { grid-template-columns: 1fr; }
    .main, .topbar { padding-inline: 16px; }
    .filters input, .filters select, .filters .select-wrap { width: 100%; }
    .banner-row { grid-template-columns: 72px 1fr; }
    .banner-row form { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition: none !important;
        animation: none !important;
    }
}

.select-wrap {
    position: relative;
    width: 100%;
}
.select-wrap select {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    width: 100%;
    height: 100%;
}
.select-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-align: start;
    background: #1E222A;
    color: var(--text);
    border: 1px solid rgba(244, 239, 230, 0.14);
    border-radius: 12px;
    padding: 11px 14px;
    box-shadow: none;
    font-weight: 500;
}
.select-trigger::after {
    content: "";
    width: 8px;
    height: 8px;
    border-inline-end: 1.6px solid var(--cream);
    border-bottom: 1.6px solid var(--cream);
    transform: rotate(45deg);
    margin-top: -4px;
    flex: none;
}
.select-trigger:hover,
.select-trigger:focus-visible {
    background: #242933;
    color: var(--text);
    transform: none;
}
.select-wrap.is-open .select-trigger {
    border-color: var(--cream-soft);
}
.select-menu {
    display: none;
    position: fixed;
    z-index: 60;
    background: #1B1F26;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    padding: 6px;
    overflow: auto;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}
.select-wrap.is-open .select-menu { display: block; }
.select-group {
    padding: 8px 12px 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #9C9588;
}
.select-option {
    width: 100%;
    display: block;
    text-align: start;
    background: transparent;
    color: var(--text);
    border: 0;
    box-shadow: none;
    border-radius: 8px;
    padding: 10px 12px;
    font-weight: 500;
}
.select-option:hover,
.select-option:focus-visible {
    background: rgba(244, 239, 230, 0.1);
    color: var(--cream);
    transform: none;
}
.select-option.is-selected {
    background: var(--cream);
    color: var(--ink);
}
.select-option.is-selected:hover {
    background: #fffaf2;
    color: var(--ink);
}
.filters .select-wrap {
    min-width: 180px;
    width: auto;
    flex: 1;
}

.dialog-root {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 20px;
}
.dialog-root[hidden] { display: none; }
.dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 12, 16, 0.72);
}
.dialog {
    position: relative;
    width: min(440px, 100%);
    background: #21252D;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    padding: 22px 22px 18px;
}
.dialog h3 {
    margin: 0;
    font-size: 16px;
    color: var(--cream);
}
.dialog p {
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.7;
}
.dialog-actions {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    margin-top: 20px;
}
body.dialog-open { overflow: hidden; }
.icon-btn:hover, .icon-btn:focus-visible {
    background: var(--elevated);
    color: var(--text);
    transform: none;
}
.field .reveal:hover {
    background: transparent;
    color: var(--muted);
    transform: none;
}
td .select-wrap { min-width: 7rem; }

/* Form laid out inside a div card (when the <form> wraps several columns) */
.card.form-card { padding: 16px 18px 18px; }
.card.form-card > h3:first-child { margin: -16px -18px 14px; }
.card.form-card > h3:not(:first-child),
.card > h3.sub,
form.card > h3.sub {
    margin: 22px 0 8px;
    padding: 16px 0 0;
    border-top: 1px solid var(--line);
    background: none;
    font-size: 14px;
    color: var(--cream);
}
.card:not(form) > h3.sub { margin-inline: 18px; }

.nav a.nav-sub { padding-inline-start: 30px; font-size: 13px; }
.nav a.nav-sub svg { width: 15px; height: 15px; }
.grow-text { flex: 1; min-width: 200px; }

.facts { display: grid; gap: 0; margin: 12px 18px; }
.facts > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--line);
}
.facts > div:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; text-align: end; min-width: 0; overflow-wrap: anywhere; }
form.card .facts { margin-inline: 0; }

.connection-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.connection-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}
.connection-line .badge { margin-inline-start: 4px; }
.mini-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin-top: 14px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}
.mini-stats > div { background: #1B1F26; padding: 10px 12px; }
.mini-stats strong { display: block; font-size: 20px; color: var(--cream); line-height: 1.2; }
.mini-stats span { font-size: 11px; color: var(--muted); }

details.advanced {
    margin-top: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0 14px;
    background: #1B1F26;
}
details.advanced > summary {
    cursor: pointer;
    padding: 12px 0;
    color: var(--cream);
    font-weight: 600;
    font-size: 13px;
}
details.advanced[open] { padding-bottom: 14px; }

/* Searchable remote combobox (provider game picker) */
.combo { position: relative; }
.combo-input { padding-inline-end: 34px; }
.combo.is-linked .combo-input { border-color: rgba(244, 239, 230, 0.4); }
.combo-menu {
    position: absolute;
    z-index: 40;
    inset-inline: 0;
    top: calc(100% + 6px);
    max-height: 320px;
    overflow: auto;
    background: #1B1F26;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}
.combo-option {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-align: start;
    background: transparent;
    color: var(--text);
    border: 0;
    box-shadow: none;
    border-radius: 8px;
    padding: 9px 12px;
    font-weight: 500;
}
.combo-option small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.combo-option:hover, .combo-option.is-active {
    background: rgba(244, 239, 230, 0.1);
    color: var(--cream);
    transform: none;
}
.combo-option.is-selected { background: var(--cream); color: var(--ink); }
.combo-option.is-selected small { color: #5C554A; }
.combo-empty { padding: 12px; color: var(--muted); font-size: 13px; }

/* Provider product picker (add package) */
.provider-picker {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #1B1F26;
    padding: 12px;
}
.provider-picker[hidden] { display: none; }
.picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.picker-head strong { color: var(--cream); font-size: 14px; }
.picker-head input { max-width: 180px; padding: 8px 10px; }
.picker-list {
    display: grid;
    gap: 6px;
    max-height: 380px;
    overflow: auto;
    padding-inline-end: 2px;
    margin-bottom: 10px;
}
.picker-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    width: 100%;
    text-align: start;
    background: #21252D;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: none;
    font-weight: 500;
}
.picker-picked {
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid var(--cream);
    border-radius: 10px;
    background: rgba(244, 239, 230, 0.08);
    color: var(--cream);
    font-size: 13px;
    line-height: 1.7;
}
.picker-picked[hidden] { display: none; }
.picker-item:hover,
.picker-item:active { border-color: var(--line-strong); background: #262B34; color: var(--text); transform: none; }
.picker-item.is-selected { border-color: var(--cream); background: rgba(244, 239, 230, 0.14); box-shadow: inset 3px 0 0 var(--cream); }
.picker-item.is-disabled { opacity: 0.55; }
.picker-item .pi-name { font-weight: 600; }
.picker-item .pi-price { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--cream); }
.picker-item .pi-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; font-size: 11px; color: var(--muted); }
.picker-item .pi-meta .badge { padding: 2px 7px; font-size: 10.5px; }
.product-summary .facts { margin-inline: 18px; }
[data-locked] { opacity: 0.7; pointer-events: none; }

.bulk-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 14px;
    padding: 0 0 4px;
}
.bulk-bar .bulk-field { flex: 1; min-width: 220px; }
.bulk-bar .bulk-field.narrow { flex: 0 0 150px; min-width: 140px; }
.bulk-bar .check { margin: 0 0 10px; }
.bulk-bar button { margin-bottom: 2px; }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
form.card > .table-wrap { margin: 12px -18px -18px; border-top: 1px solid var(--line); }

.row-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}
.row-actions form { margin: 0; }
.row-actions .btn, .row-actions button { white-space: nowrap; min-width: 64px; text-align: center; }
.row-actions .discount-percent {
    width: 88px;
    min-width: 88px;
    padding: 6px 10px;
}

.product-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}
.product-head .identity strong { font-size: 18px; color: var(--cream); }
.product-head .connection-meta { margin-top: 8px; }
.thumb.lg { width: 56px; height: 56px; border-radius: 14px; }
.mini-stats.wide { margin: 0 0 14px; }

.packages-table td { vertical-align: middle; }
.packages-table .cell-sub { display: block; margin-top: 4px; font-size: 12px; white-space: normal; }
.packages-table .num { white-space: nowrap; }
.packages-table td:first-child { min-width: 130px; }
.packages-table td:first-child strong { white-space: nowrap; }
.packages-table th, .packages-table td { padding-inline: 10px; }
.packages-table .price { color: var(--cream); font-size: 15px; }
.packages-table .price small { color: var(--muted); font-weight: 500; }
.packages-table tr.is-muted td:not(:last-child) { opacity: 0.62; }
.table-note { margin: 12px 0 0; }

.page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.link-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}
.link-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
    box-shadow: none;
}
.link-card strong { font-size: 16px; color: var(--cream); }
.link-card span { color: var(--muted); font-size: 13px; }
.link-card:hover { border-color: rgba(244, 239, 230, 0.28); background: var(--elevated); color: var(--text); }
.price-lines { display: grid; gap: 3px; font-size: 12.5px; line-height: 1.45; white-space: normal; min-width: 180px; }
.price-lines .total { color: var(--cream); font-size: 15px; margin-top: 4px; }

.page-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    margin-bottom: 20px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    scrollbar-width: none;
}
.page-tabs a {
    flex: 0 0 auto;
    padding: 9px 16px;
    border-radius: 9px;
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
    transition: background var(--ease), color var(--ease);
}
.page-tabs a:hover { color: var(--text); background: var(--elevated); }
.page-tabs a.active { color: var(--primary-ink); background: var(--primary); }

.api-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.api-toolbar .token-form { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; margin: 0; }
.api-toolbar .token-form input { width: 260px; margin: 0; }
.api-toolbar .btn { white-space: nowrap; }
.token-box {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(34, 197, 94, 0.08);
}
.token-box code { direction: ltr; text-align: left; word-break: break-all; cursor: copy; }
.swagger-frame {
    display: block;
    width: 100%;
    min-height: 640px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
}
