/* Panel de administración con estilo de herramienta de empresa (como Google Workspace o SAP Fiori):
   grises neutros, superficies blancas, azul para las acciones y lo seleccionado, rojo/verde/ámbar solo
   para estados. La marca tocuGo queda en el logo. Claro u oscuro según el ordenador, o el que se elija
   con el botón de la barra (js/tema.js). */
:root {
  --bg: #F5F6F8; --surface: #FFFFFF; --ink: #1F2328; --muted: #5F6873; --line: #DFE3E8;
  --brand: #1A66C9; --brand-strong: #1A66C9; --brand-soft: #E8F0FB; --accent: #1A66C9; --accent-soft: #E8F0FB; --accent-ink: #1557AD;
  --danger: #C5221F; --danger-soft: #FCE8E6; --warn-bg: #FEF5DD; --warn-ink: #8A5A00; --ok-ink: #18794E; --ok-soft: #E6F4EA;
  --side: #FFFFFF; --blue: #1A66C9; --blue-soft: #E8F0FB; --chart-rest: #D3D9E0; --chart-cancel: #F0A8A2;
  --shadow: 0 1px 2px rgb(16 24 40 / .06);
  /* Kit de marca tocuGo (app/lib/.../BrandColors): solo para las vistas previas de lo que se ve en la app,
     que no cambian con el tema del panel. */
  --tg-bottle: #0E3B2E; --tg-night: #13201B; --tg-cream: #F6F3EA; --tg-cream-deep: #ECE6D6; --tg-spark: #FF6A1A; --tg-spark-soft: #FFE4D2;
  --tg-amber: #FFB547; --tg-banner: #F4F1E9; --tg-banner-pro: #FFF2DF;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1B1D21; --surface: #24272C; --ink: #E3E5E8; --muted: #9AA1AA; --line: #363A41;
  --brand: #8AB4F8; --brand-strong: #3B78D8; --brand-soft: #2A3445; --accent: #8AB4F8; --accent-soft: #2A3445; --accent-ink: #A8C7FA;
  --danger: #F2938C; --danger-soft: #3B2626; --warn-bg: #3A3220; --warn-ink: #F3C969; --ok-ink: #81C995; --ok-soft: #22362B;
  --side: #202327; --blue: #8AB4F8; --blue-soft: #2A3445; --chart-rest: #444A53; --chart-cancel: #A65A55;
  --shadow: 0 1px 2px rgb(0 0 0 / .3);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1B1D21; --surface: #24272C; --ink: #E3E5E8; --muted: #9AA1AA; --line: #363A41;
    --brand: #8AB4F8; --brand-strong: #3B78D8; --brand-soft: #2A3445; --accent: #8AB4F8; --accent-soft: #2A3445; --accent-ink: #A8C7FA;
    --danger: #F2938C; --danger-soft: #3B2626; --warn-bg: #3A3220; --warn-ink: #F3C969; --ok-ink: #81C995; --ok-soft: #22362B;
    --side: #202327; --blue: #8AB4F8; --blue-soft: #2A3445; --chart-rest: #444A53; --chart-cancel: #A65A55;
    --shadow: 0 1px 2px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
}
@font-face { font-family: Fredoka; src: url("/marca/Fredoka-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14.5px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
h2 { margin: 0; font-size: 18px; }
button { font: inherit; border-radius: 8px; padding: 8px 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
button:hover { border-color: var(--brand); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
button.primary { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(1.12); }
button.danger { color: var(--danger); border-color: var(--danger); }
button.danger.solid { background: var(--danger); color: #fff; }
button:disabled { opacity: .5; cursor: default; }
button.icon-btn { width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center; border-color: transparent; background: transparent; color: var(--muted); }
button.icon-btn:hover { background: var(--bg); border-color: var(--line); color: var(--ink); }
svg.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
input, textarea { font: inherit; width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow); }
.login { max-width: 380px; margin: 10vh auto 0; display: grid; gap: 12px; }
.login h1 { margin: 0; font-size: 22px; }
.login .login-logo { width: 44px; height: 44px; border-radius: 11px; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.5em; margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.tile b { display: block; font-size: 28px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile.attention { border-color: var(--brand); background: var(--brand-soft); }
.list { display: grid; gap: 14px; }
.review { display: grid; gap: 12px; }
.review .top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; align-items: baseline; }
.review h3 { margin: 0; font-size: 17px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--brand-soft); color: var(--brand); border-radius: 99px; padding: 2px 10px; font-size: 13px; font-weight: 600; }
.docs { display: flex; flex-wrap: wrap; gap: 8px; }
.docs button { display: inline-flex; gap: 6px; align-items: center; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.reject { display: grid; gap: 8px; background: var(--danger-soft); border-radius: 12px; padding: 12px; }
.empty { text-align: center; padding: 40px 16px; }
.notice { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 10px 12px; }
[hidden] { display: none !important; }
/* Enviar un aviso */
select { font: inherit; width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; }
.seg button[aria-pressed="true"] { background: var(--brand); color: #fff; font-weight: 600; }
.compose { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 760px) { .compose { grid-template-columns: 1fr; } }
.field { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.field small { font-weight: 400; color: var(--muted); }
.filters { display: grid; grid-template-columns: 1fr 1.4fr 90px; gap: 10px; align-items: end; }
@media (max-width: 560px) { .filters { grid-template-columns: 1fr; } }
.choice { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.choice input { width: auto; margin-top: 5px; }
.places { display: grid; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.places button { border: 0; border-radius: 0; text-align: left; border-bottom: 1px solid var(--line); }
.phone { background: #E4E7EB; border-radius: 18px; padding: 16px; }
.notif { background: #fff; color: var(--tg-night); border-radius: 16px; padding: 12px 14px; display: flex; gap: 10px; box-shadow: 0 1px 3px #0002; }
.notif .ic { width: 34px; height: 34px; border-radius: 50%; background: var(--tg-bottle); color: #fff; display: grid; place-items: center; flex: none; }
.notif.pro .ic { background: var(--tg-night); color: var(--tg-amber); }
.notif b { display: block; font-size: 14px; overflow-wrap: anywhere; } .notif small { color: #5C6660; overflow-wrap: anywhere; }
.count { background: var(--brand-soft); color: var(--brand); border-radius: 12px; padding: 12px 14px; font-weight: 600; }
.history { width: 100%; border-collapse: collapse; font-size: 14px; }
.history th, .history td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.history tbody tr:last-child td { border-bottom: 0; }
.history th { color: var(--muted); font: 600 11px/1.2 "Segoe UI", system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; border-radius: 99px; padding: 2px 9px; white-space: nowrap; background: var(--bg); color: var(--muted); }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.tag.servicio { background: #e3eefc; color: #1f4f99; } .tag.promocion { background: var(--warn-bg); color: var(--warn-ink); }
.scroll { overflow-x: auto; }
/* Catálogo */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tabs button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.cat-table td .actions { flex-wrap: nowrap; }
.tag.soon { background: var(--warn-bg); color: var(--warn-ink); }
.tag.off { background: var(--danger-soft); color: var(--danger); }
.tag.ok { background: var(--ok-soft); color: var(--ok-ink); }
.editor { display: grid; gap: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.editor .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.thumb { width: 120px; height: 90px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { border: 1px solid var(--line); border-radius: 8px; padding: 3px 10px; font-size: 13px; background: var(--surface); }
.preview { border: 1px dashed var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; background: var(--surface); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; }
.check input { width: auto; }

/* --- Estructura: menú lateral, barra superior y páginas ------------------------------------ */
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); border-right: 1px solid var(--line); padding: 16px 12px 24px; position: sticky; top: 0;
        height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; margin-bottom: 4px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.brand b { display: block; font: 600 21px/1 Fredoka, "Segoe UI", sans-serif; letter-spacing: .2px; }
.brand b i { font-style: normal; color: #FF6A1A; }
.brand small { display: block; font-size: 10.5px; letter-spacing: .14em; color: var(--muted); margin-top: 3px; font-weight: 600; }
.nav { display: grid; gap: 1px; }
.nav .group { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 5px; font-weight: 600; }
.nav a { position: relative; display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: 9px; color: var(--ink); text-decoration: none; font-weight: 500; font-size: 14px; }
.nav a:hover { background: var(--bg); }
.nav a .i { display: inline-grid; color: var(--muted); }
.nav a[aria-current] { background: var(--brand-soft); color: var(--accent-ink); font-weight: 600; }
.nav a[aria-current] .i { color: var(--accent); }
.nav a[aria-current] .i { color: var(--accent-ink); }
.nav a .n { margin-left: auto; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; background: var(--accent-soft); color: var(--accent-ink); }
.side .foot { margin-top: auto; padding: 14px 6px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; font-size: 13px; }
.side .foot .who { flex: 1; min-width: 0; display: grid; }
.side .foot .who b, .side .foot .who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .foot .who small { color: var(--muted); font-size: 12px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; color: #fff; font-size: 12px; font-weight: 700; background: var(--brand-strong); }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 28px; background: var(--surface); border-bottom: 1px solid var(--line);
          position: sticky; top: 0; z-index: 2; flex-wrap: wrap; }
.topbar h1 { font-size: 18px; margin: 0; flex: 1; font-weight: 650; }
.search-box kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 600 11px Consolas, ui-monospace, monospace; padding: 1px 6px;
                  border-radius: 5px; border: 1px solid var(--line); color: var(--muted); background: var(--bg); pointer-events: none; }
.search-box input:focus + kbd, .search-box input:not(:placeholder-shown) + kbd { display: none; }
#menu-toggle { display: none; }
.content { padding: 22px 28px 64px; display: grid; gap: 18px; max-width: 1400px; }
.page { display: grid; gap: 14px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.seg.light { background: var(--surface); }
.seg.light button[aria-pressed="true"] { background: var(--brand-soft); color: var(--accent-ink); font-weight: 600; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 5; transform: translateX(-100%); transition: transform .2s; }
  body.menu-open .side { transform: none; box-shadow: 0 0 0 100vmax #0006; }
  #menu-toggle { display: inline-block; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
}

/* --- Inicio ---------------------------------------------------------------------------------- */
#app-error:empty { display: none; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 20px; flex-wrap: wrap; }
.eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.hero h2 { margin: 6px 0 4px; font-size: 26px; line-height: 1.15; letter-spacing: -.01em; font-weight: 650; }
.hero h2 em { font-style: normal; }
.hero p { margin: 0; color: var(--muted); max-width: 720px; }
.hero p b { color: var(--ink); font-weight: 600; }
.hero p b.up { color: var(--ok-ink); } .hero p b.down { color: var(--danger); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.kpi .head { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.kpi .ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.kpi .ico.accent { background: var(--accent-soft); color: var(--accent); }
.kpi .v { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin: 12px 0 10px; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 15px; color: var(--muted); font-weight: 600; margin-left: 3px; }
.kpi .d { font-size: 12.5px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 10px; }
.pill { margin-left: auto; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 99px; white-space: nowrap; background: var(--bg); color: var(--muted); }
.pill.up { background: var(--ok-soft); color: var(--ok-ink); } .pill.down { background: var(--danger-soft); color: var(--danger); }
.up { color: var(--ok-ink); } .down { color: var(--danger); }
.dash-row { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 1100px) { .dash-row { grid-template-columns: 1fr; } }
.card h3 { margin: 0 0 14px; font-size: 15.5px; font-weight: 650; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.card-head h3 { margin: 2px 0 0; }
.card-head a { font-weight: 600; font-size: 13px; text-decoration: none; white-space: nowrap; }
.hint { color: var(--muted); font-size: 12.5px; font-weight: 400; }
#d-chart .grid { stroke: var(--line); }
#d-chart .axis { fill: var(--muted); font-size: 12px; }
#d-chart .done { fill: var(--brand); } #d-chart .rest { fill: var(--chart-rest); } #d-chart .cancel { fill: var(--chart-cancel); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.todo { display: grid; }
.todo-item { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.todo-item:last-child { border-bottom: 0; }
.todo-item b { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; font-variant-numeric: tabular-nums; background: var(--bg); color: var(--muted); }
.todo-item.has b { background: var(--accent-soft); color: var(--accent-ink); }
.todo-item .go { white-space: nowrap; margin-left: auto; color: var(--brand); font-weight: 600; font-size: 13px; }
.todo-item:hover .go { text-decoration: underline; }
.now-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.now-strip span { background: var(--bg); border-radius: 99px; padding: 4px 11px; font-size: 13px; color: var(--muted); }
.now-strip b { color: var(--ink); }
.bar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 10px; margin: 0 0 12px; }
.bar .track { grid-column: 1 / -1; background: var(--bg); border-radius: 6px; height: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.bar b { text-align: right; font-variant-numeric: tabular-nums; }
.rings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 6px; }
.ring { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; min-width: 0; }
.ring b { font-size: 13px; }
.ring svg { width: 52px; height: 52px; flex: none; }
.ring .track { stroke: var(--bg); } .ring .val { stroke: var(--brand); } .ring .val.accent { stroke: var(--accent); }
.ring text { fill: var(--ink); font-weight: 700; }
.ring small { display: block; color: var(--muted); font-size: 12px; }
.tag.blue { background: var(--blue-soft); color: var(--blue); }
#d-active td, #d-active th { white-space: nowrap; font-size: 13.5px; vertical-align: middle; }
.person { display: inline-flex; align-items: center; gap: 8px; }

/* --- Fase 2: listas, fichas, mapas y buscador ------------------------------------------------ */
.filters-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters-bar input, .filters-bar select { width: auto; flex: 1 1 180px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--brand-soft); }
.stack { display: grid; gap: 14px; align-content: start; }
.detail-head { display: grid; gap: 10px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 18px; }
.fact { display: grid; gap: 1px; font-size: 14px; }
.fact .muted { font-size: 12.5px; }
.timeline { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 14px; }
.chat { display: grid; gap: 8px; max-height: 340px; overflow: auto; }
.msg { background: var(--bg); border-radius: 12px; padding: 8px 12px; max-width: 80%; }
.msg.pro { justify-self: end; background: var(--brand-soft); }
.map { height: 320px; border-radius: 12px; border: 1px solid var(--line); z-index: 0; }
.map.big { height: calc(100vh - 230px); min-height: 420px; }
.pin { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 800;
       border: 2px solid #fff; box-shadow: 0 1px 4px #0006; }
.leaflet-popup-content a { color: #1A66C9; font-weight: 700; }
.tag.done { background: var(--bg); color: var(--muted); }
a { color: var(--brand); }
a.button { display: inline-block; text-decoration: none; border-radius: 10px; padding: 9px 14px; border: 1px solid var(--line); color: var(--ink); }
.search-box { position: relative; flex: 0 1 420px; }
.search-box input { padding: 8px 12px; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line);
                  border-radius: 12px; box-shadow: 0 8px 24px #0003; z-index: 10; max-height: 70vh; overflow: auto; padding: 6px 0; }
.search-results .group { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 12px 2px; font-weight: 600; }
.search-results a { display: block; padding: 7px 12px; color: var(--ink); text-decoration: none; }
.search-results a:hover { background: var(--brand-soft); }

/* --- Fase 3: informes, contenido, ajustes --------------------------------------------------- */
.funnel { display: grid; gap: 8px; }
.funnel-step { position: relative; padding: 8px 12px; border-radius: 10px; background: var(--bg); overflow: hidden; }
.funnel-bar { position: absolute; inset: 0 auto 0 0; background: var(--brand-soft); }
.funnel-step span { position: relative; }
.cols { display: flex; align-items: flex-end; gap: 4px; height: 160px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.col-bar { width: 100%; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; }
.col small { font-size: 11px; color: var(--muted); }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.img-card { display: grid; gap: 8px; padding: 12px; }
.img-preview { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; border-radius: 10px; border: 1px solid var(--line); }
.img-preview.empty { display: grid; place-items: center; align-content: center; gap: 4px; background: var(--bg); font-size: 34px; }
.img-preview.empty small { font-size: 12px; }
.thumb.small { width: 72px; height: 48px; object-fit: cover; }
.banner-preview { display: flex; gap: 12px; align-items: center; max-width: 420px; margin-top: 6px; padding: 12px; border-radius: 16px;
                  background: var(--tg-banner); color: var(--tg-night); border: 1px solid var(--tg-cream-deep); }
.banner-preview img { width: 84px; height: 64px; object-fit: cover; border-radius: 10px; }
.banner-preview small { color: var(--tg-bottle); font-weight: 700; }
.banner-preview.pro { background: var(--tg-banner-pro); border-color: #FFE7C2; }
.banner-preview.pro small { color: var(--tg-night); }
.setting { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.setting:first-of-type { border-top: 0; }
.editor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.ts-steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.ts-qr { width: 200px; height: 200px; margin: 0 auto; border-radius: 10px; display: block; }
.ts-key { margin: 0; text-align: center; }
.ts-key code.secret { font-size: 13px; display: inline-block; margin-top: 4px; }
input.ts-code { font: 600 26px/1.2 Consolas, ui-monospace, monospace; letter-spacing: .4em; text-align: center; padding: 10px; }
input.ts-code.recovery { letter-spacing: .15em; text-transform: uppercase; }
.codes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.codes-grid code { font: 600 15px/1 Consolas, ui-monospace, monospace; text-align: center; padding: 10px 6px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); user-select: all; }
code.secret { font-size: 16px; padding: 2px 8px; border-radius: 6px; background: var(--surface); user-select: all; }
.text-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.text-editor textarea { font: 13px/1.5 Consolas, ui-monospace, monospace; min-height: 420px; resize: vertical; }
.text-preview { background: var(--tg-cream); color: var(--tg-night); border: 1px solid var(--line); border-radius: 10px; padding: 6px 18px; height: 456px; overflow: auto; font: 15px/1.6 system-ui, "Segoe UI", sans-serif; font-weight: 400; }
.text-preview h2 { font-size: 1.1rem; margin: 22px 0 6px; color: var(--tg-bottle); }
.text-preview .todo { display: inline; background: var(--tg-spark-soft); color: #8A3A00; border-radius: 4px; padding: 0 4px; font-weight: 600; }
.text-preview table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.text-preview th, .text-preview td { text-align: left; vertical-align: top; padding: 6px; border-bottom: 1px solid var(--tg-cream-deep); }
.text-preview a { color: var(--tg-bottle); }
.block-form { display: grid; gap: 10px; border: 1px solid var(--danger); border-radius: 12px; padding: 14px; }
tr.hidden-row td { opacity: .6; }
@media (max-width: 900px) { .text-editor { grid-template-columns: 1fr; } }

/* --- Ventanas y avisos (js/dialogos.js) ------------------------------------------------------- */
dialog.dialog { width: min(480px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 12px; padding: 0;
                background: var(--surface); color: var(--ink); box-shadow: 0 20px 50px rgb(0 0 0 / .25); }
dialog.dialog::backdrop { background: rgb(15 20 30 / .45); }
dialog.dialog form { display: grid; gap: 12px; padding: 22px 24px 20px; }
dialog.dialog h2 { font-size: 17px; }
dialog.dialog p.muted { margin: 0; white-space: pre-line; }
dialog.dialog .error:empty { display: none; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 50; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 420px; padding: 11px 14px; border-radius: 10px;
         background: #2B2F36; color: #F1F3F5; box-shadow: 0 8px 24px rgb(0 0 0 / .2); font-size: 14px; animation: toast-in .2s ease-out; transition: opacity .3s, transform .3s; }
.toast.out { opacity: 0; transform: translateY(8px); }
.toast-ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: #34A853; color: #fff; flex: none; }
.toast.error .toast-ic { background: #EA4335; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; transition: none; } }

/* --- Tablas: ordenar, columnas y selección (js/tablas.js) ------------------------------------- */
button.link { border: 0; background: none; color: var(--brand); padding: 4px 6px; font-weight: 600; }
button.link:hover { text-decoration: underline; }
.table-tools { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 4px 0 6px; }
.bulk-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; background: var(--brand-soft); border-radius: 8px; padding: 4px 6px 4px 12px; }
.bulk-bar button:not(.link) { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; font-size: 13px; }
.cols-wrap { position: relative; margin-left: auto; }
.cols-button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; font-size: 13px; color: var(--muted); }
.cols-button svg.ic { width: 15px; height: 15px; }
.cols-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
             box-shadow: 0 8px 24px rgb(0 0 0 / .15); padding: 8px 12px; display: grid; gap: 6px; min-width: 210px; }
.cols-menu .check { font-weight: 500; white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--ink); }
th.sortable::after { content: " ↕"; opacity: .35; }
th[aria-sort="ascending"]::after { content: " ↑"; opacity: 1; color: var(--brand); }
th[aria-sort="descending"]::after { content: " ↓"; opacity: 1; color: var(--brand); }
th.sel, td.sel { width: 34px; padding-right: 0; }
th.sel input, td.sel input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); cursor: pointer; }
tr:has(td.sel input:checked) td { background: var(--brand-soft); }
