/* =========================================================
   Ahuja Steels ERP — Design tokens
   Palette grounded in the material: graphite + steel-blue,
   with a restrained ember accent for primary actions.
   ========================================================= */
:root {
    --sidebar-width: 260px;

    /* Core palette */
    --graphite-950: #0f1419;
    --graphite-900: #161c24;
    --graphite-800: #1f2733;
    --graphite-700: #2c3644;
    --steel-600: #3a5a78;
    --steel-500: #4a7096;
    --steel-100: #eaf1f6;
    --slate-600: #5b6472;
    --slate-400: #8993a1;
    --slate-200: #dde2e8;
    --cloud-50: #f6f8fa;
    --cloud-0: #ffffff;

    /* Accent — used sparingly: primary buttons, active states, key numbers */
    --ember-500: #d97706;
    --ember-600: #b8620a;
    --ember-100: #fdf1e2;

    /* Functional */
    --success-600: #15803d;
    --success-100: #e7f6ec;
    --danger-600: #c0392b;
    --danger-100: #fbe9e7;
    --warning-600: #b8620a;

    --radius: 10px;
    --radius-sm: 7px;
    --shadow-sm: 0 1px 2px rgba(15, 20, 25, 0.06);
    --shadow-md: 0 4px 16px rgba(15, 20, 25, 0.08);
    --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

body {
    background-color: var(--cloud-50);
    font-family: var(--font-sans);
    color: var(--graphite-900);
    font-feature-settings: "tnum" 1, "cv05" 1;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--graphite-950);
}

table, .amount, .stat-value {
    font-variant-numeric: tabular-nums;
}

a { color: var(--steel-600); text-decoration: none; }
a:hover { color: var(--steel-500); }

/* ---------- Login ---------- */
.login-body {
    background:
        radial-gradient(circle at 15% 20%, rgba(217, 119, 6, 0.10), transparent 40%),
        linear-gradient(160deg, var(--graphite-950) 0%, var(--graphite-800) 55%, var(--steel-600) 130%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

.login-mark {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--steel-600), var(--ember-500));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0 auto 0.75rem;
}

/* ---------- App shell ---------- */
.app-wrapper { min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--graphite-950);
    color: #fff;
    min-height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    border-right: 1px solid rgba(255,255,255,.06);
}

.sidebar-brand {
    border-bottom: 1px solid rgba(255,255,255,.08);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.sidebar-brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--steel-600), var(--ember-500));
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.sidebar-brand strong {
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.1;
}

.sidebar .nav-link {
    color: rgba(255,255,255,.68);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1px;
    border-left: 2px solid transparent;
    transition: background .12s ease, color .12s ease;
}

.sidebar .nav-link i { opacity: .85; width: 18px; text-align: center; }

.sidebar .nav-link:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
}

.sidebar .nav-link.active {
    background: rgba(217, 119, 6, 0.14);
    color: #fff;
    border-left-color: var(--ember-500);
}

.nav-section-label {
    color: rgba(255,255,255,.32);
    text-transform: uppercase;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    padding: 0.9rem 0.75rem 0.3rem;
}

.app-content { min-width: 0; }

.topbar {
    background: var(--cloud-0);
    height: 60px;
    border-bottom: 1px solid var(--slate-200);
    position: sticky;
    top: 0;
    z-index: 10;
}

.page-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--graphite-950);
}

/* ---------- Cards ---------- */
.card {
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--cloud-0);
}

.stat-card {
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--steel-100);
    color: var(--steel-600);
    font-size: 1rem;
    margin-bottom: 0.6rem;
}

.stat-card .stat-value {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--graphite-950);
    letter-spacing: -0.01em;
}

.stat-card .text-muted { color: var(--slate-600) !important; font-size: 0.82rem; }

/* ---------- Tables ---------- */
.table {
    --bs-table-hover-bg: var(--cloud-50);
}

.table thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    color: var(--slate-600);
    border-bottom: 1px solid var(--slate-200);
    background: var(--cloud-50);
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.table td { color: var(--graphite-900); vertical-align: middle; }
.table-hover tbody tr:hover { background-color: var(--cloud-50); }

/* ---------- Buttons ---------- */
.btn {
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
}

.btn-dark {
    background: linear-gradient(135deg, var(--graphite-800), var(--steel-600));
    border: none;
}
.btn-dark:hover {
    background: linear-gradient(135deg, var(--steel-600), var(--ember-500));
}

.btn-outline-secondary {
    border-color: var(--slate-200);
    color: var(--graphite-900);
}
.btn-outline-secondary:hover {
    background: var(--cloud-50);
    border-color: var(--slate-400);
    color: var(--graphite-950);
}

/* ---------- Forms ---------- */
.form-control, .form-select {
    border-color: var(--slate-200);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--steel-500);
    box-shadow: 0 0 0 3px rgba(74, 112, 150, 0.15);
}
.form-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--graphite-900);
    margin-bottom: 0.3rem;
}

/* ---------- Badges ---------- */
.badge { font-weight: 500; font-size: 0.72rem; padding: 0.35em 0.65em; border-radius: 999px; }
.badge.bg-success { background-color: var(--success-100) !important; color: var(--success-600) !important; }
.badge.bg-secondary { background-color: var(--slate-200) !important; color: var(--slate-600) !important; }
.badge.bg-danger { background-color: var(--danger-100) !important; color: var(--danger-600) !important; }
.badge.bg-warning { background-color: var(--ember-100) !important; color: var(--warning-600) !important; }

/* ---------- Ledger colors ---------- */
.text-danger { color: var(--danger-600) !important; }
.text-success { color: var(--success-600) !important; }

/* ---------- Alerts ---------- */
.alert { border: none; border-radius: var(--radius-sm); font-size: 0.9rem; }
.alert-success { background: var(--success-100); color: var(--success-600); }
.alert-danger { background: var(--danger-100); color: var(--danger-600); }
.alert-warning { background: var(--ember-100); color: var(--warning-600); }

/* ---------- Nav pills (product sub-tabs etc.) ---------- */
.nav-pills .nav-link {
    color: var(--slate-600);
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
}
.nav-pills .nav-link.active {
    background: var(--graphite-950);
    color: #fff;
}

/* ---------- Responsive sidebar ---------- */
@media (max-width: 767.98px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        z-index: 1050;
        transition: left .2s ease-in-out;
        box-shadow: 4px 0 24px rgba(0,0,0,.25);
    }
    .sidebar.show { left: 0; }
}

/* ---------- Focus visibility (accessibility) ---------- */
a:focus-visible, button:focus-visible, .btn:focus-visible {
    outline: 2px solid var(--steel-500);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
