/* HTStore Admin */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('/fonts/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
        U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
        U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('/fonts/inter-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
        U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
        U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ─── Tokens ─── */
:root {
    /* Surfaces — comfortable, modern obsidian/slate dark ramp (no pitch-black glare) */
    --bg: #0e1217;
    --surface: #161b22;
    --surface-2: #1f242e;
    --surface-3: #282f3d;
    --surface-hover: #2d3544;

    /* Lines & Borders */
    --line: #2a313c;
    --line-strong: #3a4352;
    --border-soft: var(--line);

    /* Ink / Typography */
    --ink: #f1f5f9;
    --ink-1: var(--ink);
    --ink-2: #94a3b8;
    --ink-3: #64748b;
    --ink-4: #475569;

    /* Accent & Brand */
    --accent: #6366f1;
    --accent-hi: #818cf8;
    --accent-ghost: rgba(99, 102, 241, 0.14);
    --accent-line: rgba(99, 102, 241, 0.35);
    --primary: var(--accent);

    /* Semantic */
    --ok: #10b981;
    --ok-ghost: rgba(16, 185, 129, 0.14);
    --warn: #f59e0b;
    --warn-ghost: rgba(245, 158, 11, 0.14);
    --bad: #ef4444;
    --bad-ghost: rgba(239, 68, 68, 0.14);
    --danger: var(--bad);

    /* Type */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;

    /* Radius */
    --r-sm: 6px;
    --r-md: 9px;
    --r-lg: 13px;
    --r-xl: 18px;
    --r-pill: 999px;

    /* Space */
    --s1: 4px;
    --s2: 8px;
    --s3: 12px;
    --s4: 16px;
    --s5: 22px;
    --s6: 30px;
    --s7: 44px;

    /* Elevation — smooth natural depth */
    --e1: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.15);
    --e2: 0 4px 16px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.2);
    --e3: 0 20px 50px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);

    --sidebar-w: 236px;
    --topbar-h: 60px;
}

/* ─── Reset ─── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    background: none;
    border: none;
    cursor: pointer;
}

svg {
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Money and counts must align on the decimal down a column. */
.num,
.money,
.stat-value,
.cell-amount {
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' 1;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: var(--r-pill);
    border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--line-strong);
}

/* Visible focus everywhere — this is a money console, not a landing page. */
:focus-visible {
    outline: 2px solid var(--accent-hi);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}

:focus:not(:focus-visible) {
    outline: none;
}

.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;
}

/* ═══ Login ═══ */
.login-wrapper {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--s4);
    background: var(--bg);
    z-index: 100;
}

/* Two offset radial washes give the backdrop depth without an image. */
.login-mesh {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(680px circle at 22% 18%, rgba(109, 94, 252, 0.16), transparent 62%),
        radial-gradient(520px circle at 82% 78%, rgba(52, 211, 153, 0.07), transparent 58%);
    pointer-events: none;
}

.login-card {
    position: relative;
    width: 100%;
    max-width: 384px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    padding: var(--s6);
    box-shadow: var(--e3);
}

.login-brand-logo {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #fff;
    border-radius: var(--r-md);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.02em;
    margin-bottom: var(--s5);
    box-shadow: 0 0 0 1px var(--accent-line), 0 8px 22px rgba(109, 94, 252, 0.3);
}

.login-card h1 {
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: var(--s1);
}

.login-card .subtitle {
    color: var(--ink-3);
    font-size: 13px;
    margin-bottom: var(--s6);
}

.login-error {
    display: none;
    align-items: center;
    gap: var(--s2);
    background: var(--bad-ghost);
    border: 1px solid rgba(248, 113, 113, 0.28);
    color: #fca5a5;
    padding: var(--s3);
    border-radius: var(--r-md);
    font-size: 13px;
    margin-bottom: var(--s4);
}

.login-error.visible {
    display: flex;
}

.login-foot {
    margin-top: var(--s5);
    padding-top: var(--s4);
    border-top: 1px solid var(--line);
    font-size: 11.5px;
    color: var(--ink-4);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ═══ Layout ═══ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
}

.sidebar-brand {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    padding: 0 var(--s4);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.brand-logo-container {
    display: flex;
    align-items: center;
    gap: var(--s3);
}

.brand-logo-square {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #fff;
    border-radius: var(--r-sm);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.sidebar-brand-content h2 {
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.brand-sub {
    font-size: 10.5px;
    color: var(--ink-4);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 500;
}

.sidebar-nav {
    list-style: none;
    padding: var(--s3) var(--s2);
    flex: 1;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--ink-4);
    padding: var(--s4) var(--s3) var(--s2);
}

.sidebar-nav li:first-child .nav-section-label {
    padding-top: var(--s1);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--s3);
    padding: 8px var(--s3);
    border-radius: var(--r-sm);
    color: var(--ink-2);
    font-size: 13.5px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    position: relative;
    transition: background 0.12s ease, color 0.12s ease;
}

.nav-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.72;
}

.nav-item:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.nav-item:hover svg {
    opacity: 1;
}

.nav-item.active {
    background: var(--accent-ghost);
    color: var(--ink);
    font-weight: 500;
}

.nav-item.active svg {
    opacity: 1;
    color: var(--accent-hi);
}

/* Left rail marker — faster to scan than a full-bleed highlight. */
.nav-item.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 17px;
    background: var(--accent-hi);
    border-radius: 0 2px 2px 0;
}

.nav-badge {
    margin-left: auto;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--ink-3);
    background: var(--surface-3);
    padding: 1px 6px;
    border-radius: var(--r-pill);
    font-variant-numeric: tabular-nums;
}

.sidebar-footer {
    padding: var(--s3);
    border-top: 1px solid var(--line);
    flex-shrink: 0;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: var(--s3);
    width: 100%;
    padding: 8px var(--s3);
    border-radius: var(--r-sm);
    color: var(--ink-3);
    font-size: 13px;
    transition: background 0.12s ease, color 0.12s ease;
}

.logout-btn:hover {
    background: var(--bad-ghost);
    color: #fca5a5;
}

.logout-btn svg {
    width: 15px;
    height: 15px;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ═══ Topbar ═══ */
.topbar {
    height: var(--topbar-h);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: var(--s4);
    padding: 0 var(--s5);
    background: rgba(22, 27, 34, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar-title {
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.topbar-search {
    position: relative;
    margin-left: auto;
    width: min(300px, 34vw);
}

.topbar-search svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--ink-4);
    pointer-events: none;
}

.topbar-search input {
    width: 100%;
    height: 32px;
    padding: 0 42px 0 32px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    font-size: 13px;
    color: var(--ink);
    transition: border-color 0.12s ease, background 0.12s ease;
}

.topbar-search input::placeholder {
    color: var(--ink-4);
}

.topbar-search input:focus {
    outline: none;
    border-color: var(--accent-line);
    background: var(--surface-3);
}

.kbd-hint {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--mono);
    font-size: 10.5px;
    color: var(--ink-4);
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 1px 5px;
    pointer-events: none;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--s3);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 500;
    padding: 3px 9px;
    border-radius: var(--r-pill);
    white-space: nowrap;
    background: var(--surface-3);
    color: var(--ink-2);
    border: 1px solid var(--line);
}

.status-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.status-pill.active {
    background: var(--ok-ghost);
    color: var(--ok);
    border-color: rgba(52, 211, 153, 0.24);
}

.status-pill.expired {
    background: var(--bad-ghost);
    color: var(--bad);
    border-color: rgba(248, 113, 113, 0.24);
}

.status-pill.maxed {
    background: var(--warn-ghost);
    color: var(--warn);
    border-color: rgba(251, 191, 36, 0.24);
}

.status-pill.neutral {
    background: var(--surface-3);
    color: var(--ink-3);
}

.status-pill.active .status-dot {
    box-shadow: 0 0 0 3px var(--ok-ghost);
}

/* ═══ Sections ═══ */
.section {
    display: none;
    padding: var(--s5);
    width: 100%;
}

.section.active {
    display: block;
    animation: rise 0.22s ease both;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

.page-header {
    margin-bottom: var(--s5);
}

.page-header h1 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 2px;
}

.page-header p {
    color: var(--ink-3);
    font-size: 13px;
}

/* ═══ Stat cards ═══ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: var(--s3);
    margin-bottom: var(--s5);
}

.stat-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--s4);
    overflow: hidden;
    transition: border-color 0.14s ease, transform 0.14s ease;
}

.stat-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-1px);
}

.stat-head {
    display: flex;
    align-items: center;
    gap: var(--s2);
    margin-bottom: var(--s3);
}

.stat-icon {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: var(--r-sm);
    font-size: 13px;
    flex-shrink: 0;
    background: var(--surface-3);
}

.stat-icon.purple {
    background: var(--accent-ghost);
}

.stat-icon.green {
    background: var(--ok-ghost);
}

.stat-icon.red {
    background: var(--bad-ghost);
}

.stat-icon.amber {
    background: var(--warn-ghost);
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.stat-value {
    font-size: 27px;
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: var(--s2);
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: var(--ink-4);
}

.stat-trend.positive {
    color: var(--ok);
}

.stat-trend.negative {
    color: var(--bad);
}

/* Sparkline strip pinned to the card's bottom edge */
.stat-spark {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 22px;
    margin-top: var(--s3);
    margin-bottom: -2px;
}

.spark-bar {
    flex: 1;
    min-height: 2px;
    background: var(--accent-ghost);
    border-radius: 1px;
    transition: background 0.14s ease;
}

.stat-card:hover .spark-bar {
    background: var(--accent-line);
}

.spark-bar.hot {
    background: var(--accent);
}

/* ═══ Panels ═══ */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
}

.panel+.panel {
    margin-top: var(--s4);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s3);
    padding: var(--s3) var(--s4);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

.panel-header h2 {
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.panel-body {
    padding: var(--s4);
}

.caption {
    font-size: 11.5px;
    color: var(--ink-4);
}

.header-right-actions,
.table-search-bar {
    display: flex;
    align-items: center;
    gap: var(--s2);
    margin-left: auto;
}

/* ═══ Buttons ═══ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    padding: 0 var(--s3);
    border-radius: var(--r-md);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hi);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--ink-2);
    border-color: var(--line);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-hover);
    color: var(--ink);
    border-color: var(--line-strong);
}

.btn-danger {
    background: var(--bad-ghost);
    color: var(--bad);
    border-color: rgba(248, 113, 113, 0.24);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(248, 113, 113, 0.2);
}

.btn-ghost {
    background: transparent;
    color: var(--ink-3);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--surface-2);
    color: var(--ink);
}

.btn-sm {
    height: 27px;
    padding: 0 10px;
    font-size: 12.5px;
}

.btn-block {
    width: 100%;
    height: 38px;
}

/* ═══ Forms ═══ */
.form-group {
    margin-bottom: var(--s4);
}

.form-group label {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink-2);
    margin-bottom: 6px;
}

.form-hint {
    font-size: 11.5px;
    color: var(--ink-4);
    margin-top: 5px;
}

.form-input {
    width: 100%;
    min-height: 36px;
    padding: 8px 11px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    font-size: 13.5px;
    color: var(--ink);
    transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.form-input::placeholder {
    color: var(--ink-4);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface-3);
    box-shadow: 0 0 0 3px var(--accent-ghost);
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
    line-height: 1.55;
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%2374747f' stroke-width='1.5'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 30px;
}

.form-input-sm {
    min-height: 28px;
    padding: 4px 9px;
    font-size: 12.5px;
    width: auto;
    min-width: 180px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s3);
}

/* ═══ Variable Product Variants ═══ */
.variant-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.variant-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.variant-row:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 15%, transparent);
}

.variant-row .variant-index {
    font-size: 10px;
    font-weight: 700;
    color: var(--ink-4);
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.variant-row input[type="text"] {
    flex: 1;
    min-width: 0;
}

.variant-row input[type="number"] {
    width: 90px;
    flex-shrink: 0;
}

.variant-row input {
    padding: 5px 8px;
    font-size: 12.5px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink-1);
    outline: none;
    transition: border-color 0.15s ease;
}

.variant-row input:focus {
    border-color: var(--primary);
}

.btn-remove-variant {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--ink-4);
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
    line-height: 1;
}

.btn-remove-variant:hover {
    background: var(--danger);
    color: #fff;
}

.variant-list-empty {
    text-align: center;
    padding: 16px 8px;
    color: var(--ink-4);
    font-size: 12px;
    font-style: italic;
}

/* ═══ Tables ═══ */
.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--ink-4);
    padding: var(--s3) var(--s4);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    background: var(--surface);
}

.data-table td {
    padding: 11px var(--s4);
    border-bottom: 1px solid var(--line);
    color: var(--ink-2);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.1s ease;
}

.data-table tbody tr:hover {
    background: var(--surface-2);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table td strong {
    color: var(--ink);
    font-weight: 600;
}

.cell-mono {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink-2);
    letter-spacing: -0.01em;
}

.cell-amount {
    font-weight: 600;
    color: var(--ink);
}

.cell-amount.pos {
    color: var(--ok);
}

.cell-amount.neg {
    color: var(--bad);
}

.cell-muted {
    color: var(--ink-4);
}

.cell-truncate {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.action-cell {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.data-table th.col-right,
.data-table td.col-right {
    text-align: right;
}

/* Usage meter for promo consumption */
.usage-meter {
    display: flex;
    align-items: center;
    gap: var(--s2);
    min-width: 108px;
}

.usage-track {
    flex: 1;
    height: 4px;
    background: var(--surface-3);
    border-radius: var(--r-pill);
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background: var(--accent);
    border-radius: var(--r-pill);
    transition: width 0.3s ease;
}

.usage-fill.full {
    background: var(--warn);
}

.usage-text {
    font-size: 11.5px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Inline balance editor — stays on the right edge of a right-aligned column. */
.inline-edit {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
}

.inline-edit-input {
    width: 92px;
    height: 27px;
    padding: 0 8px;
    background: var(--surface-3);
    border: 1px solid var(--accent);
    border-radius: var(--r-sm);
    color: var(--ink);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}

.inline-edit-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-ghost);
}

/* ═══ Empty + loading states ═══ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s3);
    padding: var(--s7) var(--s4);
    text-align: center;
}

.empty-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    font-size: 17px;
}

.empty-state p {
    color: var(--ink-3);
    font-size: 13px;
}

.empty-state .empty-title {
    color: var(--ink);
    font-weight: 600;
    font-size: 13.5px;
}

.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.3s ease infinite;
    border-radius: var(--r-sm);
    height: 11px;
}

@keyframes shimmer {
    from {
        background-position: 100% 50%;
    }

    to {
        background-position: 0 50%;
    }
}

.spinner {
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255, 255, 255, 0.28);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ═══ Modals ═══ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 4, 6, 0.72);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--s4);
    z-index: 200;
}

.modal-overlay.visible {
    display: flex;
    animation: fade 0.15s ease both;
}

@keyframes fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    width: 100%;
    max-width: 448px;
    max-height: calc(100vh - 2 * var(--s5));
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-xl);
    box-shadow: var(--e3);
    animation: pop 0.17s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes pop {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s3);
    padding: var(--s4);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.modal-close {
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    border-radius: var(--r-sm);
    color: var(--ink-3);
    font-size: 19px;
    line-height: 1;
    transition: background 0.12s ease, color 0.12s ease;
}

.modal-close:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.modal-body {
    padding: var(--s4);
    overflow-y: auto;
    flex: 1;
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--s2);
    padding: var(--s3) var(--s4);
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    flex-shrink: 0;
}

.modal-sm {
    max-width: 388px;
}

.confirm-text {
    font-size: 13.5px;
    color: var(--ink-2);
    line-height: 1.6;
}

.confirm-text strong {
    color: var(--ink);
}

.confirm-warning {
    display: flex;
    gap: var(--s3);
    margin-top: var(--s3);
    padding: var(--s3);
    background: var(--bad-ghost);
    border: 1px solid rgba(248, 113, 113, 0.22);
    border-radius: var(--r-md);
    font-size: 12.5px;
    color: #fca5a5;
}

/* ═══ Toasts ═══ */
.toast-container {
    position: fixed;
    bottom: var(--s5);
    right: var(--s5);
    display: flex;
    flex-direction: column;
    gap: var(--s2);
    z-index: 300;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--s3);
    min-width: 232px;
    max-width: 380px;
    padding: 11px var(--s4);
    background: var(--surface-3);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    box-shadow: var(--e2);
    font-size: 13px;
    animation: toast-in 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
    pointer-events: auto;
}

.toast::before {
    content: '';
    width: 3px;
    align-self: stretch;
    border-radius: var(--r-pill);
    background: var(--accent);
    flex-shrink: 0;
}

.toast.ok::before {
    background: var(--ok);
}

.toast.bad::before {
    background: var(--bad);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(16px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.toast.leaving {
    animation: toast-out 0.18s ease both;
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateX(16px);
    }
}

/* ═══ Charts ═══ */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: var(--s4);
    margin-bottom: var(--s4);
}

.chart-box {
    position: relative;
    height: 252px;
}

/* ═══ Broadcast ═══ */
.formatting-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 6px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-bottom: none;
    border-radius: var(--r-md) var(--r-md) 0 0;
}

.formatting-toolbar+.form-input {
    border-radius: 0 0 var(--r-md) var(--r-md);
}

.format-btn {
    height: 25px;
    padding: 0 9px;
    font-size: 12px;
}

.broadcast-result {
    display: none;
    margin-top: var(--s4);
    padding: var(--s3) var(--s4);
    background: var(--ok-ghost);
    border: 1px solid rgba(52, 211, 153, 0.24);
    border-radius: var(--r-md);
    color: var(--ok);
    font-size: 13px;
}

.broadcast-result.visible {
    display: block;
}

.broadcast-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s3);
    margin-top: var(--s2);
    font-size: 11.5px;
    color: var(--ink-4);
}

.char-count {
    font-variant-numeric: tabular-nums;
}

.char-count.over {
    color: var(--bad);
}

/* ═══ Mobile ═══ */
.mobile-toggle {
    display: none;
    width: 34px;
    height: 34px;
    place-items: center;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    color: var(--ink-2);
    flex-shrink: 0;
}

.mobile-toggle svg {
    width: 17px;
    height: 17px;
}

.sidebar-scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(4, 4, 6, 0.6);
    z-index: 45;
}

.sidebar-scrim.visible {
    display: block;
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: var(--e3);
    }

    .sidebar.open {
        transform: none;
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-toggle {
        display: grid;
    }

    .topbar {
        padding: 0 var(--s4);
        gap: var(--s3);
    }

    .topbar-search {
        width: auto;
        flex: 1;
    }

    .kbd-hint {
        display: none;
    }

    .btn-desktop-only {
        display: none;
    }

    .section {
        padding: var(--s4);
    }

    .charts-container {
        grid-template-columns: 1fr;
    }
}

/* Below 680px tables stop being tables: each row becomes a card and every cell
   carries its own label, so nothing depends on a header row that is off-screen. */
@media (max-width: 680px) {
    .data-table thead {
        display: none;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table tr {
        background: var(--surface-2);
        border: 1px solid var(--line);
        border-radius: var(--r-md);
        padding: var(--s3);
        margin-bottom: var(--s2);
    }

    .data-table tr:hover {
        background: var(--surface-2);
    }

    .data-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--s3);
        padding: 5px 0;
        border: none;
        text-align: right;
    }

    .data-table td::before {
        content: attr(data-label);
        font-size: 10.5px;
        font-weight: 600;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--ink-4);
        text-align: left;
        flex-shrink: 0;
    }

    /* Cells holding an empty state or the action row need no label. */
    .data-table td.no-label::before {
        content: none;
    }

    .data-table td.no-label {
        display: block;
    }

    .action-cell {
        justify-content: flex-end;
        padding-top: var(--s2);
    }

    /* A flex container cannot ellipsize its own text, and a card is too narrow
       to truncate usefully anyway — let long values wrap under their label. */
    .data-table td.cell-truncate {
        display: block;
        max-width: none;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        text-align: left;
    }

    .data-table td.cell-truncate::before {
        display: block;
        margin-bottom: 2px;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .stat-value {
        font-size: 23px;
    }

    .toast-container {
        left: var(--s4);
        right: var(--s4);
        bottom: var(--s4);
    }

    .toast {
        min-width: 0;
        max-width: none;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .panel-header {
        align-items: stretch;
        flex-direction: column;
    }

    .header-right-actions,
    .table-search-bar {
        margin-left: 0;
    }

    .form-input-sm {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 420px) {
    .topbar-title {
        display: none;
    }
}

/* ═══ Broadcast Feed & Card Redesign ═══ */
.broadcast-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.broadcast-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 16px 20px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.broadcast-card:hover {
    background: var(--surface-2);
    border-color: var(--line-strong);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}

.broadcast-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.broadcast-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.broadcast-type-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: var(--r-pill);
    letter-spacing: 0.02em;
}

.broadcast-type-pill.stock {
    background: rgba(52, 211, 153, 0.12);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.26);
}

.broadcast-type-pill.announcement {
    background: rgba(109, 94, 252, 0.12);
    color: #a78bfa;
    border: 1px solid rgba(109, 94, 252, 0.26);
}

.broadcast-time-text {
    font-size: 12.5px;
    color: var(--ink-3);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.broadcast-char-badge {
    font-size: 11px;
    color: var(--ink-3);
    background: var(--surface-3);
    padding: 2px 7px;
    border-radius: var(--r-sm);
    font-family: var(--mono);
    border: 1px solid var(--line);
}

.broadcast-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.broadcast-card-actions .btn {
    padding: 4px 10px;
    font-size: 12px;
    height: 30px;
}

.broadcast-card-body {
    margin-bottom: 14px;
}

.broadcast-text-content {
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--ink);
    white-space: pre-wrap;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.broadcast-card-footer {
    border-top: 1px solid var(--line);
    padding-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.broadcast-stats-group {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12.5px;
    flex-wrap: wrap;
}

.broadcast-stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--ink-2);
}

.broadcast-stat-chip strong {
    font-weight: 600;
}

.broadcast-stat-chip.success strong {
    color: var(--ok);
}

.broadcast-stat-chip.failed strong {
    color: var(--bad);
}

.broadcast-stat-chip.total strong {
    color: var(--ink);
}

.broadcast-meter-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.broadcast-progress-bar {
    width: 90px;
    height: 5px;
    background: var(--surface-3);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--line);
}

.broadcast-progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.broadcast-progress-fill.high {
    background: #34d399;
}

.broadcast-progress-fill.medium {
    background: #fbbf24;
}

.broadcast-progress-fill.low {
    background: #ef4444;
}

.broadcast-rate-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    color: var(--ink-3);
}

.broadcast-rate-badge.high {
    color: var(--ok);
    background: var(--ok-ghost);
    border: 1px solid rgba(52, 211, 153, 0.24);
}

.broadcast-rate-badge.medium {
    color: var(--warn);
    background: var(--warn-ghost);
    border: 1px solid rgba(251, 191, 36, 0.24);
}

.broadcast-rate-badge.low {
    color: var(--bad);
    background: var(--bad-ghost);
    border: 1px solid rgba(248, 113, 113, 0.24);
}

.broadcast-view-body {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 16px;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--ink);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 340px;
    overflow-y: auto;
}

.broadcast-view-body blockquote {
    border-left: 3px solid var(--accent);
    margin: 8px 0;
    color: var(--ink-2);
    background: rgba(109, 94, 252, 0.06);
    padding: 8px 12px;
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

.broadcast-view-body code {
    background: var(--surface-3);
    padding: 2px 5px;
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 12.5px;
}

/* ═══ Print ═══ */
@media print {

    .sidebar,
    .topbar,
    .toast-container,
    .action-cell {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    body {
        background: #fff;
        color: #000;
    }

    .panel {
        border-color: #ccc;
    }
}
/* ═══ Anti-Spam Firewall Styles ═══ */
.fw-rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.fw-rule-card {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fw-rule-card:hover {
    border-color: var(--line-strong);
}

.fw-rule-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.fw-icon-pill {
    width: 36px;
    height: 36px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.fw-rule-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.input-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.input-unit input {
    padding-right: 70px !important;
}

.input-unit span {
    position: absolute;
    right: 12px;
    color: var(--ink-3);
    font-size: 13px;
    font-weight: 500;
    pointer-events: none;
    user-select: none;
}

/* Switch Component */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--surface-3);
    border: 1px solid var(--line);
    transition: .25s cubic-bezier(0.4, 0, 0.2, 1);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.switch input:checked + .slider {
    background-color: var(--accent);
    border-color: var(--accent);
}

.switch input:focus + .slider {
    box-shadow: 0 0 1px var(--accent);
}

.switch input:checked + .slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

.fw-countdown-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(255, 69, 58, 0.12);
    color: #ff453a;
    border: 1px solid rgba(255, 69, 58, 0.25);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.fw-gateway-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    background: var(--surface-3);
    color: var(--ink);
    border: 1px solid var(--line);
    white-space: nowrap;
}

#section-firewall .data-table th,
#section-firewall .data-table td {
    padding: 13px 18px;
}

#section-firewall .data-table th:first-child,
#section-firewall .data-table td:first-child {
    padding-left: 20px;
}

#section-firewall .data-table th:last-child,
#section-firewall .data-table td:last-child {
    padding-right: 20px;
}

/* ─── Vault Stock Pool ─── */
.vault-pool-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(48, 209, 88, 0.12);
    color: #30d158;
    border: 1px solid rgba(48, 209, 88, 0.25);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.vault-pool-badge.empty {
    background: rgba(142, 142, 147, 0.12);
    color: var(--ink-4);
    border-color: rgba(142, 142, 147, 0.2);
}

.vault-preview-container {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
}

.vault-preview-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}

.vault-preview-item:last-child {
    border-bottom: none;
}

.vault-preview-type {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.vault-preview-type.type-key {
    background: rgba(255, 159, 10, 0.12);
    color: #ff9f0a;
}

.vault-preview-type.type-link {
    background: rgba(10, 132, 255, 0.12);
    color: #0a84ff;
}

.vault-preview-type.type-credentials {
    background: rgba(175, 82, 222, 0.12);
    color: #af52de;
}

.vault-preview-masked {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.btn-danger {
    background: rgba(255, 69, 58, 0.12);
    color: #ff453a;
    border: 1px solid rgba(255, 69, 58, 0.2);
}

.btn-danger:hover {
    background: rgba(255, 69, 58, 0.2);
}

.btn-danger:active {
    transform: scale(0.97);
}

#vault-items-input {
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.5;
    resize: vertical;
}

/* ─── Cloudflare Turnstile & Login History Styles ─── */
.turnstile-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 12px 0 16px 0;
}

.filter-pills {
    display: flex;
    gap: 6px;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    padding: 3px;
    border-radius: 9999px;
    border: 1px solid var(--border-soft);
}

.pill-btn {
    background: transparent;
    border: none;
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.pill-btn:hover {
    color: var(--ink-1);
}

.pill-btn.active {
    background: var(--surface-3);
    color: var(--ink-1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.pill-btn span {
    font-size: 11px;
    opacity: 0.8;
}

.device-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--ink-2);
    border: 1px solid var(--border-soft);
}


/* ─── Menu Buttons Manager Styles ─── */
.menu-builder-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1024px) {
    .menu-builder-layout {
        grid-template-columns: 1fr;
    }
}

.menu-rows-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.menu-row-card {
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s ease;
}

.menu-row-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.menu-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 10px;
}

.menu-row-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--ink-1);
}

.row-handle {
    cursor: grab;
    color: var(--ink-3);
    font-size: 14px;
}

.row-count-badge {
    font-size: 11px;
    color: var(--ink-3);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 9999px;
}

.menu-row-actions {
    display: flex;
    gap: 4px;
}

.btn-icon {
    background: var(--surface-3);
    border: 1px solid var(--border-soft);
    color: var(--ink-2);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s ease;
}

.btn-icon:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    color: var(--ink-1);
}

.btn-icon:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-icon-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.4);
}

.menu-row-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.menu-btn-item {
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    padding: 10px 12px;
    flex: 1 1 calc(50% - 10px);
    min-width: 200px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    transition: all 0.15s ease;
}

.menu-btn-item:hover {
    background: var(--surface-3);
    border-color: rgba(0, 102, 204, 0.4);
}

.menu-btn-item.is-hidden {
    opacity: 0.55;
    border-style: dashed;
}

.menu-btn-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.menu-btn-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hidden-pill {
    font-size: 10px;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 4px;
}

.menu-btn-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--ink-3);
}

.menu-btn-meta code {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 4px;
    border-radius: 3px;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-tag {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
}

.tag-action { background: rgba(0, 102, 204, 0.2); color: #2997ff; }
.tag-catalogue { background: rgba(139, 92, 246, 0.2); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.3); }
.tag-link { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.tag-popup { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }

.menu-btn-ctrls {
    display: flex;
    gap: 3px;
}

.btn-icon-sm {
    background: transparent;
    border: 1px solid var(--border-soft);
    color: var(--ink-3);
    width: 22px;
    height: 22px;
    border-radius: 4px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.1s ease;
}

.btn-icon-sm:hover:not(:disabled) {
    background: var(--surface-2);
    color: var(--ink-1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon-sm:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

/* Telegram Preview Box */
.tg-preview-card {
    position: sticky;
    top: 80px;
    background: #17212b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.tg-preview-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 14px;
}

.tg-preview-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #5288c1;
    color: #ffffff;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tg-preview-bot-name {
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
}

.tg-preview-bot-sub {
    font-size: 11px;
    color: #708499;
}

.tg-preview-bubble {
    background: #182533;
    border-radius: 12px;
    padding: 12px;
    color: #ffffff;
    font-size: 13px;
}

.tg-bubble-title {
    font-size: 13px;
    margin-bottom: 4px;
}

.tg-bubble-text {
    font-size: 12px;
    color: #8da4be;
    margin-bottom: 12px;
}

.tg-keyboard-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tg-keyboard-row {
    display: flex;
    gap: 6px;
}

.tg-keyboard-button {
    flex: 1;
    background: #242f3d;
    color: #64b5f6;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    padding: 8px 6px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}



/* ─── Start Message Editor Styles ─── */
.start-msg-editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1024px) {
    .start-msg-editor-layout {
        grid-template-columns: 1fr;
    }
}

.msg-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: var(--surface-2);
    padding: 8px 10px;
    border-radius: var(--r-md);
    border: 1px solid var(--border-soft);
    margin-bottom: 12px;
}

.toolbar-btn {
    background: var(--surface-3);
    border: 1px solid var(--border-soft);
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--ink-1);
    border-color: rgba(255, 255, 255, 0.25);
}

.toolbar-btn.btn-emoji-insert {
    background: rgba(82, 136, 193, 0.15);
    color: #64b5f6;
    border-color: rgba(82, 136, 193, 0.35);
}

.toolbar-btn.btn-emoji-insert:hover {
    background: rgba(82, 136, 193, 0.3);
    color: #ffffff;
}

.start-msg-textarea {
    width: 100%;
    min-height: 260px;
    background: #12151a;
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    color: #e4ecf5;
    font-family: 'JetBrains Mono', 'Fira Code', Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    line-height: 1.6;
    padding: 14px 16px;
    resize: vertical;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.start-msg-textarea:focus {
    outline: none;
    border-color: #5288c1;
    box-shadow: 0 0 0 3px rgba(82, 136, 193, 0.2);
}

.tg-preview-bubble blockquote {
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid #5288c1;
    border-radius: 4px;
    margin: 8px 0;
    padding: 8px 12px;
    font-size: 12px;
    color: #e4ecf5;
}

.tg-preview-bubble blockquote[expandable] {
    border-left-color: #64b5f6;
}

.tg-preview-bubble blockquote[expandable]::after {
    content: ' ⌵';
    float: right;
    color: #708499;
    font-weight: bold;
}

.tg-preview-bubble .tg-custom-emoji {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    background: rgba(82, 136, 193, 0.25);
    color: #64b5f6;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(82, 136, 193, 0.4);
    margin: 0 2px;
}



.tg-keyboard-admin-btn {
    background: #1c2733 !important;
    color: #e57373 !important;
    border-color: rgba(229, 115, 115, 0.2) !important;
}



/* ─── Bot Button Sub-Tabs ─── */
.btn-subtab {
    background: transparent;
    border: 1px solid transparent;
    color: var(--ink-3);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--r-pill);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-subtab:hover {
    color: var(--ink-1);
    background: rgba(255, 255, 255, 0.05);
}

.btn-subtab.active {
    background: var(--surface-3);
    color: var(--ink-1);
    border-color: var(--border-soft);
    font-weight: 600;
}

/* ═══ Shop Sections ═══ */
.section-card {
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition: all 0.2s ease;
}

.section-card:hover {
    border-color: var(--line-strong);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.section-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--surface-3);
    border-bottom: 1px solid var(--border-soft);
    gap: 16px;
    flex-wrap: wrap;
}

.section-card-title-area {
    display: flex;
    align-items: center;
    gap: 14px;
}

.section-card-icon {
    font-size: 26px;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-1);
    border-radius: var(--r-md);
    border: 1px solid var(--border-soft);
    flex-shrink: 0;
}

.section-card-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--ink-1);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.section-badge-main {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.section-badge-id {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    background: var(--surface-1);
    color: var(--ink-3);
    border: 1px solid var(--border-soft);
}

.section-card-desc {
    padding: 10px 20px;
    font-size: 13px;
    color: var(--ink-3);
    border-bottom: 1px solid var(--border-soft);
    background: rgba(255, 255, 255, 0.015);
}

.section-card-body {
    padding: 16px 20px;
}

.section-categories-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-categories-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ink-3);
}

.section-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}

.section-category-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    transition: all 0.15s ease;
    gap: 8px;
}

.section-category-pill:hover {
    border-color: var(--accent);
    background: var(--surface-2);
}

.section-cat-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.section-cat-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section-cat-count {
    font-size: 11.5px;
    color: var(--ink-3);
    margin-top: 1px;
}

.section-empty-cats {
    padding: 24px;
    text-align: center;
    color: var(--ink-3);
    background: var(--surface-1);
    border-radius: var(--r-md);
    border: 1px dashed var(--border-soft);
}


