/* ==========================================================
   Auditorio — panel de gestión
   ========================================================== */
:root {
  --ink: #16110e;
  --ink-2: #221a16;
  --bg: #f4efe8;
  --card: #fffdfa;
  --text: #261e19;
  --muted: #85756a;
  --line: #e6ddd2;
  --line-2: #d8ccbf;
  --accent: #b5622f;
  --accent-2: #9c3f22;
  --gold: #d9a35b;
  --ok: #2f7a4b;
  --warn: #b7791f;
  --danger: #b3261e;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 14px;
  --shadow: 0 1px 2px rgba(22,17,14,.05), 0 8px 24px -14px rgba(22,17,14,.22);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 15px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
button { font: inherit; cursor: pointer; }
code { background: #efe7dc; padding: 1px 6px; border-radius: 5px; font-size: .9em; }
.muted { color: var(--muted); }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; padding: .7em 1.25em; border-radius: 10px; font-weight: 600; font-size: .92rem; text-decoration: none; border: 1px solid transparent; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; line-height: 1.2; }
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover { background: #2e241e; }
.btn--dark { background: var(--ink-2); color: #fff; }
.btn--ghost { background: var(--card); border-color: var(--line-2); color: var(--text); }
.btn--ghost:hover { border-color: var(--text); }
.btn--danger-ghost { background: transparent; border-color: rgba(179,38,30,.3); color: var(--danger); }
.btn--danger-ghost:hover { background: rgba(179,38,30,.06); }
.btn--sm { padding: .5em .95em; font-size: .85rem; }
.btn--block { width: 100%; }
.iconbtn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--card); display: grid; place-items: center; }
.iconbtn:hover { border-color: var(--text); }
.iconbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.iconlink { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--muted); }
.iconlink:hover { background: var(--bg); color: var(--text); }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #f1e9de; display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.side__brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 4px 8px 22px; }
.side__brand span { display: flex; flex-direction: column; line-height: 1.05; }
.side__brand small { font-size: .65rem; letter-spacing: .2em; text-transform: uppercase; opacity: .6; }
.side__brand strong { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; }
.side__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side__nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none; font-weight: 500; font-size: .93rem; color: rgba(241,233,222,.75); transition: background .15s, color .15s; }
.side__nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side__nav a.is-active { background: rgba(217,163,91,.14); color: #fff; }
.side__nav a.is-active .ico { color: var(--gold); }
.side__nav .side__new { margin: 6px 0; background: var(--accent); color: #fff; }
.side__nav .side__new:hover { background: #c46d37; }
.side__sep { font-size: .66rem; letter-spacing: .18em; text-transform: uppercase; color: rgba(241,233,222,.4); padding: 18px 12px 6px; }
.badge { margin-left: auto; font-style: normal; font-size: .7rem; font-weight: 700; background: var(--accent); color: #fff; border-radius: 99px; padding: 1px 7px; min-width: 20px; text-align: center; }
.side__user { border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px; }
.side__me { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 8px; border-radius: 10px; }
.side__me:hover, .side__me.is-active { background: rgba(255,255,255,.06); }
.side__me span:last-child { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.side__me strong { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side__me small { font-size: .75rem; opacity: .6; }
.side__links { display: flex; gap: 14px; padding: 8px 8px 0; font-size: .82rem; }
.side__links a { color: rgba(241,233,222,.6); text-decoration: none; }
.side__links a:hover { color: #fff; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: var(--ink); display: grid; place-items: center; font-weight: 700; font-size: .9rem; flex: none; text-decoration: none; }
.avatar--soft { background: #efe2d2; color: var(--accent-2); }
.main { padding: 32px clamp(16px, 3.5vw, 44px) 60px; min-width: 0; max-width: 1400px; width: 100%; }
.mobilebar, .tabbar, .savebar { display: none; }

/* ---------- Cabecera de página ---------- */
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.pagehead h1 { font-family: var(--serif); font-size: clamp(1.9rem, 3.4vw, 2.6rem); font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; }
.pagehead__kicker { margin: 4px 0 0; color: var(--muted); font-size: .9rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pagehead__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-block; font-size: .85rem; color: var(--muted); text-decoration: none; margin-bottom: 6px; }
.back:hover { color: var(--text); }

/* ---------- Tarjetas y avisos ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 22px; }
.card__title { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 14px; }
.card__more { display: block; margin-top: 14px; font-size: .88rem; font-weight: 600; color: var(--accent-2); text-decoration: none; }
.toast { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 600; font-size: .92rem; animation: slide .3s ease; }
.toast--ok { background: #e3f1e6; color: #1f5b35; border: 1px solid #bcdcc5; }
.toast--error { background: #fbe7e4; color: #8a1f17; border: 1px solid #f0c2bb; }
@keyframes slide { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: .92rem; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert--error { background: #fbe7e4; color: #8a1f17; border: 1px solid #f0c2bb; }
.alert--warn { background: #fdf3df; color: #7a4f0e; border: 1px solid #f0d9a8; margin: 14px 0 0; }
.alert--warn a { font-weight: 700; }
.emptybox { text-align: center; padding: 26px 10px; color: var(--muted); }
.emptybox--big { padding: 56px 20px; }
.emptybox svg { width: 40px; height: 40px; fill: none; stroke: var(--accent); stroke-width: 1.5; margin-bottom: 8px; }
.hint { display: block; font-size: .8rem; color: var(--muted); font-weight: 400; }

/* ---------- Etiquetas ---------- */
.tag { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .04em; padding: .25em .65em; border-radius: 99px; background: color-mix(in srgb, var(--c) 13%, white); color: color-mix(in srgb, var(--c) 85%, black); white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; padding: .2em .65em; border-radius: 99px; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status--confirmado { background: #e3f1e6; color: var(--ok); }
.status--pendiente { background: #fdf3df; color: var(--warn); }
.status--cancelado { background: #f3e9e7; color: var(--danger); }
.pill { display: inline-block; font-size: .72rem; font-weight: 600; padding: .2em .6em; border-radius: 99px; background: #efe7dc; color: #5f5047; font-style: normal; white-space: nowrap; }

/* ---------- Resumen ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; text-decoration: none; display: grid; grid-template-columns: 1fr auto; align-items: end; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.stat:hover { border-color: var(--line-2); transform: translateY(-1px); }
.stat span { grid-column: 1 / -1; font-size: .78rem; color: var(--muted); font-weight: 600; }
.stat b { font-family: var(--serif); font-size: 2.4rem; font-weight: 600; line-height: 1.1; }
.stat small { color: var(--muted); font-size: .78rem; padding-bottom: 8px; }
.stat--warn b { color: var(--warn); }

/* ---------- Agenda (calendario del panel) ---------- */
.dash { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.acal { padding: 18px; }
.acal__bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.acal__nav { display: flex; align-items: center; gap: 6px; }
.acal__title { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; margin-left: 8px; text-transform: capitalize; }
.acal__tools { display: flex; gap: 8px; align-items: center; }
.seg { display: inline-flex; background: #efe7dc; border-radius: 10px; padding: 3px; gap: 2px; }
.seg button, .seg__opt span { border: 0; background: none; padding: .4em .9em; border-radius: 8px; font-weight: 600; font-size: .85rem; color: var(--muted); display: block; text-align: center; cursor: pointer; }
.seg button.is-on, .seg__opt input:checked + span { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.seg__opt { flex: 1; position: relative; min-width: 0; }
.seg__opt input, .typepick input, .switch input, .techitem input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; left: 0; top: 0; width: 1px; height: 1px; margin: 0; }
.seg--full .seg__opt span { padding: .45em .4em; font-size: .82rem; }
.seg__opt input:focus-visible + span { outline: 2px solid var(--accent); }
.seg__opt--confirmado input:checked + span { color: var(--ok); }
.seg__opt--pendiente input:checked + span { color: var(--warn); }
.seg__opt--cancelado input:checked + span { color: var(--danger); }
.seg--full { display: flex; width: 100%; }
.acal__dow, .acal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.acal__dow span { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0 8px 6px; }
.acal__grid { border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.aday { min-height: 112px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 3px; position: relative; min-width: 0; }
.aday.is-out { background: #faf6f1; }
.aday.is-out .aday__num { color: #c0b3a7; }
.aday.is-today .aday__num { background: var(--ink); color: #fff; }
.aday__head { display: flex; justify-content: space-between; align-items: center; }
.aday__num { font-size: .8rem; font-weight: 700; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.aday__add { opacity: 0; width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; text-decoration: none; color: var(--muted); font-size: 1.1rem; line-height: 1; transition: opacity .15s; }
.aday:hover .aday__add, .aday__add:focus-visible { opacity: 1; }
.aday__add:hover { background: #efe7dc; color: var(--text); }
.aev { display: block; text-decoration: none; font-size: .74rem; line-height: 1.3; padding: 3px 6px; border-radius: 6px; background: color-mix(in srgb, var(--c) 14%, white); color: color-mix(in srgb, var(--c) 80%, black); border-left: 3px solid var(--c); overflow: hidden; font-weight: 600; overflow-wrap: anywhere; }
.aev span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.aev b { display: block; font-size: .68rem; opacity: .85; }
.aev:hover { background: color-mix(in srgb, var(--c) 22%, white); }
.aev b { font-weight: 700; }
.aev.is-pendiente { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 10%, white) 0 6px, white 6px 10px); border-left-style: dashed; }
.aev.is-cancelado { text-decoration: line-through; opacity: .5; }
.aday__dots { display: none; }
.acal__list { display: flex; flex-direction: column; }
.lday { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 60px 1fr; gap: 12px; }
.lday__d { text-align: center; line-height: 1.05; }
.lday__d b { display: block; font-family: var(--serif); font-size: 1.8rem; }
.lday__d small { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.lday.is-today .lday__d b { color: var(--accent); }
.lday__evs { display: flex; flex-direction: column; gap: 6px; }
.lev { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; align-items: center; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); text-decoration: none; border-left: 4px solid var(--c); }
.lev:hover { border-color: var(--line-2); border-left-color: var(--c); background: #fcf8f3; }
.lev__time { font-weight: 700; font-size: .88rem; font-variant-numeric: tabular-nums; }
.lev__title { font-weight: 600; min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.lev .status { grid-column: 2; justify-self: start; }
.lev__meta { grid-column: 2; font-size: .78rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; font-size: .76rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.dashed { border: 1.5px dashed var(--muted); }

.nextlist { padding: 20px; }
.nitem { display: grid; grid-template-columns: 48px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.nitem:last-of-type { border-bottom: 0; }
.nitem:hover strong { color: var(--accent-2); }
.nitem__date { text-align: center; line-height: 1.05; border-radius: 10px; padding: 6px 0; background: color-mix(in srgb, var(--c) 10%, white); color: color-mix(in srgb, var(--c) 85%, black); }
.nitem__date b { display: block; font-family: var(--serif); font-size: 1.5rem; }
.nitem__date small { font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; }
.nitem__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.nitem__body strong { font-size: .94rem; line-height: 1.3; }
.nitem__meta { font-size: .8rem; color: var(--muted); }
.nitem__tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 2px; }

/* ---------- Formulario de evento ---------- */
.evform { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.evform__main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.fset { display: flex; flex-direction: column; gap: 16px; }
.fset__title { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; font-weight: 700; }
.fset__title span { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font-size: .8rem; display: grid; place-items: center; }
.fset__hint { margin: -8px 0 0; color: var(--muted); font-size: .88rem; }
.sticky { position: sticky; top: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: .84rem; font-weight: 600; color: #4d4038; min-width: 0; }
.field small { font-weight: 400; color: var(--muted); }
.field__label { font-size: .84rem; font-weight: 600; color: #4d4038; }
.field input, .field select, .field textarea, .filters input, .filters select, .pop input, .auth input {
  font: inherit; font-size: .95rem; color: var(--text); background: #fff; border: 1px solid var(--line-2); border-radius: 10px; padding: .65em .8em; width: 100%; transition: border-color .15s, box-shadow .15s; font-weight: 400; min-width: 0; }
.field input:focus, .field select:focus, .field textarea:focus, .filters input:focus, .filters select:focus, .pop input:focus, .auth input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(181,98,47,.15); }
.field textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2--tight { gap: 10px; }
.grid4 { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 14px; }
.typepick { display: flex; flex-wrap: wrap; gap: 8px; }
.typepick label { position: relative; }
.typepick input { position: absolute; opacity: 0; }
.typepick span { display: inline-flex; align-items: center; gap: 7px; padding: .5em .9em; border-radius: 99px; border: 1px solid var(--line-2); font-size: .86rem; font-weight: 600; cursor: pointer; background: #fff; transition: all .15s; }
.typepick span::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.typepick input:checked + span { background: color-mix(in srgb, var(--c) 14%, white); border-color: var(--c); color: color-mix(in srgb, var(--c) 80%, black); }
.typepick input:focus-visible + span { outline: 2px solid var(--accent); }
.techgroup h3 { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.techgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.techitem { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--line-2); background: #fff; cursor: pointer; position: relative; transition: border-color .15s, background .15s; }
.techitem:hover { border-color: #bfae9d; }
.techitem input[type="checkbox"] { position: absolute; opacity: 0; }
.techitem__box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line-2); flex: none; display: grid; place-items: center; transition: all .15s; }
.techitem.is-on { border-color: var(--accent); background: #fdf6ef; }
.techitem.is-on .techitem__box { background: var(--accent); border-color: var(--accent); }
.techitem.is-on .techitem__box::after { content: ""; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
.techitem input:focus-visible ~ .techitem__box { outline: 2px solid var(--accent); outline-offset: 2px; }
.techitem__txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.techitem__txt strong { font-size: .87rem; }
.techitem__txt small { font-size: .75rem; color: var(--muted); }
.techitem__qty { margin-left: auto; }
.techitem__qty input { width: 58px; padding: .35em .4em; border: 1px solid var(--line-2); border-radius: 8px; font: inherit; text-align: center; }
.techitem:not(.is-on) .techitem__qty { opacity: .35; }
.switch { position: relative; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch__ui { width: 42px; height: 24px; border-radius: 99px; background: var(--line-2); position: relative; flex: none; transition: background .2s; }
.switch__ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .switch__ui { background: var(--ok); }
.switch input:checked + .switch__ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.switch strong { font-size: .9rem; }
.switch small { font-size: .78rem; color: var(--muted); }
.formactions { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 16px; }
.meta { font-size: .76rem; color: var(--muted); margin: 6px 0 0; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; margin-top: 8px; }

/* ---------- Listado ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px; margin-bottom: 16px; }
.filters__search { flex: 1 1 260px; position: relative; }
.filters__search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.filters__search input { padding-left: 36px; }
.filters select { width: auto; flex: 0 1 auto; }
.filters__reset { font-size: .85rem; color: var(--muted); }
.tablecard { padding: 0; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); background: #faf6f1; font-weight: 700; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; transition: background .12s; }
.table tbody tr:hover { background: #fcf8f3; }
.td-title a { font-weight: 700; text-decoration: none; }
.td-title small, .td-time small { display: block; color: var(--muted); font-size: .78rem; }
.td-time { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.td-act { width: 44px; }
.dchip { display: inline-block; text-align: center; line-height: 1.05; padding: 5px 8px; border-radius: 9px; background: color-mix(in srgb, var(--c) 10%, white); color: color-mix(in srgb, var(--c) 85%, black); min-width: 52px; }
.dchip b { display: block; font-family: var(--serif); font-size: 1.4rem; }
.dchip small { font-size: .62rem; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Mensajes ---------- */
.msglist { display: flex; flex-direction: column; gap: 8px; }
.msg { padding: 0; overflow: hidden; }
.msg__head { display: grid; grid-template-columns: auto minmax(160px, 240px) 1fr auto; gap: 14px; align-items: center; padding: 14px 18px; text-decoration: none; }
.msg__head:hover { background: #fcf8f3; }
.msg.is-unread { border-left: 3px solid var(--accent); }
.msg.is-unread .msg__who strong::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 7px; vertical-align: middle; }
.msg__who { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.msg__who small { color: var(--muted); font-size: .78rem; }
.msg__preview { color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.msg time { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.msg.is-open .msg__preview { visibility: hidden; }
.msg__body { padding: 4px 18px 18px 66px; }
.msg__text { background: #faf6f1; border-radius: 10px; padding: 14px 16px; margin: 0 0 14px; }
.msg__data { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: .88rem; margin: 0 0 16px; }
.msg__data dt { color: var(--muted); }
.msg__data dd { margin: 0; font-weight: 600; }
.msg__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.msg__actions form { margin: 0; }

/* ---------- Usuarios / ajustes ---------- */
.twocol { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack .btn:not(.btn--block) { align-self: flex-start; }
.userlist { list-style: none; margin: 0; padding: 0; }
.userlist li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.userlist li:last-child { border-bottom: 0; }
.userlist__who { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.userlist__who small { color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; }
.userlist__more { position: relative; }
.userlist__more summary { list-style: none; }
.userlist__more summary::-webkit-details-marker { display: none; }
.pop { position: absolute; right: 0; top: calc(100% + 6px); background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px -10px rgba(0,0,0,.25); padding: 12px; width: 260px; display: flex; flex-direction: column; gap: 8px; z-index: 10; }
.pop form { margin: 0; }
.pop__reset { display: flex; gap: 6px; }

/* ---------- Acceso ---------- */
.auth { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; background: var(--card); }
.auth__media { background-size: cover; background-position: center; position: relative; display: flex; align-items: flex-end; padding: 48px; color: #fff; }
.auth__media::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(22,17,14,.15), rgba(22,17,14,.85)); }
.auth__media div { position: relative; }
.auth__media p { text-transform: uppercase; letter-spacing: .2em; font-size: .75rem; color: var(--gold); margin: 0 0 8px; font-weight: 700; }
.auth__media h1 { font-family: var(--serif); font-size: clamp(2.2rem, 4vw, 3.4rem); font-weight: 500; max-width: 14ch; }
.auth__panel { display: grid; place-items: center; padding: 32px 20px; }
.auth__form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.auth__form h2 { font-family: var(--serif); font-size: 2.2rem; font-weight: 600; margin-top: 8px; }
.auth__form .muted { margin: -6px 0 6px; }
.auth__form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .86rem; }
.auth__form label small { font-weight: 400; color: var(--muted); }
.auth__form .alert { margin: 0; }
.auth__back { text-align: center; font-size: .86rem; color: var(--muted); text-decoration: none; margin-top: 6px; }

/* ---------- Responsive ---------- */
.hide-mobile { }
@media (max-width: 1180px) {
  .dash { grid-template-columns: 1fr; }
  .evform { grid-template-columns: 1fr 300px; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .mobilebar { display: flex; justify-content: space-between; align-items: center; background: var(--ink); color: #f1e9de; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); position: sticky; top: 0; z-index: 40; }
  .mobilebar .side__brand { padding: 0; }
  .mobilebar .side__brand strong { font-size: 1.2rem; }
  .mobilebar__actions { display: flex; gap: 10px; align-items: center; }
  .mobilebar .iconlink { color: rgba(241,233,222,.8); }
  .main { padding: 20px 16px 110px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(255,253,250,.97); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 4px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; font-weight: 600; color: var(--muted); text-decoration: none; padding: 4px 0; position: relative; }
  .tabbar a .ico { width: 22px; height: 22px; }
  .tabbar a.is-active { color: var(--accent-2); }
  .tabbar .badge { position: absolute; top: 0; left: 50%; margin-left: 6px; font-size: .62rem; padding: 0 5px; }
  .tabbar__new { align-self: center; }
  .tabbar__new .ico { width: 24px !important; height: 24px !important; background: var(--ink); color: #fff; border-radius: 14px; padding: 12px; box-sizing: content-box; margin-top: -18px; box-shadow: 0 6px 16px rgba(22,17,14,.3); }
  .hide-mobile { display: none !important; }
  .evform { grid-template-columns: 1fr; }
  .evform__side { order: -1; }
  .sticky { position: static; }
  .evform__side .formactions .btn--primary { display: none; }
  .savebar { display: block; position: fixed; left: 0; right: 0; bottom: 64px; padding: 10px 16px; background: linear-gradient(transparent, var(--bg) 30%); z-index: 30; }
  .savebar .btn { box-shadow: 0 8px 20px rgba(22,17,14,.25); padding: .9em; }
  .twocol { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  body { font-size: 15px; }
  .pagehead { align-items: flex-start; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat b { font-size: 2rem; }
  .card { padding: 16px; }
  .acal { padding: 12px; }
  .acal__title { font-size: 1.35rem; }
  .acal__dow span { padding: 0 0 6px; text-align: center; font-size: .62rem; }
  .aday { min-height: 54px; padding: 3px; align-items: center; cursor: pointer; }
  .aday__head { justify-content: center; }
  .aday__add, .aev { display: none; }
  .aday__dots { display: flex; gap: 2px; justify-content: center; flex-wrap: wrap; }
  .aday__dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
  .aday.is-sel { background: #fdf3e8; }
  .lday { grid-template-columns: 44px 1fr; gap: 8px; }
  .grid2, .grid4 { grid-template-columns: 1fr 1fr; }
  .grid4 .field:first-child { grid-column: 1 / -1; }
  .techgrid { grid-template-columns: 1fr; }
  .filters { padding: 10px; }
  .filters select { flex: 1 1 calc(50% - 10px); }
  .filters .btn { flex: 1 1 100%; }
  /* Tabla → tarjetas */
  .tablecard { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .table thead { display: none; }
  .table, .table tbody { display: block; }
  .table tr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; box-shadow: var(--shadow); }
  .table td { padding: 0; border: 0; }
  .td-date { grid-row: span 3; align-self: start; }
  .td-title { grid-column: 2; }
  .td-time { grid-column: 2; font-size: .85rem; }
  .td-time small { display: inline; margin-left: 6px; }
  .td-type { grid-column: 2; }
  .td-tech { display: none; }
  .td-status { grid-column: 2; }
  .td-act { display: none; }
  .msg__head { grid-template-columns: auto 1fr auto; padding: 12px 14px; }
  .msg__preview { grid-column: 2 / -1; grid-row: 2; }
  .msg time { grid-row: 1; grid-column: 3; align-self: start; }
  .msg.is-open .msg__preview { display: none; }
  .msg__body { padding: 0 14px 14px; }
  .msg__actions .btn, .msg__actions form { flex: 1 1 auto; }
  .msg__actions form .btn { width: 100%; }
  .auth { grid-template-columns: 1fr; }
  .auth__media { min-height: 200px; padding: 24px; }
  .auth__media h1 { font-size: 2rem; }
  .pop { width: 240px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .side, .tabbar, .mobilebar, .savebar { display: none !important; } }

/* ==========================================================
   v2 · Escudo, carteles, limpieza y avisos
   ========================================================== */
.side__shield { width: 30px; height: 44px; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
.mobilebar .side__shield { width: 24px; height: 36px; }
.auth__shield { width: 44px; height: 65px; object-fit: contain; }
.badge--blue { background: #4F86B0; }

/* Avisos con enlace */
.toast { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toast--warn { background: #fdf3df; color: #7a4f0e; border: 1px solid #f0d9a8; }
.toast .btn { flex: none; }

.stats { grid-template-columns: repeat(5, 1fr); }
.stat--blue b { color: #3c6f97; }

/* Datos + cartel */
.withposter { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 20px; align-items: start; }
.withposter__fields { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.poster { display: flex; flex-direction: column; gap: 6px; }
.poster__drop { position: relative; display: grid; place-items: center; aspect-ratio: 3 / 4; border: 1.5px dashed var(--line-2); border-radius: 12px; background: #fbf8f4; overflow: hidden; cursor: pointer; transition: border-color .15s, background .15s; }
.poster__drop:hover, .poster__drop.is-drag { border-color: var(--accent); background: #fdf6ef; }
.poster__drop.has-img { border-style: solid; background: #1d1714; }
.poster__drop img { width: 100%; height: 100%; object-fit: contain; }
.poster__drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.poster__empty { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 12px; color: var(--muted); }
.poster__empty .ico { width: 30px; height: 30px; color: var(--accent); margin-bottom: 4px; }
.poster__empty strong { color: var(--text); font-size: .9rem; }
.poster__empty small { font-size: .74rem; }
.poster__info { min-height: 1.2em; }
.check--small { font-size: .82rem; font-weight: 500; margin-top: 0; }

/* Limpieza en el formulario */
.cleanset { border-left: 3px solid #4F86B0; }
.cleanset__body { display: flex; flex-direction: column; gap: 14px; }
.cleanset__body[hidden] { display: none; }
.cleanset__auto { margin: -6px 0 0; }
.cleanset__status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line); }
.grid4--3 { grid-template-columns: 1.4fr 1fr 1fr; }
.notice { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 700; padding: .25em .7em; border-radius: 99px; white-space: nowrap; }
.notice::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.notice--sin_avisar { background: #e8f0f7; color: #3c6f97; }
.notice--cambios { background: #fdf3df; color: var(--warn); }
.notice--avisada { background: #e3f1e6; color: var(--ok); }
.linkcard { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--c) 8%, white); border-left: 4px solid var(--c); }
.linkcard small { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.linkcard a { font-weight: 700; font-size: 1.02rem; text-decoration: none; }
.linkcard a:hover { text-decoration: underline; }
.linkcard span { font-size: .85rem; color: var(--muted); }

/* Calendario: limpiezas */
.aev.is-clean { font-style: italic; border-left-style: dotted; font-weight: 600; }
.lev.is-clean .lev__title { font-style: italic; }

/* Correo a limpieza */
.mailgrid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.mailcard { display: flex; flex-direction: column; gap: 14px; }
.mailcard textarea { font-family: inherit; line-height: 1.55; }
.mailcard .alert { margin: 0; }
.mailactions { display: flex; gap: 8px; flex-wrap: wrap; }
.mailstatus:empty { display: none; }
.mailstatus { padding: 10px 14px; border-radius: 10px; background: #e3f1e6; color: #1f5b35; font-weight: 600; font-size: .9rem; }

/* Listado de limpiezas */
.cleaninfo { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; margin-bottom: 16px; background: #f0f5fa; border-color: #d6e3ee; }
.cleaninfo .ico { color: #3c6f97; margin-top: 2px; }
.cleaninfo p { margin: 0; font-size: .9rem; }
.cleaninfo a { font-weight: 700; color: #3c6f97; }
.seg--tabs { margin-bottom: 14px; }
.seg--tabs a { padding: .45em 1.1em; border-radius: 8px; font-weight: 600; font-size: .85rem; color: var(--muted); text-decoration: none; }
.seg--tabs a.is-on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.cleanlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cleanrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 12px 16px; }
.cleanrow.is-cancelled { opacity: .7; }
.cleanrow.is-cancelled .cleanrow__time { text-decoration: line-through; }
.cleanlist__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cleanrow__time { font-weight: 700; text-decoration: none; font-variant-numeric: tabular-nums; }
.cleanrow__after { font-size: .88rem; color: #5f5047; }
.cleanrow__after a { font-weight: 600; }
.cleanrow__state { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.cleanlist--compact li { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cleanlist--compact li:last-child { border-bottom: 0; }
.cleanlist--compact a { text-decoration: none; font-size: .88rem; }
.cleanlist--compact .cleanlist__body > span { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

/* Menú Más */
.morelist { padding: 6px; display: flex; flex-direction: column; }
.morelist a { display: flex; align-items: center; gap: 14px; padding: 14px 12px; border-radius: 10px; text-decoration: none; font-weight: 600; }
.morelist a:hover { background: #faf6f1; }
.morelist a + a { border-top: 1px solid var(--line); }
.morelist .ico { width: 22px; height: 22px; color: var(--muted); }
.morelist .badge { margin-left: auto; }
.morelist__danger { color: var(--danger); }
.morelist__danger .ico { color: var(--danger) !important; }

/* Ajustes */
.settings { display: flex; flex-direction: column; gap: 18px; max-width: 980px; }
.settings__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.field--wide { grid-column: 1 / -1; }
.settings__save { position: sticky; bottom: 16px; }
.settings__save .btn { box-shadow: 0 8px 20px rgba(22,17,14,.2); }

@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .mailgrid { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .settings__save { bottom: 76px; }
}
@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:last-child { grid-column: 1 / -1; }
  .withposter { grid-template-columns: 1fr; }
  .poster { flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 6px 14px; }
  .poster .field__label { width: 100%; }
  .poster__drop { width: 140px; }
  .poster__info, .poster .check { flex: 1 1 140px; align-self: center; }
  .grid4--3 { grid-template-columns: 1fr 1fr; }
  .grid4--3 .field:first-child { grid-column: 1 / -1; }
  .cleanrow { grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; padding: 12px; }
  .cleanrow .dchip { grid-row: span 3; align-self: start; }
  .cleanrow__state { flex-direction: row; align-items: center; flex-wrap: wrap; grid-column: 2; }
  .cleanrow__act { grid-column: 2; }
  .cleanrow__act .btn { width: 100%; }
  .settings__grid { grid-template-columns: 1fr; }
  .mailactions .btn { flex: 1 1 calc(50% - 8px); }
}
@media (max-width: 960px) {
  .app { grid-template-rows: auto 1fr; align-content: start; }
}

/* ==========================================================
   v3 · Correo: ajustes, registro, respuestas
   ========================================================== */
.alert--ok { background: #e3f1e6; color: #1f5b35; border: 1px solid #bcdcc5; }
.fset__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.settings__toc { display: flex; flex-wrap: wrap; gap: 6px; margin: -8px 0 16px; }
.settings__toc a { font-size: .82rem; font-weight: 600; text-decoration: none; padding: .35em .85em; border-radius: 99px; background: var(--card); border: 1px solid var(--line); color: #5f5047; }
.settings__toc a:hover { border-color: var(--text); color: var(--text); }
.settings__adv { border-top: 1px dashed var(--line-2); padding-top: 12px; }
.settings__adv summary { cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.settings__adv[open] summary { margin-bottom: 14px; }
.settings__test { margin-top: 18px; max-width: 980px; }
.settings__testform { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.settings__testform .field { flex: 1 1 260px; }
.maillog { list-style: none; margin: 0; padding: 0; }
.maillog li { display: grid; grid-template-columns: 80px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .86rem; }
.maillog li:last-child { border-bottom: 0; }
.maillog__when { color: var(--muted); font-variant-numeric: tabular-nums; }
.maillog__what { min-width: 0; overflow-wrap: anywhere; }
.maillog__what small { display: block; color: var(--muted); font-size: .78rem; }
.maillog__err { color: var(--danger) !important; }
.msg__flags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.msg__flags:empty { display: none; }
.msg__reply { background: #f0f5fa; border-left: 3px solid #4F86B0; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; font-size: .9rem; }
.msg__reply small { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.msg__replyform { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 14px 0 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.msg__replyform .field { width: 100%; }
@media (max-width: 720px) {
  .maillog li { grid-template-columns: 1fr auto; }
  .maillog__when { grid-column: 1 / -1; }
  .msg__replyform .btn { width: 100%; }
}
@media (max-width: 960px) {
  .tabbar { grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: 100vw; box-sizing: border-box; }
  .tabbar a { min-width: 0; }
}
.settings__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field select, .field input, .field textarea { max-width: 100%; }
@media (max-width: 720px) { .settings__grid { grid-template-columns: minmax(0, 1fr); } }
.field .check { display: flex; flex-direction: row; align-items: center; gap: 8px; margin: 2px 0 0; font-weight: 500; }
.field .check input { width: 18px; height: 18px; padding: 0; flex: none; accent-color: var(--accent); }

/* Pases adicionales */
.sessions { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px dashed var(--line-2); }
.sessions__head { display: flex; flex-direction: column; gap: 2px; }
.sessions__list { display: flex; flex-direction: column; gap: 8px; }
.sessions__list:empty { display: none; }
.sessrow { display: grid; grid-template-columns: 34px 1.4fr 1fr 1fr 36px; gap: 10px; align-items: end; padding: 10px 12px; border-radius: 12px; background: #faf6f1; border: 1px solid var(--line); }
.sessrow__n { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; color: var(--accent-2); align-self: center; text-align: center; }
.sessrow__rm { align-self: end; margin-bottom: 2px; }
.sessrow__rm:hover { border-color: var(--danger); color: var(--danger); }
.sessions__add { align-self: flex-start; }
.pill--sess { background: #f3e6da; color: var(--accent-2); }
@media (max-width: 720px) {
  .sessrow { grid-template-columns: 30px 1fr 1fr 36px; }
  .sessrow .field:first-of-type { grid-column: 2 / 4; }
  .sessrow__rm { grid-row: 1; grid-column: 4; }
  .sessrow__n { grid-row: 1 / 3; }
}
