/* css/style.css - Estilos Globales, Temas y Componentes Premium */

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

:root {
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;

    /* Corporate Light Mode Palette */
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-sidebar: #ffffff;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;

    /* Accent colors */
    --primary: #2563eb;
    --primary-glow: rgba(37, 99, 235, 0.08);
    --secondary: #0ea5e9;
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --sidebar-width: 260px;
    --header-height: 80px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(37, 99, 235, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(14, 165, 233, 0.04) 0%, transparent 40%);
    background-attachment: fixed;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-logo {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    color: var(--primary);
}

.sidebar-menu {
    list-style: none;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 10px;
    transition: var(--transition);
    border: 1px solid transparent;
}

.menu-item a:hover {
    color: var(--text-primary);
    background-color: var(--bg-card-hover);
    border-color: var(--border-color);
}

.menu-item.active a {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.06);
    border-color: rgba(37, 99, 235, 0.15);
}

.menu-item-icon {
    font-size: 1.2rem;
}


/* Sidebar User Profile Card */
.sidebar-user-profile {
    padding: 12px 16px;
    margin: 0 16px 16px 16px;
    border-radius: 12px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
}

.sidebar-user-profile:hover {
    border-color: var(--border-hover);
    background: rgba(0, 0, 0, 0.02);
}

.sidebar-user-profile .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

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

.sidebar-user-profile .user-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.2;
}

.sidebar-user-profile .user-role {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: capitalize;
    margin-top: 2px;
}

.sidebar-user-profile .btn-profile-settings {
    background: transparent;
    border: none;
    padding: 6px;
    border-radius: 8px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-user-profile .btn-profile-settings:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* Main Content Area */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header */
.main-header {
    height: var(--header-height);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-title h1 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-title p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.db-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
    padding: 6px 12px;
    border-radius: 30px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-dot {
    width: 6px;
    height: 6px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Content Container */
.content-body {
    padding: 40px;
    flex-grow: 1;
}

/* Views (Hidden by default, shown by JS) */
.view-section {
    display: none;
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* KPI Cards Grid */

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    transition: var(--transition);
}

.kpi-card:hover {
    transform: translateY(-4px);
    background: var(--bg-card);
    border-color: var(--primary);
    box-shadow: 0 12px 20px -8px rgba(37, 99, 235, 0.12);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.01) 0%, transparent 80%);
    pointer-events: none;
}

.kpi-card.danger {
    border-left: 4px solid var(--danger);
}
.kpi-card.success {
    border-left: 4px solid var(--success);
}
.kpi-card.primary {
    border-left: 4px solid var(--primary);
}
.kpi-card.info {
    border-left: 4px solid var(--info);
}

.kpi-info h3 {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.kpi-value {
    font-family: var(--font-heading);
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.kpi-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.kpi-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.kpi-card.primary .kpi-icon-wrapper { background: rgba(95, 93, 236, 0.1); color: var(--primary); }
.kpi-card.success .kpi-icon-wrapper { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.kpi-card.danger .kpi-icon-wrapper { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.kpi-card.info .kpi-icon-wrapper { background: rgba(59, 130, 246, 0.1); color: var(--info); }

/* Dashboard Columns Layout */

.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.panel-header h2 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.panel-action-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.panel-action-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

/* Lists and Items */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-item {
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.015);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.list-item:hover {
    background: rgba(0, 0, 0, 0.03);
    border-color: var(--border-hover);
    transform: translateX(2px);
}

.item-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.item-subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 20px;
    text-transform: uppercase;
}

.badge.urgente { background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.badge.alta { background: rgba(245, 158, 11, 0.15); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge.media { background: rgba(59, 130, 246, 0.15); color: var(--info); border: 1px solid rgba(59, 130, 246, 0.3); }
.badge.baja { background: rgba(156, 163, 175, 0.15); color: var(--text-secondary); border: 1px solid rgba(156, 163, 175, 0.3); }

.badge.activo { background: rgba(16, 185, 129, 0.15); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge.inactivo { background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }

.badge.pagado { background: rgba(16, 185, 129, 0.15); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge.pendiente { background: rgba(245, 158, 11, 0.15); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge.atrasado { background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
}
.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

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

/* Action Controls (Toolbar) */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.search-input-wrapper {
    position: relative;
    max-width: 360px;
    width: 100%;
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 16px 10px 40px;
    color: var(--text-primary);
    font-size: 0.88rem;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 10px var(--primary-glow);
}

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

.toolbar-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.select-filter {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.88rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.select-filter:focus {
    border-color: var(--primary);
}

/* Table Style */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 8px;
}

.data-table th {
    background: rgba(255, 255, 255, 0.02);
    padding: 16px 20px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 18px 20px;
    font-size: 0.88rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

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

.table-action-group {
    display: flex;
    gap: 8px;
}

/* Modals & Overlays */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 100%;
    max-width: 580px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

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

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

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

.modal-body {
    padding: 32px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px 32px;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.01);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-control, .form-select {
    background-color: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 10px !important;
    padding: 12px 16px !important;
    font-size: 0.9rem !important;
    outline: none !important;
    transition: var(--transition) !important;
}

.form-control:focus, .form-select:focus {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 10px var(--primary-glow) !important;
    color: var(--text-primary) !important;
}

.form-control::placeholder {
    color: var(--text-muted) !important;
}

.form-select option {
    background-color: #ffffff !important;
    color: var(--text-primary) !important;
}

textarea.form-control {
    resize: vertical !important;
    min-height: 100px !important;
}

/* Kanban Board for Tasks */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    min-height: 500px;
}

.kanban-col {
    background: rgba(241, 245, 249, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.kanban-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.kanban-col-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.kanban-count {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.kanban-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
}

.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    cursor: grab;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    transition: var(--transition);
}

.task-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    background: var(--bg-card);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.05);
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.task-card-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.task-card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.4;
}

.task-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.task-card-date {
    display: flex;
    align-items: center;
    gap: 4px;
}

.task-card-client {
    font-weight: 500;
    color: var(--info);
}

/* Detail view style (Client profile) */

.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 8px 20px var(--primary-glow);
}

.profile-name {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.profile-details {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.detail-value {
    font-size: 0.88rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Tab Panels inside Details */
.tabs-navigation {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    gap: 24px;
    margin-bottom: 24px;
}

.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    padding: 12px 4px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary);
    border-color: var(--primary);
}

.tab-pane {
    display: none;
}

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

/* Notes List */
.notes-timeline {
    position: relative;
    padding-left: 20px;
}

.notes-timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--border-color);
}

.note-node {
    position: relative;
    margin-bottom: 20px;
}

.note-node::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg-dark);
    border: 2px solid var(--primary);
}

.note-node.reunion::before { border-color: var(--info); }
.note-node.acuerdo::before { border-color: var(--success); }

.note-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.78rem;
}

.note-type {
    font-weight: 700;
    text-transform: uppercase;
}

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

.note-content {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.01);
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    line-height: 1.4;
}

.note-content p {
    margin-bottom: 0;
}

.note-delete-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    margin-left: 8px;
    transition: var(--transition);
}

.note-delete-btn:hover {
    color: var(--danger);
}

/* Invoice Bill Template (For Preview Modal) */
.invoice-bill {
    background: #ffffff;
    padding: 32px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    font-size: 0.88rem;
}

.bill-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 32px;
}

.bill-company h4 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
}

.bill-meta {
    text-align: right;
}

.bill-meta h4 {
    font-family: var(--font-heading);
    color: var(--primary);
    font-size: 1rem;
}

.bill-addresses {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.bill-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.bill-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
}

.bill-items-table th {
    text-align: left;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.bill-items-table td {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.bill-items-table td.amount, .bill-items-table th.amount {
    text-align: right;
}

.bill-summary {
    display: flex;
    justify-content: flex-end;
}

.bill-total-box {
    text-align: right;
    width: 200px;
    padding-top: 12px;
}

.bill-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.bill-total-row.final {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
}

/* Toast Messages */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
}

.toast {
    background: #141827;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    color: var(--text-primary);
    padding: 14px 20px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 250px;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Utilities */
.text-right { text-align: right; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.mr-2 { margin-right: 8px; }
.mb-0 { margin-bottom: 0; }
.w-full { width: 100%; }

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    .sidebar-logo {
        padding: 0;
        justify-content: center;
    }
    .sidebar-menu {
        padding: 24px 8px;
    }
    .menu-item a {
        padding: 12px 0;
        justify-content: center;
    }
    .sidebar .logo-text span, .sidebar .menu-item span:not(.menu-item-icon) {
        display: none;
    }
    .main-wrapper {
        margin-left: 60px;
    }
    .main-header {
        padding: 0 20px;
    }
    .content-body {
        padding: 20px;
    }
}

@media (max-width: 580px) {
    .modal-content {
        width: 95%;
        margin: 10px;
        border-radius: 16px;
    }
    .modal-body {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 30px 20px;
        border-radius: 16px;
    }
    .main-header {
        flex-direction: column;
        height: auto;
        padding: 16px 20px;
        align-items: flex-start;
        gap: 8px;
    }
    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* ================= PANTALLA DE LOGIN ================= */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(37, 99, 235, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(14, 165, 233, 0.05) 0%, transparent 50%);
    z-index: 9999;
    padding: 20px;
    overflow-y: auto;
}

.login-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08), 0 0 50px rgba(37, 99, 235, 0.05);
    text-align: center;
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 20px;
}

.login-logo .logo-icon {
    color: var(--primary);
}

.login-logo span {
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-card h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.login-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

.login-card label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-align: left;
}

/* ================= HAMBURGER SIDEBAR COLLAPSED (DESKTOP) ================= */
.sidebar-collapsed .sidebar {
    width: 70px;
}
.sidebar-collapsed .sidebar .logo-text span,
.sidebar-collapsed .sidebar .menu-item span:not(.menu-item-icon),
.sidebar-collapsed .sidebar .sidebar-close-btn,
.sidebar-collapsed .sidebar .sidebar-footer {
    display: none;
}
.sidebar-collapsed .sidebar .sidebar-logo {
    justify-content: center;
    padding: 0;
}
.sidebar-collapsed .sidebar-menu {
    padding: 24px 8px;
}
.sidebar-collapsed .sidebar .menu-item a {
    justify-content: center;
    padding: 12px 0;
}
.sidebar-collapsed .main-wrapper {
    margin-left: 70px;
}

/* ================= MOBILE SIDEBAR SLIDE-IN (MOBILE/TABLET) ================= */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        left: -260px;
        width: 260px !important;
        z-index: 2000;
        transform: translateX(0);
        box-shadow: none;
    }
    
    .sidebar-mobile-active .sidebar {
        transform: translateX(260px);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15);
    }
    
    .sidebar-mobile-active .sidebar-overlay-mobile {
        display: block;
        opacity: 1;
    }
    
    .main-wrapper {
        margin-left: 0 !important;
    }
    
    .sidebar-overlay-mobile {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(15, 23, 42, 0.3);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 1999;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
}

/* ================= SVG ANALYTICS CHARTS ================= */
.chart-svg {
    width: 100%;
    height: auto;
    max-height: 250px;
}

.chart-bar {
    fill: var(--primary);
    rx: 4px;
    transition: fill 0.3s ease;
}

.chart-bar:hover {
    fill: #1d4ed8;
    cursor: pointer;
}

.chart-grid-line {
    stroke: var(--border-color);
    stroke-dasharray: 4 4;
}

.chart-axis-line {
    stroke: var(--border-color);
}

.chart-text {
    fill: var(--text-secondary);
    font-size: 10px;
    font-family: var(--font-body);
}

/* Horizontal progress bars (service distribution) */
.service-dist-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.service-dist-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.service-dist-bar-bg {
    width: 100%;
    height: 8px;
    background-color: var(--bg-card-hover);
    border-radius: 4px;
    overflow: hidden;
}

.service-dist-bar-fg {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    transition: width 1s ease-in-out;
}

/* Donut Chart legend */
.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* ================= SUPPORT TICKETS ================= */
.ticket-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
    transition: var(--transition);
}

.ticket-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.04);
}

.ticket-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 8px;
}

.ticket-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.ticket-card-client {
    font-size: 0.78rem;
    color: var(--primary);
    font-weight: 500;
}

.ticket-card-body {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 16px;
    min-height: 48px;
}

.ticket-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    font-size: 0.78rem;
}

/* ================= PRINT / PDF LAYOUTS ================= */
@media print {
    body * {
        visibility: hidden;
    }
    
    #modal-invoice-detail,
    #modal-invoice-detail *,
    #modal-presupuesto-detalle,
    #modal-presupuesto-detalle * {
        visibility: visible;
    }
    
    #modal-invoice-detail,
    #modal-presupuesto-detalle {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: #ffffff !important;
        box-shadow: none !important;
        border: none !important;
        transform: none !important;
    }
    
    .modal-overlay {
        background: #ffffff !important;
        position: absolute !important;
        display: block !important;
        opacity: 1 !important;
        backdrop-filter: none !important;
    }
    
    .modal-close,
    .modal-footer,
    #payment-form-container {
        display: none !important;
    }
    
    .invoice-bill {
        border: none !important;
        padding: 0 !important;
        background: #ffffff !important;
        color: #000000 !important;
    }
}

/* ================= ADJUNTOS / SUBIDA DE ARCHIVOS ================= */
.upload-dropzone {
    border-style: dashed !important;
    border-width: 2px !important;
    border-color: var(--border-color) !important;
    background: rgba(37, 99, 235, 0.02) !important;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

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

.file-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.file-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05) !important;
}

.file-card-preview {
    transition: opacity 0.2s ease-in-out;
}

.file-card:hover .file-card-preview {
    opacity: 0.95;
}

/* ================= CARPETAS VIRTUALES ================= */
.folder-card {
    border: 1px solid var(--border-color) !important;
    border-radius: 12px;
    background: var(--card-bg);
    cursor: pointer;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

.folder-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary) !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05) !important;
}

.folder-icon-wrapper {
    color: #f59e0b; /* Color ámbar clásico para carpetas */
    transition: transform 0.2s ease-in-out;
}

.folder-card:hover .folder-icon-wrapper {
    transform: scale(1.08);
}

.breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--text-secondary);
}

/* Visor de Imágenes (Lightbox) */
#modal-image-viewer {
    background: rgba(15, 23, 42, 0.95) !important;
}

#modal-image-viewer .modal-content {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: scale(0.9) !important;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#modal-image-viewer.active .modal-content {
    transform: scale(1) !important;
}

#modal-image-viewer .modal-close {
    opacity: 0.8;
    transition: opacity 0.2s, color 0.2s;
}

#modal-image-viewer .modal-close:hover {
    opacity: 1 !important;
    color: #ff5b5b !important;
}
