:root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f5f7fa;
    --border: #e3e8ef;
    --text: #1c2333;
    --muted: #6b7280;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --success: #16a34a;
    --danger: #dc2626;
    --radius: 12px;
    --shadow: 0 10px 30px rgba(16, 18, 32, 0.08);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; font-size: 14px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 20px; }

/* Big white box wrapping post-login page content */
.page-container {
    background: var(--surface);
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 28px 32px;
    margin-bottom: 24px;
    min-height: calc(100vh - 220px);
}

/* User info bar (above header) */
.user-bar {
    width: 100%;
    max-width: 1400px;
    margin: 20px auto 0;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.user-info { display: flex; flex-direction: column; gap: 4px; text-align: left; }
.user-welcome { font-size: 1.05rem; font-weight: 700; font-style: italic; white-space: nowrap; }
.user-balance-row { display: flex; align-items: center; justify-content: flex-start; gap: 12px; font-size: 0.9rem; }
.user-balance { color: var(--muted); }
.user-balance-num { color: var(--muted); }
.user-add-balance { color: var(--primary); text-decoration: none; font-weight: 600; font-size: 0.85rem; }
.user-last-login { font-size: 0.8rem; color: var(--muted); }
.user-last-login-value { white-space: nowrap; }
.user-meta-label { font-size: 0.72rem; font-weight: 700; }
.user-logout { margin: 0; }
.user-actions { display: flex; align-items: center; gap: 8px; }
.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 12px;
    border-radius: 10px;
    white-space: nowrap;
    border: 1px solid rgba(0, 0, 0, 0.06);
    text-decoration: none;
}
.level-crown { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.level-text { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.level-label { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; opacity: 0.85; }
.level-name { font-size: 0.8rem; font-weight: 800; }
.level-1 { background: linear-gradient(135deg, #fdf2e3, #f6d7b0); color: #92400e; }
.level-2 { background: linear-gradient(135deg, #eef2f7, #cfd8e3); color: #334155; }
.level-3 { background: linear-gradient(135deg, #fef3c7, #fcd34d); color: #92400e; }
.level-4 { background: linear-gradient(135deg, #e0e7ff, #c4b5fd); color: #4c1d95; }
.level-settings-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; margin-bottom: 14px; }
.level-settings-row strong { min-width: 140px; padding-bottom: 6px; }
.level-widget-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.level-widget-meta { display: flex; flex-direction: column; gap: 2px; }
.level-steps { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.level-step { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.level-step.current { border-color: var(--primary); background: var(--surface-2); }
.level-step-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.level-step-name { font-weight: 700; min-width: 80px; }
.level-step-info { color: var(--muted); font-size: 0.8rem; }
.v-divider { width: 1px; height: 22px; background: var(--border); flex: none; }
.server-time {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 4px;
    color: var(--muted);
    white-space: nowrap;
}
.server-time svg { flex: none; color: var(--primary); }
.server-time-lines { display: flex; flex-direction: column; line-height: 1.15; font-size: 0.72rem; text-align: left; }
.server-date { color: var(--muted); }
.server-clock { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.server-label { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; color: var(--muted); }
@media (max-width: 640px) {
    .user-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
    .v-divider { display: none; }
    .level-badge, .server-time { order: 10; }
    .user-meta-label { display: block; }
    .user-balance-row { flex-wrap: wrap; row-gap: 2px; }
    .user-balance-num { order: 3; flex-basis: 100%; }
    .user-add-balance { order: 2; }
}
.btn-logout { background: var(--danger); color: #fff; }
.btn-logout:hover { background: #b91c1c; }
.btn-admin { background: var(--primary); color: #fff; }
.btn-admin:hover { background: var(--primary-dark); }
.btn-seller { background: var(--success); color: #fff; }
.btn-seller:hover { background: #15803d; }
.user-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    line-height: 1;
}
.user-actions button.btn { font-family: inherit; }
.user-actions .btn svg { flex: none; display: block; }

/* Header icon buttons (messages / notifications) */
.icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--primary);
    background: transparent;
    text-decoration: none;
    transition: color 0.15s ease, opacity 0.15s ease;
}
.icon-btn:hover { color: var(--primary-dark); }
.nav-cart { position: relative; }
.nav-badge { display: inline-block; min-width: 16px; height: 16px; line-height: 16px; text-align: center; background: var(--danger); color: #fff; border-radius: 999px; font-size: 0.65rem; font-weight: 700; padding: 0 4px; margin-left: 4px; vertical-align: middle; }
.nav-star { color: #f59e0b; font-size: 0.7rem; margin-left: 4px; vertical-align: middle; }
.nav-new { display: inline-block; background: var(--success); color: #fff; font-size: 0.6rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; margin-left: 4px; text-transform: uppercase; letter-spacing: 0.5px; vertical-align: middle; }

.badge-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    box-sizing: border-box;
}

/* Tools page */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 0.72rem; font-weight: 700; }
.tag-free { background: var(--success); color: #fff; }
.result-grid { display: flex; flex-direction: column; gap: 6px; }
.result-row { display: flex; justify-content: space-between; border-bottom: 1px solid var(--border, #e5e7eb); padding: 6px 0; }
.result-key { font-weight: 600; text-transform: capitalize; color: var(--muted); }
.result-val { text-align: right; }
.result-badge { display: inline-block; padding: 10px 22px; border-radius: 8px; font-size: 1.4rem; font-weight: 800; letter-spacing: 1px; }
.result-live { background: rgba(22, 163, 74, 0.15); color: #16a34a; }
.result-die { background: rgba(220, 38, 38, 0.15); color: #dc2626; }
.result-unknown { background: rgba(234, 179, 8, 0.15); color: #b45309; }

/* Notifications */
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border, #e5e7eb); }
.notif:last-child { border-bottom: none; }
.notif-link { display: block; }
.notif-link a { display: flex; align-items: flex-start; gap: 12px; color: inherit; text-decoration: none; }
.notif-link a:hover { color: var(--primary); }
.notif-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; background: var(--primary); }
.notif-order .notif-dot { background: #2563eb; }
.notif-sale .notif-dot, .notif-base_approved .notif-dot, .notif-seller_approved .notif-dot { background: #16a34a; }
.notif-base_rejected .notif-dot { background: #dc2626; }
.notif-base_cancelled .notif-dot { background: #6b7280; }
.notif-base_deleted .notif-dot { background: #dc2626; }
.notif-cards_expired .notif-dot { background: #ea580c; }
.notif-deposit .notif-dot { background: #0d9488; }
.notif-ticket_reply .notif-dot { background: #9333ea; }
.notif-base_submitted .notif-dot, .notif-admin_granted .notif-dot { background: #d97706; }
.notif-body { flex: 1; }
.notif-body p { margin: 0 0 4px; }

/* Rich text pages (FAQ / Rules) — render Quill content like the editor */
.rich-content .ql-container { height: auto; }
.rich-content .ql-container.ql-snow { border: none; }
.rich-content .ql-editor { padding: 0; height: auto; }

/* Header (contained bar, menus from the left) */
.site-header {
    width: 100%;
    max-width: 1400px;
    margin: 12px auto 0;
    background: #f5f7fa;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(16, 18, 32, 0.04);
    padding: 0;
    overflow: hidden;
}
.site-header .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    background: var(--border);
}
.nav a {
    flex: 1 1 25%;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    min-width: 0;
    padding: 0 8px;
    background: #f5f7fa;
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav a:hover { background: #ffffff; color: var(--primary); }
.nav a.active { background: #ffffff; color: var(--text); font-weight: 700; }
.nav a.nav-pill:hover { filter: brightness(1.08); }
.nav a.nav-pill.active { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22); font-weight: 700; }
@media (min-width: 640px) { .nav a { flex-basis: 16.666%; } }
@media (min-width: 900px) { .nav a { flex-basis: 12.5%; } }
@media (min-width: 1280px) { .nav a { flex: 1 1 0; padding: 0 16px; } }

/* Announcement bar (between header and page content) */
.announcement-bar {
    width: 100%;
    max-width: 1400px;
    margin: 8px auto 0;
    padding: 10px 16px 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.5;
}
.announcement-icon { flex: 0 0 auto; font-size: 1.1rem; line-height: 1.5; }
.announcement-content { flex: 1 1 auto; min-width: 0; }
.announcement-content p { margin: 0 0 6px; }
.announcement-content p:last-child { margin-bottom: 0; }
.announcement-content ul, .announcement-content ol { margin: 4px 0 6px; padding-left: 20px; }
.announcement-content a { color: var(--primary); }
.announcement-content h1, .announcement-content h2, .announcement-content h3,
.announcement-content h4, .announcement-content h5, .announcement-content h6 { margin: 6px 0; }

/* Tighten the gap directly below the announcement bar */
.announcement-bar + main.container { padding-top: 8px; }

main.container { flex: 1; padding: 28px 0 40px; }

/* Buttons */
.btn { display: inline-block; border: 1px solid transparent; border-radius: 6px; padding: 5px 10px; font-size: 0.75rem; font-weight: 600; cursor: pointer; text-decoration: none; transition: 0.15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); }
.btn-block { width: 100%; text-align: center; padding-top: 10px; padding-bottom: 10px; }

/* Flash */
.flash { border-radius: 8px; padding: 12px 16px; margin-bottom: 18px; font-weight: 500; transition: opacity 0.4s; }
.flash-success { background: #dcfce7; color: #14532d; border: 1px solid #bbf7d0; }
.flash-error { background: #fee2e2; color: #7f1d1d; border: 1px solid #fecaca; }
.flash.fade-out { opacity: 0; }

/* Auth (landing) */
.auth-wrap { display: flex; justify-content: center; padding: 40px 0; }
.auth-card { background: linear-gradient(180deg, #ffffff 0%, #ffffff 82%, #e2e7ee 100%); box-shadow: var(--shadow); width: 100%; max-width: 920px; min-height: 500px; padding: 24px; display: grid; grid-template-columns: 2fr 3fr; overflow: hidden; }
.auth-switch { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; gap: 3px; margin-bottom: 16px; }
.auth-switch a { padding: 4px 8px; border-radius: 6px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.7rem; }
.auth-switch a.active { background: var(--primary); color: #fff; }

.auth-brand { text-align: center; margin-bottom: 28px; }
.auth-brand h1 { margin: 8px 0 4px; font-size: 1.6rem; color: var(--text); }
.auth-brand p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.auth-footer { margin-top: 20px; color: var(--muted); font-size: 0.85rem; text-align: center; }
.logo-mark { width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; font-size: 1.5rem; font-weight: 800; display: flex; align-items: center; justify-content: center; margin: 0 auto; }

.tabs { display: flex; background: var(--surface-2); border-radius: 10px; padding: 4px; margin-bottom: 22px; }
.tab { flex: 1; background: none; border: none; padding: 10px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-radius: 8px; text-decoration: none; text-align: center; }
.tab.active { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.merged-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.merged-stats span { white-space: nowrap; }

/* Forms */
form label { display: block; margin-bottom: 10px; }
form label > span:first-child { display: block; font-size: 0.7rem; font-weight: 600; margin-bottom: 4px; color: #374151; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
    width: 100%; padding: 5px 7px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 0.8rem; background: #fff; color: var(--text);
}

/* Prevent iOS Safari from auto-zooming when a field is focused: any focusable
   text field must render at 16px or larger. */
@media (max-width: 768px) {
    input[type="text"], input[type="email"], input[type="password"], input[type="number"],
    input[type="search"], input[type="tel"], input[type="url"], select, textarea {
        font-size: 16px;
    }
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }
textarea { resize: vertical; }
.field-err { display: block; color: var(--danger); font-size: 0.7rem; margin-top: 3px; }
.form-error { background: #fee2e2; color: #7f1d1d; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: 0.9rem; }
.form-foot { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 14px; }
.captcha-row { display: flex; gap: 10px; align-items: stretch; }
.captcha-row input { flex: 1; }
.captcha-img { border: 1px solid var(--border); border-radius: 6px; cursor: pointer; background: var(--surface-2); width: 110px; height: 38px; }

/* Page head */
.page-head { margin-bottom: 22px; }
.page-head h1 { margin: 0 0 4px; color: var(--text); }
.page-head p { margin: 0; color: var(--muted); }
.page-head-actions { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.page-head .head-note { font-size: 0.7rem; font-style: italic; font-weight: 400; color: var(--muted); margin-left: 8px; }
.filtered-badge { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 0.65rem; font-style: normal; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; vertical-align: middle; }

/* Cards */
.card { background: var(--surface); border-radius: 0; box-shadow: none; border: 1px solid var(--border); padding: 24px; margin-bottom: 20px; }
.card h2 { margin-top: 0; font-size: 1.15rem; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; font-weight: 600; }

.profile-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 860px) { .profile-grid { grid-template-columns: 1fr 1fr; } .profile-grid .card:first-child { grid-column: 1 / -1; } }

/* News */
.news-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.news-banner {
    color: #b45309;
    background: #fef3c7;
    border: 1px solid #fde68a;
    padding: 14px 20px;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
    border-radius: 8px;
}
.news-card.pinned {
    background: #fff7ed;
}
.pinned-badge {
    display: inline-block;
    background: #f59e0b;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 2px;
    margin-bottom: 6px;
    text-transform: uppercase;
}
.inline-check { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.inline-check input[type="checkbox"] { width: auto; margin: 0; }
.inline-check span { font-weight: 600; color: #374151; }
.category-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--border); }
.category-row:last-child { border-bottom: none; }
.category-row .inline-check { margin-bottom: 0; }
.color-input { width: 46px; height: 34px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.check-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.check-row .inline-check { margin-bottom: 0; }
.news-card { background: var(--surface); border-radius: 8px; box-shadow: none; border: 1px solid var(--border); padding: 22px; min-width: 0; overflow: hidden; }
.news-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 12px; }
.news-card h2 { margin: 0; font-size: 0.95rem; }
.news-card h2 a { color: var(--text); text-decoration: none; }
.news-card h2 a:hover { color: var(--primary); }
.news-card time { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.news-detail { background: var(--surface); border-radius: 0; box-shadow: none; padding: 0; }
.news-detail h1 { margin: 10px 0 6px; }
.news-detail time { color: var(--muted); font-size: 0.85rem; }
.news-body { margin-top: 16px; }
.news-card-body { margin-top: 12px; }

/* News content renders with Quill's own typography so it matches the editor */
.news-body .ql-container,
.news-card-body .ql-container {
    height: auto;
}
.news-body .ql-container.ql-snow,
.news-card-body .ql-container.ql-snow {
    border: none;
}
.news-body .ql-editor,
.news-card-body .ql-editor {
    padding: 0;
    height: auto;
    overflow: visible;
    font-size: 0.9rem;
    cursor: default;
}
.news-body .ql-editor > *,
.news-card-body .ql-editor > * {
    cursor: default;
}
.news-body .ql-editor,
.news-card-body .ql-editor {
    overflow-wrap: break-word;
    word-break: break-word;
}
.news-body .ql-editor img,
.news-body .ql-editor video,
.news-card-body .ql-editor img,
.news-card-body .ql-editor video {
    max-width: 100%;
    height: auto;
}
.news-body .ql-editor table,
.news-card-body .ql-editor table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}
.back-link { color: var(--primary); text-decoration: none; font-size: 0.9rem; }

/* Funds */
.funds-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 700px) { .funds-grid { grid-template-columns: 280px 1fr; } }
.balance-card { text-align: center; }
.balance { font-size: 2.2rem; font-weight: 800; color: var(--primary); }
.balance span { font-size: 1rem; color: var(--muted); font-weight: 600; }
.deposit-box { background: var(--surface-2); border-radius: 10px; padding: 16px; }
.address { display: block; background: #f1f5f9; color: var(--text); border: 1px solid var(--border); padding: 12px; border-radius: 8px; overflow-wrap: anywhere; font-size: 0.85rem; }
.deposit-qr-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.qr-code { width: 160px; height: 160px; flex: none; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.deposit-qr-row .address { flex: 1; min-width: 220px; }
.deposit-countdown { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.countdown-label { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; color: var(--muted); }
.countdown-timer { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--primary); }
.countdown-timer.expired { color: var(--danger, #b91c1c); }
.muted { color: var(--muted); font-size: 0.85rem; }

.table-wrap { overflow-x: auto; }
.table-bordered { border: 1px solid var(--border); border-radius: 8px; }
.table-bordered + .table-bordered { margin-top: 14px; }
.empty-text { font-style: italic; color: var(--muted); font-size: 0.85em; }
.refund-no { font-weight: 700; color: var(--danger); }
.table-fixed { table-layout: fixed; width: 100%; min-width: 1300px; }
.table-fixed.cart-table { min-width: 1100px; }
.table-fixed.bases-table { min-width: 0; }
@media (max-width: 1024px) {
    .table-fixed.bases-table th { font-size: 0.58em; letter-spacing: 0.2px; }
    .table-fixed.bases-table td { font-size: 0.62em; }
    .table-fixed.bases-table th, .table-fixed.bases-table td { padding: 6px 4px; }
}
@media (max-width: 640px) {
    .table-fixed.bases-table { min-width: 820px; }
}
.highlight-first td:first-child { background: var(--surface-2); font-weight: 600; }
.bulk-bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); flex-wrap: wrap; }
.bulk-bar[hidden] { display: none; }
.bulk-bar .row-check { width: auto; margin: 0; }
.btn-success { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn-success:hover { background: #15803d; }
td.action-cell, th.action-cell { padding: 8px 6px; text-align: center; vertical-align: middle; }
.cart-category { margin: 4px 0 8px; font-size: 1rem; font-weight: 700; }
th.check-cell, td.check-cell { padding: 10px 0; text-align: center; vertical-align: middle; }
.cart-checkout-row { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-top: 16px; flex-wrap: wrap; }
.cart-total-line { font-size: 1rem; }
.cart-total-line strong { color: var(--primary); font-size: 1.15rem; }
.cart-summary { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.cart-discount { color: var(--success); }
.cart-discount strong { color: var(--success); }
.cart-actions { display: flex; gap: 10px; margin-top: 8px; }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--surface-2); }
.table-fixed th, .table-fixed td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
td.cell-wrap { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: break-word; word-break: break-word; }
td.cell-sm { font-size: 0.75em; }
td.cell-xs { font-size: 0.68em; }
td.cell-xxs { font-size: 0.6em; }
.head-sm th { font-size: 0.72em; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); }
th:last-child, td:last-child { border-right: none; }
tbody tr:hover { background: var(--surface-2); }
th { background: #eef2ff; color: #4338ca; font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.4px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; }
.status { padding: 3px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-completed { background: #dcfce7; color: #14532d; }
.status-failed { background: #fee2e2; color: #7f1d1d; }
.status-timeout { background: #e2e8f0; color: #475569; }
.status-open { background: #dbeafe; color: #1e40af; }
.status-answered { background: #dcfce7; color: #14532d; }
.status-closed { background: #e5e7eb; color: #374151; }
.status-active { background: #dcfce7; color: #14532d; }
.status-rejected { background: #fee2e2; color: #7f1d1d; }
.status-sold { background: #ede9fe; color: #5b21b6; }
.reject-msg { color: #b91c1c; font-size: 0.8rem; margin-top: 4px; }
.status-parsed { background: #e0f2fe; color: #075985; }
.status-checking { background: #fef3c7; color: #92400e; }
.status-approving { background: #cffafe; color: #155e75; }
.status-cancelled { background: #e2e8f0; color: #475569; }
.status-paid { background: #dcfce7; color: #14532d; }
.status-pending { background: #fef3c7; color: #92400e; }
.check-results { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 16px; }
.check-result-item { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; }
.check-result-item .mono { flex: 1; }
.badge-live { background: #dcfce7; color: #14532d; }
.badge-die { background: #fee2e2; color: #7f1d1d; }
.badge-unknown { background: #e5e7eb; color: #374151; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 20px; padding: 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
.filters label { margin-bottom: 0; }
.filters label > span:first-child { margin-bottom: 3px; }
.filters input, .filters select { min-width: 120px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.page-num, .page-nav { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 6px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text); text-decoration: none; font-size: 0.8rem; font-weight: 600; }
.page-num:hover, .page-nav:hover { background: var(--surface-2); }
.page-num.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-ellipsis { color: var(--muted); padding: 0 2px; }
.catalog-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .catalog-layout { grid-template-columns: 1fr; } }
.catalog-filters { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.filter-section { margin-bottom: 18px; }
.filter-section h3 { margin: 0 0 8px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; color: #374151; }
.filter-section h3 small { font-weight: 500; text-transform: none; color: var(--muted); }
.filter-section select, .filter-section textarea { width: 100%; }
.filter-section textarea { resize: vertical; }
.filter-actions { display: flex; flex-direction: column; gap: 8px; }
.range-field { display: flex; align-items: center; gap: 10px; }
.range-field span { flex: 0 0 32px; font-size: 0.75rem; font-weight: 600; color: #374151; }
.range-field input[type="range"] { flex: 1; padding: 0; }
.range-value { min-width: 40px; font-size: 0.8rem; font-weight: 700; color: var(--primary); }
.cart-countdown { font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.cart-countdown.expired { color: var(--danger); }

/* Horizontal catalog filters (4 columns) */
.catalog-filters-horizontal { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.filters-grid { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 12px; align-items: start; }
.filter-col { display: flex; flex-direction: column; gap: 6px; }
.filter-field { display: flex; flex-direction: column; gap: 2px; }
.filter-field > span { font-size: 0.68rem; font-weight: 600; color: #374151; }
.filter-field > span small { font-weight: 500; color: var(--muted); }
.filter-field select, .filter-field textarea, .filter-field input[type="text"] { width: 100%; }
.filter-field textarea { resize: vertical; }
.check-list { display: flex; flex-direction: column; gap: 2px; font-size: 0.75rem; }
.catalog-filters-horizontal .filter-actions { flex-direction: row; align-items: center; margin-top: 10px; }
@media (max-width: 1100px) { .filters-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .filters-grid { grid-template-columns: 1fr; } }

/* Card brand logos (all rendered at the same size) */
.brand-logo { height: 20px; width: auto; display: inline-block; vertical-align: middle; margin-right: 6px; }

/* Icon-only add-to-cart button */
.cart-add-btn, .cart-remove-btn { display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; }
.cart-add-btn svg, .cart-remove-btn svg { display: block; }

/* Extras check marks */
.extras { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.extra-item { display: inline-block; padding: 1px 5px; border-radius: 4px; background: #f3f4f6; font-size: 0.6rem; color: #374151; white-space: nowrap; }
.extra-item.extra-present { background: #dcfce7; color: #14532d; }
.extra-item.extra-present .check { color: #16a34a; }
.check { font-weight: 700; margin-left: 2px; }
.check-ok { color: var(--success); }
.check-no { color: var(--muted); }

/* Expiry discount flag + before/after price */
.discount-flag { display: inline-block; background: #dc2626; color: #fff; border-radius: 4px; padding: 1px 5px; font-size: 0.68rem; font-weight: 800; margin-right: 6px; }
.price-old { text-decoration: line-through; color: var(--muted); margin-right: 6px; font-size: 0.85rem; }
.price-new { color: var(--success); font-weight: 700; }
.refund-val { font-style: italic; font-size: 0.8rem; color: var(--muted); white-space: nowrap; }

/* Order reveal data */
.reveal-row td { background: #f8fafc; }
.reveal-data { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 0.9rem; padding: 4px 0; }
.reveal-data > div { display: inline-flex; gap: 6px; }
.rd-label { font-weight: 600; color: var(--muted); }

/* Order item cards (vertical key/value layout) */
.order-item-card { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 14px; background: var(--surface); }
.order-item-main { flex: 1 1 0; min-width: 0; }
.order-item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 18px; }
.order-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.order-field-label { font-size: 0.7rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.order-field-value { font-size: 0.92rem; overflow-wrap: anywhere; word-break: break-word; }
.order-item-actions { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; padding-left: 16px; border-left: 1px solid var(--border); }
.order-item-card .reveal-data { margin-top: 12px; border-top: 1px dashed var(--border); padding-top: 12px; }
.refund-timer { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.refund-countdown { font-weight: 700; color: #b45309; font-variant-numeric: tabular-nums; }
.refund-countdown.refund-timeout { color: #dc2626; }
.log-box { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8rem; background: #f8fafc; border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; margin: 0; white-space: pre-wrap; word-break: break-word; }
.badge-test { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 0.66rem; font-weight: 700; background: #fef3c7; color: #b45309; border: 1px solid #fde68a; margin-left: 6px; vertical-align: middle; }
.level-prices-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.level-price-box { flex: 0 0 160px; margin-bottom: 10px; }
.level-price-box > span { margin-bottom: 4px; }
.base-name-suggestion { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Cart reservation rules note */
.reservation-note { font-size: 0.78rem; color: #b45309; background: #fef3c7; border: 1px solid #fde68a; border-radius: 6px; padding: 8px 12px; margin-bottom: 14px; line-height: 1.5; }
.danger-note { font-size: 0.8rem; color: #7f1d1d; background: #fef2f2; border: 1px solid #fecaca; border-radius: 6px; padding: 10px 12px; margin-bottom: 14px; line-height: 1.5; }
.balance-card { background: #ecfdf5; border: 1px solid #a7f3d0; }
.balance-card h2 { color: #047857; }
.stages { display: flex; align-items: center; gap: 18px; margin: 14px 0 18px; flex-wrap: wrap; }
.stage { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.stage-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--border); }
.stage.current { color: var(--primary); }
.stage.current .stage-dot { background: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15); }
.stage.done { color: var(--success); }
.stage.done .stage-dot { background: var(--success); }

/* Page head with action on the right */
.page-head-flex { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* Ticket list filters */
.filter-links { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-links a { padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px; text-decoration: none; color: var(--text); font-size: 0.85rem; }
.filter-links a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Ticket thread */
.ticket-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.ticket-thread { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.ticket-msg { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); }
.ticket-msg.staff { background: #eef2ff; border-color: #c7d2fe; }
.ticket-msg-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; font-size: 0.85rem; }
.ticket-msg-body { color: var(--text); line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; }
.reply-form { margin-top: 4px; }

/* Rules modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(17, 24, 39, 0.55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-overlay[hidden] { display: none; }
.modal { background: #fff; border-radius: 12px; padding: 26px; max-width: 520px; width: 100%; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3); }
.modal h2 { margin: 0 0 12px; }
.base-actions { white-space: nowrap; text-align: center; }
.base-actions .icon-btn { border: none; padding: 0; cursor: pointer; margin: 0 3px; vertical-align: middle; }
.sold-filter { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; align-items: flex-end; }
.sold-filter .filter-field { flex: 1 1 160px; margin: 0; }
.sold-row.refunded-row { background: #fef2f2; }
.sold-row.refunded-row td { color: #7f1d1d; }
.rules-list { margin: 0 0 16px; padding-left: 20px; color: #374151; line-height: 1.6; }
.rules-list li { margin-bottom: 6px; }
.countries-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; max-height: 380px; overflow-y: auto; margin-bottom: 16px; }
.country-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.85rem; }
.country-code { font-weight: 700; color: var(--primary); min-width: 30px; }
.upload-hint { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.upload-hint p { margin: 0; }

.empty { color: var(--muted); padding: 20px 0; text-align: center; }

.error-page { background: var(--surface); border-radius: 0; box-shadow: var(--shadow); padding: 48px; text-align: center; }
.error-page h1 { font-size: 3rem; margin: 0; }

/* Footer */
.page-footer { color: var(--muted); text-align: center; font-size: 0.85rem; padding: 16px 0; }

/* Admin */
.admin-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.admin-nav a { color: var(--text); text-decoration: none; padding: 8px 14px; border-radius: 8px; background: #ffffff; border: 1px solid var(--border); font-weight: 500; }
.admin-nav a:hover { background: var(--surface-2); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { text-align: center; }
.stat-num { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-label { color: var(--muted); }

.user-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.user-meta { flex: 1 1 240px; display: flex; flex-direction: column; gap: 2px; }
.row-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.row-form label.inline { display: flex; flex-direction: column; margin: 0; }
.row-form label.inline span { font-size: 0.8rem; font-weight: 600; color: #374151; margin-bottom: 4px; }
.row-form select, .row-form input[type="number"] { width: auto; min-width: 90px; }

.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-light { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-light:hover { background: var(--border); }

.badge { padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
.badge-admin { background: #ede9fe; color: #5b21b6; }
.badge-user { background: #e0f2fe; color: #075985; }
.badge-seller { background: #dcfce7; color: #14532d; }

/* Ads (admin list) */
.ads-list { display: flex; flex-direction: column; gap: 14px; }
.ad-item { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; flex-wrap: wrap; }
.ad-thumb { height: 52px; width: auto; max-width: 200px; object-fit: contain; background: var(--surface-2); border-radius: 6px; border: 1px solid var(--border); }
.ad-info { flex: 1 1 200px; display: flex; flex-direction: column; gap: 2px; }
.ad-actions { display: flex; gap: 8px; }

/* Login: two-column white card (form + ads) */
.auth-page { display: flex; flex-direction: column; align-items: center; padding: 40px 0; }
.auth-form { padding: 34px 32px; }
.ads-sidebar { display: flex; flex-direction: column; gap: 18px; padding: 24px; justify-content: center; align-items: center; }
.ad-banner { width: 100%; }
.ad-banner img { display: block; width: 100%; height: auto; border-radius: 10px; }
.ad-banner a { display: block; }
.ad-placeholder { color: var(--muted); padding: 40px; text-align: center; }
@media (max-width: 860px) { .auth-card { grid-template-columns: 1fr; } }

/* Quill editor */
.quill-editor { margin-bottom: 14px; background: #fff; }
.quill-editor .ql-editor { min-height: 220px; font-size: 0.9rem; }

/* Quill content classes (rendered in news) */
.ql-size-small { font-size: 0.75em; }
.ql-size-large { font-size: 1.5em; }
.ql-size-huge { font-size: 2.5em; }
.ql-font-serif { font-family: Georgia, 'Times New Roman', serif; }
.ql-font-monospace { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ql-align-center { text-align: center; }
.ql-align-right { text-align: right; }
.ql-align-justify { text-align: justify; }
.ql-indent-1 { padding-left: 3em; }
.ql-indent-2 { padding-left: 6em; }
.ql-indent-3 { padding-left: 9em; }
.ql-indent-4 { padding-left: 12em; }
.ql-indent-5 { padding-left: 15em; }
.ql-indent-6 { padding-left: 18em; }
.ql-indent-7 { padding-left: 21em; }
.ql-indent-8 { padding-left: 24em; }

/* Funds page */
.balance-hero {
    text-align: center;
    padding: 24px 16px;
    margin-bottom: 20px;
}
.balance-hero-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin-bottom: 8px;
}
.balance-hero-amount {
    font-size: 3.2rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.5px;
    color: var(--text);
}
.balance-hero-amount span {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--muted);
    margin-left: 6px;
    letter-spacing: 0;
}

.funds-page { max-width: 760px; margin: 0 auto; }
.funds-card { font-size: 0.85rem; border: none; }
.funds-meta { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 16px; color: var(--muted); }
.funds-meta strong { color: var(--text); }
.funds-deposit-form { margin-bottom: 14px; }
.funds-note { background: #fffbeb; border-left: 3px solid #f59e0b; padding: 10px 12px; margin: 14px 0; color: #78350f; }
.funds-info { margin: 10px 0; color: #4b5563; }
.funds-card h3 { font-size: 0.95rem; margin: 18px 0 8px; }

