:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #dbeafe;
    --secondary-color: #64748b;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-color: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --sidebar-width: 260px;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-hover: #334155;
    --sidebar-active: #2563eb;
}

* {
    box-sizing: border-box;
}

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

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

/* ========== SIDEBAR ========== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    height: 48px;
    width: auto;
    filter: brightness(0) invert(1);
}

.sidebar-nav {
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    display: block;
    padding: 0.5rem 1.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    opacity: 0.6;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s ease;
    margin: 0.125rem 0.75rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
}

.nav-item.active {
    background: var(--sidebar-active);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    width: 24px;
    height: 20px;
    color: inherit;
}

.nav-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.nav-label {
    font-size: 0.9rem;
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
}

.user-avatar img.avatar-photo,
.user-avatar-mini img.avatar-photo-mini {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar-mini {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    color: white;
    overflow: hidden;
}

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

.user-email {
    font-size: 0.85rem;
    font-weight: 500;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.8;
}

.btn-logout {
    width: 100%;
    padding: 0.65rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fecaca;
}

/* ========== MAIN CONTENT ========== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-header {
    background: white;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.content-body {
    flex: 1;
    padding: 1rem 2rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

/* ========== CARDS & GRID ========== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.card {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
    border-color: var(--primary-light);
}

.card-header {
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 0.25rem 0;
}

.card-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
}

.card-body {
    flex: 1;
}

.card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    transform: translateY(-1px);
}

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

.btn-outline:hover:not(:disabled) {
    background: var(--background-color);
    border-color: var(--text-muted);
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

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

.btn-success:hover:not(:disabled) {
    background: #059669;
}

/* ========== FORMS ========== */
input,
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s;
    background: white;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: var(--background-color);
    cursor: not-allowed;
    opacity: 0.6;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-color);
}

/* ========== TABLE ========== */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.table thead {
    background: var(--background-color);
}

.table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: var(--background-color);
}

/* ========== BADGES ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-admin {
    background: #dbeafe;
    color: #1e40af;
}

.badge-editor {
    background: #d1fae5;
    color: #065f46;
}

.badge-cliente {
    background: #fef3c7;
    color: #92400e;
}

.badge-comercial {
    background: #e9d5ff;
    color: #6b21a8;
}

/* ========== MODAL ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.95);
    /* Almost solid dark slate */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 90vw;
    width: auto;
    min-width: 320px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-color);
}

.modal form {
    padding: 1.5rem;
}

.modal form>div {
    margin-bottom: 1.25rem;
}

.modal form>div:last-child {
    margin-bottom: 0;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--background-color);
}

/* ========== UTILITIES ========== */
.flex {
    display: flex;
}

.gap-2 {
    gap: 0.5rem;
}

.text-red {
    color: var(--danger-color);
}

.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1rem;
}

.my-4 {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

/* ========== LOGIN PAGE ========== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sidebar-bg);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></svg>');
    opacity: 0.3;
}

.login-card {
    background: white;
    width: 100%;
    max-width: 440px;
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo-large {
    display: block;
    margin: 0 auto 0.5rem;
    height: 96px;
    width: auto;
}

.brand-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-color);
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.brand-subtitle {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 0.25rem;
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: var(--text-color);
}

.login-card label {
    margin-bottom: 0.5rem;
    display: block;
    font-weight: 500;
}

.login-card input {
    margin-bottom: 1.25rem;
}

.login-card .btn-primary {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
    margin-top: 0.5rem;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

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

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

    .content-header {
        padding: 1rem 1.5rem;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .content-body {
        padding: 1.5rem;
    }

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

/* ========== LOADING SPINNER ========== */
.loading-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.loading-fullpage {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    position: relative;
    width: 60px;
    height: 60px;
}

.spinner {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    height: 70%;
    border: 4px solid transparent;
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 1.2s linear infinite reverse;
}

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

.loading-message {
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
}

/* Loading indicator (old style - keep for compatibility) */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
    font-style: italic;
}

.loading-indicator::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}


/* ========== ALERTS ========== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alert-error {
    background: #fee2e2;
    border-color: var(--danger-color);
    color: #991b1b;
}

.alert-success {
    background: #d1fae5;
    border-color: var(--success-color);
    color: #065f46;
}

.alert-warning {
    background: #fef3c7;
    border-color: var(--warning-color);
    color: #92400e;
}

/* ========== COLLAPSIBLE SIDEBAR ========== */
:root {
    --sidebar-width-collapsed: 70px;
}

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

.sidebar.collapsed .sidebar-header {
    padding: 1rem 0.5rem;
    justify-content: center;
}

.sidebar.collapsed .sidebar-logo-link {
    display: none;
}

.sidebar.collapsed .sidebar-logo {
    display: none;
}

.sidebar.collapsed .nav-section-title {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.75rem;
    margin: 0.25rem 0.5rem;
}

.sidebar.collapsed .nav-icon {
    margin-right: 0;
}

.sidebar.collapsed .nav-icon svg {
    width: 22px;
    height: 22px;
}

.sidebar.collapsed .nav-label {
    display: none;
}

.sidebar.collapsed .user-details {
    display: none;
}

.sidebar.collapsed .user-info {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .btn-logout {
    padding: 0.5rem;
    font-size: 1.25rem;
}

.sidebar.collapsed .btn-logout span:last-child {
    display: none;
}

.user-avatar-mini {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
    margin: 0 auto 0.5rem;
}

/* Collapse toggle button - Home Assistant style */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo-link {
    flex: 1;
    cursor: pointer;
}

/* Home Assistant style sidebar toggle button */
.btn-sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
}

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

/* Sidebar panel icon (arrow + lines) - shown when expanded */
.sidebar-panel-icon {
    display: flex;
    align-items: center;
    width: 20px;
    height: 20px;
    gap: 3px;
}

.panel-arrow {
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 6px solid var(--sidebar-text);
    transition: all 0.2s ease;
}

.panel-lines {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.panel-line {
    display: block;
    width: 10px;
    height: 2px;
    background: var(--sidebar-text);
    border-radius: 1px;
    transition: all 0.2s ease;
}

.btn-sidebar-toggle:hover .panel-arrow {
    border-right-color: white;
}

.btn-sidebar-toggle:hover .panel-line {
    background: white;
}

/* Hamburger menu icon - shown when collapsed */
.hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
    gap: 4px;
}

.hamburger-bar {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--sidebar-text);
    border-radius: 1px;
    transition: all 0.3s ease;
}

.btn-sidebar-toggle:hover .hamburger-bar {
    background: white;
}

/* Collapsed state - center the toggle button */
.sidebar.collapsed .btn-sidebar-toggle {
    margin: 0 auto;
}

/* Layout adjustment for collapsed sidebar */
.app-layout.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-width-collapsed);
}

/* ========== TOP NAVIGATION BAR (Breadcrumbs) ========== */
.top-nav {
    background: var(--background-color);
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-menu-btn {
    display: none;
}

.breadcrumbs {
    flex: 1;
}

.breadcrumb-list {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.breadcrumb-home {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.breadcrumb-home svg {
    stroke: currentColor;
}

.breadcrumb-home:hover {
    background: var(--background-color);
    color: var(--primary-color);
}

.breadcrumb-separator {
    color: var(--border-color);
    font-weight: 300;
}

.breadcrumb-link {
    color: var(--primary-color);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
    cursor: pointer;
}

.breadcrumb-link:hover {
    background: var(--primary-light);
}

.breadcrumb-current {
    color: var(--text-color);
    font-weight: 500;
    padding: 0.25rem 0.5rem;
}

.breadcrumb-icon {
    margin-right: 0.25rem;
}

.top-nav-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ========== HAMBURGER MENU ========== */
.btn-hamburger {
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
}

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

.hamburger-line {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-color);
    border-radius: 2px;
    transition: all 0.3s;
}

/* ========== MOBILE OVERLAY ========== */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
}

/* ========== RESPONSIVE - MOBILE ========== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: var(--sidebar-width) !important;
    }

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

    .sidebar.collapsed {
        width: var(--sidebar-width) !important;
    }

    .sidebar.collapsed .sidebar-logo-link,
    .sidebar.collapsed .sidebar-logo,
    .sidebar.collapsed .nav-section-title,
    .sidebar.collapsed .nav-label,
    .sidebar.collapsed .user-details {
        display: block;
    }

    .sidebar.collapsed .nav-item {
        justify-content: flex-start;
        padding: 0.75rem 1.25rem;
    }

    .sidebar.collapsed .nav-icon {
        margin-right: 0.75rem;
        font-size: 1.25rem;
    }

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

    .main-content {
        margin-left: 0 !important;
    }

    .mobile-menu-btn {
        display: block;
    }

    .mobile-overlay {
        display: block;
    }

    .top-nav {
        padding: 0.75rem 1rem;
    }

    .content-header {
        padding: 1rem 1.5rem;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .content-body {
        padding: 1rem;
    }

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

    .breadcrumb-list {
        font-size: 0.8rem;
    }

    .top-nav-actions {
        display: none;
    }
}

/* ========== BADGE OUTLINE ========== */
.badge-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

/* ========== NEW UPLOAD MODAL ========== */
.upload-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.upload-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 520px;
    overflow: hidden;
}

.upload-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.upload-modal-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-color);
}

.upload-modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.upload-modal-close:hover {
    background: var(--background-color);
    color: var(--text-color);
}

.upload-modal-body {
    padding: 1.25rem;
}

/* Drop Zone */
.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
}

.upload-dropzone:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.02);
}

.upload-dropzone.drag-active {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.upload-file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-dropzone-icon {
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.upload-dropzone-icon svg {
    stroke: currentColor;
}

.upload-dropzone-text {
    font-size: 0.9rem;
    color: var(--text-color);
}

.upload-dropzone-link {
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: underline;
}

.upload-dropzone-link:hover {
    text-decoration: none;
}

/* Selected File Preview */
.upload-file-preview {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.upload-file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--background-color);
    border-radius: 8px;
}

.upload-file-icon {
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.upload-file-icon svg {
    stroke: currentColor;
}

.upload-file-ext {
    position: absolute;
    bottom: 2px;
    font-size: 0.5rem;
    font-weight: 700;
    color: var(--primary-color);
    background: white;
    padding: 0 2px;
    border-radius: 2px;
}

.upload-file-details {
    flex: 1;
    min-width: 0;
}

.upload-file-name {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-file-size {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.upload-file-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.upload-file-remove:hover {
    color: var(--danger-color);
    background: #fee2e2;
}

/* Description Input */
.upload-description {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem;
    background: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.upload-description-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-color);
    outline: none;
}

.upload-description-input::placeholder {
    color: var(--text-muted);
}

.upload-send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Progress */
.upload-progress-container {
    padding: 1rem;
}

.upload-progress-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.upload-file-icon.uploading {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.upload-progress-details {
    flex: 1;
}

.upload-progress-bar {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.upload-progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.upload-progress-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Error */
.upload-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #fee2e2;
    border-radius: 6px;
    color: var(--danger-color);
    font-size: 0.85rem;
    margin-top: 1rem;
}

.upload-error svg {
    flex-shrink: 0;
}

/* Formats hint */
.upload-formats {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* ========== FILE BROWSER PANEL ========== */
.file-browser-panel {
    display: flex;
    min-height: 400px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

/* Sidebar Tree Navigation */
.file-browser-sidebar {
    width: 260px;
    background: var(--background-color);
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
}

.file-browser-tree {
    padding: 0.5rem;
}

/* Tree Item */
.tree-item {
    margin-bottom: 2px;
}

.tree-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--text-color);
}

.tree-item-header:hover {
    background: rgba(0, 0, 0, 0.05);
}

.tree-item-header.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

/* Chevron */
.tree-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
    color: var(--text-muted);
}

.tree-chevron.expanded {
    transform: rotate(90deg);
}

.tree-chevron svg {
    stroke: currentColor;
}

/* Tree Icon */
.tree-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.tree-icon svg {
    stroke: currentColor;
}

.tree-item-header.active .tree-icon {
    color: var(--primary-color);
}

/* Tree Label */
.tree-label {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Tree Children */
.tree-children {
    padding-left: 1.5rem;
}

.tree-item-child {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--text-muted);
}

.tree-item-child:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
}

.tree-item-child.selected {
    background: var(--primary-color);
    color: white;
}

.tree-item-child.selected .tree-icon {
    color: white;
}

.tree-item-child .tree-label {
    font-weight: 400;
    font-size: 0.8125rem;
}

/* File Browser Content */
.file-browser-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Empty State */
.file-browser-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    color: var(--border-color);
    margin-bottom: 1rem;
}

.empty-icon svg {
    stroke: currentColor;
}

.file-browser-empty h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 0.5rem 0;
}

.file-browser-empty p {
    font-size: 0.875rem;
    margin: 0;
    max-width: 280px;
}

/* File List Container */
.file-list-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* File List Header */
.file-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: white;
}

.file-list-title {
    font-weight: 600;
    color: var(--text-color);
}

.file-list-breadcrumb {
    font-size: 0.875rem;
}

.breadcrumb-sep {
    color: var(--text-muted);
}

/* File List States */
.file-list-loading,
.file-list-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon-small {
    color: var(--border-color);
    margin-bottom: 0.75rem;
}

.empty-icon-small svg {
    stroke: currentColor;
}

.file-list-empty p {
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
}

.file-list-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    margin: 1rem;
    background: #fee2e2;
    border-radius: 6px;
    color: var(--danger-color);
    font-size: 0.875rem;
}

/* File Table */
.file-table-container {
    flex: 1;
    overflow: auto;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
}

.file-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--background-color);
    border-bottom: 1px solid var(--border-color);
}

.file-table td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}

.file-table tr:hover td {
    background: var(--background-color);
}

.file-name-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-icon {
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-icon svg {
    stroke: currentColor;
}

.revision-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: var(--background-color);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* File Actions */
.file-actions {
    display: flex;
    gap: 0.25rem;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.btn-icon svg {
    stroke: currentColor;
}

/* Responsive */
@media (max-width: 768px) {
    .file-browser-panel {
        flex-direction: column;
    }

    .file-browser-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 200px;
        overflow-y: auto;
    }

    .file-browser-content {
        min-height: 300px;
    }
}

/* ========== DASHBOARD ========== */
.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.stat-card {
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: none;
    transition: all 0.2s ease;
    color: white;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 32px;
    height: 32px;
    stroke: currentColor;
}

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

.stat-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 0.5rem 0;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.stat-subtitle {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.85);
}

/* Stat Card Color Variants */
.stat-card-blue {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

.stat-card-blue:hover {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
}

.stat-card-green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-card-green:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.stat-card-purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.stat-card-purple:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

.stat-card-orange {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-card-orange:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

/* Dashboard Table Card */
.dashboard-table-card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.table-card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--background-color);
}

.table-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.table-wrapper {
    overflow-x: auto;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
}

.dashboard-table thead {
    background: var(--background-color);
}

.dashboard-table th {
    padding: 0.875rem 1.25rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.dashboard-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.dashboard-table tbody tr:last-child td {
    border-bottom: none;
}

.dashboard-table tbody tr {
    transition: background-color 0.15s ease;
}

.dashboard-table tbody tr:hover {
    background: var(--background-color);
}

/* File Name Cells */
.file-name {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.file-revision {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-approved {
    background: #d1fae5;
    color: #065f46;
}

/* Description Cell */
.description-cell {
    max-width: 300px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Empty State */
.empty-state {
    padding: 3rem 1.5rem !important;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

/* Capitalize utility */
.capitalize {
    text-transform: capitalize;
}

/* Responsive Dashboard */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    .dashboard-table th,
    .dashboard-table td {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }

    .description-cell {
        max-width: 150px;
    }
}

/* ========== PROFILE PAGE ========== */
.profile-page {
    max-width: 800px;
    margin: 0 auto;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.profile-avatar-large img.profile-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-initials-large {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
}

.profile-info h2 {
    margin: 0 0 0.25rem 0;
    font-size: 1.5rem;
    color: var(--text-color);
}

.profile-info p {
    margin: 0 0 0.5rem 0;
}

.profile-page form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.profile-page h3 {
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
    color: var(--text-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.photo-preview {
    margin-top: 0.75rem;
    padding: 1rem;
    background: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.preview-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    object-fit: cover;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.alert-success {
    background: #d1fae5;
    border-color: var(--success-color);
    color: #065f46;
}

/* ========== PHOTO UPLOAD COMPONENT ========== */
.photo-upload-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.photo-upload-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.photo-upload-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--border-color);
    flex-shrink: 0;
}

.photo-upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-upload-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--background-color);
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    flex-shrink: 0;
}

.photo-upload-button {
    flex-shrink: 0;
}

.photo-upload-error {
    color: var(--error-color);
    font-size: 0.875rem;
    margin: 0;
}

.photo-upload-info {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}