/* ============================================================
   VARIABLES Y RESET
   ============================================================ */
:root {
    --sas-green:      #006633;
    --sas-green-dark: #004d26;
    --sas-green-mid:  #2e7d52;
    --sas-green-light:#e8f5ee;
    --sas-green-pale: #f0faf4;
    --white:          #ffffff;
    --gray-bg:        #f4f5f6;
    --gray-light:     #e8e9eb;
    --gray-mid:       #b0b4ba;
    --gray-dark:      #6b7280;
    --text-main:      #1a2a3a;
    --text-sub:       #4a5568;
    --blue-badge:     #1565c0;
    --blue-light:     #e3f0fb;
    --orange:         #e65100;
    --orange-light:   #fff3e0;
    --red:            #b71c1c;
    --red-hover:      #c62828;
    --shadow-sm:      0 1px 4px rgba(0,0,0,.10);
    --shadow-md:      0 4px 16px rgba(0,0,0,.13);
    --radius:         8px;
    --radius-sm:      5px;
    --font:           Arial, Helvetica, sans-serif;
}

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

html { font-size: 15px; }

body {
    font-family: var(--font);
    background: var(--gray-bg);
    color: var(--text-main);
    min-height: 100vh;
}

.hidden { display: none !important; }

/* ============================================================
   PANTALLA DE LOGIN
   ============================================================ */
#login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, var(--sas-green-dark) 0%, var(--sas-green) 60%, var(--sas-green-mid) 100%);
    padding: 1rem;
}

.login-box {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 2.5rem 2.25rem 2rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    min-height: 50px;
}

.logo-ja  { max-height: 46px; max-width: 140px; object-fit: contain; }
.logo-sas { max-height: 46px; max-width: 160px; object-fit: contain; }
.logo-sep { width: 1px; height: 40px; background: var(--gray-light); }

.login-brand-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin-bottom: 1rem;
}
.brand-sas-text {
    background: var(--sas-green);
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
    padding: .2rem .6rem;
    border-radius: 4px;
    letter-spacing: .05em;
}
.brand-sas-full { font-size: .75rem; color: var(--gray-dark); }

.login-box h1 {
    font-size: 1.35rem;
    color: var(--sas-green-dark);
    font-weight: 700;
    margin-bottom: .3rem;
}

.login-subtitle {
    font-size: .9rem;
    color: var(--gray-dark);
    margin-bottom: 1.75rem;
}

.login-footer {
    margin-top: 1.75rem;
    font-size: .72rem;
    color: var(--gray-mid);
    border-top: 1px solid var(--gray-light);
    padding-top: .9rem;
}

/* ============================================================
   CABECERA
   ============================================================ */
.app-header {
    background: var(--sas-green);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .65rem 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1rem;
}

.h-left {
    display: flex;
    align-items: center;
    gap: .9rem;
    min-width: 0;
}

.h-logo {
    height: 38px;
    max-width: 120px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    flex-shrink: 0;
}

.h-titles { display: flex; flex-direction: column; min-width: 0; }

.h-title {
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.h-sub {
    font-size: .73rem;
    opacity: .85;
    white-space: nowrap;
}

.h-right {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-shrink: 0;
}

.h-user {
    font-size: .85rem;
    font-weight: 600;
    background: rgba(255,255,255,.15);
    padding: .25rem .65rem;
    border-radius: 20px;
    white-space: nowrap;
}

/* ============================================================
   NAVEGACIÓN
   ============================================================ */
.app-nav {
    background: var(--sas-green-dark);
    display: flex;
    gap: 2px;
    padding: 0 .75rem;
    overflow-x: auto;
}

.nav-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,.75);
    font-family: var(--font);
    font-size: .82rem;
    font-weight: 600;
    padding: .65rem 1rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    transition: color .15s, border-color .15s, background .15s;
}

.nav-btn:hover { color: white; background: rgba(255,255,255,.07); }

.nav-btn.active {
    color: white;
    border-bottom-color: #7de8a8;
}

/* ============================================================
   SELECTOR DE MES
   ============================================================ */
.month-bar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .55rem 1.25rem;
    gap: 1rem;
}

.mes-nav-btn {
    background: var(--sas-green-light);
    border: 1px solid var(--sas-green);
    color: var(--sas-green-dark);
    border-radius: var(--radius-sm);
    width: 36px;
    height: 36px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    flex-shrink: 0;
}

.mes-nav-btn:hover:not(:disabled) { background: var(--sas-green); color: white; }

.mes-nav-btn:disabled {
    opacity: .35;
    cursor: not-allowed;
    background: var(--gray-light);
    border-color: var(--gray-light);
    color: var(--gray-dark);
}

.mes-info {
    display: flex;
    align-items: center;
    gap: .65rem;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
}

.mes-titulo {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--sas-green-dark);
    text-align: center;
}

.mes-badge {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .05em;
    padding: .2rem .55rem;
    border-radius: 20px;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-corriente { background: var(--sas-green); color: white; }
.badge-futuro    { background: var(--blue-badge); color: white; }
.badge-historico { background: var(--gray-dark);  color: white; }

/* ============================================================
   CONTENIDO PRINCIPAL
   ============================================================ */
.app-main {
    max-width: 960px;
    margin: 1.25rem auto;
    padding: 0 1rem 2rem;
}

section { }

/* ============================================================
   PLANNING
   ============================================================ */
.planning-hdr {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.planning-hdr h2 {
    font-size: 1.05rem;
    color: var(--sas-green-dark);
}

.readonly-badge {
    background: var(--gray-light);
    color: var(--gray-dark);
    font-size: .7rem;
    padding: .2rem .55rem;
    border-radius: 20px;
    font-weight: 600;
}

.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow-sm); }

.planning-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    font-size: .88rem;
}

.planning-table thead th {
    background: var(--sas-green-light);
    color: var(--sas-green-dark);
    font-weight: 700;
    padding: .7rem 1rem;
    text-align: left;
    border-bottom: 2px solid var(--sas-green);
    white-space: nowrap;
}

.planning-table tbody tr {
    border-bottom: 1px solid var(--gray-light);
    transition: background .1s;
}

.planning-table tbody tr:hover { background: var(--gray-bg); }

.planning-table tbody tr.fila-propia { background: #fffbe6; }
.planning-table tbody tr.fila-propia:hover { background: #fff3c4; }

.planning-table td {
    padding: .7rem 1rem;
    vertical-align: middle;
}

.fecha-larga { display: block; }
.fecha-corta { display: none; font-size: .78rem; color: var(--gray-dark); }

.ubicacion-tag {
    background: var(--gray-bg);
    border: 1px solid var(--gray-light);
    border-radius: 4px;
    padding: .2rem .55rem;
    font-size: .8rem;
    white-space: nowrap;
}

.facultativo-chip {
    display: inline-block;
    border: 1.5px solid;
    border-radius: 20px;
    padding: .2rem .7rem;
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-mod {
    display: inline-block;
    background: var(--orange-light);
    color: var(--orange);
    font-size: .65rem;
    font-weight: 700;
    border-radius: 3px;
    padding: 0 .3rem;
    margin-left: .35rem;
    vertical-align: middle;
    cursor: help;
}

.td-action { width: 1%; white-space: nowrap; }
.td-btns   { display: flex; gap: .35rem; flex-wrap: nowrap; }

/* ============================================================
   HISTORIAL
   ============================================================ */
.sec-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: .5rem;
}

.sec-header h2 { font-size: 1.05rem; color: var(--sas-green-dark); }

.sec-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.filters {
    display: flex;
    gap: .75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filters select {
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-sm);
    padding: .4rem .7rem;
    font-family: var(--font);
    font-size: .85rem;
    color: var(--text-main);
    background: var(--white);
    min-width: 160px;
}

.historial-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    font-size: .83rem;
}

.historial-table thead th {
    background: var(--sas-green-light);
    color: var(--sas-green-dark);
    font-weight: 700;
    padding: .65rem .85rem;
    text-align: left;
    border-bottom: 2px solid var(--sas-green);
    white-space: nowrap;
}

.historial-table tbody tr { border-bottom: 1px solid var(--gray-light); }
.historial-table tbody tr:hover { background: var(--sas-green-pale); }
.historial-table td { padding: .6rem .85rem; vertical-align: top; }

.id-cell { font-weight: 700; color: var(--gray-dark); font-size: .8rem; text-align: center; }
.ts-cell  { white-space: nowrap; font-size: .78rem; color: var(--text-sub); }

.hist-nombre { display: block; font-weight: 600; color: var(--text-main); }
.hist-turno  { display: block; font-size: .77rem; color: var(--gray-dark); margin-top: .1rem; }
.sin-motivo  { color: var(--gray-mid); }

/* ============================================================
   CARGAR TURNOS
   ============================================================ */
section h2 {
    font-size: 1.05rem;
    color: var(--sas-green-dark);
    margin-bottom: 1rem;
}

.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.card h3 {
    font-size: .95rem;
    color: var(--sas-green-dark);
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--sas-green-light);
}

.form-row {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-row .fg { flex: 1; min-width: 150px; }

.fg { margin-bottom: .85rem; }

.fg label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-sub);
    margin-bottom: .3rem;
}

.fg input[type="text"],
.fg input[type="date"],
.fg input[type="password"],
.fg select,
.fg input[type="number"],
#inp-usuario,
#inp-password,
#inp-nuevo-fac {
    width: 100%;
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-sm);
    padding: .5rem .75rem;
    font-family: var(--font);
    font-size: .88rem;
    color: var(--text-main);
    background: var(--white);
    transition: border-color .15s;
}

.fg input:focus,
.fg select:focus,
#inp-usuario:focus,
#inp-password:focus {
    outline: none;
    border-color: var(--sas-green);
    box-shadow: 0 0 0 3px rgba(0,102,51,.12);
}

.hint {
    font-size: .8rem;
    color: var(--gray-dark);
    margin-bottom: .75rem;
}

.hint code {
    background: var(--gray-bg);
    padding: .1rem .35rem;
    border-radius: 3px;
    font-size: .78rem;
}

.csv-drop-zone {
    border: 2px dashed var(--gray-light);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    background: var(--sas-green-pale);
    transition: border-color .15s, background .15s;
}

.csv-drop-zone.drag-over {
    border-color: var(--sas-green);
    background: var(--sas-green-light);
}

.csv-hint-text {
    font-size: .85rem;
    color: var(--gray-dark);
    margin-bottom: .75rem;
}

.csv-preview-box {
    background: var(--sas-green-light);
    border: 1px solid var(--sas-green);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    margin-top: .75rem;
}

.csv-preview-box p { margin-bottom: .75rem; font-size: .88rem; }

.csv-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.usuarios-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .5rem;
}

.usuario-chip-item {
    display: flex;
    align-items: center;
    gap: .3rem;
}

.btn-icon-danger {
    background: none;
    border: none;
    color: var(--red);
    cursor: pointer;
    font-size: .75rem;
    padding: .1rem .3rem;
    border-radius: 3px;
    transition: background .1s;
}
.btn-icon-danger:hover { background: #fdecea; }

/* ============================================================
   BOTONES
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    border: none;
    border-radius: var(--radius-sm);
    padding: .55rem 1.1rem;
    font-family: var(--font);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, opacity .15s;
    white-space: nowrap;
    text-decoration: none;
}

.btn:disabled { opacity: .45; cursor: not-allowed; }

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

.btn-secondary {
    background: var(--gray-light);
    color: var(--text-main);
}
.btn-secondary:hover:not(:disabled) { background: var(--gray-mid); }

.btn-danger {
    background: var(--red);
    color: white;
}
.btn-danger:hover:not(:disabled) { background: var(--red-hover); }

.btn-outline-white {
    background: transparent;
    border: 1.5px solid rgba(255,255,255,.7);
    color: white;
}
.btn-outline-white:hover:not(:disabled) { background: rgba(255,255,255,.12); }

.btn-outline-primary {
    background: transparent;
    border: 1.5px solid var(--sas-green);
    color: var(--sas-green);
}
.btn-outline-primary:hover:not(:disabled) { background: var(--sas-green-light); }

/* Botón ceder — naranja */
.btn-ceder {
    background: var(--orange);
    color: white;
}
.btn-ceder:hover:not(:disabled) { background: #bf4000; }

.btn-outline-ceder {
    background: transparent;
    border: 1.5px solid var(--orange);
    color: var(--orange);
}
.btn-outline-ceder:hover:not(:disabled) { background: var(--orange-light); }

.btn-sm   { padding: .35rem .75rem; font-size: .78rem; }
.btn-full { width: 100%; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-ov {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 1rem;
}

.modal-box {
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.22);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-sm { max-width: 420px; }

.modal-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.4rem .9rem;
    border-bottom: 1px solid var(--gray-light);
    flex-shrink: 0;
}

.modal-hdr h3 { font-size: 1rem; color: var(--sas-green-dark); }

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--gray-dark);
    cursor: pointer;
    padding: .2rem .4rem;
    border-radius: 4px;
    line-height: 1;
    transition: background .1s;
}
.modal-close-btn:hover { background: var(--gray-light); }

.modal-body { padding: 1.1rem 1.4rem; flex: 1; }

.modal-ftr {
    padding: .9rem 1.4rem;
    border-top: 1px solid var(--gray-light);
    display: flex;
    justify-content: flex-end;
    gap: .65rem;
    flex-shrink: 0;
}

/* CAMBIO PANEL */
.cambio-panel {
    display: flex;
    align-items: stretch;
    gap: .75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.turno-lado {
    flex: 1;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.turno-lado-label {
    font-size: .73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--gray-dark);
}

.turno-lado.cedente .turno-detalle-box { border-color: var(--sas-green); background: var(--sas-green-pale); }
.turno-lado.receptor .turno-detalle-box { border-color: var(--blue-badge); background: var(--blue-light); }

.turno-detalle-box {
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-sm);
    padding: .65rem .85rem;
    min-height: 65px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.turno-detalle-box.placeholder {
    border-style: dashed;
    background: var(--gray-bg);
    border-color: var(--gray-mid);
    align-items: center;
}

.turno-detalle-box.placeholder span { color: var(--gray-dark); font-size: .82rem; text-align: center; }

.t-fecha { font-weight: 700; font-size: .88rem; color: var(--text-main); }
.t-ubic  { font-size: .8rem; color: var(--gray-dark); margin-top: .2rem; }

.cambio-flecha {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--sas-green);
    font-weight: 700;
    flex-shrink: 0;
    padding-top: 1.5rem;
}

.label-turnos-comp {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-sub);
    margin-bottom: .5rem;
}

#m-turnos-lista {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    margin-bottom: 1rem;
    max-height: 180px;
    overflow-y: auto;
}

.turno-sel-btn {
    background: var(--white);
    border: 1.5px solid var(--gray-light);
    border-radius: var(--radius-sm);
    padding: .55rem .85rem;
    cursor: pointer;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    font-family: var(--font);
    transition: border-color .12s, background .12s;
}

.turno-sel-btn:hover { border-color: var(--sas-green); background: var(--sas-green-pale); }

.turno-sel-btn.selected {
    border-color: var(--sas-green);
    background: var(--sas-green-light);
    font-weight: 600;
}

.ts-fecha { font-size: .85rem; color: var(--text-main); }
.ts-ubic  { font-size: .78rem; color: var(--gray-dark); }

/* CONFIRMACIÓN */
.warn-txt {
    background: #fff3e0;
    border-left: 4px solid var(--orange);
    padding: .65rem .9rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: .85rem;
    color: #7a3800;
    margin-bottom: 1rem;
}

.confirm-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.confirm-table td { padding: .5rem .65rem; border-bottom: 1px solid var(--gray-light); }
.confirm-table td:first-child { font-weight: 600; white-space: nowrap; color: var(--text-sub); }

/* ============================================================
   ESTADO VACÍO
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-dark);
}

.empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.empty-state h3 { font-size: 1rem; margin-bottom: .5rem; color: var(--text-main); }
.empty-state p  { font-size: .88rem; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: #1a2a3a;
    color: white;
    padding: .7rem 1.4rem;
    border-radius: 8px;
    font-size: .88rem;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    z-index: 1000;
    white-space: nowrap;
    max-width: 90vw;
    white-space: normal;
    text-align: center;
    animation: slideUp .25s ease;
}

.toast-success { background: var(--sas-green-dark); }
.toast-error   { background: var(--red); }
.toast-info    { background: var(--blue-badge); }

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

/* ============================================================
   ERROR MSG
   ============================================================ */
.error-msg {
    background: #fdecea;
    color: var(--red);
    border: 1px solid #f5c6c6;
    border-radius: var(--radius-sm);
    padding: .5rem .75rem;
    font-size: .83rem;
    margin-bottom: .75rem;
}

/* Badge tipo en historial */
.badge-tipo {
    display: inline-block;
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .04em;
    padding: .15rem .45rem;
    border-radius: 20px;
    text-transform: uppercase;
    white-space: nowrap;
    vertical-align: middle;
    margin-right: .3rem;
}
.badge-tipo-cambio { background: var(--sas-green-light); color: var(--sas-green-dark); }
.badge-tipo-cesion { background: var(--orange-light);    color: var(--orange); }

/* Modal cesión */
.modal-cesion-box { max-width: 480px; }

/* ============================================================
   PIE DE PÁGINA
   ============================================================ */
.app-footer {
    background: var(--sas-green-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: .55rem 1.25rem;
    margin-top: 2rem;
}

.footer-logo {
    height: 26px;
    max-width: 90px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: .75;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
    .h-title { font-size: .88rem; }
    .h-sub   { display: none; }
    .h-user  { display: none; }

    .planning-table thead th:nth-child(4),
    .planning-table tbody td:nth-child(4) { display: none; }

    .fecha-larga { display: none; }
    .fecha-corta { display: block; }

    .historial-table thead th:nth-child(3),
    .historial-table tbody td:nth-child(3),
    .historial-table thead th:nth-child(6),
    .historial-table tbody td:nth-child(6) { display: none; }

    .cambio-panel { flex-direction: column; }
    .cambio-flecha { padding-top: 0; transform: rotate(90deg); }

    .form-row .fg { min-width: 100%; }

    .app-main { padding: 0 .6rem 1.5rem; }
    .card { padding: 1rem 1rem; }
}

/* ============================================================
   BARRA DE ACCIONES DE TURNO (cambio + cesión)
   ============================================================ */
.cambio-top-bar {
    background: linear-gradient(135deg, #e8f5ee 0%, #f0faf4 100%);
    border: 1.5px solid var(--sas-green);
    border-radius: var(--radius);
    padding: .9rem 1.25rem;
    margin-bottom: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.cambio-top-bar-text {
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.cambio-top-bar-text strong {
    font-size: .92rem;
    color: var(--sas-green-dark);
}

.cambio-top-bar-text small {
    font-size: .78rem;
    color: var(--gray-dark);
}

.cambio-top-bar-btns {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.mis-turnos-info {
    background: #fff8e1;
    border-left: 3px solid #f9a825;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: .5rem .85rem;
    font-size: .82rem;
    color: #6d4c00;
    margin-bottom: 1rem;
}

/* Separador en modal */
.modal-sep {
    border: none;
    border-top: 1px solid var(--gray-light);
    margin: 0 0 .75rem;
}

.paso-label {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--sas-green-dark);
    margin-bottom: .6rem;
}

/* ============================================================
   SPINNER DE CARGA
   ============================================================ */
.spinner-ov {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
}
.spinner-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
}
.spinner {
    width: 36px;
    height: 36px;
    border: 4px solid var(--sas-green-light);
    border-top-color: var(--sas-green);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
.spinner-box span { font-size: .85rem; color: var(--gray-dark); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   RESUMEN POR FACULTATIVO
   ============================================================ */
.resumen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: .5rem;
}

.resumen-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.resumen-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    gap: .5rem;
}

.resumen-card-nombre {
    font-weight: 700;
    font-size: .95rem;
}

.resumen-stats {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
}

.stat-chip {
    font-size: .7rem;
    font-weight: 700;
    padding: .15rem .5rem;
    border-radius: 20px;
    white-space: nowrap;
}
.stat-realizada { background: #e8f5e9; color: #2e7d32; }
.stat-pendiente { background: #fff3e0; color: #e65100; }
.stat-total     { background: var(--gray-light); color: var(--text-sub); }

.resumen-turnos {
    padding: 0 .85rem .85rem;
    display: flex;
    flex-direction: column;
    gap: .3rem;
    max-height: 220px;
    overflow-y: auto;
}

.resumen-turno-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .5rem;
    border-radius: var(--radius-sm);
    font-size: .82rem;
}

.resumen-turno-row.realizado {
    background: #f1faf2;
    border-left: 3px solid #4caf50;
}

.resumen-turno-row.pendiente {
    background: #fff8f0;
    border-left: 3px solid #ff9800;
}

.rt-estado {
    font-size: .75rem;
    flex-shrink: 0;
}

.rt-fecha { font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.rt-ubic  { color: var(--gray-dark); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.resumen-vacio {
    padding: .75rem .85rem;
    font-size: .82rem;
    color: var(--gray-mid);
    text-align: center;
}

/* ============================================================
   INFORME SEMANAL
   ============================================================ */
.informe-filtros {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.informe-filtros label {
    font-size: .875rem;
    font-weight: 600;
    color: var(--sas-green-dark);
}
.informe-filtros select {
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-sm);
    padding: .4rem .75rem;
    font-family: var(--font);
    font-size: .875rem;
    color: var(--text-main);
    background: var(--white);
    min-width: 280px;
}
.informe-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    border-radius: var(--radius);
    overflow: hidden;
}
.informe-tabla thead tr { background: var(--sas-green); }
.informe-th {
    color: #fff;
    font-weight: 600;
    padding: .55rem .8rem;
    text-align: center;
    border: 1px solid rgba(255,255,255,.2);
    white-space: nowrap;
}
.informe-th:first-child { text-align: left; }
.informe-td-fac {
    font-weight: 600;
    color: var(--sas-green-dark);
    padding: .5rem .8rem;
    border: 1px solid var(--gray-light);
    background: #f4f9f4;
    white-space: nowrap;
}
.informe-td {
    text-align: center;
    padding: .45rem .6rem;
    border: 1px solid var(--gray-light);
    font-size: .82rem;
}
.informe-td-ok {
    background: #e8f5e9;
    color: #1b5e20;
    font-weight: 500;
}
.informe-td-vacio {
    color: #ccc;
    background: #fafafa;
}
.informe-tabla tbody tr:nth-child(even) .informe-td-fac { background: #edf3ed; }
.informe-tabla tbody tr:hover .informe-td-fac { background: #d9edd9; }
.informe-tabla tbody tr:hover .informe-td { background: #f0faf0; }
.informe-tabla tbody tr:hover .informe-td-ok { background: #c8e6c9; }
.informe-vacio {
    color: var(--text-muted);
    font-size: .9rem;
    padding: 1.5rem 0;
    text-align: center;
}

/* ============================================================
   IMPRESIÓN — RESUMEN
   ============================================================ */
.print-only { display: none; }

@media print {
    /* Ocultar todo excepto el resumen imprimible */
    body > *:not(#print-resumen) { display: none !important; }
    #print-resumen { display: block !important; }

    .print-only { display: block; }

    .pr-header {
        display: flex;
        align-items: center;
        gap: 1rem;
        border-bottom: 2px solid #006633;
        padding-bottom: .75rem;
        margin-bottom: 1.25rem;
    }
    .pr-logo { height: 40px; }
    .pr-titulo { flex: 1; }
    .pr-titulo h1 { font-size: 14pt; color: #006633; margin: 0; }
    .pr-titulo p  { font-size: 9pt; color: #555; margin: .2rem 0 0; }
    .pr-fecha { font-size: 8pt; color: #777; text-align: right; }

    .pr-fac-block { margin-bottom: 1.2rem; page-break-inside: avoid; }
    .pr-fac-nombre {
        font-size: 10pt;
        font-weight: bold;
        background: #e8f5ee;
        color: #006633;
        padding: .3rem .6rem;
        border-left: 4px solid #006633;
        margin-bottom: .4rem;
    }
    .pr-tabla { width: 100%; border-collapse: collapse; font-size: 9pt; }
    .pr-tabla th {
        background: #f0faf4;
        border: 1px solid #ccc;
        padding: .3rem .5rem;
        text-align: left;
        font-weight: 600;
    }
    .pr-tabla td { border: 1px solid #ccc; padding: .3rem .5rem; }
    .pr-tabla tr.realizado td { background: #f1faf2; }
    .pr-tabla tr.pendiente td { background: #fff8f0; }
    .pr-estado-r { color: #2e7d32; font-weight: 600; }
    .pr-estado-p { color: #e65100; font-weight: 600; }
    .pr-totales {
        font-size: 8pt;
        color: #555;
        margin-top: .3rem;
        text-align: right;
    }
}

/* ============================================================
   IMPRESIÓN — HISTORIAL
   ============================================================ */
@media print {
    .app-header, .app-nav, .month-bar, .filters, .sec-actions, .app-footer { display: none !important; }
    body { background: white; }
    .app-main { max-width: 100%; margin: 0; padding: 0; }
    .historial-table, .planning-table { font-size: 9pt; }
    .historial-table td, .historial-table th,
    .planning-table td, .planning-table th { padding: .3rem .4rem; }
    .table-wrap { box-shadow: none; overflow: visible; }
}
