* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(16, 185, 129, 0.1), 0 1px 2px 0 rgba(5, 150, 105, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(16, 185, 129, 0.15), 0 4px 6px -2px rgba(5, 150, 105, 0.1);
    --shadow-colored: 0 4px 6px -1px rgba(16, 185, 129, 0.2), 0 2px 4px -1px rgba(5, 150, 105, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 50%, #e0f2fe 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 100%;
    min-height: 100vh;
    margin: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: none;
    overflow: hidden;
}

/* Disclaimer Header */
.disclaimer-header {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    padding: 0.75rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    border-bottom: 3px solid #d97706;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.warning-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.disclaimer-header span {
    color: #78350f;
    font-size: 0.9rem;
}

.disclaimer-header strong {
    font-weight: 700;
}

/* Header Controls */
.header-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 0.5rem 0;
}

.turno-selector,
.enfermeros-input {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: white;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow);
}

.turno-selector label,
.enfermeros-input label {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-dark);
    white-space: nowrap;
}

.turno-selector select,
.enfermeros-input input {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    background: white;
    color: #333;
    outline: none;
    transition: all 0.3s ease;
}

.turno-selector select {
    cursor: pointer;
}

.enfermeros-input input {
    width: 80px;
    text-align: center;
    font-weight: 600;
}

.turno-selector select:hover,
.enfermeros-input input:hover {
    border-color: var(--primary-color);
    background: #f9fafb;
}

.turno-selector select:focus,
.enfermeros-input input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Header */
header {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1e40af 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.1), transparent 50%);
    pointer-events: none;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

.subtitle {
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    opacity: 0.95;
    position: relative;
    z-index: 1;
}

/* Main Content */
.main-content {
    padding: 2rem;
}

/* Global Summary */
.global-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-radius: 12px;
    border-left: 4px solid #10b981;
    box-shadow: var(--shadow-colored);
}

.summary-card {
    background: var(--bg-white);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow);
    border: 2px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.4s ease-out backwards;
}

.summary-card:nth-child(1) { animation-delay: 0.1s; }
.summary-card:nth-child(2) { animation-delay: 0.2s; }
.summary-card:nth-child(3) { animation-delay: 0.3s; }
.summary-card:nth-child(4) { animation-delay: 0.4s; }

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

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

.summary-icon {
    font-size: 1.75rem;
}

.summary-card.highlight .summary-icon {
    filter: brightness(2);
}

.summary-content {
    flex: 1;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.summary-label {
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    opacity: 0.85;
}

.summary-info {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.7;
    font-style: italic;
}

/* Notas del Turno */
.notas-turno-section {
    background: linear-gradient(135deg, #f0fdf4 0%, #d1fae5 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-left: 4px solid #059669;
    box-shadow: var(--shadow-colored);
    animation: fadeInUp 0.5s ease-out backwards;
    animation-delay: 0.6s;
}

.notas-turno-section label {
    display: block;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.notas-turno-section textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    transition: all 0.3s ease;
}

.notas-turno-section textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
}

/* Beds Section */
.beds-section {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    border-left: 4px solid #10b981;
    box-shadow: var(--shadow-colored);
    animation: fadeInUp 0.5s ease-out backwards;
    animation-delay: 0.7s;
}

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

.section-header h2 {
    color: var(--text-dark);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.section-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-primary-small {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary-small:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

.btn-secondary-small {
    padding: 0.5rem 1rem;
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary-small:hover {
    background: #e5e7eb;
    border-color: var(--text-light);
}

/* Beds Grid */
.beds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.bed-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid var(--border-color);
    position: relative;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.5s ease-out backwards;
}

.bed-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--success-color);
}

/* Animación de stagger para las camas */
.bed-card:nth-child(1) { animation-delay: 0.05s; }
.bed-card:nth-child(2) { animation-delay: 0.1s; }
.bed-card:nth-child(3) { animation-delay: 0.15s; }
.bed-card:nth-child(4) { animation-delay: 0.2s; }
.bed-card:nth-child(5) { animation-delay: 0.25s; }
.bed-card:nth-child(6) { animation-delay: 0.3s; }
.bed-card:nth-child(7) { animation-delay: 0.35s; }
.bed-card:nth-child(8) { animation-delay: 0.4s; }
.bed-card:nth-child(9) { animation-delay: 0.45s; }
.bed-card:nth-child(10) { animation-delay: 0.5s; }
.bed-card:nth-child(11) { animation-delay: 0.55s; }
.bed-card:nth-child(12) { animation-delay: 0.6s; }
.bed-card:nth-child(13) { animation-delay: 0.65s; }
.bed-card:nth-child(14) { animation-delay: 0.7s; }
.bed-card:nth-child(15) { animation-delay: 0.75s; }
.bed-card:nth-child(16) { animation-delay: 0.8s; }
.bed-card:nth-child(17) { animation-delay: 0.85s; }
.bed-card:nth-child(18) { animation-delay: 0.9s; }
.bed-card:nth-child(19) { animation-delay: 0.95s; }
.bed-card:nth-child(20) { animation-delay: 1s; }
.bed-card:nth-child(21) { animation-delay: 1.05s; }
.bed-card:nth-child(22) { animation-delay: 1.1s; }

.bed-card.empty {
    border-color: #d1d5db;
    background: #f9fafb;
}

.bed-card.empty:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.bed-card.clase1 {
    border-color: #10b981;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.bed-card.clase2 {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

.bed-card.clase3 {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.bed-card.clase4 {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
}

.bed-number {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.bed-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.bed-status {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 600;
}

.bed-tiss {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

.bed-patient-name {
    font-size: 0.75rem;
    color: var(--text-dark);
    margin-top: 0.25rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bed-dias {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 0.25rem;
    font-weight: 600;
}

/* Tooltip para camas ocupadas */
.bed-tooltip {
    position: absolute;
    bottom: 105%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    min-width: 200px;
    text-align: left;
}

.bed-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #334155;
}

.bed-card:hover .bed-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.tooltip-header {
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
}

.tooltip-diagnostico {
    font-size: 0.75rem;
    color: #cbd5e1;
    margin-bottom: 0.4rem;
    font-style: italic;
    line-height: 1.3;
    white-space: normal;
    max-width: 250px;
}

.tooltip-dias {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.4rem;
}

.tooltip-clase {
    font-size: 0.8rem;
    font-weight: 700;
    color: #60a5fa;
    margin-bottom: 0.3rem;
}

.tooltip-ratio {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.tooltip-hint {
    font-size: 0.7rem;
    color: #64748b;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-style: italic;
}

/* Legend */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-dark);
    font-weight: 600;
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid;
}

.legend-color.empty {
    background: #f9fafb;
    border-color: #d1d5db;
}

.legend-color.clase1 {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #10b981;
}

.legend-color.clase2 {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #3b82f6;
}

.legend-color.clase3 {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #f59e0b;
}

.legend-color.clase4 {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #ef4444;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-white);
    border-radius: 16px;
    max-width: 1500px;
    width: 100%;
    max-height: 92vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.75rem;
}

/* Datos del Paciente en Header */
.patient-info-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 1rem;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.patient-info-row {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.info-field-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.info-field-compact.full-width {
    flex: 1 1 100%;
}

.info-field-compact span {
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
    white-space: nowrap;
    min-width: 85px;
}

.info-field-compact input,
.info-field-compact textarea {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    font-size: 0.875rem;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-dark);
    font-family: inherit;
    transition: all 0.3s ease;
}

.info-field-compact input:focus,
.info-field-compact textarea:focus {
    outline: none;
    border-color: white;
    background: white;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 2rem;
    overflow: hidden;
    flex: 1;
    display: grid;
    grid-template-columns: minmax(280px, 300px) 1fr;
    gap: 2rem;
    align-items: start;
    min-height: 0;
    max-height: calc(100vh - 350px);
}

/* Columna 1: Panel de Resultados TISS (estrecha, scrolleable) */
.results-panel-modal {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    max-height: calc(100vh - 350px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-radius: 12px;
    border: 2px solid var(--success-color);
}

/* Scrollbar personalizado para results-panel */
.results-panel-modal::-webkit-scrollbar {
    width: 8px;
}

.results-panel-modal::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.results-panel-modal::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.5);
    border-radius: 10px;
}

.results-panel-modal::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 185, 129, 0.7);
}

.results-panel-modal h3 {
    color: var(--text-dark);
    margin: 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
    font-size: 1rem;
    text-align: center;
    flex-shrink: 0;
}

/* Columna 2: Panel de Intervenciones (amplia, scrolleable) */
.interventions-panel-modal {
    height: 100%;
    max-height: calc(100vh - 350px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.75rem;
}

/* Scrollbar personalizado para interventions-panel */
.interventions-panel-modal::-webkit-scrollbar {
    width: 10px;
}

.interventions-panel-modal::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.interventions-panel-modal::-webkit-scrollbar-thumb {
    background: rgba(37, 99, 235, 0.4);
    border-radius: 10px;
}

.interventions-panel-modal::-webkit-scrollbar-thumb:hover {
    background: rgba(37, 99, 235, 0.6);
}

.interventions-panel-modal h3 {
    color: var(--text-dark);
    margin: 0 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Tabs Navigation */
.tabs-container {
    background: var(--bg-light);
    border-radius: 12px;
    overflow: visible;
}

.tabs-navigation {
    display: flex;
    flex-wrap: wrap;
    background: var(--bg-white);
    border-bottom: 2px solid var(--border-color);
    gap: 0.5rem;
    padding: 0.75rem;
    position: sticky;
    top: -1px;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 1rem;
    border-radius: 12px 12px 0 0;
}

.tab-btn {
    flex: 0 1 calc(25% - 0.5rem);
    min-width: 140px;
    padding: 0.75rem 1rem;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-align: center;
}

.tab-btn:hover {
    background: #e5e7eb;
    border-color: var(--primary-color);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-color: var(--primary-color);
}

/* Tabs Content */
.tabs-content {
    padding: 1.5rem;
    min-height: 400px;
    background: var(--bg-white);
}

.tab-panel {
    display: none;
    animation: fadeInTab 0.3s ease;
}

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

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

.tab-panel-title {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--primary-color);
    font-weight: 700;
}

/* Items Vertical Layout */
.items-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.items-vertical .item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid var(--border-color);
}

.items-vertical .item:hover {
    background: #eff6ff;
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.items-vertical .item input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}

.items-vertical .item-text {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-dark);
    line-height: 1.5;
}

.items-vertical .points {
    font-weight: 700;
    color: var(--primary-color);
    background: #dbeafe;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.action-buttons-modal {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
    flex-shrink: 0;
}

.action-buttons-modal button {
    width: 100%;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    white-space: nowrap;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* Score Display dentro de results-panel */

.score-display-modal {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 10px;
    padding: 0.75rem;
    text-align: center;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.classification-modal {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 1rem;
    flex-shrink: 0;
    font-size: 0.875rem;
}

/* Responsive: tabletas y pantallas medianas */
@media (max-width: 1400px) {
    .modal-content {
        max-width: 95%;
    }
    
    .modal-body {
        grid-template-columns: minmax(260px, 280px) 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 1200px) {
    .modal-body {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        max-height: calc(100vh - 300px);
    }
    
    .results-panel-modal,
    .interventions-panel-modal {
        position: relative;
        max-height: 400px;
        height: auto;
    }
    
    .results-panel-modal {
        max-height: 300px;
    }
}

/* Category */
.category {
    margin-bottom: 2rem;
    background: var(--bg-light);
    border-radius: 12px;
    padding: 1.5rem;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.category:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.category-title {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
    font-weight: 600;
}

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

/* Item */
.item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem;
    background: var(--bg-white);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.item:hover {
    background: #eff6ff;
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
}

.item-text {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.points {
    font-weight: 700;
    color: var(--primary-color);
    background: #dbeafe;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    position: sticky;
    bottom: 0;
    background: var(--bg-white);
    padding: 1rem 0;
}

.btn-primary, .btn-secondary {
    flex: 1;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    box-shadow: var(--shadow-colored);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    animation: pulse 0.6s ease-in-out;
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e5e7eb;
    border-color: var(--text-light);
    transform: translateY(-2px);
}

/* Results Panel */
.results-panel {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 2rem;
    position: sticky;
    top: 2rem;
    height: fit-content;
    border: 2px solid var(--border-color);
}

.results-panel h2 {
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    text-align: center;
}

/* Score Display */
.score-display {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.score-number {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    line-height: 1;
}

.score-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Classification */
.classification {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary-color);
}

.classification h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.classification p {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.6;
}

.class-1 { border-left-color: #10b981; }
.class-1 h3 { color: #10b981; }

.class-2 { border-left-color: #3b82f6; }
.class-2 h3 { color: #3b82f6; }

.class-3 { border-left-color: #f59e0b; }
.class-3 h3 { color: #f59e0b; }

.class-4 { border-left-color: #ef4444; }
.class-4 h3 { color: #ef4444; }

/* Ratio Info */
.ratio-info {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.ratio-info h4 {
    color: var(--text-dark);
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.ratio-display {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.ratio-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.ratio-label {
    color: var(--text-light);
    font-size: 0.95rem;
}

.ratio-note {
    font-size: 0.875rem;
    color: var(--text-light);
    font-style: italic;
    text-align: center;
}

/* Disclaimer Results */
.disclaimer-results {
    background: #fef3c7;
    border: 2px solid #fbbf24;
    border-radius: 8px;
    padding: 1rem;
}

.disclaimer-results p {
    font-size: 0.875rem;
    color: #78350f;
    margin: 0;
}

/* Footer */
footer {
    background: var(--text-dark);
    color: white;
    padding: 1.5rem;
    text-align: center;
}

footer p {
    margin-bottom: 0.25rem;
}

.footer-note {
    font-size: 0.875rem;
    opacity: 0.7;
}

/* Scrollbar */
.selection-panel::-webkit-scrollbar {
    width: 8px;
}

.selection-panel::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 4px;
}

.selection-panel::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.selection-panel::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.classification, .ratio-info {
    animation: fadeIn 0.5s ease;
}

/* Estilos de Impresión */
@media print {
    body {
        background: white;
        padding: 0;
        margin: 0;
    }
    
    .disclaimer-header,
    .header-controls,
    .section-actions,
    .btn-primary-small,
    .btn-secondary-small,
    .modal,
    header .subtitle {
        display: none !important;
    }
    
    .section-header {
        margin-bottom: 0.5rem;
    }
    
    .section-header h2 {
        font-size: 1rem;
        margin: 0;
    }
    
    header {
        background: white !important;
        color: black !important;
        padding: 0.5rem 1rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    header h1 {
        color: black;
        font-size: 1.2rem;
        margin: 0;
    }
    
    .container {
        box-shadow: none;
        max-width: 100%;
        padding: 0.5rem;
    }
    
    .global-summary {
        page-break-inside: avoid;
        margin-bottom: 0.75rem;
        gap: 0.5rem;
    }
    
    .summary-card {
        border: 1px solid #ddd;
        padding: 0.5rem !important;
    }
    
    .summary-icon {
        font-size: 1.25rem !important;
    }
    
    .summary-value {
        font-size: 1.25rem !important;
    }
    
    .summary-label {
        font-size: 0.7rem !important;
    }
    
    .summary-info {
        font-size: 0.65rem !important;
    }
    
    .notas-turno-section {
        page-break-inside: avoid;
        border: 1px solid #ddd;
        margin-bottom: 0.75rem;
        padding: 0.5rem;
    }
    
    .notas-turno-section label {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
    }
    
    .notas-turno-section textarea {
        border: none;
        padding: 0.25rem;
        min-height: auto;
        font-size: 0.75rem;
        height: auto;
        max-height: 3rem;
        overflow: hidden;
    }
    
    .beds-section {
        margin-bottom: 0.5rem;
    }
    
    .beds-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 0.35rem;
        margin-bottom: 0.5rem;
    }
    
    /* Salto de página después de la cama 10 */
    .bed-card:nth-child(10) {
        page-break-after: always;
    }
    
    .bed-card {
        font-size: 0.65rem;
        padding: 0.35rem;
        page-break-inside: avoid;
    }
    
    .bed-number {
        font-size: 0.75rem;
    }
    
    .bed-icon {
        font-size: 1rem;
    }
    
    .bed-tiss {
        font-size: 0.7rem;
    }
    
    .bed-dias {
        font-size: 0.6rem;
    }
    
    .legend {
        page-break-before: avoid;
        margin-top: 0.5rem;
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .legend-item {
        font-size: 0.7rem;
    }
    
    .legend-color {
        width: 12px;
        height: 12px;
    }
    
    footer {
        padding: 0.5rem;
        margin-top: 0.5rem;
    }
    
    footer p {
        font-size: 0.7rem;
        margin: 0.1rem 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    header {
        padding: 1.5rem 1rem;
    }
    
    header h1 {
        font-size: 1.75rem;
    }

    .beds-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.75rem;
    }

    .bed-card {
        padding: 1rem 0.5rem;
    }

    .bed-number {
        font-size: 1.25rem;
    }

    .bed-icon {
        font-size: 1.5rem;
    }

    .global-summary {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .distribution-grid {
        grid-template-columns: 1fr;
    }
    
    /* Modal en móvil */
    .modal.active {
        padding: 0;
        align-items: flex-start;
    }
    
    .modal-content {
        max-width: 100%;
        max-height: 100vh;
        height: 100vh;
        margin: 0;
        border-radius: 0;
        overflow: visible;
        position: relative;
    }
    
    .modal-header {
        padding: 1rem;
        position: sticky;
        top: 0;
        z-index: 1000;
    }
    
    .modal-header h2 {
        font-size: 1.25rem;
    }
    
    .patient-info-header {
        padding: 0.75rem;
    }
    
    .patient-info-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .info-field-compact {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
    
    .info-field-compact span {
        font-size: 0.75rem;
        min-width: auto;
    }
    
    .info-field-compact input {
        width: 100%;
        font-size: 0.85rem;
        padding: 0.5rem;
    }
    
    .modal-close {
        width: 44px;
        height: 44px;
        font-size: 1.75rem;
        cursor: pointer;
        touch-action: manipulation;
    }

    .modal-body {
        padding: 0;
        grid-template-columns: 1fr;
        overflow-y: auto;
        overflow-x: visible;
        max-height: calc(100vh - 200px);
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    .results-panel-modal {
        order: 1;
        position: sticky;
        top: 0;
        z-index: 100;
        max-height: none;
        height: auto;
        padding: 0.75rem;
        box-shadow: 0 2px 6px rgba(0,0,0,0.1);
        background: #f8fafc;
        border-bottom: 2px solid var(--primary-color);
    }
    
    .results-panel-modal h3 {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    .score-display-modal {
        padding: 0;
        margin-bottom: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
    }
    
    .score-number {
        font-size: 1.25rem;
        margin-bottom: 0;
        font-weight: 700;
        line-height: 1;
        color: var(--primary-color);
    }
    
    .score-label {
        font-size: 0.7rem;
        text-align: left;
        line-height: 1.2;
        flex: 1;
    }
    
    .classification-modal {
        padding: 0.4rem 0.5rem;
        font-size: 0.7rem;
        margin-top: 0.4rem;
        border-radius: 4px;
    }
    
    .classification-modal h3 {
        font-size: 0.8rem;
        margin-bottom: 0.15rem;
        font-weight: 700;
    }
    
    .classification-modal p {
        margin: 0.05rem 0;
        font-size: 0.65rem;
        line-height: 1.3;
    }
    
    .classification-modal p strong {
        font-weight: 700;
        color: inherit;
    }
    
    .interventions-panel-modal {
        order: 2;
        max-height: none;
        height: auto;
        position: relative;
        overflow: visible;
        padding: 0 0 200px 0;
        margin-bottom: 0;
    }
    
    .interventions-panel-modal h3 {
        padding: 0.75rem;
        margin: 0;
        font-size: 0.9rem;
        background: var(--bg-light);
    }
    
    /* Inputs y textareas */
    input[type="text"],
    input[type="date"],
    input[type="number"],
    textarea {
        font-size: 16px !important;
        min-height: 44px;
        touch-action: manipulation;
    }
    
    textarea {
        min-height: 80px;
    }
    
    .tab-btn,
    .action-buttons-modal button,
    .modal-close,
    input,
    textarea,
    label {
        position: relative;
        z-index: 10;
        pointer-events: auto;
    }
    
    .item {
        position: relative;
        z-index: 10;
        pointer-events: auto;
        cursor: pointer;
    }

    .action-buttons-modal {
        flex-direction: column;
        gap: 0.5rem;
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 0.75rem;
        margin: 0;
        z-index: 200;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.2);
        border-top: 3px solid var(--primary-color);
    }
    
    .action-buttons-modal button {
        min-height: 50px;
        font-size: 1rem;
        font-weight: 700;
        touch-action: manipulation;
        cursor: pointer;
        border-radius: 10px;
        border: none;
        transition: all 0.2s;
    }
    
    .action-buttons-modal button:active {
        transform: scale(0.97);
    }
    
    .btn-primary {
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
        color: white;
    }
    
    .btn-danger {
        background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
        color: white;
    }
    
    .btn-secondary {
        background: #6b7280;
        color: white;
    }

    .legend {
        gap: 1rem;
    }
    
    /* Tabs con scroll horizontal en móvil */
    .tabs-navigation {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 0.75rem;
        padding: 1rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: auto;
        background: var(--bg-white);
        border-bottom: 2px solid var(--border-color);
    }
    
    .tabs-navigation::-webkit-scrollbar {
        height: 8px;
    }
    
    .tabs-navigation::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 4px;
    }
    
    .tab-btn {
        flex-shrink: 0;
        min-width: 150px;
        white-space: nowrap;
        font-size: 0.9rem;
        padding: 1rem 1.5rem;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
    }
    
    .tabs-content {
        padding: 1rem;
        min-height: auto;
        max-height: none;
        overflow-y: visible;
        background: white;
    }
    
    .tab-panel {
        display: none;
    }
    
    .tab-panel.active {
        display: block;
    }
    
    .tab-panel-title {
        font-size: 1.25rem;
    }
    
    .items-vertical .item {
        padding: 1.25rem;
        flex-direction: row;
        align-items: flex-start;
        min-height: 64px;
        gap: 1rem;
        cursor: pointer;
        touch-action: manipulation;
        background: var(--bg-light);
        margin-bottom: 0.5rem;
        border-radius: 8px;
    }
    
    .items-vertical .item input[type="checkbox"] {
        min-width: 32px;
        min-height: 32px;
        flex-shrink: 0;
        cursor: pointer;
        touch-action: manipulation;
    }
    
    .items-vertical .item-text {
        font-size: 0.9rem;
        line-height: 1.5;
        cursor: pointer;
    }
    
    .items-vertical .points {
        font-size: 0.85rem;
        padding: 0.4rem 0.7rem;
    }
    
    .info-row {
        grid-template-columns: 1fr;
    }
}

/* Animaciones para feedback */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Indicador de guardado */
.save-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.save-indicator.saved {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    opacity: 0.9;
}

.save-indicator.saving {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    animation: pulseIndicator 1.5s ease-in-out infinite;
}

.save-indicator.pending {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
    opacity: 0.85;
}

@keyframes pulseIndicator {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.7;
        transform: scale(0.98);
    }
}

/* Sistema de notificaciones Toast */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    background: white;
    color: var(--text-dark);
    padding: 1rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 420px;
    pointer-events: auto;
    animation: toastSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-left: 4px solid #10b981;
}

.toast.success {
    border-left-color: #10b981;
}

.toast.success .toast-icon {
    color: #10b981;
}

.toast.warning {
    border-left-color: #f59e0b;
}

.toast.warning .toast-icon {
    color: #f59e0b;
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.error .toast-icon {
    color: #ef4444;
}

.toast.info {
    border-left-color: #3b82f6;
}

.toast.info .toast-icon {
    color: #3b82f6;
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
}

.toast.removing {
    animation: toastSlideOut 0.3s ease-out forwards;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateX(400px) scale(0.95);
        opacity: 0;
    }
}

/* Ocultar indicador en impresión */
@media print {
    .save-indicator,
    .toast-container {
        display: none !important;
    }
}
