/* Selfcare DMR - inspirado en las tarjetas QSL: papel frío, tinta azul marino y un rojo de sello */
:root {
  --paper: #f2f4f6;
  --card: #ffffff;
  --ink: #15233b;
  --muted: #56657a;
  --rule: #cbd3dc;
  --signal: #b3261e;
  --ok: #1e6b4e;
  --warn: #8a5a00;
  --display: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", "Liberation Sans Narrow", sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { font-size: 106.25%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); line-height: 1.55; }
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--signal); }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }

.shell { max-width: 36rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.masthead { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  border-bottom: 2px solid var(--ink); padding-bottom: .6rem; margin-bottom: 2rem; }
.masthead .brand { text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 1.15rem; letter-spacing: .01em; }
.masthead nav { display: flex; gap: 1rem; font-size: .9rem; }
.masthead form { margin: 0; }
.linkbutton { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

h1 { font-family: var(--display); font-weight: 700; font-size: 2.3rem; line-height: 1.1; margin: 0 0 .75rem; }
h2 { font-family: var(--display); font-weight: 700; font-size: 1.35rem; margin: 2.25rem 0 .5rem; }
p { margin: 0 0 1rem; max-width: 34em; }
.lead { font-size: 1.1rem; color: var(--muted); }
.muted { color: var(--muted); font-size: .92rem; }

.choices { display: grid; gap: 1rem; margin-top: 2rem; }
.choice { display: block; padding: 1.1rem 1.25rem; background: var(--card); border: 1px solid var(--rule);
  border-left: 6px solid var(--ink); text-decoration: none; }
.choice strong { display: block; font-family: var(--display); font-size: 1.25rem; }
.choice span { color: var(--muted); font-size: .95rem; }
.choice:hover { border-left-color: var(--signal); color: var(--ink); }

form.stack { display: grid; gap: 1.05rem; margin-top: 1.5rem; }
label { display: grid; gap: .3rem; font-weight: 600; font-size: .95rem; }
label small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=password], input[type=email] { font: inherit; padding: .6rem .7rem;
  border: 1px solid var(--muted); border-radius: 3px; background: var(--card); color: var(--ink); width: 100%; }
input.callsign { text-transform: uppercase; font-family: var(--display); font-size: 1.15rem; letter-spacing: .04em; }
button, .button { font: inherit; font-weight: 600; padding: .65rem 1.1rem; border-radius: 3px; border: 2px solid var(--ink);
  background: var(--ink); color: #fff; cursor: pointer; justify-self: start; }
button.secondary { background: transparent; color: var(--ink); }
button.danger { background: transparent; color: var(--signal); border-color: var(--signal); }
button:hover, a.button:hover { background: var(--signal); border-color: var(--signal); color: #fff; }
a.button { display: inline-block; text-decoration: none; }

.notice { padding: .8rem 1rem; border-left: 4px solid var(--ink); background: var(--card); margin: 1rem 0; }
.notice.error { border-color: var(--signal); }
.notice.ok { border-color: var(--ok); }

/* La tarjeta: el indicativo manda, como en una QSL */
.qsl { background: var(--card); border: 1px solid var(--rule); padding: 1.5rem 8rem 1.25rem 1.5rem; margin: 1.5rem 0 1rem;
  position: relative; }
.qsl .owner { margin-top: .15rem; color: var(--muted); }
.qsl .call { font-family: var(--display); font-weight: 800; font-size: clamp(3rem, 14vw, 4.6rem); line-height: .95; letter-spacing: .02em; }
.qsl .id { font-family: var(--mono); color: var(--muted); margin-top: .35rem; }
.qsl .stamp { position: absolute; top: 1.1rem; right: 1.1rem; transform: rotate(-6deg); border: 2px solid currentColor;
  padding: .15rem .55rem; font-family: var(--display); font-weight: 700; font-size: 1rem; border-radius: 3px; }
.stamp.active { color: var(--ok); }
.stamp.pending { color: var(--warn); }
.stamp.suspended { color: var(--signal); }

dl.params { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 1rem 0; }
dl.params dt { color: var(--muted); }
dl.params dd { margin: 0; font-family: var(--mono); overflow-wrap: anywhere; }
dl.params dd .plain { font-family: var(--body); color: var(--muted); }
ol.steps { padding-left: 1.3rem; }
ol.steps li { margin-bottom: .4rem; }

/* Administración */
.shell.wide { max-width: 64rem; }
table { width: 100%; border-collapse: collapse; background: var(--card); font-size: .93rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 600; color: var(--muted); }
td.call { font-family: var(--display); font-weight: 700; font-size: 1.1rem; }
td .actions { display: flex; flex-wrap: wrap; gap: .4rem; }
td .actions form { margin: 0; }
td .actions button { padding: .3rem .6rem; font-size: .85rem; border-width: 1px; }
.tablewrap { overflow-x: auto; }
.badge { font-size: .8rem; font-weight: 600; }
.badge.pending { color: var(--warn); } .badge.active { color: var(--ok); } .badge.suspended { color: var(--signal); }
.secret { font-family: var(--mono); font-size: 1.4rem; background: var(--card); border: 1px dashed var(--ink); padding: .6rem .8rem; display: inline-block; }

@media (max-width: 30rem) {
  h1 { font-size: 1.9rem; }
  dl.params { grid-template-columns: 1fr; gap: 0 0; }
  dl.params dd { margin-bottom: .6rem; }
  .qsl { padding-right: 1.25rem; }
  .qsl .stamp { position: static; display: inline-block; transform: rotate(-4deg); margin-bottom: .75rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Talkgroups */
textarea { font: inherit; padding: .6rem .7rem; border: 1px solid var(--muted); border-radius: 3px;
  background: var(--card); color: var(--ink); width: 100%; box-sizing: border-box; resize: vertical; }
textarea.callsign { text-transform: uppercase; font-size: 1rem; letter-spacing: .03em; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
label.check input { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--ink); }
input[readonly] { opacity: .7; }
.actions-row { display: flex; gap: .6rem; align-items: center; }
a.button.tiny { padding: .3rem .6rem; font-size: .85rem; border-width: 1px; }
a.button.secondary { background: transparent; color: var(--ink); }
/* Cabecera en móvil: el menú baja de línea en vez de desbordar */
.masthead { flex-wrap: wrap; row-gap: .4rem; }
.masthead nav { flex-wrap: wrap; row-gap: .3rem; }
small.warn { color: var(--warn); font-weight: 600; }

/* Puentes y auditoría */
.mono, code { font-family: var(--mono); font-size: .88rem; }
select { font: inherit; padding: .55rem .6rem; border: 1px solid var(--muted); border-radius: 3px; background: var(--card); color: var(--ink); width: 100%; }
fieldset { border: 1px solid var(--rule); border-radius: 3px; padding: .9rem 1rem 1rem; margin: 0; display: grid; gap: 1rem; }
legend { font-weight: 700; padding: 0 .35rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.pill { display: inline-block; font-size: .78rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; border: 1.5px solid currentColor; }
.pill.ok { color: var(--ok); } .pill.connecting { color: var(--warn); } .pill.error { color: var(--signal); }
.pill.paused, .pill.stale { color: var(--muted); }
.warn { color: var(--warn); font-weight: 600; }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; border-bottom: 1px solid var(--rule); margin: 0 0 1.25rem; }
.tabs a { text-decoration: none; padding: .45rem 0; border-bottom: 3px solid transparent; font-weight: 600; color: var(--muted); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--signal); }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin: 0 0 .75rem; }
.filters label { font-size: .85rem; }
.filters input, .filters select { width: auto; min-width: 8rem; padding: .45rem .55rem; }
.filters input[type=date] { font: inherit; border: 1px solid var(--muted); border-radius: 3px; background: var(--card); color: var(--ink); }
.filters button, .filters .button { padding: .45rem .9rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; }
.card { background: var(--card); border: 1px solid var(--rule); padding: 1rem 1.1rem; }
.card header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .4rem; font-size: 1.1rem; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; margin: .5rem 0; font-size: .9rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
ul.diff { margin: 0; padding-left: 1rem; font-size: .88rem; }
.pager { display: flex; gap: 1.5rem; }
td .call, span.call { font-family: var(--display); font-weight: 700; }
.grid2 { align-items: end; }
.nowrap { white-space: nowrap; }
.notice pre { margin: .6rem 0; padding: .5rem .7rem; background: var(--bg, transparent); border: 1px dashed var(--rule); white-space: pre-wrap; }

/* ---- Ayuda del panel: administración y editor ---- */
button.small, a.button.small { padding: .3rem .7rem; font-size: .85rem; border-width: 1px; }
button.icon { padding: .2rem .55rem; font-size: .95rem; border-width: 1px; background: transparent; color: var(--ink); line-height: 1.2; }
button:disabled { opacity: .35; cursor: default; }
button:disabled:hover { background: transparent; color: var(--ink); border-color: var(--ink); }
.actions-row form { margin: 0; }
.inline-edit { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-edit input[type=text] { flex: 1 1 16rem; width: auto; }
.help-section { margin: 1.75rem 0; padding-top: 1rem; border-top: 2px solid var(--ink); }
.help-section-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.help-section-head .inline-edit input[type=text] { font-family: var(--display); font-weight: 700; font-size: 1.15rem; }
.help-items { list-style: none; margin: .75rem 0; padding: 0; background: var(--card); border: 1px solid var(--rule); }
.help-items li { display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem; border-top: 1px solid var(--rule); flex-wrap: wrap; }
.help-items li:first-child { border-top: 0; }
.help-items li .q { flex: 1 1 18rem; font-weight: 600; text-decoration: none; }
.help-items li .q:hover { text-decoration: underline; }
.help-items li.hidden-item .q { color: var(--muted); font-weight: 400; }
.danger-zone { margin-top: 2.5rem; }
.danger-zone summary { cursor: pointer; color: var(--signal); font-weight: 600; }
.danger-form { margin-top: 2rem; }
select { max-width: 100%; }

.editor { display: grid; gap: 0; }
.editor-label { font-weight: 600; font-size: .95rem; margin-bottom: .3rem; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; padding: .45rem; background: var(--paper);
  border: 1px solid var(--muted); border-bottom: 0; border-radius: 3px 3px 0 0; position: sticky; top: 0; z-index: 2; }
.editor-toolbar button { padding: .25rem .55rem; font-size: .85rem; border-width: 1px; background: var(--card); color: var(--ink); font-weight: 600; }
.editor-toolbar button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.editor-toolbar select { width: auto; padding: .25rem .4rem; font-size: .85rem; }
.editor-toolbar .sep { width: 1px; align-self: stretch; background: var(--rule); margin: 0 .15rem; }
.editor-toolbar .grow { flex: 1; }
.editor-area, .editor-source { min-height: 18rem; border: 1px solid var(--muted); border-radius: 0 0 3px 3px; background: var(--card);
  padding: .8rem 1rem; color: var(--ink); width: 100%; }
.editor-area:focus, .editor-source:focus { outline: 2px solid var(--ink); outline-offset: -2px; }
.editor-source { font-size: .85rem; line-height: 1.45; resize: vertical; }
.editor.busy .editor-area { opacity: .6; cursor: progress; }
.editor-hint { margin: .5rem 0 0; }
.editor-gallery { margin-top: .5rem; }
.editor-gallery summary { cursor: pointer; font-size: .9rem; }
.thumbs { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.thumb { padding: 0; border: 1px solid var(--rule); background: var(--card); width: 6.5rem; height: 4.5rem; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover { border-color: var(--signal); background: var(--card); }

/* Contenido de una respuesta (igual de legible que en el panel) */
.help-content p { margin: 0 0 .7rem; }
.help-content h3 { font-size: 1.1rem; margin: 1rem 0 .4rem; }
.help-content h4 { font-size: 1rem; margin: .9rem 0 .35rem; }
.help-content ul, .help-content ol { margin: 0 0 .7rem; padding-left: 1.4rem; }
.help-content blockquote { margin: .6rem 0; padding: .4rem .8rem; border-left: 4px solid var(--rule); color: var(--muted); }
.help-content pre { background: var(--paper); padding: .6rem .8rem; overflow-x: auto; font-family: var(--mono); font-size: .85rem; }
.help-content code { font-family: var(--mono); font-size: .88em; background: var(--paper); padding: 0 .25rem; }
.help-content img { max-width: 100%; height: auto; display: block; margin: .5rem 0; border: 1px solid var(--rule); }
.help-content table { width: auto; margin: .5rem 0; }
.help-content th, .help-content td { border: 1px solid var(--rule); padding: .3rem .6rem; }
.help-content p, .editor-hint { max-width: none; }
.help-section-head .inline-edit { flex: 1 1 26rem; }
.help-section-head h2 { margin: 0; }
.help-items.numbered .num { font-family: var(--mono); color: var(--muted); min-width: 1.8rem; }
