/* Agenda: un solo desplazamiento vertical visible y superficie de trabajo estable. */
@media (min-width:901px){
  .main-area:has(.agenda-workspace){
    display:flex;
    min-height:0;
    flex-direction:column;
    overflow:hidden;
  }
  .main-area:has(.agenda-workspace)>.topbar{flex:0 0 68px}
  .view:has(.agenda-workspace){
    display:flex;
    width:100%;
    height:calc(100% - 68px);
    min-height:0;
    flex-direction:column;
    overflow:hidden;
    padding-top:20px;
    padding-bottom:16px;
  }
  .view:has(.agenda-workspace)>.page-head,
  .view:has(.agenda-workspace)>.timezone-banner,
  .view:has(.agenda-workspace)>.agenda-rule-strip,
  .view:has(.agenda-workspace)>.agenda-commandbar,
  .view:has(.agenda-workspace)>.agenda-toolbar{flex:0 0 auto}
  .view:has(.agenda-workspace)>.agenda-toolbar{
    position:relative;
    top:auto;
  }
  .agenda-workspace{
    flex:1 1 auto;
    min-height:0;
    align-items:stretch;
  }
  .week-calendar{
    display:flex;
    height:100%;
    min-height:0;
    flex-direction:column;
  }
  .agenda-week-view .week-calendar-scroll,
  .agenda-day-view .week-calendar-scroll{
    flex:1 1 auto;
    height:auto;
    min-height:0;
    overflow:auto;
    overscroll-behavior:contain;
  }
  .agenda-month-view .month-calendar,
  .agenda-list-view .agenda-list{
    flex:1 1 auto;
    min-height:0;
    overflow:auto;
  }
  .calendar-legend{flex:0 0 auto}
  .agenda-editor{
    position:relative;
    top:auto;
    height:100%;
    max-height:none;
    min-height:0;
    overflow:auto;
    overscroll-behavior:contain;
  }
}

@media (min-width:901px){
  body.agenda-focus-mode .view:has(.agenda-workspace){height:100%}
  body.agenda-focus-mode .agenda-week-view .week-calendar-scroll,
  body.agenda-focus-mode .agenda-day-view .week-calendar-scroll{height:auto}
}

/* En tablet y móvil el documento es el único scroll vertical. */
@media (max-width:900px){
  .agenda-week-view .week-calendar-scroll,
  .agenda-day-view .week-calendar-scroll{
    height:auto;
    min-height:0;
    overflow-x:auto;
    overflow-y:visible;
    scrollbar-gutter:auto;
  }
  .agenda-day-view .week-calendar-scroll{overflow-x:hidden}
}

/* Mobile Nodly: acciones principales en una fila y reservas legibles. */
@media (max-width:760px){
  .view:has(.agenda-workspace) .agenda-toolbar.agenda-toolbar-compact{
    display:grid;
    grid-template-columns:minmax(96px,.72fr) minmax(0,1.7fr);
    align-items:center;
    gap:7px;
    padding:8px;
  }
  .agenda-toolbar-compact .agenda-mobile-filter{
    grid-column:1;
    order:1;
    width:100%;
    min-width:0;
    margin:0;
    background:var(--forest);
    box-shadow:0 3px 9px rgba(21,77,67,.14);
  }
  .agenda-toolbar-compact [data-agenda-views]{
    grid-column:2;
    order:2;
    width:100%;
    min-width:0;
    margin:0;
  }
  .agenda-toolbar-compact [data-agenda-views] button{
    min-width:0;
    min-height:34px;
    padding:6px 2px;
    font-size:8px;
  }
  .agenda-toolbar-compact .agenda-filters{
    grid-column:1/-1;
    order:3;
    margin-top:1px;
  }
  .calendar-item{position:relative}
  .agenda-week-view .calendar-item{
    padding:4px 2px 3px;
    border-left-width:3px;
  }
  .agenda-week-view .calendar-item strong{
    display:block;
    font-size:0!important;
    line-height:1;
  }
  .agenda-week-view .calendar-item strong::before{
    content:attr(data-start);
    font-size:7.5px;
    font-weight:800;
    letter-spacing:-.02em;
  }
  .agenda-week-view .calendar-patient-name{
    display:block!important;
    margin-top:4px!important;
    font-size:0!important;
    line-height:1!important;
    white-space:nowrap!important;
    text-overflow:ellipsis!important;
  }
  .agenda-week-view .calendar-patient-name::after{
    content:attr(data-short-name);
    font-size:8px;
    font-weight:800;
  }
  .agenda-week-view .calendar-patient-name .patient-zone-mark,
  .agenda-week-view .calendar-item small,
  .agenda-week-view .public-booking-mark{display:none!important}
  .agenda-week-view .calendar-item.public-booking::after{
    content:'↗';
    position:absolute;
    right:2px;
    bottom:2px;
    display:grid;
    place-items:center;
    width:11px;
    height:11px;
    border-radius:50%;
    background:#f6d890;
    color:#76500f;
    font-size:7px;
    font-weight:900;
  }
  .agenda-day-view .calendar-item{
    padding:6px 9px;
    border-left-width:4px;
    border-radius:8px;
  }
  .agenda-day-view .calendar-item strong{font-size:9px!important}
  .agenda-day-view .calendar-patient-name{font-size:11px!important;line-height:1.15!important}
  .agenda-day-view .calendar-item small{display:block!important;font-size:8px!important}
  .agenda-day-view .public-booking-mark{display:block!important;right:5px;bottom:4px!important;font-size:7px!important}
}

@media (max-width:360px){
  .view:has(.agenda-workspace) .agenda-toolbar.agenda-toolbar-compact{grid-template-columns:90px minmax(0,1fr);gap:5px;padding-inline:6px}
  .agenda-toolbar-compact [data-agenda-views] button{font-size:7.5px}
}
