/* Panel de gestión — reutiliza tokens, botones, campos y diálogos de site.css */
body.admin { background: var(--ivory-2); display: grid; grid-template-columns: 260px 1fr; min-height: 100svh; }
.admin svg { flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Lateral */
.side { position: sticky; top: 0; height: 100svh; background: var(--mocha); color: var(--ivory); display: flex; flex-direction: column; padding: 22px 14px; overflow-y: auto; }
.side-brand { display: flex; gap: 12px; align-items: center; text-decoration: none; padding: 6px 10px 22px; }
.side-brand b { display: block; font: 400 26px/1 var(--f-display); }
.side-brand small { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-soft); }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; text-decoration: none; font-size: 14px; color: rgba(251,247,242,.72); transition: background .25s, color .25s; }
.side-nav a svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.side-nav a:hover { background: rgba(251,247,242,.06); color: var(--ivory); }
.side-nav a.is-active { background: rgba(216,188,139,.14); color: var(--gold-light); }
.badge { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; min-width: 20px; padding: 2px 7px; border-radius: 99px; background: rgba(216,188,139,.2); color: var(--gold-light); text-align: center; }
.badge:empty { display: none; }
.side-foot { margin-top: auto; padding: 18px 12px 4px; font-size: 12.5px; color: rgba(251,247,242,.5); }
.side-foot b { color: var(--gold-light); letter-spacing: .12em; }
.side-foot .link-btn { color: rgba(251,247,242,.7); text-decoration-color: rgba(251,247,242,.3); }

/* Cabecera */
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 18px clamp(16px, 3vw, 36px); background: rgba(246,238,231,.86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.top-title { flex: 1; min-width: 0; }
.top-title .eyebrow { margin-bottom: 6px; }
.top h1 { margin: 0; font: 400 clamp(28px, 3vw, 38px)/1 var(--f-display); }
.top-actions { display: flex; gap: 10px; align-items: center; }
.icon-btn { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--white); box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.bell i { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--rose-deep); color: #fff; font: 700 10.5px/18px var(--f-ui); font-style: normal; }
.bell i:empty { display: none; }
.bell.ring svg { animation: ring .9s var(--ease); }
@keyframes ring { 20% { transform: rotate(14deg); } 40% { transform: rotate(-12deg); } 60% { transform: rotate(8deg); } 80% { transform: rotate(-4deg); } }
.menu-btn { display: none; }
.feed-pop { position: absolute; right: clamp(16px, 3vw, 36px); top: 74px; width: min(380px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; padding: 10px; border-radius: var(--r-lg); background: var(--white); box-shadow: var(--shadow-lift), 0 0 0 1px var(--line); animation: pop .4s var(--ease); }
.feed-item { display: flex; gap: 12px; padding: 12px; border-radius: 14px; font-size: 13px; color: var(--ink-2); }
.feed-item b { display: block; color: var(--ink); font-size: 13.5px; }
.feed-item.unread { background: var(--rose-pastel); }
.feed-item time { font-size: 11.5px; color: var(--ink-3); }
.feed-dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--gold); flex: none; }
.feed-item.cancelled .feed-dot { background: var(--err); }

.demo-banner { display: flex; gap: 16px; align-items: center; justify-content: space-between; margin: 16px clamp(16px, 3vw, 36px) 0; padding: 12px 16px; border-radius: 14px; background: rgba(176,122,42,.1); font-size: 13px; color: var(--ink-2); }
.demo-banner[hidden] { display: none; }

.view { padding: 22px clamp(16px, 3vw, 36px) 60px; outline: none; }
.view > * { animation: stepIn .5s var(--ease); }

/* Bloques genéricos */
.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: 1.4fr 1fr; }
.card { background: var(--white); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow-soft); min-width: 0; }
.card h2 { font: 400 26px/1.1 var(--f-display); margin: 0 0 4px; }
.card h3 { font: 500 20px/1.1 var(--f-display); margin: 0 0 10px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.muted { color: var(--ink-3); font-size: 13px; }
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi span { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.kpi b { font: 300 44px/1 var(--f-display); }
.kpi small { font-size: 12.5px; color: var(--ink-2); }
.kpi--accent { background: var(--mocha); color: var(--ivory); }
.kpi--accent span, .kpi--accent small { color: rgba(251,247,242,.6); }
.kpi--accent b { color: var(--gold-light); }

.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 14px; padding: 12px 6px; border-bottom: 1px solid var(--line); text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; }
.li:last-child { border-bottom: 0; }
button.li:hover { background: var(--ivory); border-radius: 12px; }
.li-time { font: 500 20px/1 var(--f-display); width: 58px; flex: none; }
.li-main { flex: 1; min-width: 0; font-size: 13px; color: var(--ink-2); }
.li-main b { display: block; color: var(--ink); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.pill--confirmed { background: rgba(94,140,106,.12); color: var(--ok); }
.pill--completed { background: rgba(185,143,78,.14); color: #8C6A33; }
.pill--cancelled { background: rgba(169,75,75,.1); color: var(--err); }
.pill--no_show { background: rgba(59,42,40,.08); color: var(--ink); }
.pill--needs_provider { background: rgba(176,122,42,.12); color: var(--warn); }
.pill--queued { background: rgba(94,140,106,.12); color: var(--ok); }
.pill--void { background: var(--cream); color: var(--ink-3); }
.pill--sent_manual { background: rgba(94,140,106,.12); color: var(--ok); }
.pill--demo { background: var(--cream); color: var(--ink-3); }

/* Barras semana */
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; height: 170px; padding-top: 10px; }
.bar { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; font-size: 11.5px; color: var(--ink-3); }
.bar i { display: block; width: 100%; max-width: 46px; border-radius: 10px 10px 4px 4px; background: linear-gradient(180deg, var(--rose-powder), var(--rose-palo)); min-height: 4px; transition: height .8s var(--ease); }
.bar.today i { background: linear-gradient(180deg, var(--gold-soft), var(--gold)); }
.bar b { color: var(--ink); font-size: 13px; }

/* Toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .field { flex-direction: row; align-items: center; }
.toolbar input, .toolbar select { min-height: 42px; padding: 8px 14px; border-radius: 12px; border: 0; background: var(--white); box-shadow: inset 0 0 0 1px var(--line-strong); font: 500 14px var(--f-ui); color: var(--ink); }
.toolbar .grow { flex: 1; min-width: 180px; }
.seg { display: inline-flex; padding: 4px; border-radius: 99px; background: var(--white); box-shadow: inset 0 0 0 1px var(--line); }
.seg button { border: 0; background: none; padding: 8px 14px; border-radius: 99px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.seg button.on { background: var(--ink); color: var(--ivory); }

/* Tabla */
.table-wrap { overflow-x: auto; background: var(--white); border-radius: var(--r-lg); box-shadow: var(--shadow-soft); }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); padding: 14px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr { cursor: pointer; transition: background .2s; }
table.t tbody tr:hover { background: var(--ivory); }
table.t td b { font-weight: 600; }

/* Agenda */
.agenda { --row: 22px; position: relative; display: grid; grid-template-columns: 60px repeat(var(--cols), minmax(170px, 1fr)); background: var(--white); border-radius: var(--r-lg); box-shadow: var(--shadow-soft); overflow: auto; max-height: calc(100svh - 230px); }
.ag-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 12px; background: rgba(255,255,255,.95); border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.ag-head.corner { left: 0; z-index: 4; }
.ag-head .avatar { width: 32px; height: 32px; font-size: 15px; }
.ag-times { position: sticky; left: 0; z-index: 2; background: var(--white); border-right: 1px solid var(--line); }
.ag-times div { height: calc(var(--row) * 4); font-size: 11px; color: var(--ink-3); text-align: right; padding: 0 8px; transform: translateY(-7px); }
.ag-col { position: relative; border-right: 1px solid var(--line); background-image: repeating-linear-gradient(180deg, transparent 0, transparent calc(var(--row) * 4 - 1px), var(--line) calc(var(--row) * 4 - 1px), var(--line) calc(var(--row) * 4)); }
.ag-off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, rgba(59,42,40,.035) 0 8px, transparent 8px 16px); }
.ag-block { position: absolute; left: 6px; right: 6px; border-radius: 12px; padding: 7px 10px; text-align: left; border: 0; overflow: hidden; font-size: 12px; line-height: 1.3; background: hsl(var(--h) 60% 93%); box-shadow: inset 3px 0 0 hsl(var(--h) 45% 60%); color: var(--ink); transition: transform .2s, box-shadow .2s; }
.ag-block:hover { transform: scale(1.015); box-shadow: inset 3px 0 0 hsl(var(--h) 45% 60%), var(--shadow-soft); z-index: 2; }
.ag-block b { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-block span { color: var(--ink-2); }
.ag-block.cancelled { opacity: .45; text-decoration: line-through; }
.ag-block.no_show { background: var(--cream); box-shadow: inset 3px 0 0 var(--ink-3); }
.ag-block.completed { filter: saturate(.5); }
.ag-block.timeoff { background: repeating-linear-gradient(135deg, var(--cream) 0 6px, #fff 6px 12px); box-shadow: inset 3px 0 0 var(--ink-3); cursor: default; }
.ag-block .new { position: absolute; right: 8px; top: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--rose-deep); }
.ag-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--rose-deep); z-index: 1; pointer-events: none; }
.ag-now::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--rose-deep); }

/* Formularios del panel */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; font-size: 13.5px; cursor: pointer; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 99px; background: var(--beige); position: relative; transition: background .3s; cursor: pointer; margin: 0; }
.switch input::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .3s var(--ease); }
.switch input:checked { background: var(--rose-deep); }
.switch input:checked::after { transform: translateX(18px); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 99px; background: var(--ivory); box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; cursor: pointer; }
.checks input { accent-color: var(--rose-deep); }
.sched { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; align-items: center; font-size: 13.5px; }
.sched input { min-height: 40px; padding: 8px 12px; border-radius: 10px; border: 0; box-shadow: inset 0 0 0 1px var(--line-strong); font: 500 14px var(--f-ui); width: 100%; }

.svc-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 16px; align-items: center; }
.svc-row img, .svc-row .ph { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; background: var(--nacre); }
.svc-row.off { opacity: .55; }

.integ { display: flex; gap: 14px; align-items: flex-start; }
.integ .ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--ivory-2); flex: none; font-size: 20px; }
.integ p { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); }
.integ code, .card code { font-size: 12px; background: var(--ivory-2); padding: 2px 6px; border-radius: 6px; }

.msg-preview { white-space: pre-wrap; font-size: 13px; background: var(--ivory); padding: 14px; border-radius: 12px; color: var(--ink-2); }
.qr { width: 168px; height: 168px; padding: 12px; background: #fff; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; }
.qr img, .qr canvas { width: 144px !important; height: 144px !important; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--ink-2); }
.empty-state b { display: block; font: 400 26px var(--f-display); color: var(--ink); margin-bottom: 6px; }
.client-flag { font-size: 11px; font-weight: 700; color: var(--err); }

@media (max-width: 1200px) { .g-4 { grid-template-columns: repeat(2, 1fr); } .g-3 { grid-template-columns: 1fr 1fr; } .g-2 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  body.admin { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; width: 270px; transform: translateX(-105%); transition: transform .5s var(--ease); }
  .side.open { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.3); }
  .menu-btn { display: grid; }
  .top-actions .btn { padding: 0 14px; }
  .g-3, .form-grid { grid-template-columns: 1fr; }
  .demo-banner { flex-direction: column; align-items: flex-start; }
  .agenda { grid-template-columns: 52px repeat(var(--cols), minmax(150px, 1fr)); }
  .svc-row { grid-template-columns: 52px 1fr; }
  .svc-row > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 520px) { .g-4 { grid-template-columns: 1fr 1fr; } .kpi b { font-size: 34px; } .card { padding: 18px; } .sched { grid-template-columns: 1fr; } }
