/* ── OVERLAY ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0, 0, 0, .72);
  z-index: 1000;
  align-items: center; justify-content: center;
  padding: 1.5rem;
  backdrop-filter: blur(5px);
}
.modal-overlay.open { display: flex; }

/* ── BOX ── */
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2rem;
  width: 100%; max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 28px 72px rgba(0, 0, 0, .65);
  animation: popIn .22s cubic-bezier(.22, 1, .36, 1);
}
#modal-staff .modal { max-width: 720px; }
@keyframes popIn {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .modal { animation: none; }
}

.modal-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}
.modal-title { font-size: 1.3rem; font-weight: 700; color: var(--text-light); }
.modal-close {
  width: 38px; height: 38px;
  border-radius: 9px; border: 1px solid var(--border);
  background: transparent; cursor: pointer;
  font-size: 1.05rem; color: var(--text-gray);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-light); border-color: var(--primary); }
.modal-close:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.modal-footer {
  display: flex; gap: .85rem;
  margin-top: 1.75rem;
  justify-content: flex-end;
}

/* ── FORMS ── */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-size: .8rem; font-weight: 600;
  color: var(--text-gray); margin-bottom: .45rem;
  text-transform: uppercase; letter-spacing: .04em;
}

input[type=text],
input[type=email],
input[type=time],
input[type=number],
select,
textarea {
  width: 100%; padding: .75rem 1rem;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: .95rem; color: var(--text-light);
  background: var(--bg-input); outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.file-field {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  padding: .45rem .6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
}
.file-input-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.file-pick-btn {
  flex-shrink: 0;
}
.file-name {
  flex: 1;
  min-width: 0;
  font-size: .82rem;
  color: var(--text-gray);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-name.has-file {
  color: var(--text-light);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(9, 131, 214, .18);
}
input:disabled,
select:disabled {
  background: var(--bg-card);
  color: var(--text-gray);
  cursor: default;
}
textarea { resize: vertical; min-height: 100px; }

/* Select arrow color fix for dark bg */
select { color-scheme: dark; }

.form-row  { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.field-hint { font-size: .8rem; color: var(--text-gray); margin-top: .35rem; }

/* ── DROPDOWN CHECKLIST ── */
.dropdown { position: relative; }
.dropdown-trigger {
  width: 100%; padding: .75rem 1rem;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: .95rem; color: var(--text-light);
  background: var(--bg-input); cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  text-align: left; transition: border-color .15s, box-shadow .15s;
}
.dropdown-trigger:focus,
.dropdown-trigger:hover {
  outline: none; border-color: var(--primary);
}
.dropdown-trigger:focus { box-shadow: 0 0 0 3px rgba(9, 131, 214, .18); }
.dropdown-panel {
  position: absolute;
  top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 36px rgba(0, 0, 0, .5);
  z-index: 200; max-height: 220px; overflow-y: auto;
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(-6px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.dropdown-panel.open {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .dropdown-panel { transition: opacity .12s ease; }
}
.dropdown-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .75rem 1rem; cursor: pointer;
  font-size: .95rem; color: var(--text-light);
  transition: background .1s; user-select: none;
}
.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item input[type=checkbox] {
  width: 17px; height: 17px;
  cursor: pointer; accent-color: var(--primary); flex-shrink: 0;
}
.dropdown-empty { padding: .85rem 1rem; font-size: .88rem; color: var(--text-gray); }

/* ── BLOQUES NO DISPONIBLES ── */
.nd-item {
  display: flex; align-items: center; gap: .6rem;
  margin-bottom: .5rem;
}
.nd-item input[type=time] { flex: 1; }
.nd-sep  { color: var(--text-gray); font-size: .95rem; flex-shrink: 0; }
.nd-remove {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid rgba(248, 113, 113, .3);
  background: transparent; cursor: pointer;
  color: var(--danger); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.nd-remove:hover { background: rgba(248, 113, 113, .12); border-color: var(--danger); transform: translateY(-1px); }
.nd-empty { font-size: .85rem; color: var(--text-gray); padding: .3rem 0 .5rem; }

/* ── ONBOARDING JOTFORM ── */
.modal.modal-onboarding {
  max-width: 960px;
  max-height: min(90vh, 900px);
  overflow: auto;
}
.onboarding-alert {
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin-bottom: 1.1rem;
  font-size: .9rem;
  line-height: 1.5;
}
.onboarding-alert strong { display: block; margin-bottom: .25rem; }
.onboarding-alert p { margin: 0; color: inherit; }
.onboarding-alert ul {
  margin: .4rem 0 0 1.1rem;
  padding: 0;
}
.onboarding-alert-danger {
  background: rgba(248, 113, 113, .12);
  border: 1px solid rgba(248, 113, 113, .35);
  color: #fecaca;
}
.onboarding-alert-warn {
  background: rgba(250, 204, 21, .1);
  border: 1px solid rgba(250, 204, 21, .3);
  color: #fde68a;
}
.onboarding-staff-card .form-group label,
.onboarding-edit-card .form-group label {
  font-size: .75rem;
  color: var(--text-gray);
}
.onboarding-edit-card input,
.onboarding-edit-card textarea,
.onboarding-edit-card select,
#onb-horario-tbody input[type=time] {
  width: 100%;
}
#onb-horario-tbody input[type=time] {
  min-width: 7.5rem;
}

.onb-loading {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 5;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(3px);
  border-radius: 16px;
}
.onb-loading.open { display: flex; }
.onb-loading-card {
  text-align: center;
  padding: 1.25rem 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  min-width: 220px;
}
.onb-loading-title {
  margin-top: .85rem;
  font-weight: 700;
  color: var(--text-light);
}
.onb-loading-sub {
  margin-top: .25rem;
  font-size: .8rem;
  color: var(--text-gray);
}
.onb-spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: var(--primary);
  animation: onbSpin .7s linear infinite;
}
@keyframes onbSpin {
  to { transform: rotate(360deg); }
}
#onb-btn-apply.is-loading .onb-btn-label {
  opacity: .7;
}
.modal.modal-onboarding {
  position: relative;
}

/* ── STAFF TURNOS CALENDAR ── */
.turnos-cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .65rem;
}
.turnos-cal-toolbar label { margin: 0; }
.turnos-cal-brush {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-bottom: .65rem;
}
.turnos-view-edit #ms-turnos-calendar,
.turnos-view-edit #ms-turnos-brush,
.turnos-view-edit .turnos-cal-hint { display: none; }
.turnos-view-calendar #ms-turnos-days { display: none; }

.turnos-cal {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  background: var(--bg-input);
}
.turnos-cal:empty { display: none; }
.turnos-cal:empty + .turnos-cal-hint { display: none; }
.turnos-cal-grid {
  min-width: 520px;
  display: grid;
  grid-template-columns: 44px repeat(7, minmax(0, 1fr));
}
.turnos-cal-head,
.turnos-cal-gutter,
.turnos-cal-col {
  border-left: 1px solid var(--border);
}
.turnos-cal-head {
  text-align: center;
  padding: .45rem .2rem;
  font-size: .68rem;
  letter-spacing: .04em;
  color: var(--muted);
}
.turnos-cal-head strong {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0;
}
.turnos-cal-head.is-closed,
.turnos-cal-col.is-closed {
  background: #111;
}
.turnos-cal-head.is-closed strong { color: var(--muted); }
.turnos-cal-gutter { position: relative; border-left: none; }
.turnos-cal-hour {
  position: absolute;
  right: 4px;
  font-size: .62rem;
  color: var(--muted);
}
.turnos-cal-col {
  position: relative;
  margin: 0;
  padding: 0;
  border-right: none;
  border-bottom: none;
  border-top: none;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
}
.turnos-cal-col:disabled {
  cursor: not-allowed;
}
.turnos-cal-col:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.turnos-cal-open {
  position: absolute;
  left: 0;
  right: 0;
  background: rgba(9, 131, 214, .08);
  pointer-events: none;
}
.turnos-cal-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
  opacity: .7;
  pointer-events: none;
}
.turnos-cal-block {
  position: absolute;
  left: 3px;
  right: 3px;
  background: var(--primary);
  color: #fff;
  border-radius: 4px;
  padding: 3px 5px;
  font-size: .68rem;
  line-height: 1.25;
  text-align: left;
  overflow: hidden;
  pointer-events: none;
}
.turnos-cal-block strong { display: block; font-weight: 600; }
.turnos-cal-closed-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: .7rem;
  transform: rotate(-90deg);
  pointer-events: none;
}
.turnos-cal-hint {
  margin-top: .45rem;
  font-size: .75rem;
  color: var(--muted);
}
.turnos-edit-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .4rem;
}
.turnos-edit-row label {
  min-width: 6.5rem;
  margin: 0;
}
.turnos-edit-row select { flex: 1; }

.mt-franja {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: .75rem;
  align-items: end;
}
