/* Panel de Retoma. Identidad «cuaderno de mostrador» (la misma de site/): papel cálido, serif de
   sistema para titulares, monoespaciada para rótulos y horas, verde y mostaza. Sin webfonts ni
   recursos externos (la CSP solo admite 'self'). */
:root {
  --bg: #fbfaf7;
  --fg: #1d1d1b;
  --muted: #5f5e58;
  --accent: #0f6b4f;
  --accent-ink: #ffffff;
  --line: #e4e1d8;
  --card: #ffffff;
  --soft: #f2f0e9;
  --mark: #f7dd8f;
  --stamp: #a8481f;
  --ok: #0f6b4f;
  --ok-bg: #dff2e8;
  --warn: #8a5a00;
  --warn-bg: #fbecc4;
  --alert: #a8481f;
  --alert-bg: #f8e1d6;
  --idle: #5f5e58;
  --idle-bg: #ecebe6;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, ui-serif, Georgia, "Noto Serif", serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, "Cascadia Mono", Consolas, "Roboto Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141412;
    --fg: #ecebe6;
    --muted: #a9a79f;
    --accent: #5fc79f;
    --accent-ink: #0a1712;
    --line: #2c2b27;
    --card: #1c1c19;
    --soft: #1b1b17;
    --mark: rgba(240, 197, 82, 0.3);
    --stamp: #e59c74;
    --ok: #7fe0b8;
    --ok-bg: #1d3a2e;
    --warn: #f0c552;
    --warn-bg: #3a3014;
    --alert: #e59c74;
    --alert-bg: #3c2316;
    --idle: #a9a79f;
    --idle-bg: #26261f;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
em { font-style: italic; font-weight: 400; color: var(--accent); }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.mono-label { font: 500 12px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.mono-value { font: 500 14px/1.4 var(--mono); white-space: nowrap; }
.kicker { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; color: var(--muted); font: 500 12px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.kicker::before { content: ""; flex: none; width: 28px; height: 1px; background: currentColor; }
.empty { padding: 18px 0; color: var(--muted); }

.skip { position: absolute; left: 16px; top: -80px; z-index: 30; padding: 10px 16px; border-radius: 8px; background: var(--fg); color: var(--bg); font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }

/* Barra superior */
.bar { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.bar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 28px; min-height: 64px; }
.logo { font-family: var(--serif); font-size: 26px; letter-spacing: -0.02em; color: var(--fg); text-decoration: none; }
.logo span { color: var(--accent); }
.tabs { display: flex; gap: 6px; flex: 1; }
.tabs a { padding: 20px 10px 17px; border-bottom: 3px solid transparent; color: var(--muted); text-decoration: none; font-size: 15px; }
.tabs a:hover { color: var(--fg); }
.tabs a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--accent); }
.who { display: flex; align-items: center; gap: 16px; }
.who-text { display: flex; flex-direction: column; text-align: right; line-height: 1.3; }
.who-text span { max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-button { padding: 4px 0; border: 0; background: none; color: var(--accent); font: inherit; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.link-button:disabled { color: var(--muted); cursor: default; text-decoration: none; }
.flash { max-width: 1160px; margin: 0 auto; padding: 0 20px; color: var(--stamp); }
.flash:not(:empty) { padding-top: 14px; }

/* Vistas */
.view { padding-top: 56px; padding-bottom: 96px; }
h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 5.6vw, 64px); line-height: 1.04; letter-spacing: -0.028em; text-wrap: balance; max-width: 22ch; }
h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(24px, 3vw, 32px); line-height: 1.15; letter-spacing: -0.015em; }
.small-title { font-size: 22px; margin: 6px 0 14px; }
.hero { padding-bottom: 36px; border-bottom: 1px solid var(--line); }
.hero h1 { margin-bottom: 16px; }
.lead { max-width: 36em; margin: 14px 0 22px; font-size: 18px; color: var(--muted); }
.block { margin-top: 56px; }
.block h2 { margin-bottom: 20px; }
.cols { display: grid; gap: 0 56px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.stack { min-width: 0; }
.row-between { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.mono-link { font: 500 12px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.card { padding: 22px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.card h2 { margin-bottom: 18px; }

/* Insignias */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font: 600 11px/1.6 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.badge.tone-ok { color: var(--ok); background: var(--ok-bg); }
.badge.tone-warn { color: var(--warn); background: var(--warn-bg); }
.badge.tone-alert { color: var(--alert); background: var(--alert-bg); }
.badge.tone-idle { color: var(--idle); background: var(--idle-bg); }

/* Canales */
.channels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.channel { padding: 22px; border-left: 1px solid var(--line); min-width: 0; }
.channel:first-child { border-left: 0; }
.channel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.channel-title { margin-bottom: 4px; font-size: 17px; overflow-wrap: anywhere; }

/* Avisos: notas sobre una hoja mostaza */
.sheet { margin: 0 12px 12px 0; padding: 22px; background: var(--card); border: 1px solid var(--line); box-shadow: 12px 12px 0 var(--mark); min-width: 0; }
.notes { display: grid; gap: 16px; }
.note { padding: 12px 14px; background: var(--soft); border-left: 3px solid var(--line); }
.note.tone-ok { border-left-color: var(--ok); }
.note.tone-warn { border-left-color: var(--warn); }
.note.tone-alert { border-left-color: var(--alert); }
.note-stamp { margin-bottom: 4px; color: var(--muted); }
.note.tone-alert .note-stamp { color: var(--alert); }
.note-text { overflow-wrap: anywhere; }

/* Uso del plan */
.meters { display: grid; gap: 20px; }
.meter-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
progress { display: block; width: 100%; height: 6px; border: 0; border-radius: 3px; background: var(--line); color: var(--accent); appearance: none; -webkit-appearance: none; overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); border-radius: 3px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 3px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 3px; }
.level-warn progress { color: var(--warn); }
.level-warn progress::-webkit-progress-value { background: var(--warn); }
.level-warn progress::-moz-progress-bar { background: var(--warn); }
.level-full progress { color: var(--alert); }
.level-full progress::-webkit-progress-value { background: var(--alert); }
.level-full progress::-moz-progress-bar { background: var(--alert); }
.meter .small { margin-top: 6px; }

/* Flujos activos */
.flows { border-top: 1px solid var(--line); }
.flow { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.flow > div { min-width: 0; }
.flow-name { font-family: var(--serif); font-weight: 400; font-size: 20px; overflow-wrap: anywhere; }

/* Botones */
.button { display: inline-flex; align-items: center; justify-content: center; padding: 13px 22px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font: 600 16px/1.2 system-ui, sans-serif; text-decoration: none; cursor: pointer; }
.button:hover { filter: brightness(1.08); }
.button:disabled { opacity: 0.6; cursor: default; }
.block-button { width: 100%; }

/* Entrada */
.login-wrap { max-width: 520px; margin: 0 auto; padding: 56px 20px 72px; }
.login-wrap .logo { display: block; font-size: 34px; }
.login-wrap h1 { margin: 40px auto 0; max-width: none; text-align: center; }
.login-wrap .lead { margin: 14px auto 28px; }
.login-card { margin-bottom: 24px; }
.field-label { display: block; margin-bottom: 6px; font: 500 12px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
input[type="email"], input[type="text"] { width: 100%; margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); font: inherit; font-size: 17px; }
input:focus-visible { outline-offset: 1px; }
.code-input { font-family: var(--mono) !important; font-size: 28px !important; letter-spacing: 0.4em; text-align: center; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.captcha { margin-bottom: 14px; min-height: 65px; }
.hint { margin-top: 16px; color: var(--muted); }
.notice:not(:empty) { margin-bottom: 14px; padding: 10px 12px; border-radius: 6px; background: var(--ok-bg); color: var(--ok); font-size: 14px; }
.error:not(:empty) { margin-bottom: 14px; padding: 10px 12px; border-radius: 6px; background: var(--alert-bg); color: var(--alert); font-size: 14px; }

@media (max-width: 880px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .channels { grid-template-columns: minmax(0, 1fr); }
  .channel { border-left: 0; border-top: 1px solid var(--line); }
  .channel:first-child { border-top: 0; }
}
@media (max-width: 640px) {
  .bar-inner { padding-top: 10px; padding-bottom: 6px; }
  .tabs { order: 3; flex-basis: 100%; margin: 0 -10px; }
  .who { margin-left: auto; }
  .who-text { display: none; }
  .view { padding-top: 36px; }
  .block { margin-top: 44px; }
  .sheet { padding: 16px; box-shadow: 8px 8px 0 var(--mark); margin-right: 8px; }
}
/* Canales y Flujos */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.actions.tight { margin-top: 8px; justify-content: flex-end; }
.button.secondary { background: var(--soft); color: var(--fg); border: 1px solid var(--line); }
.button.danger { background: var(--alert-bg); color: var(--alert); border: 1px solid var(--alert); }
.small-button { padding: 8px 14px; font-size: 14px; border-radius: 8px; }
.card .channel-head { margin-bottom: 12px; }
.card .channel-head .small-title { margin: 0; }
.card p + p { margin-top: 8px; }
.channels.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.confirm { margin-top: 16px; border-color: var(--alert); }
.flow-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.templates { display: grid; gap: 14px; margin-top: 12px; }
.template { padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.template-body { margin-top: 8px; padding: 10px 12px; background: var(--soft); border-left: 3px solid var(--line); overflow-wrap: anywhere; white-space: pre-wrap; }
textarea { width: 100%; margin-bottom: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); font: inherit; font-size: 16px; resize: vertical; }
textarea:focus-visible { outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; }
.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.timeline { list-style: none; margin: 14px 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); display: grid; gap: 14px; }
.tl-step { position: relative; overflow-wrap: anywhere; }
.tl-step::before { content: ""; position: absolute; left: -25px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.total { font: 600 22px/1.3 var(--mono); margin: 6px 0; overflow-wrap: anywhere; }
.lead-small { font-size: 17px; }
.est-step { margin-top: 12px; }
.est-step ul, .missing { list-style: disc; padding-left: 20px; }
.notice.warn:not(:empty) { background: var(--warn-bg); color: var(--warn); }
#act-estimate, #act-text { margin-bottom: 12px; }
@media (max-width: 880px) { .channels.two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .flow { flex-direction: column; align-items: stretch; } .flow-side { align-items: flex-start; } .actions.tight { justify-content: flex-start; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
