/* DCR - Digital Clinical Record | Design system + app styles */

:root {
    --primary-900: #0e2148;
    --primary-700: #164a86;
    --primary-600: #1d72c9;
    --primary-500: #2f8fe3;
    --primary-300: #8fc7f6;
    --primary-100: #e9f3fd;
    --primary-50: #f4f9fe;

    --ink: #0e2148;
    --ink-soft: #435270;
    --ink-mute: #7c8aa5;
    --line: #e3e9f3;
    --line-soft: #eef2f9;
    --surface: #ffffff;
    --bg: #f4f7fc;

    --success: #1f9d63;
    --success-bg: #e7f8ee;
    --danger: #d64545;
    --danger-bg: #fdecec;
    --warn: #b8790f;
    --warn-bg: #fdf3e3;

    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 26px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(14, 33, 72, .06), 0 1px 1px rgba(14, 33, 72, .04);
    --shadow-md: 0 8px 24px rgba(14, 33, 72, .08);
    --shadow-lg: 0 20px 48px rgba(14, 33, 72, .14);

    --nav-h: 72px;
    --bar-h: 64px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font-family: inherit; }
.icon { width: 1em; height: 1em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.15em; }
.icon-fill { fill: currentColor; stroke: none; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: var(--radius-sm);
    padding: 13px 20px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, background .15s ease, opacity .15s ease;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn-primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    color: #fff;
    box-shadow: 0 10px 20px rgba(29, 114, 201, .28);
}
.btn-primary:hover { box-shadow: 0 12px 26px rgba(29, 114, 201, .36); }
.btn-primary:disabled {
    background: #c6d3e6;
    box-shadow: none;
    cursor: not-allowed;
    color: #fff;
    opacity: .8;
}
.btn-ghost {
    background: var(--primary-50);
    color: var(--primary-700);
}
.btn-outline {
    background: transparent;
    color: var(--primary-700);
    border: 1.5px solid var(--line);
}
.btn-text { background: none; padding: 8px 4px; color: var(--primary-600); font-weight: 600; }
.btn-danger-text { background: none; padding: 8px 4px; color: var(--danger); font-weight: 600; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: var(--radius-xs); }
.btn-icon {
    width: 40px; height: 40px; padding: 0; border-radius: 50%;
    background: var(--primary-50); color: var(--primary-700);
    display: inline-flex; align-items: center; justify-content: center; font-size: 18px;
}

/* ---------- Auth screen ---------- */
.auth-shell {
    min-height: 100%;
    display: flex;
}
.auth-brand {
    flex: 1;
    background: radial-gradient(circle at 15% 20%, var(--primary-500), var(--primary-900) 75%);
    color: #fff;
    padding: 56px;
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 22px;
}
.auth-brand-mark img { height: 46px; filter: brightness(0) invert(1); }
.auth-brand h1 { font-size: 34px; line-height: 1.25; margin: 0; font-weight: 800; max-width: 460px; }
.auth-brand p { color: rgba(255,255,255,.78); max-width: 440px; line-height: 1.6; margin: 0; }
.auth-brand-features { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-brand-features li { display: flex; align-items: center; gap: 12px; font-weight: 500; }
.auth-brand-features .icon-badge {
    width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.14);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.auth-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    background: var(--surface);
}
.auth-card { width: 100%; max-width: 380px; }
.auth-card-logo { text-align: center; margin-bottom: 8px; }
.auth-card-logo img { height: 40px; margin: 0 auto 18px; }
.auth-card-logo img.client-logo { height: 52px; }
.powered-by { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 24px; opacity: .65; }
.powered-by img { height: 15px; width: 15px; }
.powered-by span { font-size: 11px; font-weight: 600; color: var(--ink-mute); letter-spacing: .01em; }
.auth-card h2 { font-size: 24px; font-weight: 800; margin: 0 0 6px; text-align: center; }
.auth-card .sub { color: var(--ink-mute); text-align: center; margin: 0 0 28px; font-size: 14px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.input-wrap { position: relative; }
.input-wrap .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-mute); font-size: 16px; }
.input-wrap input {
    width: 100%; padding: 13px 14px 13px 40px; border-radius: var(--radius-sm);
    border: 1.5px solid var(--line); font-size: 15px; color: var(--ink); background: var(--primary-50);
    transition: border-color .15s ease, background .15s ease;
}
.input-wrap input:focus { outline: none; border-color: var(--primary-500); background: #fff; }
.otp-input {
    width: 100%; padding: 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--line);
    font-size: 26px; font-weight: 700; letter-spacing: .5em; text-align: center; color: var(--ink);
    background: var(--primary-50); transition: border-color .15s ease, background .15s ease;
}
.otp-input:focus { outline: none; border-color: var(--primary-500); background: #fff; }
.link.disabled { color: var(--ink-mute); cursor: default; pointer-events: none; }
.form-foot { display: flex; justify-content: flex-end; margin: -6px 0 22px; }
.link { color: var(--primary-600); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.auth-copy { text-align: center; color: var(--ink-mute); font-size: 12px; margin-top: 10px; }
.auth-back { display: flex; align-items: center; gap: 6px; color: var(--primary-600); font-weight: 600; font-size: 14px; margin-bottom: 18px; cursor: pointer; }

/* ---------- App shell ---------- */
#app { display: none; min-height: 100%; flex-direction: column; }
#app.ready { display: flex; }
.topbar {
    position: sticky; top: 0; z-index: 20;
    height: var(--bar-h);
    background: rgba(255,255,255,.92);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--line-soft);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--primary-900); }
.topbar-brand img { height: 26px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.bell-btn { position: relative; }
.bell-dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid #fff; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--primary-600), var(--primary-300));
    color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; cursor: pointer;
}

.view-wrap { flex: 1; max-width: 620px; width: 100%; margin: 0 auto; padding: 20px 16px calc(var(--nav-h) + 28px); }
.view { display: none; animation: fadeUp .28s ease; }
.view.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 22px; font-weight: 800; margin: 0 0 4px; }
.page-head p { color: var(--ink-mute); margin: 0; font-size: 14px; line-height: 1.5; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 11px; font-weight: 700; color: var(--primary-500); margin: 0 0 6px; }

.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: var(--nav-h);
    background: #fff;
    border-top: 1px solid var(--line-soft);
    display: flex;
    box-shadow: 0 -6px 20px rgba(14,33,72,.06);
    padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    color: var(--ink-mute); font-size: 11.5px; font-weight: 600; cursor: pointer; border: none; background: none; padding: 8px 0 12px;
}
.nav-item .icon { font-size: 21px; }
.nav-item.active { color: var(--primary-600); }
.nav-item .dot-badge { position: relative; }

/* ---------- Cards / generic ---------- */
.card { background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); border: 1px solid var(--line-soft); padding: 18px; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); margin: 22px 0 10px; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--ink-mute); }
.empty-state .icon { font-size: 40px; color: var(--primary-300); margin-bottom: 12px; }
.empty-state h3 { color: var(--ink); margin: 0 0 6px; font-size: 16px; }
.empty-state p { margin: 0; font-size: 13.5px; }
.skeleton { background: linear-gradient(90deg, var(--line-soft) 25%, #f7f9fd 37%, var(--line-soft) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Inicio ---------- */
.hello-card {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-500));
    color: #fff; border-radius: var(--radius-lg); padding: 22px; padding-bottom: 56px; box-shadow: var(--shadow-md);
}
.hello-card h2 { margin: 2px 0 4px; font-size: 20px; font-weight: 800; }
.hello-card p { margin: 0; color: rgba(255,255,255,.82); font-size: 13.5px; }
.next-appt-card { margin-top: -34px; margin-left: 10px; margin-right: 10px; position: relative; z-index: 2; }
.appt-card { background: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: 16px; border: 1px solid var(--line-soft); }
.appt-card-top { display: flex; align-items: center; gap: 12px; }
.doc-avatar {
    width: 46px; height: 46px; border-radius: 14px; background: var(--primary-100); color: var(--primary-700);
    display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; flex-shrink: 0;
}
.appt-card-name { font-weight: 700; font-size: 15px; }
.appt-card-sub { color: var(--ink-mute); font-size: 12.5px; margin-top: 2px; }
.appt-meta { display: flex; gap: 18px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.appt-meta-item { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.appt-meta-item .icon { color: var(--primary-500); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 700; }
.badge-upcoming { background: var(--primary-100); color: var(--primary-700); }
.badge-done { background: var(--success-bg); color: var(--success); }
.badge-today { background: var(--warn-bg); color: var(--warn); }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.quick-action { background: #fff; border: 1px solid var(--line-soft); border-radius: var(--radius-md); padding: 16px; cursor: pointer; box-shadow: var(--shadow-sm); }
.quick-action .icon-badge { width: 38px; height: 38px; border-radius: 12px; background: var(--primary-100); color: var(--primary-700); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; font-size: 18px; }
.quick-action strong { display: block; font-size: 13.5px; }
.quick-action span { font-size: 12px; color: var(--ink-mute); }

.reminder-banner {
    display: flex; gap: 12px; align-items: flex-start; background: var(--warn-bg); border: 1px solid #f4dfae;
    border-radius: var(--radius-md); padding: 14px; margin-top: 18px;
}
.reminder-banner .icon { color: var(--warn); font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.reminder-banner strong { font-size: 13.5px; display: block; margin-bottom: 2px; }
.reminder-banner p { margin: 0; font-size: 12.5px; color: var(--ink-soft); }

/* ---------- Agenda / booking flow ---------- */
.tabs-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 18px; scrollbar-width: none; }
.tabs-scroll::-webkit-scrollbar { display: none; }
.tab-pill {
    flex-shrink: 0; padding: 10px 18px; border-radius: var(--radius-pill); border: 1.5px solid var(--line);
    background: #fff; color: var(--ink-soft); font-weight: 700; font-size: 13.5px; cursor: pointer; white-space: nowrap;
}
.tab-pill.active { background: var(--primary-600); border-color: var(--primary-600); color: #fff; box-shadow: 0 6px 14px rgba(29,114,201,.28); }

.month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.month-nav .label { font-weight: 700; font-size: 14px; text-transform: capitalize; }
.month-nav button { background: var(--primary-50); border: none; width: 32px; height: 32px; border-radius: 50%; color: var(--primary-700); cursor: pointer; display: flex; align-items: center; justify-content: center; }

.day-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 20px; scrollbar-width: none; }
.day-strip::-webkit-scrollbar { display: none; }
.day-chip {
    flex: 0 0 56px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0 12px;
    border-radius: var(--radius-sm); background: #fff; border: 1.5px solid var(--line); cursor: pointer;
}
.day-chip .dow { font-size: 10.5px; font-weight: 700; color: var(--ink-mute); text-transform: uppercase; }
.day-chip .num { font-size: 17px; font-weight: 800; }
.day-chip .flag { font-size: 9px; font-weight: 700; color: var(--primary-500); height: 11px; }
.day-chip.today { border-color: var(--primary-300); }
.day-chip.active { background: var(--primary-600); border-color: var(--primary-600); color: #fff; box-shadow: 0 8px 16px rgba(29,114,201,.3); }
.day-chip.active .dow, .day-chip.active .flag { color: rgba(255,255,255,.85); }
.day-chip.disabled { opacity: .4; pointer-events: none; }

.doctor-card { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.doctor-card .doc-avatar { width: 56px; height: 56px; border-radius: 16px; font-size: 18px; }
.doctor-card h3 { margin: 0 0 3px; font-size: 16.5px; }
.doctor-card .tag { display: inline-block; background: var(--primary-100); color: var(--primary-700); font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-pill); margin-bottom: 4px; }
.doctor-card .avail { font-size: 12.5px; color: var(--ink-mute); }

.slot-group-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin: 16px 0 10px; text-transform: uppercase; letter-spacing: .03em; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.slot-btn { padding: 12px 6px; border-radius: var(--radius-sm); border: 1.5px solid var(--line); background: #fff; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--ink); display: flex; align-items: center; justify-content: center; gap: 5px; }
.slot-btn.active { background: var(--primary-600); border-color: var(--primary-600); color: #fff; box-shadow: 0 8px 16px rgba(29,114,201,.3); }
.slot-btn:disabled { opacity: .35; text-decoration: line-through; cursor: not-allowed; }
.slot-btn.confirmed { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.slot-btn.confirmed .icon { width: .85em; height: .85em; }
.slot-legend { display: flex; gap: 16px; flex-wrap: wrap; margin: 2px 0 14px; }
.slot-legend-item { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-mute); font-weight: 600; }
.slot-legend-dot { width: 10px; height: 10px; border-radius: 3px; border: 1.5px solid var(--line); }
.slot-legend-dot.available { background: #fff; }
.slot-legend-dot.confirmed { background: var(--success-bg); border-color: var(--success); }
.slot-legend-dot.blocked { background: var(--line-soft); border-color: var(--ink-mute); border-style: dashed; }

/* Cupo bloqueado por el administrador (Evento.Tipo = 'B', sin paciente). */
.slot-btn.blocked { background: var(--line-soft); color: var(--ink-mute); border-style: dashed; }
.slot-btn.blocked .icon { width: .85em; height: .85em; }

/* Selección múltiple de cupos (rol Administrador). */
.multi-toggle { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin: 2px 0 12px; cursor: pointer; }
.multi-toggle input { width: 16px; height: 16px; accent-color: var(--primary-600); }
.multi-acciones { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.multi-count { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin-bottom: 10px; }
.multi-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.multi-btns .btn { flex: 1; min-width: 140px; }
.multi-hint { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--warn); font-weight: 600; }
.multi-hint .icon { flex-shrink: 0; }

/* Antes usaba position:sticky, que en este contenedor terminaba pegándose ENCIMA del
   contenido en vez de flotar con espacio propio (tapaba los últimos horarios / el checkbox de
   correo). Ahora es fixed, igual que .bottom-nav, alineado al mismo ancho que .view-wrap en
   cada breakpoint — y las vistas que lo usan reservan abajo el espacio que el botón ocupa
   (ver #agendaBookingWrap y #view-confirm). */
.sticky-cta {
    position: fixed;
    left: 16px; right: 16px;
    max-width: 588px; margin: 0 auto;
    bottom: calc(var(--nav-h) + 14px);
    z-index: 25;
}
#agendaBookingWrap, #view-confirm { padding-bottom: 74px; }

/* Confirm step */
.confirm-summary { margin-bottom: 4px; }
.confirm-summary .appt-meta { border-top: none; padding-top: 0; margin-top: 14px; flex-wrap: wrap; }
.field-block { margin-top: 20px; }
.field-block label { display: block; font-weight: 700; font-size: 13.5px; margin-bottom: 8px; }
textarea.form-area {
    width: 100%; min-height: 96px; border-radius: var(--radius-sm); border: 1.5px solid var(--line);
    padding: 12px 14px; font-size: 14px; resize: vertical; background: var(--primary-50); color: var(--ink);
}
textarea.form-area:focus { outline: none; border-color: var(--primary-500); background: #fff; }
.email-confirm { background: var(--primary-50); border-radius: var(--radius-sm); padding: 14px; margin-top: 16px; }
.email-confirm .title { font-weight: 700; font-size: 13.5px; margin-bottom: 2px; }
.email-confirm .sub { font-size: 12px; color: var(--ink-mute); margin-bottom: 10px; }
.email-confirm .row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.email-confirm input { flex: 1; border: 1.5px solid var(--line); border-radius: var(--radius-xs); padding: 10px 12px; font-size: 13.5px; background: #fff; }
.check-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--ink-soft); cursor: pointer; user-select: none; }
.check-box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: #fff; }
.check-box.checked { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }

/* Registros */
.record-item-wrap { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.record-item-wrap:last-child { border-bottom: none; }
.record-item { display: flex; align-items: center; gap: 12px; padding: 2px 0 10px; cursor: pointer; }
.record-item .doc-avatar { width: 44px; height: 44px; border-radius: 13px; }
.record-info { flex: 1; min-width: 0; }
.record-info strong { display: block; font-size: 14px; }
.record-info span { font-size: 12px; color: var(--ink-mute); }
.record-when { text-align: right; flex-shrink: 0; }
.record-when .d { font-weight: 700; font-size: 13px; }
.record-when .t { font-size: 11.5px; color: var(--ink-mute); }
/* Botón de anular: a propósito grande, con borde e ícono — que sea imposible de confundir
   con texto o de pasar por alto (antes era un texto pequeño casi invisible). Solo aparece en
   citas próximas (no pasadas). */
.record-cancel {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    width: 100%; padding: 10px 0; margin-top: 2px;
    border: 1.5px solid var(--danger); border-radius: 11px;
    background: var(--danger-bg); color: var(--danger);
    font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.record-cancel .icon { width: 13px; height: 13px; }
.record-cancel:active { opacity: .8; }

/* Perfil */
.profile-head { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 10px 0 22px; }
.profile-head .doc-avatar { width: 76px; height: 76px; border-radius: 22px; font-size: 24px; margin-bottom: 12px; }
.profile-head h2 { margin: 0 0 3px; font-size: 18px; }
.profile-head span { color: var(--ink-mute); font-size: 13px; }
.info-list { display: flex; flex-direction: column; gap: 2px; }
.info-row { display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--line-soft); }
.info-row:last-child { border-bottom: none; }
.info-row .icon { color: var(--primary-500); font-size: 17px; }
.info-row .lbl { font-size: 11.5px; color: var(--ink-mute); }
.info-row .val { font-size: 14px; font-weight: 600; }
.action-list { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.action-row {
    display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm); padding: 14px 16px; cursor: pointer; font-weight: 600; font-size: 14px;
}
.action-row .icon { color: var(--primary-600); font-size: 18px; }
.action-row.danger { color: var(--danger); }
.action-row.danger .icon { color: var(--danger); }
.action-row .chev { margin-left: auto; color: var(--ink-mute); }

/* ---------- Modal / toast / loader ---------- */
.overlay {
    position: fixed; inset: 0; background: rgba(14,33,72,.42); z-index: 100;
    display: flex; align-items: flex-end; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.modal-box {
    background: #fff; width: 100%; max-width: 440px; border-radius: 22px 22px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
    transform: translateY(24px); transition: transform .22s ease; max-height: 86vh; overflow-y: auto;
}
.overlay.show .modal-box { transform: translateY(0); }
@media (min-width: 640px) {
    .overlay { align-items: center; }
    .modal-box { border-radius: var(--radius-lg); transform: translateY(10px) scale(.98); }
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 800; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--primary-50); color: var(--ink-soft); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.modal-body p { color: var(--ink-soft); font-size: 14px; line-height: 1.55; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

.toast-stack { position: fixed; top: calc(var(--bar-h) + 12px); left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 380px); }
.toast {
    background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600;
    box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; animation: toastIn .22s ease;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.loader-veil {
    position: fixed; inset: 0; background: rgba(244,247,252,.7); backdrop-filter: blur(2px); z-index: 300;
    display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .15s ease;
}
.loader-veil.show { opacity: 1; pointer-events: auto; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3.5px solid var(--primary-100); border-top-color: var(--primary-600); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* System notification mock (in-app reminder card, phone-style) */
.notif-card {
    display: flex; gap: 12px; background: rgba(255,255,255,.98); border-radius: var(--radius-md); padding: 14px;
    box-shadow: var(--shadow-lg); border: 1px solid var(--line-soft);
}
.notif-card .app-icon { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; }
.notif-card .body { flex: 1; min-width: 0; }
.notif-card .top-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 2px; }
.notif-card .app-name { font-size: 11.5px; font-weight: 700; color: var(--ink-mute); text-transform: uppercase; letter-spacing: .03em; }
.notif-card .time { font-size: 11px; color: var(--ink-mute); }
.notif-card .title { font-weight: 700; font-size: 13.5px; margin-bottom: 2px; }
.notif-card .msg { font-size: 12.5px; color: var(--ink-soft); line-height: 1.4; }
.notif-card .actions { display: flex; gap: 16px; margin-top: 10px; }
.notif-card .actions button { background: none; border: none; padding: 0; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.notif-card .actions .dismiss { color: var(--ink-mute); }
.notif-card .actions .confirm { color: var(--primary-600); }

/* ---------- Responsive: tablet/desktop ---------- */
@media (min-width: 900px) {
    .auth-brand { display: flex; }
    .bottom-nav {
        top: var(--bar-h); bottom: 0; left: 0; right: auto; width: 220px; height: auto;
        flex-direction: column; border-top: none; border-right: 1px solid var(--line-soft); box-shadow: none;
        padding: 20px 12px;
    }
    .nav-item { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; }
    .nav-item.active { background: var(--primary-100); }
    .view-wrap { margin-left: 220px; max-width: 720px; padding: 32px 32px 48px; }
    .slot-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
    .quick-actions { grid-template-columns: 1fr 1fr 1fr; }
    /* En escritorio no hay barra inferior (el menú es lateral): el botón va casi al borde, en vez de
       flotar 86px arriba y tapar la última fila de horarios. */
    .sticky-cta { left: 252px; right: 32px; max-width: 656px; bottom: 24px; }
    #agendaBookingWrap, #view-confirm { padding-bottom: 104px; }
}
@media (min-width: 640px) and (max-width: 899.98px) {
    .view-wrap { max-width: 640px; }
    .sticky-cta { max-width: 608px; }
}
/* En monitores muy anchos el layout (sidebar de 220px + columna de 720px) se quedaba pegado
   a la izquierda dejando todo el resto de la pantalla vacío. A partir de aquí se centra la
   app completa como un bloque enmarcado, en vez de estirarse o quedar pegada a un borde. */
@media (min-width: 1220px) {
    #app { max-width: 1160px; margin: 0 auto; box-shadow: 0 0 0 1px var(--line-soft); min-height: 100vh; }
    .bottom-nav { left: calc((100vw - 1160px) / 2); }
    .sticky-cta {
        left: calc((100vw - 1160px) / 2 + 252px);
        right: calc((100vw - 1160px) / 2 + 252px);
    }
}
