/* ══════════════════════════════════════════════════════════════════
   LAYOUT SHELL — header + labelled sidebar + breadcrumb + content
   ══════════════════════════════════════════════════════════════════ */

:root {
    --hdr-h: 58px;
    --side-w: 232px;
    --side-bg: #0f172a;
    --side-bg-2: #111c33;
    --side-text: #cbd5e1;
    --side-text-dim: #94a3b8;
    --side-hover: rgba(255,255,255,.05);
    --side-border: rgba(255,255,255,.06);
    --accent: #3b82f6;
    --accent-soft: rgba(59,130,246,.18);
}

/* ── Fixed top header ───────────────────────────────────────────── */
.app-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--hdr-h);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(15,23,42,.04);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 16px;
    z-index: 1050;
    min-width: 0;          /* allow flex children to shrink */
}
.hdr-left {
    display: flex; align-items: center; gap: 10px;
    flex-shrink: 0;        /* keep logo visible */
    min-width: 0;
}
.sidebar-toggle {
    background: transparent; border: none;
    width: 38px; height: 38px;
    border-radius: 8px;
    color: #475569; font-size: 17px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
}
.sidebar-toggle:hover { background: #f1f5f9; }

/* ── Digital Wolf brand: small square mark + text ──────────────────── */
.ps-brand {
    display: inline-flex; align-items: center; gap: 10px;
    text-decoration: none !important;
    flex-shrink: 0;
}
.ps-brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    background: #000000;
    border-radius: 9px;
    box-shadow: 0 3px 8px rgba(0,0,0,.25);
    flex-shrink: 0;
}
.ps-brand-mark::before {
    content: 'DW';
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    font-size: 13px;
    color: #ffffff;
    letter-spacing: -.3px;
}
.ps-brand-name {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: #0f172a;
    letter-spacing: -.2px;
    white-space: nowrap;
}
.ps-brand:hover .ps-brand-mark { box-shadow: 0 4px 12px rgba(0,0,0,.4); }

/* Larger version on login page */
.ps-login-brand {
    display: inline-flex; align-items: center; justify-content: center; gap: 12px;
    margin: 0 auto 18px;
    line-height: 1;
}
.ps-login-brand::before {
    content: 'DW';
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px;
    background: #000000;
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(0,0,0,.3);
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    font-size: 22px;
    color: #ffffff;
    letter-spacing: -.5px;
}
.ps-login-brand .ps-brand-name { font-size: 22px; color: #0f172a; letter-spacing: -.3px; }
.login-card { text-align: center; }
.login-card form { text-align: left; }

/* Legacy logo classes kept for any view that still references them */
.app-logo-icon {
    width: 32px; height: 32px;
    background: #000000;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    color: #ffffff; font-size: 14px; flex-shrink: 0;
}
.app-logo-text { font-weight: 700; font-size: 15px; color: #0f172a; letter-spacing: -.3px; }

/* Header search */
.hdr-search {
    flex: 1; max-width: 460px;
    position: relative;
    height: 38px;
}
.hdr-search i.fa-search {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: #94a3b8; font-size: 13px;
    pointer-events: none;
}
.hdr-search input {
    width: 100%; height: 100%;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 10px;
    padding: 0 44px 0 38px;
    font-size: 13.5px;
    color: #1e293b;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.hdr-search input:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.hdr-search-kbd {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: #fff; border: 1px solid #e2e8f0;
    border-radius: 5px;
    padding: 1px 7px;
    font-size: 11px; font-weight: 600; color: #94a3b8;
    font-family: 'Inter', sans-serif;
}

/* Header user */
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* Notification bell */
.hdr-bell {
    position: relative;
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px;
    color: #475569; font-size: 17px;
    text-decoration: none !important;
    transition: background .15s, color .15s;
}
.hdr-bell:hover { background: #f1f5f9; color: #0f172a; }
.hdr-bell.has-unread { color: #1e293b; }
.hdr-bell.has-unread::after {
    content: '';
    position: absolute; top: 9px; right: 10px;
    width: 8px; height: 8px;
    background: #ef4444;
    border: 2px solid #fff;
    border-radius: 50%;
}
.hdr-bell-badge {
    position: absolute;
    top: 2px; right: 2px;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: #fff;
    font-size: 10px; font-weight: 700;
    line-height: 18px; text-align: center;
    border-radius: 9px;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(239,68,68,.4);
}
.hdr-bell.has-unread::after { display: none; }   /* badge supersedes dot when shown */
.hdr-user-btn {
    display: flex; align-items: center; gap: 10px;
    border: none; background: transparent;
    padding: 4px 10px 4px 4px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s;
}
.hdr-user-btn:hover { background: #f1f5f9; }
.hdr-user-photo {
    width: 36px; height: 36px;
    border-radius: 50%; object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #e2e8f0;
}
.user-avatar-circle {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 600; color: #fff;
    flex-shrink: 0;
}
.hdr-user-info { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.hdr-user-name { font-size: 13px; font-weight: 600; color: #1e293b; }
.hdr-user-role { font-size: 11px; color: #94a3b8; font-weight: 500; }
.hdr-user-chev { font-size: 10px; color: #94a3b8; margin-left: 2px; }

/* ── Fixed left sidebar ─────────────────────────────────────────── */
.app-sidebar {
    position: fixed;
    left: 0; top: var(--hdr-h); bottom: 0;
    width: var(--side-w);
    background: var(--side-bg);
    background-image: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg-2) 100%);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    border-right: 1px solid rgba(255,255,255,.04);
}
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.07); border-radius: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.14); }
.sidebar-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--side-border);
}

/* ── Top-level menu item (leaf, no children) ───────────────────── */
.m-item {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    margin-bottom: 2px;
    border-radius: 8px;
    color: var(--side-text);
    text-decoration: none !important;
    font-size: 13.5px; font-weight: 500;
    transition: background .15s, color .15s;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
}
.m-item:hover { background: var(--side-hover); color: #fff; }
.m-item.active {
    background: var(--accent-soft);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--accent);
}
.m-item .m-icon {
    width: 20px; flex-shrink: 0;
    font-size: 14px; text-align: center;
    color: var(--side-text-dim);
}
.m-item:hover .m-icon, .m-item.active .m-icon { color: #fff; }
.m-item .m-label { flex: 1; }
.m-item .m-badge {
    background: #ef4444; color: #fff;
    font-size: 10px; font-weight: 700;
    padding: 2px 7px; border-radius: 99px;
    margin-left: auto; flex-shrink: 0;
}

/* ── Group (collapsible header + children) ─────────────────────── */
.m-group { margin-bottom: 2px; }
.m-group-head {
    width: 100%;
    display: flex; align-items: center; gap: 12px;
    background: transparent; border: none;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--side-text);
    font-size: 13.5px; font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
    overflow: hidden;
}
.m-group-head:hover { background: var(--side-hover); color: #fff; }
.m-group-head .m-icon {
    width: 20px; flex-shrink: 0;
    font-size: 14px; text-align: center;
    color: var(--side-text-dim);
}
.m-group-head:hover .m-icon { color: #fff; }
.m-group-head .m-label { flex: 1; }
.m-group-head .m-chev {
    font-size: 10px; color: var(--side-text-dim);
    transition: transform .2s;
}
.m-group.open > .m-group-head .m-chev { transform: rotate(90deg); }
.m-group.active > .m-group-head {
    color: #fff;
    background: rgba(59,130,246,.10);
}
.m-group.active > .m-group-head .m-icon { color: var(--accent); }

/* Children slot (animated collapse) */
.m-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
    margin-left: 6px;
    padding-left: 22px;
    border-left: 1px dashed rgba(255,255,255,.08);
}
.m-group.open > .m-children { max-height: 600px; padding-top: 4px; padding-bottom: 4px; }

/* Sub-item */
.m-sub {
    position: relative;
    display: flex; align-items: center; gap: 10px;
    padding: 7px 10px;
    border-radius: 6px;
    color: var(--side-text-dim);
    text-decoration: none !important;
    font-size: 12.5px; font-weight: 500;
    transition: background .15s, color .15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.m-sub > span { overflow: hidden; text-overflow: ellipsis; }
.m-sub:hover { color: #fff; background: var(--side-hover); }
.m-sub .m-dot { font-size: 5px; color: rgba(255,255,255,.25); flex-shrink: 0; transition: color .15s, transform .15s; }
.m-sub:hover .m-dot { color: var(--side-text); }
.m-sub.active { color: #fff; background: var(--accent-soft); font-weight: 600; }
.m-sub.active .m-dot { color: var(--accent); transform: scale(1.6); }

/* Logout footer */
.m-logout { color: #fca5a5 !important; }
.m-logout .m-icon { color: #fca5a5 !important; }
.m-logout:hover { background: rgba(239,68,68,.15); color: #fecaca !important; }
.m-logout:hover .m-icon { color: #fecaca !important; }

/* Search mode — open all groups so matches show */
.app-sidebar.searching .m-group { }
.app-sidebar.searching .m-group .m-children { max-height: 600px; padding-top: 4px; padding-bottom: 4px; }
.m-hidden { display: none !important; }

/* Mobile backdrop */
.sidebar-backdrop {
    display: none;
    position: fixed; inset: var(--hdr-h) 0 0 0;
    background: rgba(15,23,42,.45);
    z-index: 1035;
}

/* ── Page area ──────────────────────────────────────────────────── */
.app-page {
    margin-left: var(--side-w);
    padding-top: var(--hdr-h);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Breadcrumb bar (replaces old sub-tabs) */
.app-crumbs {
    position: sticky;
    top: var(--hdr-h);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    height: 44px;
    padding: 0 24px;
    z-index: 1030;
    min-width: 0;
}
.crumbs-nav {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px;
    min-width: 0; flex: 1;
    overflow: hidden;
}
.crumb-home { color: #94a3b8; display: inline-flex; align-items: center; flex-shrink: 0; }
.crumb-home:hover { color: var(--accent); }
.crumb-sep { font-size: 9px; color: #cbd5e1; flex-shrink: 0; }
.crumb-mod { color: #64748b; font-weight: 500; flex-shrink: 0; }
.crumb-page {
    color: #0f172a; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    min-width: 0;
}
.crumbs-date { font-size: 12px; color: #94a3b8; font-weight: 500; flex-shrink: 0; white-space: nowrap; }

/* Main content */
.app-content { flex: 1; background: #f8fafc; padding: 24px; }

/* Footer */
.app-footer {
    background: #fff;
    border-top: 1px solid #e2e8f0;
    padding: 12px 24px;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12px; color: #94a3b8;
}
.app-footer strong { color: #374151; }
.app-footer a { color: #94a3b8; text-decoration: none; }
.app-footer a:hover { color: #374151; }

/* ══════════════════════════════════════════════════════════════════
   VARIABLES + BASE
   ══════════════════════════════════════════════════════════════════ */

/* ── Variables (refined design tokens) ─────────────────────────── */
:root {
    --primary:       #3b82f6;
    --primary-dark:  #2563eb;
    --success:       #10b981;
    --warning:       #f59e0b;
    --danger:        #ef4444;
    --info:          #06b6d4;
    --purple:        #8b5cf6;

    --body-bg:       #f6f8fb;       /* slightly cooler page bg */
    --card-bg:       #ffffff;
    --surface-2:     #fafbfc;       /* tinted surface for table heads etc */

    --text-primary:  #0f172a;
    --text-secondary:#475569;
    --text-muted:    #64748b;
    --text-faint:    #94a3b8;

    --border:        #e8edf3;       /* softer than e2e8f0 */
    --border-strong: #d4dce5;

    /* Refined elevation */
    --shadow-sm:     0 1px 2px rgba(15,23,42,.04);
    --shadow:        0 1px 3px rgba(15,23,42,.05), 0 1px 2px rgba(15,23,42,.04);
    --shadow-md:     0 4px 12px rgba(15,23,42,.06), 0 2px 4px rgba(15,23,42,.04);
    --shadow-lg:     0 12px 28px rgba(15,23,42,.08), 0 6px 12px rgba(15,23,42,.05);

    /* Radii */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 20px;
    --r-pill: 999px;

    --accent:        #3b82f6;
    --accent-soft:   rgba(59,130,246,.10);
}

/* ── Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background: var(--body-bg);
    margin: 0;
    font-feature-settings: 'cv02','cv03','cv04','cv11';
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: var(--accent); }
a:hover { color: var(--primary-dark); }
h1,h2,h3,h4,h5,h6 { font-weight: 600; letter-spacing: -0.01em; color: var(--text-primary); }
h1 { font-size: 24px; line-height: 1.25; }
h2 { font-size: 20px; line-height: 1.3; }
h3 { font-size: 17px; line-height: 1.35; }
h4 { font-size: 15px; }
h5 { font-size: 14px; }
small, .small { font-size: 12px; }
hr { border-color: var(--border); opacity: 1; }

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s, transform .2s;
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 18px 22px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    border-radius: var(--r-lg) var(--r-lg) 0 0 !important;
    display: flex; align-items: center;
}
.card-header h5, .card-header h6 { margin: 0; font-size: inherit; font-weight: 600; }
.card-body  { padding: 22px; }
.card-footer {
    padding: 14px 22px;
    background: transparent;
    border-top: 1px solid var(--border);
}

/* Subtle hover for interactive cards */
.card.is-link { cursor: pointer; }
.card.is-link:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

/* ── Stat Cards ─────────────────────────────────────────────────── */
.stat-card {
    border-radius: 12px; padding: 20px; color: white;
    position: relative; overflow: hidden;
    box-shadow: var(--shadow-md); border: none;
}
.stat-card::before {
    content: ''; position: absolute;
    top: -20px; right: -20px;
    width: 100px; height: 100px;
    border-radius: 50%; background: rgba(255,255,255,.1);
}
.stat-card .stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    background: rgba(255,255,255,.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; margin-bottom: 12px;
}
.stat-card .stat-value  { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-card .stat-label  { font-size: 13px; opacity: .85; margin-top: 4px; }
.stat-card .stat-trend  { font-size: 12px; opacity: .8; margin-top: 8px; }
.bg-stat-blue   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.bg-stat-green  { background: linear-gradient(135deg, #10b981, #047857); }
.bg-stat-orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.bg-stat-red    { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.bg-stat-purple { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.bg-stat-teal   { background: linear-gradient(135deg, #06b6d4, #0e7490); }
.bg-stat-pink   { background: linear-gradient(135deg, #ec4899, #be185d); }
.bg-stat-indigo { background: linear-gradient(135deg, #6366f1, #4338ca); }

/* ── Badges (refined: softer tints, consistent weight) ─────────── */
.badge {
    font-size: 11px; font-weight: 600;
    padding: 4px 9px; border-radius: var(--r-sm);
    letter-spacing: .2px;
}
.status-active, .status-approved, .status-won { background: #ecfdf5; color: #047857; }
.status-inactive, .status-closed              { background: #f1f5f9; color: #64748b; }
.status-pending                               { background: #fffbeb; color: #b45309; }
.status-rejected, .status-lost                { background: #fef2f2; color: #b91c1c; }
.status-open                                  { background: #eff6ff; color: #1e40af; }
.status-new                                   { background: #ecfeff; color: #0e7490; }
.priority-high   { background: #fef2f2; color: #b91c1c; }
.priority-medium { background: #fffbeb; color: #b45309; }
.priority-low    { background: #ecfdf5; color: #047857; }

/* Soft chip — generic colored pill */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; font-size: 11.5px; font-weight: 600; border-radius: var(--r-pill); }
.chip-blue   { background: #eff6ff; color: #1d4ed8; }
.chip-green  { background: #ecfdf5; color: #047857; }
.chip-orange { background: #fffbeb; color: #b45309; }
.chip-red    { background: #fef2f2; color: #b91c1c; }
.chip-purple { background: #f5f3ff; color: #6d28d9; }
.chip-teal   { background: #ecfeff; color: #0e7490; }
.chip-pink   { background: #fdf2f8; color: #be185d; }
.chip-gray   { background: #f1f5f9; color: #475569; }

/* ── Tables (more breathing room, refined hover) ───────────────── */
.table { font-size: 13.5px; color: var(--text-primary); margin-bottom: 0; }
.table th {
    font-weight: 600; color: var(--text-muted);
    font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    padding: 12px 18px;
    white-space: nowrap;
}
.table td {
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    padding: 14px 18px;
}
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table-responsive { border-radius: var(--r-lg); overflow: hidden; }

/* ── Buttons (modern, refined states) ──────────────────────────── */
.btn {
    font-size: 13.5px; font-weight: 500;
    border-radius: var(--r-md);
    padding: 8px 16px;
    transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
    line-height: 1.45;
}
.btn:active { transform: translateY(1px); }
.btn-sm     { padding: 5px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-lg     { padding: 12px 22px; font-size: 15px; border-radius: var(--r-md); }
.btn-primary {
    background: var(--accent); border-color: var(--accent); color: #fff;
    box-shadow: 0 1px 2px rgba(59,130,246,.2);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); box-shadow: 0 2px 6px rgba(59,130,246,.3); }
.btn-outline-primary { color: var(--accent); border-color: var(--accent); }
.btn-outline-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-outline-secondary { color: var(--text-secondary); border-color: var(--border-strong); }
.btn-outline-secondary:hover { background: var(--surface-2); color: var(--text-primary); border-color: var(--border-strong); }
.btn-icon   { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-sm); }
.btn-icon.btn-sm { width: 28px; height: 28px; }

/* ── Forms (refined inputs, better focus ring) ─────────────────── */
.form-control, .form-select {
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    font-size: 13.5px; padding: 9px 13px;
    color: var(--text-primary);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:hover, .form-select:hover { border-color: #c0cad6; }
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}
.form-control::placeholder { color: var(--text-faint); }
.form-label { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-text { font-size: 12px; color: var(--text-muted); }
.input-group-text { border-radius: var(--r-md); background: var(--surface-2); border-color: var(--border-strong); font-size: 13px; color: var(--text-muted); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }

/* ── Page Header (cleaner, more breathing room) ────────────────── */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-header h1 {
    font-size: 22px; margin: 0;
    color: var(--text-primary);
    letter-spacing: -0.015em;
}
.page-header p  {
    color: var(--text-muted);
    font-size: 13px;
    margin: 4px 0 0;
    line-height: 1.4;
}

/* ── Avatar (refined gradients + status dot) ───────────────────── */
.avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #8b5cf6);
    color: white;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px;
    flex-shrink: 0;
    position: relative;
    text-transform: uppercase;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.avatar-xl { width: 96px; height: 96px; font-size: 32px; }
.avatar.has-status::after {
    content: '';
    position: absolute; right: -1px; bottom: -1px;
    width: 10px; height: 10px;
    background: #10b981;
    border: 2px solid #fff;
    border-radius: 50%;
}
/* Gradient pool — apply via .avatar-N for varied colors */
.avatar-1 { background: linear-gradient(135deg, #3b82f6, #06b6d4); }
.avatar-2 { background: linear-gradient(135deg, #f97316, #f59e0b); }
.avatar-3 { background: linear-gradient(135deg, #ec4899, #8b5cf6); }
.avatar-4 { background: linear-gradient(135deg, #10b981, #06b6d4); }
.avatar-5 { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.avatar-6 { background: linear-gradient(135deg, #ef4444, #f97316); }

/* ── Filter Bar ─────────────────────────────────────────────────── */
.filter-bar {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: 12px; padding: 16px 20px;
    margin-bottom: 20px; box-shadow: var(--shadow);
}

/* ── Empty State ────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty-state i { font-size: 44px; opacity: .25; margin-bottom: 14px; display: block; }
.empty-state h5 { font-size: 15px; color: var(--text-primary); margin-bottom: 4px; }
.empty-state p  { font-size: 13px; color: var(--text-muted); margin: 0; }

/* ══════════════════════════════════════════════════════════════════
   DASHBOARD WIDGETS (modern flat KPI cards, hero, mini-lists, etc.)
   ══════════════════════════════════════════════════════════════════ */

/* Hero greeting card */
.hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    color: #fff;
    border-radius: var(--r-lg);
    padding: 24px 28px;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: ''; position: absolute;
    top: -50%; right: -10%;
    width: 350px; height: 350px;
    background: radial-gradient(circle, rgba(255,255,255,.06), transparent 70%);
}
.hero h2 { color: #fff; margin: 0 0 4px; font-size: 22px; letter-spacing: -0.02em; }
.hero p { color: rgba(255,255,255,.75); margin: 0; font-size: 13.5px; }
.hero .hero-meta { display: flex; gap: 22px; margin-top: 18px; position: relative; z-index: 1; }
.hero .hero-stat { display: flex; flex-direction: column; }
.hero .hero-stat-num { font-size: 18px; font-weight: 700; }
.hero .hero-stat-lbl { font-size: 11px; color: rgba(255,255,255,.6); text-transform: uppercase; letter-spacing: .5px; }

/* Modern KPI card — flat white with colored icon badge */
.kpi {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px 22px;
    transition: box-shadow .2s, transform .2s, border-color .2s;
    cursor: default;
    position: relative;
}
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--border-strong); }
.kpi-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.kpi-icon {
    width: 42px; height: 42px;
    border-radius: var(--r-md);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 17px;
}
.kpi-icon.kpi-blue   { background: #eff6ff; color: #2563eb; }
.kpi-icon.kpi-green  { background: #ecfdf5; color: #059669; }
.kpi-icon.kpi-orange { background: #fffbeb; color: #d97706; }
.kpi-icon.kpi-purple { background: #f5f3ff; color: #7c3aed; }
.kpi-icon.kpi-pink   { background: #fdf2f8; color: #db2777; }
.kpi-icon.kpi-teal   { background: #ecfeff; color: #0891b2; }
.kpi-icon.kpi-red    { background: #fef2f2; color: #dc2626; }
.kpi-icon.kpi-indigo { background: #eef2ff; color: #4f46e5; }
.kpi-trend {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px;
    border-radius: var(--r-pill);
    font-size: 11px; font-weight: 600;
}
.kpi-trend.up   { background: #ecfdf5; color: #047857; }
.kpi-trend.down { background: #fef2f2; color: #b91c1c; }
.kpi-value { font-size: 26px; font-weight: 700; color: var(--text-primary); line-height: 1.1; letter-spacing: -0.02em; }
.kpi-label { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.kpi-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-muted); }

/* Mini stat — compact row item for sidebar widgets */
.mini-stat { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.mini-stat + .mini-stat { border-top: 1px solid var(--border); }
.mini-stat-icon { width: 36px; height: 36px; border-radius: var(--r-md); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mini-stat-body { flex: 1; min-width: 0; }
.mini-stat-title { font-weight: 600; font-size: 13px; color: var(--text-primary); }
.mini-stat-sub { font-size: 11.5px; color: var(--text-muted); }
.mini-stat-num { font-weight: 700; color: var(--text-primary); font-size: 14px; }

/* People-list — used for new hires, birthdays, etc. */
.people-row { display: flex; align-items: center; gap: 12px; padding: 12px 22px; transition: background .15s; }
.people-row + .people-row { border-top: 1px solid var(--border); }
.people-row:hover { background: var(--surface-2); }
.people-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.people-meta { font-size: 11.5px; color: var(--text-muted); }

/* Activity feed */
.activity-list { padding: 6px 22px 16px; }
.activity-item { display: flex; gap: 12px; padding: 10px 0; align-items: flex-start; }
.activity-item + .activity-item { border-top: 1px solid var(--border); }
.activity-dot {
    width: 32px; height: 32px; border-radius: var(--r-md);
    background: var(--accent-soft); color: var(--accent);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; flex-shrink: 0;
}
.activity-body { flex: 1; min-width: 0; }
.activity-text { font-size: 13px; color: var(--text-primary); line-height: 1.45; }
.activity-text strong { color: var(--text-primary); font-weight: 600; }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Section title — used inside dashboard widgets */
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title h6 { margin: 0; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .7px; }
.section-title .section-action { font-size: 12px; color: var(--accent); }

/* Quick action button strip */
.qa-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.qa-tile {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 14px 10px;
    text-align: center;
    color: var(--text-primary);
    text-decoration: none !important;
    transition: border-color .15s, transform .15s, box-shadow .15s;
}
.qa-tile:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); color: var(--accent); }
.qa-tile i { display: block; font-size: 18px; margin-bottom: 6px; color: var(--text-muted); }
.qa-tile:hover i { color: var(--accent); }
.qa-tile span { font-size: 12px; font-weight: 500; }

/* Dark mode adjustments for new components */
body.theme-dark .hero { background: linear-gradient(135deg, #0f172a 0%, #312e81 100%); }
body.theme-dark .kpi { background: #111c33; border-color: #1e293b; }
body.theme-dark .kpi-value { color: #f1f5f9; }
body.theme-dark .kpi-icon.kpi-blue   { background: rgba(59,130,246,.15); color: #60a5fa; }
body.theme-dark .kpi-icon.kpi-green  { background: rgba(16,185,129,.15); color: #34d399; }
body.theme-dark .kpi-icon.kpi-orange { background: rgba(245,158,11,.15); color: #fbbf24; }
body.theme-dark .kpi-icon.kpi-purple { background: rgba(139,92,246,.15); color: #a78bfa; }
body.theme-dark .kpi-icon.kpi-pink   { background: rgba(236,72,153,.15); color: #f472b6; }
body.theme-dark .kpi-icon.kpi-teal   { background: rgba(6,182,212,.15); color: #22d3ee; }
body.theme-dark .kpi-icon.kpi-red    { background: rgba(239,68,68,.15); color: #f87171; }
body.theme-dark .kpi-icon.kpi-indigo { background: rgba(99,102,241,.15); color: #818cf8; }
body.theme-dark .qa-tile { background: #111c33; border-color: #1e293b; color: #cbd5e1; }
body.theme-dark .qa-tile:hover { border-color: var(--accent); }
body.theme-dark .people-row + .people-row, body.theme-dark .activity-item + .activity-item, body.theme-dark .mini-stat + .mini-stat { border-top-color: #1e293b; }
body.theme-dark .people-row:hover { background: #0f172a; }

/* ── Alerts ─────────────────────────────────────────────────────── */
.alert { border-radius: 10px; border: none; font-size: 14px; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-danger  { background: #fee2e2; color: #991b1b; }

/* ── Login ──────────────────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #2563eb 100%);
}
.login-card {
    width: 420px; background: white; border-radius: 20px;
    padding: 40px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

/* ── Payslip ────────────────────────────────────────────────────── */
.payslip { max-width: 800px; margin: 0 auto; background: white; padding: 40px; border-radius: 12px; }
.payslip-header { border-bottom: 3px solid var(--primary); padding-bottom: 20px; margin-bottom: 24px; }

/* ── Timeline ───────────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-dot { position: absolute; left: -20px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--primary); border: 2px solid white; box-shadow: 0 0 0 2px var(--primary); }
.timeline-content { background: #f8fafc; border-radius: 10px; padding: 12px 16px; border: 1px solid var(--border); }

/* ── Kanban ─────────────────────────────────────────────────────── */
.kanban-col { min-width: 220px; background: #f8fafc; border-radius: 12px; padding: 14px; }
.kanban-col-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 12px; }
.kanban-card { background: white; border-radius: 10px; padding: 14px; margin-bottom: 10px; border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 13px; }

/* ── Breadcrumb ─────────────────────────────────────────────────── */
.breadcrumb { font-size: 13px; }
.breadcrumb-item a { color: var(--primary); }
.breadcrumb-item.active { color: var(--text-muted); }

/* ── Responsive ─────────────────────────────────────────────────── */

/* Hamburger toggle is hidden on wide screens (sidebar permanent) */
.sidebar-toggle { display: none; }

/* Tablet & below: shrink search, hide user role text */
@media (max-width: 1199.98px) {
    .hdr-search { max-width: 280px; }
    .hdr-user-role { display: none; }
}

/* Narrow desktop / tablet: collapse sidebar to drawer mode */
@media (max-width: 991.98px) {
    .sidebar-toggle { display: inline-flex; }
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 4px 0 24px rgba(0,0,0,.25);
    }
    body.sidebar-open .app-sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .app-page { margin-left: 0; }
    .hdr-user-info { display: none; }
}

/* Mobile: minimum-bar header */
@media (max-width: 640px) {
    .app-header { padding: 0 12px; gap: 8px; }
    .hdr-search { display: none; }
    .ps-brand-name { display: none; }      /* keep just the square mark */
    .app-content { padding: 16px; }
    .crumbs-date { display: none; }
    .app-crumbs { padding: 0 14px; height: 40px; }
    .crumbs-nav { font-size: 12px; }
    .hdr-user-chev { display: none; }
}

@media print {
    .app-sidebar, .app-header, .app-crumbs, .app-footer, .sidebar-backdrop, .tc-drawer, .tc-backdrop { display: none !important; }
    .app-page { margin-left: 0 !important; padding-top: 0 !important; }
    .app-content { padding: 0 !important; background: #fff !important; }
}

/* ══════════════════════════════════════════════════════════════════
   THEME CUSTOMIZER DRAWER + THEME VARIANTS
   ══════════════════════════════════════════════════════════════════ */
.tc-drawer {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 340px; max-width: 95vw;
    background: #fff;
    box-shadow: -8px 0 32px rgba(15,23,42,.15);
    z-index: 2000;
    transform: translateX(100%);
    transition: transform .25s ease;
    display: flex; flex-direction: column;
}
.tc-drawer.open { transform: translateX(0); }
.tc-backdrop {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.4);
    z-index: 1999;
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
}
.tc-backdrop.open { opacity: 1; pointer-events: auto; }
.tc-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 20px 22px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: #fff;
}
.tc-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.tc-head p { margin: 4px 0 0; font-size: 12px; color: rgba(255,255,255,.7); }
.tc-close {
    background: rgba(255,255,255,.1); border: none;
    color: #fff; font-size: 18px; line-height: 1;
    width: 32px; height: 32px; border-radius: 50%;
    cursor: pointer; flex-shrink: 0;
}
.tc-close:hover { background: rgba(255,255,255,.2); }
.tc-body { flex: 1; overflow-y: auto; padding: 16px 22px 22px; }
.tc-sec { margin-bottom: 22px; }
.tc-sec h6 {
    font-size: 11px; font-weight: 700;
    color: #64748b; text-transform: uppercase; letter-spacing: .8px;
    margin: 0 0 10px;
}
.tc-tiles { display: grid; gap: 8px; }
.tc-tiles-2 { grid-template-columns: 1fr 1fr; }
.tc-tiles-3 { grid-template-columns: 1fr 1fr 1fr; }
.tc-tile {
    background: #f8fafc; border: 2px solid transparent;
    padding: 10px 8px; border-radius: 8px;
    font-size: 12.5px; font-weight: 500;
    color: #334155; cursor: pointer;
    transition: border-color .15s, background .15s;
}
.tc-tile i { display: block; font-size: 16px; margin-bottom: 4px; color: #64748b; }
.tc-tile:hover { background: #f1f5f9; }
.tc-tile.active { border-color: var(--accent); background: #fff; color: var(--accent); }
.tc-tile.active i { color: var(--accent); }
.tc-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.tc-swatch {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.tc-swatch-light { border-color: #e2e8f0; }
.tc-swatch.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tc-actions { padding-top: 12px; border-top: 1px solid #e2e8f0; }

/* Accent variants */
body.accent-blue   { --accent: #3b82f6; --accent-soft: rgba(59,130,246,.18); }
body.accent-orange { --accent: #ff6b35; --accent-soft: rgba(255,107,53,.18); }
body.accent-green  { --accent: #10b981; --accent-soft: rgba(16,185,129,.18); }
body.accent-purple { --accent: #8b5cf6; --accent-soft: rgba(139,92,246,.18); }
body.accent-pink   { --accent: #ec4899; --accent-soft: rgba(236,72,153,.18); }
body.accent-red    { --accent: #ef4444; --accent-soft: rgba(239,68,68,.18); }
body[class*="accent-"] .text-primary { color: var(--accent) !important; }
body[class*="accent-"] .btn-primary { background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important; }
body[class*="accent-"] .btn-primary:hover { filter: brightness(0.92); }
body[class*="accent-"] .btn-outline-primary { color: var(--accent) !important; border-color: var(--accent) !important; }
body[class*="accent-"] .btn-outline-primary:hover { background: var(--accent) !important; color: #fff !important; }
body[class*="accent-"] .form-control:focus, body[class*="accent-"] .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Sidebar color variants */
body.side-color-light .app-sidebar {
    --side-bg: #ffffff; --side-bg-2: #f8fafc;
    --side-text: #475569; --side-text-dim: #94a3b8;
    --side-hover: #f1f5f9; --side-border: #e2e8f0;
    background-image: none; border-right: 1px solid #e2e8f0;
}
body.side-color-light .m-item:hover, body.side-color-light .m-group-head:hover { background: #f1f5f9; color: #0f172a; }
body.side-color-light .m-item.active { background: var(--accent-soft); color: var(--accent); }
body.side-color-light .m-children { border-left-color: #e2e8f0; }
body.side-color-light .sidebar-footer { border-top-color: #e2e8f0; }
body.side-color-navy .app-sidebar { background-image: linear-gradient(180deg, #0b1448 0%, #1a237e 100%); }
body.side-color-indigo .app-sidebar { background-image: linear-gradient(180deg, #312e81 0%, #4338ca 100%); }

/* Sidebar size: compact (icon-only) */
body.side-size-compact { --side-w: 70px; }
body.side-size-compact .app-sidebar { width: 70px; }
body.side-size-compact .app-page { margin-left: 70px; }
body.side-size-compact .m-label, body.side-size-compact .m-chev, body.side-size-compact .m-children { display: none !important; }
body.side-size-compact .m-item, body.side-size-compact .m-group-head { justify-content: center; padding: 12px 8px; }
body.side-size-compact .m-icon { font-size: 16px; }

/* Top bar variants */
body.top-color-dark .app-header { background: #0f172a; border-bottom-color: #1e293b; }
body.top-color-dark .ps-brand-name { color: #e2e8f0; }
body.top-color-dark .sidebar-toggle, body.top-color-dark .hdr-bell { color: #cbd5e1; }
body.top-color-dark .sidebar-toggle:hover, body.top-color-dark .hdr-bell:hover { background: rgba(255,255,255,.08); color: #fff; }
body.top-color-dark .hdr-search input { background: #1e293b; border-color: #334155; color: #e2e8f0; }
body.top-color-dark .hdr-user-name { color: #e2e8f0; }
body.top-color-brand .app-header { background: var(--accent); border-bottom-color: transparent; }
body.top-color-brand .ps-brand-name, body.top-color-brand .sidebar-toggle, body.top-color-brand .hdr-bell { color: #fff; }
body.top-color-brand .sidebar-toggle:hover, body.top-color-brand .hdr-bell:hover { background: rgba(255,255,255,.18); }
body.top-color-brand .hdr-search input { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.25); color: #fff; }
body.top-color-brand .hdr-search input::placeholder { color: rgba(255,255,255,.7); }
body.top-color-brand .hdr-search i.fa-search { color: rgba(255,255,255,.7); }
body.top-color-brand .hdr-user-name { color: #fff; }

/* Layout width */
body.width-boxed .app-page { max-width: 1400px; margin-left: auto; margin-right: auto; box-shadow: 0 0 30px rgba(15,23,42,.08); }

/* Card style */
body.card-borderless .card { border-color: transparent; box-shadow: none; }
body.card-shadow .card { border-color: transparent; box-shadow: 0 4px 16px rgba(15,23,42,.08); }

/* Dark mode */
body.theme-dark { background: #0b1220; color: #cbd5e1; }
body.theme-dark .app-header { background: #111c33; border-bottom-color: #1e293b; }
body.theme-dark .ps-brand-name, body.theme-dark .hdr-user-name, body.theme-dark .crumb-page { color: #e2e8f0; }
body.theme-dark .sidebar-toggle, body.theme-dark .hdr-bell { color: #94a3b8; }
body.theme-dark .sidebar-toggle:hover, body.theme-dark .hdr-bell:hover { background: rgba(255,255,255,.06); color: #fff; }
body.theme-dark .hdr-search input { background: #1a2540; border-color: #243150; color: #cbd5e1; }
body.theme-dark .app-crumbs { background: #111c33; border-bottom-color: #1e293b; }
body.theme-dark .crumb-mod { color: #94a3b8; }
body.theme-dark .crumb-sep, body.theme-dark .crumbs-date { color: #475569; }
body.theme-dark .app-content { background: #0b1220; }
body.theme-dark .card { background: #111c33; border-color: #1e293b; color: #cbd5e1; }
body.theme-dark .card-header { background: transparent; border-bottom-color: #1e293b; color: #e2e8f0; }
body.theme-dark .table { color: #cbd5e1; }
body.theme-dark .table th { background: #0f172a; color: #94a3b8; border-bottom-color: #1e293b; }
body.theme-dark .table td { border-bottom-color: #1e293b; }
body.theme-dark .table tbody tr:hover { background: #0f172a; }
body.theme-dark .form-control, body.theme-dark .form-select { background: #0f172a; border-color: #1e293b; color: #cbd5e1; }
body.theme-dark .form-control::placeholder { color: #64748b; }
body.theme-dark .input-group-text { background: #0f172a; border-color: #1e293b; color: #94a3b8; }
body.theme-dark .form-label { color: #cbd5e1; }
body.theme-dark .page-header { border-bottom-color: #1e293b; }
body.theme-dark .page-header h1 { color: #f1f5f9; }
body.theme-dark .app-footer { background: #111c33; border-top-color: #1e293b; color: #64748b; }
body.theme-dark .dropdown-menu { background: #111c33; border-color: #1e293b; }
body.theme-dark .dropdown-item { color: #cbd5e1; }
body.theme-dark .dropdown-item:hover { background: #1e293b; color: #fff; }
body.theme-dark .filter-bar { background: #111c33; border-color: #1e293b; }
body.theme-dark .tc-drawer { background: #111c33; color: #cbd5e1; }
body.theme-dark .tc-tile { background: #0f172a; color: #cbd5e1; }
body.theme-dark .tc-tile:hover { background: #1e293b; }
body.theme-dark .tc-actions { border-top-color: #1e293b; }
