:root {
  --bg: #0F0E0C;
  --surface: #1A1815;
  --raised: #24211D;
  --line: #34302A;
  --text: #EDE3CF;
  --muted: #A89F8E;
  --blue: #3D9BE0;
  --blue-ink: #0078BF;
  --red: #FF4C3B;
  --kraft: #EADBC0;
  --kraft-ink: #2A241B;
  --ok: #8CC084;
  --display: "Jost", "Segoe UI", system-ui, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--display);
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.muted { color: var(--muted); }
.pad { padding: 16px; }
.small { font-size: 13px; }

.shell { display: grid; grid-template-columns: 1fr; min-height: 100%; }
.side { display: none; }
.main { min-width: 0; padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
}
.logo { font-weight: 700; letter-spacing: .02em; font-size: 20px; }
.logo b { color: var(--red); }
.top h1 { font-size: 15px; font-weight: 500; margin: 0; color: var(--muted); }
.view { padding: 16px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); max-width: 920px; display: flex; flex-direction: column; gap: 18px; }

.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr 1fr auto 1fr 1fr 1fr; align-items: end;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
}
.bottom button, .side button {
  border: 0; background: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 12px; padding: 6px 2px; border-radius: 10px; position: relative;
}
.bottom button[aria-current="page"], .side button[aria-current="page"] { color: var(--text); }
.bottom button[aria-current="page"] .ico, .side button[aria-current="page"] .ico { color: var(--red); }
.ico { font-size: 18px; line-height: 1; font-weight: 600; }
.bottom .add {
  background: var(--red); color: var(--bg); width: 54px; height: 54px; border-radius: 50%;
  justify-self: center; font-size: 28px; font-weight: 500; margin-bottom: 4px;
}
.bottom > button { font-size: 11px; white-space: nowrap; }
.center { display: flex; gap: 8px; padding: 0 4px; align-items: end; }
.mic, .bottom .mic, .side .mic {
  width: 54px; height: 54px; border-radius: 50%; margin-bottom: 4px; border: 0;
  background: var(--kraft); color: var(--kraft-ink);
  display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; cursor: pointer;
}
.mic.on, .bottom .mic.on, .side .mic.on { background: var(--red); color: var(--bg); }
.rec-time { font-variant-numeric: tabular-nums; font-size: 14px; }
@media (prefers-reduced-motion: no-preference) { .mic.on { animation: latido 1.2s ease-in-out infinite; } }
@keyframes latido { 50% { box-shadow: 0 0 0 8px rgba(255, 76, 59, .25); } }
.count { position: absolute; top: 0; right: 18%; background: var(--red); color: var(--bg); font-size: 11px; border-radius: 99px; padding: 0 6px; font-weight: 600; }

@media (min-width: 900px) {
  .shell { grid-template-columns: 220px minmax(0, 1fr); }
  .side { display: flex; flex-direction: column; gap: 4px; padding: 20px 12px; border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; }
  .side .logo { padding: 0 10px 16px; }
  .side button { flex-direction: row; justify-content: flex-start; gap: 10px; font-size: 15px; padding: 9px 10px; }
  .side button[aria-current="page"] { background: var(--surface); }
  .side .count { position: static; margin-left: auto; }
  .side .mic.wide { width: auto; height: auto; border-radius: 10px; padding: 9px 10px; margin: 6px 0 0; font-size: 15px; }
  .side .mic.wide svg { width: 18px; height: 18px; }
  .side .add { margin-top: 12px; background: var(--red); color: var(--bg); justify-content: center; font-weight: 600; }
  .side .me { margin-top: auto; font-size: 13px; color: var(--muted); padding: 10px; }
  .bottom { display: none; }
  .top .logo { display: none; }
  .main { padding-bottom: 24px; }
}

h2 { font-size: 22px; margin: 0; font-weight: 600; letter-spacing: -.01em; text-wrap: balance; }
h3 { font-size: 13px; margin: 0; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.section { display: flex; flex-direction: column; gap: 8px; }
.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.row { display: flex; gap: 12px; align-items: flex-start; padding: 11px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 3px; }
.row .title { font-weight: 500; }
.row .body { font-family: var(--serif); white-space: pre-wrap; overflow-wrap: anywhere; }
.when { font-variant-numeric: tabular-nums; min-width: 76px; font-size: 13px; color: var(--muted); }
.when b { display: block; color: var(--text); font-weight: 600; font-size: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; border: 1px solid var(--line); border-radius: 99px; padding: 1px 9px; color: var(--muted); white-space: nowrap; }
.chip.red { border-color: transparent; background: rgba(255, 76, 59, .16); color: #FF8A7E; }
.chip.blue { border-color: transparent; background: rgba(61, 155, 224, .16); color: #8CC4EE; }
.chip.kraft { border-color: transparent; background: var(--kraft); color: var(--kraft-ink); }
.chip.ok { border-color: transparent; background: rgba(140, 192, 132, .16); color: var(--ok); }
.empty { color: var(--muted); padding: 12px 14px; }
.state { flex: none; min-width: 96px; border-radius: 99px; padding: 5px 10px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); background: none; color: var(--muted); }
.state.st-en_proceso { background: rgba(61, 155, 224, .18); border-color: transparent; color: #8CC4EE; }
.state.st-terminada { background: rgba(140, 192, 132, .18); border-color: transparent; color: var(--ok); }
.form-inline { align-items: flex-end; gap: 10px; }
.form-inline .field { flex: 1 1 150px; }

.btn { border: 1px solid var(--line); background: var(--raised); border-radius: 10px; padding: 7px 12px; font-size: 14px; }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }
.btn.red { background: var(--red); color: var(--bg); border-color: var(--red); font-weight: 600; }
.btn.ghost { background: none; }
.btn.tiny { padding: 2px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 12px; color: var(--muted); }
input[type="text"], input[type="url"], input[type="date"], input[type="time"], input[type="email"], select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
}
input[type="file"] { width: 100%; max-width: 100%; min-width: 0; font-size: 13px; color: var(--muted); }
input[type="file"]::file-selector-button { font: inherit; border: 1px solid var(--line); background: var(--raised); color: var(--text); border-radius: 8px; padding: 6px 10px; margin-right: 8px; }
textarea { resize: vertical; min-height: 84px; font-family: var(--serif); }
.form { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.form .wide { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: center; }
.check input { accent-color: var(--red); width: 18px; height: 18px; }

.cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card { text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.card h4 { margin: 0; font-size: 16px; font-weight: 600; }
.card.quiet { border-style: dashed; }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--text); border-color: var(--red); }

.brief { background: var(--kraft); color: var(--kraft-ink); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.brief p { margin: 0; font-family: var(--serif); }
.brief .date { font-family: var(--display); font-weight: 600; }
.brief .date::first-letter { text-transform: uppercase; }

.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--surface); width: 100%; max-width: 640px; border-radius: 18px 18px 0 0; border: 1px solid var(--line);
  padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 12px; max-height: 92vh; overflow: auto;
}
@media (min-width: 900px) { .sheet-bg { align-items: center; } .sheet { border-radius: 18px; } }
.capbtns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.capbtns button, .capbtns label { border: 1px solid var(--line); background: var(--raised); border-radius: 12px; padding: 12px 6px; text-align: center; font-size: 14px; cursor: pointer; }
.capbtns .rec { background: var(--red); color: var(--bg); border-color: var(--red); font-weight: 600; }
.capbtns input { display: none; }
.preview { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.preview img { max-width: 120px; max-height: 120px; border-radius: 8px; }
audio { width: 100%; max-width: 360px; height: 36px; }
.transcript { border-left: 2px solid var(--blue); padding-left: 10px; color: var(--text); }
.thumb { max-width: 220px; max-height: 220px; border-radius: 8px; display: block; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom, 0px)); background: var(--kraft); color: var(--kraft-ink); padding: 9px 14px; border-radius: 10px; z-index: 30; font-weight: 500; max-width: calc(100% - 32px); }
@media (min-width: 900px) { .toast { bottom: 24px; } }
.draft { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; font-family: var(--serif); font-size: 17px; line-height: 1.65; max-width: 72ch; overflow-wrap: anywhere; }
.draft h2, .draft h3, .draft h4 { font-family: var(--display); margin: 1.2em 0 .4em; color: var(--text); text-transform: none; letter-spacing: 0; }
.draft h2 { font-size: 24px; } .draft h3 { font-size: 19px; } .draft h4 { font-size: 16px; }
.draft p { margin: 0 0 .9em; }
.draft blockquote { margin: 0 0 1em; padding: 10px 14px; border-left: 3px solid var(--red); background: var(--raised); border-radius: 0; font-size: 15px; color: var(--muted); }
.draft blockquote p:last-child { margin: 0; }
.draft hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }
.draft ul, .draft ol { padding-left: 1.3em; margin: 0 0 1em; }
.tablewrap { overflow-x: auto; margin: 0 0 1em; }
.draft table { border-collapse: collapse; font-family: var(--display); font-size: 14px; }
.draft th, .draft td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.demo-banner { border: 1px dashed var(--red); border-radius: 12px; padding: 10px 14px; font-size: 14px; color: var(--text); background: rgba(255, 76, 59, .08); }
.notice { border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; color: var(--muted); }
.login { max-width: 420px; margin: 18vh auto 0; padding: 24px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
