/* ─────────────────────────────────────────────
   SGCM · Neumorphic Design System
   Palette: #e8ecf1 base · #1e3a8a navy · #f59e0b amber
───────────────────────────────────────────── */
:root {
    --nm-bg:       #e8ecf1;
    --nm-surface:  #eef1f6;
    --nm-shadow-d: #c5cad4;
    --nm-shadow-l: #ffffff;
    --nm-raised:   8px 8px 16px var(--nm-shadow-d), -8px -8px 16px var(--nm-shadow-l);
    --nm-inset:    inset 5px 5px 10px var(--nm-shadow-d), inset -5px -5px 10px var(--nm-shadow-l);
    --nm-raised-sm:4px 4px 8px var(--nm-shadow-d), -4px -4px 8px var(--nm-shadow-l);
    --nm-inset-sm: inset 3px 3px 6px var(--nm-shadow-d), inset -3px -3px 6px var(--nm-shadow-l);

    --primary:     #1e3a8a;
    --primary-mid: #2563eb;
    --accent:      #f59e0b;
    --success:     #10b981;
    --danger:      #ef4444;
    --text-main:   #1e293b;
    --text-muted:  #64748b;
    --radius-lg:   20px;
    --radius-md:   14px;
    --radius-sm:   10px;
    --radius-xs:   7px;
}

/* ── Reset ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--nm-bg);
    color: var(--text-main);
    line-height: 1.5;
    font-size: 14px;
}

/* ── Layout ─────────────────────────────────── */
.app-container { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────── */
.sidebar {
    width: 252px;
    background: var(--nm-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 4px 0 20px rgba(197, 202, 212, 0.5);
    position: relative;
    z-index: 10;
}
.sidebar-header {
    padding: 1.5rem 1.25rem;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.3px;
}
.sidebar-header span:first-child { font-size: 1.4rem; }

.sidebar-nav {
    padding: 0.5rem 0.875rem;
    flex: 1;
    overflow-y: auto;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--nm-shadow-d); border-radius: 4px; }

.nav-group { margin-bottom: 1rem; }
.nav-group-header {
    padding: 0.4rem 0.75rem 0.3rem;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0.7rem 0.875rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    border-radius: var(--radius-md);
    margin-bottom: 3px;
    transition: all 0.22s ease;
    position: relative;
}
.nav-item span:first-child { font-size: 1rem; width: 22px; text-align: center; flex-shrink: 0; }
.nav-item:hover {
    color: var(--primary);
    background: var(--nm-bg);
    box-shadow: var(--nm-raised-sm);
}
.nav-item.active {
    color: var(--primary);
    font-weight: 700;
    box-shadow: var(--nm-inset-sm);
    background: var(--nm-bg);
}
.nav-item.active span:first-child { color: var(--accent); }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(197, 202, 212, 0.4);
}
.sidebar-role-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--nm-raised-sm);
}

/* ── Main Content ─────────────────────────── */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background: var(--nm-bg);
}

/* ── Top Header ─────────────────────────────── */
.top-header {
    height: 66px;
    background: var(--nm-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    box-shadow: 0 4px 14px rgba(197, 202, 212, 0.45);
    position: sticky;
    top: 0;
    z-index: 9;
}
.top-header > div:first-child {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--primary);
    letter-spacing: -0.2px;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}
.lang-switcher select {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--nm-bg);
    color: var(--text-main);
    font-size: 13px;
    cursor: pointer;
    box-shadow: var(--nm-raised-sm);
    outline: none;
}
.lang-switcher select:focus { box-shadow: var(--nm-inset-sm); }

/* ── User Badge ─────────────────────────────── */
.user-badge { display: flex; align-items: center; gap: 10px; }
.badge-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--nm-bg);
    color: var(--primary);
    font-weight: 800;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--nm-raised-sm);
}
.badge-role {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    color: var(--primary);
    background: var(--nm-bg);
    font-weight: 600;
    box-shadow: var(--nm-raised-sm);
}

/* ── Content Body ─────────────────────────── */
.content-body { padding: 2rem; flex: 1; }

/* ── Card (Neumorphic Raised) ───────────────── */
.card {
    background: var(--nm-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--nm-raised);
    margin-bottom: 1.5rem;
    border: none;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}
.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
}

/* ── Metrics Grid ─────────────────────────── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}
.metric-card {
    background: var(--nm-bg);
    border-radius: var(--radius-lg);
    padding: 1.4rem 1.25rem;
    box-shadow: var(--nm-raised);
    transition: box-shadow 0.25s;
    position: relative;
    overflow: hidden;
}
.metric-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}
.metric-card:hover { box-shadow: var(--nm-inset); }
.metric-title {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-left: 0.5rem;
}
.metric-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin-top: 8px;
    padding-left: 0.5rem;
    letter-spacing: -1px;
}

/* ── Quick Desk (Action Bar) ─────────────── */
.quick-desk {
    display: flex;
    gap: 0.875rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

/* ── Action Buttons ─────────────────────── */
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--nm-bg);
    color: var(--primary);
    padding: 10px 18px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    border: none;
    cursor: pointer;
    transition: all 0.22s ease;
    box-shadow: var(--nm-raised-sm);
}
.action-btn:hover {
    box-shadow: var(--nm-raised);
    color: var(--primary-mid);
}
.action-btn:active {
    box-shadow: var(--nm-inset-sm);
    color: var(--primary);
}
/* Primary variant */
.action-btn:not(.secondary) {
    background: var(--primary);
    color: #fff;
    box-shadow: 4px 4px 10px rgba(30, 58, 138, 0.35), -2px -2px 8px rgba(255,255,255,0.8);
}
.action-btn:not(.secondary):hover {
    background: var(--primary-mid);
    box-shadow: 6px 6px 14px rgba(37, 99, 235, 0.4), -2px -2px 8px rgba(255,255,255,0.6);
}
.action-btn:not(.secondary):active {
    box-shadow: inset 3px 3px 8px rgba(30, 58, 138, 0.5);
}
.action-btn.secondary {
    background: var(--nm-bg);
    color: var(--text-main);
}

/* ── Tables ──────────────────────────────── */
.table-responsive { overflow-x: auto; border-radius: var(--radius-md); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
th {
    background: var(--nm-bg);
    text-align: left;
    padding: 12px 14px;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--nm-shadow-d);
}
td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(197, 202, 212, 0.35);
    color: var(--text-main);
}
tr:hover td { background: rgba(255,255,255,0.5); }

/* ── Forms ──────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--nm-bg);
    color: var(--text-main);
    box-shadow: var(--nm-inset-sm);
    transition: box-shadow 0.2s;
    outline: none;
}
.form-control:focus {
    box-shadow: var(--nm-inset), 0 0 0 2px rgba(30, 58, 138, 0.12);
}
.form-control::placeholder { color: #a0adb8; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ── Alerts ─────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--nm-raised-sm);
}
.alert-danger  { background: var(--nm-bg); color: #b91c1c; }
.alert-success { background: var(--nm-bg); color: #15803d; }
.alert-info    { background: var(--nm-bg); color: var(--primary); }

/* ── Badges ─────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: var(--nm-raised-sm);
}

/* ── Neumorphic Icon Button ─────────────── */
.nm-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--nm-bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: var(--nm-raised-sm);
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    color: var(--primary);
    text-decoration: none;
}
.nm-icon-btn:hover { box-shadow: var(--nm-raised); }
.nm-icon-btn:active { box-shadow: var(--nm-inset-sm); }

/* ── Progress Bar (Neumorphic) ──────────── */
.nm-progress-wrap {
    background: var(--nm-bg);
    border-radius: 30px;
    box-shadow: var(--nm-inset-sm);
    height: 8px;
    overflow: hidden;
    margin-top: 8px;
}
.nm-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-mid) 100%);
    border-radius: 30px;
    transition: width 0.5s ease;
}
.nm-progress-bar.accent {
    background: linear-gradient(90deg, var(--accent) 0%, #fbbf24 100%);
}

/* ── Toggle / Pill ──────────────────────── */
.nm-toggle {
    width: 52px; height: 28px;
    border-radius: 30px;
    background: var(--nm-bg);
    box-shadow: var(--nm-inset-sm);
    position: relative;
    cursor: pointer;
    border: none;
    display: inline-block;
}
.nm-toggle::after {
    content: '';
    position: absolute;
    top: 4px; left: 4px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--nm-bg);
    box-shadow: var(--nm-raised-sm);
    transition: left 0.2s;
}
.nm-toggle.on::after { left: 28px; background: var(--accent); }
.nm-toggle.on { box-shadow: var(--nm-inset); }

/* ── Role Switcher Dropdown ─────────────── */
.role-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--nm-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--nm-raised);
    z-index: 9999;
    min-width: 215px;
    overflow: hidden;
    padding: 6px;
}
.role-dropdown.open { display: block; }
.role-dropdown-item {
    display: block;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.18s;
}
.role-dropdown-item:hover {
    background: var(--nm-bg);
    box-shadow: var(--nm-inset-sm);
    color: var(--primary);
}
.role-dropdown-item.current {
    background: var(--nm-bg);
    box-shadow: var(--nm-inset-sm);
    color: var(--primary);
    font-weight: 700;
}

/* ── Stat Bar Chart (Neumorphic) ────────── */
.nm-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 90px;
}
.nm-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.nm-bar-track {
    width: 100%;
    border-radius: 30px;
    background: var(--nm-bg);
    box-shadow: var(--nm-inset-sm);
    position: relative;
    overflow: hidden;
    flex: 1;
}
.nm-bar-fill {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(0deg, var(--primary) 0%, var(--primary-mid) 100%);
    border-radius: 30px;
    transition: height 0.6s ease;
}
.nm-bar-fill.accent {
    background: linear-gradient(0deg, var(--accent) 0%, #fbbf24 100%);
}
.nm-bar-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-align: center; }
.nm-bar-pct   { font-size: 11px; font-weight: 700; color: var(--primary); }

/* ── Code / Pre ─────────────────────────── */
code, pre {
    font-family: "Fira Code", "JetBrains Mono", monospace;
    font-size: 12.5px;
    background: var(--nm-bg);
    padding: 1px 6px;
    border-radius: 4px;
    box-shadow: var(--nm-inset-sm);
}

/* ── Status Badges ──────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: var(--nm-raised-sm);
    color: var(--text-muted);
}
.status-badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.7;
}
.status-badge.won   { color: var(--success); }
.status-badge.lost  { color: var(--danger); }
.status-badge.open  { color: var(--primary); }
.status-badge.warn  { color: var(--accent); }

/* ── Scrollbar ───────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--nm-bg); }
::-webkit-scrollbar-thumb { background: var(--nm-shadow-d); border-radius: 6px; }

