/* CSS Variables & Theme Setup */
:root {
    --navy: #0b2f6b;
    --navy-deep: #06224f;
    --teal: #11a7a1;
    --teal-dark: #067a80;
    --green: #69be45;
    --green-soft: rgba(105, 190, 69, 0.1);
    --gold: #d9a441;
    --gold-soft: rgba(217, 164, 65, 0.1);
    --ink: #243044;
    --muted: #617084;
    --line: #dce7ee;
    --soft: #f3f9fa;
    --white: #ffffff;
    
    /* Layout properties */
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 10px 30px rgba(11, 47, 107, 0.05);
    --shadow-hover: 0 18px 45px rgba(11, 47, 107, 0.12);
    --transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Global Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Nunito Sans", Arial, sans-serif;
    color: var(--ink);
    background-color: #f7fafc;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: "Montserrat", Arial, sans-serif;
    font-weight: 700;
    color: var(--navy-deep);
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    font-family: "Montserrat", Arial, sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.btn-primary {
    color: var(--white);
    background: linear-gradient(135deg, var(--navy), var(--teal-dark));
    box-shadow: 0 8px 20px rgba(11, 47, 107, 0.15);
}

.btn-primary:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 12px 28px rgba(11, 47, 107, 0.22);
    opacity: 0.95;
}

.btn-secondary {
    color: var(--navy);
    background: var(--white);
    border-color: rgba(11, 47, 107, 0.15);
}

.btn-secondary:hover {
    background: var(--soft);
    border-color: var(--navy);
}

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

.btn-danger:hover {
    background: #c53030;
}

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

/* Login Page Styling */
.login-body {
    background: radial-gradient(circle at center, rgba(17, 167, 161, 0.1), transparent 70%),
                linear-gradient(135deg, #ffffff, #f0f7f9);
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    box-shadow: 0 24px 70px rgba(11, 47, 107, 0.12);
    width: 100%;
    max-width: 440px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

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

.login-header img {
    width: 80px;
    height: auto;
    margin-bottom: 15px;
}

.login-header h2 {
    font-size: 1.4rem;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.login-header p {
    color: var(--muted);
    font-size: 0.9rem;
}

/* Form Groups */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.form-group label {
    font-family: "Montserrat", Arial, sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input, 
.form-group select, 
.form-group textarea {
    padding: 12px 16px;
    font-size: 0.95rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink);
    background-color: var(--white);
    transition: var(--transition);
    font-family: inherit;
    outline: none;
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(17, 167, 161, 0.15);
}

.form-feedback {
    background-color: #fff5f5;
    border-left: 4px solid #e53e3e;
    color: #c53030;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Dashboard Shell Layout */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--navy-deep) 0%, var(--navy) 100%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

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

.sidebar-brand img {
    height: 40px;
    width: auto;
}

.sidebar-brand h1 {
    color: var(--white);
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.menu-header {
    padding: 14px 20px 6px 20px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.45);
    pointer-events: none;
    user-select: none;
    margin-top: 8px;
}
.menu-header:first-of-type {
    margin-top: 0;
    padding-top: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
    font-size: 0.9rem;
    border-left: 4px solid transparent;
}

.sidebar-menu a:hover, 
.sidebar-menu li.active a {
    color: var(--white);
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-menu li.active a {
    border-left-color: var(--teal);
    background-color: rgba(17, 167, 161, 0.1);
}

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

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    font-weight: 600;
}

.sidebar-footer a:hover {
    color: #fc8181;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Dashboard Header */
.dashboard-header {
    background-color: var(--white);
    border-bottom: 1px solid var(--line);
    min-height: 70px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-title h2 {
    font-size: 1.25rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--teal), var(--navy));
    color: var(--white);
    display: grid;
    place-items: center;
    font-family: "Montserrat", Arial, sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-info span {
    display: block;
}

.user-info .name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--navy-deep);
}

.user-info .role {
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: capitalize;
}

/* Dashboard Workspace */
.dashboard-workspace {
    padding: 30px;
    flex-grow: 1;
}

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

.metric-card {
    background-color: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

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

.metric-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.metric-label {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--navy-deep);
    line-height: 1.1;
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--soft);
    color: var(--teal);
    display: grid;
    place-items: center;
    font-size: 1.25rem;
}

/* Panel Layout Content Containers */
.panel-card {
    background-color: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 25px;
    margin-bottom: 30px;
}

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

.panel-card-header h3 {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

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

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

.table-custom th, 
.table-custom td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.table-custom th {
    font-family: "Montserrat", Arial, sans-serif;
    font-weight: 700;
    color: var(--navy);
    background-color: var(--soft);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}

.table-custom tbody tr:hover {
    background-color: rgba(243, 249, 250, 0.4);
}

/* Status Badges */
.badge {
    display: inline-flex;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

.badge-pending {
    background-color: #feebc8;
    color: #c05621;
}

.badge-active, .badge-paid, .badge-approved {
    background-color: #c6f6d5;
    color: #22543d;
}

.badge-warning {
    background-color: #feebc8;
    color: #c05621;
}

.badge-info, .badge-in_progress {
    background-color: #ebf8ff;
    color: #2b6cb0;
}

.badge-completed, .badge-realized {
    background-color: #e2e8f0;
    color: #4a5568;
}

.badge-danger, .badge-cancel, .badge-rejected {
    background-color: #fed7d7;
    color: #9b2c2c;
}

/* Grid splits for views */
.grid-2col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
}

/* Bank Account visualizer widget */
.bank-accounts-showcase {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.bank-account-item {
    border: 2px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 16px;
    background-color: var(--soft);
    transition: var(--transition);
    position: relative;
    cursor: pointer;
}

.bank-account-item:hover {
    border-color: var(--teal);
    background-color: var(--white);
}

.bank-account-item input[type="radio"] {
    position: absolute;
    top: 16px;
    right: 16px;
    accent-color: var(--teal);
    width: 18px;
    height: 18px;
}

.bank-account-item strong {
    display: block;
    color: var(--navy);
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.bank-account-item p {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 4px;
}

/* Alert Notification bars */
.alert {
    padding: 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background-color: #f0fff4;
    border: 1px solid #c6f6d5;
    color: #22543d;
}

.alert-info {
    background-color: #ebf8ff;
    border: 1px solid #bee3f8;
    color: #2a4365;
}

.alert-danger {
    background-color: #fff5f5;
    border: 1px solid #fed7d7;
    color: #742a2a;
}

/* QR Code Section container */
.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background-color: var(--soft);
    text-align: center;
}

.qr-code-image {
    background-color: var(--white);
    padding: 15px;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.qr-code-image img {
    width: 160px;
    height: 160px;
}

.qr-code-code {
    font-family: monospace;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--navy);
    background-color: rgba(11, 47, 107, 0.08);
    padding: 4px 10px;
    border-radius: 4px;
}

/* Responsive Styles for Dashboards */
@media (max-width: 991px) {
    .sidebar {
        width: 70px;
    }
    
    .sidebar-brand h1, 
    .sidebar-menu span,
    .sidebar-footer span,
    .menu-header {
        display: none;
    }
    
    .sidebar-brand {
        justify-content: center;
        padding: 20px 0;
    }
    
    .sidebar-menu a {
        justify-content: center;
        padding: 12px 0;
        border-left-width: 0;
        border-bottom: 3px solid transparent;
    }
    
    .sidebar-menu li.active a {
        border-bottom-color: var(--teal);
    }
}

@media (max-width: 767px) {
    .dashboard-wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
    }
    
    .sidebar-brand {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px 20px;
    }
    
    .sidebar-brand h1 {
        display: block;
    }
    
    .sidebar-menu {
        flex-direction: row;
        padding: 10px 20px;
        overflow-x: auto;
    }
    
    .sidebar-menu a {
        padding: 8px 12px;
        border-bottom-width: 2px;
    }
    
    .sidebar-footer {
        display: none;
    }
    
    .dashboard-header {
        padding: 15px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .dashboard-workspace {
        padding: 20px 15px;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   MÓDULO DE NOTIFICACIONES (CAMPANA) Y CHAT DE COORDINACIÓN
   ========================================================================== */

/* Campana de Notificaciones */
.notif-bell-container {
    position: relative;
    margin-right: 15px;
}

.notif-bell-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    transition: var(--transition);
    border: 1px solid var(--line);
}

.notif-bell-btn:hover {
    color: var(--navy);
    background-color: var(--soft);
    border-color: var(--navy);
}

.notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: #e53e3e;
    color: var(--white);
    font-size: 0.65rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    padding: 0 4px;
    box-shadow: 0 0 0 2px var(--white);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.4);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(229, 62, 62, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(229, 62, 62, 0);
    }
}

/* Dropdown de Notificaciones */
.notif-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    width: 340px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 15px 35px rgba(6, 34, 79, 0.15);
    z-index: 110;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    overflow: hidden;
}

.notif-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background-color: var(--soft);
}

.notif-dropdown-header h4 {
    font-size: 0.9rem;
    color: var(--navy-deep);
}

.notif-dropdown-header button {
    background: none;
    border: none;
    font-size: 0.75rem;
    color: var(--teal-dark);
    font-weight: 700;
    cursor: pointer;
}

.notif-dropdown-header button:hover {
    text-decoration: underline;
}

.notif-dropdown-list {
    max-height: 280px;
    overflow-y: auto;
}

.notif-item {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    transition: var(--transition);
}

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

.notif-item:hover {
    background-color: var(--soft);
}

.notif-item-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 3px;
}

.notif-item-desc {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.3;
    margin-bottom: 5px;
    white-space: pre-line;
}

.notif-item-time {
    font-size: 0.7rem;
    color: var(--muted);
}

.notif-dropdown-footer {
    padding: 12px;
    text-align: center;
    border-top: 1px solid var(--line);
    font-size: 0.8rem;
    color: var(--muted);
}

/* Chat de Coordinación */
.chat-messages-container {
    height: 350px;
    overflow-y: auto;
    padding: 15px;
    background-color: #f7fafc;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.chat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    line-height: 1.4;
    font-size: 0.9rem;
    position: relative;
    word-break: break-word;
}

.chat-bubble.sent {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--navy), var(--navy-deep));
    color: var(--white);
    border-bottom-right-radius: 2px;
    box-shadow: 0 4px 10px rgba(11, 47, 107, 0.15);
}

.chat-bubble.received {
    align-self: flex-start;
    background-color: var(--white);
    color: var(--ink);
    border: 1px solid var(--line);
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.chat-bubble-meta {
    font-size: 0.7rem;
    margin-top: 5px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.chat-bubble.sent .chat-bubble-meta {
    color: rgba(255, 255, 255, 0.7);
}

.chat-bubble.received .chat-bubble-meta {
    color: var(--muted);
}

.chat-bubble-sender {
    font-weight: 700;
    text-transform: capitalize;
}

.chat-input-area {
    display: flex;
    gap: 10px;
}

.chat-input-area textarea {
    flex-grow: 1;
    resize: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-family: inherit;
    font-size: 0.9rem;
    height: 44px;
    outline: none;
    transition: var(--transition);
}

.chat-input-area textarea:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(17, 167, 161, 0.1);
}

.chat-input-area button {
    align-self: flex-end;
}

/* Tab Navigation Visibility */
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

