/* ==========================================================================
   Base compartida (sitio público + panel)
   Tokens → elementos → componentes. Contrastes verificados WCAG AA en ambos temas.
   Los colores de marca (--primary, --accent) los inyecta el servidor ya ajustados.
   ========================================================================== */

:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #efebe3;
  --surface-3: #e6e0d4;
  --text: #14202a;
  --text-muted: #4c5a65;
  --border: #d9d1c3;
  --border-strong: #b9ae9c;
  --shadow: 0 1px 2px rgba(20, 32, 42, .06), 0 4px 16px rgba(20, 32, 42, .06);
  --shadow-lg: 0 10px 40px rgba(20, 32, 42, .14);

  --ok: #166534;      --ok-soft: #dcfce7;
  --warn: #8a4b06;    --warn-soft: #fdf0d5;
  --danger: #b42318;  --danger-soft: #fde4e1;
  --info: #1e4f8a;    --info-soft: #e1ecf8;

  --primary: #0b5d7a; --on-primary: #fff; --primary-soft: #dfeaee;
  --accent: #c2410c;  --on-accent: #fff;  --accent-soft: #f6e3d9;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --radius: 8px;
  --radius-sm: 5px;
  --radius-lg: 14px;
  --focus: 0 0 0 3px var(--bg), 0 0 0 5px var(--primary);
  --header-h: 64px;
  color-scheme: light;
}

:root[data-radius="recto"] { --radius: 2px; --radius-sm: 1px; --radius-lg: 3px; }
:root[data-radius="redondo"] { --radius: 14px; --radius-sm: 9px; --radius-lg: 22px; }

:root[data-font="clasica"] {
  --font-display: "Libre Caslon Text", Georgia, serif;
  --font-body: "Source Sans 3", system-ui, sans-serif;
}
:root[data-font="moderna"] {
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Instrument Sans", system-ui, sans-serif;
}

/* Tema oscuro: explícito o del sistema */
:root[data-theme="dark"] {
  --bg: #0f1519; --surface: #172026; --surface-2: #1e2a31; --surface-3: #26343c;
  --text: #e9edef; --text-muted: #a6b4bd; --border: #2c3b44; --border-strong: #41535e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
  --ok: #6ee7a0; --ok-soft: #12301f; --warn: #f5c060; --warn-soft: #3a2a0c;
  --danger: #ff9b8f; --danger-soft: #3d1714; --info: #9cc3f5; --info-soft: #14263d;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1519; --surface: #172026; --surface-2: #1e2a31; --surface-3: #26343c;
    --text: #e9edef; --text-muted: #a6b4bd; --border: #2c3b44; --border-strong: #41535e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
    --ok: #6ee7a0; --ok-soft: #12301f; --warn: #f5c060; --warn-soft: #3a2a0c;
    --danger: #ff9b8f; --danger-soft: #3d1714; --info: #9cc3f5; --info-soft: #14263d;
    color-scheme: dark;
  }
}

/* ---------- Reset y elementos ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 1rem; line-height: 1.6;
  text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 4.5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }
p { margin: 0 0 1em; text-wrap: pretty; }
a { color: var(--primary); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
small { font-size: .85rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
code, kbd { font-family: var(--font-mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: var(--radius-sm); }
::selection { background: var(--primary); color: var(--on-primary); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
[hidden] { display: none !important; }

.icon { display: inline-block; width: 1.15em; height: 1.15em; stroke-width: 1.75; flex-shrink: 0; vertical-align: -0.18em; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -100px; z-index: 1000; background: var(--primary); color: var(--on-primary); padding: .6rem 1rem; border-radius: var(--radius); }
.skip-link:focus { top: 1rem; }
.muted { color: var(--text-muted); }
.tabular { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.prose p:last-child { margin-bottom: 0; }
.prose ul, .prose ol { padding-left: 1.2em; margin: 0 0 1em; }
.prose li { margin: .2em 0; }
.kicker {
  font-family: var(--font-body); font-size: .78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 .75rem; display: inline-flex; align-items: center; gap: .5rem;
}
.kicker::before { content: ""; width: 22px; height: 1.5px; background: currentColor; }

/* ---------- Marca ---------- */
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); font-family: var(--font-display); font-weight: 600; font-size: 1.12rem; letter-spacing: -.01em; }
.brand img { height: 36px; width: auto; }
.brand-mark { width: 34px; height: 34px; color: var(--primary); }
.brand small { display: block; font-family: var(--font-body); font-size: .7rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); line-height: 1; margin-top: 2px; }

/* ---------- Botones ---------- */
.btn {
  --b-bg: var(--surface); --b-fg: var(--text); --b-bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .55rem 1.1rem; border-radius: var(--radius);
  background: var(--b-bg); color: var(--b-fg); border: 1px solid var(--b-bd);
  font: 600 .95rem/1.2 var(--font-body); text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s, filter .15s; white-space: nowrap;
}
.btn:hover { filter: brightness(.96); text-decoration: none; }
:root[data-theme="dark"] .btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-primary { --b-bg: var(--primary); --b-fg: var(--on-primary); --b-bd: var(--primary); }
.btn-accent { --b-bg: var(--accent); --b-fg: var(--on-accent); --b-bd: var(--accent); }
.btn-ghost { --b-bg: transparent; --b-bd: transparent; }
.btn-ghost:hover { background: var(--surface-2); filter: none; }
.btn-danger { --b-bg: var(--danger-soft); --b-fg: var(--danger); --b-bd: transparent; }
.btn-sm { min-height: 36px; padding: .35rem .75rem; font-size: .875rem; }
.btn-lg { min-height: 52px; padding: .8rem 1.5rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 36px; }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1.1rem; min-width: 0; }
.field > label, .label { font-weight: 600; font-size: .92rem; }
.field .hint { font-size: .84rem; color: var(--text-muted); margin: 0; }
.field .error { font-size: .86rem; color: var(--danger); margin: 0; font-weight: 500; }
.req { color: var(--danger); margin-left: .15em; }
.input, .select, .textarea,
input:not([type]), input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password], input[type=date], input[type=time], input[type=datetime-local], input[type=search], input[type=url], select, textarea {
  width: 100%; min-height: 44px; padding: .55rem .75rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 400 1rem/1.4 var(--font-body); transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[aria-invalid=true], select[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--danger); }
input[type=color] { width: 52px; height: 44px; padding: 3px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23778' stroke-width='1.6' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8rem center; padding-right: 2.2rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; font-size: .95rem; min-height: 28px; }
.check input { width: 20px; height: 20px; margin: .15rem 0 0; accent-color: var(--primary); flex-shrink: 0; }
/* Ritmo vertical dentro de los formularios: cada bloque se separa del anterior (los márgenes se combinan,
   así que no se duplica el espacio de los .field). No aplica a los formularios que van en fila. */
form:not(.toolbar, .row, .row-between, .gm-search-form, .stack) > :not([type=hidden], .hp, [hidden], template) + * { margin-top: .9rem; }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 1rem; }
.form-grid > * { grid-column: span 12; min-width: 0; }
.form-grid > .w-quarter { grid-column: span 6; } /* en el celular, los campos cortos (contadores) van de a dos */
@media (min-width: 720px) {
  .form-grid > .w-half { grid-column: span 6; }
  .form-grid > .w-third { grid-column: span 4; }
  .form-grid > .w-quarter { grid-column: span 3; }
  .form-grid > .w-two-thirds { grid-column: span 8; }
}
.switch { position: relative; display: inline-flex; align-items: center; gap: .7rem; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 44px; height: 26px; border-radius: var(--radius); background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; transition: background .15s; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: calc(var(--radius) - 2px); background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + .track { background: var(--primary); border-color: var(--primary); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }

/* ---------- Superficies ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; }
.card-flush { padding: 0; overflow: hidden; }
.card h2, .card h3 { margin-top: 0; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.field .row > :is(input, select, textarea):not([type=color]):not([type=checkbox]):not([type=radio]) { flex: 1 1 0; min-width: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.grow { flex: 1; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .55rem; border-radius: var(--radius);
  font-size: .78rem; font-weight: 600; line-height: 1.4; background: var(--surface-2); color: var(--text); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
/* Matrícula parcial: chapita para reconocer el vehículo en la parada */
.plate-hint { display: inline-flex; align-items: center; gap: .4rem; margin-top: .3rem; font-size: .8rem; color: var(--text-muted); }
.plate-hint strong { font-family: var(--font-mono); font-size: .95rem; letter-spacing: .08em; color: var(--text); background: var(--surface); border: 1.5px solid var(--text); border-radius: 4px; padding: .02rem .45rem; }
.track-panel .plate-hint { display: flex; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-live::before { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .2; } }

/* ---------- Avisos ---------- */
.alert { display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 1rem; border-radius: var(--radius); border: 1px solid transparent; margin-bottom: 1rem; }
.alert .icon { margin-top: .2rem; }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-warning { background: var(--warn-soft); color: var(--warn); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert p { margin: 0; color: var(--text); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th { text-align: left; font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); padding: .7rem .9rem; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); }
.table td { padding: .75rem .9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .actions { text-align: right; white-space: nowrap; }
.table a.row-link { color: var(--text); font-weight: 600; text-decoration: none; }
.table a.row-link:hover { color: var(--primary); text-decoration: underline; }

/* Tablas → tarjetas: en el celular siempre; en pantallas medianas, cuando la tabla no entra a lo ancho (ui.js › fitTables) */
.table td { overflow-wrap: break-word; }
@media (max-width: 720px) {
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { border-bottom: 1px solid var(--border); padding: .6rem 0; }
  .table.responsive td { border: 0; padding: .25rem 1rem; display: flex; gap: 1rem; justify-content: space-between; align-items: baseline; text-align: right; min-width: 0; overflow-wrap: anywhere; }
  .table.responsive td::before { content: attr(data-label); font-size: .78rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; text-align: left; flex-shrink: 0; max-width: 45%; }
  .table.responsive td.actions { justify-content: flex-end; }
  .table.responsive td.actions::before { content: none; }
  .table.responsive td.check-col { justify-content: flex-start; }
  .table.responsive td.check-col::before { content: none; }
}
.table.responsive.is-cards thead { display: none; }
.table.responsive.is-cards, .table.responsive.is-cards tbody { display: block; width: 100%; }
.table.responsive.is-cards tbody { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: .75rem; padding: .75rem; }
.table.responsive.is-cards tr { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem 0; background: var(--surface); min-width: 0; }
.table.responsive.is-cards td { display: flex; gap: 1rem; justify-content: space-between; align-items: baseline; border: 0; padding: .22rem .9rem; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.table.responsive.is-cards td::before { content: attr(data-label); font-size: .74rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; text-align: left; flex-shrink: 0; max-width: 45%; }
.table.responsive.is-cards td.actions { justify-content: flex-end; margin-top: auto; border-top: 1px solid var(--border); padding-top: .4rem; }
.table.responsive.is-cards td.actions::before, .table.responsive.is-cards td.check-col::before { content: none; }
.table.responsive.is-cards td.check-col { justify-content: flex-start; }
.table.responsive.is-cards tr.is-selected { border-color: var(--primary); }
/* Las que igual no entran (comparativas, auditoría): se desplazan, con una sombra que avisa que hay más */
.table-wrap.is-scroll { background: linear-gradient(to right, var(--surface) 30%, transparent) left / 24px 100% no-repeat local, linear-gradient(to left, var(--surface) 30%, transparent) right / 24px 100% no-repeat local, radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.14), transparent) left / 10px 100% no-repeat scroll, radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.14), transparent) right / 10px 100% no-repeat scroll; }
/* Filas que se abren con doble clic (o un toque en pantallas táctiles) */
.row-openable { cursor: default; }
@media (hover: none) { .row-openable { cursor: pointer; } .row-openable:active { background: var(--surface-2); } }

/* ---------- Diálogos ---------- */
dialog.modal { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); padding: 0; width: min(680px, calc(100vw - 2rem)); max-height: calc(100vh - 3rem); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgba(10, 16, 20, .55); backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.modal-head h2 { font-size: 1.2rem; margin: 0; }
.modal-body { padding: 1.25rem; }

/* ---------- Mapas ---------- */
.map { width: 100%; height: 420px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface-2); z-index: 0; }
.leaflet-container { font-family: var(--font-body) !important; }
/* Leaflet posiciona y escala sus propias imágenes y capas SVG: las reglas globales (max-width, display)
   deforman el trazado al hacer zoom y dejan mosaicos en blanco */
.leaflet-container img, .leaflet-container svg, .leaflet-container canvas { max-width: none !important; max-height: none !important; }
.leaflet-container img.leaflet-tile { display: inline; }
.leaflet-container .leaflet-tile-pane img { image-rendering: auto; }
.map-dark .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.55); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface) !important; color: var(--text) !important; border-radius: var(--radius) !important; }
.leaflet-popup-content { margin: .8rem 1rem !important; font-size: .92rem; line-height: 1.45; }
.leaflet-popup-content h4 { margin: 0 0 .25rem; font-size: 1rem; }
.leaflet-control-attribution { font-size: 10px !important; }
:root[data-theme="dark"] .leaflet-control-attribution { background: rgba(15, 21, 25, .8) !important; color: #b8c4cc !important; }
:root[data-theme="dark"] .leaflet-control-attribution a { color: #9cc3f5 !important; }
:root[data-theme="dark"] .leaflet-bar a { background: var(--surface); color: var(--text); border-color: var(--border); }
.pin { width: 28px; height: 28px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); display: grid; place-items: center; }
.pin span { transform: rotate(45deg); color: #fff; font: 700 12px/1 var(--font-body); }
.stop-dot { width: 22px; height: 22px; border-radius: 50%; border: 3px solid #fff; display: grid; place-items: center; color: #fff; font: 700 11px/1 var(--font-body); box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.vehicle-marker { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(11, 93, 122, .25), 0 3px 10px rgba(0,0,0,.35); }
.vehicle-marker svg { width: 20px; height: 20px; }

/* ---------- Lista de paradas (sitio y panel) ---------- */
.stop-list { list-style: none; margin: 1rem 0 0; padding: 0; counter-reset: s; }
.stop-list li { position: relative; padding: 0 0 1rem 2.2rem; counter-increment: s; }
.stop-list li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--c, var(--primary)); color: #fff; font-size: .78rem; font-weight: 700; display: grid; place-items: center; }
.stop-list li::after { content: ""; position: absolute; left: calc(.8rem - 1px); top: 1.7rem; bottom: .1rem; width: 2px; background: var(--border); }
.stop-list li:last-child::after { display: none; }
.stop-list li strong { display: block; }
.stop-list li span { font-size: .87rem; color: var(--text-muted); }
.stop-list li.done::before { background: var(--surface-3); color: var(--text-muted); }
.stop-list li.current::before { box-shadow: 0 0 0 4px var(--primary-soft); }
.stop-list li.current strong { color: var(--primary); }

/* ---------- Varios ---------- */
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty .icon { display: block; width: 2.2rem; height: 2.2rem; margin: 0 auto .75rem; opacity: .6; }
.divider-label { display: flex; align-items: center; gap: 1rem; color: var(--text-muted); font-size: .85rem; margin: 1.5rem 0; }
.divider-label::before, .divider-label::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.placeholder-img {
  background-color: var(--ph, var(--primary));
  background-image:
    repeating-radial-gradient(circle at 20% 120%, transparent 0 18px, rgba(255,255,255,.09) 18px 19px),
    linear-gradient(160deg, rgba(255,255,255,.08), rgba(0,0,0,.18));
  color: #fff; display: grid; place-items: center;
}
.placeholder-img .icon { width: 2.4rem; height: 2.4rem; opacity: .85; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media print {
  .no-print, header.site-header, footer.site-footer, .admin-sidebar, .admin-topbar { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ==========================================================================
   Feedback, tiempo real y componentes compartidos (v1.1)
   ========================================================================== */

/* Avisos flotantes */
.toast-stack { position: fixed; z-index: 2000; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; max-width: min(420px, calc(100vw - 2rem)); pointer-events: none; }
.toast { pointer-events: auto; position: relative; overflow: hidden; display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 2.4rem .9rem 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-left: 4px solid var(--info);
  opacity: 0; transform: translateY(12px) scale(.98); transition: opacity .22s ease, transform .26s cubic-bezier(.2, .9, .3, 1.2); }
.toast.is-in { opacity: 1; transform: none; }
.toast.is-out { opacity: 0; transform: translateX(24px); transition: opacity .2s, transform .25s; }
.toast p { margin: 0; color: var(--text); font-size: .94rem; }
.toast .icon { margin-top: .15rem; flex-shrink: 0; }
.toast-success { border-left-color: var(--ok); } .toast-success .icon { color: var(--ok); }
.toast-error { border-left-color: var(--danger); } .toast-error .icon { color: var(--danger); }
.toast-warning { border-left-color: var(--warn); } .toast-warning .icon { color: var(--warn); }
.toast-info .icon { color: var(--info); }
.toast-x { position: absolute; top: .35rem; right: .45rem; background: none; border: 0; font-size: 1.3rem; line-height: 1; color: var(--text-muted); cursor: pointer; padding: .2rem .35rem; border-radius: 4px; }
.toast-x:hover { background: var(--surface-2); color: var(--text); }
.toast-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: currentColor; opacity: .18; transform-origin: left; animation: toast-bar linear forwards; }
.toast-success .toast-bar { color: var(--ok); } .toast-error .toast-bar { color: var(--danger); } .toast-warning .toast-bar { color: var(--warn); } .toast-info .toast-bar { color: var(--info); }
.toast.is-paused .toast-bar { animation-play-state: paused; }
@keyframes toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.alert-pop { animation: pop-in .35s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }

/* Botones: cargando y hecho */
.spinner { width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn.is-loading { cursor: progress; opacity: .85; pointer-events: none; }
.btn.is-done { animation: btn-done 1.1s ease; }
@keyframes btn-done { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); } 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: none; } }
.icon-xs { width: .85em; height: .85em; vertical-align: -.1em; }

/* Validación: sacudón suave en el campo con error */
.shake { animation: shake .4s ease; }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }

/* Tiempo real */
/* los cambios en vivo se reemplazan sin resaltar: solo un fundido corto, sin colores */
.live-swap { opacity: .55; transition: opacity .3s ease; }
[data-live] { transition: opacity .3s ease; }
.live-in { animation: live-in .45s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes live-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.live-out { animation: live-out .3s ease forwards; }
@keyframes live-out { to { opacity: 0; transform: translateX(16px); height: 0; padding-top: 0; padding-bottom: 0; } }
.just-saved { animation: just-saved 2.4s ease; }
@keyframes just-saved { 0%, 30% { background-color: color-mix(in srgb, var(--ok) 20%, transparent); box-shadow: inset 3px 0 0 var(--ok); } 100% { background-color: transparent; box-shadow: inset 3px 0 0 transparent; } }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); margin: 0 .35rem; flex-shrink: 0; transition: background .3s; }
.live-dot[data-state="ok"] { background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent); animation: live-ping 2.4s infinite; }
.live-dot[data-state="sync"] { background: var(--info); }
.live-dot[data-state="off"] { background: var(--danger); }
@keyframes live-ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
[data-countdown].is-soon { color: var(--warn); font-weight: 600; }
[data-countdown].is-past { color: var(--text-muted); }
/* Cambio de tema (app.js › switchTheme): un círculo que se abre desde el botón, con la página nueva ya pintada */
.theme-freeze, .theme-freeze *, .theme-freeze *::before, .theme-freeze *::after { transition: none !important; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
:root.theme-vt::view-transition-group(root) { animation-duration: .55s; }
:root.theme-vt::view-transition-new(root) { animation: theme-reveal .55s cubic-bezier(.22, .61, .36, 1) both; }
:root.theme-vt::view-transition-old(root) { animation: none; }
@keyframes theme-reveal {
  from { clip-path: circle(0 at var(--vt-x, 50%) var(--vt-y, 0)); }
  to { clip-path: circle(var(--vt-r, 150vmax) at var(--vt-x, 50%) var(--vt-y, 0)); }
}

/* Selector segmentado (radio en píldoras) */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: inline-flex; align-items: center; gap: .3rem; padding: .35rem .85rem; border-radius: var(--radius); font-weight: 600; font-size: .86rem; color: var(--text-muted); transition: background .18s, color .18s, box-shadow .18s; white-space: nowrap; }
.seg label:hover span { color: var(--text); }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.seg input[data-level="manage"]:checked + span { background: var(--primary); color: var(--on-primary); }
.seg input[data-level="view"]:checked + span { background: var(--primary-soft); color: var(--primary); }
.seg input:focus-visible + span { box-shadow: var(--focus); }
.seg input:disabled + span { opacity: .4; cursor: not-allowed; }
.seg .is-locked span { cursor: not-allowed; }
.seg-sm span { padding: .25rem .7rem; font-size: .82rem; }
.chip { position: relative; display: inline-flex; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .65rem; border-radius: var(--radius); border: 1px dashed var(--border-strong); font-size: .8rem; font-weight: 600; color: var(--text-muted); transition: all .15s; }
.chip input:checked + span { border-style: solid; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--text); }
.chip input:focus-visible + span { box-shadow: var(--focus); }
.chip.is-locked span { opacity: .45; cursor: not-allowed; }

/* Medidor de ocupación */
.load-meter { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; font-size: .86rem; }
.load-meter i { display: inline-block; width: 56px; height: 6px; border-radius: var(--radius); background: var(--surface-3); position: relative; overflow: hidden; }
.load-meter i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--p, 0%); background: var(--ok); border-radius: inherit; transition: width .5s ease; }
.load-meter i.full::after { background: var(--warn); }

/* Opciones en tarjetas (radio) */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .4rem; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span { display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: .9rem; font-weight: 500; transition: border-color .15s, background .15s; height: 100%; }
.choice input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.choice input:focus-visible + span { box-shadow: var(--focus); }

/* Indicador de cambios sin guardar */
.dirty-pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; font-weight: 600; color: var(--warn); background: var(--warn-soft); padding: .25rem .65rem; border-radius: var(--radius); margin-right: auto; }
.dirty-pill.pop { animation: pop-in .3s ease; }
.dirty-pill .icon { width: .9em; height: .9em; animation: pulse 1.6s infinite; }

dialog.modal[open] { animation: pop-in .25s ease; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 1.25rem 0 0; font-size: .92rem; }
.kv dt { color: var(--text-muted); font-weight: 600; }
.kv dd { margin: 0; }
.warn-text { color: var(--warn); font-weight: 600; }

/* ==========================================================================
   v1.2: buscadores, chips de filtro, navegación GPS, traslados (compartido)
   ========================================================================== */

/* Buscador con lista de sugerencias (direcciones, selectores con muchas opciones) */
.combo { position: relative; min-width: 0; }
.combo-list {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px); max-height: 300px; overflow-y: auto; overscroll-behavior: contain;
  margin: 0; padding: .3rem; list-style: none; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.combo-list li { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem .6rem; border-radius: var(--radius-sm); cursor: pointer; font-size: .93rem; line-height: 1.3; }
.combo-list li .icon { margin-top: .1rem; color: var(--text-muted); }
.combo-list li small { display: block; color: var(--text-muted); font-size: .8rem; }
.combo-list li:hover, .combo-list li.is-active { background: var(--primary-soft); }
.combo-list li[aria-selected="true"] { font-weight: 600; color: var(--primary); }
.combo-list li[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.combo-list li.is-empty { color: var(--text-muted); }
input.combo-input { -webkit-appearance: none; appearance: none; }
input.combo-input::-webkit-search-cancel-button, input.combo-input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.combo-list .combo-empty { color: var(--text-muted); cursor: default; }
.combo-select .combo-input { padding-right: 2.2rem; text-overflow: ellipsis; }
.combo-select .combo-caret { position: absolute; right: .85rem; top: 50%; width: 8px; height: 8px; border-right: 1.6px solid var(--text-muted); border-bottom: 1.6px solid var(--text-muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.combo-native { position: absolute !important; opacity: 0; pointer-events: none; height: 1px !important; min-height: 0 !important; width: 1px !important; bottom: 0; left: 0; }

/* Chips (filtros, atajos, lugares frecuentes) */
.fchip, .chip-btn {
  display: inline-flex; align-items: center; gap: .3rem; min-height: 32px; padding: .25rem .7rem; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 500 .84rem/1.2 var(--font-body);
  text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
}
.fchip:hover, .chip-btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.fchip.is-on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.fchip.is-off { opacity: .45; text-decoration: line-through; }
.fchip small { opacity: .8; font-weight: 500; }

/* Marcadores A / B de origen y destino */
.tr-mark { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font: 700 .7rem/1 var(--font-body); color: #fff; vertical-align: -.25em; flex-shrink: 0; }
.tr-mark-a { background: var(--primary); }
.tr-mark-b { background: var(--accent); }
.tr-pin { width: 32px; height: 32px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); display: grid; place-items: center; }
.tr-pin span { transform: rotate(45deg); color: #fff; font: 800 13px/1 var(--font-body); }
.tr-pin-a { background: var(--primary); }
.tr-pin-b { background: var(--accent); }
/* Pasos de un viaje o traslado (página del cliente y panel) */
.progress-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.progress-steps li::marker { content: none; }
.progress-steps li { position: relative; display: flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center; padding: 0 .15rem; }
.progress-steps li + li::before { content: ""; position: absolute; top: 15px; right: 50%; width: 100%; height: 2px; background: var(--border); transition: background .3s; }
.progress-steps li.done::before, .progress-steps li.current::before { background: var(--ok); }
.progress-steps li span { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border-strong); font-weight: 700; font-size: .85rem; color: var(--text-muted); transition: all .3s; }
.progress-steps li span .icon { width: 1rem; height: 1rem; }
.progress-steps li small { font-size: .76rem; line-height: 1.25; color: var(--text-muted); font-weight: 600; overflow-wrap: break-word; hyphens: auto; min-width: 0; max-width: 100%; }
.progress-steps li.done span { background: var(--ok); border-color: var(--ok); color: #fff; }
.progress-steps li.current span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: 0 0 0 5px var(--primary-soft); animation: pulse-ring 2s infinite; }
.progress-steps li.current small { color: var(--text); }
@media (max-width: 420px) { .progress-steps li small { font-size: .7rem; } }
.hub-status { margin: 1rem 0 0; font-size: .92rem; color: var(--text-muted); }
.stepper input { width: 100%; min-width: 3ch; padding-inline: .25rem; }
@keyframes pulse-ring { 0%, 100% { box-shadow: 0 0 0 4px var(--primary-soft); } 50% { box-shadow: 0 0 0 8px transparent; } }
/* Armador de traslados: lo usan el sitio público y el panel (alta de mostrador) */
.total-line { display: flex; justify-content: space-between; align-items: baseline; padding: 1rem 0; border-top: 1px solid var(--border); margin-top: .5rem; }
.total-line strong { font-family: var(--font-display); font-size: 1.6rem; }
.stepper { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.stepper input { border: 0; text-align: center; min-width: 0; border-radius: 0; -moz-appearance: textfield; appearance: textfield; font-weight: 700; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { box-shadow: none; }
.stepper button { width: 42px; flex-shrink: 0; border: 0; background: var(--surface-2); color: var(--text); font-size: 1.2rem; font-weight: 700; cursor: pointer; transition: background .15s; }
.stepper button:hover { background: var(--primary-soft); color: var(--primary); }
.stepper button:active { transform: scale(.94); }
.stepper:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
[data-total].bump { animation: bump .35s ease; display: inline-block; }
@keyframes bump { 50% { transform: scale(1.08); color: var(--accent); } }
.tr-points { position: relative; display: grid; gap: .2rem; margin-bottom: .75rem; }
.tr-point { margin-bottom: .4rem; }
.tr-point label { display: flex; align-items: center; gap: .45rem; }
.tr-point-tools { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .15rem; }
.tr-point-tools .btn { min-height: 32px; padding: .2rem .5rem; font-size: .82rem; color: var(--text-muted); }
.tr-point-tools .btn[aria-pressed="true"] { color: var(--primary); background: var(--primary-soft); }
.tr-swap { justify-self: end; margin: -1.9rem .25rem -.4rem 0; z-index: 2; border-radius: 50%; background: var(--surface); border: 1px solid var(--border-strong); }
.tr-presets { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip-btn .icon { width: 1em; height: 1em; color: var(--primary); }
.tr-quote { background: var(--surface-2); border-radius: var(--radius); padding: .8rem 1rem; margin: .4rem 0 1rem; min-height: 3.2rem; display: flex; flex-direction: column; justify-content: center; }
.tr-quote-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.tr-quote-grid small { display: block; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 600; }
.tr-quote-grid strong { font-family: var(--font-display); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.tr-companies { display: grid; gap: .4rem; }
.tr-companies .choice span { justify-content: space-between; }
.tr-companies .choice b { font-variant-numeric: tabular-nums; }
.choice.is-off { opacity: .45; }
.choice.is-off span { cursor: not-allowed; }
/* Desglose del precio de un traslado (cotización, página del cliente y panel) */
.tr-fare { display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; margin: .6rem 0 0; padding-top: .55rem; border-top: 1px dashed var(--border-strong); font-size: .86rem; }
.tr-fare dt { color: var(--text-muted); font-weight: 500; }
.tr-fare dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.tr-fare .total { font-weight: 700; color: var(--text); font-size: .95rem; padding-top: .3rem; border-top: 1px solid var(--border); }
.tr-fare-rules { display: flex; gap: .4rem; align-items: flex-start; font-size: .84rem; color: var(--text-muted); }
.tr-fare-rules .icon { margin-top: .2rem; flex-shrink: 0; }
/* Lo que necesita un traslado: personas y valijas */
.tr-needs { display: flex; flex-wrap: wrap; gap: .4rem; }
.tr-needs > span { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .65rem; border-radius: var(--radius); background: var(--surface-2); font-size: .88rem; }
.tr-needs > span .icon { width: 1em; height: 1em; color: var(--primary); }
.tr-needs-sm > span { padding: .15rem .5rem; font-size: .8rem; }

/* Vehículo con rumbo (navegación y seguimiento) */
.nav-car { width: 44px; height: 44px; display: grid; place-items: center; color: var(--c, var(--primary)); filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); transition: transform .6s ease; }
.nav-car::before { content: ""; position: absolute; width: 40px; height: 40px; border-radius: 50%; background: color-mix(in srgb, var(--c, #0b5d7a) 18%, transparent); }
.nav-car svg { position: relative; width: 26px; height: 26px; }
.vehicle-marker { position: relative; }
.vehicle-marker.has-heading::after { content: ""; position: absolute; left: 50%; top: 50%; width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 10px solid #fff;
  transform: translate(-50%, -50%) rotate(var(--h, 0deg)) translateY(-27px); filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }

/* Indicación de navegación (próxima maniobra, distancia, llegada) */
.nav-banner { position: absolute; z-index: 500; left: .6rem; right: .6rem; top: .6rem; pointer-events: none; }
.nav-banner:empty { display: none; }
.nav-banner > * { pointer-events: auto; }
.nav-step { display: flex; gap: .8rem; align-items: center; background: #14532d; color: #fff; border-radius: var(--radius-lg); padding: .7rem .9rem; box-shadow: var(--shadow-lg); }
.nav-step.is-off { background: #78350f; }
.nav-icon { width: 46px; height: 46px; border-radius: 12px; background: rgba(255,255,255,.14); display: grid; place-items: center; flex-shrink: 0; }
.nav-icon .icon { width: 30px; height: 30px; stroke-width: 2.4; }
.nav-dist { display: block; font: 700 1.45rem/1.1 var(--font-body); letter-spacing: -.01em; }
.nav-text { display: block; font-size: 1rem; line-height: 1.3; font-weight: 500; }
.nav-then { display: flex; align-items: center; gap: .3rem; margin-top: .3rem; font-size: .8rem; opacity: .85; }
.nav-meta { display: flex; gap: 1rem; justify-content: center; margin: .4rem auto 0; width: fit-content; max-width: 100%; background: var(--surface); color: var(--text); border-radius: var(--radius); padding: .35rem 1rem; font-size: .88rem; box-shadow: var(--shadow); flex-wrap: wrap; }
.nav-meta b { font-variant-numeric: tabular-nums; }
.map.is-picking, .map.is-picking .leaflet-interactive, .map.is-picking .leaflet-grab { cursor: crosshair !important; }

/* ==========================================================================
   v1.3: avisos (panel y sitio)
   ========================================================================== */
.notice-list { list-style: none; margin: 0; padding: 0; }
.notice { display: flex; gap: .8rem; align-items: flex-start; padding: .85rem 1rem; border-bottom: 1px solid var(--border); }
.notice:last-child { border-bottom: 0; }
.notice strong { display: block; }
.notice p { margin: .2rem 0 .25rem; color: var(--text-muted); font-size: .94rem; }
.notice-icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--info-soft); color: var(--info); }
.notice-ok .notice-icon { background: var(--ok-soft); color: var(--ok); }
.notice-warn .notice-icon { background: var(--warn-soft); color: var(--warn); }
.notice-danger .notice-icon { background: var(--danger-soft); color: var(--danger); }
.notice.is-unread { background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }
.notice.is-unread strong::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); margin-left: .45rem; vertical-align: middle; }
.notices-card { padding: 0; overflow: hidden; border-color: var(--warn); }
.notices-card .hub-h { padding: 1rem 1rem 0; }

/* Hojas (diálogos que en el celular suben desde abajo) y píldoras de filtro */
dialog.modal.sheet { width: min(560px, 100vw); }
.sheet-body { display: flex; flex-direction: column; max-height: inherit; min-height: 0; }
.sheet-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: 1rem 1rem .4rem; }
.sheet-head h2 { margin: 0; font-size: 1.15rem; }
.sheet-tools { display: grid; gap: .6rem; padding: .4rem 1rem .8rem; border-bottom: 1px solid var(--border); }
.sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface); }
@media (max-width: 640px) {
  dialog.modal.sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; max-height: 88vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-bottom: 0; }
  dialog.modal.sheet[open] { animation: sheet-up .25s ease; }
  .sheet-head::before { content: ""; position: absolute; top: .4rem; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--border-strong); }
}
@keyframes sheet-up { from { transform: translateY(40%); opacity: .4; } to { transform: none; opacity: 1; } }
.pills { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.pills::-webkit-scrollbar { display: none; }
.pill { flex-shrink: 0; display: inline-flex; align-items: center; gap: .35rem; min-height: 36px; padding: .3rem .85rem; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted); font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; }
.pill span { font-size: .75rem; opacity: .75; font-variant-numeric: tabular-nums; }
.pill[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* Tipo de traslado: los más usados a un toque (panel y sitio) */
.tt-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.tt-chips .chip { display: inline-flex; align-items: center; gap: .35rem; min-height: 36px; padding: .3rem .8rem; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: .86rem; font-weight: 500; cursor: pointer; }
.tt-chips .chip:hover { border-color: var(--primary); }
.tt-chips .chip[aria-pressed="true"] { border-color: var(--primary); background: var(--primary); color: var(--on-primary, #fff); }
.tt-chips .chip:focus-visible { box-shadow: var(--focus); outline: 0; }
/* aviso de capacidad (reserva y traslado): avisa sin frenar el pedido */
.tr-cap { margin: -.4rem 0 1.1rem; padding: .65rem .8rem; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--warn) 14%, transparent); border-left: 3px solid var(--warn); font-size: .88rem; line-height: 1.45; }
.field .row > .combo { flex: 1 1 0; min-width: 0; }
.field .row > .combo > input { width: 100%; }

/* ==========================================================================
   Mapas: elegir un punto (panel) y ver ubicaciones (sitio y panel)
   ========================================================================== */
.mp { display: grid; gap: .55rem; }
.mp > .label { display: inline-flex; align-items: center; gap: .35rem; margin: 0; }
.mp-tools { display: flex; gap: .4rem; flex-wrap: wrap; }
.mp-search { flex: 1 1 260px; display: flex; gap: .4rem; min-width: 0; }
.mp-search input { flex: 1; min-width: 0; }
.mp-results { list-style: none; margin: 0; padding: .3rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); max-height: 220px; overflow: auto; }
.mp-results li { font-size: .88rem; }
.mp-results li.muted { padding: .4rem .5rem; }
.mp-results button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; gap: .4rem; width: 100%; padding: .45rem .5rem; border-radius: 6px; }
.mp-results button:hover, .mp-results button:focus-visible { background: var(--surface-2); }
.mp-map, .mv-map { height: 300px; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; background: var(--surface-2); z-index: 0; }
.mp-map.map-off, .mv-map.map-off { display: grid; place-items: center; color: var(--text-muted); font-size: .9rem; }
.mp-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem .8rem; }
.mp-status { margin: 0; font-size: .86rem; color: var(--text-muted); display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.mp-actions { display: inline-flex; gap: .3rem; flex-wrap: wrap; }
@media (max-width: 520px) { .mp-hide-sm { display: none; } .mp-map { height: 240px; } }
.mp-pin { background: none; border: 0; }
.mp-pin span { position: absolute; left: 50%; top: 2px; width: 26px; height: 26px; margin-left: -13px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--primary); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.mp-pin span::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #fff; }
.mp-pin-venue span { background: #64748b; }
.mv { display: grid; gap: .5rem; }
.mv-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.mv-list li { display: flex; align-items: center; gap: .5rem; }
.mv-list .grow { display: flex; flex-direction: column; min-width: 0; }
.leaflet-container { font: inherit; }

/* ==========================================================================
   Compartir / QR (panel y sitio)
   ========================================================================== */
.sh { display: grid; gap: .8rem; }
.sh-tabs { display: flex; flex-wrap: wrap; width: 100%; }
.sh-tabs button { flex: 1 1 auto; }
.sh-body { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 1rem; align-items: center; }
.sh-qr { width: 180px; aspect-ratio: 1; background: #fff; border-radius: 12px; padding: 6px; border: 1px solid var(--border); }
.sh-qr svg { width: 100%; height: 100%; display: block; }
.sh-side { display: grid; gap: .6rem; min-width: 0; }
.sh-hint { margin: 0; font-size: .88rem; }
.sh-url { display: flex; gap: .4rem; }
.sh-url input { flex: 1; min-width: 0; font-size: .88rem; }
.sh-actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.sh-dialog-body { padding: 0 1rem 1rem; overflow-y: auto; }
dialog.modal.sh-dialog { width: min(640px, calc(100vw - 1.5rem)); }
.sh { container-type: inline-size; }
@container (max-width: 480px) {
  .sh-body { grid-template-columns: 1fr; justify-items: center; }
  .sh-qr { width: min(240px, 70vw); }
  .sh-side { width: 100%; }
  .sh-hide-sm { display: none; }
}
/* llegó por un enlace o QR de inscripción: el formulario se resalta */
.is-spotlight { animation: spotlight 1.6s ease 2; box-shadow: 0 0 0 3px var(--primary), var(--shadow-lg); }
@keyframes spotlight { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--primary) 35%, transparent), var(--shadow-lg); } }
@media (prefers-reduced-motion: reduce) { .is-spotlight { animation: none; } }
.sh-tabs { gap: .25rem; padding: .25rem; border-radius: 14px; background: var(--surface-2); }
.sh-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; min-height: 34px; padding: .3rem .7rem; border: 0; border-radius: 10px; background: none; font: inherit; font-weight: 600; font-size: .84rem; color: var(--text-muted); cursor: pointer; }
.sh-tabs button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }

/* ---------- Pestañas que no entran: «Más» y su hoja desde abajo (tabs-more.js) ---------- */
.has-more { flex-wrap: nowrap !important; overflow: hidden !important; }
.has-more > .is-overflow { display: none !important; }
.tabs-more { flex: none; display: inline-flex; align-items: center; gap: .35rem; margin-left: auto; padding: .45rem .75rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font: 600 .88rem var(--font-body); cursor: pointer; white-space: nowrap; align-self: center; position: relative; }
.tabs-more[hidden] { display: none; }
.tabs-more:hover, .tabs-more:focus-visible { border-color: var(--primary); color: var(--primary); }
.tabs-more .icon { width: 1rem; height: 1rem; }
.tabs-more b { min-width: 1.3rem; padding: 0 .3rem; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .75rem; line-height: 1.3rem; text-align: center; }
.tabs-more.has-alert::after { content: ""; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.tabs > .tabs-more { margin-bottom: 2px; }
dialog.more-sheet { width: min(480px, calc(100vw - 2rem)); overflow: hidden; }
dialog.more-sheet .sheet-body { max-height: min(85vh, calc(100vh - 3rem)); }
.more-list { list-style: none; margin: 0; padding: .2rem 1rem calc(1rem + env(safe-area-inset-bottom)); overflow: auto; display: grid; gap: .4rem; }
.more-item { display: flex; align-items: center; gap: .75rem; width: 100%; min-height: 56px; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.more-item:hover, .more-item:focus-visible { background: var(--surface-2); outline: 0; }
.more-item.is-active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.more-ic { flex: none; width: 2.3rem; height: 2.3rem; border-radius: var(--radius); display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 12%, var(--surface)); color: var(--primary); }
.more-ic .icon { width: 1.15rem; height: 1.15rem; }
.more-tx { flex: 1; min-width: 0; display: grid; gap: .1rem; line-height: 1.25; }
.more-tx strong { font-size: .95rem; display: flex; align-items: center; gap: .35rem; }
.more-tx small { font-size: .8rem; color: var(--text-muted); }
.more-count { flex: none; min-width: 1.6rem; padding: .1rem .45rem; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .8rem; font-weight: 700; text-align: center; }
.more-alert { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.more-go, .more-check { flex: none; width: 1rem; height: 1rem; color: var(--text-muted); }
.more-check { color: var(--primary); }
@media (max-width: 640px) { dialog.more-sheet { width: 100vw; } }
.has-more > * { flex-shrink: 0; }
@media (max-width: 719px) {
  .tabs-more { padding: .45rem .55rem; gap: .25rem; }
  .tabs-more span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tabs.has-more button, .tabs.has-more a { padding-inline: .6rem; }
  .tn-ptabs.has-more button { padding-inline: .65rem; }
}

/* Avisos en este dispositivo (partials/push-optin.php + notify.js) */
.push-optin-row { display: flex; gap: .9rem; align-items: flex-start; flex-wrap: wrap; }
.push-optin-row > .grow { flex: 1 1 260px; min-width: 0; }
.push-optin .perm-icon { width: 34px; height: 34px; border-radius: var(--radius-sm, var(--radius)); background: var(--surface-2); display: grid; place-items: center; color: var(--primary); flex-shrink: 0; }
.push-optin-btns { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.push-optin[data-state="on"] .perm-icon { background: var(--ok, #16a34a); color: #fff; }
.push-optin[data-state="denied"] .perm-icon, .push-optin[data-state="unsupported"] .perm-icon { opacity: .55; }
[role="tabpanel"] > .push-optin + * { margin-top: 1.25rem; }
.page-title + .push-optin { margin-bottom: 1.25rem; }


/* Compartir / QR: imagen personalizable (share.js) y piezas del torneo en el diseñador */
.sh-style { margin-top: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2, transparent); }
.sh-style > summary { cursor: pointer; padding: .65rem .9rem; font-weight: 600; font-size: .9rem; list-style: none; display: flex; align-items: center; gap: .4rem; }
.sh-style > summary::-webkit-details-marker { display: none; }
.sh-style > summary::after { content: "▾"; margin-left: auto; color: var(--text-muted); transition: transform .2s; }
.sh-style[open] > summary::after { transform: rotate(180deg); }
.sh-style-in { display: flex; gap: 1rem; flex-wrap: wrap; padding: 0 .9rem .9rem; align-items: flex-start; }
.sh-prev { max-width: 100%; height: auto; border-radius: var(--radius); box-shadow: 0 8px 24px -12px rgb(0 0 0 / .45); background: #fff; flex-shrink: 0; }
.sh-style-f { display: grid; gap: .55rem; flex: 1 1 220px; min-width: 0; }
.sh-style-f input:not([type=color]):not([type=checkbox]) { width: 100%; }
.sh-color { display: inline-flex; align-items: center; gap: .5rem; font-size: .88rem; }
.sh-color input { width: 2.6rem; height: 2rem; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: none; }
.sh-designs { border-top: 1px solid var(--border); padding: .8rem .9rem .9rem; display: grid; gap: .6rem; }
.sh-designs-t { margin: 0; font-size: .86rem; }
.sh-designs-list { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .2rem; }
.sh-dz { display: grid; gap: .2rem; justify-items: center; flex: 0 0 auto; width: 84px; text-decoration: none; color: inherit; }
.sh-dz img, .sh-dz > span { width: 84px; height: 64px; object-fit: contain; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); display: grid; place-items: center; }
.sh-dz small { font-size: .7rem; color: var(--text-muted); text-align: center; line-height: 1.2; }
.sh-designs-new { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin: 0; }
.sh-designs-new select { flex: 1 1 140px; min-width: 0; }

/* ---------- Espacios de proyectos (Leantime): tarjetas, modos de acceso y datos ---------- */
[data-show-if][hidden] { display: none !important; }
.pm-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.pm-card { display: flex; align-items: center; gap: .75rem; padding: .8rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.pm-card .grow { min-width: 0; overflow-wrap: anywhere; }
.pm-dot { --pm: var(--primary); flex: none; display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: var(--radius); background: color-mix(in srgb, var(--pm) 16%, transparent); color: var(--pm); vertical-align: middle; }
.pm-dot-lg { width: 2.4rem; height: 2.4rem; }
.pm-modes { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.pm-mode { position: relative; display: block; cursor: pointer; }
.pm-mode input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pm-mode > span { display: grid; gap: .25rem; height: 100%; box-sizing: border-box; padding: .8rem .9rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.pm-mode > span > .icon { color: var(--primary); }
.pm-mode small { color: var(--text-muted); font-size: .84rem; line-height: 1.35; }
.pm-mode input:checked + span { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.pm-mode input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.pm-facts, .pm-roles { display: grid; gap: .5rem 1rem; margin: 0; }
.pm-facts { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.pm-facts dt, .pm-roles dt { font-size: .8rem; color: var(--text-muted); }
.pm-facts dd, .pm-roles dd { margin: 0; overflow-wrap: anywhere; }
.pm-roles { padding: 1rem 1.1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.pm-roles dt { font-weight: 700; color: var(--text); font-size: .9rem; }
.pm-roles dd { color: var(--text-muted); font-size: .88rem; }
.pm-person { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; }
.pm-person .grow { min-width: 12rem; }

/* ---------- Diálogos propios (PDE.dialog: confirmar, pedir un texto, avisar) ---------- */
dialog.pde-dlg { width: min(460px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg, 12px); background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
dialog.pde-dlg::backdrop { background: rgba(10, 14, 18, .55); backdrop-filter: blur(2px); }
dialog.pde-dlg[open] { animation: pde-dlg-in .16s ease-out; }
@keyframes pde-dlg-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.pde-dlg-b { display: flex; gap: .9rem; padding: 1.3rem 1.3rem 1rem; }
.pde-dlg-ic { flex: none; display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: var(--radius); background: var(--primary-soft); color: var(--primary); }
.pde-dlg.is-danger .pde-dlg-ic { background: var(--danger-soft); color: var(--danger); }
.pde-dlg-t { flex: 1; min-width: 0; display: grid; gap: .5rem; }
.pde-dlg-t h2 { margin: 0; font-size: 1.1rem; }
.pde-dlg-m { margin: 0; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.pde-dlg-in { width: 100%; box-sizing: border-box; }
.pde-dlg-hint { margin: 0; font-size: .85rem; color: var(--text-muted); }
.pde-dlg-a { display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 1.3rem 1.1rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg, 12px) var(--radius-lg, 12px); }
.toast .toast-act { flex: none; border: 1px solid currentColor; background: none; color: inherit; font: inherit; font-weight: 700; font-size: .85rem; padding: .25rem .6rem; border-radius: var(--radius); cursor: pointer; }
.toast .toast-act:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.sh-qr.is-loading:empty { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%) 0 0 / 200% 100%; animation: sh-qr-load 1.1s linear infinite; }
@keyframes sh-qr-load { to { background-position: -200% 0; } }

/* ¿Suma al ranking? (TennisView::rankBadge) — con el color de la disciplina; «Amistoso» apagado */
.tn-rk-badge { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; text-decoration: none; }
.tn-rk-badge.is-on { background: color-mix(in srgb, var(--dc, var(--primary)) 16%, var(--surface)); color: var(--text); border: 1px solid color-mix(in srgb, var(--dc, var(--primary)) 45%, transparent); font-weight: 700; }
.tn-rk-badge.is-on .icon { color: var(--dc, var(--primary)); }
a.tn-rk-badge.is-on:hover { background: color-mix(in srgb, var(--dc, var(--primary)) 26%, var(--surface)); }
.tn-rk-badge.is-off { color: var(--text-muted); font-weight: 600; }
.cal-card-tags { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }

/* Opciones de listas con foto o iniciales (PDE.suggest it.img / it.ini) y deshabilitadas */
.combo-av { flex: none; width: 1.9rem; height: 1.9rem; border-radius: 50%; object-fit: cover; }
.combo-ini { display: grid; place-items: center; font-size: .72rem; font-weight: 800; color: #fff; background: hsl(var(--h, 200) 45% 42%); }
.combo-list li.is-disabled { opacity: .55; cursor: not-allowed; }
.combo-list li.is-disabled:hover { background: transparent; }
/* Inscripción en dobles: el compañero elegido es una ficha (foto, nombre, @usuario) */
.pt-card { display: flex; align-items: center; gap: .7rem; padding: .55rem .6rem; border: 1px solid var(--primary); border-radius: var(--radius); background: var(--primary-soft); }
.pt-card[hidden] { display: none; }
.pt-card .grow { display: grid; min-width: 0; }
.pt-card strong { overflow-wrap: anywhere; }
.pt-card small { color: var(--text-muted); }
.pt-card .tn-avatar { width: 2.4rem; height: 2.4rem; }
/* Inscripción en dobles: compacta (buscar, «Jugaste con», o la pareja sin cuenta) */
.pt-pick { display: grid; gap: .45rem; min-width: 0; }
.pt-pick [hidden] { display: none !important; }
.pt-label { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; font-size: .9rem; }
.pt-search { position: relative; }
.pt-search .combo { width: 100%; }
.pt-search input { width: 100%; padding-left: 2.1rem; }
.pt-search-ic { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; z-index: 1; display: inline-flex; }
.pt-recent { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.pt-recent small { color: var(--text-muted); font-size: .78rem; margin-right: .1rem; }
.pt-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .6rem .18rem .2rem; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--text); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; }
.pt-chip:hover, .pt-chip:focus-visible { border-color: var(--primary); background: var(--primary-soft); }
.pt-chip .tn-avatar { width: 1.5rem; height: 1.5rem; font-size: .6rem; }
.pt-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .2rem .6rem; margin: 0; font-size: .8rem; color: var(--text-muted); line-height: 1.35; }
.pt-new-open { display: inline-flex; align-items: center; gap: .3rem; padding: 0; border: 0; background: none; color: var(--primary); font: inherit; font-weight: 700; cursor: pointer; }
.pt-new-open:hover { text-decoration: underline; }
.pt-new { display: grid; gap: .5rem; padding: .7rem; border: 1px dashed var(--primary); border-radius: var(--radius); background: var(--primary-soft); }
.pt-new-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.pt-new-head strong { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; white-space: nowrap; }
.pt-new-head .btn { padding-inline: .5rem; }
.pt-new .field { margin: 0; }
.pt-new .hint { margin: 0; font-size: .78rem; }
.pt-new-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .5rem; }
.pt-note summary { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; font-size: .85rem; color: var(--text-muted); list-style: none; }
.pt-note summary::-webkit-details-marker { display: none; }
.pt-note summary:hover { color: var(--text); }
.pt-note[open] summary { margin-bottom: .4rem; }
.pt-note .field { margin: 0; }
/* el aviso de error al lado del formulario que lo causó (ver app.js: «avisos donde corresponden») */
.alert.is-placed { margin: 0 0 .2rem; }

/* Fechas coherentes (dates.js): nota de duración/aviso debajo del campo y resaltado cuando se corrige solo */
.date-note { margin: .3rem 0 0; }
.date-note.is-warn { color: var(--warn); }
input.date-moved { animation: date-moved 1.2s ease; }
@keyframes date-moved { 0%, 40% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 45%, transparent); } 100% { box-shadow: none; } }

/* Modales: encabezado y botones siempre a la vista al hacer scroll (formularios largos en ventanas chicas) */
dialog.modal { overscroll-behavior: contain; }
dialog.modal .modal-head, dialog.modal .sheet-head { position: sticky; top: 0; z-index: 4; background: var(--surface); }
dialog.modal .sheet-foot, dialog.modal .modal-foot { position: sticky; bottom: 0; z-index: 4; background: var(--surface); }
dialog.modal .modal-body .form-actions, dialog.modal form > .form-actions { position: sticky; bottom: 0; z-index: 4; background: var(--surface); border-top: 1px solid var(--border); margin-inline: -1.25rem; padding: .8rem 1.25rem; }
dialog.modal .modal-head .btn-icon, dialog.modal .sheet-head .btn-icon { flex: none; }
.modal-kbd { font-size: .75rem; color: var(--text-muted); }

/* ---------- Seguridad y moderación (compartido por el sitio y el panel) ---------- */
/* cartel arriba de todo: mantenimiento activo (para quien entra igual), solo lectura o mantenimiento programado */
.maint-bar { display: flex; justify-content: center; align-items: center; gap: .5rem; padding: .5rem 1rem; font-size: .88rem; line-height: 1.35; text-align: center; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.maint-bar > .icon { flex: none; }
.maint-bar span { color: var(--text); }
.maint-bar a { color: inherit; font-weight: 700; margin-left: .35rem; white-space: nowrap; }
.maint-bar.is-ro, .maint-bar.is-soon { background: var(--info-soft); color: var(--info); border-bottom-color: color-mix(in srgb, var(--info) 30%, transparent); }
.admin-content > .maint-bar { margin: -.5rem 0 1rem; border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); border-radius: var(--radius); justify-content: flex-start; text-align: left; }
.admin-content > .maint-bar.is-ro { border-color: color-mix(in srgb, var(--info) 30%, transparent); }

/* cartel de mantenimiento y de acceso bloqueado (páginas propias, livianas) */
body.maint-page { background: var(--bg); color: var(--text); }
.maint-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 2rem 1rem; }
.maint-card { width: min(540px, 100%); text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2.2rem 1.5rem; box-shadow: var(--shadow-lg); }
.maint-art { display: grid; place-items: center; color: var(--primary); margin-bottom: 1rem; }
.maint-art .icon { width: 4rem; height: 4rem; color: var(--danger); }
.maint-spin { transform-origin: 60px 60px; animation: maint-rot 2.4s linear infinite; }
@keyframes maint-rot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .maint-spin { animation: none; } }
.maint-brand { margin: 0; font-size: .8rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.maint-card h1 { font-size: clamp(1.5rem, 5vw, 2rem); margin: .3rem 0 .6rem; }
.maint-lead { color: var(--text-muted); margin: 0 auto 1rem; max-width: 42ch; }
.maint-until { display: inline-flex; align-items: center; gap: .35rem; margin: 0; font-weight: 600; }
.maint-count { margin: .25rem 0 0; font-family: var(--font-display); font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.maint-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: 1.4rem; }
.maint-facts { display: grid; gap: .4rem; margin: 0 auto 1rem; max-width: 380px; text-align: left; }
.maint-facts > div { display: flex; gap: .6rem; justify-content: space-between; padding: .45rem .7rem; border-radius: var(--radius); background: var(--surface-2); }
.maint-facts dt { color: var(--text-muted); font-size: .85rem; display: inline-flex; align-items: center; gap: .3rem; }
.maint-facts dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }

/* verificación en dos pasos: ingreso y apelación */
.tfa-card, .appeal-card { text-align: left; }
.tfa-ic { display: grid; place-items: center; width: 3.2rem; height: 3.2rem; border-radius: 50%; background: var(--primary-soft); color: var(--primary); margin-bottom: .8rem; }
.tfa-ic .icon { width: 1.5rem; height: 1.5rem; }
.tfa-input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.5rem !important; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.tfa-trust { margin: .2rem 0 1rem; font-size: .9rem; }
.tfa-help { margin-top: 1rem; font-size: .9rem; }
.tfa-help summary { cursor: pointer; color: var(--primary); display: inline-flex; gap: .35rem; align-items: center; }
.appeal-s { display: flex; gap: .8rem; align-items: flex-start; padding: .9rem; margin: .5rem 0 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.appeal-s p { margin: .2rem 0 0; }

/* seguridad de la propia cuenta (Mi cuenta y Mi perfil) */
.asec-state { display: flex; gap: .8rem; align-items: flex-start; margin: .2rem 0 1rem; }
.asec-state p { margin: .25rem 0 0; font-size: .9rem; }
.asec-dot { flex: none; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--surface-2); color: var(--text-muted); }
.asec-state.is-on .asec-dot { background: var(--ok-soft); color: var(--ok); }
.asec-req { color: var(--warn) !important; font-weight: 600; display: flex; gap: .35rem; align-items: center; }
.asec-left.is-low { color: var(--warn); }
.asec-setup { margin-top: 1rem; }
.asec-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.asec-steps > li { display: flex; gap: .8rem; align-items: flex-start; min-width: 0; }
.asec-steps p { margin: .2rem 0 .5rem; }
.asec-n { flex: none; display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: .9rem; }
.asec-qr-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.asec-qr { display: block; width: 168px; height: 168px; padding: 6px; background: #fff; border-radius: var(--radius); border: 1px solid var(--border); flex: none; }
.asec-qr svg { width: 100%; height: 100%; display: block; }
.asec-key { display: grid; gap: .25rem; min-width: 0; }
.asec-key code { font-size: 1rem; letter-spacing: .08em; overflow-wrap: anywhere; padding: .35rem .5rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.asec-key .btn { justify-self: start; }
.asec-confirm label { display: block; margin: .2rem 0 .5rem; }
.asec-code-row { gap: .5rem; flex-wrap: wrap; }
.asec-code-row .tfa-input { max-width: 12rem; font-size: 1.25rem !important; }
.asec-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; }
.asec-more { flex: 1 1 260px; min-width: 0; }
.asec-more > summary { list-style: none; cursor: pointer; }
.asec-more > summary::-webkit-details-marker { display: none; }
.asec-pw { margin-top: .6rem; padding: .8rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.asec-pw label { display: block; font-size: .88rem; margin-bottom: .4rem; }
.asec-pw .row { gap: .5rem; flex-wrap: wrap; }
.asec-pw input[type=password] { flex: 1 1 180px; min-width: 0; }
.asec-codes { margin-top: 1rem; padding: 1rem; border: 2px dashed var(--warn); border-radius: var(--radius); background: var(--warn-soft); }
.asec-codes h3 { margin: 0 0 .3rem; font-size: 1rem; display: flex; gap: .4rem; align-items: center; }
.asec-code-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .4rem; margin: .8rem 0; padding: 0; list-style: none; }
.asec-code-list li { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.05rem; text-align: center; padding: .4rem; border-radius: var(--radius-sm); background: var(--surface); }
.asec-codes .row { gap: .5rem; flex-wrap: wrap; }
.asec-list { list-style: none; margin: .4rem 0 .8rem; padding: 0; display: grid; gap: .4rem; }
.asec-list li { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.asec-list li.is-current { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); background: color-mix(in srgb, var(--ok-soft) 50%, transparent); }
.asec-list .grow { min-width: 0; overflow-wrap: anywhere; }
.asec-list form { margin: 0 !important; }
.asec-dev { flex: none; display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: var(--radius); background: var(--surface-2); color: var(--text-muted); }

/* reportes y sanciones de la propia cuenta */
.amod-h { font-size: .95rem; margin: 1rem 0 .4rem; color: var(--text-muted); }
.amod-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.amod-list > li { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .8rem; border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.amod-list > li.is-on { border-left: 4px solid var(--warn); }
.amod-list > li.is-ended { opacity: .8; }
.amod-list > li.is-focus { box-shadow: 0 0 0 3px var(--primary-soft); }
.amod-list .grow { min-width: 0; overflow-wrap: anywhere; }
.amod-list p { margin: .2rem 0 0; font-size: .9rem; }
.amod-ic { flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: var(--radius); background: var(--surface-2); }
.amod-msg { font-style: italic; }
.amod-appeal { color: var(--info); }
.amod-appeal.is-ok { color: var(--ok); }
.amod-ap { margin-top: .5rem; }
.amod-ap > summary { list-style: none; cursor: pointer; display: inline-flex; }
.amod-ap > summary::-webkit-details-marker { display: none; }
.amod-ap form { margin-top: .5rem; display: grid; gap: .5rem; }
.amod-ap textarea { width: 100%; }
.amod-ap form .btn { justify-self: start; }

/* reportar: botón y formulario */
.rp-btn { color: var(--text-muted); }
.rp-btn:hover { color: var(--danger); }
.rp-btn.is-reported { color: var(--danger); }
.footer-links { display: inline-flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: center; }
.footer-report { padding: .2rem .5rem; min-height: 0; font-size: .85rem; }
dialog.rp-dlg { width: min(720px, calc(100vw - 1.5rem)); }
.rp-dlg .modal-head h2 { display: flex; align-items: center; gap: .45rem; font-size: 1.15rem; min-width: 0; }
.rp-dlg .modal-head h2 span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-lead { display: flex; gap: .4rem; align-items: flex-start; margin: 0 0 1rem; padding: .6rem .8rem; border-radius: var(--radius); background: var(--surface-2); font-size: .88rem; color: var(--text-muted); }
.rp-lead .icon { flex: none; margin-top: .15rem; }
.rp-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.rp-reasons { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
.rp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: .45rem; }
.rp-reason { position: relative; cursor: pointer; display: block; min-width: 0; }
.rp-reason input { position: absolute; opacity: 0; pointer-events: none; }
.rp-reason span { display: grid; grid-template-columns: auto 1fr; column-gap: .5rem; align-items: center; height: 100%; padding: .55rem .7rem; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color .15s, background .15s; }
.rp-reason span .icon { grid-row: span 2; color: var(--text-muted); }
.rp-reason strong { font-size: .9rem; line-height: 1.25; }
.rp-reason small { grid-column: 2; font-size: .76rem; color: var(--text-muted); line-height: 1.3; }
.rp-reason:hover span { border-color: var(--border-strong); }
.rp-reason input:checked + span { border-color: var(--danger); background: var(--danger-soft); }
.rp-reason input:checked + span .icon { color: var(--danger); }
.rp-reason input:focus-visible + span { box-shadow: var(--focus); }
.rp-count { text-align: right; margin-top: .2rem; }
.rp-drop { position: relative; display: flex; gap: .8rem; align-items: center; padding: .9rem 1rem; margin: .4rem 0; border: 2px dashed var(--border-strong); border-radius: var(--radius); cursor: pointer; color: var(--text-muted); transition: border-color .15s, background .15s; }
.rp-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.rp-drop .icon { width: 1.6rem; height: 1.6rem; flex: none; }
.rp-drop span { display: grid; }
.rp-drop strong { color: var(--text); }
.rp-drop.is-over, .rp-drop:hover { border-color: var(--primary); background: var(--primary-soft); }
.rp-drop.is-full { opacity: .5; pointer-events: none; }
.rp-files { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; gap: .35rem; }
.rp-files li { display: flex; gap: .6rem; align-items: center; padding: .35rem .5rem; border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.rp-files img, .rp-ficon { width: 44px; height: 44px; flex: none; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-2); display: grid; place-items: center; }
.rp-files .grow { min-width: 0; display: grid; }
.rp-files strong { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-files small { color: var(--text-muted); font-size: .78rem; }
.rp-links { display: grid; gap: .35rem; margin-bottom: .4rem; }
.rp-link { display: flex; gap: .4rem; align-items: center; }
.rp-link input { flex: 1; min-width: 0; }
.rp-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 1.25rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
.rp-login, .rp-done { text-align: center; display: grid; justify-items: center; gap: .6rem; padding: 2rem 1.25rem; }
.rp-done p { margin: 0; max-width: 46ch; }
.rp-big { display: grid; place-items: center; width: 3.6rem; height: 3.6rem; border-radius: 50%; background: var(--surface-2); color: var(--primary); }
.rp-big .icon { width: 1.8rem; height: 1.8rem; }
.rp-big.is-ok { background: var(--ok-soft); color: var(--ok); }
@media (max-width: 560px) {
  .rp-grid { grid-template-columns: 1fr; }
  .rp-reason small { display: none; }
  .rp-foot .btn { flex: 1 1 auto; justify-content: center; }
}
