:root{--admin-bg:#f3f6f4;--admin-green:#0b3a2e;--admin-accent:#168061;--admin-line:#dce5e0}.auth-page{min-height:100vh;display:grid;place-items:center;background:radial-gradient(circle at 50% 0,#eef7f2,#dce8e2);overflow:auto;padding:24px}.auth-page:before{content:"";position:fixed;inset:0;background:#0b3a2e;clip-path:polygon(0 0,32% 0,18% 100%,0 100%)}.auth-card{position:relative;width:min(430px,100%);margin:0;background:#fff;border:1px solid var(--admin-line);border-radius:18px;padding:36px;box-shadow:0 24px 70px #0b2c2330;text-align:center}.auth-card img{width:68px;height:68px;object-fit:contain;background:var(--admin-green);border-radius:16px;padding:9px}.auth-card small{display:block;color:var(--admin-accent);font-weight:800;letter-spacing:.13em;margin-top:18px}.auth-card h1{margin:7px 0;font:28px Georgia,serif}.auth-card p{color:#68766f}.auth-card form{display:grid;gap:14px;text-align:left;margin-top:24px}.auth-card form .primary{width:100%;margin-top:4px}.auth-card a{color:var(--admin-green);text-align:center;margin-top:4px}.auth-card #authMessage{color:#a34037;margin-top:14px;font-weight:700}
.admin-shell{min-height:100vh;background:var(--admin-bg);display:grid;grid-template-columns:238px 1fr}.admin-side{background:var(--admin-green);color:#fff;padding:22px 14px;display:flex;flex-direction:column}.admin-brand{display:flex;align-items:center;gap:10px;padding:0 8px 20px}.admin-brand img{width:40px;height:40px;object-fit:contain}.admin-brand strong{font-size:16px}.admin-nav{display:grid;gap:5px}.admin-nav button{border:0;background:transparent;color:#c4d8d0;padding:11px 12px;text-align:left;border-radius:8px;font-weight:700}.admin-nav button.active,.admin-nav button:hover{background:#1b5b49;color:#fff}.admin-user{margin-top:auto;border-top:1px solid #315d51;padding:16px 8px 0;display:flex;justify-content:space-between}.admin-main{min-width:0}.admin-top{height:68px;background:#fff;border-bottom:1px solid var(--admin-line);display:flex;align-items:center;padding:0 24px}.admin-top h1{font-size:19px;margin:0}.admin-top div{margin-left:auto;display:flex;gap:8px}.admin-content{padding:24px}.admin-panel{background:#fff;border:1px solid var(--admin-line);border-radius:13px;overflow:hidden}.panel-head{padding:17px 18px;border-bottom:1px solid var(--admin-line);display:flex;align-items:center;gap:10px}.panel-head h2{font-size:16px;margin:0;flex:1}.admin-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:18px}.stat{background:#fff;border:1px solid var(--admin-line);border-radius:12px;padding:17px}.stat small{color:#718078}.stat strong{display:block;font-size:25px;margin-top:5px}.data-table{width:100%;border-collapse:collapse}.data-table th,.data-table td{padding:11px 13px;border-bottom:1px solid #edf1ef;text-align:left;font-size:12px}.data-table th{background:#f8faf9;color:#65746c;font-size:10px;text-transform:uppercase;letter-spacing:.08em}.badge{display:inline-block;padding:4px 7px;border-radius:12px;background:#e7f3ed;color:#17634d;font-size:10px;font-weight:800}.badge.pending{background:#fff2c9;color:#8a6500}.admin-form{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;padding:18px}.admin-form .full{grid-column:1/-1}.checks{display:flex;flex-wrap:wrap;gap:8px}.checks label{border:1px solid var(--admin-line);border-radius:7px;padding:8px;flex-direction:row;align-items:center}.checks input{height:auto}.schedule-wrap{overflow:auto}.schedule-table{min-width:900px}.schedule-table th:first-child,.schedule-table td:first-child{position:sticky;left:0;background:#fff;z-index:1}.area-row td{background:#eaf4ef!important;font-weight:800;color:#155642}.cell-select{width:100%;min-width:120px;height:32px}.toolbar{display:flex;gap:8px;flex-wrap:wrap;padding:14px 18px;border-bottom:1px solid var(--admin-line)}@media(max-width:800px){.admin-shell{grid-template-columns:1fr}.admin-side{position:static}.admin-nav{grid-template-columns:repeat(3,1fr)}.admin-user{display:none}.admin-grid{grid-template-columns:repeat(2,1fr)}.admin-form{grid-template-columns:1fr}.admin-form .full{grid-column:auto}}
.admin-side .admin-nav a{display:block;border:0;background:transparent;color:#c4d8d0;padding:11px 12px;text-align:left;border-radius:8px;font-weight:700;text-decoration:none}.admin-side .admin-nav a:hover{background:#1b5b49;color:#fff}.schedule-table .pending-cell{background:#fff7d9}.schedule-table .pending-cell small{display:block;color:#8a6500;max-width:150px;margin-top:4px}.admin-user span{display:grid}.admin-user small{color:#a8c1b8}.admin-user a{color:#fff}.toast{z-index:100000!important}#adminDialog{z-index:9000}#adminDialog::backdrop{z-index:8999}
.public-schedule{min-height:100vh;background:#f3f6f4}.public-schedule>header{height:70px;background:#0b3a2e;color:#fff;display:flex;align-items:center;padding:0 5vw;gap:20px}.public-schedule>header>a{display:flex;align-items:center;gap:10px;color:#fff;text-decoration:none;font-weight:800}.public-schedule>header img{width:42px;height:42px;object-fit:contain}.public-schedule>header>div{margin-left:auto;display:flex;gap:8px}.public-schedule>header select{height:36px;border-color:#477065;background:#fff}.public-schedule main{max-width:1400px;margin:auto;padding:30px}.public-title small{color:#168061;font-weight:800;letter-spacing:.13em}.public-title h1{margin:6px 0}.public-title p{color:#66756d}.public-schedule #publicSchedule{background:#fff;border:1px solid #dce5e0;border-radius:13px;overflow:hidden}.mobile-schedule{display:none}.mobile-schedule article{background:#fff;border:1px solid #dce5e0;border-radius:10px;padding:14px}.mobile-schedule article h3{margin-top:0}.mobile-schedule article p{display:flex;justify-content:space-between;border-top:1px solid #edf1ef;padding-top:8px}.mobile-schedule article p>*{font-size:11px}@media(max-width:700px){.public-schedule>header{height:auto;padding:12px;align-items:flex-start}.public-schedule>header>div{display:grid}.public-schedule main{padding:16px}.public-schedule .schedule-wrap{display:none}.mobile-schedule{display:grid;gap:10px}}

/* ===== Menú móvil de administración ===== */
.admin-brand-row{display:block}
.admin-menu-toggle,.admin-mobile-menu{display:none}
@media(max-width:800px){
  .admin-side{position:sticky;top:0;z-index:6000;height:68px;min-height:0;padding:0 14px;display:block;box-shadow:0 8px 24px rgba(3,28,21,.16)}
  .admin-brand-row{height:68px;display:flex;align-items:center;justify-content:space-between;gap:12px}
  .admin-brand{padding:0;min-width:0}
  .admin-brand img{width:38px;height:38px}
  .admin-brand strong{font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .admin-nav,.admin-user{display:none!important}
  .admin-menu-toggle{display:flex;width:42px;height:42px;border:1px solid rgba(255,255,255,.16);border-radius:11px;background:#1b5b49;align-items:center;justify-content:center;flex-direction:column;gap:4px;padding:0;flex:0 0 auto}
  .admin-menu-toggle span{display:block;width:18px;height:2px;border-radius:2px;background:#fff;transition:transform .18s ease,opacity .18s ease}
  .admin-menu-toggle.open span:nth-child(1){transform:translateY(6px) rotate(45deg)}
  .admin-menu-toggle.open span:nth-child(2){opacity:0}
  .admin-menu-toggle.open span:nth-child(3){transform:translateY(-6px) rotate(-45deg)}
  .admin-mobile-menu{position:absolute;display:block;top:60px;left:12px;right:12px;background:#fff;color:#17342b;border:1px solid var(--admin-line);border-radius:14px;box-shadow:0 18px 50px rgba(4,35,26,.28);padding:10px;opacity:0;visibility:hidden;transform:translateY(-8px) scale(.985);transform-origin:top right;transition:opacity .16s ease,transform .16s ease,visibility .16s;max-height:calc(100vh - 82px);overflow:auto}
  .admin-mobile-menu.open{opacity:1;visibility:visible;transform:none}
  .admin-mobile-user{display:flex;align-items:center;gap:10px;padding:9px 9px 12px;border-bottom:1px solid #e8eeeb;margin-bottom:6px}
  .admin-mobile-user>span:last-child{display:grid;gap:1px;min-width:0}
  .admin-mobile-user b{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .admin-mobile-user small{font-size:10px;color:#73847c}
  .admin-mobile-avatar{width:34px;height:34px;border-radius:10px;display:grid;place-items:center;background:#e5f2ec;color:#0d644b;font-weight:900;text-transform:uppercase;flex:0 0 auto}
  .admin-mobile-links{display:grid;grid-template-columns:1fr 1fr;gap:5px}
  .admin-mobile-links button{min-height:44px;border:0;border-radius:9px;background:transparent;color:#28473d;text-align:left;padding:9px 10px;font-weight:750;font-size:12px}
  .admin-mobile-links button.active{background:#e6f3ed;color:#0b5d46}
  .admin-mobile-links button:active{background:#dcece5}
  .admin-mobile-menu-footer{display:grid;grid-template-columns:1fr 1fr;gap:7px;padding-top:9px;margin-top:7px;border-top:1px solid #e8eeeb}
  .admin-mobile-menu-footer a{min-height:40px;border:1px solid #dce5e0;border-radius:9px;display:flex;align-items:center;justify-content:center;color:#183b31;text-decoration:none;font-weight:800;font-size:12px;background:#f8faf9}
  .admin-mobile-menu-footer .logout-link{color:#9a3d36;background:#fff8f7;border-color:#f0d7d3}
  .admin-top{height:58px;padding:0 14px}
  .admin-top h1{font-size:18px}
  .admin-top>div{display:none}
  .admin-content{padding:14px}
}
@media(max-width:390px){
  .admin-mobile-links{grid-template-columns:1fr}
}

/* ===== Tablas responsive de administración ===== */
@media(max-width:800px){
  .admin-panel{overflow:visible}
  .admin-panel .data-table:not(.schedule-table){display:block;width:100%;border-collapse:separate}
  .admin-panel .data-table:not(.schedule-table) thead{display:none}
  .admin-panel .data-table:not(.schedule-table) tbody{display:grid;gap:10px;padding:10px}
  .admin-panel .data-table:not(.schedule-table) tr{display:block;background:#fff;border:1px solid var(--admin-line);border-radius:11px;padding:7px 10px;box-shadow:0 2px 8px rgba(9,45,35,.035)}
  .admin-panel .data-table:not(.schedule-table) td{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;width:100%;padding:8px 0;border:0;border-bottom:1px solid #edf1ef;text-align:right;font-size:12px;min-width:0;overflow-wrap:anywhere}
  .admin-panel .data-table:not(.schedule-table) td:last-child{border-bottom:0;padding-bottom:3px}
  .admin-panel .data-table:not(.schedule-table) td::before{content:attr(data-label);flex:0 0 42%;max-width:42%;text-align:left;color:#718078;font-size:9px;font-weight:850;text-transform:uppercase;letter-spacing:.07em;line-height:1.35}
  .admin-panel .data-table:not(.schedule-table) td[data-label=""]::before{display:none}
  .admin-panel .data-table:not(.schedule-table) td[data-label=""]{display:block;text-align:left}
  .admin-panel .data-table:not(.schedule-table) td[colspan]{display:block;text-align:center;color:#728078;padding:14px 8px}
  .admin-panel .data-table:not(.schedule-table) td[colspan]::before{display:none}
  .admin-panel .data-table:not(.schedule-table) td .badge{margin-left:4px;margin-bottom:3px}
  .admin-panel .data-table:not(.schedule-table) td .secondary{min-height:34px;padding:7px 11px;white-space:nowrap}

  /* La programación mensual mantiene formato matriz, pero con desplazamiento cómodo */
  .schedule-wrap{width:100%;max-width:100%;overflow-x:auto;overflow-y:visible;-webkit-overflow-scrolling:touch;border-radius:0 0 12px 12px;scrollbar-width:thin}
  .schedule-table{min-width:max(760px,100%)}
  .schedule-table th,.schedule-table td{white-space:nowrap}
  .schedule-table th:first-child,.schedule-table td:first-child{min-width:125px;box-shadow:2px 0 0 #e7eeea}
  .cell-select{min-width:130px;max-width:160px}

  .toolbar{padding:12px;gap:8px}
  .toolbar label{min-width:0;flex:1 1 120px}
  .toolbar input,.toolbar select{width:100%}
  .toolbar button{flex:1 1 100%;min-height:40px}
  .panel-head{padding:14px}
  .panel-head .primary,.panel-head .secondary{white-space:nowrap}
}

@media(max-width:430px){
  .admin-panel .data-table:not(.schedule-table) tbody{padding:8px}
  .admin-panel .data-table:not(.schedule-table) td{gap:10px}
  .admin-panel .data-table:not(.schedule-table) td::before{flex-basis:38%;max-width:38%}
}

/* ===== Espaciado y presentación de formularios de administración ===== */
#adminDialog .dialog-shell{
  width:min(780px,calc(100vw - 36px));
  max-width:100%;
  max-height:min(90vh,860px);
  overflow:hidden;
  border-radius:16px;
}
#adminDialog .modal-head{
  padding:16px 20px;
  border-bottom:1px solid var(--admin-line);
}
#adminDialogBody{
  max-height:calc(90vh - 68px);
  overflow:auto;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
}
#adminDialogBody .admin-form{
  padding:20px 22px 22px !important;
  gap:14px 16px;
  box-sizing:border-box;
}
#adminDialogBody .admin-form>label,
#adminDialogBody .admin-form .full{
  min-width:0;
}
#adminDialogBody .admin-form>label{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-weight:700;
  line-height:1.25;
}
#adminDialogBody .admin-form input:not([type="checkbox"]):not([type="radio"]),
#adminDialogBody .admin-form select,
#adminDialogBody .admin-form textarea{
  width:100%;
  min-width:0;
  box-sizing:border-box;
  margin:0;
}
#adminDialogBody .admin-form textarea{
  min-height:86px;
  resize:vertical;
}
#adminDialogBody .admin-form .checks{
  gap:9px;
  margin-top:8px;
}
#adminDialogBody .admin-form .checks label{
  min-height:38px;
  box-sizing:border-box;
  padding:9px 11px;
}
#adminDialogBody .admin-form .full>.primary,
#adminDialogBody .admin-form>div>.primary{
  min-height:40px;
}

@media(max-width:800px){
  #adminDialog{
    width:calc(100vw - 20px);
    max-width:none;
    margin:auto;
  }
  #adminDialog .dialog-shell{
    width:100%;
    max-height:calc(100vh - 28px);
    border-radius:16px;
  }
  #adminDialog .modal-head{
    padding:14px 16px;
  }
  #adminDialogBody{
    max-height:calc(100vh - 96px);
  }
  #adminDialogBody .admin-form{
    padding:16px !important;
    gap:12px;
  }
  #adminDialogBody .admin-form .checks{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
  }
  #adminDialogBody .admin-form .checks label{
    width:100%;
    min-width:0;
    margin:0;
  }
}

@media(max-width:420px){
  #adminDialog{
    width:calc(100vw - 16px);
  }
  #adminDialogBody .admin-form{
    padding:14px !important;
  }
  #adminDialogBody .admin-form .checks{
    grid-template-columns:1fr;
  }
}

/* ===== Scroll general del panel de administración ===== */
/* app.css está pensado para la vista pública y fija <main> a 100vh.
   En administración necesitamos que el contenido largo pueda desplazarse. */
.admin-shell > .admin-main{
  margin-left:0 !important;
  width:auto;
  height:100vh;
  min-height:0;
  overflow-x:hidden;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
}
.admin-shell > .admin-main .admin-top{
  position:sticky;
  top:0;
  z-index:100;
}
.admin-shell > .admin-side{
  height:100vh;
  position:sticky;
  top:0;
  align-self:start;
}
.admin-content{
  min-height:calc(100vh - 68px);
  padding-bottom:40px;
}

@media(max-width:800px){
  /* En móvil dejamos que la página completa crezca de forma natural. */
  body{overflow:auto !important}
  .admin-shell > .admin-main{
    height:auto;
    min-height:calc(100vh - 68px);
    overflow:visible;
  }
  .admin-shell > .admin-side{
    height:68px;
    position:sticky;
    top:0;
  }
  .admin-shell > .admin-main .admin-top{
    top:68px;
  }
  .admin-content{
    min-height:0;
    padding-bottom:32px;
  }
}

/* ===== Editor y vista previa de turnos tipo matriz ===== */
.schedule-actions{align-items:center}
.schedule-save-state{font-size:11px;color:#728078;margin-left:auto;padding:6px 0}
.schedule-save-state.dirty{color:#9a5a18;font-weight:800}
.schedule-editor-note{padding:0 18px 14px;color:#68766f;font-size:12px}
.schedule-table .cell-select{min-width:118px;width:100%;border:0;background:transparent;padding:7px 8px;font:inherit;color:#173b31}
.schedule-table td{padding:0}
.schedule-table th{font-weight:850}
.turnos-preview-dialog .dialog-shell{width:min(1220px,calc(100vw - 28px));max-height:94vh}
.turnos-preview-dialog #adminDialogBody{max-height:calc(94vh - 66px);padding:0;background:#edf2ef}
.turnos-preview-wrap{overflow:auto;padding:18px}
.turnos-preview-actions{position:sticky;bottom:0;display:flex;justify-content:flex-end;gap:9px;padding:12px 18px;background:#fff;border-top:1px solid var(--admin-line);z-index:4}
.turnos-print-sheet{position:relative;isolation:isolate;width:1248px;min-height:816px;margin:0 auto;padding:20px 22px 24px;box-sizing:border-box;background:#fff;color:#111;font-family:Georgia,'Times New Roman',serif}
.turnos-print-watermark{position:absolute;z-index:-1;inset:0;display:flex;align-items:center;justify-content:center;pointer-events:none;overflow:hidden}
.turnos-print-watermark img{width:34%;max-height:60%;object-fit:contain;opacity:.055;filter:grayscale(1)}
.turnos-print-section{margin:0 0 28px}
.turnos-print-section:last-child{margin-bottom:0}
.turnos-print-section h2{margin:0 0 10px;text-align:center;font-size:27px;line-height:1.05;letter-spacing:.02em;color:#050505}
.turnos-print-section table{width:100%;border-collapse:collapse;table-layout:fixed;background:transparent}
.turnos-print-section th,.turnos-print-section td{border:1.3px solid #111;padding:6px 5px;text-align:center;vertical-align:middle;font-size:12px;line-height:1.08;background:rgba(255,255,255,.88)}
.turnos-print-section thead th{font-size:12px;font-weight:800}
.turnos-print-section tbody th{width:108px;text-align:left;font-family:Arial,sans-serif;font-size:10px;font-weight:500}
.turnos-print-section .turnos-role-head{width:108px;border-left-color:transparent;border-top-color:transparent;background:transparent}
.turnos-print-section td{height:27px;text-transform:uppercase}
@media(max-width:800px){
  .schedule-save-state{width:100%;margin-left:0;text-align:center}
  .turnos-preview-dialog{width:calc(100vw - 10px)!important}
  .turnos-preview-wrap{padding:10px}
  .turnos-preview-actions{padding:10px;flex-direction:column-reverse}
  .turnos-preview-actions button{width:100%}
}
.turnos-public-sheet{max-width:none;box-shadow:0 8px 32px rgba(13,55,43,.08);border:1px solid #dde6e1}
.public-schedule #publicSchedule{overflow-x:auto;padding-bottom:10px}
@media(max-width:800px){.turnos-public-sheet{transform-origin:top left}}

/* ===== Filtros del listado de integrantes ===== */
.member-filters{
  display:grid;
  grid-template-columns:minmax(220px,1.5fr) minmax(220px,1fr) auto auto;
  align-items:end;
  gap:10px;
  padding:14px 16px;
  border-bottom:1px solid var(--admin-line);
  background:#fbfcfb;
}
.member-filters label{display:grid;gap:5px;min-width:0}
.member-filters label>span{font-size:10px;font-weight:850;text-transform:uppercase;letter-spacing:.055em;color:#68776f}
.member-filters input,.member-filters select{width:100%;min-width:0;min-height:39px;box-sizing:border-box}
.member-clear-filter{min-height:39px;white-space:nowrap}
.member-filter-count{font-size:11px;color:#74827b;white-space:nowrap;padding:0 2px 10px;text-align:right}
.member-empty-filter td{text-align:center!important;color:#74827b;padding:24px!important}
@media(max-width:800px){
  .member-filters{grid-template-columns:1fr 1fr;padding:12px;gap:9px}
  .member-clear-filter{width:100%}
  .member-filter-count{align-self:center;text-align:right;padding:0}
}
@media(max-width:520px){
  .member-filters{grid-template-columns:1fr}
  .member-filter-count{text-align:left;padding:0 2px 2px}
}


/* Resumen dinámico de turnos por área */
.schedule-stats-card{margin:14px 18px 16px;border:1px solid #d9e3de;border-radius:12px;background:#fff;overflow:hidden}
.schedule-stats-head{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:13px 15px;background:#f5f9f7;border-bottom:1px solid #e0e8e4}
.schedule-stats-head b{display:block;font-size:14px}.schedule-stats-head small{display:block;margin-top:3px;color:#68766f;font-weight:400}
.schedule-stats-head>span{font-size:11px;color:#68766f;white-space:nowrap}
.schedule-stats-wrap{max-height:260px;overflow:auto}
.schedule-stats-table{margin:0;border:0}.schedule-stats-table th:nth-child(n+2),.schedule-stats-table td:nth-child(n+2){text-align:center;width:110px}
.schedule-stats-table tr.no-turns{opacity:.52}.schedule-stats-table tr.has-turns td:first-child{color:#063f32}
.leader-cap{display:inline-block;margin-left:4px;padding:1px 5px;border-radius:10px;background:#fff1d6;color:#8a5600;font-size:9px;font-weight:800;vertical-align:middle}
@media(max-width:720px){.schedule-stats-card{margin:12px 0}.schedule-stats-head{align-items:flex-start;flex-direction:column;gap:5px}.schedule-stats-wrap{max-height:220px}.schedule-stats-table th,.schedule-stats-table td{display:table-cell!important;padding:8px 7px!important}.schedule-stats-table thead{display:table-header-group!important}.schedule-stats-table tr{display:table-row!important;border:0!important}.schedule-stats-table th:nth-child(n+2),.schedule-stats-table td:nth-child(n+2){width:auto;min-width:70px}.schedule-stats-table td:before{display:none!important}}


/* ===== Turnos: lectura visual y experiencia móvil ===== */
.schedule-wrap{
  overflow:auto;
  border:1px solid #dce5e0;
  border-radius:12px;
  background:#fff;
  box-shadow:0 4px 18px rgba(13,55,43,.045);
}
.schedule-table{margin:0;border:0;min-width:900px}
.schedule-table thead th{
  position:sticky;
  top:0;
  z-index:5;
  background:#0d4f40;
  color:#fff;
  border-color:#27695b;
  text-align:center;
  white-space:nowrap;
}
.schedule-table thead th:first-child{
  left:0;
  z-index:7;
  min-width:155px;
  text-align:left;
  box-shadow:2px 0 0 rgba(255,255,255,.18);
}
.schedule-table tbody th{
  position:sticky;
  left:0;
  z-index:4;
  min-width:155px;
  color:#123f34;
  border-right:1px solid #ccd9d3;
  font-weight:850;
  box-shadow:2px 0 5px rgba(18,63,52,.05);
}
.schedule-table tbody tr:nth-child(odd) th,
.schedule-table tbody tr:nth-child(odd) td{background:#ffffff}
.schedule-table tbody tr:nth-child(even) th,
.schedule-table tbody tr:nth-child(even) td{background:#f2f5f3}
.schedule-table tbody tr:hover th,
.schedule-table tbody tr:hover td{background:#e8f3ee}
.schedule-table .cell-select{
  background:transparent;
  border-radius:0;
  min-height:39px;
  cursor:pointer;
}
.schedule-table .cell-select:focus{
  outline:2px solid #159471;
  outline-offset:-2px;
  background:#f3fff9;
}
.schedule-table td:has(.cell-select[value=""]){color:#98a39e}
.schedule-editor-note{
  margin:0 18px 14px;
  padding:11px 13px;
  border:1px solid #dbe7e1;
  border-radius:10px;
  background:#f7faf8;
  line-height:1.45;
}
.schedule-actions{
  gap:8px;
  flex-wrap:wrap;
  padding:14px 18px;
  border-bottom:1px solid #e0e8e4;
  background:#fff;
}
.schedule-stats-table tbody tr:nth-child(odd) td{background:#fff}
.schedule-stats-table tbody tr:nth-child(even) td{background:#f5f7f6}
.schedule-stats-table tbody tr:hover td{background:#ebf5f0}

@media(max-width:800px){
  .schedule-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
    padding:12px;
  }
  .schedule-actions button{width:100%;min-height:42px}
  .schedule-save-state{
    grid-column:1/-1;
    margin:0;
    padding:8px 10px;
    border-radius:8px;
    background:#f5f8f6;
  }
  .schedule-save-state.dirty{background:#fff6e8}
  .schedule-editor-note{
    margin:0 0 12px;
    padding:10px 11px;
    font-size:11px;
  }
  .schedule-wrap{
    margin:0;
    border-radius:10px;
    -webkit-overflow-scrolling:touch;
    scroll-snap-type:x proximity;
  }
  .schedule-wrap:after{
    content:'Desliza horizontalmente para ver más fechas →';
    display:block;
    position:sticky;
    left:0;
    width:max-content;
    max-width:calc(100vw - 42px);
    padding:7px 10px;
    margin:8px;
    border-radius:8px;
    background:rgba(13,79,64,.92);
    color:#fff;
    font-size:10px;
    font-weight:750;
    pointer-events:none;
  }
  .schedule-table{min-width:max-content}
  .schedule-table thead th{
    min-width:116px;
    padding:9px 7px!important;
    font-size:11px;
  }
  .schedule-table thead th:first-child,
  .schedule-table tbody th{
    min-width:128px;
    width:128px;
    max-width:128px;
  }
  .schedule-table tbody th{
    white-space:normal;
    line-height:1.15;
    font-size:10px;
    padding:8px 7px!important;
  }
  .schedule-table td{
    min-width:116px;
    width:116px;
  }
  .schedule-table .cell-select{
    min-width:116px;
    min-height:42px;
    padding:7px 24px 7px 7px;
    font-size:11px;
  }
  .schedule-stats-card{border-radius:10px;overflow:hidden}
  .schedule-stats-head{padding:11px 12px}
  .schedule-stats-head b{font-size:13px}
  .schedule-stats-head small{font-size:10px;line-height:1.35}
  .schedule-stats-wrap{max-height:none;overflow:visible}
  .schedule-stats-table thead{display:none!important}
  .schedule-stats-table tbody{display:grid!important;grid-template-columns:1fr;gap:8px;padding:9px;background:#f4f7f5}
  .schedule-stats-table tbody tr{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) repeat(3,auto);
    align-items:center;
    gap:7px;
    padding:10px 11px;
    border:1px solid #dbe5e0!important;
    border-radius:10px;
    background:#fff!important;
    box-shadow:0 2px 7px rgba(13,55,43,.035);
  }
  .schedule-stats-table tbody tr:nth-child(even){background:#f8faf9!important}
  .schedule-stats-table tbody tr.no-turns{display:none!important}
  .schedule-stats-table td{
    display:block!important;
    width:auto!important;
    min-width:0!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
    text-align:center!important;
    font-size:12px;
  }
  .schedule-stats-table td:first-child{text-align:left!important;font-size:12px;color:#0b493a}
  .schedule-stats-table td:nth-child(2):before,
  .schedule-stats-table td:nth-child(3):before,
  .schedule-stats-table td:nth-child(4):before{
    display:block!important;
    margin-bottom:2px;
    color:#7a8780;
    font-size:8px;
    font-weight:850;
    text-transform:uppercase;
    letter-spacing:.04em;
  }
  .schedule-stats-table td:nth-child(2):before{content:'Alabanza'}
  .schedule-stats-table td:nth-child(3):before{content:'Audiovisual'}
  .schedule-stats-table td:nth-child(4):before{content:'Líder'}
}

@media(max-width:480px){
  .schedule-actions{grid-template-columns:1fr}
  .schedule-save-state{grid-column:1}
  .schedule-table thead th{min-width:108px}
  .schedule-table td,.schedule-table .cell-select{min-width:108px;width:108px}
  .schedule-table thead th:first-child,
  .schedule-table tbody th{min-width:116px;width:116px;max-width:116px}
  .schedule-stats-table tbody tr{grid-template-columns:minmax(0,1fr) 48px 58px 48px}
}

/* Botón de redistribución y resumen de turnos */
#redistributeProgram{white-space:nowrap}
.schedule-stats-table td:nth-child(n+2),.schedule-stats-table th:nth-child(n+2){text-align:center}
@media(max-width:720px){
  #redistributeProgram{order:2;flex:1 1 46%;min-width:145px}
  #saveProgram{order:1;flex:1 1 46%}
  #previewProgram{order:3;flex:1 1 46%}
  #publishProgram{order:4;flex:1 1 46%}
  #archiveProgram{order:5;flex:1 1 46%}
  .schedule-save-state{order:6;width:100%}
}

/* Corrección contador de participación en móvil */
@media(max-width:720px){
  .schedule-stats-card{display:block!important}
  .schedule-stats-wrap{display:block!important;visibility:visible!important}
  .schedule-stats-table{display:table!important;width:100%!important}
  .schedule-stats-table tbody{display:grid!important}
  .schedule-stats-table tbody tr.has-turns{display:grid!important}
  .schedule-stats-table td:nth-child(n+2){font-size:14px!important;font-weight:800;color:#0b493a}
}

/* =========================================================
   Turnos · pulido móvil v3
   ========================================================= */
@media(max-width:720px){
  /* Cabecera de acciones: compacta, jerarquizada y fácil de tocar */
  .schedule-actions{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:9px!important;
    padding:12px!important;
    background:#fff!important;
  }
  .schedule-actions button{
    min-height:44px!important;
    width:100%!important;
    margin:0!important;
    border-radius:10px!important;
    font-size:12px!important;
    line-height:1.15!important;
    padding:9px 10px!important;
  }
  #saveProgram{
    grid-column:1/-1!important;
    min-height:46px!important;
    box-shadow:0 3px 10px rgba(13,79,64,.13);
  }
  #redistributeProgram{grid-column:1/2!important;min-width:0!important}
  #previewProgram{grid-column:2/3!important}
  #publishProgram{grid-column:1/2!important}
  #archiveProgram{grid-column:2/3!important}
  .schedule-save-state{
    grid-column:1/-1!important;
    width:auto!important;
    min-height:34px!important;
    display:flex!important;
    align-items:center;
    justify-content:center;
    padding:7px 10px!important;
    margin:0!important;
    border:1px solid #e4ece8;
    border-radius:9px!important;
    background:#f6f9f7!important;
    color:#66756e!important;
    font-size:10px!important;
    text-align:center;
  }
  .schedule-save-state.dirty{
    background:#fff6e8!important;
    border-color:#efd8a8!important;
    color:#7a5515!important;
  }

  /* Nota: menos pesada visualmente */
  .schedule-editor-note{
    position:relative;
    margin:0 12px 12px!important;
    padding:10px 11px 10px 34px!important;
    border:1px solid #dce9e3!important;
    border-radius:11px!important;
    background:#f8fbf9!important;
    color:#53675e!important;
    font-size:10.5px!important;
    line-height:1.45!important;
  }
  .schedule-editor-note:before{
    content:'i';
    position:absolute;
    left:11px;
    top:11px;
    width:15px;
    height:15px;
    display:grid;
    place-items:center;
    border-radius:50%;
    background:#dff0e9;
    color:#0d6a52;
    font:800 10px/1 Arial,sans-serif;
  }

  /* Resumen: tarjetas claras, nombre arriba y métricas abajo */
  .schedule-stats-card{
    margin:0 12px 12px!important;
    border:1px solid #dbe7e1!important;
    border-radius:12px!important;
    background:#fff!important;
    overflow:hidden!important;
    box-shadow:0 3px 12px rgba(13,55,43,.04);
  }
  .schedule-stats-head{
    display:flex!important;
    align-items:flex-start!important;
    justify-content:space-between!important;
    gap:10px!important;
    padding:12px!important;
    background:#f7faf8!important;
    border-bottom:1px solid #e1e9e5!important;
  }
  .schedule-stats-head b{display:block;font-size:13px!important;color:#0c493a}
  .schedule-stats-head small{display:block;margin-top:3px;font-size:9.5px!important;line-height:1.35;color:#718078}
  .schedule-stats-head>span{
    flex:0 0 auto;
    padding:4px 7px;
    border-radius:999px;
    background:#e6f2ed;
    color:#1c6b56;
    font-size:9px;
    font-weight:800;
    white-space:nowrap;
  }
  .schedule-stats-wrap{
    max-height:330px!important;
    overflow:auto!important;
    padding:9px!important;
    background:#f4f7f5!important;
  }
  .schedule-stats-table{display:block!important;width:100%!important;border:0!important;background:transparent!important}
  .schedule-stats-table thead{display:none!important}
  .schedule-stats-table tbody{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px!important;
    padding:0!important;
    background:transparent!important;
  }
  .schedule-stats-table tbody tr.has-turns{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:7px!important;
    padding:10px!important;
    border:1px solid #dce6e1!important;
    border-radius:11px!important;
    background:#fff!important;
    box-shadow:0 2px 6px rgba(13,55,43,.035)!important;
  }
  .schedule-stats-table tbody tr.has-turns:nth-child(even){background:#fbfcfb!important}
  .schedule-stats-table tbody tr.no-turns{display:none!important}
  .schedule-stats-table td{
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    min-width:0!important;
    width:auto!important;
    min-height:44px;
    padding:6px 4px!important;
    border:1px solid #e5ece8!important;
    border-radius:8px!important;
    background:#f7faf8!important;
    color:#123f34!important;
    text-align:center!important;
    font-size:15px!important;
    font-weight:850!important;
  }
  .schedule-stats-table td:first-child{
    grid-column:1/-1!important;
    display:block!important;
    min-height:0!important;
    padding:0 1px 2px!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    color:#0b493a!important;
    text-align:left!important;
    font-size:12px!important;
    font-weight:850!important;
  }
  .schedule-stats-table td:nth-child(2):before,
  .schedule-stats-table td:nth-child(3):before,
  .schedule-stats-table td:nth-child(4):before{
    display:block!important;
    margin:0 0 4px!important;
    color:#718078!important;
    font-size:8.5px!important;
    font-weight:850!important;
    line-height:1!important;
    letter-spacing:.03em!important;
    text-transform:uppercase!important;
    white-space:nowrap!important;
  }
  .schedule-stats-table td:nth-child(2):before{content:'Alabanza'!important}
  .schedule-stats-table td:nth-child(3):before{content:'Audiovisual'!important}
  .schedule-stats-table td:nth-child(4):before{content:'Líder'!important}
  .schedule-stats-table td:nth-child(4){background:#f7f5fb!important}
  .leader-cap{
    display:inline-block;
    margin-left:3px;
    padding:1px 4px;
    border-radius:999px;
    background:#efe7fb;
    color:#68449a;
    font-size:8px;
    vertical-align:middle;
  }
}

@media(max-width:420px){
  .schedule-actions{grid-template-columns:1fr 1fr!important}
  #saveProgram{grid-column:1/-1!important}
  #redistributeProgram{grid-column:1/2!important}
  #previewProgram{grid-column:2/3!important}
  #publishProgram{grid-column:1/2!important}
  #archiveProgram{grid-column:2/3!important}
  .schedule-stats-head{padding:11px!important}
  .schedule-stats-head>span{font-size:8px;padding:4px 6px}
  .schedule-stats-wrap{max-height:300px!important}
}


/* ===== PDF / VISTA PREVIA DE TURNOS: COLOR, DOMINGOS Y MARCA DE AGUA ===== */
.schedule-table thead th.sunday-col{background:#dceaf2!important;color:#17485f!important;border-color:#bed2dd!important}
.schedule-table tbody td.sunday-col{background:#eef6fa!important}
.schedule-table tbody tr:nth-child(even) td.sunday-col{background:#e4f0f6!important}
.schedule-table tbody td.sunday-col .cell-select{background:transparent}

.turnos-print-sheet{position:relative;isolation:isolate;background:#fff;overflow:hidden}
.turnos-print-watermark{position:absolute;z-index:0;inset:0;display:flex;align-items:center;justify-content:center;pointer-events:none;overflow:hidden}
.turnos-print-watermark img{width:35%;max-height:58%;object-fit:contain;opacity:.085;filter:grayscale(.35)}
.turnos-print-section{position:relative;z-index:1}
.turnos-print-section h2{padding:7px 12px;border-radius:7px;font-family:Arial,sans-serif;font-weight:900;letter-spacing:.045em}
.turnos-print-alabanza h2{background:#e5f1eb;color:#103f32;border:1px solid #bfd7ca}
.turnos-print-audiovisual h2{background:#e7eef7;color:#183c5a;border:1px solid #c5d5e6}
.turnos-print-section table{background:transparent}
.turnos-print-section thead th:not(.turnos-role-head){background:rgba(227,238,232,.94);color:#153c31;border-color:#5f766d}
.turnos-print-audiovisual thead th:not(.turnos-role-head){background:rgba(229,237,247,.94);color:#25485f;border-color:#657c8b}
.turnos-print-section tbody tr.row-odd th,
.turnos-print-section tbody tr.row-odd td{background:rgba(255,255,255,.82)}
.turnos-print-section tbody tr.row-even th,
.turnos-print-section tbody tr.row-even td{background:rgba(239,243,241,.82)}
.turnos-print-section thead th.sunday-col{background:rgba(194,220,234,.96)!important;color:#123f56!important}
.turnos-print-section tbody td.sunday-col{background:rgba(219,237,246,.84)!important}
.turnos-print-section tbody tr.row-even td.sunday-col{background:rgba(207,229,240,.86)!important}
.turnos-print-section th,.turnos-print-section td{border-color:#596a63}
.turnos-print-section tbody th{font-weight:700;color:#173b31}
.turnos-print-section td{font-weight:600}
.turnos-print-section .turnos-role-head{background:transparent!important;border-left-color:transparent!important;border-top-color:transparent!important}


/* ===== Turnos: oficio horizontal, límites y edición estable ===== */
.turnos-print-sheet{width:1248px!important;min-height:816px!important;padding:26px 28px 30px!important}
.schedule-stats-table .stat-limit{font-size:10px;font-weight:600;color:#7a8982}
.schedule-stats-table td.at-limit .stat-current{color:#9a6417}
.schedule-stats-table td.over-limit .stat-current{color:#b42318}
.schedule-stats-table td.over-limit{background:#fff1f0!important}
.member-limit-box{padding:12px 13px;border:1px solid #dce6e1;border-radius:10px;background:#f7faf8}
.member-limit-box>small{display:block;margin-top:3px;color:#6d7c74;font-size:11px;line-height:1.4}
.member-limit-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:10px}
.member-limit-grid label{margin:0}
@media(max-width:720px){
  .member-limit-grid{grid-template-columns:1fr 1fr;gap:8px}
  .schedule-stats-table .stat-limit{font-size:9px!important;display:inline!important;color:#7a8982!important}
}
@media(max-width:390px){.member-limit-grid{grid-template-columns:1fr}}
