:root {
    /* Shineplus brand colors */
    --primary: #1e3a5f;        /* Navy blue from logo */
    --primary-dark: #152b48;
    --primary-light: #dce8f5;
    --accent: #e8001d;         /* Red from logo */
    --accent-light: #fde8eb;
    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --info: #0891b2;
    --info-light: #cffafe;

    /* Sidebar */
    --sidebar-bg: #0d1e33;
    --sidebar-hover: #1a2f4a;
    --sidebar-active: #e8001d;
    --sidebar-text: #8fa8c4;
    --sidebar-width: 248px;

    /* Layout */
    --topbar-height: 62px;
    --bg: #f0f4f8;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #1a2b3c;
    --text-muted: #64748b;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

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

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: width .22s ease;
    overflow: hidden;
    box-shadow: 2px 0 12px rgba(0,0,0,.15);
}
.sidebar.collapsed { width: 62px; }
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .user-name,
.sidebar.collapsed .user-role { display: none; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 14px 0; }
.sidebar.collapsed .sidebar-logo { width: 36px; height: 36px; }
.sidebar.collapsed .sidebar-footer { justify-content: center; }
.sidebar.collapsed .logout-btn { margin: 0; }

/* Brand area */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    min-height: 70px;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 8px;
    flex-shrink: 0;
    background: #fff;
    padding: 2px;
}
.sidebar-brand-text { display: flex; flex-direction: column; }
.brand-ams {
    font-size: 18px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: .04em;
    line-height: 1.1;
}
.brand-sub {
    font-size: 10px;
    color: var(--sidebar-text);
    letter-spacing: .03em;
    white-space: nowrap;
}

/* Nav */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #2a4a6a; border-radius: 2px; }

.nav-section {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .1em;
    color: #3d6080;
    text-transform: uppercase;
    padding: 14px 16px 4px;
    white-space: nowrap;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 7px;
    margin: 1px 8px;
    transition: all .14s;
    white-space: nowrap;
    font-size: 13.5px;
    font-weight: 500;
}
.nav-item i { width: 18px; text-align: center; flex-shrink: 0; font-size: 14px; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(232,0,29,.35);
}
.nav-item.active i { color: #fff; }

/* Footer */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,.07);
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 60px;
}
.user-info { display: flex; align-items: center; gap: 8px; flex: 1; overflow: hidden; }
.user-info > i { font-size: 24px; color: #3d6080; flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #e2e8f0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11px; color: var(--sidebar-text); }
.logout-btn { color: #3d6080; text-decoration: none; padding: 7px; border-radius: 6px; flex-shrink: 0; transition: all .14s; }
.logout-btn:hover { color: var(--accent); background: rgba(232,0,29,.15); }

/* ── Main ─────────────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left .22s ease;
}
.main-content.expanded { margin-left: 62px; }

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 22px;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}
.menu-toggle {
    background: none; border: none; cursor: pointer;
    font-size: 18px; color: var(--text-muted);
    padding: 7px; border-radius: 6px; flex-shrink: 0;
    transition: all .14s;
}
.menu-toggle:hover { background: var(--bg); color: var(--primary); }
.topbar-brand-mobile { display: none; align-items: center; gap: 6px; }
.page-title { font-size: 15px; font-weight: 600; flex: 1; color: var(--text-muted); }
.date-display { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }

/* Content */
.content-area { padding: 22px; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.card-title { font-size: 14.5px; font-weight: 700; color: var(--text); }

/* ── Stat cards ─────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 16px 18px;
    display: flex; align-items: center; gap: 14px;
    box-shadow: var(--shadow);
    transition: box-shadow .15s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-icon {
    width: 46px; height: 46px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; flex-shrink: 0;
}
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.cyan { background: var(--info-light); color: var(--info); }
.stat-icon.navy { background: #dce8f5; color: var(--primary); }
.stat-icon.accent { background: var(--accent-light); color: var(--accent); }

.stat-label { font-size: 11.5px; color: var(--text-muted); margin-bottom: 3px; font-weight: 500; }
.stat-value { font-size: 21px; font-weight: 800; line-height: 1.1; }
.stat-value.green { color: var(--success); }
.stat-value.red { color: var(--danger); }
.stat-value.blue { color: var(--primary); }
.stat-value.accent { color: var(--accent); }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    background: #f7f9fc;
    font-size: 11.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted);
    padding: 10px 14px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 1px solid #f0f4f8; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f7f9fc; }
tr.low-stock td { background: #fff8f0; }
tr.low-stock:hover td { background: #fef3c7; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 20px;
    font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info    { background: var(--info-light);    color: var(--info); }
.badge-secondary { background: #f1f5f9; color: #64748b; }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-accent  { background: var(--accent-light);  color: var(--accent); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 16px; border-radius: 6px; border: none;
    cursor: pointer; font-size: 13.5px; font-weight: 600;
    text-decoration: none; transition: all .14s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent  { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #c4001a; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #b91c1c; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #b45309; }
.btn-secondary { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-icon { padding: 6px 9px; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.form-group input,
.form-group select,
.form-group textarea {
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 6px; font-size: 14px;
    color: var(--text); background: #fff;
    transition: border .14s; outline: none; width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,58,95,.1);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-actions {
    display: flex; gap: 10px; margin-top: 22px;
    padding-top: 16px; border-top: 1px solid var(--border);
}

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px; border-radius: var(--radius);
    margin-bottom: 16px; font-size: 13.5px;
    display: flex; align-items: center; gap: 10px;
}
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #86efac; }
.alert-danger,
.alert-error   { background: var(--danger-light);  color: var(--danger);  border: 1px solid #fca5a5; }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #fcd34d; }

/* ── Login page ─────────────────────────────────────────────── */
.login-page {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
    background: linear-gradient(145deg, #0d1e33 0%, #1e3a5f 60%, #2a1010 100%);
}
.login-box {
    background: #fff; border-radius: 14px;
    padding: 40px; width: 100%; max-width: 420px;
    box-shadow: 0 24px 64px rgba(0,0,0,.35);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { width: 90px; height: 90px; object-fit: contain; margin-bottom: 10px; }
.login-logo h1 { font-size: 26px; font-weight: 900; color: var(--primary); letter-spacing: .04em; }
.login-logo .ams-tagline { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.login-logo .company-name { font-size: 14px; font-weight: 600; color: var(--accent); margin-top: 4px; }

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
    display: flex; align-items: center;
    justify-content: space-between; margin-bottom: 20px;
}
.page-header h2 { font-size: 20px; font-weight: 800; color: var(--text); }
.breadcrumb { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ── Filters bar ─────────────────────────────────────────────── */
.filters-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters-bar .form-group { margin: 0; }
.filters-bar label { font-size: 12px; }
.filters-bar input, .filters-bar select { padding: 6px 10px; font-size: 13px; }

/* ── Summary row ─────────────────────────────────────────────── */
.summary-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.summary-item {
    background: var(--bg);
    border-radius: 8px; padding: 10px 18px;
    border: 1px solid var(--border);
    min-width: 140px;
}
.summary-item .s-label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.summary-item .s-value { font-size: 19px; font-weight: 800; margin-top: 2px; }

/* ── Utility ─────────────────────────────────────────────────── */
.amount-positive { color: var(--success); font-weight: 700; }
.amount-negative { color: var(--danger);  font-weight: 700; }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-muted   { color: var(--text-muted); }
.fw-bold      { font-weight: 700; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2        { gap: 8px; }
.mt-1         { margin-top: 8px; }
.mt-2         { margin-top: 16px; }

.empty-state  { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state i { font-size: 40px; margin-bottom: 12px; opacity: .35; display: block; }
.empty-state p { font-size: 15px; }

/* ── Salary slip accent ──────────────────────────────────────── */
.slip-accent { color: var(--accent); }

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: var(--sidebar-width) !important; }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content { margin-left: 0 !important; }
    .topbar-brand-mobile { display: flex; }
    .page-title { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid  { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .content-area { padding: 14px; }
}

/* ── Print ───────────────────────────────────────────────────── */
@media print {
    .sidebar, .topbar, .btn, .filters-bar, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content-area { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}
