body {
  margin: 0;
  background: #f5f5f7;
  color: #111;
  font-family: "SF Pro Text","SF Pro Display",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}

input,
select,
textarea,
button{
  font-family: inherit;
}

input[type="datetime-local"],
input[type="date"],
input[type="time"]{
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}

html.no-scroll,
body.no-scroll{
  overflow: hidden;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  padding: 14px;
  font-size: 20px;
}

.weekdays, .calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
}

.weekdays span {
  font-size: 12px;
  color: #888;
}


/* Vista diaria */
.day-view {
  position: fixed;
  inset: 0;
  background: #ffffff;
  z-index: 100;
  overflow-y: auto;
}

.hidden {
  display: none;
}

.day-header {
  display: flex;
  align-items: center;
  padding: 16px;
  font-size: 18px;
}

.hour-row {
  height: 60px;
  border-top: 1px solid #1a1a1a;
  padding-left: 12px;
  font-size: 12px;
  color: #999;
}

.fab {
  position: fixed;
  right: 16px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  background: #6e2cff;
  border-radius: 50%;
  color: white;
  font-size: 32px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.25);
  display: none;
  align-items: flex-end;
}

.modal.open { display: flex; }

.modal-content {
  background: #ffffff;
  width: 100%;
  border-radius: 18px 18px 0 0;
  padding: 16px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal-header h3{
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #111111;
}

.modal-action{
  background: none;
  border: none;
  color: #007aff;
  font-size: 14px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 10px;
  transition: background .15s ease, transform .12s ease, box-shadow .2s ease;
}
.modal-action--primary{
  color: #007aff;
}
.modal-action:hover{
  background: rgba(0,122,255,.08);
}
.modal-action:active{
  transform: translateY(1px) scale(.98);
  background: rgba(0,122,255,.16);
}
.modal-action:focus-visible{
  outline: 2px solid rgba(0,122,255,.35);
  outline-offset: 2px;
}

.field-group{
  margin-bottom: 14px;
}
.field-group.is-hidden{
  display: none;
}
.field-label{
  font-size: 12px;
  color: #8e8e93;
  margin: 2px 4px 8px;
}

.field {
  background: #f2f2f7;
  border: 1px solid #e5e5ea;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.field input {
  background: none;
  border: none;
  color: #111;
  font-size: 16px;
  width: 100%;
  outline: none;
}
.field select{
  background: none;
  border: none;
  color: #111;
  font-size: 16px;
  width: 100%;
  outline: none;
  appearance: none;
}

.field textarea{
  background: none;
  border: none;
  color: #111;
  font-size: 16px;
  width: 100%;
  outline: none;
  resize: vertical;
  font-family: inherit;
}

.field.row input{
  text-align: right;
  color: #111;
}
.field.row{
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f5f7fb);
  border: 1px solid rgba(148,163,184,.45);
  box-shadow:
    0 10px 24px rgba(15,23,42,.08),
    inset 0 1px 0 rgba(255,255,255,.9);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
  cursor: pointer;
}
.field.row input[type="datetime-local"],
.field.row input[type="date"],
.field.row input[type="time"]{
  cursor: pointer;
  background: transparent;
  appearance: none;
}
.field.row span{
  font-size: 13px;
  font-weight: 700;
  color: #475569;
}
.field.row input[type="datetime-local"],
.field.row input[type="date"],
.field.row input[type="time"]{
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
@media (min-width: 1024px){
  .field.row{
    padding: 14px 16px;
    border-radius: 16px;
    box-shadow:
      0 14px 30px rgba(15,23,42,.10),
      inset 0 1px 0 rgba(255,255,255,.95);
  }
  .field.row:hover{
    border-color: rgba(37,99,235,.55);
    box-shadow:
      0 18px 40px rgba(15,23,42,.12),
      inset 0 1px 0 rgba(255,255,255,.98);
    transform: translateY(-1px);
  }
  .field.row:focus-within{
    border-color: rgba(37,99,235,.75);
    box-shadow:
      0 0 0 4px rgba(37,99,235,.14),
      0 22px 44px rgba(15,23,42,.12),
      inset 0 1px 0 rgba(255,255,255,.98);
  }
  .field.row input[type="datetime-local"],
  .field.row input[type="date"],
  .field.row input[type="time"]{
    font-size: 18px;
  }
  input[type="date"]::-webkit-calendar-picker-indicator,
  input[type="time"]::-webkit-calendar-picker-indicator,
  input[type="datetime-local"]::-webkit-calendar-picker-indicator{
    transform: scale(1.3);
  }
  .field:has(select):hover{
    border-color: rgba(37,99,235,.55);
    box-shadow:
      0 12px 26px rgba(15,23,42,.10),
      inset 0 1px 0 rgba(255,255,255,.9);
    transform: translateY(-1px);
  }
  .field:has(select):focus-within{
    border-color: rgba(37,99,235,.75);
    box-shadow:
      0 0 0 4px rgba(37,99,235,.14),
      0 16px 34px rgba(15,23,42,.12);
  }
  .field--select.is-hovered{
    border-color: rgba(37,99,235,.55);
    box-shadow:
      0 12px 26px rgba(15,23,42,.10),
      inset 0 1px 0 rgba(255,255,255,.9);
    transform: translateY(-1px);
  }
  .field--select.is-focused{
    border-color: rgba(37,99,235,.75);
    box-shadow:
      0 0 0 4px rgba(37,99,235,.14),
      0 16px 34px rgba(15,23,42,.12);
  }
}

/* Date/time picker icon (WebKit) */
input[type="date"],
input[type="time"],
input[type="datetime-local"]{
  font-variant-numeric: tabular-nums;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator{
  opacity: 1;
  filter: invert(32%) sepia(88%) saturate(2500%) hue-rotate(197deg);
  transform: scale(1.2);
  padding: 4px;
  background: rgba(59,130,246,.12);
  border-radius: 8px;
  box-shadow: 0 6px 14px rgba(37,99,235,.18);
}

.field input::placeholder{
  color: #8e8e93;
}

.row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.field.row span{
  color: #111111;
}

.segmented{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #f2f2f7;
  border: 1px solid #e5e5ea;
  border-radius: 14px;
  padding: 6px;
}
.segmented-btn{
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #111111;
  cursor: pointer;
}
.segmented-btn.is-active{
  background: #007aff;
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(0,113,227,0.2);
}

.danger-btn{
  width: 100%;
  margin: 4px 0 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,59,48,0.3);
  background: rgba(255,59,48,0.08);
  color: #ff3b30;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.danger-btn:active{
  transform: translateY(1px);
}

.ds-modal{position:fixed;inset:0;display:none;align-items:center;justify-content:center;background:rgba(2,6,23,.35);backdrop-filter:blur(8px);z-index:2000;padding:16px}
.ds-modal.is-open{display:flex}
.ds-modal__card{
  width:min(520px,calc(100vw - 32px));
  max-height:calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow:auto;
  background:rgba(255,255,255,.92);
  border:1px solid rgba(148,163,184,.35);
  border-radius:18px;
  box-shadow:0 30px 80px rgba(15,23,42,.25);
  padding:16px
}
.ds-modal__head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.ds-iconbtn{width:36px;height:36px;border-radius:999px;border:1px solid rgba(148,163,184,.45);background:rgba(255,255,255,.75);cursor:pointer}
.ds-muted{color:rgba(100,116,139,.95);margin:8px 0 12px}
.ds-radio-list{display:flex;flex-direction:column;gap:8px;margin:10px 0 8px;width:100%;align-items:stretch}
.ds-radio{
  display:grid;
  grid-template-columns: 18px minmax(0,1fr);
  align-items:flex-start;
  column-gap:10px;
  padding:10px 12px;
  border:1px solid rgba(148,163,184,.35);
  border-radius:14px;
  background:rgba(255,255,255,.7);
  cursor:pointer;
  width:100%;
  max-width:100%;
  min-width:0;
  box-sizing:border-box
}
.ds-radio input{accent-color:#2563eb;margin-top:2px}
.ds-radio:hover{background:rgba(59,130,246,.08)}
.ds-radio span{
  display:block;
  position:static;
  min-width:0;
  white-space:normal;
  line-height:1.35;
  color:inherit;
  word-break:break-word
}
.ds-field{margin-top:10px}
.ds-label{display:block;font-weight:800;margin-bottom:6px}
.ds-textarea{width:100%;border-radius:14px;border:1px solid rgba(148,163,184,.35);padding:10px 12px;resize:none;background:rgba(255,255,255,.8)}
.ds-modal__card input,
.ds-modal__card select,
.ds-modal__card textarea{
  max-width:100%;
  width:100%;
  box-sizing:border-box;
}
.ds-help{font-size:.78rem;color:rgba(100,116,139,.9);margin-top:6px}
.ds-modal__actions{display:flex;justify-content:flex-end;gap:10px;margin-top:14px}
.ds-error{margin-top:10px;color:#b91c1c;font-weight:800}

/* ===== Cancel modal: sticky actions + scrollable body (mobile) ===== */
#cancelModal .ds-modal__card,
#cancelWindowModal .ds-modal__card{
  display:flex;
  flex-direction:column;
}
#cancelModal .ds-radio-list{
  max-height: 42dvh;
  overflow: auto;
  padding-right: 4px;
}
#cancelModal .ds-modal__actions,
#cancelWindowModal .ds-modal__actions{
  margin-top: auto;
  padding-top: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.92) 36%, rgba(255,255,255,.98) 100%);
  position: sticky;
  bottom: calc(-1 * env(safe-area-inset-bottom));
  z-index: 2;
}

.ds-modal__actions .btn{
  border-radius: 999px;
  font-weight: 700;
  padding: 8px 14px;
  font-size: 13px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, filter .18s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 140px;
}
.ds-modal__actions .btn:active{
  transform: translateY(1px);
}
.ds-modal__actions .btn-ghost{
  border: 1px solid rgba(148,163,184,.45);
  background: rgba(248,250,252,.9);
  color: #0f172a;
}
.ds-modal__actions .btn-ghost:hover{
  border-color: rgba(148,163,184,.85);
  box-shadow: 0 10px 22px rgba(15,23,42,.12);
  transform: translateY(-1px);
}
.ds-modal__actions .btn-danger{
  border: 1px solid rgba(239,68,68,.35);
  background: linear-gradient(135deg, rgba(239,68,68,.12), rgba(251,113,133,.18));
  color: #ef4444;
  box-shadow: 0 10px 22px rgba(239,68,68,.15);
}
.ds-modal__actions .btn-danger:hover{
  border-color: rgba(239,68,68,.6);
  box-shadow: 0 14px 30px rgba(239,68,68,.22);
  transform: translateY(-1px);
}
.ds-modal__actions .btn-primary{
  border: 1px solid rgba(37,99,235,.35);
  background: linear-gradient(180deg,#1a7cff,#0b63d1);
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(14,116,255,.28);
}
.ds-modal__actions .btn-primary:hover{
  border-color: rgba(37,99,235,.6);
  box-shadow: 0 16px 32px rgba(14,116,255,.35);
  transform: translateY(-1px);
}

.toast{
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: rgba(17,17,17,0.92);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  z-index: 400;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  max-width: min(520px, 92%);
}

.toast[hidden]{
  display: none;
}

/* Context menu */
.context-menu{
  position: fixed;
  min-width: 160px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(17,17,17,.12);
  background: rgba(255,255,255,.98);
  box-shadow: 0 12px 30px rgba(0,0,0,.14);
  z-index: 500;
}
.context-menu[hidden]{ display:none; }
.context-menu__item{
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #111111;
  cursor: pointer;
}
.context-menu__item:hover{
  background: rgba(0,0,0,.05);
}
.context-menu__item.danger{
  color: #d83030;
}

/* ===== LÍNEA ROJA DE HORA ACTUAL ===== */
.current-time-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #ff453a;
  z-index: 20;
}

.current-time-label {
  position: absolute;
  left: 8px;
  top: -10px;
  font-size: 12px;
  color: #ff453a;
}

/* ===== contenedor de eventos ===== */
.events-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.event-block {
  position: absolute;
  left: 70px;
  right: 10px;
  background: #0a84ff;
  border-radius: 10px;
  padding: 6px;
  font-size: 12px;
  pointer-events: auto;
}

.event-dot {
  width: 6px;
  height: 6px;
  background: #0a84ff;
  border-radius: 50%;
  margin: 4px auto 0;
}

/* ===== iOS light day-view look ===== */
:root{
  --bg: #ffffff;
  --text: #111111;
  --muted: #8e8e93;
  --line: #e5e5ea;
  --cardRadius: 12px;
  --pending: #3b82f6;
  --confirmed: #34c759;
  --cancelled: #ff3b30;
}

body{
  background: var(--bg);
  color: var(--text);
}

.top-bar, .day-header{
  background: var(--bg);
  color: var(--text);
}

.weekdays span{ color: var(--muted); }

.calendar-grid div{
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

/* ===== Month view full-bleed (Apple-style grid) ===== */
html, body{
  height: 100%;
}

.top-bar{
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.top-bar__left,
.top-bar__right{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.weekdays{
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.calendar-grid{
  background: var(--bg);
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  min-height: calc(100vh - 140px);
  grid-auto-rows: minmax(88px, 1fr);
}

.calendar-grid > div{
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: var(--dayPad);
  font-size: 13px;
  line-height: 1.2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  color: var(--text);
}

.calendar-grid > div:empty{
  background: #fafafb;
}


/* Apple-style month grid */
.top-bar{
  align-items: center;
  gap: 12px;
}

#monthTitle{
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.sync-badge{
  font-size: 11px;
  font-weight: 600;
  color: #0a3d7a;
  background: rgba(10,132,255,.12);
  border: 1px solid rgba(10,132,255,.25);
  padding: 4px 8px;
  border-radius: 999px;
}

.user-bar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px 6px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(148,163,184,.2);
  border-radius: 14px;
  margin: 8px 12px 6px;
  box-shadow: 0 8px 22px rgba(15,23,42,.08);
}
.user-bar{
  backdrop-filter: blur(10px);
}
.user-bar .user-actions{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
  position: relative;
}
.user-actions-primary{
  display:inline-flex;
  align-items:center;
  gap:8px;
}
.user-actions-more{
  position:absolute;
  top: calc(100% + 8px);
  right: 0;
  display:flex;
  flex-direction:column;
  gap:8px;
  min-width: 184px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.28);
  background: rgba(255,255,255,.96);
  box-shadow: 0 16px 34px rgba(15,23,42,.16);
  z-index: 12;
}
.user-actions-more[hidden]{
  display:none !important;
}
.btn-more{
  border-style: dashed;
}
.user-bar #userName{
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
  max-width: 48%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 640px){
  .user-bar{
    padding: 6px 10px;
    margin: 6px 8px 4px;
    gap: 8px;
    border-radius: 12px;
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .user-bar #userName{
    flex: 1 1 100%;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .user-bar .user-actions{
    width: 100%;
    margin-left: 0;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
  }
  .user-actions-primary{
    width: 100%;
    display:grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    align-items: stretch;
  }
  .user-actions-primary > button{
    min-width: 0;
    justify-content: center;
  }
  .user-actions-more{
    right: 0;
    left: auto;
    width: min(78vw, 240px);
  }
  .btn-page span,
  .btn-refresh span,
  .btn-logout span{
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .btn-logout, .btn-page, .btn-refresh{
    padding: 5px 8px;
    font-size: 11px;
  }
}
@media (max-width: 420px){
  .user-actions-primary{
    grid-template-columns: 1fr 1fr;
  }
  .user-actions-primary #moreActionsBtn{
    grid-column: 1 / -1;
  }
}

/* Mobile month view: abrir día directo, sin CTA extra */
@media (max-width: 1023px){
  .view-day-card{
    display: none !important;
  }
}
.user-bar #userName{
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}
.btn-logout{
  border: 1px solid rgba(148,163,184,.35);
  background: rgba(248,250,252,.9);
  color: #0f172a;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-logout:hover{
  border-color: rgba(148,163,184,.8);
  box-shadow: 0 10px 22px rgba(15,23,42,.12);
  transform: translateY(-1px);
}
.btn-page{
  border: 1px solid rgba(10,132,255,.35);
  background: rgba(10,132,255,.08);
  color: #0f172a;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-refresh{
  border: 1px solid rgba(59,130,246,.25);
  background: linear-gradient(135deg, rgba(239,246,255,.9), rgba(219,234,254,.9));
  color: #1d4ed8;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-refresh:hover{
  border-color: rgba(37,99,235,.45);
  box-shadow: 0 10px 22px rgba(37,99,235,.18);
  transform: translateY(-1px);
}
.btn-refresh:active{
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(37,99,235,.16);
}
.btn-refresh__spinner{
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: btn-refresh-spin .7s linear infinite;
  display: none;
}
.btn-refresh.is-loading .btn-refresh__icon{
  display: none;
}
.btn-refresh.is-loading .btn-refresh__spinner{
  display: inline-block;
}
@keyframes btn-refresh-spin{
  to { transform: rotate(360deg); }
}
.btn-page:hover{
  border-color: rgba(10,132,255,.6);
  box-shadow: 0 10px 22px rgba(15,23,42,.12);
  transform: translateY(-1px);
}
#goMyPageBtn{ display: none; }

.weekdays{
  margin: 4px 16px 8px;
}

.weekdays span{
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.calendar-grid{
  margin: 0 12px 8px;
  border-radius: 14px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}
.calendar-grid > div{
  position: relative;
}
.calendar-grid > div > *{
  position: relative;
  z-index: 2;
}
.calendar-grid > div.haptic-flash::after{
  z-index: 1;
}

.calendar-grid .calendar-day{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  position: relative;
  padding: var(--dayPad);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  min-height: 96px;
  overflow: hidden;
}

.calendar-day__num{
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.calendar-count{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: #0a58ca;
  pointer-events: none;
  z-index: 1;
}
.calendar-count span{
  position: relative;
  z-index: 2;
  white-space: nowrap;
  transform: translateY(10px);
}
.calendar-count-badge{
  position: absolute;
  top: 8px;
  right: 8px;
  border-radius: 999px;
  background: #0A84FF;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(10,132,255,.22);
}
.calendar-count-badge.is-dot{
  width: 9px;
  height: 9px;
  padding: 0;
}
.calendar-count-badge.is-pill{
  height: 20px;
  min-width: 20px;
  padding: 0 7px;
  letter-spacing: -0.2px;
  line-height: 1;
}
/* ===== iOS-style inversion when day is selected ===== */
.calendar-grid > div.is-selected .calendar-count-badge{
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}
.calendar-grid > div.is-selected .calendar-count-badge.is-pill{
  color: #0A84FF;
}
.calendar-grid > div.is-selected .calendar-count-badge.is-dot{
  background: #0A84FF;
  width: 8px;
  height: 8px;
}

/* ===== iOS subtle animations ===== */
@media (prefers-reduced-motion: no-preference){
  .calendar-count-badge{
    transform-origin: center;
  }
  .calendar-count-badge.pop-in{
    animation: badgePopIn 220ms cubic-bezier(.2,.9,.2,1) both;
  }
  @keyframes badgePopIn{
    0%   { transform: scale(.85); opacity: 0; filter: blur(.2px); }
    60%  { transform: scale(1.06); opacity: 1; filter: blur(0px); }
    100% { transform: scale(1.00); opacity: 1; }
  }
  @media (min-width: 1024px){
    .calendar-grid > div:hover .calendar-count-badge{
      transform: translateY(-1px);
      transition: transform 140ms ease;
    }
  }
}
@media (prefers-reduced-motion: reduce){
  .calendar-count-badge.pop-in{
    animation: none !important;
  }
}

/* ===== iOS "haptic visual" highlight on day cell ===== */
@media (prefers-reduced-motion: no-preference){
  .calendar-grid > div.haptic-flash{
    position: relative;
  }
  .calendar-grid > div.haptic-flash::after{
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 14px;
    background: rgba(10,132,255,.14);
    box-shadow: 0 0 0 1px rgba(10,132,255,.22) inset;
    opacity: 0;
    transform: scale(.98);
    animation: hapticFlash 240ms cubic-bezier(.2,.9,.2,1) both;
    pointer-events: none;
  }
  .calendar-grid > div.haptic-flash--danger::after{
    background: rgba(255,59,48,.14);
    box-shadow: 0 0 0 1px rgba(255,59,48,.22) inset;
  }
  @keyframes hapticFlash{
    0%   { opacity: 0; transform: scale(.98); }
    35%  { opacity: 1; transform: scale(1.00); }
    100% { opacity: 0; transform: scale(1.01); }
  }
}
@media (prefers-reduced-motion: reduce){
  .calendar-grid > div.haptic-flash::after{
    animation: none !important;
  }
}

@media (prefers-reduced-motion:no-preference){
  .calendar-grid > div{
    transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
  }
  .calendar-grid > div.is-selected{
    transform: translateY(-1px);
  }
}

/* ===== Snap focus (iOS-like) for Day Pane ===== */
#dayPane{ position: relative; }
@media (prefers-reduced-motion: no-preference){
  #dayPane{
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
  }

  #dayPane.is-snap-focused{
    transform: translateY(-1px);
  }

  #dayPane.snap-pop{
    animation: dayPaneSnapPop 260ms cubic-bezier(.2,.9,.2,1) both;
  }

  @keyframes dayPaneSnapPop{
    0%   { transform: translateY(0px) scale(.995); }
    55%  { transform: translateY(-2px) scale(1.003); }
    100% { transform: translateY(-1px) scale(1.000); }
  }

  #dayPane.snap-pop::after,
  #dayPane.is-snap-focused::after{
    content:"";
    position:absolute;
    inset: 10px;
    border-radius: 18px;
    pointer-events:none;
    opacity: 0;
    transition: opacity 160ms ease;
    background: rgba(10,132,255,.08);
    box-shadow:
      0 0 0 1px rgba(10,132,255,.18) inset,
      0 18px 50px rgba(2, 6, 23, .10);
  }

  #dayPane.is-snap-focused::after{ opacity: 1; }
  #dayPane.snap-pop::after{ opacity: 1; }
}

@media (prefers-reduced-motion: reduce){
  #dayPane.snap-pop{ animation:none !important; }
}

/* Guardrails anti-regresión */
.editor-pane[hidden]{ display:none !important; }
@media (min-width:1024px){
  .pane--month .calendar-grid > div{ min-height:0 !important; }
}
.calendar-grid .today .calendar-count span{
  transform: translateY(16px);
}
.calendar-day.has-events .calendar-day__num{
  z-index: 2;
}
.calendar-day.has-events .calendar-day__num::after{
  content: "";
  position: absolute;
  top: -6px;
  left: -6px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid rgba(17,17,17,.08);
  z-index: -1;
}
.calendar-day.is-selected .calendar-count{
  color: #084298;
}

.calendar-day.has-availability .calendar-day__num{
  position: relative;
}
.calendar-day.has-availability .calendar-day__num::after{
  content: "";
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(34,197,94,.35);
  border: 1px solid rgba(16,185,129,.45);
}

.calendar-events{
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  margin-top: 2px;
  max-height: calc(100% - 24px);
  overflow: hidden;
}

.calendar-event{
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #e9f1ff;
  border: 1px solid #d4e2ff;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.month-chip{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(10,132,255,.10);
  color: #0a3d7a;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 90%;
  padding-right: 8px;
  margin-right: 6px;
}
.month-chip::before{
  content: "";
  width: 5px;
  height: 8px;
  border-radius: 4px;
  background: var(--brand, #0a84ff);
}
.month-chip.scheduled{
  background: #dbeafe;
  color: #1e3a8a;
  border: 1px solid #bfdbfe;
}
.month-chip.scheduled::before{ background:#60a5fa; }

.month-chip.completed{
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.month-chip.completed::before{ background:#22c55e; }

.month-chip.cancelled{
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.month-chip.cancelled::before{ background:#f87171; }
.month-chip.canceled{
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.month-chip.canceled::before{ background:#f87171; }

.month-chip.no_show{
  background: #fef9c3;
  color: #92400e;
  border: 1px solid #fde68a;
}
.month-chip.no_show::before{ background:#f59e0b; }
.month-chip.pending{
  background: #dbeafe;
  color: #1e3a8a;
  border: 1px dashed #93c5fd;
}
.month-chip.pending::before{ background:#1e3a8a; }
.month-more{
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(17,17,17,.03);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  width: fit-content;
}

/* Month skeleton */
.calendar-grid.loading .calendar-day__num{
  color: transparent;
}
.calendar-grid.loading .calendar-day{
  position: relative;
}
.calendar-grid.loading .calendar-day::after{
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 12px;
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 45%, #f1f5f9 60%);
  background-size: 200% 100%;
  animation: shimmer 1.1s ease-in-out infinite;
}

@keyframes shimmer{
  0%{ background-position: 200% 0; }
  100%{ background-position: -200% 0; }
}

/* Day skeleton */
.day-skeleton{
  position: absolute;
  top: 10px;
  left: var(--time-col-width);
  right: var(--event-gutter);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.day-skeleton .skeleton-bar{
  height: 22px;
  border-radius: 10px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 45%, #f1f5f9 60%);
  background-size: 200% 100%;
  animation: shimmer 1.1s ease-in-out infinite;
}

/* Compact grid: keep 6 rows without scroll (mobile) */
@media (max-width: 1023px){
  .calendar-grid{
    min-height: auto;
    height: calc(100vh - 170px);
    grid-auto-rows: minmax(60px, 1fr);
  }
}

@media (max-width: 1023px) and (max-height: 780px){
  .calendar-grid{
    height: calc(100vh - 190px);
    grid-auto-rows: minmax(56px, 1fr);
  }
}

@media (max-width: 1023px) and (max-height: 680px){
  .calendar-grid{
    height: calc(100vh - 210px);
    grid-auto-rows: minmax(50px, 1fr);
  }
}

.calendar-event.pending{
  background: #fff4d6;
  border-color: #f0d8a2;
}
.calendar-event.confirmed{
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #166534;
}
.calendar-event.cancelled{
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
}
.calendar-event.canceled{
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
}
.calendar-event.more{
  background: transparent;
  border: none;
  color: #6b7280;
  padding-left: 2px;
}

.calendar-grid .calendar-day:not(:nth-child(7n)){
  border-right: 1px solid var(--line);
}

/* Ensure month grid lines are visible across full width */
.calendar-grid{
  margin: 0 8px 12px;
  gap: 0;
}

.calendar-grid{
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
}

/* Offline banner */
/* Offline banner content will live inside user-bar */
.offline-banner{
  display:none;
}
@media (max-width: 420px){
  .offline-banner{
    padding: 6px 8px;
    font-size: 11px;
    gap: 8px;
  }
  .offline-banner button{
    padding: 5px 8px;
    font-size: 11px;
  }
}

/* Responsive month grid sizing */
@media (max-height: 820px){
  .calendar-grid .calendar-day{
    min-height: 86px;
    font-size: 15px;
  }
  .calendar-day__num{ font-size: 15px; }
  .calendar-grid{ margin: 0 6px 10px; }
}
@media (max-height: 700px){
  .calendar-grid .calendar-day{
    min-height: 74px;
    font-size: 14px;
  }
  .calendar-day__num{ font-size: 14px; }
}
@media (max-width: 900px){
  .calendar-grid .calendar-day{
    min-height: 84px;
    font-size: 14px;
  }
  .calendar-day__num{ font-size: 14px; }
  .event-block{
    padding: 12px 12px;
    font-size: 15px;
  }
  .event-title{
    font-size: 15px;
  }
  .event-meta{
    font-size: 12px;
  }
  .event-sub{
    font-size: 13px;
  }
}

@media (min-width: 1200px){
  .event-block{
    padding: 14px 16px;
  }
  .event-title{
    font-size: 17px;
  }
  .event-meta{
    font-size: 14px;
  }
  .event-sub{
    font-size: 15px;
  }
}
@media (max-width: 640px){
  .calendar-grid .calendar-day{
    min-height: 72px;
    font-size: 13px;
  }
  .calendar-day__num{ font-size: 13px; }
}

.day-view{
  background: var(--bg);
}

.pane--day[hidden]{
  display: none !important;
}

@media (max-width: 1023px){
  #workspace{
    height: 100dvh;
    overflow: hidden;
  }
  .pane--month{
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  body.day-open{
    overflow: hidden;
    touch-action: pan-y;
  }
  body.day-open .pane--month{
    display: none;
  }
  body.day-open .pane--day{
    display: flex;
  }
  .day-view--sheet{
    transform: translateX(100%);
    opacity: 0;
    transition: transform 320ms cubic-bezier(.22,1,.36,1), opacity 220ms ease;
    will-change: transform, opacity;
    box-shadow: -24px 0 60px rgba(15,23,42,.12);
  }
  .day-view--sheet.is-visible{
    transform: translateX(0);
    opacity: 1;
  }
  .day-view--sheet.is-hiding{
    transform: translateX(100%);
    opacity: 0;
  }
  .nav-btn--back{
    width: 34px;
    height: 34px;
    font-size: 18px;
    box-shadow: 0 8px 18px rgba(15,23,42,.10);
  }
  .pane--day{
    position: fixed;
    inset: 0;
    z-index: 120;
    background: #ffffff;
    transform: translateX(100%);
    opacity: 0;
    transition: transform 320ms cubic-bezier(.22,1,.36,1), opacity 220ms ease;
    box-shadow: -24px 0 60px rgba(15,23,42,.12);
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    display: none;
    flex-direction: column;
    overflow: hidden;
  }
  .pane--day.is-visible{
    transform: translateX(0);
    opacity: 1;
    display: flex;
  }
  .pane--day.is-hiding{
    transform: translateX(100%);
    opacity: 0;
  }
  .pane--day .day-view{
    position: relative;
    inset: auto;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #ffffff;
  }
  .pane--day .day-header{
    position: sticky;
    top: 0;
    z-index: 40;
    padding-top: calc(12px + env(safe-area-inset-top));
  }
  .pane--day .hours-grid{
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    overflow: auto;
    background: #ffffff;
    padding-bottom: max(96px, env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }
  .pane--month .top-bar{
    padding-top: calc(10px + env(safe-area-inset-top));
  }
  .pane--month .user-bar{
    margin: 10px 12px 10px;
  }
  .pane--month .weekdays{
    margin: 8px 12px 8px;
  }
  .pane--month .calendar-grid{
    flex: 1 1 auto;
    min-height: 0;
    margin: 0 12px 8px;
    grid-auto-rows: minmax(0, 1fr);
  }
  .pane--month .calendar-day{
    min-height: 0;
  }
  .pane--month .view-day-card{
    position: sticky;
    bottom: max(8px, env(safe-area-inset-bottom));
    margin: 0 12px 12px;
  }
}

#dayView{
  position: relative;
}

.hours-grid{
  position: relative;
  padding: 12px 12px 28px 12px;
}

.refund-legend{
  position: sticky;
  bottom: 12px;
  margin: 10px 6px 12px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(148,163,184,0.35);
  box-shadow: 0 10px 24px rgba(15,23,42,.08);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  z-index: 8;
}

/* ===== iOS safe-area polish ===== */
:root{
  --sa-top: env(safe-area-inset-top, 0px);
  --sa-bot: env(safe-area-inset-bottom, 0px);
  --time-col-width: 76px;
  --event-gutter: 16px;
}

#workspace,
.pane--month,
.pane--day{
  height: 100dvh;
}

.top-bar{
  padding-top: calc(10px + var(--sa-top));
}
.pane--day .day-header{
  padding-top: calc(10px + var(--sa-top));
}

.hours-grid{
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: max(96px, var(--sa-bot));
}

.fab{
  bottom: calc(18px + var(--sa-bot));
}

/* ===== Day sheet: iOS handle ===== */
@media (max-width: 1023px){
  .pane--day{
    border-left: 1px solid rgba(17,17,17,.08);
    background: rgba(255,255,255,.98);
  }

  .pane--day .day-header{
    position: sticky;
    top: 0;
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding-top: calc(18px + var(--sa-top));
    padding-bottom: 10px;
  }

  .pane--day .day-header .day-title{
    margin-top: 2px;
  }

  .pane--day .day-header::before{
    content:"";
    position:absolute;
    left:50%;
    top: calc(8px + var(--sa-top));
    transform: translateX(-50%);
    width: 42px;
    height: 5px;
    border-radius: 999px;
    background: rgba(0,0,0,.14);
  }
}

/* ===== Touch targets ===== */
.nav-btn,
.btn-logout,
.btn-page,
.btn-refresh{
  min-width: 44px;
  min-height: 44px;
}

*{
  -webkit-tap-highlight-color: transparent;
}

/* ===== iOS typography feel ===== */
body{
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.event-time,
.hour-label,
.slot-time{
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ===== Press feel ===== */
@media (hover: none){
  .event-block{
    transition: transform 160ms ease, box-shadow 180ms ease, filter 160ms ease;
  }
  .event-block:active{
    transform: scale(.988);
  }
}

/* ===== Event layout premium en ancho angosto ===== */
@media (max-width: 860px){
  .event-grid{
    grid-template-columns: 1fr;
    row-gap: 6px;
  }

  .event-col--right{
    align-items: flex-start;
    text-align: left;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
  }

  .event-statuses,
  .event-time,
  .event-dur,
  .event-sub{
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .event-email{ display: none; }

  .event-title{
    font-size: 15px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .event-service{
    font-size: 12px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow: hidden;
  }
}

/* ===== Doctor mode: layout premium en ancho limitado ===== */
@media (max-width: 980px){
  .event-grid{
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 8px;
  }

  .event-col--right{
    min-width: 0;
    align-items: flex-end;
    gap: 6px;
  }

  .event-statuses{
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .event-statuses,
  .event-time,
  .event-sub{
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ===== Cuando el evento es chico: prioridad a lo esencial ===== */
.event-block.semi .event-email{ display:none; }
.event-block.compact .event-email,
.event-block.compact .event-meta{ display:none; }
.event-block.compact .event-statuses{ display:none; }

.event-time{
  font-size: 11px;
  font-weight: 700;
  opacity: .95;
}

.hour-row{
  position: relative;
  height: 94px;
  border-top: 1px solid var(--line);
  padding: 0;
}

.hour-label{
  position: absolute;
  left: 0;
  width: 66px;
  text-align: right;
  padding-right: 14px;
  top: -9px;
  font-size: 12.5px;
  color: var(--muted);
}

.events-layer{
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.event-block{
  position: absolute;
  left: var(--time-col-width);
  right: var(--event-gutter);
  border-radius: var(--cardRadius);
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  box-sizing: border-box;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  pointer-events: auto;
  box-shadow: 0 18px 38px rgba(15,23,42,.12);
  border: 1px solid rgba(148,163,184,.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: grab;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}
.event-block::before{
  content:"";
  position:absolute;
  left:0;
  top:0;
  bottom:0;
  width:4px;
  background: rgba(255,255,255,.35);
  opacity:.9;
}
.event-block.confirmed::before{ background: rgba(255,255,255,.55); }
.event-block.pending::before{ background: rgba(255,255,255,.45); }
.event-block.canceled::before,
.event-block.cancelled::before{ background: rgba(255,255,255,.45); }
.event-block::after{
  content:"";
  position:absolute;
  inset:0;
  background: rgba(255,255,255,0);
  transition: background 140ms ease;
  pointer-events:none;
}
.event-block:active::after,
.event-block.is-tapping::after{
  background: rgba(255,255,255,.10);
}
.event-block *{
  color: inherit;
}
.event-grid{
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, .6fr);
  column-gap: 10px;
  row-gap: 4px;
  height: 100%;
  min-width: 0;
}
.event-col{
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}
.event-col--right{
  align-items: flex-end;
  text-align: right;
}
.event-block:hover{
  transform: translateY(-2px);
  box-shadow: 0 22px 46px rgba(15,23,42,.24);
  filter: saturate(1.03);
}
.event-block:active{
  transform: translateY(0);
  box-shadow: 0 12px 28px rgba(15,23,42,.14);
}
.event-block:hover{
  transform: translateY(-2px);
  box-shadow: 0 22px 46px rgba(15,23,42,.20);
  filter: saturate(1.03);
}
.event-block:active{
  transform: translateY(0);
  box-shadow: 0 12px 28px rgba(15,23,42,.14);
}
.event-block.is-dragging{
  cursor: grabbing;
  transform: scale(1.02);
  box-shadow: 0 18px 40px rgba(15,23,42,.18);
  filter: saturate(1.05);
  z-index: 999;
}
.event-block.is-no-drag{
  cursor: not-allowed;
  opacity: 0.92;
}
.event-block.is-drop{
  animation: eventDrop 280ms ease;
}
@keyframes eventDrop{
  0%{ transform: scale(1.02); box-shadow: 0 18px 40px rgba(15,23,42,.18); }
  100%{ transform: scale(1); box-shadow: 0 1px 0 rgba(0,0,0,0.04); }
}
.event-ghost{
  position: absolute;
  left: var(--time-col-width);
  right: var(--event-gutter);
  border-radius: var(--cardRadius);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(15,23,42,0.65);
  background: rgba(99, 102, 241, 0.12);
  border: 1px dashed rgba(99, 102, 241, 0.35);
  box-shadow: 0 10px 28px rgba(15,23,42,.10);
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  touch-action: none;
}
.event-ghost__time{
  font-weight: 700;
  color: rgba(30, 64, 175, .9);
}

.event-block.patient-slot{
  background: rgba(15,23,42,0.04);
  border: 1px solid rgba(17,17,17,.08);
  color: #0f172a;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 16px;
  min-width: 0;
  padding: 14px 14px;
  line-height: 1.15;
  white-space: normal;
  word-break: break-word;
  hyphens: auto;
  box-shadow: 0 12px 28px rgba(15,23,42,.10);
  gap: 4px;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease;
}

.event-block,
.event-block.patient-slot{
  box-sizing: border-box;
  width: auto;
  max-width: none;
  border-radius: var(--cardRadius);
}

.event-block.patient-slot.is-free{
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(37,99,235,.22), rgba(37,99,235,0)),
    linear-gradient(180deg, rgba(239,246,255,0.95), rgba(226,232,255,0.85));
  border-color: rgba(37,99,235,0.35);
  color: #0b1b3b;
}
.event-block.patient-slot.is-paid{
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(16,185,129,.20), rgba(16,185,129,0)),
    linear-gradient(180deg, rgba(239,246,255,0.95), rgba(226,232,255,0.85));
  border-color: rgba(16,185,129,.40);
  color: #0b1b3b;
}
.event-block.patient-slot.is-free:hover{
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(37,99,235,.26), rgba(37,99,235,0)),
    linear-gradient(180deg, rgba(239,246,255,1), rgba(219,234,254,0.95));
  transform: translateY(-1px);
  box-shadow: 0 22px 46px rgba(15,23,42,.14);
}
.event-block.patient-slot.is-free:active,
.event-block.patient-slot.is-free.is-tapping{
  transform: translateY(0) scale(0.985);
  box-shadow: 0 14px 28px rgba(15,23,42,.12);
}
.event-block.patient-slot.is-busy{
  background:
    repeating-linear-gradient(
      135deg,
      rgba(148,163,184,0.16) 0px,
      rgba(148,163,184,0.16) 10px,
      rgba(148,163,184,0.24) 10px,
      rgba(148,163,184,0.24) 20px
    ),
    linear-gradient(180deg, rgba(241,245,249,0.96), rgba(226,232,240,0.92));
  border-color: rgba(148,163,184,0.55);
  color: rgba(15,23,42,0.75);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.65);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.event-block.patient-slot.is-busy .slot-badge{
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(15,23,42,0.7);
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(148,163,184,0.35);
  backdrop-filter: blur(6px);
}
.event-block.patient-slot .slot-time{
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.event-block.patient-slot .slot-status{
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(30, 64, 175, 0.95);
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.event-block.patient-slot .slot-service{
  font-size: 12px;
  font-weight: 600;
  color: rgba(15, 23, 42, 0.78);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* =========================
   Patient Day Slot (Apple-like)
   ========================= */
.p-slot{
  position: absolute;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;

  padding: 14px 14px;
  border-radius: 18px;

  background: rgba(255,255,255,.92);
  border: 1px solid rgba(148,163,184,.22);
  box-shadow: 0 14px 34px rgba(15,23,42,.10);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  text-align: left;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  user-select: none;
  touch-action: pan-y;
  pointer-events: auto;
  z-index: 3;

  transition:
    transform .16s ease,
    box-shadow .18s ease,
    border-color .18s ease,
    background .18s ease;
}

.p-slot:active{
  transform: scale(.985);
}

.p-slot__time{
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: rgba(15,23,42,.92);
  font-variant-numeric: tabular-nums;
}

.p-slot__meta{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}

.p-slot__dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(37,99,235,.88);
  box-shadow: 0 0 0 6px rgba(37,99,235,.10);
}

.p-slot__label{
  font-size: 13px;
  font-weight: 700;
  color: rgba(15,23,42,.68);
}

/* Selected */
.p-slot.is-selected{
  border-color: rgba(37,99,235,.40);
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(37,99,235,.18), rgba(37,99,235,0)),
    rgba(255,255,255,.92);
  box-shadow: 0 16px 42px rgba(37,99,235,.16), 0 14px 34px rgba(15,23,42,.10);
}

.p-slot.is-selected .p-slot__dot{
  background: rgba(37,99,235,1);
  box-shadow: 0 0 0 6px rgba(37,99,235,.14);
}

.p-slot.is-selected .p-slot__label{
  color: rgba(37,99,235,.95);
}

/* Disabled */
.p-slot.is-disabled{
  opacity: .55;
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

.p-slot.is-disabled .p-slot__dot{
  background: rgba(148,163,184,.9);
  box-shadow: 0 0 0 6px rgba(148,163,184,.12);
}

.p-slot.is-disabled .p-slot__label{
  color: rgba(100,116,139,.75);
}
.event-block.patient-slot .slot-title{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 100%;
}
.event-block.patient-slot .slot-title{
  font-size: 13px;
  font-weight: 700;
  color: rgba(15,23,42,.92);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-block.patient-slot .slot-money{
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(16,185,129,.12);
  color: rgba(5,150,105,1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
}
.event-block.patient-slot .slot-check{
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(37,99,235,0.12);
  color: #1d4ed8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.event-sub{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-top: 4px;
  background: rgba(255,255,255,0.18);
  color: #ffffff;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-sub--pending{
  color: #0f172a;
  background: rgba(245,158,11,0.14);
  border: 1px solid rgba(245,158,11,0.22);
}
.event-sub--paid{
  color: #0f172a;
  background: rgba(16,185,129,0.14);
  border: 1px solid rgba(16,185,129,0.22);
}
.event-sub--refund{
  color: #0f172a;
  background: rgba(37,99,235,0.14);
  border: 1px solid rgba(37,99,235,0.22);
}
.event-sub--refunded{
  color: #0f172a;
  background: rgba(34,197,94,0.14);
  border: 1px solid rgba(34,197,94,0.22);
}
.event-sub--canceled{
  color: #0f172a;
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.22);
}
.event-statuses{
  margin-top: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 10px;
  row-gap: 4px;
  min-width: 0;
}
.event-statuses.is-single > .event-sub{
  grid-column: 1 / -1;
}
.event-statuses > *{
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}
.event-status-text{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-status-text--paid{
  background: rgba(255,255,255,.22);
  color: rgba(220,252,231,.95);
}

/* ===== Slot confirmado Apple-like ===== */
.event-block.confirmed{
  display: flex;
  align-items: stretch;
  padding: 10px 12px;
  line-height: 1.15;
}
.event-block.confirmed .event-grid{
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto 1fr;
  row-gap: 4px;
  column-gap: 10px;
  height: 100%;
}
.event-block.confirmed .event-time{
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 700;
  opacity: .9;
  white-space: nowrap;
}
.event-block.confirmed .event-title{
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.event-block.confirmed .event-meta{
  font-size: 12px;
  opacity: .9;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.event-block.confirmed .event-col--right{
  align-items: flex-end;
  justify-content: flex-start;
}
.event-block.confirmed .event-status{
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.event-title{
  font-weight: 600;
  line-height: 1.2;
  font-size: 16px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  white-space: normal;
}

.event-meta{
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.25;
  opacity: 0.94;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 10px;
  row-gap: 4px;
  overflow: hidden;
}
.event-meta > *{
  min-width: 0;
}
.event-service{
  font-weight: 600;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  white-space: normal;
}
.event-email{
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 600;
  opacity: .9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.field-note{
  margin-top: 6px;
  font-size: 12px;
  color: rgba(15,23,42,0.6);
}
#paymentStatusNote{
  font-size: 14px;
  font-weight: 700;
  color: rgba(15,23,42,0.95);
  letter-spacing: -0.01em;
}
.payment-note--paid{ color: #0f766e; }
.payment-note--pending{ color: #b45309; }
.payment-note--refund{ color: #1d4ed8; }
.payment-note--refunded{ color: #16a34a; }
.payment-note--canceled{ color: #dc2626; }
.editor-lock-banner{
  margin: 4px 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15,118,110,.28);
  background: rgba(15,118,110,.12);
  color: #0f766e;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.event-modality{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  width: fit-content;
}
.event-modality.online{
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}
.event-modality.presencial{
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.event-time,
.event-dur{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Compact: conserva todo, pero más denso */
.event-block.compact .event-meta{
  display: grid;
  font-size: 11px;
  opacity: .88;
}
.event-block.compact .event-statuses{
  display: block;
}
.event-block.compact .event-grid{
  grid-template-columns: 1fr;
}
.event-block.compact .event-col--right{
  align-items: flex-start;
  text-align: left;
}
.event-block.compact .event-col{
  min-height: 0;
}
.event-block.compact .event-title,
.event-block.compact .event-sub,
.event-block.compact .event-time{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.event-block.compact .event-title{
  -webkit-line-clamp: 1;
  font-size: 14px;
}
.event-block.compact .event-service,
.event-block.compact .event-email{
  display: none;
}
.event-block.compact .event-modality{
  display: none;
}

/* Semi: muestra solo hora, oculta duración */
.event-block.semi .event-dur{
  display: none;
}
.event-block.semi .event-email,
.event-block.semi .event-service{
  display: none;
}
.event-block.semi .event-title{
  -webkit-line-clamp: 1;
}
.event-block.semi .event-col{
  min-height: 0;
}
.event-block.semi .event-title,
.event-block.semi .event-sub,
.event-block.semi .event-time{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes busyShake{
  0%{ transform: translateX(0); }
  30%{ transform: translateX(-2px); }
  60%{ transform: translateX(2px); }
  100%{ transform: translateX(0); }
}
.event-block.patient-slot.is-busy.is-shaking{
  animation: busyShake 120ms ease;
}

.event-clip{
  display: inline-block;
  margin-top: 6px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0,0,0,.18);
  color: rgba(255,255,255,.95);
}
.event-block.compact .event-clip{ display:none; }

/* status colors */
.event-block.pending{ background: linear-gradient(135deg, #0ea5e9, #2563eb); border: 1px solid rgba(255,255,255,0.18); }
.event-block.confirmed{ background: linear-gradient(135deg, #10b981, #34d399); border: 1px solid rgba(255,255,255,0.18); }
.event-block.cancelled{ background: linear-gradient(135deg, #ef4444, #f97316); border: 1px solid rgba(255,255,255,0.18); }
.event-block.canceled{ background: linear-gradient(135deg, #ef4444, #f97316); border: 1px solid rgba(255,255,255,0.18); }
.event-block.scheduled{ background: linear-gradient(135deg, #1677ff, #5aa7ff); border: 1px solid rgba(255,255,255,0.18); }
.event-block.completed{ background: linear-gradient(135deg, #10b981, #34d399); border: 1px solid rgba(255,255,255,0.18); }
.event-block.no_show{ background: linear-gradient(135deg, #f59e0b, #fbbf24); border: 1px solid rgba(255,255,255,0.18); }

/* línea roja */
.current-time-line{
  background: #ff3b30;
  height: 2px;
}
.current-time-label{
  color: #ff3b30;
}

/* FAB estilo iOS simple */
.fab{
  background: #007aff;
}

/* Tap feedback */
.tap-feedback{
  transition: transform 160ms ease, box-shadow 180ms ease, filter 160ms ease;
}
.tap-feedback.is-tapping{
  transform: scale(0.985);
  filter: saturate(1.03);
}

/* Month/day nav buttons (Finder-like) */
.nav-btn{
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #d8d8de;
  background: #f5f5f7;
  color: #111111;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
  transition: box-shadow 180ms ease, transform 160ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.nav-btn:active{
  transform: translateY(1px);
  box-shadow: none;
}

.nav-btn--back{
  width: 28px;
  height: 28px;
  font-size: 16px;
  position: relative;
  background: linear-gradient(180deg, #eef4ff 0%, #dbeafe 100%);
  border-color: rgba(59,130,246,0.35);
  color: #1d4ed8;
  box-shadow: 0 10px 22px rgba(30,64,175,0.18), 0 1px 0 rgba(255,255,255,0.7) inset;
}

.nav-btn--back:hover{
  box-shadow: 0 16px 36px rgba(30,64,175,0.28), 0 0 0 3px rgba(0,113,227,0.18);
  border-color: rgba(0,113,227,0.45);
}

.nav-btn--back::after{
  content: "Regresar";
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(-6px);
  opacity: 0;
  pointer-events: none;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15,23,42,0.9);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(15,23,42,0.25);
  transition: opacity 160ms ease, transform 160ms ease;
}

.nav-btn--back:hover::after{
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (hover: none){
  .nav-btn--back::after{ display:none; }
}

.day-header{
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
}

.day-header__title{
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
}

.day-header__title h2{
  margin: 0;
}

.day-header__spacer{
  width: 32px;
  height: 32px;
}

.empty-state{
  position: absolute;
  left: 0;
  right: 0;
  top: var(--day-header-offset, 92px);
  bottom: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 18px;
  pointer-events: none;
}

.empty-state__card{
  width: min(420px, 100%);
  background: rgba(242, 242, 247, 0.92);
  border: 1px solid rgba(229, 229, 234, 1);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}

.empty-state__title{
  font-size: 16px;
  font-weight: 700;
  color: #111111;
  line-height: 1.25;
}

.empty-state__subtitle{
  margin-top: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #6b6b6f;
  line-height: 1.35;
}

.day-notice{
  margin: 10px 0 12px 0;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  color: rgba(0,0,0,.72);
  background: rgba(0,0,0,.05);
  backdrop-filter: blur(10px);
}

.event-block.clipped{
  box-shadow: 0 18px 38px rgba(15,23,42,.10), inset 0 0 0 1px rgba(255,255,255,.20);
}

/* Apple-style day view refinements */
.day-view{
  background: #f7f7fb;
}

.day-header{
  position: sticky;
  top: 0;
  z-index: 40;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}

.day-header__title h2{
  font-weight: 700;
  letter-spacing: -0.2px;
}

.hours-grid{
  background: #ffffff;
  padding: 10px 0 28px 0;
}

.hours-grid::before{
  content: "";
  display: none;
}

.hours-canvas{
  position: relative;
}

.hours-canvas::before{
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 72px;
  width: 1px;
  background: var(--line);
  z-index: 1;
  pointer-events: none;
}

.hour-row{
  border-top: 1px solid #e9e9ee;
}

.hour-label{
  font-size: 11px;
  color: #9a9aa1;
}

.current-time-line{
  background: #ff3b30;
  height: 2px;
}

.current-time-line::before{
  content: "";
  position: absolute;
  left: 66px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ff3b30;
}


/* ===============================
   Premium polish (Month View)
   Pegar al FINAL de agenda.css
================================ */

:root{
  --bg-app: #f5f5f7;
  --surface: #ffffff;
  --text: #111111;
  --muted: #6b7280;
  --line: rgba(17,17,17,.08);
  --shadow: 0 10px 30px rgba(17,17,17,.08);
  --shadow-sm: 0 6px 16px rgba(17,17,17,.08);
  --brand: #0a84ff;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 12px;
  --dayPad: 10px;
}

html, body{ height: 100%; }
body{
  background: var(--bg-app);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Roboto, Helvetica, Arial;
}

/* Top bar premium */
.top-bar{
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--bg-app) 72%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

#monthTitle{
  margin: 0;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.4px;
  text-transform: capitalize;
}

/* Nav buttons */
.nav-btn{
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.75);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.nav-btn:hover{ box-shadow: var(--shadow-sm); }
.nav-btn:active{ transform: translateY(1px); }

/* Weekdays row */
.weekdays{
  margin: 10px 16px 10px;
  padding: 8px 10px;
  background: rgba(255,255,255,.6);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.weekdays span{
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--muted);
  text-transform: uppercase;
}

/* Calendar container as a card */
.calendar-grid{
  margin: 0 16px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
}

/* Cells */
.calendar-grid > div{
  min-height: 104px;
  padding: 10px 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  background: var(--surface);
}

/* Remove right border on last column */
.calendar-grid > div:nth-child(7n){
  border-right: none;
}

/* Empty leading cells */
.calendar-grid > div:empty{
  background: linear-gradient(180deg, rgba(17,17,17,.02), rgba(17,17,17,.00));
}

/* Day number styling: wrap with pseudo “badge” effect */
.calendar-grid .calendar-day{
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}
.calendar-grid .calendar-day::first-letter{ /* noop, keeps selector stable */ }

/* Today: not a huge blue blob; a refined badge */
.calendar-grid .today{
  background: var(--surface) !important;
  width: auto;
  height: auto;
  margin: 0;
  border-radius: 0;
  display: flex;
  color: var(--text) !important;
  padding-top: 10px;
}
.calendar-grid .today::before{
  content: "";
  position: absolute;
  top: 10px;
  left: 10px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 10px 20px rgba(10,132,255,.22);
}
.calendar-grid .today .calendar-day__num{
  position: relative;
  z-index: 2;
  color: #ffffff;
}
.calendar-grid .today.has-events .calendar-day__num{
  color: #ffffff;
}
.calendar-grid .today.has-events .calendar-day__num::after{
  background: transparent;
  border-color: transparent;
}

/* Hover / active */
.calendar-grid > div:hover{
  background: rgba(10,132,255,.04);
}
.calendar-grid > div:active{
  transform: translateY(1px);
}

/* Event dot -> make it more subtle/premium */
.event-dot{
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 6px 14px rgba(10,132,255,.25);
  margin-top: 2px;
}

/* FAB premium */
.fab{
  background: var(--brand);
  box-shadow: 0 16px 40px rgba(10,132,255,.30);
}
.fab:active{ transform: translateY(1px); }


.calendar-day.is-selected{
  background: linear-gradient(180deg, #eef5ff 0%, #dbeafe 100%);
  box-shadow:
    inset 0 0 0 1px rgba(96,165,250,.55),
    inset 0 1px 0 rgba(255,255,255,.9),
    0 10px 22px rgba(59,130,246,.10);
}

.calendar-day.is-selected .calendar-day__num{
  color: #0b5ed7;
}

/* ===== View Day Card (iOS-like) ===== */
.view-day-card{
  position: sticky;
  bottom: 12px;
  z-index: 45;
  margin: 10px 16px 16px;
}

.view-day-card[hidden]{ display:none; }

.view-day-card__btn{
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  padding: 14px 36px 14px 14px;
  border-radius: 16px;
  border: 1px solid rgba(17,17,17,.10);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px rgba(0,0,0,.10);
  cursor: pointer;
  position: relative;
  transition: transform 140ms ease, box-shadow 180ms ease, background 180ms ease;
}
.view-day-card__btn::after{
  content: "›";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: #9ca3af;
}
.view-day-card__btn:hover{
  background: rgba(255,255,255,.98);
  box-shadow: 0 14px 34px rgba(0,0,0,.12);
}
.view-day-card__btn:active{
  transform: translateY(1px);
}

.view-day-card__title{
  font-size: 13px;
  font-weight: 700;
  color: #6b7280;
}

.view-day-card__subtitle{
  font-size: 15px;
  font-weight: 700;
  color: #111111;
  letter-spacing: -0.2px;
}

/* ===============================
   DESKTOP WORKSPACE (Month | Day | Editor)
   - 2 columnas por defecto
   - 3 columnas cuando editor está abierto
   - Mobile conserva overlays
================================ */

.workspace{
  min-height: 100vh;
}

/* Desktop layout */
@media (min-width: 1024px){
  body{
    overflow: hidden;
  }

  .workspace{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 12px;
    align-items: stretch;
    height: 100vh;
  }

  .workspace.has-editor{
    grid-template-columns: 1fr 1fr 1fr;
  }

.pane{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  backdrop-filter: none;
  height: 100%;
}

@media (max-width: 720px){
  .event-block{
    padding: 8px 10px;
    gap: 2px;
  }
  .event-service,
  .event-email,
  .event-dur,
  .event-modality,
  .event-clip{
    display: none;
  }
  .event-email{
    display: none;
  }
  .event-grid{
    grid-template-columns: 1fr auto;
    row-gap: 2px;
  }
  .event-col{
    gap: 2px;
  }
  .event-title{
    -webkit-line-clamp: 1;
  }
  .event-statuses{
    margin-top: 0;
    grid-template-columns: 1fr;
    justify-items: end;
  }
  .event-sub{
    font-size: 11px;
    padding: 3px 8px;
    margin-top: 0;
  }
  .event-time,
  .event-dur{
    font-size: 12px;
  }
}
.pane:focus-within{
  outline: 2px solid rgba(0, 122, 255, 0.25);
  outline-offset: -2px;
  border-radius: 16px;
}

  /* Month pane */
  .pane--month{
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
  }
  .pane--month .calendar-grid{
    height: 100%;
    flex: 1;
    min-height: 0;
    margin: 0 16px 16px;
    grid-auto-rows: minmax(0, 1fr);
  }
  .pane--month .calendar-grid > div{
    min-height: 0;
  }
  .pane--month .weekdays{
    margin: 10px 16px 10px;
  }
  .pane--month .top-bar{
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg-app) 72%, transparent);
    backdrop-filter: blur(12px);
  }
  /* En desktop no usamos “Ver día” card */
  .pane--month .view-day-card{
    display: none;
  }

  /* Day pane */
  #dayView.day-view{
    position: relative;
    inset: auto;
    height: 100%;
    overflow: hidden;
    background: transparent;
  }
  .pane--day{
    min-width: 0;
    height: 100%;
  }
  .pane--day .day-header{
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: color-mix(in srgb, var(--bg-app) 72%, transparent);
    backdrop-filter: blur(12px);
  }
  .pane--day .hours-grid{
    height: calc(100% - 64px);
    overflow: auto;
    border-radius: 0;
    background: var(--surface);
    padding-bottom: 96px;
  }
  /* Back button no tiene sentido en desktop */
  #backBtn{
    visibility: hidden;
  }
  .pane--day .fab{
    position: absolute;
    right: 16px;
    bottom: 16px;
    margin: 0;
    z-index: 50;
  }

  /* Editor pane (3ra columna) */
  .editor-pane{
    position: relative;
    display: block;
    min-width: 0;
    overflow: hidden;
  }
  /* Hidden must always win */
  .editor-pane[hidden]{
    display: none !important;
  }
  .editor-backdrop{
    display: none;
  }
  .editor-card{
    height: 100%;
    overflow: auto;
    background: rgba(255,255,255,.92);
    border-radius: 18px;
    border: 1px solid rgba(17,17,17,.08);
    box-shadow: 0 18px 50px rgba(17,17,17,.10);
  }

  /* Smooth premium motion */
  .workspace,
  .pane,
  .editor-card{
    transition: grid-template-columns 280ms cubic-bezier(.2,.9,.2,1),
                transform 280ms cubic-bezier(.2,.9,.2,1),
                opacity 220ms ease;
  }
}

/* Mobile editor: overlay / bottom sheet */
.editor-pane{
  position: fixed;
  inset: 0;
  z-index: 220;
}

/* Hidden must always win */
.editor-pane[hidden]{
  display: none !important;
}

.editor-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.28);
  opacity: 0;
  transition: opacity 220ms ease;
}

.editor-card{
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #ffffff;
  border-radius: 18px 18px 0 0;
  padding: 16px;
  max-height: 92vh;
  overflow: auto;
  transform: translateY(12px);
  opacity: 0;
  transition: transform 260ms cubic-bezier(.2,.9,.2,1), opacity 200ms ease;
}

.editor-pane.is-open .editor-backdrop{
  opacity: 1;
}

.editor-pane.is-open .editor-card{
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1023px){
  .editor-card{
    max-height: calc(100dvh - max(8px, var(--sa-top)));
    padding: 16px 16px calc(20px + var(--sa-bot));
  }
  .editor-card .modal-header{
    position: sticky;
    top: 0;
    z-index: 6;
    margin: 0 0 12px;
    padding: 6px 0 10px;
    background: linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(255,255,255,.95) 76%, rgba(255,255,255,0) 100%);
    border-bottom: 1px solid rgba(226,232,240,.8);
  }
}

@media (min-width: 1024px){
  .editor-pane{
    position: relative;
    inset: auto;
    z-index: auto;
  }
  .editor-card{
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    max-height: none;
    padding: 16px;
    transform: none;
    opacity: 1;
  }
}

@media (min-width:1024px){
  :root{ --dayPad: 12px; }
}

@media (min-width: 1024px){
  .pane--month .calendar-grid{
    height: 100%;
    grid-auto-rows: 1fr;
  }
  .pane--month .calendar-grid > div{
    min-height: 0 !important;
  }
}

@media (min-width: 1024px){
  .event-block{
    border-radius: var(--cardRadius);
    padding: 12px 14px;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    box-shadow: 0 18px 38px rgba(15,23,42,.12);
    border: 1px solid rgba(148,163,184,.28);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  .event-title{
    font-size: 16px;
  }
  .event-meta{
    font-size: 13px;
  }
  .event-sub{
    font-size: 14px;
  }
  .event-block.patient-slot{
    font-size: 14px;
    box-shadow: 0 12px 28px rgba(15,23,42,.10);
  }
  .event-block.patient-slot .slot-time{
    font-size: 16px;
  }
  .event-block.patient-slot .slot-status{
    font-size: 12.5px;
  }
}

/* Top-month actions (Apple-like): move old user actions into month header menu */
.user-bar{
  display: none !important;
}

.top-bar__right{
  position: relative;
  gap: 12px;
}

.top-bar__left{
  gap: 12px;
}

.nav-btn--more{
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.35);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.94));
  box-shadow: 0 8px 22px rgba(15,23,42,.10), inset 0 1px 0 rgba(255,255,255,.95);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
}

.nav-btn--more i{
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.nav-btn--more:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(15,23,42,.12), inset 0 1px 0 rgba(255,255,255,.98);
}

.month-actions-menu{
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(240px, 78vw);
  padding: 8px;
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,.26);
  background: rgba(255,255,255,.96);
  box-shadow: 0 20px 42px rgba(15,23,42,.18);
  backdrop-filter: blur(14px);
  z-index: 40;
  gap: 6px;
}

.day-header{
  grid-template-columns: auto 1fr auto;
  gap: 12px;
}

.day-header__left,
.day-header__right{
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.day-header__right{
  position: relative;
}

.day-header__title{
  justify-self: center;
}

.day-actions-menu{
  right: 0;
  top: calc(100% + 10px);
}

.month-actions-menu .btn-page,
.month-actions-menu .btn-refresh,
.month-actions-menu .btn-logout{
  width: 100%;
  justify-content: flex-start;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid rgba(148,163,184,.22);
  background: rgba(248,250,252,.9);
  color: #0f172a;
}

.month-actions-menu .btn-page:hover,
.month-actions-menu .btn-refresh:hover,
.month-actions-menu .btn-logout:hover{
  background: rgba(239,246,255,.9);
  border-color: rgba(59,130,246,.28);
  transform: none;
  box-shadow: none;
}

@media (max-width: 1023px){
  .top-bar{
    padding-right: max(12px, var(--sa-right));
  }
  .top-bar__left,
  .top-bar__right,
  .day-header__left,
  .day-header__right{
    gap: 14px;
  }
  .month-actions-menu{
    right: 0;
    width: min(240px, calc(100vw - 32px));
  }
}
