/* Hilo — prototipo MVP · estilo clínico minimalista */
:root {
  --bg: #f5f7f8;
  --card: #ffffff;
  --ink: #16232b;
  --ink-soft: #5b6b75;
  --accent: #0e7c72;
  --accent-soft: #e2f0ee;
  --rec: #d64550;
  --ok: #2f8a5f;
  --ok-soft: #e4f2ea;
  --warn: #8f6400;
  --warn-soft: #f7efd9;
  --line: #e1e7ea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(22,35,43,.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 520px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; position: relative; }
#view { flex: 1; padding: 20px 16px 96px; }
.hidden { display: none !important; }

h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 650; margin-bottom: 10px; letter-spacing: -0.01em; }
.muted { color: var(--ink-soft); font-size: 14px; }
.small { font-size: 12.5px; }

.icon { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Nav ---------- */
#bottomnav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px;
  display: flex; justify-content: space-around; align-items: center;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  z-index: 40;
}
.navbtn {
  border: 0; background: none; color: var(--ink-soft);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 500; padding: 6px 10px; border-radius: 10px; cursor: pointer;
  letter-spacing: .02em;
}
.navbtn.active { color: var(--accent); font-weight: 600; }
.navrec {
  background: var(--accent); color: #fff; width: 54px; height: 54px; border-radius: 50%;
  margin-top: -24px; box-shadow: 0 3px 12px rgba(14,124,114,.35);
  align-items: center; justify-content: center;
}
.navrec .icon { width: 24px; height: 24px; }

/* ---------- Cards / listas ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.card.tappable { cursor: pointer; transition: border-color .1s ease; }
.card.tappable:hover { border-color: var(--accent); }
.card.tappable:active { transform: scale(.99); }
.row { display: flex; align-items: center; gap: 10px; }
.spread { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 4px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
  letter-spacing: .02em;
}
.chip.gray { background: var(--bg); border: 1px solid var(--line); color: var(--ink-soft); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* ---------- Botones ---------- */
.btn {
  border: 0; border-radius: 10px; padding: 12px 18px; font-size: 14.5px; font-weight: 600;
  cursor: pointer; background: var(--accent); color: #fff; display: inline-flex;
  align-items: center; gap: 8px; justify-content: center;
}
.btn:hover { filter: brightness(1.05); }
.btn.secondary { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.btn.danger { background: transparent; color: var(--rec); border: 1px solid var(--line); }
.btn.wide { width: 100%; }
.btn.smallbtn { padding: 8px 12px; font-size: 13px; border-radius: 9px; }
.btn.smallbtn .icon { width: 16px; height: 16px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- Inicio ---------- */
.hero { text-align: center; padding: 26px 0 16px; }
.hero .logo { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; }
.hero .logo em { color: var(--accent); font-style: normal; }
.bigrec {
  width: 136px; height: 136px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent);
  color: #fff; font-size: 14.5px; font-weight: 600; margin: 20px auto 8px;
  box-shadow: 0 6px 22px rgba(14,124,114,.28);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  transition: transform .08s ease;
}
.bigrec:active { transform: scale(.97); }
.bigrec .icon { width: 32px; height: 32px; }
.quickactions { display: flex; gap: 10px; justify-content: center; margin: 8px 0 22px; }

.searchbar {
  width: 100%; padding: 13px 16px; font-size: 15px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  box-shadow: var(--shadow); outline: none;
}
.searchbar:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.sectiontitle { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 0 10px; }
.containergrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.containercard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 14px; cursor: pointer; box-shadow: var(--shadow);
}
.containercard:hover { border-color: var(--accent); }
.containercard .cname { font-weight: 650; font-size: 14.5px; margin: 7px 0 2px; }

/* ---------- Grabación ---------- */
#overlay {
  position: fixed; inset: 0; background: rgba(13,20,24,.97); z-index: 100;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.recpanel { width: 100%; max-width: 520px; padding: 28px 22px; text-align: center; display: flex; flex-direction: column; height: 100%; }
.rectime { font-size: 42px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 26px; letter-spacing: -0.01em; }
.recstate { color: #f0989e; font-weight: 600; font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; margin-top: 6px; }
.wave { display: flex; gap: 5px; justify-content: center; align-items: center; height: 56px; margin: 22px 0; }
.wave span { width: 5px; border-radius: 3px; background: var(--rec); animation: wv 1s ease-in-out infinite; }
.wave span:nth-child(2) { animation-delay: .15s; } .wave span:nth-child(3) { animation-delay: .3s; }
.wave span:nth-child(4) { animation-delay: .45s; } .wave span:nth-child(5) { animation-delay: .6s; }
.wave span:nth-child(6) { animation-delay: .75s; } .wave span:nth-child(7) { animation-delay: .9s; }
@keyframes wv { 0%,100% { height: 12px; } 50% { height: 48px; } }
@media (prefers-reduced-motion: reduce) { .wave span { animation: none; height: 24px; } }
.livetranscript {
  flex: 1; overflow-y: auto; text-align: left; background: rgba(255,255,255,.06);
  border-radius: var(--radius); padding: 14px 16px; font-size: 15px; line-height: 1.55; margin-bottom: 20px;
  min-height: 120px;
}
.livetranscript .interim { color: #9fadb5; }
.stopbtn {
  width: 82px; height: 82px; border-radius: 50%; border: 3px solid #fff; background: var(--rec);
  margin: 0 auto 10px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.stopbtn .sq { width: 24px; height: 24px; background: #fff; border-radius: 5px; }
.canclink { background: none; border: 0; color: #9fadb5; font-size: 14px; cursor: pointer; padding: 8px; }

/* ---------- Revisión ---------- */
.reviewtranscript {
  width: 100%; min-height: 130px; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; font-size: 15px; line-height: 1.55; font-family: inherit; color: var(--ink);
  background: var(--card); resize: vertical; outline: none;
}
.reviewtranscript:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.selectbox, input.textbox {
  width: 100%; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--card); font-size: 15px; color: var(--ink); outline: none; font-family: inherit;
}
select.selectbox:focus, input.textbox:focus { border-color: var(--accent); }
.tasksuggestion { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tasksuggestion:last-child { border-bottom: 0; }
.tasksuggestion input[type=checkbox] { width: 19px; height: 19px; margin-top: 1px; accent-color: var(--accent); }
.fieldlabel { font-size: 11.5px; font-weight: 650; color: var(--ink-soft); margin: 18px 0 6px; text-transform: uppercase; letter-spacing: .08em; }

/* ---------- Nota / segmentos ---------- */
.segment {
  display: block; padding: 9px 12px; border-radius: 8px; cursor: pointer; line-height: 1.55;
  font-size: 15px; margin-bottom: 2px;
}
.segment:hover { background: var(--accent-soft); }
.segment.playing { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.segment .ts { color: var(--accent); font-size: 12px; font-weight: 700; margin-right: 8px; font-variant-numeric: tabular-nums; }
audio.player { width: 100%; margin: 10px 0 14px; }

/* ---------- Tareas ---------- */
.taskitem { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.taskitem:last-child { border-bottom: 0; }
.taskcheck { width: 20px; height: 20px; accent-color: var(--ok); margin-top: 1px; flex: none; }
.taskitem.done .tasktext { text-decoration: line-through; color: var(--ink-soft); }
.tasktext { font-size: 15px; line-height: 1.45; }
.origenlink { background: none; border: 0; color: var(--accent); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 2px 0; }
.origenlink:hover { text-decoration: underline; }

/* ---------- Buscar ---------- */
.result-snippet { font-size: 14.5px; line-height: 1.5; margin: 6px 0 8px; }
.result-snippet mark { background: var(--warn-soft); color: inherit; border-radius: 3px; padding: 0 2px; }

/* ---------- Header interno ---------- */
.pagehead { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.backbtn { background: var(--card); border: 1px solid var(--line); width: 38px; height: 38px; border-radius: 10px; font-size: 16px; cursor: pointer; flex: none; color: var(--ink); }
.backbtn:hover { border-color: var(--accent); color: var(--accent); }
.timelinedate { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; margin: 18px 0 8px; }

.empty { text-align: center; padding: 36px 24px; color: var(--ink-soft); line-height: 1.6; }

.notice { background: var(--warn-soft); color: #6d5200; border-radius: var(--radius); padding: 10px 14px; font-size: 13.5px; line-height: 1.45; margin-bottom: 14px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10181d; --card: #18222a; --ink: #e7edf0; --ink-soft: #93a4ad;
    --line: #27343c; --accent: #35b0a4; --accent-soft: #143a36;
    --ok-soft: #16352a; --warn-soft: #383010; --warn: #d0a72e;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
  }
  .notice { color: #e5cf7a; }
}

/* ---------- Escritorio ---------- */
#sidebar { display: none; }
.side-logo { font-size: 24px; font-weight: 800; letter-spacing: -.03em; margin: 4px 8px 18px; }
.side-logo em { color: var(--accent); font-style: normal; }
.sidebtn {
  border: 0; background: none; text-align: left; padding: 10px 12px; border-radius: 10px;
  font-size: 14.5px; color: var(--ink-soft); cursor: pointer; font-weight: 550; font-family: inherit;
}
.sidebtn:hover { background: var(--bg); color: var(--ink); }
.sidebtn.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.side-rec { margin-top: auto; }

@media (min-width: 900px) {
  #app { max-width: none; flex-direction: row; }
  #bottomnav { display: none; }
  #sidebar {
    display: flex; flex-direction: column; gap: 4px;
    width: 230px; flex: none; padding: 24px 16px;
    background: var(--card); border-right: 1px solid var(--line);
    position: sticky; top: 0; height: 100vh;
  }
  #view { flex: 1; padding: 32px 44px 60px; max-width: 1200px; margin: 0 auto; }
  .containergrid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Tablero ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 12px; align-items: start; }
@media (max-width: 899px) { .board { grid-template-columns: 1fr; } }
.boardcol { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 160px; }
.boardcol.dragover { border-color: var(--accent); background: var(--accent-soft); }
.boardcolhead { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); padding: 4px 6px 10px; }
.boardcard { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow); }
.boardcard:hover { border-color: var(--accent); }
.boardcard:active { cursor: grabbing; }
.boarddrop { padding: 18px 6px; text-align: center; border: 1px dashed var(--line); border-radius: 10px; }

/* ---------- Pestañas móviles Lista/Tablero/Hoy ---------- */
.mobiletabs { display: flex; gap: 8px; margin-bottom: 14px; }
.mobiletabs button {
  flex: 1; padding: 9px 6px; border: 1px solid var(--line); background: var(--card);
  border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--ink-soft);
  cursor: pointer; font-family: inherit;
}
.mobiletabs button.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
@media (min-width: 900px) { .mobiletabs { display: none; } }

/* ---------- Calendario ---------- */
.calgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.caldow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); text-align: center; padding: 4px 0; }
.calcell {
  min-height: 86px; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 5px 6px; cursor: pointer; overflow: hidden;
}
.calcell:hover { border-color: var(--accent); }
.calcell.out { opacity: .35; }
.calcell.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.calcell.sel { background: var(--accent-soft); }
.calday { font-size: 12px; font-weight: 650; color: var(--ink-soft); margin-bottom: 4px; }
.calcell.today .calday { color: var(--accent); }
.calpill {
  display: block; font-size: 10.5px; font-weight: 600; color: #fff; border-radius: 5px;
  padding: 1px 5px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.calmore { font-size: 10px; color: var(--ink-soft); }
@media (max-width: 640px) {
  .calcell { min-height: 54px; padding: 4px; }
  .calpill { font-size: 0; height: 6px; padding: 0; border-radius: 3px; }
}
/* ---------- Selector de color de hilo ---------- */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.sel { border-color: var(--ink); }
