/* Comerciales — estilos de la app */
:root {
  --bg: #f6f3ee;
  --card: #ffffff;
  --card-2: #fbf9f6;
  --ink: #1b1d22;
  --muted: #6c6f77;
  --faint: #a3a39e;
  --line: #e6e0d6;
  --accent: #d9472b;
  --accent-ink: #ffffff;
  --accent-soft: #fbe5dd;
  --teal: #1f6f6b;
  --teal-soft: #dcefec;
  --amber: #b7791f;
  --amber-soft: #fbefd9;
  --danger: #c0352b;
  --ok: #2f7d4f;
  --shadow: 0 1px 2px rgba(30, 25, 15, .05), 0 4px 16px rgba(30, 25, 15, .05);
  --radius: 16px;
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --tabbar: 64px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181d;
    --card: #1f2229;
    --card-2: #1b1e24;
    --ink: #eceae6;
    --muted: #9b9ea6;
    --faint: #6b6e76;
    --line: #2d3039;
    --accent: #f0623f;
    --accent-soft: #3a2420;
    --teal: #4fb3ac;
    --teal-soft: #1d3331;
    --amber: #e0a74a;
    --amber-soft: #3a2f1c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
.hidden { display: none !important; }

/* ---------- estructura ---------- */
#app { min-height: 100vh; }
.boot { display: grid; place-items: center; height: 100vh; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.view {
  max-width: 680px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) 18px calc(var(--tabbar) + env(safe-area-inset-bottom) + 32px);
}
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.top h1 { font-family: var(--serif); font-size: 30px; letter-spacing: -.01em; line-height: 1.1; }
.eyebrow { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 4px; font-weight: 600; }
.back svg { width: 18px; height: 18px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 500; margin-bottom: 10px; background: none; border: 0; padding: 0; cursor: pointer; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
  color: #fff; flex: none;
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }

/* ---------- barra inferior ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10.5px; font-weight: 600; color: var(--faint); padding: 6px 0;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.on { color: var(--ink); }
.tabbar .mic {
  justify-self: center; width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); border: 0;
  display: grid; place-items: center; margin-top: -18px;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent);
  cursor: pointer;
}
.tabbar .mic svg { width: 26px; height: 26px; }

/* ---------- tarjetas y listas ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px;
}
.section { margin: 26px 0 10px; display: flex; align-items: baseline; justify-content: space-between; }
.section h2 { font-family: var(--serif); font-size: 20px; }
.section a, .link { color: var(--accent); font-size: 14px; font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; }

.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.item {
  display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px;
  border-bottom: 1px solid var(--line); cursor: pointer; width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0;
}
.item:last-child { border-bottom: 0; }
.item:active { background: var(--card-2); }
.item .main { flex: 1; min-width: 0; }
.item .t { font-weight: 600; }
.item .s { color: var(--muted); font-size: 14px; }
.item .x { color: var(--muted); font-size: 14px; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .r { color: var(--faint); font-size: 13px; white-space: nowrap; }
.chev { color: var(--faint); align-self: center; }
.empty { color: var(--muted); text-align: center; padding: 26px 16px; font-size: 15px; }

.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 14px; }
.meta span { display: inline-flex; align-items: center; gap: 5px; }
.meta svg { width: 15px; height: 15px; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--card-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap;
}
.pill.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill.teal { background: var(--teal-soft); color: var(--teal); border-color: transparent; }
.pill.amber { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.pill.danger { background: var(--accent-soft); color: var(--danger); border-color: transparent; }

/* ---------- inicio ---------- */
.rec-hero {
  width: 100%; border: 0; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 16px;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 20px; padding: 20px;
  box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 30%, transparent);
}
.rec-hero .dot { width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; flex: none; }
.rec-hero .dot svg { width: 28px; height: 28px; }
.rec-hero b { display: block; font-size: 19px; }
.rec-hero small { opacity: .85; font-size: 14px; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }

.banner {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--amber-soft); color: var(--amber); font-size: 14px; font-weight: 500; margin: 12px 0;
}
.banner.teal { background: var(--teal-soft); color: var(--teal); }
.banner.danger { background: var(--accent-soft); color: var(--danger); }

.team-today { display: grid; gap: 8px; }
.who { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 14px; padding: 11px 14px; box-shadow: var(--shadow); }
.who .main { flex: 1; min-width: 0; }
.who .t { font-weight: 600; }
.who .s { font-size: 14px; color: var(--muted); }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 12px; padding: 11px 16px; font-weight: 600; font-size: 15px; cursor: pointer;
}
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .5; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }

/* ---------- formularios ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.input, .field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); background: var(--card-2);
  border-radius: 12px; padding: 12px 13px; font-size: 16px; outline: none;
  -webkit-appearance: none; appearance: none;
}
.field textarea { min-height: 96px; resize: vertical; }
.field textarea.tall { min-height: 260px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); background: var(--card); }
.field small { display: block; color: var(--faint); font-size: 12.5px; margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.search { position: relative; margin-bottom: 12px; }
.search input { padding-left: 38px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 7px 13px; border-radius: 999px; font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer;
}
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; margin-bottom: 14px; }
.seg button { border: 0; background: none; padding: 8px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- hoja (formularios y avisos) ---------- */
.sheet-bg {
  position: fixed; inset: 0; z-index: 50; background: rgba(15, 12, 8, .38);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease;
}
.sheet {
  width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  background: var(--bg); border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
  animation: up .24s cubic-bezier(.2, .9, .3, 1);
}
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h3 { font-family: var(--serif); font-size: 22px; margin-bottom: 16px; }
.sheet .foot { display: flex; gap: 8px; margin-top: 6px; }
.sheet .foot .btn { flex: 1; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- grabadora ---------- */
.recorder {
  position: fixed; inset: 0; z-index: 60; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 20px) 24px calc(env(safe-area-inset-bottom) + 30px);
  text-align: center;
}
.recorder .who-for { color: var(--muted); font-size: 15px; }
.recorder .clock { font-family: var(--serif); font-size: 64px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.recorder .hint { color: var(--muted); max-width: 320px; margin: 10px auto 0; font-size: 15px; }
.recorder .state { font-weight: 600; color: var(--accent); display: inline-flex; align-items: center; gap: 8px; }
.recorder .state::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite; }
.recorder .state.paused { color: var(--muted); }
.recorder .state.paused::before { background: var(--muted); animation: none; }
@keyframes blink { 50% { opacity: .25; } }
.wave { display: flex; align-items: center; justify-content: center; gap: 4px; height: 90px; width: min(320px, 80vw); margin: 0 auto; }
.wave i { display: block; flex: none; width: 5px; border-radius: 3px; background: var(--accent); height: 6px; transition: height .08s linear; opacity: .85; }
.rec-controls { display: flex; align-items: center; justify-content: center; gap: 28px; }
.round {
  width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--line); background: var(--card);
  display: grid; place-items: center; cursor: pointer; color: var(--ink);
}
.round svg { width: 26px; height: 26px; }
.round.big { width: 84px; height: 84px; background: var(--accent); border-color: var(--accent); color: #fff; }
.round.big svg { width: 34px; height: 34px; }
.round-label { font-size: 12px; color: var(--muted); margin-top: 6px; }
.rec-controls > div { display: flex; flex-direction: column; align-items: center; }
.review audio { width: 100%; margin: 16px 0; }

/* ---------- nota ---------- */
.note-head h1 { font-family: var(--serif); font-size: 26px; line-height: 1.15; margin: 6px 0 10px; }
.client-link { font-weight: 700; color: var(--accent); font-size: 15px; }
.md h4 { font-family: var(--serif); font-size: 17px; margin: 16px 0 6px; }
.md h4:first-child { margin-top: 0; }
.md ul { margin: 0 0 8px; padding-left: 20px; }
.md li { margin: 4px 0; }
.md p { margin: 0 0 8px; }
.md .cite { color: var(--accent); font-weight: 600; font-size: 13px; }
.transcript { white-space: pre-wrap; color: var(--muted); font-size: 15px; }
details > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: "Mostrar"; color: var(--accent); font-size: 14px; }
details[open] > summary::after { content: "Ocultar"; }
audio { width: 100%; }
.status-box { display: flex; gap: 12px; align-items: center; }

/* ---------- tareas ---------- */
.task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.check {
  width: 24px; height: 24px; flex: none; border-radius: 50%; border: 2px solid var(--faint);
  background: none; cursor: pointer; display: grid; place-items: center; margin-top: 1px; padding: 0; color: #fff;
}
.check svg { width: 14px; height: 14px; opacity: 0; }
.task.done .check { background: var(--ok); border-color: var(--ok); }
.task.done .check svg { opacity: 1; }
.task.done .tt { text-decoration: line-through; color: var(--faint); }
.task .main { flex: 1; min-width: 0; cursor: pointer; }
.task .tm { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

/* ---------- calendario ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.month-nav h2 { font-family: var(--serif); font-size: 20px; }
.month-nav .btn { padding: 7px 11px; }
.planner { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.planner-inner { display: grid; min-width: max-content; }
.pl-row { display: grid; border-bottom: 1px solid var(--line); }
.pl-row:last-child { border-bottom: 0; }
.pl-name {
  position: sticky; left: 0; z-index: 2; background: var(--card);
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13px; font-weight: 600;
  border-right: 1px solid var(--line);
}
.pl-days { display: grid; grid-auto-flow: row dense; grid-auto-rows: 30px; row-gap: 4px; padding: 6px 0; position: relative; min-height: 46px; }
.pl-head .pl-days { grid-auto-rows: auto; padding: 6px 0; min-height: 0; }
.pl-day { text-align: center; font-size: 11px; color: var(--muted); line-height: 1.2; }
.pl-day b { display: block; font-size: 13px; color: var(--ink); }
.pl-day.we { color: var(--faint); }
.pl-day.today b { background: var(--accent); color: #fff; border-radius: 50%; width: 22px; height: 22px; line-height: 22px; margin: 0 auto; }
.pl-bg { position: absolute; inset: 0; display: grid; pointer-events: none; }
.pl-bg i.we { background: color-mix(in srgb, var(--line) 35%, transparent); }
.pl-bg i.today { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.bar {
  position: relative; z-index: 1; margin: 0 2px; border-radius: 8px; padding: 0 8px;
  font-size: 12px; font-weight: 600; color: #fff; line-height: 30px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border: 0; text-align: left;
}
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); margin: 10px 2px 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- contactos ---------- */
.contact-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ---------- login ---------- */
.login { max-width: 380px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 12vh) 22px 40px; }
.login .logo { width: 64px; height: 64px; border-radius: 18px; background: var(--accent); color: #fff; display: grid; place-items: center; margin-bottom: 18px; }
.login .logo svg { width: 32px; height: 32px; }
.login h1 { font-family: var(--serif); font-size: 32px; margin-bottom: 6px; }
.login p { color: var(--muted); margin: 0 0 26px; }
.error { color: var(--danger); font-size: 14px; margin: -4px 0 12px; }

/* ---------- avisos ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 16px);
  transform: translateX(-50%); z-index: 80; max-width: calc(100% - 32px);
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px;
  font-size: 14.5px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  animation: up .2s ease;
}
.toast.err { background: var(--danger); color: #fff; }

.ask-answer { margin-top: 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.mt { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; min-width: 0; }
