/* ===== Panel de administración ===== */
body.admin { background: #0a0a0c; }
.small { font-size: .82rem; }

/* Login */
.login { min-height: 100svh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(ellipse at 50% 0%, #2a2412, var(--bg) 65%); }
.login-card { width: min(400px, 100%); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem; display: grid; gap: 1rem; box-shadow: var(--shadow); }
.login-card h1 { font-size: 1.4rem; margin: 0; }
.login-card p { margin: 0; }
.login-logo { width: 56px; height: 56px; }
.back { text-align: center; font-size: .88rem; }

/* Layout */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100svh; }
.sidebar { background: var(--bg-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100svh; }
.side-brand { display: flex; align-items: center; gap: .6rem; padding: 1.2rem; font-family: var(--display); font-weight: 700; letter-spacing: .06em; border-bottom: 1px solid var(--line); }
.side-brand img { width: 32px; height: 32px; }
.side-nav { display: grid; padding: .8rem; gap: .2rem; overflow-y: auto; }
.side-nav a { padding: .65rem .85rem; border-radius: 10px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.side-nav a:hover { background: var(--bg-3); color: var(--text); }
.side-nav a.active { background: #231f12; color: var(--gold-2); }
.count { background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; padding: .05rem .5rem; border-radius: 999px; }
.side-foot { margin-top: auto; padding: 1rem; display: grid; gap: .5rem; border-top: 1px solid var(--line); }
.main { min-width: 0; }
.main-head { display: flex; align-items: center; gap: 1rem; padding: 1rem clamp(1rem, 3vw, 2rem); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(10, 10, 12, .95); backdrop-filter: blur(8px); z-index: 5; }
.main-head h1 { font-family: var(--font); font-size: 1.3rem; letter-spacing: 0; margin: 0; flex: 1; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.view { padding: clamp(1rem, 3vw, 2rem); display: grid; gap: 1.2rem; }
.main-head .nav-toggle { display: none; }

/* Cards y tablas */
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.card h2 { font-family: var(--font); font-size: 1.05rem; letter-spacing: 0; margin-bottom: .9rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; }
.toolbar .field { min-width: 150px; }
.toolbar input, .toolbar select { padding: .55rem .75rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { background: none; border: 0; padding: .5rem 1rem; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--gold); color: #15120a; font-weight: 600; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .7rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
tr:hover td { background: rgba(255, 255, 255, .02); }
.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--bg-3); }
.row-actions { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.icon-btn { background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; padding: .4rem .65rem; cursor: pointer; font-size: .85rem; }
.icon-btn:hover { border-color: var(--gold); }
.icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }

/* Estados de cita */
.pill { display: inline-block; padding: .2rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 600; text-transform: capitalize; border: 1px solid; white-space: nowrap; }
.pill.pendiente { color: var(--warn); border-color: rgba(224, 160, 40, .5); background: rgba(224, 160, 40, .08); }
.pill.aceptada { color: var(--info); border-color: rgba(76, 141, 255, .5); background: rgba(76, 141, 255, .08); }
.pill.confirmada { color: var(--ok); border-color: rgba(61, 187, 122, .5); background: rgba(61, 187, 122, .08); }
.pill.cancelada { color: var(--danger); border-color: rgba(229, 72, 77, .5); background: rgba(229, 72, 77, .08); }
.pill.completada { color: var(--muted); border-color: var(--line); }
.act { border: 1px solid; background: transparent; border-radius: 8px; padding: .38rem .7rem; cursor: pointer; font-size: .82rem; font-weight: 600; }
.act.aceptar { color: var(--info); border-color: rgba(76, 141, 255, .6); }
.act.confirmar { color: var(--ok); border-color: rgba(61, 187, 122, .6); }
.act.cancelar { color: var(--danger); border-color: rgba(229, 72, 77, .6); }
.act.wa { color: #25d366; border-color: rgba(37, 211, 102, .6); }
.act:hover { background: rgba(255, 255, 255, .05); }

/* Lista de citas como tarjetas */
.appt-day h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); margin: .4rem 0 .6rem; }
.appt { display: grid; grid-template-columns: 90px 1fr auto; gap: 1rem; align-items: center; padding: .9rem 1rem; background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 12px; margin-bottom: .55rem; }
.appt.pendiente { border-left-color: var(--warn); }
.appt.aceptada { border-left-color: var(--info); }
.appt.confirmada { border-left-color: var(--ok); }
.appt.cancelada { border-left-color: var(--danger); opacity: .65; }
.appt-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.appt-time small { display: block; color: var(--muted); font-weight: 400; }
.appt-main { min-width: 0; display: grid; gap: .15rem; }
.appt-main .who { font-weight: 600; }
.appt-main .what { color: var(--muted); font-size: .9rem; }
.appt-main .note { font-size: .85rem; color: #d9d4c7; font-style: italic; }
.appt-side { display: grid; gap: .45rem; justify-items: end; }

/* Calendario semanal */
.week { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: .5rem; overflow-x: auto; }
.week-col { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; min-height: 260px; display: flex; flex-direction: column; }
.week-col.today { border-color: var(--gold); }
.week-col.off { background: repeating-linear-gradient(135deg, var(--bg-2), var(--bg-2) 8px, #121215 8px, #121215 16px); }
.week-col header { padding: .6rem; border-bottom: 1px solid var(--line); text-align: center; font-size: .85rem; }
.week-col header strong { display: block; font-size: 1.2rem; }
.week-col .items { padding: .4rem; display: grid; gap: .35rem; align-content: start; }
.chip { font-size: .78rem; padding: .4rem .5rem; border-radius: 8px; background: var(--bg-3); border-left: 3px solid var(--line); cursor: pointer; text-align: left; border-top: 0; border-right: 0; border-bottom: 0; }
.chip.pendiente { border-left-color: var(--warn); }
.chip.aceptada { border-left-color: var(--info); }
.chip.confirmada { border-left-color: var(--ok); }
.chip.cancelada { border-left-color: var(--danger); opacity: .55; text-decoration: line-through; }
.chip b { display: block; }

/* Horarios */
.hours-grid { display: grid; gap: .5rem; }
.hours-row { display: grid; grid-template-columns: 130px 110px 1fr 1fr; gap: .8rem; align-items: center; }
.switch { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; color: var(--text); font-size: .9rem; }
.switch input { width: 40px; height: 22px; appearance: none; background: var(--bg-3); border: 1px solid var(--line); border-radius: 999px; position: relative; cursor: pointer; padding: 0; transition: .2s; flex: none; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: .2s; }
.switch input:checked { background: var(--gold); border-color: var(--gold); }
.switch input:checked::after { left: 20px; background: #15120a; }
.weekday-picks { display: flex; gap: .35rem; flex-wrap: wrap; }
.weekday-picks label { display: inline-flex; align-items: center; gap: .3rem; padding: .35rem .6rem; border: 1px solid var(--line); border-radius: 8px; font-size: .85rem; color: var(--text); cursor: pointer; }
.weekday-picks input { width: auto; }

/* Formularios */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.form-grid .full { grid-column: 1 / -1; }
textarea { min-height: 80px; resize: vertical; }
.img-field { display: flex; gap: .9rem; align-items: center; }
.img-preview { width: 88px; height: 88px; border-radius: 12px; border: 1px dashed var(--line); background: var(--bg-3) center / cover no-repeat; flex: none; display: grid; place-items: center; color: var(--muted); font-size: .75rem; text-align: center; }
.img-preview.wide { width: 160px; }
.img-field .controls { display: grid; gap: .4rem; flex: 1; min-width: 0; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
input[type="color"] { padding: .2rem; height: 44px; }
.save-bar { display: flex; justify-content: flex-end; gap: .6rem; }

/* Modal */
.modal { border: 0; padding: 0; background: transparent; color: var(--text); width: min(620px, calc(100vw - 2rem)); max-height: calc(100svh - 2rem); }
.modal::backdrop { background: rgba(0, 0, 0, .7); backdrop-filter: blur(3px); }
.modal-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); display: grid; max-height: calc(100svh - 2rem); }
.modal-card header, .modal-card footer { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: 1rem 1.2rem; }
.modal-card header { border-bottom: 1px solid var(--line); }
.modal-card header h2 { font-family: var(--font); font-size: 1.1rem; letter-spacing: 0; margin: 0; }
.modal-card footer { border-top: 1px solid var(--line); justify-content: flex-end; }
.modal-body { padding: 1.2rem; overflow-y: auto; }
.modal .form-error { margin: 0 1.2rem; }

/* Toasts */
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; z-index: 100; }
.toast { background: var(--bg-3); border: 1px solid var(--line); border-left: 3px solid var(--gold); padding: .8rem 1rem; border-radius: 10px; box-shadow: var(--shadow); max-width: 360px; font-size: .9rem; animation: tin .2s ease-out; }
.toast.error { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }
.toast a { color: var(--gold-2); text-decoration: underline; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; }
.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; }
.stat b { display: block; font-size: 1.5rem; }
.stat span { color: var(--muted); font-size: .82rem; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .main-head .nav-toggle { display: block; }
  .appt { grid-template-columns: 1fr; }
  .appt-side { justify-items: start; }
  .hours-row { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
