/* ==========================================================================
   SUPERMERCADOS SER - DESIGN SYSTEM & COMPONENT STYLES
   ========================================================================== */

:root {
    /* Color Palette */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #e0e7ff;
    
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-active: #1e293b;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-light: #f8fafc;
    
    --border-color: #e2e8f0;
    --border-dark: #334155;
    
    /* Status Colors */
    --status-pending-bg: #fef3c7;
    --status-pending-text: #92400e;
    --status-pending-border: #fde68a;

    --status-progress-bg: #dbeafe;
    --status-progress-text: #1e40af;
    --status-progress-border: #bfdbfe;

    --status-completed-bg: #d1fae5;
    --status-completed-text: #065f46;
    --status-completed-border: #a7f3d0;

    /* Priority Colors */
    --prio-high-bg: #fee2e2;
    --prio-high-text: #991b1b;
    --prio-med-bg: #ffedd5;
    --prio-med-text: #9a3412;
    --prio-low-bg: #f1f5f9;
    --prio-low-text: #475569;

    /* Cost & Purple Accent */
    --purple-bg: #f3e8ff;
    --purple-text: #6b21a8;

    /* Shadows & Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px 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 & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* Sidebar */
.sidebar {
    width: 270px;
    background-color: var(--bg-sidebar);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

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

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fff;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.brand-text h2 {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
}

.brand-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
}

.nav-btn.active {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

/* Database Online Tools Sidebar Box */
.database-tools {
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed var(--border-dark);
    border-radius: var(--radius-md);
    padding: 0.85rem;
    margin-bottom: 1rem;
}

.db-tools-header {
    font-size: 0.78rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.db-actions-btns {
    display: flex;
    gap: 0.4rem;
}

.btn-outline-light {
    border: 1px solid var(--border-dark);
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.05);
    flex: 1;
    font-size: 0.75rem;
    padding: 0.4rem 0.3rem;
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Sidebar Footer */
.sidebar-footer {
    border-top: 1px solid var(--border-dark);
    padding-top: 1rem;
}

.quick-stats-mini {
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
}

.mini-stat {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
}

.progress-bar-sm {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill-sm {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8, #10b981);
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* Top Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-title h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
}

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

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

.search-box {
    position: relative;
    width: 280px;
}

.search-box i {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-box input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.4rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    font-size: 0.88rem;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background-color: var(--bg-card);
    padding: 0.35rem 0.75rem 0.35rem 0.35rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.user-profile img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
}

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

.user-name {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.1;
}

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

/* KPI Banner */
.kpi-banner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.kpi-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.text-indigo .kpi-icon { background: #e0e7ff; color: #4338ca; }
.text-amber .kpi-icon { background: #fef3c7; color: #b45309; }
.text-blue .kpi-icon { background: #dbeafe; color: #1d4ed8; }
.text-emerald .kpi-icon { background: #d1fae5; color: #047857; }
.text-purple .kpi-icon { background: #f3e8ff; color: #6b21a8; }

.kpi-info {
    display: flex;
    flex-direction: column;
}

.kpi-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.kpi-value {
    font-size: 1.35rem;
    font-weight: 800;
}

/* Filters Bar */
.filters-bar {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-group select {
    padding: 0.45rem 0.8rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-main);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

.filter-summary {
    margin-left: auto;
    font-size: 0.82rem;
    color: var(--text-muted);
    background-color: var(--bg-main);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-full);
}

/* Export Toolbar (Descargas Seleccionables) */
.export-toolbar {
    background: linear-gradient(135deg, #eef2ff, #f0fdf4);
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-md);
    padding: 0.8rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.export-selection-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.88rem;
    color: var(--text-primary);
}

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

.export-actions {
    display: flex;
    gap: 0.6rem;
}

/* Content Views */
.content-view {
    display: none;
}

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

/* ==========================================================================
   DASHBOARD SINGLE COLUMN FEED (DESCRIPCIÓN, SEDE Y PRIORIDAD)
   ========================================================================== */
.dashboard-single-column-feed {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 900px;
    margin: 0 auto;
}

.empty-dashboard-feed {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-dashboard-feed h3 {
    font-size: 1.1rem;
    margin-top: 1rem;
    color: var(--text-primary);
}

/* Simple Dashboard Card Focus: Descripción, Sede & Prioridad */
.simple-dashboard-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.simple-dashboard-card:hover {
    box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.15);
    border-color: #a5b4fc;
    transform: translateY(-2px);
}

.simple-dashboard-card.selected {
    border-color: var(--primary);
    background-color: #f5f3ff;
}

.simple-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.simple-card-left, .simple-card-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.badge-location-prominent {
    background: #4338ca;
    color: #ffffff;
    font-size: 0.85rem;
    padding: 0.35rem 0.85rem;
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(67, 56, 202, 0.25);
}

.simple-card-body {
    padding: 0.2rem 0;
}

.simple-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
    margin-bottom: 0.4rem;
}

.simple-card-desc-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.simple-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border-color);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.click-hint-text {
    font-size: 0.78rem;
    color: var(--primary);
    font-weight: 600;
}

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

/* LOCATION GROUP CARDS VIEW */
.locations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1.5rem;
}

.location-group-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.location-card-header {
    padding: 1.1rem 1.25rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.location-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--primary-hover);
}

.location-title h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

.location-badges {
    display: flex;
    gap: 0.35rem;
}

.location-stats-strip {
    padding: 0.5rem 1.25rem;
    background-color: #f1f5f9;
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.location-tickets-list {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    max-height: 450px;
    overflow-y: auto;
}

.empty-location-state {
    padding: 2rem 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Ticket Item Card inside Location */
.ticket-item-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.9rem;
    background-color: #fff;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.ticket-item-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
}

.ticket-item-card.selected {
    border-color: var(--primary);
    background-color: #f5f3ff;
}

.ticket-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.ticket-select-chk {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.ticket-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
    cursor: pointer;
}

.ticket-title:hover {
    color: var(--primary);
}

.ticket-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}

/* Progress bar inside cards */
.ticket-progress-bar {
    margin-bottom: 0.6rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}

.progress-track {
    height: 6px;
    background: #e2e8f0;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.ticket-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.4rem;
    border-top: 1px dashed var(--border-color);
}

.ticket-badges-mini {
    display: flex;
    gap: 0.3rem;
}

.tag-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    background-color: #f1f5f9;
    color: var(--text-secondary);
    font-weight: 500;
}

/* KANBAN BOARD */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.kanban-column {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    min-height: 500px;
}

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

.column-header.status-pending { border-color: #f59e0b; }
.column-header.status-in-progress { border-color: #3b82f6; }
.column-header.status-completed { border-color: #10b981; }

.column-header h3 {
    font-size: 1rem;
    font-weight: 700;
    flex: 1;
}

.kanban-cards {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.kanban-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.9rem;
    background-color: #fff;
    box-shadow: var(--shadow-sm);
}

.kanban-card.selected {
    border-color: var(--primary);
    background-color: #f5f3ff;
}

.kanban-card-top {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
}

.kanban-title {
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 0.4rem;
}

.kanban-loc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.kanban-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

/* DATA TABLES */
.table-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.data-table th {
    background-color: #f8fafc;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background-color: #f8fafc;
}

.table-row-selected {
    background-color: #f5f3ff !important;
}

.table-row-total {
    background-color: #e0e7ff;
    font-weight: 700;
}

/* BADGES & BUTTONS */
.code-badge {
    font-family: monospace;
    font-weight: 700;
    background-color: #f1f5f9;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-location {
    background-color: #e0e7ff;
    color: #4338ca;
}

.status-pending { background-color: var(--status-pending-bg); color: var(--status-pending-text); }
.status-in-progress { background-color: var(--status-progress-bg); color: var(--status-progress-text); }
.status-completed { background-color: var(--status-completed-bg); color: var(--status-completed-text); }

.priority-alta { background-color: var(--prio-high-bg); color: var(--prio-high-text); }
.priority-media { background-color: var(--prio-med-bg); color: var(--prio-med-text); }
.priority-baja { background-color: var(--prio-low-bg); color: var(--prio-low-text); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.3);
}

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

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

.btn-secondary {
    background-color: #e2e8f0;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: #cbd5e1;
}

.btn-block { width: 100%; }

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.btn-icon-sm {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: #fff;
    cursor: pointer;
}

.btn-icon-only {
    width: 36px;
    height: 36px;
    padding: 0;
}

.btn-text-danger {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 1.1rem;
    cursor: pointer;
    font-weight: bold;
}

/* MODAL SYSTEM & TABBED FORMS */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    padding: 1rem;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-dialog {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 94vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-dialog.modal-lg {
    max-width: 820px;
}

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

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    padding: 0.9rem 1.25rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    max-height: calc(94vh - 110px);
}

.modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background-color: #f8fafc;
    flex-shrink: 0;
}

/* Form Controls Compact Layout */
.form-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.55rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-bottom: 0.55rem;
}

.col-12 { flex: 0 0 100%; }
.col-6 { flex: 0 0 calc(50% - 0.375rem); }
.col-5 { flex: 0 0 calc(41.66% - 0.375rem); }
.col-3 { flex: 0 0 calc(25% - 0.375rem); }
.col-1 { flex: 0 0 calc(8.33% - 0.375rem); }

.form-group label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

.required { color: #ef4444; }

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-size: 0.84rem;
    line-height: 1.25;
    outline: none;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Form Tabs Header */
.form-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
}

.tab-btn {
    padding: 0.45rem 0.85rem;
    background: none;
    border: none;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;

    display: flex;
    align-items: center;
    gap: 0.4rem;
}

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

.tab-content {
    display: none;
}

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

/* Range Slider */
.progress-slider-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    background: #f8fafc;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.progress-slider-wrapper input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

.progress-bar-container {
    height: 10px;
    background: #e2e8f0;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #10b981);
    transition: width 0.2s ease;
}

/* Log & Bitacora Inputs & Photos */
.log-entry-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.log-entry-row input[type="text"] {
    flex: 1;
}

.log-photo-btn-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #f1f5f9;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.log-photo-btn-label:hover {
    background: #e0e7ff;
    border-color: var(--primary);
    color: var(--primary);
}

.log-photo-preview-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #f1f5f9;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px dashed var(--primary);
}

.log-photo-preview-thumb {
    position: relative;
    width: 60px;
    height: 50px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

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

.log-item-photo {
    display: block;
    margin-top: 0.5rem;
    max-width: 130px;
    max-height: 90px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease;
}

.log-item-photo:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}

.logs-container {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    background: #fafafa;
}

.log-item {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.4rem;
}

.log-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.log-text {
    font-size: 0.82rem;
    color: var(--text-primary);
}

/* File Upload & Photos Gallery */
.file-upload-dropzone {
    border: 2px dashed #a5b4fc;
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    background-color: #f5f3ff;
    cursor: pointer;
}

.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.photo-thumb-card {
    position: relative;
    width: 100%;
    height: 90px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.photo-thumb-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

.photo-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(239, 68, 68, 0.85);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.85rem;
    cursor: pointer;
}

/* Subpanels Gastos & Materiales */
.card-subpanel {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.card-subpanel h4 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.table-subpanel {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.table-subpanel th, .table-subpanel td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--border-color);
}

.cost-summary-banner {
    background: #f3e8ff;
    border: 1px solid #d8b4fe;
    border-radius: var(--radius-md);
    padding: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #581c87;
}

.total-highlight {
    font-size: 1.05rem;
    font-weight: 800;
    color: #6b21a8;
}

/* Lightbox Modal */
.lightbox-dialog {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.lightbox-dialog img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.5);
}

.lightbox-caption {
    color: #fff;
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: #fff;
    font-size: 2rem;
}

/* Charts & SVG Elements */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1.5rem;
}

.chart-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.chart-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.chart-header .subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chart-body {
    height: 250px;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.flex-center {
    align-items: center;
    justify-content: center;
}

.svg-bar-chart-container {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 200px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.chart-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 40px;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 160px;
    width: 100%;
}

.bar {
    flex: 1;
    border-radius: 4px 4px 0 0;
    transition: height 0.4s ease;
}

.bar-pending { background-color: #f59e0b; }
.bar-progress { background-color: #3b82f6; }
.bar-completed { background-color: #10b981; }

.chart-bar-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    text-align: center;
    white-space: nowrap;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 1rem;
    font-size: 0.78rem;
    margin-top: 0.75rem;
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.bg-amber { background-color: #f59e0b; }
.bg-blue { background-color: #3b82f6; }
.bg-emerald { background-color: #10b981; }

/* Donut Chart Simulation */
.donut-wrapper {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: conic-gradient(#6366f1 0% 30%, #06b6d4 30% 55%, #10b981 55% 75%, #f59e0b 75% 90%, #ec4899 90% 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.donut-center-info {
    width: 90px;
    height: 90px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    text-align: center;
}

.donut-legend-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem 1rem;
    font-size: 0.75rem;
    margin-top: 1rem;
}

.donut-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Detail Modal Styling */
.detail-main-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    background: #f8fafc;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.detail-section h4 {
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.progress-track-lg {
    height: 12px;
    background: #e2e8f0;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill-lg {
    height: 100%;
    transition: width 0.4s ease;
}

.detail-photos-gallery {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.detail-photo-thumb {
    width: 90px;
    height: 70px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.detail-tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

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

.toast {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius-md);
    background: #0f172a;
    color: #fff;
    font-size: 0.85rem;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

.toast-success { border-left: 4px solid #10b981; }
.toast-error { border-left: 4px solid #ef4444; }
.toast-info { border-left: 4px solid #38bdf8; }

.toast.fade-out {
    opacity: 0;
    transform: translateY(10px);
}

/* Helpers */
.margin-top-md { margin-top: 1rem; }
.margin-top-lg { margin-top: 1.5rem; }
.text-purple { color: #6b21a8; }
.text-emerald { color: #047857; }
.text-rose { color: #e11d48; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
