/* Una columna estrecha pensada para el movil. Grises neutros y el texto como
   unico acento; el verde solo marca lo recomendado y lo que va bien. */
:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --fg: #1c1c1a;
  --muted: #6b6b66;
  --line: #e4e4e0;
  --good: #2f7d55;
  --warn: #b7791f;
  --bad: #c0392b;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211; --surface: #1a1a19; --fg: #ecece8; --muted: #9a9a94; --line: #2c2c2a;
    --good: #5fbf8a; --warn: #e0a84a; --bad: #e57368;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font);
  font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.wrap {
  max-width: 640px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px 80px;
  display: flex; flex-direction: column; gap: 20px;
}
h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; margin: 0; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; margin: 0; text-wrap: balance; }
h3 { font-size: 15px; font-weight: 600; margin: 0; }
p { margin: 0; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* Estado del agente */
.top { display: flex; flex-direction: column; gap: 6px; }
.state { display: flex; align-items: baseline; gap: 8px; }
.dot { flex: none; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); transform: translateY(-1px); }
.dot.good { background: var(--good); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.meters { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.meters b { font-weight: 500; color: var(--fg); }

/* Pestañas */
.tabs {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  display: flex; gap: 4px; border-bottom: 1px solid var(--line);
  margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px)));
  padding-inline: max(12px, env(safe-area-inset-left, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  overflow-x: auto; scrollbar-width: none;
}
.tabs button {
  background: none; border: 0; color: var(--muted); font: inherit; font-size: 15px; font-weight: 500;
  padding: 12px 8px 10px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--fg); }
.tabs .n { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 5px; border-radius: 9px; background: var(--fg); color: var(--bg); font-size: 12px; line-height: 18px; text-align: center; }

/* Items */
.list { display: flex; flex-direction: column; gap: 16px; }
.item {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; display: flex; flex-direction: column; gap: 12px; scroll-margin-top: 64px;
  transition: border-color .3s ease;
}
.item.focus { border-color: var(--fg); }
.meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: var(--muted); }
.meta .block { color: var(--warn); font-weight: 500; }
.md { display: flex; flex-direction: column; gap: 8px; font-size: 15px; overflow-wrap: anywhere; }
.md ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.md code { font-size: 13px; background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 0 4px; }
.md pre { margin: 0; overflow-x: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 13px; }
.md pre code { border: 0; padding: 0; background: none; }
.md h4 { margin: 4px 0 0; font-size: 14px; font-weight: 600; }

.opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: grid; grid-template-columns: 20px 1fr; gap: 12px; align-items: start; text-align: left;
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--fg); font: inherit; cursor: pointer; transition: border-color .15s ease;
}
.opt:hover { border-color: var(--muted); }
.opt[aria-pressed="true"] { border-color: var(--fg); }
.radio { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--muted); margin-top: 3px; display: grid; place-items: center; }
.radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--fg); transform: scale(0); transition: transform .15s ease; }
.opt[aria-pressed="true"] .radio { border-color: var(--fg); }
.opt[aria-pressed="true"] .radio::after { transform: scale(1); }
.opt .t { font-weight: 500; }
.opt .d { color: var(--muted); font-size: 14px; margin-top: 2px; }
.rec { color: var(--good); font-size: 13px; font-weight: 500; margin-left: 6px; white-space: nowrap; }

textarea, input, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
textarea { resize: vertical; min-height: 44px; }
textarea.big { min-height: 140px; }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--fg); }
::placeholder { color: var(--muted); }
.pin { font-size: 24px; letter-spacing: .4em; text-align: center; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 0; }
button.main, button.ghost {
  font: inherit; font-weight: 500; font-size: 15px; cursor: pointer; border-radius: 10px; padding: 11px 16px;
}
button.main { background: var(--fg); color: var(--bg); border: 1px solid var(--fg); }
button.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, .opt:focus-visible, .tabs button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.err { color: var(--bad); font-size: 14px; }
.ok { color: var(--good); font-size: 14px; }

.hist { display: flex; flex-direction: column; }
.hist .h { display: flex; flex-direction: column; gap: 2px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.hist .h:last-child { border-bottom: 0; }
.hist .a { font-size: 14px; }

.section { display: flex; flex-direction: column; gap: 10px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.section:last-child { border-bottom: 0; }
.empty { padding: 40px 0; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.gate { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; gap: 14px; max-width: 360px; margin: 0 auto; width: 100%; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
