:root {
    color-scheme: dark;
    --bg: #090a0d;
    --panel: #101115;
    --panel-raised: #14151a;
    --border: #24252b;
    --muted: #898b96;
    --text: #f0f0f3;
    --accent: #b895ff;
    --green: #67d7a2;
    --red: #ff777d;
    --gold: #f2c56b;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font: 13px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button { color: inherit; }
.is-hidden { display: none !important; }

.auth-gate {
    display: grid;
    min-height: 100vh;
    padding: 24px;
    place-items: center;
    background: radial-gradient(ellipse at 50% 32%, #17131f 0, var(--bg) 58%);
}

.auth-card {
    width: min(390px, 100%);
    padding: 36px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(16, 17, 21, .94);
    text-align: center;
    box-shadow: 0 24px 80px #0008;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 12px;
    color: #130e1c;
    background: var(--accent);
    font-size: 19px;
    font-weight: 850;
}

.auth-card .brand-mark { width: 48px; height: 48px; margin: 0 auto 20px; font-size: 23px; }
.auth-card h1 { margin: 7px 0 10px; font-size: 21px; letter-spacing: -.4px; }
.auth-card > p:not(.eyebrow) { margin: 0; color: var(--muted); line-height: 1.65; }
.auth-card > p.auth-error { color: var(--red); }
.eyebrow { margin: 0; color: var(--accent); font-size: 10px; font-weight: 750; letter-spacing: 1.4px; }
.auth-spinner {
    width: 20px;
    height: 20px;
    margin: 22px auto 0;
    border: 2px solid #ffffff20;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.app-shell {
    display: grid;
    grid-template-columns: 220px minmax(420px, 1fr) 325px;
    min-height: 100vh;
}

.sidebar {
    display: flex;
    position: sticky;
    top: 0;
    flex-direction: column;
    height: 100vh;
    padding: 23px 15px 14px;
    border-right: 1px solid var(--border);
    background: #0c0d10;
}

.brand { display: flex; align-items: center; gap: 10px; margin: 1px 5px 43px; color: inherit; text-decoration: none; }
.brand > span:last-child { display: grid; gap: 1px; }
.brand strong { font-size: 15px; letter-spacing: -.4px; }
.brand small { color: var(--muted); font-size: 8px; font-weight: 750; letter-spacing: 1.5px; }
.nav-label { margin: 0 10px 11px; color: #666873; font-size: 9px; font-weight: 750; letter-spacing: 1.2px; }
.side-nav { display: grid; gap: 5px; }
.nav-item {
    display: flex;
    min-height: 39px;
    align-items: center;
    gap: 11px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #a4a5ae;
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: background .16s ease, color .16s ease;
}
.nav-item:hover { color: var(--text); background: #ffffff08; }
.nav-item.is-active { color: #e7d9ff; border-color: #b895ff26; background: #b895ff12; }
.nav-icon { width: 17px; color: #999ba6; font-size: 17px; text-align: center; }
.nav-item.is-active .nav-icon { color: var(--accent); }
.nav-count { margin-left: auto; color: #777984; font-size: 11px; }
.sidebar-bottom { margin-top: auto; }
.security-note { display: flex; align-items: center; gap: 8px; margin: 0 8px 15px; color: #848690; font-size: 10px; }
.security-dot, .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px #67d7a255; }
.admin-profile { display: flex; align-items: center; gap: 9px; padding: 13px 3px 1px; border-top: 1px solid var(--border); }
.admin-avatar { display: grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; border: 1px solid #b895ff45; border-radius: 50%; color: #d7c3ff; background: #b895ff18; font-weight: 700; }
.admin-profile > div:nth-child(2) { display: grid; min-width: 0; gap: 2px; }
.admin-profile strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.admin-profile small { color: var(--muted); font-size: 10px; }
.owner-badge { margin-left: auto; padding: 3px 5px; border: 1px solid #b895ff35; border-radius: 4px; color: #c9adff; font-size: 8px; font-weight: 800; letter-spacing: .5px; }

.main-content { min-width: 0; padding: 0 25px 34px; }
.topbar { display: flex; height: 60px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.breadcrumbs { color: #92939c; font-size: 11px; }
.breadcrumbs span { margin: 0 8px; color: #50515a; }
.breadcrumbs strong { color: #e6e6e9; font-weight: 550; }
.topbar-right { display: flex; align-items: center; gap: 15px; }
.live-status, .updated-label { display: flex; align-items: center; gap: 7px; color: #9b9da7; font-size: 10px; }
.live-status .live-dot, .updated-label .live-dot { width: 6px; height: 6px; }
.icon-button { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid var(--border); border-radius: 7px; color: #b5b6be; background: var(--panel); font-size: 17px; cursor: pointer; }
.icon-button:hover { border-color: #4a4657; color: var(--text); }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 25px 0 18px; }
.page-heading h1 { margin: 5px 0 4px; font-size: 23px; font-weight: 680; letter-spacing: -.7px; }
.page-subtitle { margin: 0; color: var(--muted); font-size: 11px; }
.updated-label { padding: 6px 9px; border: 1px solid var(--border); border-radius: 18px; background: #ffffff03; white-space: nowrap; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 17px; }
.stat-card { min-width: 0; padding: 13px 13px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; color: #a5a6af; font-size: 10px; }
.stat-icon { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 7px; font-size: 13px; }
.stat-icon.purple { color: #c4a4ff; background: #b895ff17; }
.stat-icon.green { color: var(--green); background: #67d7a215; }
.stat-icon.red { color: var(--red); background: #ff777d16; }
.stat-icon.gold { color: var(--gold); background: #f2c56b15; }
.stat-card > strong { display: block; overflow: hidden; margin-top: 7px; font-size: 20px; font-weight: 680; letter-spacing: -.6px; text-overflow: ellipsis; white-space: nowrap; }
.stat-card > small { display: block; margin-top: 2px; color: #71737d; font-size: 9px; }

.view-panel { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 12px; }
.panel-heading h2 { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: -.2px; }
.panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.result-count { color: #888a94; font-size: 10px; white-space: nowrap; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 0 16px 12px; }
.search-box { display: flex; min-width: 100px; height: 33px; flex: 1; align-items: center; gap: 8px; padding: 0 9px; border: 1px solid var(--border); border-radius: 7px; color: #7f818b; background: #0c0d10; }
.search-box > span { font-size: 17px; }
.search-box input { width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 10px; }
.search-box input::placeholder { color: #666872; }
.filter-select { height: 33px; padding: 0 26px 0 9px; border: 1px solid var(--border); border-radius: 7px; color: #b5b6bf; background: #0c0d10; font-size: 10px; }

.table-wrap { width: 100%; overflow-x: auto; border-top: 1px solid var(--border); }
.user-table { width: 100%; border-collapse: collapse; text-align: left; }
.user-table th { height: 31px; padding: 0 9px; color: #6f717b; font-size: 8px; font-weight: 750; letter-spacing: .7px; white-space: nowrap; }
.user-table th:first-child, .user-table td:first-child { padding-left: 16px; }
.user-table th:nth-child(3), .user-table td:nth-child(3) { text-align: right; }
.user-table td { height: 53px; padding: 6px 9px; border-top: 1px solid #ffffff08; color: #c5c6cd; font-size: 10px; white-space: nowrap; }
.user-row { cursor: pointer; transition: background .12s ease; }
.user-row:hover, .user-row.is-selected { background: #ffffff06; }
.user-cell { display: flex; min-width: 120px; align-items: center; gap: 8px; }
.user-avatar { width: 29px; height: 29px; flex: 0 0 29px; overflow: hidden; border: 1px solid #ffffff16; border-radius: 50%; background: #22232a; object-fit: cover; }
.user-name-wrap { display: grid; max-width: 130px; gap: 2px; }
.user-name { overflow: hidden; color: #e5e5e9; font-size: 10px; font-weight: 580; text-overflow: ellipsis; }
.user-subname { overflow: hidden; color: #7d7f89; font-size: 9px; text-overflow: ellipsis; }
.user-id { color: #9a9ba4; font-variant-numeric: tabular-nums; }
.gold-value { color: #f0d18a; font-variant-numeric: tabular-nums; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border: 1px solid #ffffff0f; border-radius: 20px; color: #a3a4ad; background: #ffffff04; font-size: 9px; }
.status-pill::before { width: 5px; height: 5px; border-radius: 50%; background: #777984; content: ""; }
.status-pill.online { color: #93dfb8; border-color: #67d7a222; background: #67d7a20a; }
.status-pill.online::before { background: var(--green); }
.status-pill.vip { color: #e4c078; border-color: #f2c56b22; background: #f2c56b0a; }
.status-pill.vip::before { background: var(--gold); }
.status-pill.banned { color: #ff9a9e; border-color: #ff777d25; background: #ff777d0c; }
.status-pill.banned::before { background: var(--red); }
.row-chevron { color: #62646e; font-size: 17px; }
.empty-state { padding: 28px 14px; color: #82848e; text-align: center; font-size: 11px; }

.detail-panel { position: sticky; top: 0; height: 100vh; overflow-y: auto; border-left: 1px solid var(--border); background: #0c0d10; }
.detail-placeholder { display: grid; min-height: 60vh; align-content: center; justify-items: center; padding: 28px; color: #e5e5e9; text-align: center; }
.placeholder-icon { display: grid; width: 47px; height: 47px; margin-bottom: 15px; place-items: center; border: 1px solid var(--border); border-radius: 14px; color: #aaa1ba; background: #ffffff04; font-size: 22px; }
.detail-placeholder strong { font-size: 12px; }
.detail-placeholder p { max-width: 210px; margin: 6px 0 0; color: #81838d; font-size: 10px; line-height: 1.65; }
.detail-content { padding: 18px 15px 24px; }
.detail-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.detail-header h2 { margin: 0; font-size: 12px; font-weight: 650; }
.close-detail { display: none; width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 6px; color: #b4b5bd; background: transparent; cursor: pointer; }
.profile-block { display: flex; align-items: center; gap: 11px; padding: 15px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); }
.profile-avatar { width: 47px; height: 47px; flex: 0 0 47px; border: 1px solid #ffffff20; border-radius: 50%; background: #22232a; object-fit: cover; }
.profile-name { min-width: 0; }
.profile-name h3 { overflow: hidden; margin: 0 0 4px; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.profile-name p { overflow: hidden; margin: 0; color: #858791; font-size: 10px; text-overflow: ellipsis; }
.profile-badges { display: flex; gap: 5px; margin-top: 7px; }
.profile-badges .status-pill { padding: 3px 6px; font-size: 8px; }
.detail-section { margin-top: 17px; }
.detail-section-heading { display: flex; justify-content: space-between; margin: 0 0 8px; color: #9b9ca5; font-size: 9px; font-weight: 750; letter-spacing: .65px; text-transform: uppercase; }
.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.info-card { min-width: 0; padding: 9px 10px; border: 1px solid #ffffff0b; border-radius: 7px; background: #ffffff03; }
.info-card span { display: block; color: #7d7f89; font-size: 9px; }
.info-card strong { display: block; overflow: hidden; margin-top: 4px; color: #dedee3; font-size: 11px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.profile-status { padding: 9px 10px; border: 1px solid #ffffff0b; border-radius: 7px; color: #a6a7b0; background: #ffffff03; font-size: 10px; overflow-wrap: anywhere; }
.action-card { margin-top: 16px; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); }
.action-card h3 { margin: 0 0 9px; font-size: 10px; font-weight: 650; }
.action-card p { margin: -4px 0 10px; color: #81838d; font-size: 9px; line-height: 1.5; }
.form-row { display: flex; gap: 6px; }
.field, .select-field { width: 100%; min-width: 0; height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; outline: 0; color: #e4e4e8; background: #0b0c0f; font-size: 10px; }
.field:focus, .select-field:focus { border-color: #9a7ad8; }
.field::placeholder { color: #62646e; }
.action-button, .primary-button { display: inline-flex; min-height: 32px; align-items: center; justify-content: center; gap: 7px; padding: 0 10px; border: 1px solid #b895ff35; border-radius: 6px; color: #d9c6ff; background: #b895ff14; font-size: 10px; font-weight: 620; cursor: pointer; white-space: nowrap; }
.action-button:hover, .primary-button:hover { background: #b895ff25; }
.action-button:disabled { opacity: .55; cursor: wait; }
.action-button.full { width: 100%; }
.action-button.danger { border-color: #ff777d30; color: #ff9a9e; background: #ff777d0c; }
.action-button.danger:hover { background: #ff777d18; }
.action-button.neutral { border-color: var(--border); color: #c4c5cc; background: #ffffff05; }
.field-hint { display: block; margin-top: 6px; color: #70727c; font-size: 8px; }
.item-list { display: flex; flex-wrap: wrap; gap: 5px; }
.item-chip { padding: 4px 7px; border: 1px solid #ffffff0c; border-radius: 5px; color: #a7a8b0; background: #ffffff04; font-size: 9px; }
.item-chip strong { margin-left: 4px; color: #e0d1ff; font-weight: 600; }

.room-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 0 14px 14px; }
.room-card { padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: #0c0d10; }
.room-card h3 { margin: 0 0 5px; font-size: 11px; font-weight: 620; }
.room-id { color: #858791; font-size: 9px; }
.room-meta { display: flex; justify-content: space-between; margin-top: 12px; color: #9e9fa8; font-size: 9px; }
.overview-view { padding-bottom: 17px; }
.overview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; padding: 0 15px 16px; }
.overview-card { padding: 13px; border: 1px solid var(--border); border-radius: 8px; background: #0c0d10; }
.overview-card span, .overview-card small { display: block; color: #8d8f98; font-size: 9px; }
.overview-card strong { display: block; margin: 8px 0 4px; font-size: 19px; }
.primary-button { margin-left: 15px; }
.primary-button span { font-size: 14px; }
.toast { position: fixed; z-index: 20; right: 20px; bottom: 20px; max-width: min(360px, calc(100vw - 40px)); padding: 11px 15px; transform: translateY(12px); border: 1px solid #67d7a235; border-radius: 8px; opacity: 0; color: #b3ebce; background: #101814; box-shadow: 0 10px 32px #0008; font-size: 11px; pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.is-visible { transform: translateY(0); opacity: 1; }
.toast.is-error { border-color: #ff777d40; color: #ffb0b3; background: #1a1011; }

@media (max-width: 1220px) {
    .app-shell { grid-template-columns: 200px minmax(420px, 1fr); }
    .detail-panel { position: fixed; z-index: 10; top: 0; right: 0; width: 340px; border-left: 1px solid var(--border); box-shadow: -20px 0 60px #0008; }
    .detail-panel.is-hidden { display: none; }
    .close-detail { display: block; }
}

@media (max-width: 760px) {
    .app-shell { display: block; }
    .sidebar { position: static; width: 100%; height: auto; padding: 10px 13px 0; border-right: 0; border-bottom: 1px solid var(--border); }
    .brand { margin: 0 2px 9px; }
    .brand-mark { width: 32px; height: 32px; border-radius: 10px; font-size: 16px; }
    .brand strong { font-size: 13px; }
    .nav-label, .sidebar-bottom { display: none; }
    .side-nav { display: flex; gap: 4px; overflow-x: auto; }
    .nav-item { min-height: 35px; flex: 0 0 auto; gap: 6px; padding: 0 8px; font-size: 10px; }
    .nav-icon { width: auto; font-size: 14px; }
    .nav-count { margin-left: 0; font-size: 9px; }
    .main-content { padding: 0 13px 24px; }
    .topbar { height: 48px; }
    .live-status { display: none; }
    .page-heading { align-items: center; padding: 19px 0 13px; }
    .page-heading h1 { font-size: 20px; }
    .page-subtitle { max-width: 245px; font-size: 10px; }
    .updated-label { font-size: 8px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-bottom: 12px; }
    .stat-card { padding: 10px; }
    .stat-card > strong { font-size: 18px; }
    .stat-card > small { font-size: 8px; }
    .stat-top { font-size: 9px; }
    .stat-icon { width: 22px; height: 22px; }
    .panel-heading { padding: 13px 12px 10px; }
    .toolbar { padding: 0 12px 10px; }
    .user-table { min-width: 550px; }
    .room-grid { grid-template-columns: 1fr; }
    .overview-grid { grid-template-columns: 1fr; }
    .detail-panel { position: fixed; z-index: 10; top: auto; right: 0; bottom: 0; width: 100%; height: min(85vh, 760px); border-top: 1px solid var(--border); border-left: 0; border-radius: 14px 14px 0 0; box-shadow: 0 -20px 60px #0008; }
    .detail-panel:not(.is-open) { display: none; }
    .detail-content { padding: 14px 16px 26px; }
}
