:root {
  --paper: #EEF0FB;
  --surface: #FFFFFF;
  --ink: #1A1F5C;
  --muted: #5B618F;
  --line: #CBD0EE;
  --cobalt: #2F45FF;
  --cobalt-ink: #FFFFFF;
  --signal: #FF4F7B;
  --radius: 22px;
  /* movimiento: feedback propio < 100ms, cambios de estado ~200ms, paneles ~300ms */
  --d-fast: 110ms;
  --d-base: 200ms;
  --d-slow: 300ms;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --font: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12153A;
    --surface: #1C2052;
    --ink: #E7E9FF;
    --muted: #A3A8D6;
    --line: #333A7E;
    --cobalt: #8E9BFF;
    --cobalt-ink: #10133A;
    --signal: #FF7A9A;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-optical-sizing: auto;
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- botones ---------- */
.btn {
  appearance: none; border: 0; border-radius: 999px; cursor: pointer;
  padding: .7em 1.3em; font-weight: 650; letter-spacing: -.005em;
  background: var(--cobalt); color: var(--cobalt-ink);
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  text-decoration: none; white-space: nowrap; flex: none; transition: transform var(--d-fast) var(--ease-out), opacity var(--d-fast) ease;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.small { padding: .45em .95em; font-size: 15px; }
.icon-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ink);
}
.icon-btn:hover { background: color-mix(in srgb, var(--line) 45%, transparent); }

/* ---------- nota de voz ---------- */
.mic {
  appearance: none; border: 0; cursor: pointer; flex: none;
  width: 46px; height: 46px; border-radius: 999px; display: grid; place-items: center;
  background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line);
  transition: background var(--d-fast) ease, color var(--d-fast) ease, transform var(--d-fast) var(--ease-out);
}
.mic.small { width: 38px; height: 38px; }
.mic:hover { box-shadow: inset 0 0 0 1.5px var(--cobalt); }
.mic:active { transform: scale(.94); }
.mic[data-state="rec"] { background: var(--signal); color: #fff; box-shadow: none; animation: rec 1.4s ease-out infinite; }
.mic[data-state="rec"] svg { fill: currentColor; }
.mic[data-state="busy"] { cursor: progress; opacity: 1; }
.mic[data-state="busy"] svg { animation: spin .9s linear infinite; }
.voice-live { color: var(--signal) !important; font-weight: 650; font-variant-numeric: tabular-nums; }
.stub-actions { display: flex; align-items: center; gap: 8px; flex: none; }
@keyframes rec { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--signal) 45%, transparent); } 80%, 100% { box-shadow: 0 0 0 10px transparent; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .mic[data-state="rec"], .mic[data-state="busy"] svg { animation: none; } }

/* ---------- el ticket: la tool como algo que se entrega ---------- */
.ticket {
  --notch: 13px;
  --cut: calc(100% - var(--stub, 66px));
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  -webkit-mask:
    radial-gradient(circle var(--notch) at 0 var(--cut), #0000 97%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% var(--cut), #0000 97%, #000) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle var(--notch) at 0 var(--cut), #0000 97%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% var(--cut), #0000 97%, #000) right / 51% 100% no-repeat;
}
.ticket .perf {
  position: absolute; left: calc(var(--notch) + 8px); right: calc(var(--notch) + 8px); top: var(--cut);
  border-top: 2px dashed var(--line);
}
.ticket .stub {
  height: var(--stub, 66px); padding: 0 14px 0 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  appearance: none; border: 0; cursor: pointer; text-align: left; text-decoration: none;
  background: var(--surface); color: var(--ink); border-radius: 14px;
  padding: .55em .9em; font-size: 15px; line-height: 1.35; max-width: 100%;
}
.chip:hover { box-shadow: inset 0 0 0 1.5px var(--cobalt); }
.sheet .chip { background: var(--paper); }

/* ---------- hojas (dialog) ---------- */
dialog.sheet {
  border: 0; padding: 0; color: var(--ink); background: var(--surface);
  width: min(560px, 100%); max-height: 88vh; max-width: 100%;
  margin: auto auto 0; border-radius: var(--radius) var(--radius) 0 0;
}
dialog.sheet::backdrop { background: rgb(10 12 40 / .45); }
@media (min-width: 720px) { dialog.sheet { margin: auto; border-radius: var(--radius); } }
.sheet-body { padding: 22px 22px calc(22px + env(safe-area-inset-bottom)); }
.sheet h2 { font-size: 22px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.01em; }
.sheet h3 { font-size: 17px; margin: 22px 0 8px; }
.sheet p { margin: 0 0 12px; color: var(--muted); }
.field {
  width: 100%; border: 1.5px solid var(--line); background: var(--paper); border-radius: 14px;
  padding: .7em .9em; resize: vertical;
}
.field:focus { border-color: var(--cobalt); outline: none; }
.row { display: flex; gap: 8px; align-items: center; }
.row .field { flex: 1; min-width: 0; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--paper); padding: .6em 1.1em; border-radius: 999px; font-weight: 600; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity var(--d-base) ease, transform var(--d-base) var(--ease-out); z-index: 50; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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

/* ---------- marca e iconos ---------- */
.logo-mark { width: 30px; height: 30px; border-radius: 9px; display: block; flex: none; }
.ico { display: block; flex: none; }

/* ---------- contador en vivo ---------- */
.live-counter {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.live-counter b { color: var(--ink); font-weight: 700; display: inline-block; }
.live-counter b.bump { animation: bump 700ms var(--ease-out); }
.live-counter .sep { opacity: .5; }
.live-counter .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.live-counter .dot.on { background: #18B26B; box-shadow: 0 0 0 0 rgb(24 178 107 / .5); animation: beat 1.8s ease-out infinite; }
@keyframes bump { 0% { transform: translateY(-4px); color: var(--cobalt); } 100% { transform: none; } }
@keyframes beat { 0% { box-shadow: 0 0 0 0 rgb(24 178 107 / .45); } 80%, 100% { box-shadow: 0 0 0 8px rgb(24 178 107 / 0); } }

/* ---------- cards de tools (galería) ---------- */
.tcard {
  appearance: none; border: 0; cursor: pointer; text-align: left; color: var(--ink);
  background: var(--surface); border-radius: 18px; padding: 14px; width: 100%;
  display: grid; grid-template-rows: auto 1fr auto; gap: 10px; min-height: 148px;
  transition: transform var(--d-fast) var(--ease-out), box-shadow var(--d-base) ease;
}
.tcard:hover { box-shadow: inset 0 0 0 1.5px var(--cobalt); }
.tcard:active { transform: scale(.98); }
.tcard-ico {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--cobalt) 12%, transparent); color: var(--cobalt);
}
.tcard-ico.big { width: 56px; height: 56px; border-radius: 16px; }
.tcard-title { font-weight: 650; font-size: 16px; line-height: 1.25; letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tcard-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 12px; line-height: 1; padding: 5px 8px; border-radius: 999px; background: var(--paper); color: var(--muted); font-weight: 600; }
.tcard.gone .tcard-ico { background: var(--paper); color: var(--muted); }
.tcard.fresh { animation: fresh 1.6s var(--ease-out); }
@keyframes fresh { 0% { box-shadow: inset 0 0 0 2px var(--signal); transform: translateY(-6px); } 100% { box-shadow: inset 0 0 0 0 transparent; transform: none; } }
.idea-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.idea-sheet .tcard-tags { margin-top: 4px; }
.idea-status { font-size: 14px; margin: 12px 0 0 !important; }

/* ---------- marquesina de ideas: minimalista, se pausa al tocar ---------- */
.marquee { overflow: hidden; margin: 0 -20px; padding: 4px 0; -webkit-mask-image: linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent); mask-image: linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent); }
.marquee-track { display: flex; gap: 10px; width: max-content; padding: 0 20px; animation: slide var(--marquee-s, 60s) linear infinite; }
.marquee:hover .marquee-track, .marquee:focus-within .marquee-track { animation-play-state: paused; }
.marquee .tcard { width: 200px; min-height: 140px; }
@keyframes slide { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .marquee { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
  .marquee-track { animation: none; }
}
