/* Base compartida: tokens, reset, controles. Claro/oscuro según el sistema.
 * Mundo «app de consumo cálida»: fondo arena teñido, tarjetas blancas de esquina amplia,
 * un único color saturado (naranja quemado) reservado a lo que se puede pulsar y al
 * progreso activo; verde solo para «guardado y verificado», rojo solo para fallos.
 * La app de Mac (mac_agent/theme.py) usa los mismos valores. */
@font-face {
  font-family: "Figtree"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/assets/fonts/figtree-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/assets/fonts/figtree-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;
  --font: "Figtree", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --ground: #fbf3e9;        /* fondo de página, arena teñida */
  --bg: #ffffff;            /* tarjetas */
  --bg-sunken: #f5eadd;     /* superficies hundidas dentro de una tarjeta */
  --bg-hover: #f3e7da;
  --bg-selected: #fbe6da;
  --line: #eadfd2;
  --line-strong: #d9cbbb;
  --text: #2b241f;
  --text-2: #6f625a;
  --text-3: #776859;
  --accent: #c2410c;        /* la acción: solo lo que se puede pulsar y el progreso activo */
  --accent-hover: #a8380a;
  --accent-soft: #fbe6da;
  --accent-text: #b5400f;
  --on-accent: #ffffff;
  --bubble-in: #ffffff;
  --bubble-out: #f7dccb;
  --bubble-out-text: #2b241f;
  --bubble-out-meta: #6f4e3a;
  --ok: #1c7a47;
  --ok-soft: #e5f3ea;
  --warn: #8a5300;
  --warn-soft: #fbefd8;
  --err: #b3261e;
  --err-soft: #fbe7e4;
  --shadow-pop: 0 18px 40px rgba(60, 38, 20, 0.16), 0 2px 6px rgba(60, 38, 20, 0.08);
  --shadow-card: 0 1px 2px rgba(60, 38, 20, 0.05);
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-bubble: 18px;

  --fs-xs: 0.75rem;   /* 12 */
  --fs-sm: 0.8125rem; /* 13 */
  --fs-md: 0.9375rem; /* 15 */
  --fs-lg: 1rem;      /* 16 */
  --fs-xl: 1.125rem;  /* 18 */
  --fs-2xl: 1.5rem;   /* 24 */
  --fs-3xl: 2.125rem; /* 34 */
  --fs-4xl: 2.75rem;  /* 44 */

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #1d1915;
    --bg: #26211c;
    --bg-sunken: #1f1a16;
    --bg-hover: #312a23;
    --bg-selected: #3a2418;
    --line: #3a322a;
    --line-strong: #4a4036;
    --text: #f3eae0;
    --text-2: #bfb2a5;
    --text-3: #a89a8c;
    --accent: #e8693a;
    --accent-hover: #f07a4a;
    --accent-soft: #3a2418;
    --accent-text: #f49a6e;
    --on-accent: #1d1410;
    --bubble-in: #2f2822;
    --bubble-out: #4a2b1c;
    --bubble-out-text: #f3eae0;
    --bubble-out-meta: #d9bfaf;
    --ok: #5bc98c;
    --ok-soft: #173326;
    --warn: #e8ac48;
    --warn-soft: #3a2c12;
    --err: #f2756f;
    --err-soft: #3d1b1a;
    --shadow-pop: 0 18px 40px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.35);
    --shadow-card: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-md)/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
button, input, textarea, select { font: inherit; color: inherit; }
img, video { display: block; max-width: 100%; }
a { color: var(--accent-text); text-underline-offset: 0.18em; }
::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); }
::marker { color: var(--text-3); }
input, textarea { caret-color: var(--accent); }
:focus-visible { outline: none; box-shadow: var(--focus); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Scrollbars finos, del color de la interfaz */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 22px; height: 22px; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--bg); color: var(--text);
  font-weight: 600; font-size: var(--fs-md); text-decoration: none; white-space: nowrap;
  cursor: pointer; transition: background-color 160ms var(--ease-out), border-color 160ms, color 160ms, transform 180ms var(--ease-out);
}
.btn:hover { background: var(--bg-hover); }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-icon { width: 44px; padding: 0; }
.btn-block { width: 100%; }
.btn.is-busy { pointer-events: none; opacity: 0.75; }

.input {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--bg); color: var(--text);
  transition: border-color 150ms, box-shadow 150ms;
}
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }

/* Píldoras de estado */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 11px; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
  background: var(--bg-sunken); color: var(--text-2);
}
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-err { background: var(--err-soft); color: var(--err); }
.pill-accent { background: var(--accent-soft); color: var(--accent-text); }

.dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; flex: none; }
.dot-live { position: relative; }
.dot-live::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid currentColor; opacity: 0; animation: ring 2.4s var(--ease-out) infinite;
}
@keyframes ring { 0% { transform: scale(0.5); opacity: 0.6; } 80%, 100% { transform: scale(1.4); opacity: 0; } }

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