/* Variables CSS */
:root {
    --primary-color: #4b5563; /* Gris elegante y profesional */
    --primary-light: #6b7280;
    --primary-dark: #374151;
    --secondary-color: #6b7280; /* Gris */
    --accent-color: #f3f4f6; /* Gris claro */
    --white: #ffffff;
    --black: #1f2937;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --border-radius: 8px;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8fafc;
    color: var(--black);
    line-height: 1.6;
}

/* Pantallas */
.screen {
    display: none;
    min-height: 100vh;
}


.screen.active {
    display: block !important;
}

/* Forzar visibilidad de pantallas */
#loginScreen.active {
    display: block !important;
}

#mainScreen.active {
    display: block !important;
}

#loginScreen:not(.active) {
    display: none !important;
}

#mainScreen:not(.active) {
    display: none !important;
}

/* TEMPORAL: Forzar visibilidad de mainScreen cuando está activa */
#mainScreen.active {
    display: block !important;
    background: white !important;
    min-height: 100vh !important;
}


/* Pantalla de Login */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    padding: 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 3rem;
    color: var(--white);
}

.login-header .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.login-header .logo-img {
    height: 120px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.login-header .logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #374151; /* Gris oscuro */
    margin: 0;
}

.login-header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.login-form {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-footer {
    margin-top: 2rem;
    text-align: center;
    color: var(--white);
    opacity: 0.8;
    font-size: 0.9rem;
}

.client-portal-link {
    color: var(--white);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 2px solid var(--white);
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    margin-left: 0.5rem;
}

.client-portal-link:hover {
    background: var(--white);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Header */
.header {
    background: var(--white);
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary-color);
}

.header-left .logo-img {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.header-left .logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #374151; /* Gris oscuro */
    margin: 0;
}

.header-left .logo i {
    font-size: 1.5rem;
}

.nav-tabs {
    display: flex;
    gap: 0.5rem;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--secondary-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.nav-tab:hover {
    background: var(--accent-color);
    color: var(--primary-color);
}

.nav-tab.active {
    background: var(--primary-color);
    color: var(--white);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#refreshBtn {
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#refreshBtn:hover {
    transform: rotate(180deg);
    background: var(--primary-color);
    color: var(--white);
}

#clientRefreshBtn {
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#clientRefreshBtn:hover {
    transform: rotate(180deg);
    background: var(--primary-color);
    color: var(--white);
}

.user-menu span {
    font-weight: 500;
    color: var(--black);
}

/* Contenido principal */
.main-content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.tab-content {
    display: none;
}

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

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--black);
}

.page-header p {
    color: var(--secondary-color);
    margin-top: 0.5rem;
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

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

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

.btn-secondary:hover {
    background: #4b5563;
}

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

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

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

/* Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--white);
}

.stat-card:nth-child(1) .stat-icon { background: var(--primary-color); }
.stat-card:nth-child(2) .stat-icon { background: var(--success); }
.stat-card:nth-child(3) .stat-icon { background: var(--warning); }
.stat-card:nth-child(4) .stat-icon { background: var(--error); }

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--black);
    margin-bottom: 0.25rem;
}

.stat-content p {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.dashboard-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.dashboard-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--black);
}

/* Listas */
.clients-list,
.projects-list,
.quotes-list {
    display: grid;
    gap: 1rem;
}

.client-card,
.project-card,
.quote-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--black);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.card-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.8rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    font-weight: 500;
}

.info-value {
    color: var(--black);
    font-weight: 500;
}

/* Barra de búsqueda */
.search-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.search-bar input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Calendario */
.calendar-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.calendar-controls span {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--black);
    min-width: 200px;
    text-align: center;
}

.appointments-calendar {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--primary-color);
    color: var(--white);
}

.calendar-day-header {
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.calendar-day-header:last-child {
    border-right: none;
}

.calendar-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid #e5e7eb;
}

.calendar-week:last-child {
    border-bottom: none;
}

.calendar-day {
    min-height: 120px;
    padding: 0.5rem;
    border-right: 1px solid #e5e7eb;
    position: relative;
}

.calendar-day:last-child {
    border-right: none;
}

.calendar-day.other-month {
    background: #f9fafb;
    color: #9ca3af;
}

.calendar-day.today {
    background: rgba(59, 130, 246, 0.1);
}

.day-number {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.appointment-item {
    background: var(--primary-color);
    color: var(--white);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.appointment-item:hover {
    background: var(--primary-dark);
}

.appointment-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.appointment-delete-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--white);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    transition: background-color 0.2s;
}

.appointment-delete-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Formularios */
.form-group {
    margin-bottom: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--black);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal.active {
    display: flex !important;
}

/* Specific styles for delete client modal */
#deleteClientModal {
    display: none;
}

#deleteClientModal.active {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: 1000 !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 2rem !important;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--black);
}

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

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

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

/* Loading */
.loading-spinner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.loading-spinner.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notificaciones */
.notifications {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notification {
    background: var(--white);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary-color);
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
}

.notification.success {
    border-left-color: var(--success);
}

.notification.error {
    border-left-color: var(--error);
}

.notification.warning {
    border-left-color: var(--warning);
}

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

/* Estados */
.status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
}

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

.status.en_proceso {
    background: #e5e7eb;
    color: #4b5563;
}

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

.status.cancelado {
    background: #fee2e2;
    color: #991b1b;
}

.status.programada {
    background: #e5e7eb;
    color: #4b5563;
}

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

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

.status.cancelada {
    background: #fee2e2;
    color: #991b1b;
}

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

.status.rechazada {
    background: #fee2e2;
    color: #991b1b;
}

.status.expirada {
    background: #f3f4f6;
    color: #6b7280;
}

/* Estilos específicos para el portal de clientes */
.login-tabs {
    display: flex;
    margin-bottom: 2rem;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: #f3f4f6;
}

.login-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--secondary-color);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-weight: 500;
}

.login-tab.active {
    background: var(--white);
    color: var(--primary-color);
    box-shadow: var(--shadow);
}

/* Estilos para formularios del portal de clientes */
#clientLoginScreen .login-form {
    display: none;
}

#clientLoginScreen .login-form.active {
    display: block;
}

.profile-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1000px;
}

.profile-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.profile-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--black);
}

/* Alertas */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert i {
    font-size: 1.25rem;
    margin-top: 0.125rem;
}

.alert-warning {
    background-color: #fef3cd;
    border: 1px solid #fde68a;
    color: #92400e;
}

.alert-warning i {
    color: #f59e0b;
}

.alert ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.5rem;
}

.alert li {
    margin-bottom: 0.25rem;
}

/* Form Help */
.form-help {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #6b7280;
}

/* Messages Container - Responsive */
.messages-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    height: calc(100vh - 250px);
    min-height: 600px;
}

.messages-container.mobile-view-conversation .conversations-panel {
    display: flex;
}

.messages-container.mobile-view-conversation .message-thread-panel {
    display: none;
}

.messages-container.mobile-view-thread .conversations-panel {
    display: none;
}

.messages-container.mobile-view-thread .message-thread-panel {
    display: flex;
}

/* Back button for mobile */
.message-thread-header .back-button {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-tabs {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-tab {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal {
        padding: 1rem;
    }
    
    .calendar-header,
    .calendar-week {
        grid-template-columns: repeat(7, 1fr);
        font-size: 0.8rem;
    }
    
    .calendar-day {
        min-height: 80px;
        padding: 0.25rem;
    }
    
    .appointment-item {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
    
    /* Messages Mobile Styles */
    .messages-container {
        grid-template-columns: 1fr;
        height: calc(100vh - 200px);
        min-height: 500px;
        gap: 0;
        position: relative;
    }
    
    .conversations-panel,
    .message-thread-panel {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        height: 100%;
    }
    
    .conversations-panel {
        display: flex;
    }
    
    .message-thread-panel {
        display: none;
    }
    
    .messages-container.mobile-view-thread .conversations-panel {
        display: none;
    }
    
    .messages-container.mobile-view-thread .message-thread-panel {
        display: flex;
    }
    
    /* Back button for mobile */
    .message-thread-header .back-button {
        display: inline-flex !important;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem;
        background: transparent;
        border: none;
        color: var(--primary-color);
        cursor: pointer;
        font-size: 1rem;
        margin-right: 1rem;
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
    }
    
    .conversations-header {
        padding: 0.75rem !important;
    }
    
    .conversations-header .search-bar {
        margin-bottom: 0.75rem !important;
    }
    
    .conversations-header .filters-bar {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .conversations-header .filters-bar select {
        width: 100%;
    }
    
    .conversation-item {
        padding: 1rem 0.75rem;
        min-height: 60px;
    }
    
    .conversation-item-title {
        font-size: 0.95rem;
        margin-bottom: 0.25rem;
    }
    
    .conversation-item-preview {
        font-size: 0.85rem;
    }
    
    .conversation-item-meta {
        font-size: 0.75rem;
    }
    
    .unread-badge {
        min-width: 24px;
        height: 24px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .message-thread {
        padding: 0.75rem;
    }
    
    .message-bubble {
        max-width: 85%;
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }
    
    .message-composer {
        padding: 0.75rem !important;
    }
    
    .message-composer textarea {
        font-size: 1rem; /* Evitar zoom en iOS */
        min-height: 44px; /* Tamaño táctil mínimo */
    }
    
    .message-composer button {
        min-width: 44px;
        min-height: 44px;
        padding: 0.75rem;
    }
    
    .page-header {
        padding: 0.75rem 1rem;
        margin-bottom: 1rem;
    }
    
    .page-header h2 {
        font-size: 1.5rem;
    }
    
    .page-header .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .login-form {
        padding: 1.5rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .card-info {
        grid-template-columns: 1fr;
    }
    
    .notifications {
        top: 1rem;
        right: 1rem;
        left: 1rem;
    }
    
    .notification {
        min-width: auto;
    }
    
    .profile-container {
        grid-template-columns: 1fr;
    }
}

/* Appointment List View Styles */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.view-toggle {
    display: flex;
    background: #f3f4f6;
    border-radius: 6px;
    padding: 2px;
}

.view-toggle .btn {
    border: none;
    background: transparent;
    color: #6b7280;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.view-toggle .btn.active {
    background: var(--white);
    color: var(--primary-color);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.appointment-view {
    margin-top: 1.5rem;
}

.list-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.search-box {
    flex: 1;
    max-width: 300px;
}

.filter-controls {
    min-width: 150px;
}

.appointments-list {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.appointment-item-list {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    align-items: center;
    transition: background-color 0.2s;
}

.appointment-item-list:hover {
    background: #f9fafb;
}

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

.appointment-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.appointment-title-list {
    font-weight: 600;
    color: var(--black);
    font-size: 1rem;
}

.appointment-client-list {
    color: #6b7280;
    font-size: 0.875rem;
}

.appointment-date-list {
    color: var(--black);
    font-weight: 500;
}

.appointment-time-list {
    color: #6b7280;
    font-size: 0.875rem;
}

.appointment-status-list {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.appointment-status-list.scheduled {
    background: #e5e7eb;
    color: #4b5563;
}

.appointment-status-list.confirmed {
    background: #dcfce7;
    color: #166534;
}

.appointment-status-list.completed {
    background: #f3f4f6;
    color: #374151;
}

.appointment-status-list.cancelled {
    background: #fee2e2;
    color: #dc2626;
}

.appointment-actions {
    display: flex;
    gap: 0.5rem;
}

.appointment-actions .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.appointment-actions .btn-edit {
    background: #6b7280;
    color: white;
    border: none;
}

.appointment-actions .btn-edit:hover {
    background: #4b5563;
}

.appointment-actions .btn-delete {
    background: #ef4444;
    color: white;
    border: none;
}

.appointment-actions .btn-delete:hover {
    background: #dc2626;
}

/* Responsive adjustments for appointment list */
@media (max-width: 768px) {
    .header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .view-toggle {
        justify-content: center;
    }
    
    .list-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        max-width: none;
    }
    
    .appointment-item-list {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 1rem;
    }
    
    .appointment-info {
        order: 1;
    }
    
    .appointment-date-list {
        order: 2;
    }
    
    .appointment-time-list {
        order: 3;
    }
    
    .appointment-status-list {
        order: 4;
        justify-self: start;
    }
    
    .appointment-actions {
        order: 5;
        justify-self: end;
    }
}

/* Client Password Modal Styles */
.password-info {
    text-align: center;
}

.password-info p {
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
}

.credentials-box {
    background: var(--accent-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e5e7eb;
}

.credential-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--white);
    border-radius: var(--border-radius);
    border: 1px solid #d1d5db;
}

.credential-item:last-child {
    margin-bottom: 0;
}

.credential-item label {
    font-weight: 600;
    color: var(--black);
    margin-right: 1rem;
    min-width: 120px;
}

.credential-value {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.credential-value span {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    background: #f8fafc;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    flex: 1;
    word-break: break-all;
}

.btn-copy {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
}

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

.btn-copy:active {
    transform: scale(0.95);
}

.password-note {
    background: #f3f4f6;
    border: 1px solid #bfdbfe;
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: left;
}

.password-note p {
    margin: 0;
    color: var(--primary-dark);
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.password-note i {
    color: var(--primary-color);
    margin-top: 0.1rem;
    flex-shrink: 0;
}

/* Responsive adjustments for password modal */
@media (max-width: 480px) {
    .credential-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .credential-item label {
        min-width: auto;
        margin-right: 0;
        margin-bottom: 0.25rem;
    }
    
    .credential-value {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .credential-value span {
        text-align: center;
    }
}

/* ==================== TIMELINE/CRONOGRAMA STYLES ==================== */

/* Header actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.view-controls {
    display: flex;
    gap: 0.5rem;
}

.view-controls .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.view-controls .btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Timeline filters */
.timeline-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 150px;
}

.filter-group label {
    font-weight: 600;
    color: var(--black);
    font-size: 0.9rem;
}

.filter-group select {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
}

/* Schedule view */
.schedule-view {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    padding: 1.5rem;
}

.schedule-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.schedule-controls #currentScheduleMonth {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--black);
    min-width: 200px;
    text-align: center;
}

.schedule-content {
    position: relative;
}

.schedule-calendar {
    width: 100%;
}

.schedule-calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e5e7eb;
    border: 1px solid #e5e7eb;
    margin-bottom: 1px;
}

.schedule-day-header {
    background: #f9fafb;
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: #6b7280;
    text-transform: uppercase;
}

.schedule-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e5e7eb;
    border: 1px solid #e5e7eb;
    margin-bottom: 1px;
    min-height: 120px;
    position: relative;
}

.schedule-week-tasks {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    pointer-events: none;
}

.schedule-week-tasks .schedule-task-bar {
    pointer-events: all;
}

.schedule-day {
    background: white;
    padding: 0.5rem;
    min-height: 120px;
    position: relative;
    border: 1px solid transparent;
    z-index: 1;
}

.schedule-day.other-month {
    background: #f9fafb;
    opacity: 0.5;
}

.schedule-day.today {
    background: #f3f4f6;
    border-color: #6b7280;
}

.schedule-day-number {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--black);
    margin-bottom: 0.5rem;
}

.schedule-task-bar {
    position: absolute;
    height: 24px;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    margin-top: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    z-index: 3;
}

.schedule-task-bar:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    z-index: 10;
}

.schedule-task-title {
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* Colores por tipo */
.schedule-task-bar.type-project {
    background: #6b7280;
}

.schedule-task-bar.type-appointment {
    background: #10b981;
}

.schedule-task-bar.type-quote {
    background: #f59e0b;
}

/* Colores por prioridad (sobrescribe tipo si es necesario) */
.schedule-task-bar.priority-critical {
    background: #ef4444;
}

.schedule-task-bar.priority-high {
    background: #f59e0b;
}

.schedule-task-bar.priority-medium {
    background: #6b7280;
}

.schedule-task-bar.priority-low {
    background: #10b981;
}

/* Estados */
.schedule-task-bar.status-completed {
    opacity: 0.6;
    text-decoration: line-through;
}

.schedule-task-bar.status-cancelled {
    opacity: 0.4;
    text-decoration: line-through;
}

/* Timeline view (mantener para compatibilidad) */
.timeline-view {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.timeline-container {
    padding: 2rem;
}

.timeline-content {
    position: relative;
}

.timeline-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
    border-left: 4px solid;
    background: #f8fafc;
    transition: all 0.3s ease;
}

.timeline-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-lg);
}

.timeline-item.priority-critical {
    border-left-color: #ef4444;
    background: #fef2f2;
}

.timeline-item.priority-high {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.timeline-item.priority-medium {
    border-left-color: #6b7280;
    background: #f3f4f6;
}

.timeline-item.priority-low {
    border-left-color: #10b981;
    background: #f0fdf4;
}

.timeline-item.status-completed {
    opacity: 0.7;
    background: #f3f4f6;
}

.timeline-item.status-cancelled {
    opacity: 0.5;
    background: #f9fafb;
    text-decoration: line-through;
}

.timeline-date {
    min-width: 120px;
    text-align: center;
    margin-right: 1rem;
}

.timeline-date .date {
    font-weight: 600;
    color: var(--black);
    font-size: 0.9rem;
}

.timeline-date .time {
    color: var(--secondary-color);
    font-size: 0.8rem;
}

.timeline-content-item {
    flex: 1;
    margin-right: 1rem;
}

.timeline-title {
    font-weight: 600;
    color: var(--black);
    margin-bottom: 0.25rem;
}

.timeline-description {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.timeline-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.timeline-priority {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.timeline-priority.critical {
    background: #fef2f2;
    color: #dc2626;
}

.timeline-priority.high {
    background: #fffbeb;
    color: #d97706;
}

.timeline-priority.medium {
    background: #f3f4f6;
    color: #2563eb;
}

.timeline-priority.low {
    background: #f0fdf4;
    color: #059669;
}

.timeline-actions {
    display: flex;
    gap: 0.5rem;
}

.timeline-actions .btn {
    padding: 0.5rem;
    font-size: 0.8rem;
}

/* Kanban view */
.kanban-view {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    padding: 1rem;
    min-height: 500px;
}

.kanban-column {
    background: #f8fafc;
    border-radius: var(--border-radius);
    padding: 1rem;
    min-height: 400px;
}

.kanban-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.kanban-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--black);
}

.kanban-header .count {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.kanban-tasks {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.kanban-task {
    background: white;
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--shadow);
    cursor: move;
    transition: all 0.3s ease;
    border-left: 4px solid;
}

.kanban-task:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.kanban-task.priority-critical {
    border-left-color: #ef4444;
}

.kanban-task.priority-high {
    border-left-color: #f59e0b;
}

.kanban-task.priority-medium {
    border-left-color: #6b7280;
}

.kanban-task.priority-low {
    border-left-color: #10b981;
}

.kanban-task-title {
    font-weight: 600;
    color: var(--black);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.kanban-task-description {
    color: var(--secondary-color);
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.kanban-task-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--secondary-color);
}

/* Accounting views */
.accounting-view {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.accounting-view .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Overdue and due soon styles */
tr.overdue {
    background-color: #fee2e2;
}

tr.overdue:hover {
    background-color: #fecaca;
}

tr.due-soon {
    background-color: #fef3c7;
}

tr.due-soon:hover {
    background-color: #fde68a;
}

.kanban-task-due {
    font-weight: 500;
}

.kanban-task-due.overdue {
    color: #ef4444;
}

.kanban-task-due.due-today {
    color: #f59e0b;
}

.kanban-task-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.75rem;
    border-top: 1px solid #f3f4f6;
    padding-top: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.kanban-task:hover .kanban-task-actions {
    opacity: 1;
}

.kanban-task-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.8rem;
    transition: color 0.2s ease;
}

.kanban-task-actions .btn-edit {
    color: var(--secondary-color);
}

.kanban-task-actions .btn-edit:hover {
    color: var(--primary-color);
}

.kanban-task-actions .btn-delete {
    color: var(--secondary-color);
}

.kanban-task-actions .btn-delete:hover {
    color: #ef4444;
}

/* Selections Views */
.selections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.selection-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    border-top: 4px solid transparent;
    transition: all 0.3s ease;
}

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

.selection-card.status-approved { border-top-color: var(--success); }
.selection-card.status-pending { border-top-color: var(--warning); }
.selection-card.status-ordered { border-top-color: var(--primary-color); }
.selection-card.status-delivered { border-top-color: var(--primary-dark); }
.selection-card.status-installed { border-top-color: var(--black); }

.selection-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.category-badge {
    background: #eef2ff;
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.category-badge.small {
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
}

.selection-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.selection-card:hover .selection-actions {
    opacity: 1;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--secondary-color);
    padding: 0.25rem;
    transition: color 0.2s;
}

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

.selection-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--black);
}

.selection-project {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.selection-details {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #4b5563;
}

.selection-details p {
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.selection-financials {
    background: #f9fafb;
    border-radius: 6px;
    padding: 0.75rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.financial-item {
    display: flex;
    flex-direction: column;
}

.financial-item .label {
    font-size: 0.7rem;
    color: #6b7280;
    text-transform: uppercase;
}

.financial-item .value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--black);
}

.financial-item.positive .value { color: var(--success); }
.financial-item.negative .value { color: var(--error); }

.selection-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.file-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.file-link:hover { text-decoration: underline; }

/* Hierarchy View */
.hierarchy-view {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.hierarchy-project {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.project-header {
    background: #f3f4f6;
    padding: 1rem 1.5rem;
    margin: 0;
    border-bottom: 1px solid #e5e7eb;
    font-size: 1.2rem;
    color: var(--black);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.hierarchy-content {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}

.hierarchy-category {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.category-header {
    font-size: 1rem;
    color: var(--primary-color);
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hierarchy-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hierarchy-item {
    background: #f9fafb;
    padding: 0.75rem;
    border-radius: 6px;
    border-left: 3px solid #ccc;
    cursor: pointer;
    transition: all 0.2s;
}

.hierarchy-item:hover {
    background: #f3f4f6;
    transform: translateX(2px);
}

.hierarchy-item.status-approved { border-left-color: var(--success); }
.hierarchy-item.status-pending { border-left-color: var(--warning); }
.hierarchy-item.status-ordered { border-left-color: var(--primary-color); }

.item-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.item-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.item-status {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    background: #e5e7eb;
    color: #374151;
}

.item-meta {
    font-size: 0.8rem;
    color: #6b7280;
    display: flex;
    gap: 0.5rem;
}

/* Allowances View */
.allowances-view {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.allowance-project-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.allowance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.allowance-summary {
    background: #f3f4f6;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.allowance-summary.positive { background: #d1fae5; color: #065f46; }
.allowance-summary.negative { background: #fee2e2; color: #991b1b; }

.summary-label { font-size: 0.8rem; text-transform: uppercase; opacity: 0.8; }
.summary-value { font-size: 1.2rem; font-weight: 700; }

.progress-container {
    margin-bottom: 2rem;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #4b5563;
}

.progress-bar-bg {
    height: 10px;
    background: #e5e7eb;
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 5px;
}

.progress-bar-fill.over-budget {
    background: var(--error);
}

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

.allowance-table th {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
    color: #6b7280;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.allowance-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.95rem;
}

.text-error { color: var(--error); font-weight: 600; }
.text-success { color: var(--success); font-weight: 600; }

/* Files Views */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.file-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

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

.file-checkbox {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 10;
}

.file-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.file-thumbnail {
    width: 100%;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    overflow: hidden;
    cursor: pointer;
}

.file-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.file-list-thumbnail {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
}

.file-list-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-info {
    margin-bottom: 0.75rem;
}

.file-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--black);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 0.8rem;
    color: #6b7280;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.file-date {
    font-size: 0.75rem;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.file-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity 0.2s;
}

.file-card:hover .file-actions {
    opacity: 1;
}

.file-type-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.file-type-badge.type-image {
    background: #e5e7eb;
    color: #4b5563;
}

.file-type-badge.type-video {
    background: #fce7f3;
    color: #9f1239;
}

.file-type-badge.type-document {
    background: #fef3c7;
    color: #92400e;
}

.file-detail-preview {
    text-align: center;
    margin-bottom: 2rem;
}

.file-detail-info {
    background: #f9fafb;
    padding: 1.5rem;
    border-radius: var(--border-radius);
}

.info-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.info-value {
    font-size: 0.95rem;
    color: var(--black);
    margin-bottom: 1rem;
}

.file-comment {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 3px solid var(--primary-color);
}

/* Form row for side-by-side inputs */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Responsive design for timeline */
@media (max-width: 768px) {
    .header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .view-controls {
        justify-content: center;
    }
    
    .timeline-filters {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .timeline-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .timeline-date {
        min-width: auto;
        text-align: left;
        margin-right: 0;
    }
    
    .timeline-content-item {
        margin-right: 0;
    }
    
    .timeline-meta {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .kanban-board {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .timeline-container {
        padding: 1rem;
    }
    
    .kanban-board {
        padding: 0.5rem;
    }
    
    .kanban-column {
        padding: 0.75rem;
    }
}

/* Map Styles */
#map {
    height: 500px;
    width: 100%;
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: #f3f4f6;
    min-height: 500px;
    position: relative;
}

.dashboard-card #map {
    margin-top: 1rem;
}

/* Loading state for map */
#map:empty::before {
    content: "Loading map...";
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6b7280;
    font-size: 0.9rem;
}

/* Messages Section Styles */
.conversation-item {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

.conversation-item:hover {
    background-color: #f9fafb;
}

.conversation-item.active {
    background-color: #eff6ff;
    border-left: 3px solid var(--primary-color);
}

.unread-badge {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.message-item {
    margin-bottom: 1rem;
    display: flex;
}

.message-item.message-left {
    justify-content: flex-start;
}

.message-item.message-right {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    background: white;
    box-shadow: var(--shadow);
}

.message-item.message-right .message-bubble {
    background: var(--primary-color);
    color: white;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.message-item.message-right .message-header {
    color: rgba(255, 255, 255, 0.9);
}

.message-time {
    margin-left: auto;
    font-size: 0.75rem;
    opacity: 0.7;
}

.message-content {
    line-height: 1.5;
    word-wrap: break-word;
}

.message-item.message-right .message-content {
    color: white;
}

.role-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.role-badge.admin {
    background: var(--primary-color);
    color: white;
}

.role-badge.client {
    background: #e5e7eb;
    color: #374151;
}

.message-item.message-right .role-badge.admin {
    background: rgba(255, 255, 255, 0.2);
}

.message-attachments {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.attachment-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f9fafb;
    border-radius: 4px;
    text-decoration: none;
    color: var(--primary-color);
    font-size: 0.875rem;
    transition: background-color 0.2s;
    border: 1px solid #e5e7eb;
}

.attachment-link:hover {
    background: #f3f4f6;
}

.attachment-link small {
    font-size: 0.75rem;
    color: #6b7280;
    margin-left: 0.25rem;
}

.message-item.message-right .attachment-link {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.message-item.message-right .attachment-link:hover {
    background: rgba(255, 255, 255, 0.3);
}

.message-item.message-right .attachment-link small {
    color: rgba(255, 255, 255, 0.8);
}

/* Attachment Thumbnails */
.attachment-thumbnail {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    transition: transform 0.2s, box-shadow 0.2s;
}

.attachment-thumbnail:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.attachment-thumbnail.image img {
    width: 100%;
    max-width: 300px;
    max-height: 300px;
    object-fit: cover;
    display: block;
}

.attachment-thumbnail.video video {
    width: 100%;
    max-width: 300px;
    max-height: 300px;
    display: block;
    background: #000;
}

.attachment-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    padding: 0.75rem;
    color: white;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.attachment-thumbnail:hover .attachment-overlay {
    opacity: 1;
}

.attachment-overlay i {
    font-size: 1rem;
}

.attachment-overlay span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.message-item.message-right .attachment-thumbnail {
    border-color: rgba(255, 255, 255, 0.3);
}

.attachment-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f9fafb;
    border-radius: 4px;
    font-size: 0.875rem;
}

.conversations-list {
    overflow-y: auto;
}

.conversations-list::-webkit-scrollbar {
    width: 6px;
}

.conversations-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.conversations-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.conversations-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.message-thread {
    overflow-y: auto;
    padding: 1rem;
}

.message-thread::-webkit-scrollbar {
    width: 6px;
}

.message-thread::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.message-thread::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.message-thread::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Estimate Section */
.estimate-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
}

.summary-card.highlight {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--white);
    border-left-color: var(--primary-dark);
}

.summary-label {
    font-size: 0.875rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-card.highlight .summary-label {
    color: rgba(255, 255, 255, 0.9);
}

.summary-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--black);
}

.summary-card.highlight .summary-value {
    color: var(--white);
}

.summary-percentage {
    font-size: 0.875rem;
    color: var(--secondary-color);
    margin-top: 0.25rem;
}

.summary-card.highlight .summary-percentage {
    color: rgba(255, 255, 255, 0.8);
}

.estimate-allowances-section {
    margin-bottom: 2rem;
}

.allowances-summary {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.estimate-table-container {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.estimate-table-container .table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

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

.estimate-table-container thead th {
    background: #f9fafb;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--secondary-color);
    border-bottom: 2px solid #e5e7eb;
}

.estimate-table-container tbody td {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.estimate-table-container tbody tr:hover {
    background: #f9fafb;
}

.estimate-table-container tbody tr[data-level="1"] td {
    padding-left: 2rem;
    font-size: 0.9rem;
}

.estimate-table-container tbody tr[data-level="2"] td {
    padding-left: 3rem;
    font-size: 0.85rem;
}

.estimate-table-container tfoot {
    background: #f9fafb;
    font-weight: 600;
}

.estimate-table-container tfoot td {
    padding: 1rem 0.75rem;
    border-top: 2px solid #e5e7eb;
}

.estimate-project-selector {
    margin-bottom: 1.5rem;
}

.estimate-project-selector .form-group {
    max-width: 400px;
}