@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    /* ── Warm Cream / Peach Palette ─────────────────────────────── */
    --bg-main:    #FFFDFB;   /* Off White    — main background       */
    --bg-sidebar: #FFF8F4;   /* Warm Ivory   — left sidebar          */
    --bg-card:    #FFFFFF;   /* Pure White   — card surfaces         */
    --bg-outer:   #FFF3EC;   /* Light Cream  — outer gradient areas  */
    --peach-glow: #FFE8D8;   /* Soft Peach   — hover glows           */
    --apricot:    #FFD6B8;   /* Apricot      — light orange accent   */
    --border-color: #FFD6B8; /* Apricot border for warmth            */

    /* ── Primary Brand ──────────────────────────────────────────── */
    --primary:        #FF6B00;
    --primary-hover:  #F25C05;
    --primary-glow:   #FFE8D8; /* Soft Peach replaces cold rgba glow  */

    --secondary:           #FF8A33;
    --secondary-gradient:  linear-gradient(135deg, #FF6B00 0%, #F25C05 100%);

    /* ── Status Colors ───────────────────────────────────────────── */
    --success:    #22C55E;
    --success-bg: rgba(34, 197, 94, 0.1);
    --warning:    #F59E0B;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger:     #EF4444;
    --danger-bg:  rgba(239, 68, 68, 0.1);
    --info:       #3B82F6;
    --info-bg:    rgba(59, 130, 246, 0.1);

    /* ── Typography ──────────────────────────────────────────────── */
    --text-main:  #111827;
    --text-muted: #6B7280;
    --font-sans:  'Outfit', sans-serif;

    /* ── Transitions ─────────────────────────────────────────────── */
    --transition-fast:   0.2s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* ── Metric Card Pastels ─────────────────────────────────────── */
    --card-amber-bg:     #fef3c7;
    --card-amber-border: #fde68a;
    --card-amber-text:   #b45309;

    --card-rose-bg:      #ffe4e6;
    --card-rose-border:  #fecdd3;
    --card-rose-text:    #be123c;

    --card-purple-bg:    #f3e8ff;
    --card-purple-border:#e9d5ff;
    --card-purple-text:  #6b21a8;

    --card-blue-bg:      #e0f2fe;
    --card-blue-border:  #bae6fd;
    --card-blue-text:    #0369a1;
}

/* Global Reset & Scrollbars */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Scrollbar styling — warm peach tones */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-outer); /* Light Cream #FFF3EC */
}
::-webkit-scrollbar-thumb {
    background: var(--apricot); /* Apricot #FFD6B8 */
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--peach-glow); /* Soft Peach #FFE8D8 */
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition-fast);
}

/* Auth / Login Page Layout */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 20px;
    background: var(--bg-main);
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 100%;
    max-width: 480px;
    padding: 40px;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.05);
    text-align: center;
    color: var(--text-main);
}

.auth-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
}

.auth-logo-icon {
    width: 60px;
    height: 60px;
    background: var(--secondary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    font-weight: 700;
}

.auth-logo-text {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
}

.auth-title {
    font-size: 22px;
    margin-bottom: 8px;
    font-weight: 600;
}

.auth-subtitle {
    color: #94a3b8;
    font-size: 14px;
    margin-bottom: 30px;
}

/* Dashboard App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar Styling (Premium Glassmorphism & Animations) */
.app-sidebar {
    width: 240px; 
    background: linear-gradient(180deg, rgba(255, 248, 244, 0.98) 0%, rgba(255, 255, 255, 0.95) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1001;
    transition: width 300ms cubic-bezier(0.4, 0, 0.2, 1), transform 300ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 300ms ease;
    border-right: 1px solid rgba(255, 214, 184, 0.4); /* Soft Apricot border */
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
}

.app-sidebar:hover {
    box-shadow: 4px 0 32px rgba(255, 107, 0, 0.05);
}

/* Sidebar Brand / Logo Frame */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    background: #ffffff;
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03), inset 0 2px 4px rgba(255,255,255,0.8);
    border: 1px solid rgba(255, 214, 184, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sidebar-brand:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(255, 107, 0, 0.06), inset 0 2px 4px rgba(255,255,255,0.8);
}

.brand-icon {
    font-size: 24px;
    color: var(--primary);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.sidebar-brand:hover .brand-icon {
    transform: scale(1.1) rotate(5deg);
}

.brand-name {
    font-size: 20px;
    font-weight: 800;
    color: #1e293b;
    transition: opacity 300ms ease-in-out;
    white-space: nowrap;
    letter-spacing: -0.02em;
}

/* ERP & CRM Tabs */
.sidebar-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 30px;
    background: rgba(255, 232, 216, 0.6); /* Soft Peach */
    padding: 5px;
    border-radius: 12px;
    border: 1px solid rgba(255, 214, 184, 0.3);
}

.sidebar-tab {
    padding: 8px 12px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-tab.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.08);
}

.sidebar-tab:not(.active):hover {
    color: var(--primary-hover);
    background: rgba(255, 255, 255, 0.5);
}

.sidebar-section-title {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--primary); /* Orange */
    margin: 25px 0 12px 14px;
    text-transform: uppercase;
    transition: opacity 300ms ease-in-out;
    white-space: nowrap;
    opacity: 0.8;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0; /* Removed for hidden scrollbar */
    margin-bottom: 20px;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Custom Scrollbar for sidebar menu */
.sidebar-menu::-webkit-scrollbar {
    display: none;
}
.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 138, 51, 0.2);
    border-radius: 10px;
}
.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 107, 0, 0.4);
}

.sidebar-menu-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-right: 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    border: 1px solid transparent;
}

.sidebar-menu-item a span {
    transition: opacity 300ms ease-in-out, transform 300ms ease;
}

.sidebar-menu-item a i {
    font-size: 20px;
    flex-shrink: 0;
    color: #94a3b8;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s ease;
}

.sidebar-menu-item a:hover {
    color: var(--primary-hover);
    background: linear-gradient(90deg, rgba(255, 232, 216, 0.7) 0%, rgba(255, 232, 216, 0.1) 100%);
    border: 1px solid rgba(255, 214, 184, 0.4);
    transform: translateX(4px);
}

.sidebar-menu-item a:hover i {
    color: var(--primary);
    transform: scale(1.15);
}

.sidebar-menu-item.active a {
    color: #ffffff;
    background: var(--secondary-gradient);
    font-weight: 700;
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(255, 107, 0, 0.25), inset 0 2px 4px rgba(255,255,255,0.2);
    border: none;
    transform: translateX(4px);
}

.sidebar-menu-item.active a i {
    color: #ffffff;
}

.sidebar-menu-item.active a:hover {
    transform: translateX(6px);
    box-shadow: 0 8px 20px rgba(255, 107, 0, 0.35), inset 0 2px 4px rgba(255,255,255,0.2);
}

/* Sidebar Collapsed State */
@media (min-width: 1100px) {
    .app-sidebar.collapsed {
        width: 72px;
    }

    .app-sidebar.collapsed .brand-name,
    .app-sidebar.collapsed .sidebar-section-title,
    .app-sidebar.collapsed .sidebar-menu-item a span,
    .app-sidebar.collapsed .sidebar-user-info {
        opacity: 0;
        pointer-events: none;
        width: 0;
        height: 0;
        overflow: hidden;
        margin: 0;
        padding: 0;
    }

    .app-sidebar.collapsed .sidebar-brand {
        padding: 10px 8px;
        justify-content: center;
    }

    .app-sidebar.collapsed .sidebar-menu-item a {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    .app-sidebar.collapsed .sidebar-menu-item.active a {
        padding-left: 0;
        justify-content: center;
        position: relative;
    }

    .app-sidebar.collapsed .sidebar-menu-item.active a::before {
        content: '';
        position: absolute;
        left: -12px;
        top: 50%;
        transform: translateY(-50%);
        height: 80%;
        width: 4px;
        border-radius: 4px;
        background: var(--primary);
    }

    .app-sidebar.collapsed .sidebar-logo {
        justify-content: center !important;
        padding-left: 0 !important;
    }

    .app-sidebar.collapsed .sidebar-brand-img {
        height: 30px !important;
    }

    .app-sidebar.collapsed .sidebar-user {
        padding: 10px;
        justify-content: center;
    }

    .app-sidebar.collapsed .logout-btn {
        display: none;
    }
}

/* Sidebar User Profile */
.sidebar-user {
    margin-top: auto;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar-placeholder {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.sidebar-user-info {
    flex-grow: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: capitalize;
}

.logout-btn {
    color: #f87171;
    font-size: 18px;
}

/* Main Content Area */
.app-main {
    margin-left: 240px;
    width: calc(100% - 240px);
    flex-grow: 1;
    padding: 30px 40px;
    min-height: 100vh;
    transition: margin-left 300ms ease-in-out, width 300ms ease-in-out;
    position: relative;
}

.app-main.collapsed {
    margin-left: 72px;
    width: calc(100% - 72px);
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: fixed;
    top: 24px;
    left: 221px; /* 240 - 19 */
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    transition: all 300ms ease-in-out, left 300ms ease-in-out;
    z-index: 1002;
    outline: none;
}

.sidebar-toggle.collapsed {
    left: 53px; /* 72 - 19 = 53px */
}

.sidebar-toggle:hover {
    background: #F3F4F6;
    transform: scale(1.05);
}

.sidebar-toggle:active {
    background: #E5E7EB;
    transform: scale(0.95);
}

.sidebar-toggle i {
    font-size: 20px;
}

.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 300ms ease-in-out;
}

.sidebar-backdrop.show {
    display: block;
    opacity: 1;
}

/* Top bar styled */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: var(--bg-card);
    padding: 15px 25px;
    border-radius: 16px;
    color: var(--text-main);
    box-shadow: 0 10px 25px rgba(0,0,0,0.02);
    border: 1px solid var(--border-color);
}

.header-title h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.header-title p {
    color: var(--text-muted);
    margin: 0;
    margin-top: 4px;
    font-size: 14px;
}

/* Top Bar Widgets */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-container {
    position: relative;
    width: 260px;
}

.search-input {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 10px 16px 10px 40px;
    font-size: 14px;
    color: var(--text-main);
    font-family: var(--font-sans);
}

.search-input:focus {
    outline: none;
    background: #e2e8f0;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
}

.noti-bell {
    font-size: 22px;
    color: var(--text-muted);
    position: relative;
    cursor: pointer;
    background: #f1f5f9;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.noti-bell:hover {
    background: #e2e8f0;
    color: var(--primary);
}

.noti-bell-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: white;
    width: 15px;
    height: 15px;
    font-size: 9px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Welcome Banner (Primary Theme Gradient card) */
.welcome-banner {
    background: var(--secondary-gradient);
    border-radius: 16px;
    padding: 30px;
    color: #ffffff;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px var(--apricot); /* Apricot warm shadow */
    position: relative;
    overflow: hidden;
}

.welcome-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 12px;
    color: #ffffff;
}

.welcome-title {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #ffffff;
}

.welcome-quote {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-style: italic;
}

/* Metric Cards: Pastel style based on user image */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background-color: var(--bg-card);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 15px 45px rgba(0,0,0,0.03); /* Subtler shadow */
    transition: var(--transition-smooth);
    color: var(--text-main);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    opacity: 0;
    transition: var(--transition-smooth);
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.08); /* Requested shadow */
    border-color: var(--border-color);
}

.metric-card:hover::before {
    opacity: 1;
}

.metric-card-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%; /* Circular orange icon */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: var(--primary-glow);
    color: var(--primary);
}

.metric-card-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.metric-card-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}

.metric-card .metric-card-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.metric-card .metric-card-title {
    display: block;
}

.metric-card .metric-card-value {
    display: block;
    margin-top: 4px;
}

/* Panels & Tables */
.section-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 30px;
}

.section-grid > div {
    min-width: 0;
}

@media (max-width: 1100px) {
    .section-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar-toggle {
        left: 20px !important;
        top: 25px;
    }
    
    .sidebar-toggle.collapsed {
        left: 20px !important;
    }
    
    .app-main {
        margin-left: 0 !important;
        padding-top: 80px;
    }
    
    .app-sidebar {
        transform: translateX(-100%);
    }
    
    .app-sidebar.mobile-open {
        transform: translateX(0);
    }
}

.content-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 15px 45px rgba(0,0,0,0.02);
    overflow-wrap: break-word;
    word-break: break-word;
}

.impersonate-banner {
    position: sticky;
    top: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 999;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

/* Forms & Clean Inputs */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-muted);
}

.form-input {
    width: 100%;
    background: var(--bg-main); /* Off White #FFFDFB */
    border: 1px solid var(--border-color); /* Apricot #FFD6B8 */
    border-radius: 12px;
    padding: 10px 14px;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 14px;
    transition: var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-main);
    box-shadow: 0 0 0 3px var(--peach-glow); /* Soft Peach focus ring */
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    padding-right: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary-gradient);
    color: white;
}

.btn-secondary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: rgba(0, 0, 0, 0.03);
    border-color: #cbd5e1;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
}

.btn-block {
    width: 100%;
}

/* Tables & Lists */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th {
    padding: 12px 14px;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.custom-table td {
    padding: 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: #334155;
    white-space: nowrap;
}

.custom-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-danger {
    background: var(--danger-bg);
    border: 1px solid var(--danger);
    color: var(--danger);
}

/* Financial Summaries */
.finance-bars {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.finance-bar-row {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
}

.finance-bar-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
}

.finance-bar-title {
    font-weight: 700;
}

.finance-bar-stats {
    font-size: 12px;
    color: var(--text-muted);
}

.bar-track {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill-earnings {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
}

.bar-fill-expenditures {
    height: 100%;
    background: #f43f5e;
    border-radius: 4px;
}

/* Activities / Logs */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.activity-item {
    display: flex;
    gap: 12px;
    position: relative;
}

.activity-item::before {
    content: '';
    position: absolute;
    left: 17px;
    top: 34px;
    bottom: -14px;
    width: 2px;
    background: var(--border-color);
}

.activity-item:last-child::before {
    display: none;
}

.activity-dot {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--primary);
    flex-shrink: 0;
}

.activity-dot.completed {
    color: var(--success);
    border-color: var(--success);
    background: var(--success-bg);
}

.activity-dot.award {
    color: var(--warning);
    border-color: var(--warning);
    background: var(--warning-bg);
}

.activity-content {
    flex-grow: 1;
    padding-top: 6px;
}

.activity-title {
    font-size: 13px;
    font-weight: 700;
}

.activity-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.activity-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Clock widget */
.attendance-panel {
    background: linear-gradient(135deg, #e0e7ff 0%, #fce7f3 100%);
    border: 1px solid #c7d2fe;
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    margin-bottom: 24px;
}

.attendance-clock {
    font-size: 40px;
    font-weight: 700;
    color: #1e1b4b;
    letter-spacing: -1px;
}

.attendance-date {
    font-size: 14px;
    color: #4f46e5;
    margin-bottom: 18px;
    font-weight: 500;
}

.attendance-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* Adaptive mobile layout adjustments */
@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
}

.user-avatar-placeholder {
    background: var(--primary-glow);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* User Profile Dropdown */
.profile-dropdown {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    width: 200px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px 0;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.08);
    display: none;
    z-index: 1000;
    transform-origin: bottom right;
    animation: dropdownPop 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-dropdown.show {
    display: block;
}

.profile-dropdown.dropdown-bottom {
    bottom: auto;
    top: calc(100% + 10px);
    transform-origin: top right;
}

@keyframes dropdownPop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Chatbot Widget Styles */
.chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    height: 450px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    transform-origin: bottom right;
    animation: dropdownPop 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-container.show {
    display: flex;
}

.chatbot-header {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-message.bot {
    background: #ffffff;
    color: #334155;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
}

.chat-message.user {
    background: #4f46e5;
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 5px rgba(79, 70, 229, 0.2);
}

.chatbot-input-area {
    padding: 15px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
}

.chatbot-input-area input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    outline: none;
    font-size: 13px;
    font-family: inherit;
    background: #f8fafc;
}

.chatbot-input-area input:focus {
    border-color: #4f46e5;
}

.chatbot-input-area button {
    background: #ef4444;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s ease;
}

.chatbot-input-area button:hover {
    background: #dc2626;
}

.profile-dropdown a, .profile-dropdown button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.profile-dropdown a:hover, .profile-dropdown button:hover {
    background: #334155;
    color: #ffffff;
}

.profile-dropdown button {
    color: #f87171;
}

.profile-dropdown button:hover {
    background: rgba(248, 113, 113, 0.1);
    color: #ef4444;
}

.profile-dropdown-divider {
    height: 1px;
    background: #334155;
    margin: 6px 0;
}

/* Premium Form Controls */
.form-control {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: var(--font-sans);
    color: var(--text-main);
    background-color: #f9fafb;
    background-clip: padding-box;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.form-control:focus {
    color: var(--text-main);
    background-color: #ffffff;
    border-color: var(--primary);
    outline: 0;
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.form-control::placeholder {
    color: #9ca3af;
    opacity: 1;
}

/* Stylish File Input */
input[type="file"].form-control {
    padding: 8px;
    background-color: #ffffff;
}

input[type="file"].form-control::file-selector-button {
    padding: 6px 12px;
    margin-right: 12px;
    background: var(--primary-glow);
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--primary);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

input[type="file"].form-control::file-selector-button:hover {
    background: var(--primary);
    color: white;
}

/* Tonal Action Buttons */
.btn-action-edit, .btn-action-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-action-edit {
    background: rgba(2, 132, 199, 0.1);
    color: var(--info);
}
.btn-action-edit:hover {
    background: var(--info);
    color: white;
}

.btn-action-delete {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
}
.btn-action-delete:hover {
    background: var(--danger);
    color: white;
}

/* ── Responsive Layout & Sidebar Variables ── */

.app-main {
    flex: 1;
    margin-left: 240px;
    width: calc(100% - 240px);
    transition: margin-left 300ms cubic-bezier(0.4, 0, 0.2, 1), width 300ms cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-main.collapsed {
    margin-left: 72px;
    width: calc(100% - 72px);
}

.sidebar-toggle {
    position: fixed;
    top: 15px;
    left: 20px;
    z-index: 1002;
    background: var(--primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: none; /* Hidden on desktop */
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(255, 107, 0, 0.3);
}

.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-backdrop.show {
    display: block;
    opacity: 1;
}

/* ── Media Queries for Responsiveness ── */

@media (max-width: 1100px) {
    /* Sidebar goes off-canvas */
    .app-sidebar {
        transform: translateX(-100%);
        width: 260px !important; /* Fixed width on mobile */
    }
    .app-sidebar.mobile-open {
        transform: translateX(0);
    }
    
    /* Main content takes full width */
    .app-main, .app-main.collapsed {
        margin-left: 0 !important;
        width: 100% !important;
        padding-top: 60px; /* Space for the mobile toggle button */
    }
    
    /* Show mobile toggle */
    .sidebar-toggle {
        display: flex;
    }
    
    /* Ensure forms are responsive */
    form .grid, .form-row {
        grid-template-columns: 1fr !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Cards and Grids collapse */
    .dashboard-grid, .stats-grid, .cards-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Ensure tables can scroll horizontally */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        display: block;
    }
    
    /* Adjust specific widget paddings */
    .dashboard-card, .card {
        padding: 15px;
    }
}

@media (max-width: 768px) {
    .auth-card {
        padding: 30px 20px;
        margin: 15px;
    }
    
    .topbar-right {
        gap: 10px;
    }
    
    .chatbot-container {
        width: 90%;
        right: 5%;
        bottom: 80px;
    }

    .floating-helpdesk {
        width: 45px !important;
        height: 45px !important;
        font-size: 22px !important;
        bottom: 20px !important;
        right: 20px !important;
    }

    .impersonate-banner {
        top: 60px; /* Sticks below the mobile header */
        flex-direction: column;
        padding: 10px;
        font-size: 13px;
        gap: 5px;
    }
}

/* Custom Select Styles */
.custom-select-wrapper { position: relative; user-select: none; min-width: 200px; }
.custom-select { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; background: #fff; border: 1px solid var(--border-color); border-radius: 10px; cursor: pointer; font-size: 13px; color: var(--text-main); box-shadow: 0 2px 6px rgba(0,0,0,0.02); transition: all 0.2s ease; }
.custom-select:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(249, 115, 22, 0.1); }
.custom-select-img { width: 26px; height: 26px; border-radius: 8px; object-fit: cover; margin-right: 12px; border: 1px solid rgba(0,0,0,0.05); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.custom-select-options { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: #fff; border: 1px solid var(--border-color); border-radius: 12px; box-shadow: 0 10px 40px -10px rgba(0,0,0,0.15); z-index: 100; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); max-height: 300px; overflow-y: auto; padding: 8px; }
.custom-select-options.show { opacity: 1; visibility: visible; transform: translateY(0); }
.custom-option { display: flex; align-items: center; padding: 10px 12px; margin-bottom: 2px; border-radius: 8px; cursor: pointer; transition: all 0.2s ease; font-size: 13px; color: var(--text-main); font-weight: 500; }
.custom-option:last-child { margin-bottom: 0; }
.custom-option:hover { background: #f8fafc; color: var(--primary); padding-left: 16px; }
.custom-option.selected { background: #fff7ed; color: var(--primary); font-weight: 600; }
.custom-option.selected::after { content: '\2713'; margin-left: auto; font-size: 14px; font-weight: bold; }

/* Award Recognition Form UI */
.custom-input-style { border: 1px solid rgba(0,0,0,0.08); border-radius: 12px; padding: 12px 16px; background: #fafafa; font-size: 13px; color: var(--text-main); transition: all 0.3s ease; box-shadow: inset 0 2px 4px rgba(0,0,0,0.01); }
.custom-input-style:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1), inset 0 2px 4px rgba(0,0,0,0.01); outline: none; }
.input-with-icon { position: relative; display: flex; align-items: center; }
.input-icon { position: absolute; left: 16px; color: var(--text-muted); font-weight: 600; font-size: 14px; pointer-events: none; }
.submit-award-btn { margin-top: 15px; padding: 14px 20px; font-size: 14px; font-weight: 600; letter-spacing: 0.3px; border-radius: 12px; background: linear-gradient(135deg, var(--primary), var(--secondary)); box-shadow: 0 8px 20px rgba(249, 115, 22, 0.25); display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.3s ease; border: none; color: white; cursor: pointer; width: 100%; }
.submit-award-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 25px rgba(249, 115, 22, 0.35); }
