/* ============================================================
   Payroll System — Professional Theme
   Self-hosted (layered on local Bootstrap 5). No external deps.
   ============================================================ */

:root {
    --brand:        #4f46e5;   /* indigo-600 */
    --brand-dark:   #4338ca;
    --brand-light:  #eef2ff;
    --sidebar-bg:   #0f172a;   /* slate-900 */
    --sidebar-bg2:  #1e293b;   /* slate-800 */
    --sidebar-txt:  #cbd5e1;
    --sidebar-muted:#64748b;
    --ink:          #0f172a;
    --muted:        #64748b;
    --line:         #e2e8f0;
    --bg:           #f1f5f9;
    --card:         #ffffff;
    --ok:           #16a34a;
    --warn:         #d97706;
    --danger:       #dc2626;
    --info:         #0891b2;
    --radius:       14px;
    --shadow:       0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.06);
    --shadow-sm:    0 1px 2px rgba(15,23,42,.08);
    --sidebar-w:    248px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    margin: 0;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

/* Bootstrap primary → brand indigo */
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-active-bg: var(--brand-dark); }
.text-primary { color: var(--brand) !important; }
.bg-primary { background-color: var(--brand) !important; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

/* ---------- App shell: sidebar + main ---------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg2));
    color: var(--sidebar-txt);
    position: fixed; inset: 0 auto 0 0;
    display: flex; flex-direction: column;
    z-index: 1040;
    transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 20px 16px;
    font-weight: 700; font-size: 1.15rem; color: #fff;
    letter-spacing: .2px;
}
.sidebar-brand .logo-badge {
    width: 34px; height: 34px; border-radius: 9px;
    background: linear-gradient(135deg, var(--brand), #7c3aed);
    display: grid; place-items: center; color: #fff; font-weight: 800;
    box-shadow: 0 4px 12px rgba(79,70,229,.5);
}
.sidebar-nav { padding: 8px 12px 24px; overflow-y: auto; flex: 1; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }

.nav-section {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .09em;
    color: var(--sidebar-muted); font-weight: 700;
    padding: 16px 12px 6px;
}
.sidebar-link {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; margin: 2px 0;
    border-radius: 10px; color: var(--sidebar-txt);
    text-decoration: none; font-weight: 500; font-size: .92rem;
    transition: background .15s, color .15s;
}
.sidebar-link svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.sidebar-link:hover { background: rgba(148,163,184,.12); color: #fff; }
.sidebar-link.active {
    background: var(--brand); color: #fff;
    box-shadow: 0 4px 12px rgba(79,70,229,.4);
}
.sidebar-link.active svg { opacity: 1; }

/* ---------- Main column ---------- */
.app-main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.app-topbar {
    height: 62px; background: #fff; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 14px;
    padding: 0 22px; position: sticky; top: 0; z-index: 1030;
}
.app-topbar .page-title { font-weight: 700; font-size: 1.05rem; color: var(--ink); margin: 0; }
.sidebar-toggle {
    display: none; background: none; border: 1px solid var(--line);
    border-radius: 9px; width: 40px; height: 40px; cursor: pointer;
}
.topbar-spacer { flex: 1; }
.user-chip {
    display: flex; align-items: center; gap: 9px; padding: 5px 8px 5px 5px;
    border: 1px solid var(--line); border-radius: 999px; background: #fff;
    cursor: pointer; color: var(--ink); font-weight: 600; font-size: .88rem;
}
.user-chip .avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), #7c3aed); color: #fff;
    display: grid; place-items: center; font-weight: 700; font-size: .8rem;
}
.user-chip .role { color: var(--muted); font-weight: 500; font-size: .78rem; }

.app-content { padding: 26px 26px 60px; flex: 1; }
.app-content > h1, .app-content > h2 { font-weight: 700; letter-spacing: -.01em; margin-bottom: 4px; }

/* ---------- Cards ---------- */
.card {
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); background: var(--card);
}
.card-header {
    background: #fff; border-bottom: 1px solid var(--line);
    font-weight: 650; font-weight: 600; padding: 14px 18px; border-radius: var(--radius) var(--radius) 0 0 !important;
}
.card-body { padding: 18px; }

/* ---------- Stat tiles (dashboard) ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; margin-bottom: 26px; }
.stat-tile {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat-tile .stat-label { color: var(--muted); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-tile .stat-value { font-size: 2rem; font-weight: 750; font-weight: 700; margin-top: 4px; color: var(--ink); }
.stat-tile .stat-ico {
    position: absolute; top: 16px; right: 16px; width: 42px; height: 42px; border-radius: 11px;
    display: grid; place-items: center; color: #fff;
}
.stat-tile.i-brand .stat-ico { background: var(--brand); }
.stat-tile.i-ok    .stat-ico { background: var(--ok); }
.stat-tile.i-warn  .stat-ico { background: var(--warn); }
.stat-tile.i-info  .stat-ico { background: var(--info); }
.stat-ico svg { width: 22px; height: 22px; }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; color: var(--ink); margin: 0; }
.table thead th {
    background: #f8fafc; color: var(--muted); font-weight: 650; font-weight: 600;
    text-transform: uppercase; font-size: .74rem; letter-spacing: .04em;
    border-bottom: 1px solid var(--line); padding: 11px 14px; white-space: nowrap;
}
.table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: var(--brand-light); }
.table-responsive, .card > .table-responsive { border-radius: var(--radius); }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; font-size: .85rem; color: #334155; margin-bottom: 5px; }
.form-control, .form-select {
    border: 1px solid #cbd5e1; border-radius: 10px; padding: 9px 12px; font-size: .92rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}

/* ---------- Buttons ---------- */
.btn { border-radius: 10px; font-weight: 600; font-size: .9rem; padding: 8px 16px; }
.btn-sm { padding: 5px 11px; font-size: .82rem; border-radius: 8px; }

/* ---------- Badges / alerts ---------- */
.badge { font-weight: 600; padding: .4em .65em; border-radius: 7px; }
.alert { border: none; border-radius: 12px; padding: 13px 16px; box-shadow: var(--shadow-sm); }
.alert-success { background: #dcfce7; color: #166534; }
.alert-danger  { background: #fee2e2; color: #991b1b; }
.alert-info    { background: #e0f2fe; color: #075985; }
.alert-warning { background: #fef3c7; color: #92400e; }

/* ---------- Dropdown ---------- */
.dropdown-menu { border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.dropdown-item { border-radius: 8px; padding: 8px 12px; font-size: .9rem; }
.dropdown-item:active { background: var(--brand); }

/* ---------- Login page ---------- */
.auth-wrap {
    min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background: radial-gradient(1200px 600px at 10% -10%, #312e81 0%, transparent 55%),
                radial-gradient(1000px 600px at 110% 110%, #4f46e5 0%, transparent 50%),
                #0f172a;
}
.auth-card {
    width: 100%; max-width: 400px; background: #fff; border-radius: 18px;
    box-shadow: 0 20px 60px rgba(2,6,23,.5); padding: 34px 32px;
}
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.auth-brand .logo-badge {
    width: 42px; height: 42px; border-radius: 11px;
    background: linear-gradient(135deg, var(--brand), #7c3aed);
    display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.1rem;
    box-shadow: 0 6px 16px rgba(79,70,229,.45);
}
.auth-brand .t1 { font-weight: 750; font-weight: 700; font-size: 1.1rem; line-height: 1.1; }
.auth-brand .t2 { color: var(--muted); font-size: .8rem; }
.auth-card h1 { font-size: 1.3rem; font-weight: 700; margin: 0 0 4px; }
.auth-card .sub { color: var(--muted); font-size: .9rem; margin-bottom: 22px; }
.btn-block { width: 100%; }

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .sidebar-toggle { display: grid; place-items: center; }
    .sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(2,6,23,.5); z-index: 1035; }
    .sidebar-backdrop.show { display: block; }
}
