/* SetterLead — pensado primero para móvil; desde 900px, barra lateral y lista en tabla. */
:root {
  color-scheme: light;
  --bg: #f3f3f0;
  --surface: #ffffff;
  --surface-2: #ebeae5;
  --border: #e5e4df;
  --text: #1a1a18;
  --text-2: #55544e;
  --text-3: #6f6e68;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --accent-soft: #fff1e8;
  --danger: #b42318;
  --series-1: #ea580c;
  --series-2: #16a34a;
  --neutral-bar: #b9b8b1;
  --grid: #ecebe6;
  --shadow: 0 1px 2px rgba(0,0,0,.04);
  --radius: 12px;
  --nav-h: 62px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1b1b1a; --surface-2: #272725; --border: #34342f;
    --text: #f3f3f1; --text-2: #c3c2b7; --text-3: #a09f97;
    --accent: #fb923c; --accent-ink: #1a1a18; --accent-soft: #3b2414; --danger: #f97066;
    --series-1: #f97316; --series-2: #4ade80; --neutral-bar: #5c5b55; --grid: #2a2a27; --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1b1b1a; --surface-2: #272725; --border: #34342f;
  --text: #f3f3f1; --text-2: #c3c2b7; --text-3: #a09f97;
  --accent: #fb923c; --accent-ink: #1a1a18; --accent-soft: #3b2414; --danger: #f97066;
  --series-1: #f97316; --series-2: #4ade80; --neutral-bar: #5c5b55; --grid: #2a2a27; --shadow: none;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  /* shortcut: Inter solo si está instalada; alojar la fuente en el servidor si se quiere igual en todos los equipos. */
  font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; font-weight: 600; }
h1 { font-size: 1.5rem; letter-spacing: -.015em; } h2 { font-size: 1rem; } h3 { font-size: .93rem; color: var(--text-2); }
p { margin: .25rem 0 .75rem; }
.muted { color: var(--text-2); }
.small { font-size: .87rem; }
.hidden { display: none !important; }

/* ---------- formularios (16px en móvil para que iOS no haga zoom) ---------- */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: .55rem .7rem; width: 100%; min-height: 44px; font-size: 16px;
}
input[type="color"] { padding: .2rem; width: 52px; flex: none; }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; flex: none; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 88px; resize: vertical; }
label { display: block; font-size: .87rem; color: var(--text-2); }
label > input:not([type="checkbox"]), label > select, label > textarea { margin-top: .3rem; color: var(--text); }
.check { display: flex; gap: .6rem; align-items: flex-start; color: var(--text); font-size: .95rem; padding: .35rem 0; }
.check small { display: block; color: var(--text-3); font-size: .82rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px; font-weight: 500;
  padding: .5rem .9rem; min-height: 44px; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { min-height: 36px; padding: .25rem .65rem; font-size: .92rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 160px; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: .8rem; }
.form-grid .full { grid-column: 1 / -1; }
@media (min-width: 600px) { .form-grid { grid-template-columns: 1fr 1fr; } }
.error { color: var(--danger); font-size: .9rem; min-height: 1.2em; }
fieldset { border: 1px solid var(--border); border-radius: 10px; padding: .6rem .8rem .8rem; margin: 0; }
legend { font-size: .85rem; color: var(--text-3); padding: 0 .3rem; }

/* ---------- marco: barra arriba y pestañas abajo en móvil; barra lateral desde 900px ---------- */
.side {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .6rem;
  padding: .45rem 16px; min-height: 54px; background: var(--bg);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; letter-spacing: -.02em; font-size: 1.05rem; }
.brand b { color: var(--accent); font-weight: inherit; }
.logo { width: 30px; height: 30px; flex: none; }
.logo path { fill: var(--accent); }
.logo rect { fill: var(--accent-ink); }
.side .word, .side .who { display: none; }
/* 16px en todos los campos: con menos, Safari en iPhone hace zoom al tocarlos. */
.side select { width: auto; max-width: 46vw; min-height: 36px; padding: .2rem .5rem; font-size: 16px; }
.side .proj { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot { margin-left: auto; display: flex; align-items: center; gap: .1rem; flex: none; }
main { max-width: 1100px; margin: 0 auto; padding: 8px 16px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }

nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom));
}
nav.tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none;
  color: var(--text-2); font-size: .75rem; font-weight: 500; padding: .3rem 0; border-radius: 10px;
}
nav.tabs a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
nav.tabs a.active { color: var(--accent); font-weight: 600; }

@media (min-width: 900px) {
  body { font-size: 14px; }
  input, select, textarea { font-size: 14px; min-height: 40px; }
  .btn { min-height: 40px; }
  .app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
  .side { height: 100vh; flex-direction: column; align-items: stretch; gap: 1rem; padding: 16px 6px 10px 14px; }
  .side .brand { padding: 2px 6px; }
  .side .word { display: inline; }
  .side select { width: 100%; max-width: none; min-height: 40px; font-size: 14px; }
  .side .proj { padding: 0 6px; }
  nav.tabs { position: static; flex-direction: column; justify-content: flex-start; gap: 2px; border: 0; padding: 0; background: none; }
  nav.tabs a {
    flex: none; flex-direction: row; gap: .65rem; font-size: 1rem; min-height: 40px; padding: 0 .7rem;
    border: 1px solid transparent; border-radius: 9px;
  }
  nav.tabs a svg { width: 16px; height: 16px; }
  nav.tabs a.active { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: var(--shadow); }
  .side-foot { margin: auto 0 0; padding: .5rem 0 0 6px; border-top: 1px solid var(--border); }
  .side .who { display: block; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
  main {
    max-width: none; margin: 10px 10px 10px 0; padding: 22px 24px 32px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  }
}

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stack > * + * { margin-top: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-bottom: .6rem; }
.section-head h1, .section-head h2 { margin: 0; }

/* ---------- login ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth { width: 100%; max-width: 400px; }
.auth .brand { font-size: 1.6rem; margin-bottom: .4rem; }
.auth .logo { width: 40px; height: 40px; }
.auth form > * + * { margin-top: .8rem; }

/* ---------- pestañas de canal (como las hojas del Excel) ---------- */
/* Con muchos canales la fila se desplaza por dentro en vez de ensanchar la página. */
.segmented { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  flex: 1 0 auto; white-space: nowrap; border: 0; background: transparent; border-radius: 9px; padding: .5rem .7rem; cursor: pointer;
  font-weight: 500; color: var(--text-2); min-height: 40px;
}
.segmented button.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.segmented button .n { font-weight: 500; color: var(--text-3); margin-left: .3rem; font-size: .9em; }
@media (min-width: 900px) {
  .segmented { display: inline-flex; max-width: 100%; }
  .segmented button { flex: none; min-height: 34px; padding: .3rem .8rem; }
}

/* chips de estado: una fila desplazable en móvil */
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: 2px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
@media (min-width: 760px) { .chips { flex-wrap: wrap; margin: 0; padding: 0; overflow: visible; } }
.chip {
  display: inline-flex; align-items: center; gap: .4rem; flex: none;
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: .3rem .8rem;
  cursor: pointer; font-size: .9rem; color: var(--text-2); min-height: 36px;
}
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip b { font-weight: 600; color: var(--text); }
.chip.active b { color: inherit; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--c, transparent); }
.dot.none { background: var(--text-3); }
@media (min-width: 900px) { .chip { min-height: 32px; } }

/* ---------- leads: tarjetas en móvil, filas de tabla desde 900px ---------- */
.lead-list { display: flex; flex-direction: column; }
.lead {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem .75rem; align-items: center;
  padding: .75rem 1rem; border-bottom: 1px solid var(--border); cursor: pointer;
}
.lead:last-child { border-bottom: 0; }
.lead:hover { background: var(--surface-2); }
.lead .name { font-weight: 600; overflow-wrap: anywhere; }
.lead .meta { grid-column: 1 / -1; font-size: .85rem; color: var(--text-2); display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .7rem; }
.lead .obs { grid-column: 1 / -1; font-size: .9rem; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lead .actions { grid-column: 1 / -1; display: flex; gap: .4rem; margin-top: .3rem; }
@media (min-width: 900px) {
  .lead { grid-template-columns: minmax(150px, 1.2fr) minmax(0, 2fr) minmax(0, 1.4fr) 190px auto; gap: 0 1rem; min-height: 56px; padding: .4rem 1rem; }
  .lead > * { grid-row: 1; }
  .lead .name { grid-column: 1; }
  .lead .obs { grid-column: 2; -webkit-line-clamp: 1; }
  .lead .meta { grid-column: 3; }
  .lead .st { grid-column: 4; }
  .lead .actions { grid-column: 5; margin: 0; }
}
/* El estado es una pastilla con el color del estado, igual en la lista, en Hoy y en la ficha. */
.status-select {
  width: auto; max-width: 48vw; min-height: 32px; padding: .1rem 1.6rem .1rem .7rem; font-size: 16px; font-weight: 500;
  border-radius: 999px; background-color: var(--surface);
}
/* Sin color-mix (Safari de iOS 15) la pastilla se queda en blanco con su borde. */
.status-select[style*="--c"] {
  border-color: color-mix(in srgb, var(--c) 35%, var(--surface));
  background-color: color-mix(in srgb, var(--c) 14%, var(--surface));
  color: color-mix(in srgb, var(--c) 50%, var(--text));
}
@media (min-width: 900px) { .status-select { max-width: 100%; min-height: 28px; font-size: 13px; } }
.badge { display: inline-block; padding: .05rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 500; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.late { background: var(--accent-soft); background: color-mix(in srgb, var(--danger) 13%, var(--surface)); color: var(--danger); }
.empty { padding: 2rem 1rem; text-align: center; color: var(--text-3); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .7rem 1rem; border-top: 1px solid var(--border); }
.pager span { font-size: .9rem; color: var(--text-2); }
.list-card { padding: 0; overflow: hidden; }

/* ---------- Hoy ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 760px) { .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; } }
.counter { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.counter .label { font-size: .87rem; color: var(--text-2); min-height: 2.4em; line-height: 1.2; }
.counter .ctl { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: .3rem; margin-top: .3rem; align-items: center; }
.counter .ctl input { text-align: center; font-size: 1.6rem; font-weight: 600; letter-spacing: -.02em; padding: .1rem; min-height: 44px; border-color: transparent; background: transparent; font-variant-numeric: tabular-nums; }
.counter .ctl button { height: 44px; min-height: 44px; padding: 0; font-size: 1.3rem; }
.counter .hint { font-size: .78rem; color: var(--text-3); margin-top: .35rem; min-height: 1.3em; }
.counter.auto { background: var(--bg); }
.version { margin: .9rem 0 0; text-align: center; font-size: .78rem; color: var(--text-3); }
.summary textarea { min-height: 6.5em; border-color: var(--accent); background: var(--accent-soft); }
[hidden] { display: none !important; }
.kpi-edit + .kpi-edit { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--border); }
.kpi-edit select { margin-top: .4rem; }
.counter .hint button { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-size: inherit; font-weight: 600; }
.day-bar { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: .4rem; }
.day-bar input { text-align: center; }
@media (min-width: 900px) { .day-bar { grid-template-columns: 40px 180px 40px; } }
.saved { font-size: .87rem; color: var(--text-3); }

/* ---------- modal: hoja a pantalla completa en móvil ---------- */
dialog {
  border: 0; padding: 0; background: var(--surface); color: var(--text);
  width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0;
}
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog form { display: flex; flex-direction: column; height: 100%; }
dialog .sheet-head { display: flex; align-items: center; gap: .5rem; padding: .7rem 16px; border-bottom: 1px solid var(--border); }
dialog .sheet-head h2 { margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog .sheet-body { flex: 1; overflow-y: auto; padding: 16px; }
dialog .sheet-foot {
  display: flex; gap: .5rem; padding: .7rem 16px calc(.7rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--border);
}
dialog .sheet-foot .grow { flex: 1; }
dialog.ask { width: min(360px, calc(100vw - 32px)); height: fit-content; max-height: calc(100dvh - 32px); margin: auto; padding: 20px 16px 16px;
  border-radius: 16px; border: 1px solid var(--border); }
dialog.ask .ask-text { margin: 0 0 .5rem; font-weight: 600; line-height: 1.4; }
dialog.ask .ask-btns { display: flex; gap: .5rem; margin-top: 1rem; }
dialog.ask .ask-btns .btn { flex: 1; }
@media (min-width: 760px) {
  dialog { width: min(480px, calc(100vw - 32px)); height: fit-content; max-height: calc(100vh - 48px); margin: auto; border-radius: 16px; border: 1px solid var(--border); }
  dialog form { height: auto; max-height: calc(100vh - 48px); }
  /* La ficha del lead se abre como panel lateral, con la lista a la vista. */
  dialog.drawer { width: min(520px, 100vw); height: 100vh; max-height: 100vh; margin: 0 0 0 auto; border-radius: 0; border-width: 0 0 0 1px; }
  dialog.drawer form { height: 100%; max-height: none; }
}
.import-note { background: var(--surface-2); border-radius: 10px; padding: .6rem .8rem; font-size: .87rem; color: var(--text-2); }

/* ---------- Panel ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; text-align: left; box-shadow: var(--shadow); }
.tile.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.tile .label { font-size: .87rem; color: var(--text-2); line-height: 1.2; min-height: 2.4em; }
.tile .value { font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tile .sub { font-size: .8rem; color: var(--text-3); }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 11px; }
.chart .bar { fill: var(--series-1); }
.chart .bar.hover { opacity: .8; }
.chart .hit { fill: transparent; }
.tooltip {
  position: absolute; pointer-events: none; background: var(--text); color: var(--bg); padding: .3rem .55rem;
  border-radius: 6px; font-size: .8rem; white-space: nowrap; transform: translate(-50%, -115%); z-index: 2;
}
.hbars { display: grid; grid-template-columns: minmax(96px, max-content) minmax(0, 1fr) auto; gap: .5rem .7rem; align-items: center; font-size: .93rem; }
.hbars .lab { display: flex; align-items: center; gap: .45rem; }
.hbars .fill { height: 10px; background: var(--c, var(--neutral-bar)); border-radius: 5px; min-width: 2px; }
.hbars .n { font-variant-numeric: tabular-nums; text-align: right; color: var(--text-2); }
.two-col { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 860px) { .two-col { grid-template-columns: 1fr 1fr; } }
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: .55rem .55rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .82rem; color: var(--text-3); font-weight: 500; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.date { white-space: nowrap; }

/* ---------- Ajustes ---------- */
.edit-row { display: flex; gap: .4rem; align-items: center; }
.edit-row + .edit-row { margin-top: .45rem; }
.edit-row input:not([type="color"]):not([type="checkbox"]) { flex: 1; min-width: 0; }
.notice { background: var(--accent-soft); border-radius: 10px; padding: .65rem .85rem; font-size: .93rem; }
.notice code { font-size: 1.05rem; font-weight: 700; user-select: all; }
.member { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .3rem .6rem; padding: .6rem 0; border-bottom: 1px solid var(--border); align-items: center; }
.member .mail { font-size: .85rem; color: var(--text-3); overflow-wrap: anywhere; }
.member .acts { grid-column: 1 / -1; display: flex; gap: .4rem; flex-wrap: wrap; }
.member select { width: auto; min-height: 36px; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: .6rem 1rem; border-radius: 10px; font-size: .93rem; z-index: 50;
  max-width: calc(100vw - 32px);
}
@media (min-width: 900px) { .toast { bottom: 24px; } }
#channels, #pchannels { scroll-margin-top: 70px; }

.label-text { font-size: .87rem; color: var(--text-2); }
.loading { opacity: .55; transition: opacity .15s; }

/* ---------- barra superior: dónde estás y buscador de leads ---------- */
.topbar { display: flex; align-items: center; gap: .8rem; margin-bottom: 12px; }
.crumb { display: none; }
.topbar input { flex: 1; }
/* En el móvil el buscador solo sale en Leads, para no quitar sitio a Hoy. */
@media (max-width: 899px) { .app:not([data-route="leads"]) .topbar { display: none; } }
@media (min-width: 900px) {
  .topbar { margin: -22px -24px 20px; padding: 10px 20px; border-bottom: 1px solid var(--border); }
  .crumb { display: block; flex: 1; color: var(--text-3); }
  .crumb b { color: var(--text); font-weight: 500; }
  .topbar input { flex: 0 1 300px; min-height: 36px; }
}

/* Atajos a las secciones de Ajustes: solo en la barra lateral del ordenador. */
.subnav { display: none; }
@media (min-width: 900px) {
  .subnav { display: flex; flex-direction: column; gap: 1px; }
  .subnav span { font-size: .87rem; color: var(--text-3); padding: 0 .7rem .3rem; }
  .subnav a { display: flex; align-items: center; min-height: 34px; padding: 0 .7rem; border-radius: 9px; color: var(--text-2); text-decoration: none; }
  .subnav a:hover { background: var(--surface-2); }
}
[id^="s-"] { scroll-margin-top: 12px; }

/* ---------- resumen sobre la lista de Leads (solo en ordenador) ---------- */
#leadSub { margin: .15rem 0 0; }
.sum-grid { display: none; }
@media (min-width: 900px) { .sum-grid:not(:empty) { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; } }
.legend { display: flex; flex-wrap: wrap; gap: .2rem 1rem; font-size: .87rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.key { width: 8px; height: 8px; border-radius: 2px; background: var(--series-1); }
.key.s1 { background: var(--series-2); }
.chart .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.s1 { stroke: var(--series-2); }
.chart .area { fill: var(--series-1); opacity: .08; }
.gauge { display: block; width: 100%; max-width: 220px; margin: .4rem auto 0; }
.gauge path { fill: none; stroke-width: 14; stroke-linecap: round; }
.gauge .track { stroke: var(--grid); }
.gauge .value { stroke: var(--series-2); }
.gauge .axis { fill: var(--text-3); font-size: 11px; }
.gauge .big { fill: var(--text); font-size: 30px; font-weight: 600; }
.stats { display: flex; gap: .8rem; margin: .6rem 0; font-size: .87rem; color: var(--text-3); }
.stats div { flex: 1; }
.stats b { display: block; font-size: 1.2rem; font-weight: 600; color: var(--text); }
.stats .late b { color: var(--danger); }

/* ---------- Hoy: cabecera con el día y dos columnas en ordenador ---------- */
.day-head, .day-head select, .day-head .day-bar { flex: 1 1 100%; }
.hoy-cols { display: grid; gap: 14px; }
.day-note { order: -1; }
.day-note h2 label { font: inherit; color: inherit; }
.day-note textarea { min-height: 7rem; }
@media (min-width: 900px) {
  .day-head { flex: 0 1 auto; flex-wrap: nowrap; }
  .day-head select { flex: none; width: auto; }
  .day-head .day-bar { flex: none; }
  .hoy-cols { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
  .day-note { order: 0; }
  .day-note textarea { min-height: 12rem; }
}

/* ---------- ficha: bloque Avance ---------- */
.steps .step { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .7rem; padding: .35rem 0; border-top: 1px solid var(--border); }
.steps .step:first-of-type { border-top: 0; }
.steps .check { flex: 1 1 220px; }
.steps input[type="date"] { width: auto; flex: none; }
.steps input[type="number"] { width: 72px; }
.steps .inline { display: flex; align-items: center; gap: .4rem; }
.steps .inline > input { margin-top: 0; }

/* En Hoy la lista comparte fila con las notas: cada lead va en dos líneas, con el estado y el botón a la derecha. */
@media (min-width: 900px) {
  .hoy-cols .lead { grid-template-columns: minmax(0, 1fr) 190px auto; gap: .1rem 1rem; padding: .6rem 1rem; }
  .hoy-cols .lead .name { grid-column: 1; grid-row: 1; }
  .hoy-cols .lead .meta { grid-column: 1; grid-row: 2; }
  .hoy-cols .lead .obs { grid-column: 1; grid-row: 3; }
  .hoy-cols .lead .st { grid-column: 2; grid-row: 1 / span 3; }
  .hoy-cols .lead .actions { grid-column: 3; grid-row: 1 / span 3; }
}
