/* Proyectia by Encriptech — estilos. Mobile first, tema claro/oscuro. */
:root {
  --bg: #F3F6F4; --surface: #FFFFFF; --surface-2: #F7F9F8; --line: #E2E8E5; --line-2: #EEF2F0;
  --text: #15201B; --muted: #5E6B65; --faint: #8A9690;
  --primary: #0F8A6C; --primary-ink: #FFFFFF; --primary-soft: #E2F3EC; --primary-strong: #0A6B53;
  --accent: #E8871E; --plan: #CFE5DC;
  --ok: #1E9E5A; --ok-soft: #E3F5EA; --warn: #C98400; --warn-soft: #FFF4D9;
  --bad: #D64545; --bad-soft: #FDE8E8; --info: #2F6FDE; --info-soft: #E6EEFC; --mute-soft: #EEF1F0;
  --shadow: 0 1px 2px rgba(16, 40, 30, .06), 0 4px 16px rgba(16, 40, 30, .06);
  --radius: 16px; --radius-sm: 10px;
  --tab-h: 68px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1412; --surface: #161E1B; --surface-2: #1B2521; --line: #28342F; --line-2: #212C28;
    --text: #E6EEEA; --muted: #9AA8A1; --faint: #74827B;
    --primary: #2DB58D; --primary-ink: #04140F; --primary-soft: #153A2F; --primary-strong: #5CD1AE;
    --plan: #234A3E; --ok-soft: #12321F; --warn-soft: #3A2E0E; --bad-soft: #3D1A1A; --info-soft: #172846; --mute-soft: #222C28;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1412; --surface: #161E1B; --surface-2: #1B2521; --line: #28342F; --line-2: #212C28;
  --text: #E6EEEA; --muted: #9AA8A1; --faint: #74827B;
  --primary: #2DB58D; --primary-ink: #04140F; --primary-soft: #153A2F; --primary-strong: #5CD1AE;
  --plan: #234A3E; --ok-soft: #12321F; --warn-soft: #3A2E0E; --bad-soft: #3D1A1A; --info-soft: #172846; --mute-soft: #222C28;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i-sm { width: 16px; height: 16px; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.hide { display: none !important; }
@media (max-width: 520px) { .lbl-wide { display: none; } }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Shell ---------- */
.shell { min-height: 100dvh; }
.sidebar { display: none; }
.view { min-width: 0; padding: 16px 16px calc(var(--tab-h) + 28px + env(safe-area-inset-bottom)); max-width: 1180px; margin: 0 auto; outline: none; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding: 6px 8px env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); padding: 6px 0; }
.tabbar a.on { color: var(--primary); font-weight: 600; }
.tabbar a.fab { margin-top: -26px; }
.tabbar a.fab span.b {
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: var(--primary-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 45%, transparent);
  border: 4px solid var(--bg);
}
.tabbar a.fab .i { width: 24px; height: 24px; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); }
  .sidebar {
    display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100dvh;
    padding: 20px 14px; border-right: 1px solid var(--line); background: var(--surface);
  }
  .tabbar { display: none; }
  .view { padding: 28px 32px 48px; width: 100%; }
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.brand span { display: flex; flex-direction: column; line-height: 1.1; }
.brand b { font-size: 18px; letter-spacing: -.01em; }
.brand small { font-size: 11px; color: var(--muted); }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; }
.side-nav a:hover { background: var(--surface-2); color: var(--text); }
.side-nav a.on { background: var(--primary-soft); color: var(--primary-strong); }
.side-cta { justify-content: center; }

/* ---------- Encabezados ---------- */
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.top h1 { font-size: 22px; letter-spacing: -.01em; }
.top .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--surface); border: 1px solid var(--line); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.hello h1 { font-size: 26px; letter-spacing: -.02em; }
.hello h1 em { font-style: normal; color: var(--primary); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 2px 10px; }
.section-title h2 { font-size: 16px; }
.section-title a { font-size: 13px; color: var(--primary); font-weight: 600; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 10px; }
.grid > .card + .card { margin-top: 0; }
.card.flat { box-shadow: none; }
.grid { display: grid; gap: 12px; }
@media (min-width: 640px) { .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 639px) { .g4 { grid-template-columns: repeat(2, 1fr); } }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.kpi .value small { font-size: 14px; font-weight: 600; color: var(--muted); }
.kpi .foot { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-weight: 600; }
.big-delta { font-size: 30px; font-weight: 700; }
.c-ok { color: var(--ok); } .c-warn { color: var(--warn); } .c-bad { color: var(--bad); } .c-info { color: var(--info); }

.actions4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .actions4 { grid-template-columns: repeat(4, 1fr); } }
.action {
  display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 600; cursor: pointer; text-align: left;
}
.action .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-strong); }
.action.main { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.action.main .ic { background: rgba(255,255,255,.18); color: inherit; }
.action small { font-weight: 400; font-size: 12.5px; opacity: .8; display: block; margin-top: 2px; }

/* ---------- Listas ---------- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.li { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-top: 1px solid var(--line-2); cursor: pointer; }
.li:first-child { border-top: 0; }
.li:hover { background: var(--surface-2); }
.li .t { font-weight: 600; font-size: 14.5px; }
.li .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.li .num-badge { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty .i { width: 34px; height: 34px; color: var(--faint); margin-bottom: 6px; }

/* ---------- Chips y estados ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.done { background: var(--primary-soft); color: var(--primary-strong); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.mute { background: var(--mute-soft); color: var(--muted); }
.bg-ok { background: var(--ok); } .bg-warn { background: var(--warn); } .bg-bad { background: var(--bad); } .bg-done { background: var(--primary); } .bg-info { background: var(--info); } .bg-mute { background: var(--faint); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 99px; font-size: 13.5px; font-weight: 600;
  white-space: nowrap; cursor: pointer; color: var(--muted);
}
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .n { opacity: .7; font-weight: 500; margin-left: 4px; }

/* ---------- Progreso ---------- */
.bar { height: 8px; border-radius: 99px; background: var(--line-2); position: relative; overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--primary); }
.bar > b { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text); opacity: .55; border-radius: 2px; }
.pv { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; font-size: 12.5px; }

/* ---------- Botones y formularios ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.btn-primary:hover { background: var(--primary-strong); }
.btn-danger { color: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); outline: none;
}
textarea.input { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px var(--primary-soft); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
input[type=range] { width: 100%; accent-color: var(--primary); height: 32px; }
.seg { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 6px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; cursor: pointer; }
.switch input { width: 44px; height: 26px; accent-color: var(--primary); }

/* ---------- Pestañas ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 10px 12px; font-weight: 600; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--primary); border-color: var(--primary); }

/* ---------- Proyecto (tarjeta) ---------- */
.pcard { display: block; overflow: hidden; padding: 0; }
.pcard .cover { height: 92px; position: relative; display: flex; align-items: flex-end; padding: 12px 14px; color: #fff; }
.pcard .cover h3 { font-size: 17px; text-shadow: 0 1px 6px rgba(0,0,0,.25); }
.pcard .cover .code { position: absolute; top: 10px; left: 14px; font-size: 11.5px; font-weight: 700; opacity: .9; letter-spacing: .05em; }
.pcard .cover .pill { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,.92); }
.pcard .body { padding: 14px; display: grid; gap: 10px; }

/* ---------- Captura por voz ---------- */
.capture { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.capture > * { min-width: 0; }
@media (min-width: 1000px) { .capture { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; } }
.line-nav { display: flex; align-items: center; gap: 8px; }
.line-nav .lbl { flex: 1; text-align: center; font-weight: 700; white-space: nowrap; font-size: 14.5px; }
.ftabs { position: relative; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 2px 4px 4px; }
.ftabs::-webkit-scrollbar { display: none; }
.ftab {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 112px; padding: 9px 12px; cursor: pointer;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-align: left;
}
.ftab b { font-size: 12.5px; }
.ftab small { font-size: 11.5px; color: var(--faint); max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ftab.filled small { color: var(--muted); }
.ftab.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px var(--primary-soft); }
.ftab.on b { color: var(--primary-strong); }
.field-box { min-height: 170px; }
.field-box textarea.input { min-height: 150px; font-size: 16px; }
.heard {
  border-radius: 12px; padding: 10px 12px; background: var(--surface-2); border: 1px dashed var(--line); font-size: 14px; color: var(--muted); min-height: 44px;
}
.heard.live { border-color: var(--primary); color: var(--text); }
.mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0 2px; }
.mic {
  width: 84px; height: 84px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: var(--primary); color: var(--primary-ink); box-shadow: 0 8px 24px color-mix(in srgb, var(--primary) 40%, transparent);
  position: relative; transition: transform .15s;
}
.mic .i { width: 34px; height: 34px; }
.mic:active { transform: scale(.96); }
.mic.on { background: var(--bad); box-shadow: 0 8px 24px color-mix(in srgb, var(--bad) 40%, transparent); }
.mic.on::after {
  content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 3px solid var(--bad); opacity: .5; animation: pulse 1.4s infinite;
}
@keyframes pulse { 0% { transform: scale(.9); opacity: .6; } 100% { transform: scale(1.25); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mic.on::after { animation: none; } }
.mic-state { font-size: 13px; font-weight: 600; color: var(--muted); }
.cmd-help { font-size: 12.5px; color: var(--muted); }
.cmd-help code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-family: inherit; font-size: 12px; color: var(--text); white-space: nowrap; }
.cmd-help p { margin: 6px 0; line-height: 1.9; }
.sticky-mic { position: sticky; bottom: calc(var(--tab-h) + 12px); z-index: 5; }
@media (min-width: 900px) { .sticky-mic { bottom: 16px; } }
.citem { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line-2); cursor: pointer; }
.citem:first-child { border-top: 0; }
.citem.on { background: var(--primary-soft); }
.citem .meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.citem .meta span { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Fotos ---------- */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; cursor: pointer; }
.thumb button .i { width: 14px; height: 14px; }
.thumb input { position: absolute; left: 0; right: 0; bottom: 0; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; padding: 4px 6px; outline: none; }
.thumb input::placeholder { color: rgba(255,255,255,.75); }
.add-photo { aspect-ratio: 1; border-radius: 12px; border: 1.5px dashed var(--line); display: grid; place-items: center; color: var(--muted); cursor: pointer; background: var(--surface); text-align: center; font-size: 12px; font-weight: 600; }
.add-photo .i { width: 26px; height: 26px; margin: 0 auto 4px; display: block; }

/* ---------- Bitácora / feed ---------- */
.feed-item { display: grid; grid-template-columns: 36px 1fr; gap: 12px; padding: 14px; border-top: 1px solid var(--line-2); }
.feed-item:first-child { border-top: 0; }
.feed-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
.feed-ic .i { width: 18px; height: 18px; }
.feed-item .t { font-weight: 600; font-size: 14px; }
.feed-item .s { font-size: 12.5px; color: var(--muted); }
.feed-item p { margin: 6px 0 0; font-size: 14px; white-space: pre-line; }
.feed-photos { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; }
.feed-photos img { width: 96px; height: 76px; object-fit: cover; border-radius: 10px; flex: none; cursor: zoom-in; }

/* ---------- Gantt ---------- */
.gantt-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); max-height: 70vh; }
.gantt { display: grid; position: relative; min-width: max-content; font-size: 12.5px; }
.g-head, .g-row { display: contents; }
.g-name {
  position: sticky; left: 0; z-index: 2; background: var(--surface); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line-2);
  padding: 8px 10px; width: min(44vw, 260px); display: flex; flex-direction: column; justify-content: center; cursor: pointer;
}
.g-name .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-name .s { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-name.group { background: var(--surface-2); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); cursor: default; }
.g-hd { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); }
.g-hd.g-name { z-index: 4; font-weight: 700; color: var(--muted); }
.g-scale { position: relative; height: 44px; }
.g-scale .m { position: absolute; top: 4px; font-size: 11px; font-weight: 700; color: var(--muted); padding-left: 4px; white-space: nowrap; }
.g-scale .w { position: absolute; bottom: 4px; font-size: 10.5px; color: var(--faint); padding-left: 3px; }
.g-track { position: relative; height: 46px; border-bottom: 1px solid var(--line-2); }
.g-track.group { height: 30px; background: var(--surface-2); }
.g-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.g-grid.month { background: var(--line); }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); z-index: 1; pointer-events: none; }
.g-today::before { content: "Hoy"; position: absolute; top: 2px; left: 4px; font-size: 10px; font-weight: 700; color: var(--accent); }
.g-plan { position: absolute; top: 9px; height: 12px; border-radius: 99px; background: var(--plan); }
.g-real { position: absolute; top: 24px; height: 12px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.g-real i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; }
.g-real.ok i { background: var(--ok); } .g-real.risk i { background: var(--warn); } .g-real.late i, .g-real.blocked i { background: var(--bad); }
.g-real.done i, .g-real.verify i { background: var(--primary); } .g-real.todo i { background: var(--faint); }
.g-ghost { position: absolute; top: 24px; height: 12px; border-radius: 99px; border: 1.5px dashed var(--bad); opacity: .7; }
.g-mile { position: absolute; top: 14px; width: 16px; height: 16px; transform: translateX(-8px) rotate(45deg); border-radius: 3px; }
.g-lbl { position: absolute; top: 22px; font-size: 11px; font-weight: 700; white-space: nowrap; padding-left: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 12px; color: var(--muted); margin: 10px 2px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 18px; height: 8px; border-radius: 99px; display: inline-block; }

/* ---------- Curva S ---------- */
.chart svg { width: 100%; height: auto; display: block; }
.chart .ax { stroke: var(--line); }
.chart text { fill: var(--faint); font-size: 10px; }

/* ---------- Hoja inferior (sheet) ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(8, 16, 12, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 640px; max-height: 92dvh; overflow: auto; overflow-x: hidden; background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: .6; } }
@media (min-width: 700px) { .backdrop { align-items: center; } .sheet { border-radius: 22px; } }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 12px; }
.sheet h2 { font-size: 19px; margin-bottom: 4px; }
.sheet .lead { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.sheet-foot { display: flex; gap: 10px; margin-top: 8px; position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); background: var(--surface); padding: 10px 0 4px; }
.sheet-foot .btn { flex: 1; }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.88); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 90dvh; border-radius: 10px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; z-index: 70;
  transition: .2s; pointer-events: none; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { .toast { bottom: 28px; } }

/* ---------- Q&A seguimiento ---------- */
.qa-q { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 12px; }
.qa-q .bot { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-strong); display: grid; place-items: center; flex: none; }
.qa-q .bubble { background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 10px 12px; font-weight: 600; }
.pct-big { font-size: 44px; font-weight: 800; letter-spacing: -.03em; text-align: center; }
.summary { background: var(--primary-soft); border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.summary div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.summary div span:first-child { color: var(--muted); }

/* ---------- Informe (vista previa / impresión) ---------- */
.paper { background: #fff; color: #15201B; border-radius: 6px; padding: 32px; box-shadow: var(--shadow); border: 1px solid var(--line); font-size: 13px; }
.paper h1 { font-size: 22px; margin-bottom: 4px; }
.paper h2 { font-size: 15px; color: #0F8A6C; margin: 18px 0 8px; }
.paper table { width: 100%; border-collapse: collapse; margin: 6px 0 10px; }
.paper th { background: #0F8A6C; color: #fff; text-align: left; font-size: 12px; }
.paper th, .paper td { border: 1px solid #C9D3CE; padding: 5px 7px; vertical-align: top; }
.paper tr:nth-child(even) td { background: #F2F6F4; }
.paper .ph { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.paper .ph figure { margin: 0; text-align: center; font-size: 11px; color: #5E6B65; font-style: italic; }
.paper .ph img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 4px; }
.paper .sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 40px; text-align: center; font-size: 12px; }
.paper .sign div { border-top: 1px solid #333; padding-top: 6px; }
.paper .brandline { display: flex; justify-content: space-between; border-bottom: 2px solid #0F8A6C; padding-bottom: 6px; margin-bottom: 18px; font-size: 11px; color: #5E6B65; }
.paper .brandline b { color: #0F8A6C; letter-spacing: .08em; }
@media (max-width: 600px) { .paper { padding: 16px; font-size: 12px; } .paper .ph { grid-template-columns: 1fr; } }

@media print {
  body { background: #fff; }
  .sidebar, .tabbar, .no-print, .toast, #sheetRoot { display: none !important; }
  .shell { display: block; }
  .view { padding: 0; max-width: none; }
  .paper { box-shadow: none; border: 0; padding: 0; }
  @page { size: A4; margin: 16mm; }
}

/* ---- Acceso y sincronización con el equipo ---- */
.login-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: var(--bg); overflow: auto; }
.login { width: 100%; max-width: 400px; padding: 24px; }
.login .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.login .brand img { width: 40px; height: 40px; border-radius: 10px; }
.login .brand small { display: block; font-size: 11px; color: var(--muted); }
.login h1 { font-size: 22px; margin: 0 0 6px; }
.login p.muted { margin: 0 0 16px; font-size: 14px; }
.login-msg { min-height: 1.3em; color: var(--bad); font-size: 13.5px; margin: 4px 0 10px; }
.sync-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-left: auto; background: var(--faint); flex: none; }
.sync-dot.ok { background: var(--primary); } .sync-dot.wait { background: #E0A100; } .sync-dot.off { background: var(--faint); } .sync-dot.err { background: #D64545; }
.team-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.team-row:first-child { border-top: 0; }
.team-row .t { font-weight: 600; } .team-row .s { font-size: 12.5px; color: var(--muted); }
.team-row.off { opacity: .55; }

/* Asistente de bienvenida: profesión y áreas */
.wz-steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; font-size: 12.5px; color: var(--faint); }
.wz-steps span { padding: 4px 10px; border-radius: 99px; background: var(--surface-2); }
.wz-steps .on { background: var(--primary); color: var(--primary-ink); font-weight: 600; }
.wz-steps .done { color: var(--primary-strong); }
.wz-q { font-size: 18px; margin: 0 0 10px; }
.prof-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 620px) { .prof-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.prof { display: grid; gap: 2px; text-align: left; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.prof:hover { border-color: var(--primary); }
.prof.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.prof .e { font-size: 24px; line-height: 1.2; }
.prof small { color: var(--muted); font-size: 12.5px; }
.chips.wrap { flex-wrap: wrap; }
.chip-x { display: inline-grid; place-items: center; border: 0; background: none; color: inherit; padding: 0; margin-left: 6px; cursor: pointer; opacity: .7; }
.chip-x:hover { opacity: 1; }
.chip-x .i { width: 14px; height: 14px; }
