/* =============================================
   SISTEMA APR - Agua Potable Rural
   Diseño UI/UX Moderno & Atractivo
   ============================================= */

/* ---- CSS Variables / Theme ---- */
:root {
    /* Water-inspired palette */
    --primary: #0c6e8f;
    --primary-light: #1a9fc7;
    --primary-dark: #084b63;
    --primary-50: rgba(12,110,143,0.05);
    --primary-100: rgba(12,110,143,0.1);
    --primary-200: rgba(12,110,143,0.2);

    --accent: #00c9a7;
    --accent-light: #5dffd8;
    --accent-dark: #009b7d;

    --success: #22c55e;
    --success-bg: #f0fdf4;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --info: #3b82f6;
    --info-bg: #eff6ff;

    /* Neutrals */
    --bg: #f4f7fa;
    --bg-card: #ffffff;
    --bg-sidebar: #0a1628;
    --bg-sidebar-hover: rgba(255,255,255,0.07);
    --bg-sidebar-active: rgba(0,201,167,0.15);
    
    --text: #1e293b;
    --text-light: #64748b;
    --text-lighter: #94a3b8;
    --text-sidebar: #94a3b8;
    --text-sidebar-active: #00c9a7;
    --text-white: #ffffff;

    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --sidebar-width: 272px;
    --sidebar-collapsed-width: 72px;
    --header-height: 72px;

    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --transition: 0.2s cubic-bezier(.4,0,.2,1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 15px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-light); }

img { max-width: 100%; display: block; }

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

/* ---- Sidebar Overlay (mobile) ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease, width 0.3s ease;
    overflow: hidden;
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand-icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--accent), var(--primary-light));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    flex-shrink: 0;
}

.sidebar-brand h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-white);
    line-height: 1.2;
}
.sidebar-brand small {
    font-size: 0.7rem;
    color: var(--text-sidebar);
    font-weight: 400;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

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

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

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

.nav-section-title {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.25);
    padding: 12px 16px 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-sidebar);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
}

.nav-link:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-white);
}

.nav-link.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
}

.nav-link .nav-icon {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    opacity: 0.7;
}
.nav-link.active .nav-icon,
.nav-link:hover .nav-icon { opacity: 1; }

.nav-link .badge-nav {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    padding: 2px 7px;
    border-radius: 20px;
    font-weight: 600;
}

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

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info .name { color: var(--text-white); font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info .role { color: var(--text-sidebar); font-size: 0.7rem; }

.sidebar-logout {
    color: var(--text-sidebar);
    font-size: 1.1rem;
    transition: color var(--transition);
    padding: 4px;
}
.sidebar-logout:hover { color: var(--danger); }

/* ---- Sidebar Toggle (en top header) ---- */
.btn-toggle-sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    background: none;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-light);
    font-size: 1rem;
    transition: all var(--transition);
    flex-shrink: 0;
}
.btn-toggle-sidebar:hover {
    background: var(--primary-50);
    border-color: var(--primary);
    color: var(--primary);
}

/* ---- Sidebar Collapsed State ---- */
.main-content {
    transition: margin-left 0.3s ease;
}

body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}
body.sidebar-collapsed .main-content {
    margin-left: 0;
}

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

/* ---- Top Header ---- */
.top-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

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

.btn-mobile-menu {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
}

.page-title h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}
.page-title .breadcrumb {
    font-size: 0.78rem;
    color: var(--text-light);
}
.page-title .breadcrumb a { color: var(--primary); }

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ---- Page Content ---- */
.page-content {
    padding: 28px 32px;
    flex: 1;
}

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.card-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.card-body { padding: 24px; }
.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    background: var(--bg);
}

/* ---- Stat Cards (Dashboard) ---- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card.primary::after { background: var(--primary); }
.stat-card.success::after { background: var(--success); }
.stat-card.warning::after { background: var(--warning); }
.stat-card.danger::after  { background: var(--danger); }
.stat-card.accent::after  { background: var(--accent); }
.stat-card.info::after    { background: var(--info); }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.stat-card.primary .stat-icon { background: var(--primary-50); color: var(--primary); }
.stat-card.success .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card.warning .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat-card.danger .stat-icon  { background: var(--danger-bg); color: var(--danger); }
.stat-card.accent .stat-icon  { background: rgba(0,201,167,0.1); color: var(--accent-dark); }
.stat-card.info .stat-icon    { background: var(--info-bg); color: var(--info); }

.stat-info h4 {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.stat-info .stat-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}
.stat-info .stat-detail {
    font-size: 0.78rem;
    color: var(--text-lighter);
    margin-top: 4px;
}

/* ---- Tables ---- */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}
table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    padding: 12px 14px;
    border-bottom: 2px solid var(--border);
    text-align: left;
    white-space: nowrap;
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 1;
}
table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.88rem;
    vertical-align: middle;
    white-space: nowrap;
}
/* Celdas que pueden crecer */
table td.wrap { white-space: normal; min-width: 120px; }
table tbody tr {
    transition: background var(--transition);
}
table tbody tr:hover {
    background: var(--primary-50);
}
table tbody tr:last-child td { border-bottom: none; }

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.badge-success  { background: var(--success-bg); color: #15803d; }
.badge-warning  { background: var(--warning-bg); color: #b45309; }
.badge-danger   { background: var(--danger-bg);  color: #dc2626; }
.badge-info     { background: var(--info-bg);    color: #2563eb; }
.badge-primary  { background: var(--primary-50); color: var(--primary); }
.badge-neutral  { background: #f1f5f9; color: var(--text-light); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
}
.btn:active { transform: scale(0.97); }

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

.btn-accent    { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-dark); color: white; }

.btn-success   { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; color: white; }

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

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

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

.btn-ghost     { background: transparent; color: var(--text-light); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; border-radius: 6px; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: var(--radius-sm); }
.btn-icon.sm { width: 32px; height: 32px; font-size: 0.85rem; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Forms ---- */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.form-group .hint {
    font-size: 0.75rem;
    color: var(--text-lighter);
    margin-top: 4px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg-card);
    transition: all var(--transition);
    outline: none;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-100);
}
.form-control::placeholder { color: var(--text-lighter); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-check input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.input-group {
    display: flex;
    align-items: stretch;
}
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ---- Alerts ---- */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease-out;
}
.alert-success { background: var(--success-bg); color: #15803d; border-left: 4px solid var(--success); }
.alert-danger  { background: var(--danger-bg);  color: #dc2626; border-left: 4px solid var(--danger); }
.alert-warning { background: var(--warning-bg); color: #b45309; border-left: 4px solid var(--warning); }
.alert-info    { background: var(--info-bg);    color: #2563eb; border-left: 4px solid var(--info); }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
    list-style: none;
}
.pagination a, .pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-light);
    transition: all var(--transition);
}
.pagination a:hover { background: var(--primary-50); color: var(--primary); }
.pagination .active { background: var(--primary); color: white; }

/* ---- Modal ---- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10,22,40,0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.show { display: flex; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.25s ease-out;
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
}
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}
.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.4;
}
.empty-state h4 { font-size: 1.1rem; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 0.9rem; max-width: 360px; margin: 0 auto; }

/* ---- Utilities ---- */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-light); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-mono { font-family: var(--font-mono); }

.fw-bold { font-weight: 700; }
.fs-sm { font-size: 0.82rem; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

.hidden { display: none !important; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); width: var(--sidebar-width) !important; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0 !important; }
    .btn-mobile-menu { display: block; }
    .btn-toggle-sidebar { display: none; }
    .page-content { padding: 20px 16px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
    .header-right .hide-mobile { display: none; }
}

@media (max-width: 768px) {
    /* Tablas: scroll horizontal */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
    .table-responsive table { min-width: 600px; }
    
    /* Cards */
    .card-header { flex-wrap: wrap; gap: 8px; }
    .card-header .btn-group, .card-header .d-flex { flex-wrap: wrap; }
    
    /* Modales */
    .modal { width: 95%; max-width: 95%; margin: 10px; max-height: 90vh; }
    .modal-body { max-height: 60vh; overflow-y: auto; }
    
    /* Stat cards en columna */
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 1.3rem; }
    
    /* Top header compacto */
    .top-header { padding: 0 12px; }
    .page-title h2 { font-size: 1rem; }
    .header-right { font-size: 0.75rem; }
    
    /* Breadcrumbs */
    .breadcrumb { font-size: 0.75rem; }
    
    /* Page header actions */
    .page-header-actions { flex-wrap: wrap; gap: 6px; }
    .page-header-actions .btn { font-size: 0.8rem; padding: 6px 12px; }
}

@media (max-width: 640px) {
    html { font-size: 14px; }
    .top-header { padding: 0 12px; height: 50px; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .btn-group { flex-direction: column; }
    .btn-group .btn { width: 100%; justify-content: center; }
    table th, table td { padding: 8px 10px; font-size: 0.8rem; }
    .page-content { padding: 16px 12px; }
    
    /* Ocultar columnas menos importantes en tablas */
    .hide-sm { display: none !important; }
    
    /* Actions como iconos compactos */
    .d-flex.gap-1 { gap: 2px; }
    .d-flex.gap-1 .btn-sm { padding: 4px 6px; font-size: 0.75rem; }
    
    /* Card body padding reducido */
    .card-body { padding: 12px; }
    .card-header { padding: 12px; }
    
    /* Filtros en columna */
    .filter-bar { flex-direction: column; }
    .filter-bar .form-control { width: 100%; }
    .filter-bar .btn { width: 100%; }
}

@media (max-width: 400px) {
    .stat-grid { grid-template-columns: 1fr; }
    .stat-card { padding: 12px; }
    .page-title h2 { font-size: 0.9rem; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ---- Breadcrumb ---- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}
.breadcrumb a:hover {
    text-decoration: underline;
}
.breadcrumb .sep {
    color: var(--text-lighter);
    font-size: 0.7rem;
}

/* ---- Page Header with Actions ---- */
.page-header-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.page-header-bar .page-header-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* ---- Botón volver arriba ---- */
.btn-scroll-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(12,110,143,0.35);
    z-index: 999;
    transition: opacity 0.3s, transform 0.3s;
}
.btn-scroll-top.visible {
    display: flex;
}
.btn-scroll-top:hover {
    transform: scale(1.1);
}

/* ---- Bottom nav mobile (portal) ---- */
.bottom-nav-mobile {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 6px 0;
    z-index: 998;
    justify-content: space-around;
}
.bottom-nav-mobile a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 0.65rem;
    color: var(--text-light);
    text-decoration: none;
    padding: 4px 8px;
}
.bottom-nav-mobile a.active { color: var(--primary); }
.bottom-nav-mobile a i { font-size: 1.1rem; }

@media (max-width: 768px) {
    .bottom-nav-mobile { display: flex; }
    body.has-bottom-nav { padding-bottom: 60px; }
}

/* ---- Quick actions cards (mobile friendly) ---- */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}
.quick-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    transition: border-color 0.2s, transform 0.1s;
}
.quick-action-card:hover { border-color: var(--primary); }
.quick-action-card:active { transform: scale(0.97); }
.quick-action-card i { font-size: 1.3rem; color: var(--primary); }

/* ---- Touch-friendly buttons ---- */
@media (max-width: 768px) {
    .btn { min-height: 44px; } /* Apple HIG minimum touch target */
    .btn-sm { min-height: 36px; padding: 6px 10px; }
    .form-control, select { min-height: 44px; font-size: 16px; /* Prevent iOS zoom */ }
    .nav-link { min-height: 44px; }
}

/* ---- Login Page ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, #0a1628 0%, var(--primary-dark) 50%, #0a1628 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(0,201,167,0.08) 0%, transparent 50%),
                radial-gradient(circle at 70% 60%, rgba(26,159,199,0.06) 0%, transparent 50%);
    animation: floatBg 20s ease-in-out infinite;
}

@keyframes floatBg {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-2%, 2%); }
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 440px;
    padding: 48px 40px;
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}
.login-logo .logo-icon {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--accent), var(--primary-light));
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(0,201,167,0.3);
}
.login-logo h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
}
.login-logo p {
    color: var(--text-light);
    font-size: 0.88rem;
    margin-top: 4px;
}

.login-card .form-control {
    padding: 12px 16px;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
}

.login-card .btn-primary {
    width: 100%;
    padding: 13px;
    font-size: 1rem;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 4px 16px rgba(12,110,143,0.3);
}
.login-card .btn-primary:hover {
    box-shadow: 0 6px 24px rgba(12,110,143,0.4);
    transform: translateY(-1px);
}

/* ---- Portal Cliente ---- */
.portal-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    padding: 32px;
    border-radius: var(--radius-lg);
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}
.portal-header::after {
    content: '';
    position: absolute;
    top: -30px; right: -30px;
    width: 200px; height: 200px;
    background: rgba(0,201,167,0.15);
    border-radius: 50%;
}
.portal-header h2 { font-size: 1.4rem; font-weight: 800; position: relative; z-index: 1; }
.portal-header p { opacity: 0.85; margin-top: 4px; position: relative; z-index: 1; }

/* ---- Chart container ---- */
.chart-container {
    position: relative;
    height: 300px;
    padding: 16px 0;
}

/* ---- Tooltips ---- */
[data-tooltip] {
    position: relative;
}
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-sidebar);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}
[data-tooltip]:hover::after { opacity: 1; }

/* ---- Water Animation (Login/Portal) ---- */
.water-drops {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.water-drops span {
    position: absolute;
    width: 6px;
    height: 6px;
    background: rgba(0,201,167,0.3);
    border-radius: 50%;
    animation: drop 8s linear infinite;
}
@keyframes drop {
    0%   { transform: translateY(-100px) scale(0); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 0.5; }
    100% { transform: translateY(100vh) scale(1); opacity: 0; }
}

/* ---- Print styles ---- */
@media print {
    .sidebar, .top-header, .btn, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ============================================
   PASSWORD TOGGLE
   ============================================ */
.password-wrapper {
    position: relative;
}
.password-wrapper input {
    padding-right: 44px;
}
.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px 8px;
    font-size: 0.9rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.password-toggle:hover {
    opacity: 1;
}
