/* Mafia Pilot — TGMHub-inspired dark navy theme
   Palette: #0B1220 bg · #2672FF primary · #22c55e active · #FFD166 gold */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    color-scheme: dark;
    --bg: #0B1220;
    --bg-2: #0F1A2B;
    --surface: #132133;
    --surface-2: #18263A;
    --surface-3: #1E2C42;
    --border: rgba(255,255,255,0.06);
    --border-strong: rgba(255,255,255,0.13);
    --text: #EAF0FF;
    --text-2: #A9B6D9;
    --text-3: rgba(234,240,255,0.38);
    --accent: #2672FF;
    --accent-600: #1E5EDC;
    --accent-soft: rgba(38,114,255,0.14);
    --green: #22c55e;
    --green-soft: rgba(34,197,94,0.14);
    --green-border: rgba(34,197,94,0.5);
    --gold: #FFD166;
    --danger: #ef4444;
    --ink: #2672FF;
    --radius: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 4px 10px rgba(0,0,0,0.45);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.55);
    --glow: 0 8px 32px rgba(38,114,255,0.10);
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(180deg, #0B1220 0%, #0F1A2B 100%);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
    min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
::selection { background: rgba(38,114,255,0.35); color: var(--text); }

/* ── Sidebar ── */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 264px; background:
        radial-gradient(620px 320px at -90px -70px, rgba(38,114,255,0.16), transparent 62%),
        radial-gradient(420px 260px at 110% 115%, rgba(255,209,102,0.05), transparent 55%),
        rgba(15, 26, 43, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column; z-index: 100;
    transition: transform 0.25s ease, width 0.22s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 11px;
    padding: 20px 20px;
    font-size: 17px; font-weight: 800; letter-spacing: -0.02em;
    border-bottom: 1px solid var(--border);
    position: relative;
}
.sidebar-brand .brand-dot {
    width: 34px; height: 34px; border-radius: 11px;
    background: linear-gradient(180deg, var(--accent), var(--accent-600));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 800;
    box-shadow: 0 6px 18px rgba(38,114,255,0.4);
    flex-shrink: 0;
}
.sidebar-brand span.accent { color: var(--gold); }
.brand-badge {
    margin-left: auto;
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
    color: #4ade80; background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.28);
    padding: 3px 8px; border-radius: 999px;
    white-space: nowrap;
}
.brand-badge::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: #4ade80; box-shadow: 0 0 8px rgba(74,222,128,0.8);
    animation: brandPulse 2.2s ease-in-out infinite;
}
@keyframes brandPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
.collapse-btn {
    width: 26px; height: 26px; border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: rgba(255,255,255,0.04);
    color: var(--text-3); font-size: 11px;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    transition: all 0.12s ease; flex-shrink: 0;
}
.collapse-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.3); }
.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.sidebar-section {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 12px 8px;
    font-size: 10.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-3);
}
.sidebar-section::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.sidebar-link {
    display: flex; align-items: center; gap: 12px;
    padding: 7px 12px; margin-bottom: 3px;
    font-size: 13.5px; font-weight: 550;
    color: var(--text-2); border-radius: 12px;
    transition: all 0.12s ease; position: relative;
}
.sidebar-link .icon {
    width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
    background: rgba(255,255,255,0.05); border: 1px solid var(--border);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 15px; transition: all 0.15s ease;
}
.sidebar-link:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.sidebar-link:hover .icon { background: rgba(255,255,255,0.09); border-color: var(--border-strong); }
.sidebar-link.active {
    background: linear-gradient(180deg, rgba(38,114,255,0.22), rgba(30,94,220,0.16));
    color: #fff; font-weight: 600;
    border: 1px solid rgba(38,114,255,0.35);
    box-shadow: 0 4px 16px rgba(38,114,255,0.18), inset 0 1px 0 rgba(255,255,255,0.06);
}
.sidebar-link.active .icon {
    background: linear-gradient(180deg, var(--accent), var(--accent-600));
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(38,114,255,0.45);
}
.sidebar-link.active::before {
    content: ''; position: absolute; left: -12px; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 20px; border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, #4ade80, #22c55e);
    box-shadow: 0 0 10px rgba(34,197,94,0.6);
}
.sidebar-footer {
    padding: 14px 14px 16px; border-top: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 9px;
}
.user-card {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 13px; padding: 10px 12px;
    min-width: 0;
}
.user-avatar {
    width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
    background: linear-gradient(180deg, var(--accent), var(--accent-600));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800;
    box-shadow: 0 4px 12px rgba(38,114,255,0.35);
}
.user-meta { min-width: 0; }
.user-name { color: var(--text); font-weight: 650; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--gold); margin-top: 1px; }
.logout-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font-size: 11.5px; font-weight: 600; color: var(--text-3);
    border: 1px solid var(--border); background: rgba(255,255,255,0.02);
    cursor: pointer; padding: 8px 10px; border-radius: 10px;
    transition: all 0.12s ease; width: 100%;
}
.logout-btn:hover { color: #f87171; border-color: rgba(239,68,68,0.35); background: rgba(239,68,68,0.08); }

/* ── Collapsed rail mode (desktop) ── */
.sidebar.collapsed { width: 70px; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 20px 0; }
.sidebar.collapsed .sidebar-brand .brand-text,
.sidebar.collapsed .sidebar-brand .brand-badge,
.sidebar.collapsed .collapse-btn { display: none; }
.sidebar.collapsed .sidebar-section { justify-content: center; padding: 14px 0 8px; }
.sidebar.collapsed .sidebar-section::after { display: none; }
.sidebar.collapsed .sidebar-link { justify-content: center; padding: 8px 0; }
.sidebar.collapsed .sidebar-link .icon { width: 36px; height: 36px; font-size: 16px; }
.sidebar.collapsed .sidebar-link .link-text,
.sidebar.collapsed .user-meta,
.sidebar.collapsed .logout-btn .logout-text { display: none; }
.sidebar.collapsed .sidebar-footer { padding: 12px 10px 14px; }
.sidebar.collapsed .user-card { justify-content: center; padding: 8px; }
.sidebar.collapsed .logout-btn { padding: 9px 0; }
.sidebar.collapsed .sidebar-link.active::before { left: -12px; }

/* ── Main ── */
.main { margin-left: 264px; min-height: 100vh; display: flex; flex-direction: column; transition: margin-left 0.22s ease; }
.main.collapsed { margin-left: 70px; }

/* ── Top Bar ── */
.topbar {
    background: rgba(11, 18, 32, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 0 28px; height: 58px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ── Content ── */
.content { padding: 26px 32px 48px; flex: 1; width: 100%; }

/* ── Cards ── */
.card {
    background: var(--surface); border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm), var(--glow);
    overflow: hidden; margin-bottom: 16px;
}
.card-header {
    padding: 16px 22px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.card-body { padding: 16px 22px; }

/* ── Stats Grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
    box-shadow: var(--shadow-sm), var(--glow);
}
.stat-icon { font-size: 22px; margin-bottom: 10px; }
.stat-value { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-3); margin-top: 4px; font-weight: 500; }

/* ── Section ── */
.section { margin-bottom: 24px; }
.section-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; letter-spacing: -0.01em; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-3); text-align: left; padding: 10px 18px;
    border-bottom: 1px solid var(--border); background: var(--surface-2);
}
td { padding: 13px 18px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; border-radius: 10px;
    font-size: 13px; font-weight: 600;
    border: none; cursor: pointer; transition: all 0.12s ease;
    line-height: 1.2;
}
.btn-primary {
    background: linear-gradient(180deg, var(--accent), var(--accent-600));
    color: #fff; box-shadow: 0 4px 14px rgba(38,114,255,0.35);
}
.btn-primary:hover { background: linear-gradient(180deg, #3a82ff, var(--accent-600)); transform: translateY(-0.5px); }
.btn-primary:active { transform: translateY(1px); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; transform: translateY(-0.5px); }
.btn-success { background: var(--green); color: #062b16; font-weight: 700; }
.btn-success:hover { background: #16a34a; transform: translateY(-0.5px); }
.btn-outline {
    background: transparent; border: 1px solid var(--border-strong); color: var(--text-2);
}
.btn-outline:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 8px; }
.btn-ghost { background: transparent; color: var(--text-3); padding: 5px 9px; border-radius: 8px; }
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.05); }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.form-input {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border-strong);
    border-radius: 12px; font-size: 14px; color: var(--text);
    background: var(--surface-2); transition: border-color 0.12s, box-shadow 0.12s;
}
.form-input:focus { outline: none; border-color: var(--green-border); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.13); }
.form-input::placeholder { color: rgba(234,240,255,0.32); }
.form-select {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border-strong);
    border-radius: 12px; font-size: 14px; color: var(--text);
    background: var(--surface-2); appearance: auto; transition: border-color 0.12s, box-shadow 0.12s;
}
.form-select:focus { outline: none; border-color: var(--green-border); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.13); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Search ── */
.search-box { position: relative; }
.search-box .search-icon {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    font-size: 14px; color: var(--text-3); pointer-events: none;
}
.search-input {
    width: 100%; padding: 10px 14px 10px 38px;
    border: 1px solid var(--border-strong); border-radius: 12px;
    font-size: 14px; background: var(--surface-2); color: var(--text);
    transition: border-color 0.12s, box-shadow 0.12s;
}
.search-input:focus { outline: none; border-color: var(--green-border); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.13); }
.search-input::placeholder { color: rgba(234,240,255,0.32); }

/* ── Badges ── */
.badge {
    display: inline-flex; align-items: center; padding: 3px 10px;
    border-radius: 999px; font-size: 11px; font-weight: 600;
    border: 1px solid transparent;
}
.badge-active { background: var(--green-soft); color: #4ade80; border-color: var(--green-border); }
.badge-closed { background: var(--surface-2); color: var(--text-3); }
.badge-pending { background: rgba(255,209,102,0.12); color: #FFD166; border-color: rgba(255,209,102,0.35); }
.badge-success { background: var(--green-soft); color: #4ade80; border-color: var(--green-border); }
.badge-failed { background: rgba(239,68,68,0.12); color: #f87171; border-color: rgba(239,68,68,0.35); }

/* ── Rank Badges ── */
.rank-badge {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 2px 8px; border-radius: 6px;
    font-size: 10px; font-weight: 700; color: #fff;
}
.rank-R5 { background: #e74c3c; }
.rank-R4 { background: #e67e22; }
.rank-R3 { background: #3498db; }
.rank-R2 { background: #2ecc71; }
.rank-R1 { background: #64748b; }

/* ── Faction Tag ── */
.faction-tag {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 11px;
    font-size: 11px; font-weight: 700; color: #fff;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25);
}

/* ── Quick Nav ── */
.quick-nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.quick-item {
    display: flex; flex-direction: column; align-items: center;
    padding: 18px 8px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm), var(--glow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.quick-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.quick-icon {
    width: 48px; height: 48px; border-radius: 13px;
    background: var(--surface-2); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; margin-bottom: 10px;
}
.quick-label { font-size: 12px; font-weight: 600; color: var(--text-2); }

/* ── Faction Chips ── */
.chips { display: flex; gap: 8px; padding: 12px 0; overflow-x: auto; flex-wrap: nowrap; }
.chip {
    padding: 7px 16px; border-radius: 999px; font-size: 13px;
    font-weight: 550; color: var(--text-2);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-strong);
    white-space: nowrap; cursor: pointer; transition: all 0.12s ease;
    min-height: 38px;
}
.chip:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.25); color: var(--text); }
.chip.active {
    background: var(--green-soft); color: var(--text); font-weight: 600;
    border-color: var(--green-border);
    box-shadow: 0 6px 18px rgba(34, 197, 94, 0.10);
}
