/* Calendario de campañas v2: estilos (PLAN §11, docs/DISENO.md).
   Lo memorable es la tira de la portada; el resto, callado. Borrador = a lápiz (rayado y discontinuo), validada = a
   tinta (liso con canto de color). Nunca el color solo: cada barra lleva su estado y su choque en palabra.
   Lo del móvil cuelga de html[data-layout="mobile"] (lo pone app.js: anchura de 760 px o menos, o «Sitio para
   ordenador»), no de @media: con «Sitio para ordenador» la consulta de anchura diría «ordenador». */

@font-face { font-family: "Space Grotesk"; font-weight: 400; font-display: swap; src: url(/fonts/SpaceGrotesk-Regular.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 500; font-display: swap; src: url(/fonts/SpaceGrotesk-Medium.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 600; font-display: swap; src: url(/fonts/SpaceGrotesk-SemiBold.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 700; font-display: swap; src: url(/fonts/SpaceGrotesk-Bold.woff2) format("woff2"); }
@font-face { font-family: "Aeion Mono"; font-weight: 400; font-display: swap; src: url(/fonts/AeionMono-Regular.woff2) format("woff2"); }

:root {
  color-scheme: light;
  --paper: #f2effb;
  --surface: #ffffff;
  --ink: #1d1630;
  --grey: #5d5a6b;
  --line: #ddd7ee;
  --line-strong: #c4bcdc;
  --purple: #6b38fb;
  --on-purple: #ffffff;
  --lime: #dcfe42;
  --on-lime: #1d1630;
  --week-band: #dcfe42;
  --on-week: #1d1630;
  --magenta: #c4146f; /* texto: #f52c98 no da AA sobre blanco; se usa de fondo y en el borde */
  --magenta-fill: #f52c98;
  --red: #c0392b;
  --amber: #b7791f;
  --amber-text: #8a5a12;
  --green: #2e7d4f;
  --t-vertical: #2a78d6;
  --t-marca: #eb6834;
  --t-general: #1baf7a;
  --t-agencia: #eda100;
  --t-estacional: #e87ba4;
  --backdrop: rgba(29, 22, 48, 0.32);
  --toast: #1d1630;
  --on-toast: #f4f1fa;
  --moment: rgba(29, 22, 48, 0.07);
  --sel: rgba(107, 56, 251, 0.14);

  --f-13: 13px; --f-15: 15px; --f-17: 17px; --f-20: 20px; --f-26: 26px; --f-34: 34px;
  --r-bar: 4px; --r-ctl: 10px; --r-box: 16px;
  --gutter: 32px;
  --label-w: 96px;
  --bar-h: 34px;
  --target: 40px;
  --top-h: 64px;
  --day-head: 30px;
  --font: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Aeion Mono", ui-monospace, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #0d0a16;
    --surface: #17131f;
    --ink: #f4f1fa;
    --grey: #b9b3c6;
    --line: #2c2639;
    --line-strong: #453d57;
    --purple: #a78bff;
    --on-purple: #0d0a16;
    --magenta: #ff6bb8;
    --week-band: rgba(220, 254, 66, 0.16); /* en oscuro, la banda lima pleno deslumbra: tenue, con su canto pleno */
    --on-week: #dcfe42;
    --magenta-fill: #f52c98;
    --red: #ff7a6b;
    --amber: #e0a43e;
    --amber-text: #e0a43e;
    --green: #5cc48a;
    --t-vertical: #3987e5;
    --t-marca: #d95926;
    --t-general: #199e70;
    --t-agencia: #c98500;
    --t-estacional: #d55181;
    --backdrop: rgba(0, 0, 0, 0.55);
    --toast: #f4f1fa;
    --on-toast: #1d1630;
    --moment: rgba(244, 241, 250, 0.08);
    --sel: rgba(167, 139, 255, 0.22);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--f-15)/1.45 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.2; }
h1 { font-size: var(--f-34); letter-spacing: -0.02em; }
h2 { font-size: var(--f-20); }
h3 { font-size: var(--f-17); }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.icon { width: 20px; height: 20px; flex: none; }
.muted { color: var(--grey); }
.code { font-family: var(--mono); font-size: var(--f-15); letter-spacing: 0; word-break: break-all; }

:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
/* Los títulos que reciben el foco al abrir una vista o la ficha no son controles: sin contorno. */
[tabindex="-1"]:focus { outline: none; }
.skip {
  position: absolute; left: 8px; top: 8px; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
  background: var(--surface); padding: 0; z-index: 50;
}
.skip:focus { width: auto; height: auto; clip-path: none; padding: 10px 14px; border-radius: var(--r-ctl); }
.noscript { padding: 32px; }
.sr-legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* --- botones y campos --- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--target); padding: 0 16px; border-radius: var(--r-ctl);
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: var(--f-15); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--purple); border-color: var(--purple); color: var(--on-purple); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { border-color: var(--line-strong); }
.btn.warn { border-color: var(--red); color: var(--red); }
.btn.pink { background: var(--magenta-fill); border-color: var(--magenta-fill); color: #1d1630; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: var(--f-13); }
.btn.on-dark { color: var(--on-toast); border-color: currentColor; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .label, legend { font-size: var(--f-13); font-weight: 600; color: var(--grey); }
.hint { font-size: var(--f-13); color: var(--grey); }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="search"],
input[type="url"], select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border-radius: var(--r-ctl);
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
textarea { min-height: 88px; resize: vertical; }
/* WebKit no deja dar altura a un desplegable nativo: se dibuja entero (con su flecha) para que mida lo que pide el móvil. */
select {
  -webkit-appearance: none; appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d5a6b' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px 18px;
}
input:hover, select:hover, textarea:hover { border-color: var(--grey); }
::placeholder { color: var(--grey); opacity: 1; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; margin: 0; accent-color: var(--purple); flex: none; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }

.check {
  display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 12px 6px 10px;
  border-radius: var(--r-ctl); border: 1.5px solid var(--line); background: var(--surface); cursor: pointer;
  font-weight: 500;
}
.check:has(input:checked) { border-color: var(--purple); }
.swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--tc, var(--grey)); flex: none; }

.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-ctl);
  border: 1.5px solid var(--red); color: var(--ink); background: color-mix(in srgb, var(--red) 8%, var(--surface));
}
.alert .icon { color: var(--red); margin-top: 1px; }

/* --- el marco --- */

.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 28px;
  padding: 0 var(--gutter); min-height: 64px; background: var(--paper); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: var(--f-17); min-height: 44px; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px; background: var(--purple); position: relative; overflow: hidden;
}
.brand-mark::after { content: ""; position: absolute; left: 8px; top: 0; bottom: 0; width: 6px; background: var(--lime); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-link {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: var(--r-ctl);
  text-decoration: none; font-weight: 500; color: var(--grey);
}
.nav-link:hover { color: var(--ink); background: var(--moment); }
.nav-link[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -3px 0 var(--purple); border-radius: 0; }
.who { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.who-name { display: inline-flex; align-items: center; gap: 6px; color: var(--grey); font-size: var(--f-13); margin-right: 4px; }
.top-title { display: none; }
.tabs, .fab { display: none; }

main { display: block; padding: 28px var(--gutter) 64px; max-width: 1480px; margin: 0 auto; outline: none; }
body.bare main { padding: 0; max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .today { color: var(--grey); font-size: var(--f-17); }
.page.narrow { max-width: 720px; }
.page.narrow h1 { margin-bottom: 12px; }
.later { font-size: var(--f-17); color: var(--grey); }

/* --- la tira (Próximas 13 semanas) --- */

.strip { background: var(--surface); border-radius: var(--r-box); padding: 4px 0 8px; }
.strip-scroll { overflow-x: auto; overscroll-behavior-x: contain; border-radius: var(--r-box); }
.strip-inner { position: relative; min-width: 100%; padding-top: 52px; }
.weeks { position: absolute; top: 0; bottom: 0; left: var(--label-w); right: 12px; display: flex; pointer-events: none; }
.week { flex: 1 1 0; border-left: 1px solid var(--line); padding: 10px 0 0 8px; }
.week-label { display: block; font-size: var(--f-13); color: var(--grey); white-space: nowrap; }
.week-month { display: block; font-size: var(--f-13); font-weight: 600; color: var(--ink); min-height: 18px; }
.week[data-current-week="1"] { background: var(--week-band); border-left-color: transparent; border-radius: 10px; box-shadow: inset 0 4px 0 var(--lime); }
.week[data-current-week="1"] .week-label, .week[data-current-week="1"] .week-month { color: var(--on-week); }
.today-line { position: absolute; top: 50px; bottom: 0; width: 2px; margin-left: -1px; background: var(--purple); z-index: 2; }
.today-line span {
  position: absolute; top: 0; left: 4px; font-size: var(--f-13); font-weight: 600; color: var(--on-purple);
  background: var(--purple); border-radius: 999px; padding: 0 7px; line-height: 20px;
}
.lane { position: relative; display: flex; border-top: 1px solid var(--line); }
.lane-label {
  width: var(--label-w); flex: none; padding: 10px 12px 10px 20px; font-weight: 600; position: sticky; left: 0; z-index: 4;
  background: var(--surface);
}
.lane-label .short { display: none; }
.lane-track { position: relative; flex: 1; margin-right: 12px; min-height: calc(var(--rows, 1) * (var(--bar-h) + 6px) + var(--mrows, 0) * 22px + 16px); }
.moment {
  position: absolute; height: 20px; pointer-events: none; white-space: nowrap;
  font-size: var(--f-13); color: var(--grey); padding: 0 4px; border-bottom: 3px solid var(--moment); line-height: 16px;
}
/* Como en las barras: si a su derecha no hay otro momento en su fila, el nombre sigue por ahí (--reach). */
.moment-name {
  position: relative; display: block; overflow: hidden; text-overflow: ellipsis; width: max-content;
  max-width: calc(var(--reach, 1) * 100% + (var(--reach, 1) - 1) * 8px);
}
.moment::before { content: ""; position: absolute; inset: 0; background: var(--moment); opacity: 0.5; }

.bar {
  position: absolute; height: var(--bar-h); display: flex; align-items: center; padding: 0 8px 0 10px;
  border-radius: var(--r-bar); --tc: var(--grey);
  background: color-mix(in srgb, var(--tc) 18%, var(--surface));
  border-left: 4px solid var(--tc);
  color: var(--ink); font-weight: 600; font-size: var(--f-13); line-height: 15px; cursor: pointer; overflow: visible;
  white-space: nowrap; user-select: none; -webkit-user-select: none; z-index: 3;
  container-type: inline-size;
}
/* Dos líneas: el nombre y, debajo, la palabra de su estado y de su choque. Si la barra es corta y a su derecha no hay
   nada en esa fila, el texto sigue fuera de la barra (--reach = días de la barra más los libres, entre los de la barra)
   para que se lea qué campaña es sin pasar el ratón. */
.bar-text {
  flex: none; display: flex; flex-direction: column; justify-content: center; min-width: 0; width: max-content;
  max-width: calc(100cqw + (100cqw + 22px) * (var(--reach, 1) - 1) - 2px);
}
.bar .bar-name { display: block; overflow: hidden; text-overflow: ellipsis; }
/* La palabra va sobre una píldora del color de la superficie: legible (AA) encima del rayado de cualquier tipo. */
.bar .tag {
  display: block; width: fit-content; max-width: calc(100% + 3px); margin-left: -3px; padding: 0 3px; border-radius: 3px;
  overflow: hidden; text-overflow: ellipsis; background: var(--surface); color: var(--grey); font-weight: 500;
}
.bar .tag .draft-word { color: var(--magenta); font-weight: 600; }
.bar .tag .tag-sev.alta { color: var(--red); }
.bar .tag .tag-sev.media { color: var(--amber-text); }
.bar .tag .sev { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; }
.bar.draft {
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--tc) 30%, var(--surface)) 0 5px,
    color-mix(in srgb, var(--tc) 9%, var(--surface)) 5px 11px);
  border: 1.5px dashed var(--tc); border-left-width: 4px; border-left-style: solid;
}
.bar.cancelled { --tc: var(--grey); color: var(--grey); }
.bar.cancelled .bar-name { text-decoration: line-through; }
.bar.sev-alta { box-shadow: 0 0 0 2px var(--red); }
.bar.sev-media { box-shadow: 0 0 0 2px var(--amber); }
.bar.sev-alta .sev { color: var(--red); }
.bar.sev-media .sev { color: var(--amber); }
.bar.sev-baja .sev { color: var(--grey); }
.bar:hover { filter: saturate(1.25); }
.bar:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; z-index: 6; }
.t-vertical { --tc: var(--t-vertical); }
.t-marca { --tc: var(--t-marca); }
.t-general { --tc: var(--t-general); }
.t-agencia { --tc: var(--t-agencia); }
.t-estacional { --tc: var(--t-estacional); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 14px 20px 6px; font-size: var(--f-13); color: var(--grey); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sample.moment-sample { background: var(--moment); border-bottom: 3px solid var(--line-strong); }
.legend .sample { width: 26px; height: 14px; border-radius: 3px; display: inline-block; }
.sample.ink { background: color-mix(in srgb, var(--t-vertical) 18%, var(--surface)); border-left: 4px solid var(--t-vertical); }
.sample.pencil {
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--t-vertical) 30%, var(--surface)) 0 4px,
    color-mix(in srgb, var(--t-vertical) 9%, var(--surface)) 4px 8px);
  border: 1.5px dashed var(--t-vertical);
}

/* --- Esta semana: debajo de la tira --- */

.columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; margin-top: 36px; }
.col h2 { font-size: var(--f-26); margin-bottom: 4px; }
.col > .sub { color: var(--grey); margin-bottom: 18px; }
.group { margin-top: 18px; }
.group > h3 { font-size: var(--f-15); color: var(--grey); font-weight: 600; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.list { list-style: none; margin: 0; padding: 0; }
.item {
  display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 4px 14px; align-items: baseline;
  padding: 10px 8px; min-height: 44px; border-bottom: 1px solid var(--line); text-decoration: none; border-radius: 0;
}
a.item:hover { background: var(--surface); }
.item .when { font-weight: 600; white-space: nowrap; }
.item .what { font-weight: 500; overflow-wrap: anywhere; }
.item .where { color: var(--grey); font-size: var(--f-13); grid-column: 2 / 3; }
.item .state { font-size: var(--f-13); font-weight: 600; white-space: nowrap; }
.late { color: var(--red); }
.soon { color: var(--amber-text); }
.done-word { color: var(--green); }
.draft-word { color: var(--magenta); }
.sev-word { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: var(--f-13); white-space: nowrap; }
.sev-word.alta { color: var(--red); }
.sev-word.media { color: var(--amber-text); }
.sev-word.baja { color: var(--grey); }
.sev-word .icon { width: 16px; height: 16px; }
.more { padding: 10px 8px; }
.more a { font-weight: 600; color: var(--purple); display: inline-flex; align-items: center; min-height: 44px; }
.empty { padding: 14px 0; color: var(--grey); font-size: var(--f-17); max-width: 60ch; }

/* --- Calendario --- */

.toolbar { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-end; margin-bottom: 18px; }
.toolbar fieldset { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.toolbar legend { width: 100%; }
.filter-sets { display: contents; }
.filters-toggle { display: none; }
.toolbar .check { min-height: 36px; padding: 4px 10px 4px 8px; font-size: var(--f-13); }
.toolbar .check input { width: 16px; height: 16px; }
.pager { display: flex; gap: 8px; margin-left: auto; align-items: center; }
.pager .range { color: var(--grey); margin-right: 6px; }
.cal { background: var(--surface); border-radius: var(--r-box); overflow: hidden; user-select: none; -webkit-user-select: none; }
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.cal-head span { padding: 10px 10px 8px; font-size: var(--f-13); font-weight: 600; color: var(--grey); }
.cal-week {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); position: relative; border-bottom: 1px solid var(--line);
  --top: calc(var(--day-head) + var(--mrows, 0) * 20px);
  min-height: calc(var(--top) + var(--rows, 1) * 38px + 14px);
}
/* La raya entre días es una sombra, no un borde: así cada día mide lo mismo y una barra de N días mide N anchos. */
.cal-day { position: relative; box-shadow: inset 1px 0 0 var(--line); padding: 6px 8px; min-width: 0; }
.cal-day:first-child { box-shadow: none; }
.cal-day .num { font-size: var(--f-13); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; min-height: 22px; }
.cal-day .num .wd { display: none; }
.cal-day.past .num { color: var(--grey); font-weight: 400; }
.cal-day.weekend { background: color-mix(in srgb, var(--paper) 45%, var(--surface)); }
.cal-day.today .num .d { background: var(--purple); color: var(--on-purple); border-radius: 999px; padding: 0 7px; }
.cal-day.sel { background: var(--sel); }
.cal-week .moment { top: calc(var(--day-head) + var(--mrow, 0) * 20px); height: 18px; z-index: 1; }
.cal-day .bar { left: 3px; width: calc(var(--span, 1) * 100% - 6px); top: calc(var(--top) + var(--lane, 0) * 38px); }
.handle { position: absolute; top: 0; bottom: 0; width: 12px; cursor: ew-resize; touch-action: none; z-index: 2; }
.handle.start { left: -4px; }
.handle.end { right: 0; }
.handle::after { content: ""; position: absolute; top: 9px; bottom: 9px; left: 5px; width: 2px; border-radius: 2px; background: var(--tc); opacity: 0; }
.bar:hover .handle::after, .bar:focus-visible .handle::after { opacity: 1; }
.bar.cut-start { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.bar.cut-end { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-note { margin-top: 12px; color: var(--grey); font-size: var(--f-13); }

/* --- hojas: la ficha y la confirmación del arrastre --- */

/* La ficha cuelga por debajo de la cabecera (la navegación sigue a mano con ella abierta) y es la página mientras está
   abierta: se desplaza con la página y una captura de página entera la saca entera. La vista de debajo queda fija donde
   estaba, detrás del velo (app.js: lockBase). */
body.sheet-open #main { position: fixed; top: var(--lock-top, var(--top-h)); left: 0; right: 0; }
.sheet-wrap {
  position: relative; z-index: 15; min-height: calc(100vh - var(--top-h)); background: var(--backdrop);
  display: flex; justify-content: flex-end;
}
.sheet {
  width: min(640px, 100%); background: var(--surface); padding: 28px 32px 48px;
  box-shadow: -18px 0 48px rgba(29, 22, 48, 0.18); animation: slide-in 180ms ease-out;
}
.sheet-wrap.center { position: fixed; inset: 0; z-index: 35; min-height: 0; align-items: center; justify-content: center; padding: 16px; }
.sheet-wrap.center .sheet { height: auto; max-height: 100%; overflow-y: auto; border-radius: var(--r-box); width: min(560px, 100%); animation: rise 160ms ease-out; }
@keyframes slide-in { from { transform: translateX(32px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes rise { from { transform: translateY(12px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet h3 { margin: 16px 0 6px; }
.sheet-wrap.center .sheet > h2:first-child { margin-top: 0; }
.review h3 { margin-bottom: 6px; }
.sheet-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.close { min-width: 44px; padding: 0 10px; }
.sheet h1 { font-size: var(--f-34); margin-bottom: 10px; overflow-wrap: anywhere; }
.sheet h2 { font-size: var(--f-20); margin: 32px 0 10px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-bottom: 14px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: var(--f-13);
  font-weight: 600; border: 1.5px solid var(--line-strong);
}
.pill.type { border-color: var(--tc); }
.pill.phase-borrador, .pill.phase-borrador_vencido { border-color: var(--magenta-fill); color: var(--magenta); }
.pill.phase-proxima, .pill.phase-en_marcha { border-color: var(--green); color: var(--green); }
.pill.phase-cancelada, .pill.phase-terminada { color: var(--grey); }
.when-big { font-size: var(--f-20); font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 6px; }
.code-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 18px; padding: 12px 14px; border-radius: var(--r-ctl); background: var(--paper); }
.prose { max-width: 62ch; }
.prose p + p { margin-top: 8px; }
.note { margin-top: 10px; padding: 10px 14px; border-left: 3px solid var(--amber); background: color-mix(in srgb, var(--amber) 8%, var(--surface)); }
.task { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 6px 14px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; }
.task .meta { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: var(--f-13); color: var(--grey); }
.task .meta select { width: auto; min-height: 36px; padding: 4px 34px 4px 10px; font-size: var(--f-13); }
.task .name { font-weight: 600; }
.task.done .name { color: var(--grey); text-decoration: line-through; }
.inline-form { display: grid; gap: 12px; margin-top: 14px; padding: 14px; border-radius: var(--r-ctl); background: var(--paper); }
.inline-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.task .inline-form { grid-column: 1 / -1; margin-top: 4px; }
.history { list-style: none; margin: 0; padding: 0; }
.history > li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.history .h-when { font-size: var(--f-13); color: var(--grey); }
.history .h-what { font-weight: 500; }
.history .h-outside { color: var(--red); }
.changes { list-style: none; margin: 6px 0 0; padding: 0; font-size: var(--f-13); }
.changes li { padding: 2px 0; }
.changes .f { font-weight: 600; }
.diff { display: grid; gap: 8px; margin: 12px 0; }
.diff .line { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.diff .old { color: var(--grey); text-decoration: line-through; }
.back-to-draft { padding: 12px 14px; border-radius: var(--r-ctl); background: color-mix(in srgb, var(--magenta-fill) 12%, var(--surface)); border: 1.5px solid var(--magenta-fill); }

/* --- Nueva --- */

.wizard { max-width: 760px; }
.steps { list-style: none; display: flex; gap: 6px 20px; flex-wrap: wrap; padding: 0; margin: 14px 0 26px; color: var(--grey); font-size: var(--f-13); }
.steps li { display: flex; align-items: center; gap: 8px; }
.steps li::before { content: ""; width: 28px; height: 4px; border-radius: 2px; background: var(--line-strong); }
.steps li[aria-current="step"] { color: var(--ink); font-weight: 600; }
.steps li[aria-current="step"]::before { background: var(--purple); }
.steps li.done::before { background: var(--ink); }
.step { background: var(--surface); border-radius: var(--r-box); padding: 26px 28px 28px; display: grid; gap: 22px; }
.step > h2 { font-size: var(--f-26); }
.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.type-option { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: start; padding: 12px 14px; border-radius: var(--r-ctl); border: 1.5px solid var(--line); cursor: pointer; }
.type-option:has(input:checked) { border-color: var(--tc); background: color-mix(in srgb, var(--tc) 10%, var(--surface)); }
.type-option input { margin-top: 2px; }
.type-option .t-name { font-weight: 600; display: inline-flex; gap: 8px; align-items: center; }
.type-option .t-help { grid-column: 2; font-size: var(--f-13); color: var(--grey); }
.scope-box { position: relative; }
.suggest { list-style: none; margin: 6px 0 0; padding: 4px; border-radius: var(--r-ctl); border: 1.5px solid var(--line-strong); background: var(--surface); max-height: 280px; overflow: auto; }
.suggest button { width: 100%; text-align: left; display: flex; justify-content: space-between; gap: 10px; min-height: 40px; padding: 6px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; }
.suggest button:hover { background: var(--paper); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 12px; border-radius: 999px; background: var(--paper); font-weight: 500; }
.chip button { min-width: 32px; min-height: 32px; border: 0; background: none; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.boxes { display: flex; flex-wrap: wrap; gap: 8px; }
.wizard-nav { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.review { display: grid; gap: 18px; }
.review dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; }
.review dt { color: var(--grey); font-size: var(--f-13); font-weight: 600; padding-top: 2px; }
.review dd { margin: 0; }
.preview { list-style: none; margin: 0; padding: 0; }
.preview li { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }

/* --- Mis tareas --- */

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.tasks-list .item { grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center; }
.tasks-list .item .where a { color: inherit; }

/* --- Entrar e invitación --- */

.gate { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
/* El panel de Entrar es oscuro en los dos modos (no toma la tinta, que en oscuro es clara). */
.gate-art { background: #1d1630; color: #f4f1fa; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; overflow: hidden; }
.gate-art h1 { font-size: var(--f-34); line-height: 1.1; max-width: 12ch; color: #f4f1fa; }
.gate-art p { color: #b9b3c6; max-width: 40ch; font-size: var(--f-17); margin-top: 16px; }
.gate-strip { display: grid; grid-template-columns: repeat(13, 1fr); gap: 4px; height: 120px; align-items: stretch; }
.gate-strip span { border-radius: 4px; background: rgba(244, 241, 250, 0.08); position: relative; }
.gate-strip span.now { background: var(--lime); }
.gate-strip span.b1::after, .gate-strip span.b2::after, .gate-strip span.b3::after { content: ""; position: absolute; left: 30%; height: 14px; border-radius: 3px; z-index: 1; }
.gate-strip span.b1::after { width: calc(270% + 8px); }
.gate-strip span.b2::after { width: calc(200% + 4px); }
.gate-strip span.b3::after { width: calc(360% + 12px); }
.gate-strip span.b1::after { top: 18px; background: #2a78d6; }
.gate-strip span.b2::after { top: 50px; background: #eb6834; }
.gate-strip span.b3::after { top: 82px; background: #1baf7a; }
.gate-form { display: flex; align-items: center; justify-content: center; padding: 48px 32px; }
.gate-form form { width: min(400px, 100%); display: grid; gap: 18px; }
.gate-form h2 { font-size: var(--f-26); }
.gate-form .btn { min-height: 48px; }

/* --- avisos --- */

.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40; display: grid; gap: 8px; width: min(520px, calc(100% - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px 12px 16px; border-radius: var(--r-ctl); background: var(--toast); color: var(--on-toast); animation: rise 160ms ease-out; }
/* Arriba y en el flujo de la página (no fijo): con la maqueta del móvil no tapa ningún botón. */
.desktop-notice { display: grid; gap: 10px; margin: 12px var(--gutter) 0; padding: 14px 16px; border-radius: var(--r-ctl); background: var(--surface); border: 2px solid var(--purple); }
.desktop-notice .btn { justify-self: start; }

/* --- móvil: diseño aparte, no un ordenador encogido ---
   html[data-layout="mobile"] lo pone app.js (760 px o menos, o «Sitio para ordenador» con su zoom). */

html[data-layout="mobile"] { --gutter: 16px; --label-w: 48px; --bar-h: 44px; --target: 44px; --top-h: 56px; --day-head: 58px; }
html[data-layout="mobile"] body { font-size: var(--f-17); padding-bottom: 88px; }
html[data-layout="mobile"] h1 { font-size: var(--f-26); }
html[data-layout="mobile"] .top { min-height: 56px; gap: 12px; }
html[data-layout="mobile"] .nav, html[data-layout="mobile"] .who { display: none; }
html[data-layout="mobile"] .top-title { display: block; margin-left: auto; font-weight: 600; color: var(--grey); }
html[data-layout="mobile"] .brand-name { display: none; }
html[data-layout="mobile"] .brand { min-width: 44px; }
html[data-layout="mobile"] main { padding: 18px var(--gutter) 32px; }
html[data-layout="mobile"] .tabs:not([hidden]) {
  display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--surface);
  border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
}
html[data-layout="mobile"] .tab {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; border: 0; background: none; text-decoration: none; font-size: var(--f-13); font-weight: 500;
  color: var(--grey); border-radius: var(--r-ctl); cursor: pointer;
}
html[data-layout="mobile"] .tab[aria-current="page"] { color: var(--purple); }
html[data-layout="mobile"] .tab .icon { width: 24px; height: 24px; }
html[data-layout="mobile"] .more-menu {
  position: fixed; left: 8px; right: 8px; bottom: 76px; display: grid; gap: 2px; padding: 8px; border-radius: var(--r-box);
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: 0 -10px 40px rgba(29, 22, 48, 0.16);
}
html[data-layout="mobile"] .more-link { display: flex; align-items: center; min-height: 48px; padding: 0 14px; border-radius: var(--r-ctl); text-decoration: none; font-weight: 500; border: 0; background: none; text-align: left; cursor: pointer; }
html[data-layout="mobile"] .more-link:hover { background: var(--paper); }
html[data-layout="mobile"] .more-who { display: flex; gap: 8px; align-items: center; padding: 8px 14px; color: var(--grey); font-size: var(--f-15); }
html[data-layout="mobile"] .fab {
  display: inline-flex; position: fixed; right: 16px; bottom: 84px; z-index: 24; align-items: center; gap: 8px;
  min-height: 56px; padding: 0 22px 0 18px; border-radius: 999px; background: var(--purple); color: var(--on-purple);
  font-weight: 600; text-decoration: none; box-shadow: 0 8px 24px rgba(107, 56, 251, 0.35);
}
html[data-layout="mobile"] .fab .icon { width: 22px; height: 22px; }
html[data-layout="mobile"] .btn, html[data-layout="mobile"] .nav-link { min-height: 44px; }
html[data-layout="mobile"] .btn.small { min-height: 44px; }
html[data-layout="mobile"] input[type="text"], html[data-layout="mobile"] input[type="email"],
html[data-layout="mobile"] input[type="password"], html[data-layout="mobile"] input[type="date"],
html[data-layout="mobile"] input[type="search"], html[data-layout="mobile"] input[type="url"],
html[data-layout="mobile"] select, html[data-layout="mobile"] textarea { min-height: 48px; font-size: var(--f-17); }
html[data-layout="mobile"] .check { min-height: 44px; }
html[data-layout="mobile"] .toolbar .check { min-height: 44px; font-size: var(--f-15); }
html[data-layout="mobile"] .page-head { margin-bottom: 14px; }

/* La tira se desliza en horizontal dentro de su caja (la página no). */
html[data-layout="mobile"] .strip-inner { min-width: calc(var(--label-w) + 13 * 96px + 12px); }
html[data-layout="mobile"] .lane-label { padding: 12px 6px 10px 12px; }
html[data-layout="mobile"] .lane-label .long { display: none; }
html[data-layout="mobile"] .lane-label .short { display: inline; }
html[data-layout="mobile"] .bar { min-width: 44px; font-size: var(--f-13); }
html[data-layout="mobile"] .legend { padding: 12px 14px 4px; }

html[data-layout="mobile"] .columns { grid-template-columns: minmax(0, 1fr); gap: 28px; margin-top: 26px; }
html[data-layout="mobile"] .col h2 { font-size: var(--f-20); }
html[data-layout="mobile"] .item { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 4px; }
html[data-layout="mobile"] .item .when { grid-column: 1 / 2; }
html[data-layout="mobile"] .item .what, html[data-layout="mobile"] .item .where { grid-column: 1 / 2; }
html[data-layout="mobile"] .item .state, html[data-layout="mobile"] .item .act { grid-column: 2 / 3; grid-row: 1 / span 3; align-self: center; }
html[data-layout="mobile"] .tasks-list .item { grid-template-columns: minmax(0, 1fr) auto; }
/* Lo que se lee (campaña de cada fila, datos de las tareas, cambios del historial) a 15 px; los 13, para etiquetas. */
html[data-layout="mobile"] .item .where, html[data-layout="mobile"] .task .meta, html[data-layout="mobile"] .history .h-when,
html[data-layout="mobile"] .changes, html[data-layout="mobile"] .hint { font-size: var(--f-15); }

/* Calendario en el móvil: una semana por pantalla, que se cambia deslizando (encaje por semana), con su día de la
   semana en cada día, los momentos encima y los filtros recogidos tras «Filtros». */
html[data-layout="mobile"] .toolbar { gap: 8px; margin-bottom: 12px; align-items: stretch; }
html[data-layout="mobile"] .pager { display: contents; }
html[data-layout="mobile"] .pager .range { order: -1; width: 100%; color: var(--ink); font-weight: 600; font-size: var(--f-17); margin: 0; }
html[data-layout="mobile"] .filters-toggle { display: inline-flex; flex: 0.8 1 0; min-width: 0; }
html[data-layout="mobile"] .pager .btn { flex: 1 1 0; min-width: 0; white-space: normal; padding: 0 8px; font-size: var(--f-15); line-height: 1.15; }
html[data-layout="mobile"] .filter-sets { display: flex; flex-direction: column; gap: 12px; width: 100%; order: 2; }
html[data-layout="mobile"] .toolbar:not(.open) .filter-sets { display: none; }
html[data-layout="mobile"] .cal {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none;
}
html[data-layout="mobile"] .cal::-webkit-scrollbar { display: none; }
html[data-layout="mobile"] .cal-head { display: none; }
html[data-layout="mobile"] .cal-week {
  flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; border-bottom: 0;
  min-height: calc(var(--top) + var(--rows, 1) * 52px + 16px);
}
html[data-layout="mobile"] .cal-day { padding: 6px 2px; }
html[data-layout="mobile"] .cal-day .num { flex-direction: column; gap: 2px; justify-content: center; width: 100%; min-height: 40px; }
html[data-layout="mobile"] .cal-day .num .wd { display: block; font-size: var(--f-13); font-weight: 500; color: var(--grey); }
html[data-layout="mobile"] .cal-day .num .d { font-size: var(--f-15); }
html[data-layout="mobile"] .cal-day .bar { top: calc(var(--top) + var(--lane, 0) * 52px); width: calc(var(--span, 1) * 100% - 4px); left: 2px; padding: 0 4px 0 6px; }

/* La ficha, a pantalla entera: la vista de debajo no se pinta. */
html[data-layout="mobile"] body.sheet-open #main { display: none; }
html[data-layout="mobile"] .sheet-wrap { background: var(--surface); }
html[data-layout="mobile"] .sheet-wrap.center { background: var(--backdrop); }
html[data-layout="mobile"] .sheet { width: 100%; padding: 12px 16px 40px; box-shadow: none; animation: none; }
html[data-layout="mobile"] .sheet h1 { font-size: var(--f-26); }
html[data-layout="mobile"] .task { grid-template-columns: minmax(0, 1fr) auto; }
html[data-layout="mobile"] .task > .when { grid-column: 1; grid-row: 1; }
html[data-layout="mobile"] .task > .name { grid-column: 1; grid-row: 2; }
html[data-layout="mobile"] .task > .btn, html[data-layout="mobile"] .task > .state { grid-column: 2; grid-row: 1 / span 2; }
html[data-layout="mobile"] .task .meta { grid-column: 1 / 3; grid-row: 3; }
html[data-layout="mobile"] .task .meta select { min-height: 44px; font-size: var(--f-15); }
html[data-layout="mobile"] .inline-form .row, html[data-layout="mobile"] .dates { grid-template-columns: 1fr; }
html[data-layout="mobile"] .step { padding: 18px 16px 20px; }
html[data-layout="mobile"] .types { grid-template-columns: 1fr; }
html[data-layout="mobile"] .review dl { grid-template-columns: 1fr; gap: 2px; }
html[data-layout="mobile"] .review dd { margin-bottom: 10px; }
html[data-layout="mobile"] .suggest button { min-height: 44px; }
html[data-layout="mobile"] .chip button { min-width: 44px; min-height: 44px; }
html[data-layout="mobile"] .sheet a:not(.btn), html[data-layout="mobile"] .where a { display: inline-flex; align-items: center; min-height: 44px; }

html[data-layout="mobile"] .gate { grid-template-columns: 1fr; min-height: 0; }
html[data-layout="mobile"] .gate-art { padding: 28px 16px 24px; gap: 18px; }
html[data-layout="mobile"] .gate-art h1 { font-size: var(--f-34); }
html[data-layout="mobile"] .gate-strip { height: 64px; }
html[data-layout="mobile"] .gate-strip span.b1::after { top: 8px; height: 10px; }
html[data-layout="mobile"] .gate-strip span.b2::after { top: 27px; height: 10px; }
html[data-layout="mobile"] .gate-strip span.b3::after { top: 46px; height: 10px; }
html[data-layout="mobile"] .gate-form { padding: 24px 16px 40px; align-items: flex-start; }
html[data-layout="mobile"] .toasts { bottom: 92px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
