/* AgendaOS — panel administrativo */
:root {
  --brand: #c0807a;
  --brand-600: color-mix(in oklab, var(--brand), #3a1f1c 18%);
  --brand-700: color-mix(in oklab, var(--brand), #2a1512 38%);
  --brand-300: color-mix(in oklab, var(--brand), #fff 40%);
  --brand-100: color-mix(in oklab, var(--brand), #fff 82%);
  --brand-50: color-mix(in oklab, var(--brand), #fff 92%);
  --ink: #2a1f1d;
  --ink-2: #4a3b38;
  --muted: #8a7a76;
  --bg: #f7f2ee;
  --card: #fff;
  --line: #ece3dd;
  --ok: #3f8f6b;
  --ok-bg: #e6f4ec;
  --warn: #a67812;
  --warn-bg: #fcf1d8;
  --danger: #c2453d;
  --danger-bg: #fbe9e7;
  --info: #4a6fa5;
  --info-bg: #e8eef8;
  --display: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Jost', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(42, 31, 29, .04), 0 8px 24px -16px rgba(42, 31, 29, .25);
  --ease: cubic-bezier(.2, .7, .2, 1);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font: 400 15px/1.55 var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--brand-700); }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h2 { font-size: 1.05rem; font-weight: 600; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }

/* Estructura */
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--ink); color: rgba(255, 255, 255, .78); padding: 22px 14px; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 24px; text-decoration: none; color: #fff; }
.side-brand small { display: block; font-size: .74rem; color: rgba(255, 255, 255, .5); letter-spacing: .04em; }
.side-brand > span:last-child { font: 600 1.25rem/1.15 var(--display); }
.brand-mark { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font: italic 600 1.35rem/1 var(--display); flex: none; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: inherit; text-decoration: none; transition: background .2s, color .2s; }
.side-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-nav a.active { background: var(--brand); color: #fff; }
.side-nav em { margin-left: auto; font-style: normal; font-size: .72rem; font-weight: 600; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; display: grid; place-items: center; background: rgba(255, 255, 255, .14); color: #fff; }
.side-nav a.active em { background: rgba(255, 255, 255, .25); }
.side-foot { margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .08); display: grid; gap: 2px; }
.side-foot a, .side-foot button { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: rgba(255, 255, 255, .6); text-decoration: none; background: none; border: 0; font: inherit; font-size: .9rem; cursor: pointer; width: 100%; text-align: left; }
.side-foot a:hover, .side-foot button:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 16px 32px; background: rgba(247, 242, 238, .88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar-title h1 { font: 600 1.8rem/1.1 var(--display); }
.topbar-title p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.topbar-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.menu-btn { display: none; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; place-items: center; }
.content { padding: 28px 32px 60px; animation: in .4s var(--ease) both; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.backdrop { display: none; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: 500 .9rem/1.2 var(--sans); text-decoration: none; cursor: pointer; transition: background .2s, border-color .2s, transform .15s, box-shadow .2s; white-space: nowrap; }
.btn:hover { border-color: #d8ccc5; }
.btn:active { transform: scale(.98); }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 16px -8px var(--brand); }
.btn-brand:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger-bg); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(42, 31, 29, .05); border-color: transparent; }
.btn-sm { padding: 6px 11px; font-size: .84rem; border-radius: 10px; }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.is-loading .icon { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Tarjetas */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px 20px 20px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.stack { display: grid; gap: 20px; align-content: start; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { position: relative; overflow: hidden; padding: 18px 20px; animation: in .5s var(--ease) both; }
.kpi:nth-child(2) { animation-delay: .05s; }
.kpi:nth-child(3) { animation-delay: .1s; }
.kpi:nth-child(4) { animation-delay: .15s; }
.kpi .kpi-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-600); margin-bottom: 12px; }
.kpi b { display: block; font-size: 1.8rem; font-weight: 500; letter-spacing: -.02em; line-height: 1.1; }
.kpi span { color: var(--muted); font-size: .86rem; }
.kpi small { display: block; margin-top: 6px; font-size: .8rem; color: var(--ink-2); }
.meter { height: 6px; border-radius: 6px; background: var(--brand-50); margin-top: 10px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 6px; background: var(--brand); width: 0; animation: grow 1.2s .3s var(--ease) forwards; }
@keyframes grow { to { width: var(--w); } }

/* Gráfica de barras */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar i { display: block; width: 100%; max-width: 44px; border-radius: 10px 10px 4px 4px; background: linear-gradient(180deg, var(--brand-300), var(--brand)); height: 0; animation: bar-up .9s var(--ease) forwards; animation-delay: calc(var(--i) * 60ms); }
.bar.closed i { background: repeating-linear-gradient(45deg, var(--line), var(--line) 4px, #fff 4px, #fff 8px); }
@keyframes bar-up { to { height: var(--h); } }
.bar b { font-size: .82rem; font-weight: 600; }
.bar span { font-size: .74rem; color: var(--muted); text-transform: capitalize; }

/* Listas de citas */
.appt-list { list-style: none; margin: 0; padding: 0; }
.appt-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.appt-item:last-child { border-bottom: 0; }
.appt-time { width: 74px; flex: none; font-weight: 600; font-size: .92rem; }
.appt-time small { display: block; font-weight: 400; color: var(--muted); font-size: .76rem; }
.appt-dot { width: 4px; align-self: stretch; border-radius: 4px; flex: none; }
.appt-main { min-width: 0; flex: 1; }
.appt-main b { display: block; font-weight: 500; }
.appt-main span { color: var(--muted); font-size: .86rem; }
.appt-item a.cover { position: absolute; inset: 0; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.empty .icon { width: 34px; height: 34px; color: var(--brand-300); margin-bottom: 8px; }

/* Estados */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: .76rem; font-weight: 500; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.confirmada { background: var(--ok-bg); color: var(--ok); }
.pill.pendiente { background: var(--warn-bg); color: var(--warn); }
.pill.completada { background: var(--info-bg); color: var(--info); }
.pill.cancelada { background: #f1ecea; color: var(--muted); }
.pill.no_asistio { background: var(--danger-bg); color: var(--danger); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: .74rem; background: var(--bg); color: var(--ink-2); }
.tag-brand { background: var(--brand-50); color: var(--brand-700); }

.pill.pay-aprobado { background: var(--ok-bg); color: var(--ok); }
.pill.pay-en_revision, .pill.pay-pendiente { background: var(--warn-bg); color: var(--warn); }
.pill.pay-rechazado { background: var(--danger-bg); color: var(--danger); }
.pill.pay-sin_pago { background: #f1ecea; color: var(--muted); }
.pill.pay-pagado { background: var(--ok-bg); color: var(--ok); }

/* Vista previa de WhatsApp */
.wa-previews { display: flex; gap: 30px; flex-wrap: wrap; justify-content: center; }
.phone { width: 340px; border-radius: 44px; padding: 12px; background: #1c1c1e; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .5); }
.phone-screen { border-radius: 34px; overflow: hidden; background: #efe7de url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Ccircle cx='10' cy='10' r='1.5' fill='%23d9cfc4'/%3E%3Ccircle cx='40' cy='35' r='1.2' fill='%23d9cfc4'/%3E%3C/svg%3E"); display: flex; flex-direction: column; height: 640px; }
.wa-top { display: flex; align-items: center; gap: 10px; padding: 40px 14px 12px; background: #075e54; color: #fff; }
.wa-top .avatar { width: 36px; height: 36px; background: var(--brand); font-family: var(--display); font-style: italic; font-size: 1.1rem; }
.wa-top b { display: block; font-weight: 500; font-size: .95rem; }
.wa-top small { font-size: .72rem; opacity: .8; }
.wa-chat { flex: 1; padding: 14px 10px; overflow-y: auto; }
.wa-day { text-align: center; margin-bottom: 10px; }
.wa-day span { background: #e1f2fb; color: #4a5d66; font-size: .7rem; padding: 4px 10px; border-radius: 8px; }
.wa-bubble { position: relative; max-width: 88%; margin-left: auto; background: #d9fdd3; border-radius: 10px 0 10px 10px; padding: 8px 10px 18px; font: 400 .84rem/1.4 -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif; color: #111b21; white-space: pre-wrap; word-break: break-word; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); animation: in .5s var(--ease) both; }
.wa-bubble b { font-weight: 700; }
.wa-bubble i { font-style: italic; }
.wa-bubble a { color: #027eb5; }
.wa-time { position: absolute; right: 8px; bottom: 4px; font-size: .64rem; color: #667781; }
.wa-time::after { content: " ✓✓"; color: #53bdeb; }
.wa-input { display: flex; align-items: center; gap: 8px; padding: 8px 10px 22px; }
.wa-input span { flex: 1; background: #fff; border-radius: 20px; padding: 9px 14px; color: #8696a0; font-size: .82rem; }
.wa-input i { width: 38px; height: 38px; border-radius: 50%; background: #00a884; display: grid; place-items: center; color: #fff; font-style: normal; }
.preview-label { text-align: center; margin: 0 0 12px; font-weight: 500; }

/* Tablas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .76rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #fcf9f7; }
tr.is-off td { opacity: .5; }
.row-link { color: inherit; text-decoration: none; font-weight: 500; }
.row-link:hover { color: var(--brand-700); }
.thumb { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; background: var(--bg); flex: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; display: inline-grid; place-items: center; color: #fff; font-size: .8rem; font-weight: 600; }
.who { display: flex; align-items: center; gap: 10px; }

/* Filtros */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filters .search { flex: 1; min-width: 200px; position: relative; }
.filters .search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.filters .search input { padding-left: 38px; }
.tabs { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.tabs a { padding: 6px 12px; border-radius: 9px; text-decoration: none; color: var(--ink-2); font-size: .88rem; }
.tabs a.active { background: var(--ink); color: #fff; }

/* Formularios */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label, .label { display: block; font-size: .84rem; font-weight: 500; margin-bottom: 6px; color: var(--ink-2); }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 5px; }
input:not([type]), input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password], input[type=date], input[type=time], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font: inherit; color: var(--ink); outline: 0; transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
textarea { resize: vertical; min-height: 80px; }
input[type=color] { width: 52px; height: 42px; border: 1px solid var(--line); border-radius: 12px; padding: 4px; background: #fff; cursor: pointer; }
.input-group { display: flex; align-items: center; gap: 8px; }
.input-group span { color: var(--muted); font-size: .9rem; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 20px; border-top: 1px solid var(--line); background: #fcfaf8; border-radius: 0 0 var(--radius) var(--radius); }
.section-title { font-size: .76rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 8px 0 -4px; }

/* Interruptor */
.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; transition: border-color .2s, background .2s; }
.switch:hover { border-color: #ddd0c9; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { position: relative; width: 40px; height: 23px; border-radius: 99px; background: #ddd2cc; flex: none; transition: background .25s; margin-top: 1px; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .3s cubic-bezier(.34, 1.56, .64, 1); }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--brand-100); }
.switch b { display: block; font-weight: 500; font-size: .92rem; }
.switch small { display: block; color: var(--muted); font-size: .82rem; line-height: 1.35; }
.switch.compact { padding: 0; border: 0; background: none; align-items: center; }

/* Checks de servicios / equipo */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .2s, background .2s; font-size: .9rem; }
.check:has(input:checked) { border-color: var(--brand-300); background: var(--brand-50); }
.check input { accent-color: var(--brand); width: 16px; height: 16px; }
.check-group { margin-bottom: 14px; }
.check-group h4 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 8px; font-size: .86rem; font-weight: 600; }
.check-group h4 button { border: 0; background: none; color: var(--brand-700); font: inherit; font-size: .8rem; font-weight: 400; cursor: pointer; }

/* Horario semanal */
.week-hours { display: grid; gap: 8px; }
.day-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 14px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.day-row .times { display: flex; align-items: center; gap: 8px; }
.day-row .times input { max-width: 130px; }
.day-row.is-closed .times { opacity: .35; pointer-events: none; }
.day-row .closed-label { color: var(--muted); font-size: .86rem; }

/* Campo de imagen con IA */
.image-field { display: flex; gap: 16px; align-items: flex-start; }
.image-preview { position: relative; width: 140px; height: 140px; border-radius: 16px; overflow: hidden; flex: none; background: repeating-linear-gradient(45deg, var(--bg), var(--bg) 8px, #fff 8px, #fff 16px); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); }
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-preview.round { border-radius: 50%; }
.image-preview .loading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .85); color: var(--brand-600); font-size: .8rem; text-align: center; padding: 10px; }
.image-preview .loading .icon { width: 28px; height: 28px; animation: spin 1s linear infinite; margin: 0 auto 6px; display: block; }
.image-tools { display: grid; gap: 8px; flex: 1; min-width: 0; }
.ai-box { display: flex; gap: 8px; }
.ai-box input { flex: 1; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Alertas */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 14px; margin-bottom: 18px; font-size: .92rem; animation: in .35s var(--ease) both; }
.alert.ok { background: var(--ok-bg); color: #24573f; }
.alert.error { background: var(--danger-bg); color: #8c2a24; display: block; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert.hide { animation: out .4s forwards; }
@keyframes out { to { opacity: 0; transform: translateY(-6px); height: 0; padding: 0; margin: 0; } }

/* Paginación */
.pagination { display: flex; gap: 6px; justify-content: center; padding: 18px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 36px; height: 36px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink); font-size: .88rem; }
.pagination .active { background: var(--ink); border-color: var(--ink); color: #fff; }
.pagination .disabled { opacity: .4; }

/* =========================================================
   Agenda visual
   ========================================================= */
.agenda-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.agenda-bar h2 { font: 600 1.5rem/1.1 var(--display); margin: 0 8px; }
.agenda-bar .spacer { flex: 1; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .82rem; color: var(--ink-2); margin-bottom: 14px; }
.legend a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: inherit; padding: 4px 10px 4px 4px; border-radius: 99px; border: 1px solid var(--line); background: #fff; }
.legend a.active { border-color: var(--ink); }
.legend a .avatar { width: 24px; height: 24px; font-size: .66rem; }
.cal { --hour: 64px; display: grid; background: #fff; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: auto; max-height: calc(100vh - 230px); }
.cal-head { display: contents; }
.cal-corner, .cal-col-head { position: sticky; top: 0; z-index: 3; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 8px; }
.cal-corner { left: 0; z-index: 4; }
.cal-col-head { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: .88rem; font-weight: 500; border-left: 1px solid var(--line); min-width: 0; }
.cal-col-head small { display: block; color: var(--muted); font-weight: 400; font-size: .74rem; }
.cal-col-head.is-today { color: var(--brand-700); }
.cal-col-head.is-today b { background: var(--brand); color: #fff; border-radius: 8px; padding: 0 6px; }
.cal-col-head a { text-decoration: none; color: inherit; text-align: center; }
.cal-times { position: sticky; left: 0; z-index: 2; background: #fff; }
.cal-time { height: var(--hour); white-space: nowrap; font-size: .72rem; color: var(--muted); text-align: right; padding: 0 8px; transform: translateY(-7px); }
.cal-col { position: relative; border-left: 1px solid var(--line); background-image: repeating-linear-gradient(180deg, var(--line) 0, var(--line) 1px, transparent 1px, transparent calc(var(--hour) / 2)); background-size: 100% var(--hour); min-width: 150px; }
.cal-col.is-closed { background-color: #faf6f3; }
.cal-slot-link { position: absolute; left: 0; right: 0; height: calc(var(--hour) / 2); }
.cal-slot-link:hover { background: var(--brand-50); }
.cal-slot-link:hover::after { content: "+ Nueva"; position: absolute; left: 8px; top: 4px; font-size: .72rem; color: var(--brand-700); }
.ev {
  position: absolute; left: 4px; right: 4px; z-index: 1; border-radius: 10px; padding: 5px 8px; overflow: hidden; text-decoration: none; color: var(--ink);
  background: color-mix(in oklab, var(--c), #fff 82%); border-left: 3px solid var(--c); font-size: .78rem; line-height: 1.3;
  transition: transform .15s, box-shadow .2s; animation: ev-in .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 25ms);
}
@keyframes ev-in { from { opacity: 0; transform: scale(.96); } }
.ev:hover { z-index: 2; box-shadow: 0 10px 24px -10px rgba(42, 31, 29, .45); transform: scale(1.02); }
.ev b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev span { display: block; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .ev-time { font-size: .7rem; color: var(--muted); }
.ev.pendiente { background: repeating-linear-gradient(135deg, color-mix(in oklab, var(--c), #fff 85%), color-mix(in oklab, var(--c), #fff 85%) 6px, #fff 6px, #fff 12px); border-left-style: dashed; }
.ev.completada { opacity: .65; }
.ev.no_asistio { opacity: .55; text-decoration: line-through; }
.ev .ev-flag { position: absolute; top: 4px; right: 6px; font-size: .62rem; padding: 1px 6px; border-radius: 99px; background: var(--warn-bg); color: var(--warn); }
.off { position: absolute; left: 0; right: 0; z-index: 0; background: repeating-linear-gradient(45deg, #f3ece8, #f3ece8 6px, #faf6f3 6px, #faf6f3 12px); color: var(--muted); font-size: .72rem; padding: 4px 8px; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 2; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }

/* Detalle de cita */
.detail-hero { display: flex; gap: 18px; align-items: center; padding: 22px; }
.detail-hero img { width: 84px; height: 84px; border-radius: 18px; object-fit: cover; }
.detail-hero h2 { font: 600 1.7rem/1.1 var(--display); margin-bottom: 4px; }
.kv { list-style: none; margin: 0; padding: 0; }
.kv li { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv li:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { font-weight: 500; text-align: right; }
.status-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.slot-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; padding: 2px; }
.slot-picker button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 4px; font: 500 .84rem/1.2 var(--sans); cursor: pointer; transition: all .15s; color: var(--ink); }
.slot-picker button small { display: block; color: var(--muted); font-weight: 400; font-size: .7rem; }
.slot-picker button:hover { border-color: var(--brand); }
.slot-picker button.is-selected { background: var(--brand); border-color: var(--brand); color: #fff; }
.slot-picker button.is-selected small { color: rgba(255, 255, 255, .8); }
.slot-picker .empty { grid-column: 1 / -1; padding: 14px; }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); }
.login-media { position: relative; background: url('../img/hero.jpg') center / cover; }
.login-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(42, 31, 29, .7)); }
.login-media blockquote { position: absolute; left: 48px; right: 48px; bottom: 48px; z-index: 1; margin: 0; color: #fff; font: italic 500 2.2rem/1.2 var(--display); }
.login-form { display: grid; place-items: center; padding: 40px 24px; }
.login-card { width: min(380px, 100%); animation: in .6s var(--ease) both; }
.login-card h1 { font: 600 2.4rem/1.1 var(--display); margin: 20px 0 6px; }
.login-card form { display: grid; gap: 14px; margin-top: 26px; }

/* Responsive */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform .35s var(--ease); }
  .nav-open .sidebar { transform: none; }
  .nav-open .backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(42, 31, 29, .4); animation: in .2s both; }
  .menu-btn { display: grid; }
  .topbar { padding: 12px 16px; }
  .topbar-title h1 { font-size: 1.45rem; }
  .topbar-title p { display: none; }
  .topbar-actions .btn span { display: none; }
  .content { padding: 18px 16px 50px; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-media { display: none; }
  .day-row { grid-template-columns: 1fr; }
  .image-field { flex-direction: column; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi b { font-size: 1.4rem; }
  .cal-col { min-width: 130px; }
}
