/* ===== Layout ===== */
:root {
    --sidebar-width: 250px;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --primary: #2563eb;
    --page-bg: #f1f5f9;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--page-bg);
    color: #0f172a;
}

.wrapper { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #cbd5e1;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: transform .25s ease;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px 18px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #334155;
    position: sticky;
    top: 0;
    background: var(--sidebar-bg);
    z-index: 1;
}

.sidebar .nav { padding: 8px 0 20px; flex-grow: 1; }

.sidebar .nav-section {
    list-style: none;
    padding: 14px 20px 6px;
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 600;
}

.sidebar .nav-link {
    color: #cbd5e1;
    padding: 9px 20px;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background .15s, color .15s;
}

.sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar .nav-link.active {
    background: rgba(37, 99, 235, 0.25);
    color: #fff;
    border-left: 3px solid var(--primary);
    padding-left: 17px;
}

.sidebar .nav-link i { font-size: 1.05rem; width: 1.25rem; text-align: center; }

.sidebar-footer {
    padding: 12px 20px;
    color: #64748b;
    border-top: 1px solid #334155;
}

/* ===== Main content ===== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    transition: margin-left .25s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: #fff;
    padding: 12px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* ===== Stat cards ===== */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    border-left: 4px solid;
}

.stat-blue   { border-left-color: #2563eb; }
.stat-green  { border-left-color: #16a34a; }
.stat-orange { border-left-color: #d97706; }
.stat-purple { border-left-color: #7c3aed; }
.stat-teal   { border-left-color: #0d9488; }
.stat-slate  { border-left-color: #475569; }
.stat-rose   { border-left-color: #e11d48; }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.stat-blue   .stat-icon { background: #dbeafe; color: #2563eb; }
.stat-green  .stat-icon { background: #dcfce7; color: #16a34a; }
.stat-orange .stat-icon { background: #fef3c7; color: #d97706; }
.stat-purple .stat-icon { background: #ede9fe; color: #7c3aed; }
.stat-teal   .stat-icon { background: #ccfbf1; color: #0d9488; }
.stat-slate  .stat-icon { background: #e2e8f0; color: #475569; }
.stat-rose   .stat-icon { background: #ffe4e6; color: #e11d48; }

.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; color: #1e293b; }
.stat-label { color: #64748b; font-size: .85rem; }
.stat-sub   { color: #94a3b8; font-size: .75rem; }

/* ===== Cards ===== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    padding: 14px 18px;
}

.empty-state { font-size: .95rem; }

/* ===== Status badges ===== */
.badge.status-active,
.badge.status-completed,
.badge.status-accepted,
.badge.status-paid,
.badge.status-won,
.badge.status-qualified { background: #dcfce7; color: #15803d; }
.badge.status-inactive,
.badge.status-draft,
.badge.status-void { background: #f1f5f9; color: #64748b; }
.badge.status-pending,
.badge.status-sent,
.badge.status-proposal,
.badge.status-contacted { background: #fef3c7; color: #b45309; }
.badge.status-shipped,
.badge.status-new { background: #dbeafe; color: #1d4ed8; }
.badge.status-cancelled,
.badge.status-rejected,
.badge.status-lost { background: #fee2e2; color: #b91c1c; }

.pipeline-filters { display: flex; flex-wrap: wrap; gap: .35rem; }

/* ===== Spreadsheet cells ===== */
.cell-edit:hover {
    background: #eff6ff;
    outline: 2px solid #2563eb;
    outline-offset: -2px;
}

/* ===== Login ===== */
.login-page {
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(37, 99, 235, 0.18), transparent 50%),
        radial-gradient(ellipse at 80% 0%, rgba(15, 23, 42, 0.35), transparent 45%),
        linear-gradient(160deg, #0f172a 0%, #1e293b 45%, #334155 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.login-shell { width: 100%; max-width: 420px; }
.login-panel {
    background: #fff;
    border-radius: 16px;
    padding: 36px 32px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.login-brand {
    text-align: center;
    margin-bottom: 28px;
}
.login-brand i {
    font-size: 2rem;
    color: var(--primary);
}
.login-brand h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 10px 0 4px;
    color: #0f172a;
}
.login-brand p { color: #64748b; margin: 0; font-size: .9rem; }
.login-hint { color: #64748b; font-size: .8rem; text-align: center; }

.btn.loading { pointer-events: none; opacity: .7; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
}
