@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');
:root {
    --primary-color: #1a73e8;
    --primary-light: #4c8bf5;
    --primary-dark: #0d47a1;
    --secondary-color: #34a853;
    --secondary-light: #6aa84f;
    --secondary-dark: #296d36;
    --text-color: #2d3436;
    --text-light: #636e72;
    --text-darker: #0a0a0a;
    --bg-color: #f4f7f6;
    --card-bg: #fff;
    --border-color: #e0e0e0;
    --input-border-color: #bdbdbd;
    --success-color: #34a853;
    --warning-color: #fbbc05;
    --danger-color: #ea4335;
    --info-color: #4285f4;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 25px rgba(0,0,0,0.15);
    --transition: all 0.3s ease;
    --radius-md: 12px;
    --header-height-mobile: 55px;
    --nav-height-mobile: 60px;
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-secondary: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: var(--font-primary);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.65;
    font-size: 16px;
    font-weight: 400;
    letter-spacing: -0.01em;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: var(--header-height-mobile);
    padding-bottom: var(--nav-height-mobile);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-secondary);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.025em;
    color: var(--text-darker);
    margin-bottom: 1rem;
}
h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.04em;
}
h2 {
    color: var(--primary-dark);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 24px;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    position: relative;
}
h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 2px;
}
h3 {
    font-size: clamp(1.25rem, 2.5vw, 1.5rem);
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 16px;
}
h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 12px;
}
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--primary-dark);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    height: var(--header-height-mobile);
}
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    height: 100%;
}
.logo-section {
    display: flex;
    align-items: center;
}
.logo {
    font-family: var(--font-secondary);
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo i {
    color: var(--secondary-color);
    font-size: 1.5rem;
}
.system-subtitle {
    font-family: var(--font-primary);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    margin-left: 10px;
    display: none;
}
.nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--card-bg);
    box-shadow: var(--shadow);
    z-index: 900;
    height: var(--nav-height-mobile);
    border-top: 1px solid var(--border-color);
}
.nav-content {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 100%;
}
.nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-light);
    font-family: var(--font-secondary);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    padding: 5px 0;
    transition: var(--transition);
}
.nav a i {
    font-size: 1.2rem;
    margin-bottom: 3px;
}
.nav a.active {
    color: var(--primary-color);
    font-weight: 600;
}
.main-content {
    flex-grow: 1;
    padding: 20px 15px;
    max-width: 100%;
    width: 100%;
    margin-top: 0;
}
.section {
    display: none;
    animation: fadeIn 0.5s ease-out;
}
.section.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.card {
    background-color: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}
.card:hover {
    box-shadow: var(--shadow-hover);
}
.btn {
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    text-align: center;
    text-transform: uppercase;
    transition: var(--transition);
    border: none;
    margin-top: 10px;
    width: 100%;
    position: relative;
    overflow: hidden;
}
.btn i {
    margin-right: 6px;
}
.btn-primary {
    background-color: var(--primary-color);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}
.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}
.btn-secondary:hover {
    background-color: var(--secondary-dark);
    transform: translateY(-1px);
}
.btn-danger {
    background-color: var(--danger-color);
    color: white;
}
.btn-danger:hover {
    background-color: #c43224;
    transform: translateY(-1px);
}
.btn-warning {
    background-color: var(--warning-color);
    color: var(--text-color);
}
.btn-warning:hover {
    background-color: #e8a600;
    transform: translateY(-1px);
}
.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
    margin-bottom: 25px;
}
.btn-group .btn {
    flex-grow: 1;
    width: auto;
    margin-top: 0;
}
.form-group {
    margin-bottom: 18px;
}
label {
    display: block;
    margin-bottom: 6px;
    font-family: var(--font-secondary);
    font-weight: 600;
    color: var(--text-darker);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    opacity: 0.9;
}
input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--input-border-color);
    border-radius: 8px;
    font-family: var(--font-primary);
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-color);
    background-color: #fcfcfc;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.4;
}
input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}
textarea {
    resize: vertical;
    min-height: 90px;
    font-family: var(--font-primary);
    line-height: 1.6;
}
.form-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: 1fr;
    margin-bottom: 20px;
}
.section-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
    padding: 20px;
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
}
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.table-container {
    overflow-x: auto;
    margin-top: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    background-color: var(--card-bg);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}
.data-table th, .data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.data-table th {
    background-color: var(--primary-color);
    color: white;
    font-family: var(--font-secondary);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
}
.sortable {
    cursor: pointer;
    position: relative;
    -webkit-user-select: none; 
    user-select: none;
}
.data-table th.sortable {
     padding-right: 22px !important;
}
.sortable::after {
    content: ' ';
    position: absolute;
    right: 8px;
    top: 50%;
    width: 0; 
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    opacity: 0.3; 
    transform: translateY(-50%);
}
.sortable:not(.sort-asc):not(.sort-desc)::after {
    border-top: 5px solid white; 
    border-bottom: 5px solid transparent;
    margin-top: -2px;
}
.sortable.sort-asc::after {
    content: ' ';
    border-bottom: 5px solid white;
    border-top: 5px solid transparent; 
    opacity: 1;
    margin-top: -6px;
}
.sortable.sort-desc::after {
    content: ' ';
    border-top: 5px solid white;
    border-bottom: 5px solid transparent; 
    opacity: 1;
    margin-top: -2px;
}
.data-table td {
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.5;
}
.data-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}
.data-table tbody tr:hover {
    background-color: #f0f0f0;
    cursor: default;
}
.action-buttons {
    display: flex;
    gap: 6px;
}
.action-buttons .btn {
    padding: 8px 12px;
    font-size: 0.75rem;
    width: auto;
    margin-top: 0;
}
.badge-urgente { background-color: var(--danger-color); color: white; padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.badge-alta { background-color: var(--warning-color); color: var(--text-darker); padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.badge-media { background-color: var(--info-color); color: white; padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.badge-baja { background-color: var(--secondary-color); color: white; padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.badge-normal { background-color: var(--secondary-color); color: white; padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.badge-anormal { background-color: var(--warning-color); color: var(--text-darker); padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.badge-contaminado { background-color: var(--danger-color); color: white; padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.badge-necrosado {
  background-color: #8B4513; 
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.widget {
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    background-color: var(--card-bg);
    text-align: center;
    border-left: 5px solid var(--primary-color);
    transition: var(--transition);
}
.widget:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}
.widget-icon {
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 12px;
}
.widget-title {
    font-family: var(--font-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.widget-value {
    font-family: var(--font-secondary);
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: -0.03em;
    line-height: 1;
}
.chart-container {
    height: 300px;
    margin-top: 24px;
}
#message-box {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    font-family: var(--font-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
    max-width: 90%;
    text-align: center;
}
.message-success { background-color: var(--success-color); color: white; }
.message-error { background-color: var(--danger-color); color: white; }
.message-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Overlay de "Trabajando, espere por favor" (operaciones lentas: copia
   de seguridad, restablecer, limpiar datos). Ver ui-helpers.js
   showLoadingOverlay()/hideLoadingOverlay(). */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.loading-overlay.visible {
    opacity: 1;
    visibility: visible;
}
.loading-box {
    background-color: var(--card-bg);
    padding: 36px 40px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-hover);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}
.loading-box p {
    margin: 0;
    font-weight: 600;
    color: var(--text-color);
}
.loading-dots {
    display: flex;
    gap: 10px;
}
.loading-dots span {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--primary-color);
    animation: loading-dots-bounce 1.4s ease-in-out infinite both;
}
.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes loading-dots-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}
.modal-content {
    background-color: var(--card-bg);
    padding: 32px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-hover);
    max-width: 90%;
    width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}
.modal-overlay.visible .modal-content {
    transform: scale(1);
}
.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-title {
    font-family: var(--font-secondary);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin: 0;
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: var(--transition);
}
.modal-close:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-darker);
}
.modal-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: 24px;
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.footer {
    padding: 20px 15px 80px 15px;
    background-color: #e0e0e0;
    color: var(--text-light);
    text-align: center;
    font-size: 0.8rem;
    font-family: var(--font-primary);
    border-top: 1px solid var(--border-color);
}
.footer button {
    margin-bottom: 12px;
    width: auto;
    padding: 10px 16px;
}
#pdf-preview-container {
    margin-top: 24px;
    padding: 24px;
    background: white;
    box-shadow: var(--shadow);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    max-width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
}
#pdf-content {
    max-width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
}
.pdf-details, .pdf-table-data {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    margin-bottom: 24px;
}
.pdf-details table, .pdf-table-data table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
}
.pdf-details th, .pdf-details td,
.pdf-table-data th, .pdf-table-data td {
    word-wrap: break-word;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 768px) {
    #pdf-preview-container {
        padding: 16px;
        margin-left: -8px;
        margin-right: -8px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .pdf-details th, .pdf-details td,
    .pdf-table-data th, .pdf-table-data td {
        font-size: 0.8rem;
        padding: 6px 8px;
    }
}
.pdf-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-color);
}
.pdf-header h1 {
    color: var(--primary-dark);
    font-size: 1.8rem;
    font-family: var(--font-secondary);
    font-weight: 800;
    margin: 0;
}
.pdf-header p {
    color: var(--text-light);
    font-size: 0.9rem;
    font-family: var(--font-primary);
}
.pdf-details, .pdf-table-data {
    width: 100%;
    margin-bottom: 24px;
}
.pdf-details th, .pdf-details td {
    padding: 10px;
    text-align: left;
    font-size: 0.9rem;
    font-family: var(--font-primary);
}
.pdf-details th {
    font-weight: 600;
    width: 35%;
    color: var(--primary-dark);
    font-family: var(--font-secondary);
}
.pdf-table-data table {
    width: 100%;
    border-collapse: collapse;
}
.pdf-table-data th, .pdf-table-data td {
    border: 1px solid #ddd;
    padding: 10px;
    font-size: 0.85rem;
    font-family: var(--font-primary);
}
.pdf-table-data th {
    background-color: #f2f2f2;
    color: var(--text-color);
    font-family: var(--font-secondary);
    font-weight: 600;
}
.pdf-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 12px;
    border-top: 1px solid #ddd;
    font-style: italic;
    font-size: 0.75rem;
    color: var(--text-light);
    font-family: var(--font-primary);
}
.help-content {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 8px;
}
.help-section {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}
.help-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}
.help-section h4 {
    color: #0d47a1;
    font-size: 1.1rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.help-section h4 i {
    color: #1a73e8;
    font-size: 1rem;
}
.help-section p {
    color: #555;
    line-height: 1.6;
    margin: 0;
    font-size: 0.95rem;
}
.help-features {
    background-color: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    margin: 20px 0;
}
.help-features h4 {
    color: #0d47a1;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.help-features ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.help-features li {
    padding: 6px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}
.help-features li i {
    color: #34a853;
    font-size: 0.9rem;
}
.help-contact {
    background-color: #e8f0fe;
    padding: 16px;
    border-radius: 8px;
    margin-top: 20px;
}
.help-contact h4 {
    color: #0d47a1;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.help-contact p {
    color: #555;
    margin: 0;
    line-height: 1.6;
}
.help-content::-webkit-scrollbar {
    width: 6px;
}
.help-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}
.help-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}
.help-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
@media (min-width: 768px) {
    body {
        padding-top: 70px;
        padding-bottom: 0;
    }
    .header {
        height: 80px;
    }
    .logo {
        font-size: 1.4rem;
        font-weight: 800;
    }
    .system-subtitle {
        display: block;
        font-size: 0.8rem;
    }
    .nav {
        position: fixed;
        top: 70px;
        bottom: 0;
        left: 0;
        width: 240px;
        height: auto;
        border-top: none;
        border-right: 1px solid var(--border-color);
        box-shadow: 0 0 8px rgba(0, 0, 0, 0.12);
        padding: 8px 0;
        background-color: var(--card-bg);
        overflow-y: auto;
    }
    .nav-content {
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        padding-top: 8px;
    }
    .nav a {
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        padding: 16px 24px;
        width: 100%;
        font-family: var(--font-secondary);
        font-size: 0.9rem;
        font-weight: 500;
        letter-spacing: -0.01em;
        color: var(--text-light);
        text-decoration: none;
        border-radius: 0 28px 28px 0;
        margin: 2px 0;
        margin-right: 12px;
        transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
        position: relative;
        min-height: 48px;
    }
    .nav a:hover {
        background-color: rgba(26, 115, 232, 0.08);
        color: var(--primary-color);
        transform: translateX(2px);
    }
    .nav a.active {
        background-color: rgba(26, 115, 232, 0.12);
        color: var(--primary-color);
        font-weight: 600;
        font-family: var(--font-secondary);
    }
    .nav a.active::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 4px;
        background-color: var(--primary-color);
        border-radius: 0 2px 2px 0;
    }
    .nav a i {
        font-size: 1.25rem;
        margin-right: 16px;
        margin-bottom: 0;
        width: 24px;
        text-align: center;
        color: inherit;
        transition: transform 0.2s ease;
    }
    .nav a:hover i {
        transform: scale(1.1);
    }
    .nav a:focus {
        outline: 2px solid var(--primary-color);
        outline-offset: -2px;
        background-color: rgba(26, 115, 232, 0.08);
    }
    .nav a::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: radial-gradient(circle, rgba(26, 115, 232, 0.3) 0%, transparent 70%);
        transform: scale(0);
        transition: transform 0.3s ease;
        pointer-events: none;
        border-radius: inherit;
        opacity: 0;
    }
    .nav a:active::after {
        transform: scale(1);
        opacity: 1;
    }
    .nav-separator {
        height: 1px;
        background-color: var(--border-color);
        margin: 8px 24px;
        opacity: 0.6;
    }
    @media (hover: none) {
        .nav a:hover {
            background-color: transparent;
            transform: none;
        }
        
        .nav a:hover i {
            transform: none;
        }
    }
    .main-content {
        margin-left: 240px;
        padding: 32px;
        max-width: calc(100% - 240px);
    }
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .form-grid.full-row > .form-group:last-child,
    .form-grid .form-group.full-row {
        grid-column: 1 / -1;
    }
    .section-actions {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    .filter-group {
        flex-direction: row;
        gap: 16px;
    }
    .btn {
        width: auto;
        margin-top: 0;
    }
    .btn-group {
        flex-wrap: nowrap;
    }
    .footer {
        margin-left: 240px;
        padding-bottom: 20px;
        text-align: center;
    }
}
.logogdp {
    width: 50px;
    height: 50px;
    display: inline-block;
    background-color: #f0f0f0;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.logogdpAN {
    width: 250px;
    height: 150px;
    display: inline-block;
    background-color: #f0f0f0;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.text-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: left;
}
.text-content span {
    font-family: var(--font-secondary);
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
    text-align: left;
    display: block;
    letter-spacing: -0.02em;
}
.system-subtitle {
    margin-top: 2px;
    text-align: left;
    display: block;
    font-family: var(--font-primary);
    font-weight: 400;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 0.01em;
}
.btn-orange {
    background-color: #ff7f00;
    color: white;
    border: none;
    transition: background-color 0.3s ease;
}
.btn-orange:hover {
    background-color: #e66a00;
}
.gades-widget {
    display: inline-block;
    background: #fff;
    border-radius: 10px;
    padding: 15px 20px;
    margin: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 180px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-left: 6px solid transparent;
    cursor: pointer;
}
.gades-widget:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.gades-widget-icon {
    font-size: 28px;
    margin-bottom: 5px;
}
.gades-widget-title {
    font-weight: bold;
    margin-bottom: 4px;
}
.gades-widget-value {
    font-size: 22px;
    color: #333;
}
.gades-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.gades-modal {
    background: #fff;
    padding: 20px 30px;
    border-radius: 10px;
    width: 80%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 15px rgba(0,0,0,0.3);
    animation: gades-fadeIn 0.3s ease;
}
.gades-modal h2 {
    margin-top: 0;
    color: var(--primary-color, #0077cc);
}
.gades-modal-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}
.gades-modal-table th,
.gades-modal-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}
.gades-modal-table th {
    background: #f4f4f4;
}
.gades-modal-close {
    margin-top: 20px;
    background: var(--primary-color, #0077cc);
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
}
@keyframes gades-fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.large-extra-modal-flex {
    height: auto;
    min-height: 900px;
    max-height: 90vh;
    overflow-y: auto;
}
.observations-alert {
    font-size: 0.75rem;
    color: var(--danger-color);
    margin-top: 4px;
    font-style: italic;
    display: none;
}
.observations-alert.visible {
    display: block;
}

@keyframes welcomePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.emergency-protocol {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.emergency-protocol h4 {
    color: var(--danger-color);
    margin-bottom: 6px;
    font-size: 1.1rem;
    font-family: var(--font-secondary);
    font-weight: 600;
}
.emergency-protocol p {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.6;
}
.inline-title {
    display: flex;
    align-items: center;
    gap: 6px;
}
.inline-title span {
    margin-right: 0;
}
@media (max-width: 600px) {
    .welcome-tutorial-nav .btn {
        font-size: 14px;
        padding: 8px 12px;
    }
    .welcome-tutorial-nav > div {
        flex-direction: column;
        gap: 8px !important;
    }
    .welcome-tutorial-nav #welcomePrevBtn,
    .welcome-tutorial-nav #welcomeNextBtn {
        width: 100%;
        flex: none !important;
    }
    .welcome-tutorial-nav #welcomeSkipBtn {
        font-size: 13px;
        margin-top: 8px !important;
    }
}
.contaminacion-roja {
    border-color: #d10000 !important;
    background-color: #fff5f5 !important;
}
.contaminacion-roja:focus {
    box-shadow: 0 0 0 3px rgba(209, 0, 0, 0.1) !important;
}
#contaminacion option[value="Sí"] {
    color: #d10000;
    font-weight: bold;
}
.gades-contaminated-cell {
    background-color: #dc3545 !important;
    color: white !important;
    font-weight: bold !important;
}
.badge-verde-claro {
    background-color: #b6fcb6; 
    color: #000; 
    padding: 4px 8px;
    border-radius: 4px;
}

.badge-amarillo {
    background-color: #fff59d; 
    color: #000;
    padding: 4px 8px;
    border-radius: 4px;
}
.badge-naranja {
    background-color: #ff9800; 
    color: white;              
    padding: 4px 8px;          
    border-radius: 4px;        
    font-weight: bold;          
    display: inline-block;      
    text-align: center;         
}
.badge-azul-celeste {
    background-color: #00bfff; 
    color: white;              
    padding: 4px 8px;          
    border-radius: 4px;        
    font-weight: bold;          
    display: inline-block;      
    text-align: center;         
}
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.image-modal-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.image-modal-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
}
.image-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}
.environment-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 8px;
}

.environment-pc {
    background: var(--info-color);
    color: white;
}

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

.environment-ios {
    background: var(--primary-color);
    color: white;
}
@media (max-width: 768px) {
    .image-thumbnail {
        border-width: 3px;
        padding: 12px;
    }
    
    .image-thumbnail-img {
        height: 120px;
    }
    
    .image-actions .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        min-width: 80px;
    }
}
.android-permission-warning {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin: 10px 0;
    text-align: center;
    border-left: 5px solid #c23616;
}

.android-permission-warning i {
    font-size: 1.5rem;
    margin-bottom: 10px;
    display: block;
}
.image-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@media (max-width: 480px) {
    .modal-content {
        width: 95% !important;
        margin: 10px;
        padding: 20px;
        max-height: 85vh;
        overflow-y: auto;
    }
    
    .gades-modal {
        width: 95% !important;
        padding: 15px;
        max-height: 80vh;
    }
    .image-modal-content {
        max-width: 95%;
        max-height: 80%;
    }
    .image-modal-content img {
        max-height: 70vh;
    }
}
@media (min-width: 481px) and (max-width: 768px) {
    .modal-content {
        width: 90% !important;
        margin: 15px auto;
        padding: 25px;
        max-height: 80vh;
    }
    
    .gades-modal {
        width: 90% !important;
        padding: 20px;
    }
    
    .image-modal-content {
        max-width: 90%;
    }
}
@media (max-width: 768px) {
    .modal-close {
        width: 44px;
        height: 44px;
        font-size: 1.8rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .btn {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    .action-buttons .btn {
        min-height: 36px;
        padding: 8px 12px;
    }
    .modal-content {
        -webkit-overflow-scrolling: touch;
    }
    .form-grid {
        gap: 12px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    input[type="text"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px; 
        padding: 14px 12px;
    }
}
@media (max-width: 768px) and (orientation: portrait) {
    .modal-overlay {
        padding: 10px 0;
    }
    
    .modal-content {
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }
    .btn {
        font-weight: 600;
        letter-spacing: 0.5px;
    }
    
    .btn-primary {
        background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    }
    
    .btn-danger {
        background: linear-gradient(135deg, var(--danger-color), #c23321);
    }
}
@media (max-width: 768px) and (orientation: landscape) {
    .modal-content {
        max-height: 90vh;
        padding: 15px;
    }
    
    .gades-modal {
        max-height: 85vh;
    }
    
    .image-modal-content img {
        max-height: 65vh;
    }
}
@media (max-width: 768px) {
    .modal-header {
        padding-bottom: 15px;
        margin-bottom: 20px;
    }
    
    .modal-title {
        font-size: 1.3rem;
        line-height: 1.4;
    }
    .modal-body {
        font-size: 0.95rem;
        line-height: 1.5;
    }
    
    .modal-content {
        background: var(--card-bg);
        color: var(--text-color);
    }
}
@media (max-width: 768px) {
    .modal-overlay {
        animation: mobileFadeIn 0.3s ease-out;
    }
    
    .modal-content {
        animation: mobileSlideUp 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    }
    
    @keyframes mobileFadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
    
    @keyframes mobileSlideUp {
        from { 
            opacity: 0;
            transform: translateY(30px) scale(0.95);
        }
        to { 
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }
}
@media (max-width: 768px) {
    .modal-overlay {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}
@media (min-width: 769px) and (max-width: 1024px) {
    .modal-content {
        width: 85% !important;
        max-width: 600px;
    }
    
    .gades-modal {
        width: 80% !important;
        max-width: 700px;
    }
}
@media (max-width: 768px) {
    .modal-overlay.keyboard-visible {
        align-items: flex-start;
        padding-top: 20px;
    }
    
    .modal-overlay.keyboard-visible .modal-content {
        max-height: calc(100vh - 100px);
        margin-top: 10px;
    }
    
    input[type="text"]:focus,
    input[type="number"]:focus,
    input[type="date"]:focus,
    select:focus,
    textarea:focus {
        transform: translateY(-5px);
        transition: transform 0.3s ease;
    }
    
    select {
        cursor: pointer;
    }
}
@media (max-width: 768px) {
    @supports (-webkit-touch-callout: none) {
        input[type="text"],
        input[type="number"],
        input[type="date"],
        select,
        textarea {
            font-size: 16px; 
        }
    }
}

.welcome-modal-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(30, 41, 59, 0.55); 
  backdrop-filter: blur(8px); 
  display: none; 
  justify-content: center;
  align-items: center;
  z-index: 9999; 
  opacity: 0;
  transition: opacity 0.25s ease-in-out;
}

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

.welcome-modal-open {
  overflow: hidden !important;
}

.welcome-modal-content {
  background: white;
  border-radius: 1.5rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  max-width: 450px;
  width: 90%;
  animation: welcomeFadeIn 0.3s ease-out;
  text-align: left;          
  padding: 24px 28px;        
  line-height: 1.6;          
  word-wrap: break-word;    
}

@keyframes welcomeFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.welcome-button-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between; 
    align-items: center;
    gap: 12px;
}

.welcome-button-group #welcomePrevBtn {
    margin-right: auto; 
}
@media (max-width: 600px) {
    .welcome-modal-content {
        width: 95%;
        padding: 20px;
    }

    .welcome-button-group {
        flex-direction: column; 
        gap: 10px;
    }

    .welcome-button-group .btn {
        width: 100%;
        margin: 0; 
    }

    .welcome-button-group #welcomeNextBtn {
        order: 1; 
    }
    .welcome-button-group #welcomePrevBtn {
        order: 2; 
    }
    .welcome-button-group #welcomeSkipBtn {
        order: 3; 
        margin-top: 8px; 
    }
    
    
    .welcome-modal-content .btn-group {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
}

.btn-purple-medium {
    color: #fff; 
    background-color: #6f42c1; 
    border-color: #6f42c1;
}

.btn-purple-medium:hover {
    color: #fff;
    background-color: #5d36a1; 
    border-color: #5d36a1;
}

.btn-purple-medium:focus {
    box-shadow: 0 0 0 0.25rem rgba(111, 66, 193, 0.5); 
}


.ininewmodal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ininewmodal.visible {
    opacity: 1;
    visibility: visible;
}

.ininewmodal .modal-content {
    background-color: var(--card-bg);
    padding: 32px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-hover);
    max-width: 90%;
    width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    pointer-events: auto;
}

.ininewmodal.visible .modal-content {
    transform: scale(1);
}
@media (max-width: 480px) {
    .ininewmodal .modal-content {
        width: 98% !important;
        max-width: 98% !important;
        margin: 0 auto;
        padding: 16px;
        max-height: 95vh;
        border-radius: 8px;
    }
    
    .ininewmodal .modal-header {
        padding-bottom: 10px;
        margin-bottom: 15px;
    }
    
    .ininewmodal .modal-title {
        font-size: 1.1rem;
        line-height: 1.3;
    }
    
    .ininewmodal .form-grid {
        gap: 10px;
    }
    
    .ininewmodal .form-group {
        margin-bottom: 12px;
    }
    
    .ininewmodal input[type="text"],
    .ininewmodal input[type="number"],
    .ininewmodal input[type="date"],
    .ininewmodal select,
    .ininewmodal textarea {
        font-size: 16px; 
        padding: 12px 10px;
    }
    
    .ininewmodal .btn {
        min-height: 44px;
        padding: 12px 16px;
        font-size: 0.9rem;
    }
    
    .ininewmodal #related-data-muestra {
        margin-top: 15px;
        padding: 12px;
    }
    
    .ininewmodal .table-container {
        margin-left: -16px;
        margin-right: -16px;
        border-radius: 0;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .ininewmodal .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        padding: 20px;
        max-height: 85vh;
    }
    
    .ininewmodal .modal-title {
        font-size: 1.2rem;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .ininewmodal .modal-content {
        max-height: 92vh;
        padding: 12px 16px;
    }
    
    .ininewmodal .modal-header {
        padding-bottom: 8px;
        margin-bottom: 12px;
    }
    
    .ininewmodal .form-grid {
        gap: 8px;
    }
}

@media (max-width: 768px) {
    .ininewmodal .modal-content {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    .ininewmodal .modal-close {
        width: 44px;
        height: 44px;
        font-size: 1.8rem;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }
    
    .ininewmodal label::after {
        content: '';
    }
    
    .ininewmodal label:has(+ input[required])::after,
    .ininewmodal label:has(+ select[required])::after {
        content: ' *';
        color: var(--danger-color);
        font-weight: bold;
    }
}

.ininewmodal {
    overflow-y: auto;
    padding: 10px;
}

@supports (-webkit-touch-callout: none) {
    .ininewmodal {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

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

.ininewmodal .modal-title {
    font-family: var(--font-secondary);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin: 0;
}

.ininewmodal .modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    z-index: 2001;
    padding: 0.25rem;
    border-radius: 50%;
    transition: var(--transition);
}

.ininewmodal .modal-close:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-darker);
}

.ininewmodal .modal-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: 24px;
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
@media (max-width: 768px) {
    .ininewmodal .modal-content {
        width: 95% !important;
        margin: 10px auto;
        max-height: 90vh;
    }
}

@media (max-width: 768px) {
    #emergencyProtocolBtn {
        padding: 4px 8px;
        font-size: 12px;
        transform: scale(0.9);
        transform-origin: center;
    }
    
    #emergencyProtocolBtn i {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    #emergencyProtocolBtn {
        transform: scale(0.8);
        padding: 3px 6px;
        font-size: 11px;
    }
}
        .toast {
            position: fixed;
            top: 50px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(0, 0, 0, 0.8);
            color: white;
            padding: 12px 24px;
            border-radius: 25px;
            z-index: 10000;
            font-size: 14px;
            display: none;
            animation: fadeInOut 3s ease-in-out;
        }
        
        @keyframes fadeInOut {
            0% { opacity: 0; }
            20% { opacity: 1; }
            80% { opacity: 1; }
            100% { opacity: 0; }
        }

        .container {
            padding: 20px;
            text-align: center;
        }

.btn-minimizar {
    position: fixed;
    bottom: 80px; 
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    font-size: 24px;
    z-index: 9999;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

.btn-minimizar:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.btn-minimizar:active {
    transform: scale(0.95);
}
@media (max-width: 768px) {
    .btn-minimizar {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }
}
@media (max-width: 480px) {
    .btn-minimizar {
        width: 50px;
        height: 50px;
        bottom: 80px; 
        right: 15px;
        font-size: 20px;
    }
}

.app-minimizada .btn-minimizar {
    background: linear-gradient(135deg, var(--success-color), var(--secondary-dark));
}

.app-minimizada .btn-minimizar::after {
    content: "↗";
    position: absolute;
    font-size: 14px;
    bottom: -5px;
    right: -5px;
}
.app-minimizada .main-content,
.app-minimizada .header,
.app-minimizada .nav,
.app-minimizada .footer {
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.app-minimizada .btn-minimizar {
    background: linear-gradient(135deg, #34a853, #296d36) !important;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
.app-minimizada::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(26, 115, 232, 0.1), rgba(52, 168, 83, 0.1));
    backdrop-filter: blur(3px);
    z-index: 999;
    pointer-events: none;
}
.exter-emergency-protocol {
  background: #f8fafc;
  border-radius: 1.5rem;
  padding: 2rem;
  font-family: "Inter", "Segoe UI", sans-serif;
  color: #1e293b;
  line-height: 1.6;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  border: 1px solid #e2e8f0;
}

.exter-title {
  text-align: center;
  color: #14532d;
  font-size: 1.9rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.exter-intro {
  text-align: justify;
  font-size: 1rem;
  margin-bottom: 2rem;
  color: #475569;
  line-height: 1.6;
}

.exter-emergency-section {
  border-left: 6px solid #10b981;
  background: #ffffff;
  padding: 1rem 1.2rem;
  margin-bottom: 1.4rem;
  border-radius: 0.8rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  transition: transform 0.2s, box-shadow 0.2s;
}

.exter-emergency-section:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}

.exter-emergency-section h3 {
  color: #065f46;
  margin-bottom: 0.4rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.exter-emergency-section p {
  margin: 0.3rem 0;
  color: #334155;
}

.exter-tips {
  background: linear-gradient(135deg, #e6f4ea, #d1fae5);
  border: 1px solid #bbf7d0;
  padding: 1.2rem 1.5rem;
  border-radius: 1rem;
  margin-top: 2rem;
}

.exter-tips h4 {
  color: #065f46;
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.exter-tips ul {
  margin: 0;
  padding-left: 1.2rem;
}
.exter-tips li {
  margin-bottom: 0.4rem;
  list-style: none;
  position: relative;
  padding-left: 1.2rem;
}

.exter-tips li::before {
  content: "🌿";
  position: absolute;
  left: 0;
}

.exter-emergency-fungal { border-left-color: #f87171; }
.exter-emergency-sterilization { border-left-color: #fb923c; }
.exter-emergency-power { border-left-color: #facc15; }
.exter-emergency-pests { border-left-color: #84cc16; }
.exter-emergency-water { border-left-color: #38bdf8; }
.exter-emergency-ventilation { border-left-color: #0ea5e9; }
.exter-emergency-virus { border-left-color: #a855f7; }
.exter-emergency-chemical { border-left-color: #f97316; }
.exter-emergency-fire { border-left-color: #ef4444; }
.exter-emergency-waterquality { border-left-color: #22d3ee; }

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

.exter-emergency-section {
  animation: exter-fadeIn 0.6s ease both;
}

.modern-alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.modern-alert-overlay.active {
    display: flex;
}

.modern-alert-box {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 420px;
    width: 90%;
    overflow: hidden;
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modern-alert-header {
    padding: 24px 24px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.modern-alert-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.modern-alert-icon.success {
    background: linear-gradient(135deg, #34a853 0%, #6aa84f 100%);
    color: white;
}

.modern-alert-icon.error {
    background: linear-gradient(135deg, #ea4335 0%, #ff6b6b 100%);
    color: white;
}

.modern-alert-icon.warning {
    background: linear-gradient(135deg, #fbbc05 0%, #ffd54f 100%);
    color: white;
}

.modern-alert-icon.info {
    background: linear-gradient(135deg, #4285f4 0%, #64b5f6 100%);
    color: white;
}

.modern-alert-title {
    flex: 1;
    font-family: var(--font-secondary);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-darker);
    margin: 0;
}

.modern-alert-body {
    padding: 20px 24px;
}

.modern-alert-message {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-color);
    margin: 0;
}

.modern-alert-footer {
    padding: 16px 24px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: var(--bg-color);
}

.modern-alert-btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-family: var(--font-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

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

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

.modern-alert-btn.danger {
    background: var(--danger-color);
    color: white;
}

@media (max-width: 600px) {
    .modern-alert-box {
        width: 95%;
    }
    .modern-alert-footer {
        flex-direction: column;
    }
    .modern-alert-btn {
        width: 100%;
    }
}
.modal#editSampleModal .modal-content {
    width: 95% !important;
    max-width: 900px !important;
}

/* =====================================================================
   VITROLAB - Añadidos sobre el CSS original de OrchiTrack
   (menú de usuario, admin de catálogos, subida de imagen, paginación API)
   ===================================================================== */
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
}
.user-menu .user-role-badge {
    background: rgba(255,255,255,0.15);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.user-menu button {
    background: none;
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.75rem;
}
.api-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}
.api-pagination button {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    cursor: pointer;
}
.api-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.catalog-admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}
.catalog-type-card h4 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.catalog-item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border-color);
}
.catalog-item-row input[type="text"] {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--input-border-color);
    border-radius: 6px;
}
.catalog-item-row.inactive {
    opacity: 0.5;
}
.catalog-item-row .icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px 6px;
}
.catalog-item-row .icon-btn.danger { color: var(--danger-color); }
.file-drop-zone {
    border: 2px dashed var(--input-border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    color: var(--text-light);
    cursor: pointer;
}
.file-drop-zone:hover { border-color: var(--primary-color); }
.user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    gap: 10px;
    flex-wrap: wrap;
}
.user-row .user-meta { font-size: 0.85rem; color: var(--text-light); }
.status-pill {
    padding: 2px 9px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}
.status-pill.active { background: #e6f4ea; color: var(--secondary-dark); }
.status-pill.pending { background: #fff4dd; color: #a06400; }
.status-pill.disabled { background: #fdecea; color: var(--danger-color); }
.install-pwa-banner {
    display: none;
    background: var(--secondary-color);
    color: #fff;
    padding: 10px 15px;
    text-align: center;
    font-size: 0.85rem;
    cursor: pointer;
}
.install-pwa-banner.visible { display: block; }

/* Toggle de mostrar/ocultar contraseña (ver assets/js/password-toggle.js) */
.password-field {
    position: relative;
}
.password-field input {
    padding-right: 42px;
    width: 100%;
    box-sizing: border-box;
}
.password-field .password-toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 8px 10px;
    font-size: 0.95rem;
    line-height: 1;
}
.password-field .password-toggle:hover {
    color: var(--primary-color);
}

/* Etiqueta de cultivo (QR) - ver assets/js/labels.js y views/modals/label-modal.php */
.label-preview {
    background: #fff;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    text-align: left;
}
.label-code {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 6px;
    color: var(--text-color);
}
.label-species {
    font-weight: 700;
    font-size: 1.15rem;
    margin-bottom: 8px;
    color: var(--text-color);
}
.label-line {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: var(--text-color);
}
#label-qr-canvas {
    display: block;
    margin: 14px auto;
}
.label-footer {
    text-align: center;
    font-weight: 700;
    margin-top: 10px;
    color: var(--text-color);
}

/* Lector de QR (ver assets/js/scanner.js) */
#qr-reader {
    border-radius: var(--radius-md);
    overflow: hidden;
}

/* Al pulsar "Imprimir etiqueta" solo se imprime la vista previa de la etiqueta */
@media print {
    body * {
        visibility: hidden;
    }
    #label-preview, #label-preview * {
        visibility: visible;
    }
    #label-preview {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
    }
}

/* =====================================================================
   Dashboard: tarjetas KPI con icono/color (como el index.html original)
   ===================================================================== */
.dashboard-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 24px;
}
.kpi-widget {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 14px 18px;
    box-shadow: var(--shadow);
    flex: 1 1 140px;
    max-width: 190px;
    text-align: center;
    border-left: 5px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.kpi-widget:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}
.kpi-widget-icon {
    font-size: 1.6rem;
    margin-bottom: 6px;
    display: block;
}
.kpi-widget-title {
    font-family: var(--font-secondary);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin-bottom: 4px;
}
.kpi-widget-value {
    font-family: var(--font-secondary);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-color);
    line-height: 1;
}
@media (max-width: 600px) {
    .kpi-widget {
        flex: 1 1 42%;
        max-width: none;
    }
}

/* Gráfico de estado de resultados: tamaño contenido, no crece sin control */
.chart-container {
    position: relative;
    height: 240px;
    margin-top: 10px;
}

/* =====================================================================
   Cabecera: botón hamburguesa (colapsar menú lateral) y botón Emergencia
   ===================================================================== */
.icon-only-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    padding: 6px 10px;
    margin-right: 10px;
    cursor: pointer;
    display: none;
    border-radius: 6px;
}
.icon-only-btn:hover {
    background: rgba(255,255,255,0.12);
}
@media (min-width: 768px) {
    .icon-only-btn {
        display: inline-flex;
        align-items: center;
    }
}
.header-actions {
    display: flex;
    align-items: center;
}
.header-btn-label {
    margin-left: 6px;
}
@media (max-width: 480px) {
    .header-btn-label {
        display: none;
    }
}

/* =====================================================================
   Menú lateral colapsable (solo escritorio) - ver assets/js/main.js
   ===================================================================== */
.nav, .main-content, .footer {
    transition: margin-left 0.25s ease-in-out, width 0.25s ease-in-out;
}
@media (min-width: 768px) {
    .sidebar-collapsed .nav {
        width: 76px;
    }
    .sidebar-collapsed .nav a span {
        display: none;
    }
    .sidebar-collapsed .nav a {
        justify-content: center;
        padding: 16px 0;
        margin-right: 0;
        border-radius: 0;
    }
    .sidebar-collapsed .nav a i {
        margin-right: 0;
    }
    .sidebar-collapsed .main-content,
    .sidebar-collapsed .footer {
        margin-left: 76px;
        max-width: calc(100% - 76px);
    }
}

/* =====================================================================
   QR de la ficha en la cabecera del informe PDF (arriba a la derecha).
   No estaba en el .pdf-header original de OrchiTrack (ese solo llevaba
   título/subtítulo centrados); se añade aquí, sin tocar las reglas
   .pdf-header de más arriba, para no perder la referencia byte a byte
   con el ejemplo. - ver assets/js/reports.js
   ===================================================================== */
.pdf-header {
    position: relative;
}
.pdf-header-qr {
    position: absolute;
    top: 0;
    right: 0;
    width: 70px;
    height: 70px;
}
.pdf-header-qr img {
    width: 100%;
    height: 100%;
    display: block;
}

/* =====================================================================
   Filas clicables en las listas de "relacionados" dentro de un modal
   (Cultivos de una Muestra; Resultados de un Cultivo): llevan a la
   ficha correspondiente - ver assets/js/samples.js y cultures.js.
   ===================================================================== */
#related-cultures-list tbody tr,
#related-results-list tbody tr {
    cursor: pointer;
}
#related-cultures-list tbody tr:hover,
#related-results-list tbody tr:hover {
    background-color: #e8f0fe;
}

/* =====================================================================
   Barra de navegación entre fichas relacionadas (Muestra -> Cultivo ->
   Resultado): permite recorrer "Anterior/Siguiente" varias fichas
   hermanas seguidas, y "Volver a ..." para regresar a la ficha de
   origen, sin el vaivén de cerrar y volver a abrir cada modal.
   Ver assets/js/cultures.js y results.js.
   ===================================================================== */
.modal-nav-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: -8px 0 20px 0;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--border-color);
}
.modal-nav-bar .btn {
    width: auto;
    margin-top: 0;
    padding: 8px 14px;
    font-size: 0.75rem;
}
.modal-nav-bar .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}
.modal-nav-spacer {
    flex: 1 1 auto;
}
.modal-nav-position {
    font-size: 0.8rem;
    color: var(--text-light);
    white-space: nowrap;
}
