/* ============================================
   ENTEGREYERI — Premium Professional CSS
   Green-themed enterprise design system
   ============================================ */

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

:root {
    /* Primary Green Palette */
    --primary-50: #ecfdf5;
    --primary-100: #d1fae5;
    --primary-200: #a7f3d0;
    --primary-300: #6ee7b7;
    --primary-400: #34d399;
    --primary-500: #10b981;
    --primary-600: #059669;
    --primary-700: #047857;
    --primary-800: #065f46;
    --primary-900: #064e3b;
    --primary-950: #022c22;

    /* Accent */
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --accent-cyan: #06b6d4;

    /* Neutral */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Semantic */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Surfaces — light command-center canvas */
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --text: var(--gray-800);
    --text-muted: var(--gray-500);
    --border: var(--gray-200);
    --overlay: rgba(15, 23, 42, 0.45);

    /* Layout */
    --sidebar-width: 280px;
    --sidebar-collapsed: 76px;
    --sidebar-current: var(--sidebar-width);
    --topbar-height: 64px;
    --border-radius: 14px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --space: 8px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, .05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, .1), 0 1px 2px -1px rgba(0, 0, 0, .1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -2px rgba(0, 0, 0, .1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -4px rgba(0, 0, 0, .1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1);

    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg: #0b1220;
    --surface: #111827;
    --surface-muted: #1f2937;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --border: #1f2937;
    --overlay: rgba(0, 0, 0, 0.6);
    --gray-50: #111827;
    --gray-100: #1f2937;
    --gray-200: #334155;
}

/* ============================================
   RESET & BASE
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

/* Hide number input spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
    color: var(--primary-700);
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-900) 0%, var(--primary-700) 50%, var(--primary-500) 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at center, rgba(16, 185, 129, 0.15) 0%, transparent 70%);
    animation: loginPulse 8s ease-in-out infinite;
}

@keyframes loginPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

.login-page::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    top: -200px;
    right: -200px;
}

.login-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 440px;
    padding: 0 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius-lg);
    padding: 48px 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: loginSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.4);
}

.login-logo .logo-icon i {
    font-size: 32px;
    color: white;
}

.login-logo h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary-900);
    letter-spacing: -0.5px;
}

.login-logo p {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 4px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.login-form .input-wrapper {
    position: relative;
    width: 100%;
    min-width: 0;
}

.login-form .input-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 1.1rem;
    transition: var(--transition-fast);
}

.login-form .form-control {
    width: 100%;
    padding: 12px 14px 12px 44px;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--gray-800);
    background: white;
    transition: var(--transition);
    outline: none;
}

.login-form .form-control:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.login-form .form-control:focus+i,
.login-form .input-wrapper:focus-within i {
    color: var(--primary-600);
}

.login-form .form-control::placeholder {
    color: var(--gray-400);
}

.password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0;
    font-size: 1.1rem;
    transition: var(--transition-fast);
    z-index: 2;
}

.login-form .password-input-control {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.login-form .password-input-control #passwordInput {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding-right: 48px;
}

.login-form .password-input-control .password-toggle {
    right: 8px;
    width: 32px;
    height: 32px;
}

.login-form .password-input-control .password-toggle i {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    font-size: inherit;
}

.password-toggle:hover {
    color: var(--gray-600);
}

.form-check-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-600);
    cursor: pointer;
}

.form-check label {
    font-size: 0.8125rem;
    color: var(--gray-600);
    margin: 0;
    cursor: pointer;
}

.forgot-link {
    font-size: 0.8125rem;
    color: var(--primary-600);
    font-weight: 500;
}

.forgot-link:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

.btn-login {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--border-radius-sm);
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: white;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-800));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4);
}

.btn-login:hover::before {
    left: 100%;
}

.btn-login:active {
    transform: translateY(0);
}

.login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--border-radius-sm);
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-error i {
    color: var(--danger);
    font-size: 1.1rem;
}

.login-error span {
    color: #991b1b;
    font-size: 0.8125rem;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

.login-footer p {
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* ============================================
   MAIN LAYOUT
   ============================================ */
.app-layout {
    display: block;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-current);
    background: linear-gradient(180deg, var(--primary-950) 0%, var(--primary-900) 100%);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 16px 20px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
}

.sidebar-rail-toggle {
    margin-left: auto;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.75);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-rail-toggle i {
    font-size: 1.15rem;
    line-height: 1;
}

.sidebar-rail-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

.sidebar-logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary-400), var(--primary-600));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.sidebar-logo i {
    font-size: 22px;
    color: white;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
}

.sidebar-brand h2 {
    font-size: 1.125rem;
    font-weight: 800;
    color: white;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.sidebar-brand span {
    font-size: 0.6875rem;
    color: var(--primary-300);
    font-weight: 400;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section.collapsed {
    margin-bottom: 2px;
}

.nav-section.collapsed > .nav-item,
.nav-section.collapsed > .nav-submenu {
    display: none;
}

.nav-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--primary-400);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    user-select: none;
}

.nav-section-title:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
}

.nav-section-title::after {
    content: "\F282";
    font-family: "bootstrap-icons";
    font-size: 0.7rem;
    margin-left: auto;
    opacity: 0.55;
    transition: transform 0.15s ease;
}

.nav-section.collapsed .nav-section-title::after {
    transform: rotate(-90deg);
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-radius: var(--border-radius-sm);
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    margin-bottom: 2px;
    position: relative;
    white-space: nowrap;
}

.nav-item i {
    width: 22px;
    font-size: 1.125rem;
    margin-right: 12px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    text-decoration: none;
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.15));
    color: white;
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary-400);
    border-radius: 0 3px 3px 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--primary-500);
    color: white;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    min-width: 22px;
    text-align: center;
}

.nav-badge.warning {
    background: var(--accent-orange);
}

.nav-badge.danger {
    background: var(--accent-red);
}

.nav-item .coming-soon {
    margin-left: auto;
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--primary-400);
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Submenu */
.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-submenu.open {
    max-height: 500px;
}

.nav-submenu .nav-item {
    padding-left: 50px;
    font-size: 0.8125rem;
}

.nav-item .arrow {
    margin-left: auto;
    font-size: 0.75rem;
    transition: var(--transition-fast);
}

.nav-item.expanded .arrow {
    transform: rotate(90deg);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-400), var(--primary-600));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

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

.sidebar-user-info h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-info span {
    font-size: 0.6875rem;
    color: var(--primary-300);
}

html.sidebar-mini {
    --sidebar-current: var(--sidebar-collapsed);
}

html.sidebar-mini .sidebar {
    width: var(--sidebar-collapsed);
}

html.sidebar-mini .main-content {
    margin-left: var(--sidebar-collapsed);
}

@media (min-width: 769px) {
    .sidebar-toggle {
        display: none !important;
    }

    html.sidebar-mini .sidebar-header {
        padding: 14px 8px 10px;
        justify-content: center;
        gap: 0;
    }

    html.sidebar-mini .sidebar-brand,
    html.sidebar-mini .sidebar-user-info,
    html.sidebar-mini .nav-section-title,
    html.sidebar-mini .nav-badge,
    html.sidebar-mini .nav-item .coming-soon,
    html.sidebar-mini .nav-item .arrow {
        display: none !important;
    }

    html.sidebar-mini .sidebar-rail-toggle {
        display: inline-flex;
        margin-left: 0;
        position: static;
        width: 28px;
        height: 28px;
    }

    html.sidebar-mini .sidebar-nav {
        padding: 10px 8px;
    }

    html.sidebar-mini .nav-section {
        margin-bottom: 4px;
    }

    html.sidebar-mini .nav-section.collapsed > .nav-item {
        display: flex;
    }

    html.sidebar-mini .nav-section.collapsed > .nav-submenu {
        display: block;
    }

    html.sidebar-mini .nav-submenu {
        max-height: none !important;
        overflow: visible;
    }

    html.sidebar-mini .nav-item {
        justify-content: center;
        padding: 10px 8px;
        font-size: 0;
        line-height: 0;
    }

    html.sidebar-mini .nav-item i {
        width: auto;
        margin-right: 0;
        font-size: 1.2rem;
        line-height: 1;
        color: inherit;
    }

    html.sidebar-mini .nav-submenu .nav-item {
        padding-left: 8px;
    }

    html.sidebar-mini .sidebar-footer {
        padding: 10px 8px;
    }

    html.sidebar-mini .sidebar-user {
        justify-content: center;
        padding: 8px;
        gap: 0;
    }
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-current);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.2s ease;
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
    height: var(--topbar-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 12px;
    box-shadow: none;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sidebar-toggle.is-mini {
    background: var(--primary-50);
    color: var(--primary-700);
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.topbar-breadcrumb .separator {
    color: var(--gray-300);
}

.topbar-breadcrumb .current {
    color: var(--gray-800);
    font-weight: 600;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

button.topbar-search {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    min-width: 280px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: #fff;
    box-shadow: none;
    color: var(--gray-500);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0;
    cursor: pointer;
    white-space: nowrap;
}
button.topbar-search i { font-size: 0.9rem; color: var(--gray-400); }
button.topbar-search:hover { border-color: var(--primary-300); background: var(--primary-50); color: var(--primary-800); }
button.topbar-search:hover i { color: var(--primary-600); }
.topbar-search-key {
    margin-left: auto;
    padding: 3px 6px;
    border-radius: 6px;
    background: var(--gray-100);
    color: var(--gray-500);
    font-family: inherit;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.topbar-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    border: none;
    background: transparent;
    color: var(--gray-500);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: var(--transition-fast);
}

.topbar-btn:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.topbar-btn .badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-red);
    border: 2px solid white;
}

.topbar-divider {
    width: 1px;
    height: 28px;
    background: var(--gray-200);
    margin: 0 8px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.topbar-user:hover {
    background: var(--gray-100);
}

.topbar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-400), var(--primary-600));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 700;
    color: white;
}

.topbar-user-info {
    display: flex;
    flex-direction: column;
}

.topbar-user-info .name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-800);
    line-height: 1.2;
}

.topbar-user-info .role {
    font-size: 0.6875rem;
    color: var(--gray-500);
}

/* User Dropdown */
.user-dropdown {
    position: relative;
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--gray-200);
    min-width: 220px;
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition-fast);
    z-index: 200;
}

.user-dropdown.open .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--border-radius-sm);
    font-size: 0.8125rem;
    color: var(--gray-700);
    transition: var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.dropdown-item i {
    font-size: 1.1rem;
    width: 20px;
    color: var(--gray-500);
}

.dropdown-item:hover {
    background: var(--gray-100);
    color: var(--gray-900);
    text-decoration: none;
}

.dropdown-item.danger {
    color: var(--danger);
}

.dropdown-item.danger i {
    color: var(--danger);
}

.dropdown-divider {
    height: 1px;
    background: var(--gray-100);
    margin: 4px 8px;
}

/* ============================================
   DASHBOARD CONTENT
   ============================================ */
.page-content {
    flex: 1;
    padding: 24px;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.625rem;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.5px;
}

.page-header p {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 4px;
}

/* ============================================
   STAT CARDS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 22px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.stat-card.green::before {
    background: linear-gradient(90deg, var(--primary-400), var(--primary-600));
}

.stat-card.blue::before {
    background: linear-gradient(90deg, var(--accent-blue), #2563eb);
}

.stat-card.orange::before {
    background: linear-gradient(90deg, var(--accent-orange), #d97706);
}

.stat-card.purple::before {
    background: linear-gradient(90deg, var(--accent-purple), #7c3aed);
}

.stat-card.cyan::before {
    background: linear-gradient(90deg, var(--accent-cyan), #0891b2);
}

.stat-card.red::before {
    background: linear-gradient(90deg, var(--accent-red), #dc2626);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
    flex-shrink: 0;
}

.stat-icon.green {
    background: var(--primary-50);
    color: var(--primary-600);
}

.stat-icon.blue {
    background: #eff6ff;
    color: var(--accent-blue);
}

.stat-icon.orange {
    background: #fffbeb;
    color: var(--accent-orange);
}

.stat-icon.purple {
    background: #f5f3ff;
    color: var(--accent-purple);
}

.stat-icon.cyan {
    background: #ecfeff;
    color: var(--accent-cyan);
}

.stat-icon.red {
    background: #fef2f2;
    color: var(--accent-red);
}

.stat-info h3 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-info p {
    font-size: 0.8125rem;
    color: var(--gray-500);
    font-weight: 500;
}

.stat-trend {
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: 20px;
}

.stat-trend.up {
    color: var(--success);
    background: var(--primary-50);
}

.stat-trend.down {
    color: var(--danger);
    background: #fef2f2;
}

/* ============================================
   CONTENT CARDS
   ============================================ */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

.content-grid.single {
    grid-template-columns: 1fr;
}

.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    overflow: hidden;
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h3 i {
    color: var(--primary-600);
    font-size: 1.1rem;
}

.card-header .card-actions {
    display: flex;
    gap: 8px;
}

.card-body {
    padding: 22px;
}

/* ============================================
   ACTIVITY LIST
   ============================================ */
.activity-list {
    list-style: none;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--gray-50);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.activity-icon.success {
    background: var(--primary-50);
    color: var(--primary-600);
}

.activity-icon.warning {
    background: #fffbeb;
    color: var(--accent-orange);
}

.activity-icon.danger {
    background: #fef2f2;
    color: var(--accent-red);
}

.activity-icon.info {
    background: #eff6ff;
    color: var(--accent-blue);
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-content h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-800);
}

.activity-content p {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-time {
    font-size: 0.6875rem;
    color: var(--gray-400);
    white-space: nowrap;
    margin-top: 2px;
}

/* ============================================
   NOTIFICATIONS
   ============================================ */
.notification-list {
    list-style: none;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--gray-50);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.notification-dot.success {
    background: var(--success);
}

.notification-dot.warning {
    background: var(--warning);
}

.notification-dot.error {
    background: var(--danger);
}

.notification-dot.info {
    background: var(--info);
}

.notification-content h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-800);
}

.notification-content p {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 2px;
}

/* ============================================
   QUICK ACTIONS
   ============================================ */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 14px;
    border-radius: var(--border-radius-sm);
    border: 2px dashed var(--gray-200);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    background: none;
    font-family: inherit;
    color: var(--gray-600);
}

.quick-action i {
    font-size: 1.5rem;
    color: var(--primary-500);
    transition: var(--transition-fast);
}

.quick-action span {
    font-size: 0.75rem;
    font-weight: 600;
}

.quick-action:hover {
    border-color: var(--primary-300);
    background: var(--primary-50);
    color: var(--primary-700);
    text-decoration: none;
}

.quick-action:hover i {
    transform: scale(1.1);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state i {
    font-size: 3rem;
    color: var(--gray-300);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1rem;
    color: var(--gray-600);
    margin-bottom: 4px;
}

.empty-state p {
    font-size: 0.8125rem;
    color: var(--gray-400);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
    color: white;
    text-decoration: none;
}

.btn-outline {
    background: white;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

/* ============================================
   STATUS BADGES
   ============================================ */
.status-badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-badge.success {
    background: var(--primary-50);
    color: var(--primary-700);
}

.status-badge.warning {
    background: #fffbeb;
    color: #b45309;
}

.status-badge.danger {
    background: #fef2f2;
    color: #b91c1c;
}

.status-badge.info {
    background: #eff6ff;
    color: #1d4ed8;
}

.status-badge.pool {
    background: #f0fdfa;
    color: #0f766e;
}

.status-badge.prepared {
    background: #faf5ff;
    color: #7c3aed;
}

.status-badge.pending {
    background: #fffbeb;
    color: #b45309;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        transition: none;
    }

    html.sidebar-mini {
        --sidebar-current: var(--sidebar-width);
    }

    .sidebar {
        width: var(--sidebar-width);
        transition: transform 0.2s ease;
    }

    .sidebar-rail-toggle {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .topbar-user-info {
        display: none;
    }

    .page-content {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 32px 24px;
    }
}

/* Mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(4px);
}

.sidebar-overlay.active {
    display: block;
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   TOOLTIP
   ============================================ */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-900);
    color: white;
    font-size: 0.6875rem;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-fast);
    pointer-events: none;
    z-index: 9999;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   SHELL / EMBED + WORKSPACE TABS + PWA
   ============================================ */
html.embed-mode .sidebar,
html.embed-mode .topbar,
html.embed-mode .sidebar-overlay,
html.embed-mode .workspace {
    display: none !important;
}

html.embed-mode .main-content {
    margin-left: 0 !important;
    min-height: 0;
}

html.embed-mode .app-layout {
    display: block;
}

html.embed-mode,
html.embed-mode body {
    background: var(--gray-100);
}

html.shell-mode,
html.shell-mode body {
    height: 100%;
    overflow: hidden;
}

html.shell-mode .app-layout,
html.shell-mode .main-content {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
}

html.shell-mode .page-content {
    display: none !important;
}

.workspace {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    background: var(--gray-100);
}

html.shell-mode .workspace {
    display: flex;
}

.workspace-tabbar {
    display: flex;
    align-items: stretch;
    background: #e8eef4;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
    min-height: 40px;
}

.workspace-tabs {
    display: flex;
    align-items: stretch;
    gap: 4px;
    padding: 6px 8px 0 12px;
    overflow-x: auto;
    overflow-y: hidden;
    flex: 1;
    min-width: 0;
}

.workspace-tabs::-webkit-scrollbar {
    height: 4px;
}

.ws-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 240px;
    min-width: 120px;
    height: 34px;
    padding: 0 8px 0 12px;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    background: transparent;
    color: var(--gray-600);
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.ws-tab i {
    font-size: 0.85rem;
    color: var(--gray-400);
    flex-shrink: 0;
}

.ws-tab-title {
    overflow: hidden;
    text-overflow: ellipsis;
}

.ws-tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    color: var(--gray-400);
    margin-left: 2px;
    flex-shrink: 0;
}

.ws-tab-close:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.ws-tab:hover {
    background: rgba(255, 255, 255, 0.55);
}

.ws-tab.active {
    background: #fff;
    color: var(--gray-800);
    border-color: var(--gray-200);
    box-shadow: 0 -1px 0 #fff;
}

.ws-tab.active i {
    color: var(--primary-600);
}

.ws-tab-kapat-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 4px 10px 4px 6px;
    border-left: 1px solid var(--gray-200);
    background: #e8eef4;
}

.ws-tab-kapat-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: #fff;
    color: var(--gray-700);
    font-size: 0.75rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.ws-tab-kapat-btn:hover,
.ws-tab-kapat-wrap.open .ws-tab-kapat-btn {
    border-color: var(--primary-300);
    color: var(--primary-700);
    background: var(--primary-50);
}

.ws-tab-kapat-btn i {
    font-size: 0.7rem;
}

.ws-tab-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 8px;
    min-width: 210px;
    padding: 6px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--gray-200);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
    z-index: 80;
}

.ws-tab-context {
    position: fixed;
    right: auto;
    top: auto;
    z-index: 4000;
}

.ws-tab-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    border-radius: 7px;
    padding: 8px 10px;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--gray-700);
    cursor: pointer;
}

.ws-tab-menu-item:hover:not(:disabled) {
    background: var(--primary-50);
    color: var(--primary-700);
}

.ws-tab-menu-item.danger {
    color: #dc2626;
}

.ws-tab-menu-item.danger:hover:not(:disabled) {
    background: #fef2f2;
    color: #b91c1c;
}

.ws-tab-menu-item:disabled {
    color: var(--gray-400);
    cursor: default;
}

.workspace-panes {
    flex: 1;
    min-height: 0;
    position: relative;
    background: var(--gray-100);
}

.ws-pane {
    display: none;
    position: absolute;
    inset: 0;
}

.ws-pane.active {
    display: block;
}

.ws-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: var(--gray-100);
}

.ws-frame-loading {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--gray-600);
    background: var(--gray-100);
    font-size: .9rem;
}

.ws-frame-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: ws-frame-spin .8s linear infinite;
}

@keyframes ws-frame-spin { to { transform: rotate(360deg); } }

.topbar-install {
    display: none;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--primary-200);
    border-radius: 8px;
    background: var(--primary-50);
    color: var(--primary-700);
    font-size: 0.75rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.topbar-install:hover {
    background: var(--primary-100);
}

html.shell-mode .topbar-install {
    display: inline-flex;
}

@media (max-width: 768px) {
    .topbar-install span {
        display: none;
    }

    .ws-tab {
        min-width: 96px;
        max-width: 160px;
    }
}

.integration-inline-status {
    display: none;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.45;
    margin-top: 8px;
}

.integration-inline-status.is-success {
    background: var(--primary-50);
    color: var(--primary-800);
    border: 1px solid var(--primary-200);
}

.integration-inline-status.is-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.integration-inline-status i {
    flex-shrink: 0;
    margin-top: 2px;
}
.login-form .input-wrapper.password-field {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
}

.login-form .input-wrapper.password-field #passwordInput {
    display: block;
    width: 100%;
    min-width: 0;
    padding-right: 52px;
}

.login-form .input-wrapper.password-field .password-toggle {
    position: absolute;
    inset-inline-end: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.login-form .input-wrapper.password-field .password-toggle i {
    position: static;
    left: auto;
    top: auto;
    transform: none;
}
