/* ═══════════════════════════════════════════════════════════════════════════════
   ORB WEB ADMIN — "The Command Deck" Design System
   Premium cyberpunk admin panel. No generic templates.
   ═══════════════════════════════════════════════════════════════════════════════ */

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

html, body {
    width: 100%; height: 100%;
    background: #080808;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; border: none; background: none; color: inherit; font-family: inherit; font-size: inherit; }
input, textarea, select { font-family: var(--font-body); color: var(--text-primary); font-size: inherit; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ─── Animations ────────────────────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulseGlow { 0%,100% { box-shadow: 0 0 6px rgba(var(--primary-rgb),0.2); } 50% { box-shadow: 0 0 16px rgba(var(--primary-rgb),0.5); } }
@keyframes countPulse { 0% { color: var(--primary); } 100% { color: var(--text-primary); } }
@keyframes dataPulse { 0% { box-shadow: 0 0 0 0 rgba(var(--primary-rgb),0.15); } 100% { box-shadow: 0 0 0 0 transparent; } }

.anim-enter { animation: scaleIn 0.25s cubic-bezier(0.22,1,0.36,1) both; }
.anim-stagger { animation: slideUp 0.3s cubic-bezier(0.22,1,0.36,1) both; }

/* ─── App Shell ─────────────────────────────────────────────────────────────── */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 2400px;
    margin: 0 auto;
}

/* ─── Command Bar (Top Nav) ─────────────────────────────────────────────────── */
.command-bar {
    height: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    background: rgba(12,12,12,0.95);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 100;
    gap: 8px;
}

.cb-brand {
    font-family: var(--font-headline);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--primary);
    margin-right: 24px;
    user-select: none;
}

.cb-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    position: relative;
}

.cb-sep {
    width: 1px;
    height: 16px;
    background: var(--border-subtle);
    margin: 0 8px;
}

.cb-link {
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    position: relative;
    transition: color 0.2s;
    white-space: nowrap;
}

.cb-link:hover { color: var(--text-secondary); }
.cb-link.active { color: var(--text-primary); }
.cb-link.active::after {
    content: '';
    position: absolute;
    bottom: 0; left: 10px; right: 10px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px 2px 0 0;
    animation: fadeIn 0.2s;
}

.cb-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.cb-search-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--surface-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
}
.cb-search-trigger:hover { border-color: var(--border-hover); color: var(--text-secondary); }
.cb-search-trigger kbd {
    font-family: var(--font-body);
    font-size: 14px;
    padding: 1px 5px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    color: var(--text-muted);
}

.cb-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}
.cb-user:hover { background: var(--surface-bg); }

.cb-avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: rgba(var(--primary-rgb),0.12);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: var(--primary);
}

.cb-user-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.cb-user-role { font-size: 14px; color: var(--primary); text-transform: uppercase; letter-spacing: 0.5px; }

.cb-user-menu {
    display: none;
    position: absolute;
    top: 44px; right: 20px;
    background: var(--panel-bg);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 6px;
    min-width: 160px;
    z-index: 200;
    animation: slideDown 0.15s ease;
}
.cb-user-menu.open { display: block; }
.cb-user-menu-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    font-size: 14px; color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer; transition: all 0.1s;
}
.cb-user-menu-item:hover { background: var(--surface-hover); color: var(--text-primary); }
.cb-user-menu-item.danger:hover { background: rgba(var(--danger-rgb),0.1); color: var(--danger); }

/* ─── Main Body (Context Panel + Workspace) ─────────────────────────────────── */
.main-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ─── Context Panel ─────────────────────────────────────────────────────────── */
.context-panel {
    width: 260px;
    min-width: 260px;
    background: rgba(12,12,12,0.6);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s cubic-bezier(0.22,1,0.36,1), min-width 0.3s cubic-bezier(0.22,1,0.36,1), opacity 0.2s;
}
.context-panel.collapsed {
    width: 0; min-width: 0; opacity: 0; border: none;
}

.ctx-header {
    padding: 14px 16px 10px;
    font-family: var(--font-headline);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
}

.ctx-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    font-size: 14px;
}

.ctx-search {
    padding: 8px;
}
.ctx-search input {
    width: 100%;
    padding: 7px 10px 7px 32px;
    background: var(--surface-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
}
.ctx-search input:focus { border-color: var(--primary); }
.ctx-search input::placeholder { color: var(--text-muted); }
.ctx-search { position: relative; }
.ctx-search i {
    position: absolute;
    left: 20px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

/* Context panel player card */
.ctx-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    border-left: 2px solid transparent;
}
.ctx-player:hover { background: rgba(255,255,255,0.03); }
.ctx-player.active {
    background: rgba(var(--primary-rgb),0.06);
    border-left-color: var(--primary);
}
.ctx-player-id {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(var(--primary-rgb),0.1);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: var(--primary);
    flex-shrink: 0;
}
.ctx-player-info { flex: 1; min-width: 0; }
.ctx-player-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-player-meta { font-size: 14px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-player-health {
    width: 4px; height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}
.ctx-player-health.high { background: #22c55e; }
.ctx-player-health.mid { background: #f59e0b; }
.ctx-player-health.low { background: var(--danger); }

/* ─── Workspace ─────────────────────────────────────────────────────────────── */
.workspace {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    animation: fadeIn 0.2s;
}

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.2s; }

/* ─── Status Dock (Bottom) ──────────────────────────────────────────────────── */
.status-dock {
    height: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    background: rgba(12,12,12,0.95);
    border-top: 1px solid var(--border-subtle);
    gap: 16px;
    z-index: 100;
}

.dock-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-muted);
}
.dock-stat .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34,197,94,0.5);
}
.dock-stat .value { color: var(--text-secondary); font-weight: 600; }

.dock-sep {
    width: 1px; height: 16px;
    background: var(--border-subtle);
}

.dock-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dock-sync {
    font-size: 14px;
    color: var(--text-disabled);
}

.dock-actions-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(var(--primary-rgb),0.08);
    border: 1px solid rgba(var(--primary-rgb),0.2);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.15s;
}
.dock-actions-btn:hover {
    background: rgba(var(--primary-rgb),0.15);
    border-color: rgba(var(--primary-rgb),0.4);
}

/* Quick Actions Dropdown */
.quick-actions-panel {
    display: none;
    position: fixed;
    bottom: 44px; right: 20px;
    width: 320px;
    max-height: 400px;
    background: var(--panel-bg);
    border: 1px solid var(--border-default);
    border-radius: 10px;
    padding: 12px;
    z-index: 300;
    animation: slideUp 0.2s cubic-bezier(0.22,1,0.36,1);
    overflow-y: auto;
}
.quick-actions-panel.open { display: block; }

.qa-section-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 8px 4px 4px;
}
.qa-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}
.qa-btn {
    display: flex; flex-direction: column;
    align-items: center; gap: 3px;
    padding: 10px 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.qa-btn:hover { background: var(--surface-hover); }
.qa-btn i { font-size: 14px; color: var(--primary); }
.qa-btn span { font-size: 9px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); text-align: center; }
.qa-btn.danger i { color: var(--danger); }
.qa-btn.danger:hover { background: rgba(var(--danger-rgb),0.08); }

/* ─── Page Header ───────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 20px; }
.page-title {
    font-family: var(--font-headline);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}
.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ─── Stat Cards ────────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    gap: 12px;
}

.stat-card {
    background: var(--surface-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 18px;
    transition: all 0.2s;
}
.stat-card:hover {
    border-color: rgba(var(--primary-rgb),0.2);
}

.stat-card .stat-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: rgba(var(--primary-rgb),0.08);
    display: flex; align-items: center; justify-content: center;
    color: var(--primary);
    font-size: 14px;
    margin-bottom: 12px;
}

.stat-card .stat-value {
    font-family: var(--font-headline);
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}
.stat-card .stat-label {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* SVG Radial Chart */
.radial-chart {
    position: relative;
    width: 64px; height: 64px;
}
.radial-chart svg { transform: rotate(-90deg); }
.radial-chart .track { fill: none; stroke: rgba(255,255,255,0.06); stroke-width: 6; }
.radial-chart .fill { fill: none; stroke: var(--primary); stroke-width: 6; stroke-linecap: round; transition: stroke-dasharray 0.8s cubic-bezier(0.22,1,0.36,1); }
.radial-chart .center-text {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-headline);
    font-size: 14px; font-weight: 700;
    color: var(--text-primary);
}

/* ─── Panel / Card ──────────────────────────────────────────────────────────── */
.panel {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow: hidden;
}
.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
}
.panel-title {
    font-family: var(--font-headline);
    font-size: 14px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--text-secondary);
}
.panel-body { padding: 16px; }

/* ─── Tables ────────────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
    padding: 8px 12px;
    font-size: 14px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.6px;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}
.data-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: background 0.1s;
}
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.data-table tbody td {
    padding: 10px 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border-radius: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    padding: 8px 18px;
    background: var(--primary);
    color: #080808;
    font-size: 14px;
}
.btn-primary:hover { filter: brightness(1.15); box-shadow: 0 0 20px rgba(var(--primary-rgb),0.3); }

.btn-secondary {
    padding: 6px 14px;
    background: var(--surface-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
    font-size: 14px;
}
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border-hover); color: var(--text-primary); }

.btn-danger {
    padding: 6px 14px;
    background: rgba(var(--danger-rgb),0.08);
    color: var(--danger);
    border: 1px solid rgba(var(--danger-rgb),0.2);
    font-size: 14px;
}
.btn-danger:hover { background: rgba(var(--danger-rgb),0.15); border-color: rgba(var(--danger-rgb),0.4); }

.btn-ghost {
    padding: 6px 10px;
    color: var(--text-muted);
    font-size: 14px;
}
.btn-ghost:hover { background: var(--surface-bg); color: var(--text-secondary); }

.btn-icon {
    width: 28px; height: 28px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    transition: all 0.15s;
}
.btn-icon:hover { background: rgba(var(--primary-rgb),0.08); color: var(--primary); }

/* ─── Inputs ────────────────────────────────────────────────────────────────── */
.input-field {
    width: 100%;
    padding: 8px 12px;
    background: var(--surface-bg);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
}
.input-field:focus { border-color: var(--primary); }
.input-field::placeholder { color: var(--text-muted); }

select.input-field {
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.4)' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}
select.input-field option { background: #1a1a1a; color: var(--text-primary); }

textarea.input-field { resize: vertical; min-height: 80px; }

.form-group { margin-bottom: 12px; }
.form-label {
    display: block;
    font-size: 14px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.checkbox-wrapper {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
}
.checkbox-wrapper input[type="checkbox"] { display: none; }
.checkbox-custom {
    width: 16px; height: 16px;
    border: 1px solid var(--border-default);
    border-radius: 4px;
    background: var(--surface-bg);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.checkbox-wrapper input:checked + .checkbox-custom {
    background: var(--primary); border-color: var(--primary);
}
.checkbox-wrapper input:checked + .checkbox-custom::after {
    content: '✓'; font-size: 14px; color: #080808; font-weight: 700;
}

/* ─── Badges ────────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 14px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.badge-primary { background: rgba(var(--primary-rgb),0.12); color: var(--primary); }
.badge-success { background: rgba(34,197,94,0.12); color: #22c55e; }
.badge-danger { background: rgba(var(--danger-rgb),0.12); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,0.12); color: #f59e0b; }
.badge-muted { background: rgba(255,255,255,0.05); color: var(--text-muted); }

.status-dot {
    width: 6px; height: 6px; border-radius: 50%; display: inline-block;
}
.status-dot.online { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.status-dot.offline { background: var(--danger); }

/* ─── Tabs ──────────────────────────────────────────────────────────────────── */
.tab-bar {
    display: flex; gap: 0; border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 16px;
}
.tab-item {
    padding: 10px 16px;
    font-size: 14px; font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.tab-item:hover { color: var(--text-secondary); }
.tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ─── Search Bar ────────────────────────────────────────────────────────────── */
.search-bar {
    position: relative;
    margin-bottom: 12px;
}
.search-bar .search-icon {
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted); font-size: 14px;
}
.search-bar input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    background: var(--surface-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
}
.search-bar input:focus { border-color: var(--primary); }
.search-bar input::placeholder { color: var(--text-muted); }

/* ─── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 500;
    align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--panel-bg);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    width: 420px; max-width: 90%; max-height: 80vh;
    overflow-y: auto;
    animation: scaleIn 0.2s cubic-bezier(0.22,1,0.36,1);
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}
.modal-title {
    font-family: var(--font-headline);
    font-size: 14px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.modal-close {
    width: 28px; height: 28px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); cursor: pointer;
    transition: all 0.15s;
}
.modal-close:hover { background: rgba(var(--danger-rgb),0.1); color: var(--danger); }
.modal-body { padding: 20px; }
.modal-footer {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--border-subtle);
}

/* ─── Command Palette (Spotlight) ───────────────────────────────────────────── */
.spotlight-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: flex-start; justify-content: center;
    padding-top: 15vh;
}
.spotlight-overlay.open { display: flex; }
.spotlight-box {
    width: 520px; max-width: 90%;
    background: var(--panel-bg);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    overflow: hidden;
    animation: slideDown 0.15s cubic-bezier(0.22,1,0.36,1);
}
.spotlight-input {
    width: 100%;
    padding: 16px 20px;
    background: transparent;
    border: none; border-bottom: 1px solid var(--border-subtle);
    font-family: var(--font-headline);
    font-size: 16px;
    color: var(--text-primary);
    outline: none;
}
.spotlight-input::placeholder { color: var(--text-muted); }
.spotlight-results {
    max-height: 340px;
    overflow-y: auto;
    padding: 8px;
}
.spotlight-group-title {
    font-size: 14px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 8px 10px 4px;
}
.spotlight-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer; transition: all 0.1s;
}
.spotlight-item:hover, .spotlight-item.selected { background: var(--surface-hover); }
.spotlight-item i { width: 16px; text-align: center; color: var(--text-muted); }
.spotlight-item span { font-size: 14px; color: var(--text-primary); }
.spotlight-item .meta { font-size: 14px; color: var(--text-muted); margin-left: auto; }
.spotlight-empty {
    padding: 24px; text-align: center;
    color: var(--text-muted); font-size: 14px;
}

/* ─── Activity Feed (horizontal timeline) ───────────────────────────────────── */
.activity-feed {
    display: flex; gap: 10px;
    overflow-x: auto;
    padding: 8px 0 12px;
    scroll-snap-type: x mandatory;
}
.activity-feed::-webkit-scrollbar { height: 3px; }
.activity-card {
    min-width: 200px; max-width: 200px;
    background: var(--surface-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 12px;
    scroll-snap-align: start;
    flex-shrink: 0;
    transition: border-color 0.15s;
}
.activity-card:hover { border-color: rgba(var(--primary-rgb),0.2); }
.activity-card .act-icon {
    width: 24px; height: 24px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    margin-bottom: 8px;
}
.activity-card .act-icon.success { background: rgba(34,197,94,0.1); color: #22c55e; }
.activity-card .act-icon.error { background: rgba(var(--danger-rgb),0.1); color: var(--danger); }
.activity-card .act-icon.info { background: rgba(var(--primary-rgb),0.1); color: var(--primary); }
.activity-card .act-title { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.activity-card .act-meta { font-size: 14px; color: var(--text-muted); }

/* ─── Player Action Groups (inline expand) ──────────────────────────────────── */
.action-section {
    margin-bottom: 12px;
}
.action-section-title {
    font-size: 14px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 6px 0;
    display: flex; align-items: center; gap: 8px;
}
.action-section-title::after {
    content: ''; flex: 1; height: 1px;
    background: var(--border-subtle);
}
.action-section.danger .action-section-title { color: rgba(var(--danger-rgb),0.6); }
.action-section.danger .action-section-title::after { background: rgba(var(--danger-rgb),0.15); }

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 6px;
}

.action-btn {
    display: flex; flex-direction: column;
    align-items: center; gap: 4px;
    padding: 12px 6px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.action-btn:hover {
    background: rgba(var(--primary-rgb),0.06);
    border-color: rgba(var(--primary-rgb),0.2);
    transform: translateY(-1px);
}
.action-btn:active { transform: scale(0.96) translateY(0); }
.action-btn .action-icon { font-size: 16px; color: var(--primary); }
.action-btn .action-label {
    font-size: 9px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.3px;
    color: var(--text-muted);
    text-align: center;
}
.action-btn.danger-action:hover {
    background: rgba(var(--danger-rgb),0.06);
    border-color: rgba(var(--danger-rgb),0.2);
}
.action-btn.danger-action .action-icon { color: var(--danger); }

/* Inline action inputs (expands below button) */
.action-inputs {
    display: none;
    padding: 12px;
    background: rgba(var(--primary-rgb),0.03);
    border: 1px solid rgba(var(--primary-rgb),0.1);
    border-radius: 8px;
    margin-top: 8px;
    animation: slideDown 0.2s cubic-bezier(0.22,1,0.36,1);
}
.action-inputs.open { display: block; }

/* ─── Health / Armor Bars ───────────────────────────────────────────────────── */
.health-bar {
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    overflow: hidden;
}
.health-bar .fill {
    height: 100%; border-radius: 4px;
    transition: width 0.5s ease;
}
.health-bar .fill.health { background: #22c55e; }
.health-bar .fill.armor { background: #3b82f6; }

/* ─── Permission Grid (accounts) ────────────────────────────────────────────── */
.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 4px;
    max-height: 250px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: rgba(0,0,0,0.2);
}

/* ─── Console ───────────────────────────────────────────────────────────────── */
.console-wrapper {
    width: 100%;
    height: calc(100vh - 200px);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow: hidden;
}
.console-input {
    display: flex; gap: 8px;
    margin-top: 10px;
}

/* ─── File Explorer ─────────────────────────────────────────────────────────── */
.file-explorer {
    display: flex; gap: 12px;
    height: calc(100vh - 200px);
}
.file-tree {
    width: 240px; min-width: 240px;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 8px;
}
.file-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.1s;
}
.file-item:hover { background: rgba(255,255,255,0.03); }
.file-item.active { background: rgba(var(--primary-rgb),0.06); color: var(--primary); }
.file-item .file-icon { font-size: 14px; width: 16px; text-align: center; flex-shrink: 0; }
.file-item .file-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-editor {
    flex: 1;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow: hidden;
}
.file-breadcrumb {
    display: flex; align-items: center; gap: 4px;
    padding: 8px 14px;
    font-size: 14px; color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(255,255,255,0.01);
}
.file-actions { display: flex; gap: 6px; margin-left: auto; }

/* ─── Map Container ─────────────────────────────────────────────────────────── */
.map-container {
    width: 100%;
    height: calc(100vh - 200px);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    background: #0d0d0d;
}

/* ─── Stream Viewer ─────────────────────────────────────────────────────────── */
.stream-viewer {
    width: 100%; aspect-ratio: 16/9;
    background: #000;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}
.stream-viewer img { width: 100%; height: 100%; object-fit: contain; }

/* ─── Toast ─────────────────────────────────────────────────────────────────── */
.toast-container {
    position: fixed; top: 60px; right: 20px;
    z-index: 9999;
    display: flex; flex-direction: column; gap: 6px;
}
.toast {
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: var(--panel-bg);
    font-size: 14px; font-weight: 500;
    display: flex; align-items: center; gap: 10px;
    min-width: 220px; max-width: 360px;
    animation: slideDown 0.25s cubic-bezier(0.22,1,0.36,1);
    cursor: pointer;
    transition: opacity 0.2s;
}
.toast.success { border-left: 3px solid #22c55e; }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--primary); }
.toast.warning { border-left: 3px solid #f59e0b; }
.toast .toast-icon { font-size: 14px; }
.toast.success .toast-icon { color: #22c55e; }
.toast.error .toast-icon { color: var(--danger); }
.toast.info .toast-icon { color: var(--primary); }
.toast.warning .toast-icon { color: #f59e0b; }

/* ─── Pagination ────────────────────────────────────────────────────────────── */
.pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 4px; padding: 12px 0;
}
.pagination button {
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.1s;
}
.pagination button:hover { background: var(--surface-hover); }
.pagination button.active {
    background: rgba(var(--primary-rgb),0.1);
    border-color: rgba(var(--primary-rgb),0.3);
    color: var(--primary);
}

/* ─── Empty State ───────────────────────────────────────────────────────────── */
.empty-state {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 40px 20px;
    text-align: center;
}
.empty-state .empty-icon { font-size: 36px; color: var(--text-disabled); margin-bottom: 12px; }
.empty-state .empty-text { font-size: 14px; color: var(--text-muted); }

/* ─── Spinner ───────────────────────────────────────────────────────────────── */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(var(--primary-rgb),0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ─── Login Page ────────────────────────────────────────────────────────────── */
.login-wrapper {
    width: 100%; height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: #080808;
}
.login-panel {
    width: 380px;
    background: var(--panel-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 36px;
    animation: scaleIn 0.3s cubic-bezier(0.22,1,0.36,1);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-text {
    font-family: var(--font-headline);
    font-size: 28px; font-weight: 800;
    letter-spacing: 4px;
    color: var(--primary);
}
.login-logo .logo-sub {
    font-size: 14px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1px;
    margin-top: 4px;
}
.login-form .form-group { margin-bottom: 16px; }
.login-form .btn-primary { width: 100%; height: 42px; margin-top: 4px; }
.login-error {
    display: none; padding: 10px;
    border-radius: 6px;
    background: rgba(var(--danger-rgb),0.08);
    border: 1px solid rgba(var(--danger-rgb),0.15);
    color: var(--danger); font-size: 14px;
    text-align: center; margin-bottom: 12px;
}
.login-error.visible { display: block; }
.login-footer { text-align: center; margin-top: 24px; font-size: 14px; color: var(--text-disabled); }

/* ─── Utility ───────────────────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 6px; }
.gap-md { gap: 12px; }
.mt-sm { margin-top: 6px; }
.mt-md { margin-top: 12px; }
.mb-md { margin-bottom: 12px; }
.text-muted { color: var(--text-muted); }
.text-primary-c { color: var(--primary); }
.text-danger { color: var(--danger); }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ═══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet & Mobile
   Breakpoints:
     ≤1024px (tablet)    sidebar narrower, less padding
     ≤768px  (mobile)    hamburger nav, sidebar = drawer, modals full-screen,
                         dock simplified, touch-sized hit areas
     ≤480px  (small)     extra tightening for narrow phones
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─── Hamburger toggle (hidden on desktop) ───────────────────────────────────── */
.cb-hamburger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: background 0.15s, color 0.15s;
    margin-right: 4px;
}
.cb-hamburger:hover { background: var(--surface-hover); color: var(--text-primary); }
.cb-hamburger i { font-size: 18px; }

/* ─── Context drawer FAB (mobile only) ──────────────────────────────────────── */
/* Floating button that opens the context-panel drawer on mobile. Hidden on
   desktop and on pages whose context panel is .collapsed (those have no
   list to show). Default-hidden; mobile media query unhides it. */
.ctx-fab {
    display: none;
    position: fixed;
    bottom: 52px;
    left: 14px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #000;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0,0,0,0.45), 0 0 12px rgba(var(--primary-rgb),0.4);
    z-index: 88;
    transition: transform 0.15s, box-shadow 0.2s;
}
.ctx-fab:active { transform: scale(0.92); }
.ctx-fab i { font-size: 16px; }

/* Backdrop shared by sidebar drawer + nav drawer */
.mobile-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 90;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s;
}
.mobile-backdrop.active { display: block; }

/* ─── Tablet (≤1024px) ─────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .context-panel {
        width: 220px;
        min-width: 220px;
    }
    .workspace { padding: 16px; }
    .cb-link { padding: 12px 10px; font-size: 13px; }
    .cb-search-trigger { padding: 6px 10px; }
    .cb-search-trigger kbd { display: none; }
}

/* ─── Mobile (≤768px) ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Show hamburger, restructure top bar for narrow space */
    .cb-hamburger { display: inline-flex; }
    .command-bar { padding: 0 12px; gap: 4px; }
    .cb-brand { margin-right: 8px; font-size: 14px; letter-spacing: 2px; }

    /* Nav becomes a slide-down drawer triggered by the hamburger */
    .cb-nav {
        position: fixed;
        top: 48px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        background: rgba(12,12,12,0.98);
        border-bottom: 1px solid var(--border-subtle);
        padding: 8px;
        gap: 2px;
        max-height: calc(100vh - 84px);
        overflow-y: auto;
        z-index: 95;
        transform: translateY(-110%);
        transition: transform 0.25s cubic-bezier(0.22,1,0.36,1);
        pointer-events: none;
    }
    .cb-nav.open {
        transform: translateY(0);
        pointer-events: auto;
    }
    .cb-link {
        padding: 14px 16px;
        border-radius: 6px;
        font-size: 14px;
        text-align: left;
    }
    /* Active underline doesn't make sense in the drawer; use left bar */
    .cb-link.active { background: rgba(var(--primary-rgb),0.1); }
    .cb-link.active::after {
        bottom: auto; left: 0; top: 8px; right: auto;
        width: 3px; height: calc(100% - 16px);
        border-radius: 0 2px 2px 0;
    }
    .cb-sep { display: none; }

    /* Right-side cluster: hide search button (use spotlight via cmd palette
       only), shrink user avatar block. */
    .cb-search-trigger { display: none; }
    .cb-user { padding: 4px; }
    .cb-user > div:not(.cb-avatar) { display: none; }
    .cb-user-menu { right: 0; min-width: 200px; }

    /* Context panel becomes a left slide-over drawer with backdrop. */
    .context-panel {
        position: fixed;
        top: 48px;
        bottom: 36px;
        left: 0;
        width: 78vw;
        max-width: 320px;
        z-index: 95;
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.22,1,0.36,1);
        background: rgba(8,8,8,0.98);
        box-shadow: 8px 0 32px rgba(0,0,0,0.5);
    }
    .context-panel.mobile-open {
        transform: translateX(0);
    }
    /* Override the desktop .collapsed state — on mobile the drawer simply
       lives in transform space, not width-collapsed. */
    .context-panel.collapsed {
        width: 78vw; min-width: 0;
        opacity: 1;
        border-right: 1px solid var(--border-subtle);
    }

    /* Workspace takes full width */
    .workspace { padding: 12px; }

    /* FAB visible on mobile by default. Pages without a context panel get
       .hidden toggled by app.js navigate() based on page.context. */
    .ctx-fab { display: inline-flex; }

    /* Status dock shrinks; hide CPU/RAM, keep player count + actions */
    .status-dock { padding: 0 12px; gap: 8px; }
    .status-dock .dock-stat:nth-child(n+3) { display: none; }
    .status-dock .dock-sep { display: none; }
    .dock-sync { display: none; }
    .dock-actions-btn span,
    .dock-actions-btn { font-size: 13px; }

    /* Modals: full screen on mobile, ditch the centered floating box */
    .modal-overlay { padding: 0; }
    .modal {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    .modal-body {
        flex: 1;
        overflow-y: auto;
        padding: 16px;
    }
    .modal-header { padding: 14px 16px; }
    .modal-footer { padding: 12px 16px; }

    /* Spotlight: full-screen overlay on mobile */
    .spotlight-overlay { padding: 0; align-items: stretch; }
    .spotlight-box {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    .spotlight-input { font-size: 16px; padding: 18px 16px; } /* 16px prevents iOS zoom */
    .spotlight-results { flex: 1; }

    /* Quick actions panel: slide from bottom, full width */
    .quick-actions-panel {
        bottom: 36px;
        right: 0;
        left: 0;
        width: auto;
        max-height: 60vh;
        border-radius: 12px 12px 0 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
    }
    .qa-grid { grid-template-columns: repeat(3, 1fr); }

    /* Touch target enforcement (Apple HIG = 44px min hit area) */
    .cb-link,
    .cb-hamburger,
    .cb-user,
    .modal-close,
    .dock-actions-btn,
    button[class*="btn"]:not(.btn-icon) {
        min-height: 40px;
    }

    /* Hover effects don't apply on touch — make active states more obvious */
    .cb-link:active { background: rgba(var(--primary-rgb),0.15); }
    .ctx-player-row:active { background: var(--surface-hover); }

    /* Tighten typography slightly */
    body { font-size: 14px; }
    .ctx-header { font-size: 13px; padding: 12px 14px 8px; }

    /* Quick action positioning: moved to bottom-sheet style */
    .quick-actions-panel { animation: slideUp 0.25s cubic-bezier(0.22,1,0.36,1); }

    /* iOS WebKit zooms inputs whose font-size is < 16px on focus.
       Bump all interactive text inputs to 16px on mobile. */
    .input-field,
    .spotlight-input,
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px;
    }

    /* Login screen: full-width panel with comfortable padding */
    .login-panel {
        width: 100%;
        max-width: 100%;
        margin: 0 12px;
        padding: 28px 22px;
        border-radius: 12px;
    }
    .login-wrapper { padding: 16px; }
    .login-logo .logo-text { font-size: 24px; }

    /* ─── Page chrome ────────────────────────────────────────────────────── */
    .page-title { font-size: 20px; }
    .page-subtitle { font-size: 13px; }
    .page-header { margin-bottom: 14px; }

    /* Stat-grids: most pages use inline grid-template-columns. Override to a
       single column on mobile — !important is required because inline wins. */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    .stat-card { padding: 14px; }
    .stat-card .stat-value { font-size: 22px; }

    /* ─── Tables ────────────────────────────────────────────────────────── */
    /* Make tables scroll horizontally inside their own box rather than
       blowing out the page width. The display:block+overflow-x:auto pattern
       turns the <table> into its own scroll container without needing each
       page to wrap it in a div. */
    .data-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-collapse: separate; /* needed when display:block */
    }
    .data-table thead, .data-table tbody { display: table; width: 100%; min-width: 480px; }
    .data-table thead th,
    .data-table tbody td {
        padding: 8px 10px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* ─── Action grid (player actions) ──────────────────────────────────── */
    /* Tighter min so 4 cols fit on a 360px screen */
    .action-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }
    .action-btn { padding: 10px 4px; }
    .action-btn .action-icon { font-size: 15px; }

    /* ─── Permission grid (accounts) ────────────────────────────────────── */
    .permission-grid {
        grid-template-columns: 1fr;
        max-height: none; /* let content flow inside scrollable workspace */
    }

    /* ─── Console / File Explorer ───────────────────────────────────────── */
    /* Account for shorter mobile chrome (no big page-header padding) */
    .console-wrapper { height: calc(100vh - 220px); min-height: 320px; }

    .file-explorer {
        flex-direction: column;
        height: auto;
    }
    .file-tree {
        width: 100%;
        min-width: 0;
        max-height: 35vh;
    }

    /* ─── Map page ──────────────────────────────────────────────────────── */
    /* The map iframe lives in #mapIframeHost (offscreen at 1200x800) and is
       projected into the active page. On mobile we need it to fit and accept
       touch gestures. The page module sets its own host dimensions; we just
       make sure the rendered iframe scales. */
    #routerView .map-host,
    #routerView iframe {
        width: 100% !important;
        max-width: 100vw;
        touch-action: manipulation;
    }

    /* ─── Modal forms ───────────────────────────────────────────────────── */
    /* Standard modals frequently use 2-col form grids inline; collapse them */
    .modal-body .form-group { margin-bottom: 14px; }
    .modal-body [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

/* ─── Touch-only refinements ────────────────────────────────────────────── */
/* Devices that primarily use touch (no mouse) get extra padding on rows */
@media (hover: none) and (pointer: coarse) {
    .ctx-player, .ctx-row, [data-id].clickable {
        padding-top: 10px;
        padding-bottom: 10px;
    }
    .data-table tbody td { padding: 12px 10px; }
}

/* ─── Small mobile (≤480px) ────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .cb-brand { letter-spacing: 1px; margin-right: 4px; }
    .qa-grid { grid-template-columns: repeat(2, 1fr); }
    .workspace { padding: 10px; }
}

/* ─── Reduced motion preference ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
