:root {
    --bg: #090d14;
    --surface: #111722;
    --surface-2: #151d2a;
    --surface-3: #1b2534;
    --border: #263245;
    --border-soft: rgba(255, 255, 255, .07);
    --text: #edf2f8;
    --muted: #8c9aae;
    --faint: #59687c;
    --orange: #f47a24;
    --orange-2: #ff9a52;
    --green: #35c987;
    --red: #ef5c67;
    --yellow: #f4c85b;
    --blue: #5c9df5;
    --sidebar: 252px;
    --radius: 14px;
    --shadow: 0 18px 50px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

.app-shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); display: flex; flex-direction: column; padding: 22px 14px 14px; background: #0d121b; border-right: 1px solid var(--border-soft); z-index: 30; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 9px 25px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: white; background: linear-gradient(145deg, var(--orange-2), #d94c13); box-shadow: 0 8px 22px rgba(244, 122, 36, .25); font-size: 19px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: .01em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.nav-sections { flex: 1; overflow-y: auto; }
.nav-label { padding: 19px 12px 7px; color: var(--faint); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .13em; }
.nav-link { display: flex; align-items: center; gap: 11px; min-height: 42px; margin: 2px 0; padding: 9px 12px; border-radius: 9px; color: #9daabd; font-weight: 550; transition: .16s ease; }
.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.nav-link.active { color: #fff; background: linear-gradient(90deg, rgba(244, 122, 36, .18), rgba(244, 122, 36, .05)); box-shadow: inset 3px 0 var(--orange); }
.nav-icon { width: 21px; color: var(--muted); font-size: 16px; text-align: center; }
.nav-link.active .nav-icon { color: var(--orange-2); }
.sidebar-user { display: flex; align-items: center; gap: 9px; padding: 13px 9px 3px; border-top: 1px solid var(--border-soft); }
.avatar { display: grid; place-items: center; flex: 0 0 auto; width: 35px; height: 35px; border-radius: 50%; color: #fff; background: linear-gradient(145deg, #43516a, #263349); font-weight: 750; }
.avatar-small { width: 30px; height: 30px; font-size: 12px; }
.user-copy { min-width: 0; flex: 1; }
.user-copy strong, .user-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { font-size: 12px; }
.user-copy small { margin-top: 2px; color: var(--muted); font-size: 10px; text-transform: capitalize; }
.icon-button, .menu-button { border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.icon-button { padding: 8px; font-size: 18px; }
.icon-button:hover { color: var(--orange); }

.app-main { grid-column: 2; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 68px; padding: 0 32px; border-bottom: 1px solid var(--border-soft); background: rgba(9, 13, 20, .88); backdrop-filter: blur(14px); }
.menu-button { display: none; font-size: 21px; }
.environment { display: flex; align-items: center; gap: 8px; color: #cdd6e2; font-size: 12px; font-weight: 650; }
.environment small { color: var(--muted); font-weight: 500; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(53, 201, 135, .1); }
.topbar-profile { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.content { width: 100%; max-width: 1460px; margin: 0 auto; padding: 30px 32px 56px; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.eyebrow { margin-bottom: 7px; color: var(--orange-2); font-size: 10px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(25px, 3vw, 34px); line-height: 1.1; letter-spacing: -.035em; }
h2 { font-size: 16px; letter-spacing: -.01em; }
.page-subtitle { margin: 0; color: var(--muted); line-height: 1.55; }
.header-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.card { margin-bottom: 18px; padding: 21px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: linear-gradient(145deg, rgba(21, 29, 42, .96), rgba(16, 23, 34, .96)); box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.card-header h2 { margin: 0; }
.card-header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.5fr) minmax(300px, .7fr); }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { position: relative; overflow: hidden; min-height: 128px; padding: 20px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); }
.stat-card::after { content: ""; position: absolute; width: 90px; height: 90px; right: -35px; bottom: -45px; border-radius: 50%; background: rgba(244, 122, 36, .08); }
.stat-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.stat-icon { color: var(--orange-2); font-size: 18px; }
.stat-value { margin-top: 17px; font-size: 30px; font-weight: 780; letter-spacing: -.035em; }
.stat-detail { margin-top: 4px; color: var(--muted); font-size: 11px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 37px; padding: 8px 14px; border: 1px solid transparent; border-radius: 9px; color: #fff; cursor: pointer; font-size: 12px; font-weight: 700; transition: .16s ease; }
.btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn-primary { background: linear-gradient(145deg, var(--orange-2), #e75f18); box-shadow: 0 7px 20px rgba(244, 122, 36, .18); }
.btn-outline { border-color: var(--border); color: #b7c3d2; background: rgba(255, 255, 255, .02); }
.btn-success { color: #b9f4db; background: rgba(53, 201, 135, .15); border-color: rgba(53, 201, 135, .25); }
.btn-danger { color: #ffc3c7; background: rgba(239, 92, 103, .14); border-color: rgba(239, 92, 103, .22); }
.btn-sm { min-height: 30px; padding: 5px 9px; font-size: 11px; }

.flash { margin-bottom: 18px; padding: 12px 14px; border-radius: 10px; font-size: 12px; }
.flash-success { color: #b9f4db; background: rgba(53, 201, 135, .1); border: 1px solid rgba(53, 201, 135, .25); }
.flash-error { color: #ffc3c7; background: rgba(239, 92, 103, .1); border: 1px solid rgba(239, 92, 103, .25); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; font-size: 10px; font-weight: 750; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-active { color: #6be2aa; background: rgba(53, 201, 135, .11); }
.badge-inactive { color: #ff818a; background: rgba(239, 92, 103, .1); }
.badge-upcoming { color: #75b3ff; background: rgba(92, 157, 245, .12); }
.badge-ended { color: #9aa7b8; background: rgba(140, 154, 174, .1); }
.badge-role { color: #ffad74; background: rgba(244, 122, 36, .12); text-transform: capitalize; }
.badge-role::before { display: none; }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--border-soft); text-align: left; vertical-align: middle; }
th { color: var(--faint); font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
td { color: #c9d3df; font-size: 12px; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(255, 255, 255, .018); }
tbody tr:last-child td { border-bottom: 0; }
.cell-main { display: block; color: var(--text); font-weight: 680; }
.cell-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.empty-state { padding: 35px 15px; color: var(--muted); text-align: center; }

.toolbar { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .search-field { flex: 1; min-width: 220px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 6px; color: #aeb9c8; font-size: 11px; font-weight: 650; }
.form-group small { display: block; margin-top: 5px; color: var(--faint); font-size: 10px; line-height: 1.45; }
.form-group input, .form-group select, .form-group textarea, .toolbar input, .toolbar select { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; outline: none; color: var(--text); background: #0c121c; transition: border .16s, box-shadow .16s; }
.form-group textarea { min-height: 95px; resize: vertical; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus, .toolbar input:focus, .toolbar select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(244, 122, 36, .1); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.checkbox-row { display: flex; align-items: center; gap: 9px; min-height: 40px; }
.checkbox-row input { width: 17px; height: 17px; accent-color: var(--orange); }
.checkbox-row label { margin: 0; }
.readonly-field { padding: 10px 11px; border: 1px solid var(--border-soft); border-radius: 9px; color: var(--muted); background: rgba(0, 0, 0, .12); }

.server-select { display: flex; gap: 9px; flex-wrap: wrap; }
.server-select form { display: inline-flex; }
.server-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 9px 14px; border: 1px solid var(--border); border-radius: 10px; color: #aeb9c7; background: #0e1520; cursor: pointer; }
.server-btn:hover, .server-btn.active { color: #fff; border-color: rgba(244, 122, 36, .55); background: rgba(244, 122, 36, .1); }
.server-btn.active::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.server-btn:disabled { opacity: .4; cursor: not-allowed; }

.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.quick-action { display: flex; align-items: center; gap: 10px; padding: 13px; border: 1px solid var(--border-soft); border-radius: 10px; color: #bac5d3; background: rgba(255, 255, 255, .018); font-size: 12px; }
.quick-action:hover { border-color: rgba(244, 122, 36, .35); color: #fff; }
.quick-icon { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 8px; color: var(--orange-2); background: rgba(244, 122, 36, .1); }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.detail-item { padding: 14px; border: 1px solid var(--border-soft); border-radius: 10px; background: rgba(0, 0, 0, .1); }
.detail-item span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.detail-item strong { font-size: 14px; }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; color: var(--muted); font-size: 11px; }
.pagination-links { display: flex; gap: 7px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.text-muted { color: var(--muted); }
.text-right { text-align: right; }

.auth-shell { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: radial-gradient(circle at 20% 20%, rgba(244, 122, 36, .12), transparent 28%), radial-gradient(circle at 85% 75%, rgba(92, 157, 245, .08), transparent 28%), var(--bg); }
.login-wrap { width: 100%; max-width: 390px; }
.login-brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 24px; text-align: center; }
.login-brand .brand-mark { width: 50px; height: 50px; margin-bottom: 13px; font-size: 24px; }
.login-brand h1 { margin-bottom: 5px; font-size: 25px; }
.login-brand p { color: var(--muted); font-size: 12px; }
.login-card { padding: 25px; }

@media (max-width: 1050px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-main { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .app-shell { display: block; }
    .sidebar { transform: translateX(-102%); transition: transform .2s ease; box-shadow: 15px 0 50px rgba(0, 0, 0, .35); }
    .menu-open .sidebar { transform: translateX(0); }
    .menu-open::after { content: ""; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .55); }
    .app-main { width: 100%; }
    .topbar { padding: 0 18px; }
    .menu-button { display: block; }
    .topbar-profile > span:first-child { display: none; }
    .content { padding: 24px 16px 45px; }
    .page-header { flex-direction: column; }
    .stats-grid, .grid-2, .form-grid, .detail-grid { grid-template-columns: 1fr; }
    .quick-actions { grid-template-columns: 1fr; }
    .card { padding: 17px; }
    .environment small { display: none; }
}
