@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

:root {
    --ink: #0a0b0c;
    --ink-raised: #121316;
    --surface: #16181b;
    --surface-raised: #1c1e22;
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.17);
    --text: #eef0f1;
    --text-muted: #8d9096;
    --input-bg: #121316;
    --input-border: rgba(255, 255, 255, 0.15);

    --accent: #c9922f;
    --accent-soft: rgba(201, 146, 47, 0.14);
    --accent-contrast: #191204;
    --money: var(--accent);
    --success: #4f9d52;
    --success-soft: rgba(79, 157, 82, 0.14);
    --danger: #c1503f;
    --danger-soft: rgba(193, 80, 63, 0.14);
    --warning: #b98a2e;
    --warning-soft: rgba(185, 138, 46, 0.14);
    --neutral: #82858c;
    --neutral-soft: rgba(130, 133, 140, 0.14);

    --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.55);
    --shadow-sm: 0 8px 24px -12px rgba(0, 0, 0, 0.45);
    --header-bg: rgba(10, 11, 12, 0.88);

    --font-ui: 'Vazirmatn', 'Segoe UI', ui-sans-serif, system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

    --radius: 0.55rem;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

body.light-theme {
    --ink: #f2f1ec;
    --ink-raised: #ffffff;
    --surface: #ffffff;
    --surface-raised: #fbfaf7;
    --border: rgba(20, 20, 18, 0.11);
    --border-strong: rgba(20, 20, 18, 0.20);
    --text: #17181a;
    --text-muted: #63666d;
    --input-bg: #ffffff;
    --input-border: rgba(20, 20, 18, 0.18);

    --accent: #96631a;
    --accent-soft: rgba(150, 99, 26, 0.10);
    --accent-contrast: #fff8ec;
    --success: #2f7a34;
    --success-soft: rgba(47, 122, 52, 0.10);
    --danger: #a83f30;
    --danger-soft: rgba(168, 63, 48, 0.10);
    --warning: #8f6a1f;
    --warning-soft: rgba(143, 106, 31, 0.10);
    --neutral: #6b6e75;
    --neutral-soft: rgba(107, 110, 117, 0.10);

    --shadow: 0 16px 40px -18px rgba(23, 24, 26, 0.16);
    --shadow-sm: 0 6px 18px -10px rgba(23, 24, 26, 0.12);
    --header-bg: rgba(242, 241, 236, 0.92);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

* { font-family: var(--font-ui); box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    background: var(--ink);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    transition: background 0.35s ease, color 0.35s ease;
    overflow-x: hidden;
}

/* ---------- themed scrollbars: window + every scrollable panel, both themes ---------- */

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background-color: var(--border-strong);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: background-color 0.15s ease;
}
::-webkit-scrollbar-thumb:hover {
    background-color: var(--accent);
}
::-webkit-scrollbar-corner {
    background: transparent;
}

/* ---------- ambient background: a faint ledger grid, nothing else ---------- */

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.55;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 55%);
    mask-image: linear-gradient(to bottom, #000 0%, transparent 55%);
}

/* ---------- ambient glow field: drifting accent-hued light behind the
   landing page, so scrolled-past sections read as part of one considered
   scene instead of flat empty space between cards ---------- */

.glow-field {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(58px);
    opacity: 0.85;
    background: radial-gradient(circle, color-mix(in srgb, var(--accent) 75%, transparent) 0%, transparent 70%);
    animation: orbDrift 22s ease-in-out infinite alternate;
}
.glow-orb-1 { width: 26rem; height: 26rem; top: -6rem; inset-inline-end: -8rem; animation-duration: 26s; }
.glow-orb-2 { width: 20rem; height: 20rem; top: 34rem; inset-inline-start: -6rem; animation-duration: 19s; animation-delay: -6s; }
.glow-orb-3 { width: 22rem; height: 22rem; top: 66rem; inset-inline-end: -4rem; animation-duration: 24s; animation-delay: -11s; }
@keyframes orbDrift {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-2.5rem, 3rem) scale(1.12); }
}

/* ---------- header / nav ---------- */

.site-header {
    position: sticky;
    top: 0;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    box-shadow: inset 0 -1px 0 0 transparent;
}
.site-header::before {
    content: "";
    display: block;
    height: 2px;
    background: var(--accent);
}

.nav-link {
    position: relative;
    padding: 0.55rem 0.9rem;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}
.nav-link:hover { background: var(--surface); color: var(--text); }

.nav-link-mobile {
    padding: 0.8rem 0.9rem;
    border-radius: var(--radius);
    color: var(--text);
    font-weight: 500;
}
.nav-link-mobile:active { background: var(--surface); }

.icon-btn {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text);
    transition: background 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 1.1rem; height: 1.1rem; }

/* ---------- surfaces: flat panels, no blur, no glass ---------- */

.glass-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s ease, transform 0.2s var(--ease), box-shadow 0.2s ease;
}

.glass-card-strong {
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

a.glass-card:hover, a.glass-card-strong:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

@media (min-width: 640px) {
    .glass-card, .glass-card-strong { border-radius: 0.7rem; }
}

/* a panel with a leading accent rail — used sparingly, for the one thing on a screen that matters most */
.rail-card {
    border-inline-start: 3px solid var(--accent);
}

/* ---------- form controls ---------- */

.field-input {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text);
    border-radius: 0.5rem;
    padding: 0.7rem 1rem;
    width: 100%;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-input::placeholder { color: var(--text-muted); }
.field-input:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-gradient {
    position: relative;
    background: var(--accent);
    color: var(--accent-contrast);
    border-radius: 0.5rem;
    padding: 0.8rem 1.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    min-height: 2.75rem;
    transition: filter 0.15s ease, transform 0.15s var(--ease);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
}
.btn-gradient:hover { filter: brightness(1.1); }
.btn-gradient:active { transform: scale(0.98); }
.btn-gradient:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }

.btn-danger {
    position: relative;
    background: var(--danger);
    color: #fff;
    border-radius: 0.5rem;
    padding: 0.8rem 1.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    min-height: 2.75rem;
    transition: filter 0.15s ease, transform 0.15s var(--ease);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
}
.btn-danger:hover { filter: brightness(1.1); }
.btn-danger:active { transform: scale(0.98); }
.btn-danger:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text);
    border-radius: 0.5rem;
    padding: 0.75rem 1.4rem;
    min-height: 2.75rem;
    font-weight: 500;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s var(--ease);
    white-space: nowrap;
}
.btn-ghost:hover { background: var(--surface); border-color: var(--accent); }
.btn-ghost:active { transform: scale(0.98); }
.btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- status / feedback ---------- */

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.85rem;
    border-radius: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}
/* the class's own display:inline-flex otherwise beats the browser's default
   [hidden] { display: none } rule (author CSS always wins over the
   user-agent stylesheet, even at equal specificity) -- without this, a
   status-pill toggled via the hidden attribute never actually hides. */
.status-pill[hidden] { display: none; }
.status-pill svg { width: 0.85em; height: 0.85em; flex-shrink: 0; }
.status-pending,
.status-awaiting_payment,
.status-payment_submitted { background: var(--warning-soft); color: var(--warning); }
.status-approved { background: var(--success-soft); color: var(--success); }
.status-rejected,
.status-expired { background: var(--danger-soft); color: var(--danger); }
.status-cancelled { background: var(--neutral-soft); color: var(--neutral); }
.status-open { background: var(--warning-soft); color: var(--warning); }
.status-answered { background: var(--success-soft); color: var(--success); }
.status-closed { background: var(--neutral-soft); color: var(--neutral); }

.flash-box {
    border-radius: 0.5rem;
    padding: 0.85rem 1.1rem;
    font-size: 0.9rem;
    line-height: 1.7;
    border: 1px solid;
    word-break: break-word;
    animation: fadeInUp 0.3s var(--ease);
}
.flash-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.flash-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 35%, transparent); color: var(--success); }
.flash-neutral { background: var(--neutral-soft); border-color: color-mix(in srgb, var(--neutral) 35%, transparent); color: var(--text-muted); }

.brand-mark {
    color: var(--accent);
    letter-spacing: -0.01em;
}

.money {
    color: var(--money);
    font-family: var(--font-mono);
}

/* ---------- tables ---------- */

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-scroll table { min-width: 640px; }

/* ---------- utility ---------- */

.tabular-nums { font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.font-mono { font-family: var(--font-mono); }

::selection { background: var(--accent-soft); }

@media (max-width: 480px) {
    h1 { font-size: 1.5rem !important; }
}

/* ---------- motion: entrance ---------- */

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.reveal {
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 0.5s var(--ease) forwards;
}
.reveal-1 { animation-delay: 0.05s; }
.reveal-2 { animation-delay: 0.1s; }
.reveal-3 { animation-delay: 0.15s; }
.reveal-4 { animation-delay: 0.2s; }
.reveal-5 { animation-delay: 0.25s; }
.reveal-6 { animation-delay: 0.3s; }

/* ---------- stat tiles: a top rule instead of a glow blob ---------- */

.stat-tile {
    position: relative;
    overflow: hidden;
    border-top: 2px solid var(--accent) !important;
}

/* ---------- hero ---------- */

/* Persian's connected letterforms and stacked marks need more vertical
   room than Tailwind's leading-tight (1.25) gives a large bold headline --
   at 1.25 a wrapped two-line h1 visually crowds into itself. */
.hero-heading {
    line-height: 1.5;
    max-width: 26rem;
}
.hero-lede {
    line-height: 1.9;
}

.section-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.01em;
}
.section-eyebrow::before {
    content: "";
    width: 1.1rem;
    height: 1px;
    background: var(--accent);
}

.step-index {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--accent);
    letter-spacing: 0.04em;
}

/* One deliberate scale for every landing section heading, instead of
   text-lg/text-xl picked ad hoc per section. */
.section-heading {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.4;
}
@media (min-width: 640px) {
    .section-heading { font-size: 1.75rem; }
}

.brand-mark-shine {
    color: var(--accent);
    background: linear-gradient(100deg,
        var(--accent) 30%,
        color-mix(in srgb, var(--accent) 55%, #fff) 50%,
        var(--accent) 70%);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shineSweep 5s ease-in-out infinite;
}
@keyframes shineSweep {
    0%   { background-position: 200% 0; }
    100% { background-position: -20% 0; }
}

.btn-hero {
    animation: heroPulse 2.6s ease-in-out infinite;
}
.btn-hero:hover { animation-play-state: paused; }
@keyframes heroPulse {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
    50%      { box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent) 0%, transparent); }
}

.feature-card {
    position: relative;
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}
.feature-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 20px 45px -22px color-mix(in srgb, var(--accent) 45%, transparent), var(--shadow);
}
.feature-card .icon-tile {
    transition: transform 0.3s var(--ease), background 0.3s var(--ease);
}
.feature-card:hover .icon-tile {
    transform: scale(1.1) rotate(-6deg);
    background: var(--accent);
    color: var(--accent-contrast);
}

/* ---------- live stat strip: a single unified band instead of floating tiles ---------- */

.stat-band {
    display: flex;
    align-items: stretch;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0;
    border-radius: 1rem;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.stat-band-item {
    flex: 1 1 12rem;
    padding: 1.5rem 1.25rem;
    text-align: center;
    position: relative;
}
.stat-band-item + .stat-band-item::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 15%;
    bottom: 15%;
    width: 1px;
    background: var(--border);
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--text-muted);
}

.protocol-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    border-radius: 0.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    transition: border-color 0.2s ease, transform 0.2s var(--ease);
}
.protocol-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.protocol-chip svg { color: var(--accent); width: 1.1rem; height: 1.1rem; flex-shrink: 0; }

/* ---------- captcha challenge chip (login / admin login / signup) ---------- */

.captcha-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}
.captcha-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.85rem;
    border-radius: 0.5rem;
    background: var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    color: var(--accent);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.9rem;
}
.pulse-dot {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 999px;
    background: var(--success);
    box-shadow: 0 0 0 0 rgba(79, 157, 82, 0.6);
    animation: pulseDot 2s infinite;
    flex-shrink: 0;
}
@keyframes pulseDot {
    0%   { box-shadow: 0 0 0 0 rgba(79, 157, 82, 0.55); }
    70%  { box-shadow: 0 0 0 7px rgba(79, 157, 82, 0); }
    100% { box-shadow: 0 0 0 0 rgba(79, 157, 82, 0); }
}

.rate-ticker {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1.1rem;
    border-radius: 0.4rem;
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
}

/* ---------- feature / icon tiles ---------- */

.icon-tile {
    width: 2.6rem;
    height: 2.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    color: var(--accent);
    flex-shrink: 0;
}
.icon-tile svg { width: 1.3rem; height: 1.3rem; }

/* ---------- progress ring (payment countdown) ---------- */

.ring-wrap { position: relative; width: 6.5rem; height: 6.5rem; margin: 0 auto; }
.ring-wrap svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring-track { fill: none; stroke: var(--border-strong); stroke-width: 6; }
.ring-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}
.ring-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.05rem;
}

/* ---------- payment method picker ---------- */

.crypto-icon-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.crypto-icon-wrap svg { display: block; }
.crypto-icon-badge {
    position: absolute;
    bottom: -2px;
    inset-inline-end: -2px;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 50%;
    border: 2px solid var(--surface-raised);
}

/* Flexbox (not grid) is deliberate: every card is a fixed size regardless
   of how many payment methods are shown, and the row centers itself and
   wraps gracefully on narrow screens -- one card never stretches to fill
   the whole width, and a wrapped row never leaves an off-center gap next
   to a lone item, since flex-wrap centers each row's own content. */
.payment-method-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.65rem;
}
.payment-method-btn {
    flex: 0 0 6.25rem;
    width: 6.25rem;
    min-height: 5.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 0.5rem;
    border: 1px solid var(--border-strong);
    border-radius: 0.65rem;
    background: var(--surface);
    text-align: center;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s var(--ease);
}
.payment-method-btn:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.payment-method-btn:active { transform: scale(0.98); }
.payment-method-btn .payment-method-btn-label {
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text);
}

.payment-method-settings-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem;
}

/* ---------- usage bar ---------- */

.usage-bar-track {
    height: 0.5rem;
    border-radius: 999px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    overflow: hidden;
}
.usage-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--accent);
    transition: width 0.6s var(--ease);
}

/* ---------- tabs ---------- */

.tab-btn { transition: all 0.2s var(--ease); }

/* ---------- misc ---------- */

.hairline { border-color: var(--border); }
.hover-lift { transition: transform 0.2s var(--ease), box-shadow 0.2s ease; }
.hover-lift:hover { transform: translateY(-1px); }

code, .code-chip {
    font-family: var(--font-mono);
}

.copy-ok { color: var(--success) !important; border-color: color-mix(in srgb, var(--success) 40%, transparent) !important; }

.wallet-step {
    border-top: 1px dashed var(--border-strong);
    padding-top: 1rem;
}

/* ---------- admin shell: sidebar + content ---------- */

.admin-shell {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: stretch;
}
@media (min-width: 1024px) {
    .admin-shell { flex-direction: row; align-items: flex-start; }
    .admin-sidebar { flex: 0 0 14rem; position: sticky; top: 5rem; }
    .admin-shell > .min-w-0 { flex: 1 1 0%; }
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.85rem;
    border-radius: 0.45rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}
.admin-nav-link svg { width: 1.05rem; height: 1.05rem; flex-shrink: 0; }
.admin-nav-link:hover { background: var(--surface); color: var(--text); }
.admin-nav-link.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* ---------- modal ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay[hidden] { display: none; }
.modal-panel {
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
    border-radius: 0.7rem;
    box-shadow: var(--shadow);
    max-width: 26rem;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    animation: fadeInUp 0.2s var(--ease);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.modal-body { padding: 1.25rem; }

/* ---------- user card (admin users list) ---------- */

.user-card-stat {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.user-card-stat svg { width: 0.9rem; height: 0.9rem; flex-shrink: 0; }

/* ---------- dashboard: main task + secondary summary, real desktop layout ---------- */

.dash-shell {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.dash-main, .dash-side { display: flex; flex-direction: column; gap: 1.5rem; }
@media (min-width: 1024px) {
    .dash-shell { flex-direction: row; align-items: flex-start; }
    .dash-main { flex: 1 1 0%; min-width: 0; }
    .dash-side { flex: 0 0 22rem; }
}

/* ---------- stat strip: a horizontal row of tiles, full width, no column-height mismatch ---------- */

.stat-strip {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
}
@media (min-width: 640px) {
    .stat-strip { grid-template-columns: repeat(var(--stat-strip-cols, 4), 1fr); }
}
.stat-strip-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 2px solid var(--accent);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
}

/* ---------- card grid: lets list pages actually use desktop width ---------- */

.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
}
@media (min-width: 1280px) {
    .card-grid { grid-template-columns: repeat(2, 1fr); align-items: start; }
}

/* ---------- settings-style pages: height-balanced two columns via CSS multi-column ---------- */

.balanced-columns { column-gap: 1.5rem; }
@media (min-width: 1024px) {
    .balanced-columns { column-count: 2; }
}
.balanced-columns > * { break-inside: avoid; margin-bottom: 1.5rem; }

/* ---------- protocol / server toggle cards ---------- */

.proto-select-label { display: block; height: 100%; cursor: pointer; }
.proto-select-label input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.proto-select-card {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    height: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 0.9rem;
    transition: border-color 0.15s var(--ease), background 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.proto-select-label input:checked + .proto-select-card,
.proto-select-card.is-on {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 1px var(--accent) inset;
}
.proto-select-label input:focus-visible + .proto-select-card {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.proto-select-card .name { color: var(--text); }
.select-card-clickable { cursor: pointer; }
.select-card-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- pagination controls ---------- */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    margin-top: 1rem;
}
.pagination-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ---------- live reseller usage bar ---------- */

.usage-bar-track {
    height: 0.4rem;
    border-radius: 999px;
    background: var(--input-bg);
    overflow: hidden;
}
.usage-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 999px;
    transition: width 0.5s var(--ease), background 0.2s var(--ease);
}

/* ---------- honeypot: visible to bots, invisible + unreachable for real users ---------- */

.hp-field {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    opacity: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* ---------- admin sidebar: panel connectivity indicator ---------- */

.panel-health-pill {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.78rem;
}
.panel-health-pill.panel-health-down { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.panel-health-pill.panel-health-down .pulse-dot { background: var(--danger); box-shadow: 0 0 0 0 rgba(193, 80, 63, 0.6); animation: pulseDotDanger 2s infinite; }
.panel-health-pill.panel-health-unknown { color: var(--text-muted); }
.panel-health-pill.panel-health-unknown .pulse-dot { background: var(--neutral); animation: none; box-shadow: none; }
@keyframes pulseDotDanger {
    0%   { box-shadow: 0 0 0 0 rgba(193, 80, 63, 0.55); }
    70%  { box-shadow: 0 0 0 7px rgba(193, 80, 63, 0); }
    100% { box-shadow: 0 0 0 0 rgba(193, 80, 63, 0); }
}

/* ---------- nav unread badge ---------- */

.nav-badge {
    margin-inline-start: auto;
    min-width: 1.3rem;
    height: 1.3rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ---------- support tickets: chat thread ---------- */

.chat-thread {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding: 1rem;
    max-height: 55vh;
    overflow-y: auto;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.chat-bubble {
    max-width: 78%;
    padding: 0.6rem 0.9rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}
.chat-bubble.mine {
    align-self: flex-start;
    background: var(--accent);
    color: var(--accent-contrast);
    border-bottom-right-radius: 0.3rem;
}
.chat-bubble.theirs {
    align-self: flex-end;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-bottom-left-radius: 0.3rem;
}
.chat-bubble-meta {
    display: block;
    font-size: 0.68rem;
    opacity: 0.75;
    margin-top: 0.3rem;
}
.chat-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 2rem 0;
}

.ticket-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.ticket-unread-badge {
    min-width: 1.4rem;
    height: 1.4rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* not in the bundled Tailwind build -- long unbroken free-text (a note with
   no spaces, a long URL/error string) needs this to stay inside its card
   instead of overflowing and causing horizontal scroll on mobile. */
.break-words {
    overflow-wrap: break-word;
    word-break: break-word;
}
