/* Base visual de Kobi con colores propios de Tareas (índigo #2E1F5E + lavanda #A78BFA, texto de acento #6D28D9; Plus Jakarta Sans + Inter). Lo propio de Tareas va al final. */
:root {
  --bg: #F8FAFC; --surface: #ffffff; --surface-2: #F1F5F9; --ink: #1E2A38; --muted: #4A5568; --faint: #94A3B8; --line: #E2E8F0;
  --navy: #2E1F5E; --navy-2: #3B2A73; --on-navy: #ffffff; --on-navy-muted: rgba(255,255,255,.68);
  --cyan: #A78BFA; --accent: #6D28D9; --accent-ink: #ffffff; --accent-soft: #F3EEFF;
  --ok: #15803D; --ok-soft: #E8F6EE; --warn: #A16207; --warn-soft: #FDF4DC; --bad: #C2413A; --bad-soft: #FDECEA; --info: #1E5FA8; --info-soft: #E8F0FB;
  --series-1: #0096B8; --series-2: #D97300;
  --shadow-sm: 0 1px 3px rgba(46,31,94,.07), 0 1px 2px rgba(46,31,94,.05);
  --shadow: 0 4px 16px rgba(46,31,94,.09), 0 1px 4px rgba(46,31,94,.06);
  --radius: 14px;
  --font-display: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1826; --surface: #16263D; --surface-2: #1D3150; --ink: #E7EDF5; --muted: #A3B1C4; --faint: #6E809A; --line: #263C5C;
    --navy: #150E2C; --navy-2: #22183F; --on-navy: #ffffff; --on-navy-muted: rgba(255,255,255,.62);
    --cyan: #B9A3FF; --accent: #B79BFF; --accent-ink: #150E2C; --accent-soft: #2E2352;
    --ok: #5FCB8A; --ok-soft: #14352A; --warn: #E8B45A; --warn-soft: #3A2E14; --bad: #F28B82; --bad-soft: #43201F; --info: #8DB8F0; --info-soft: #1B2D4A;
    --series-1: #1BA3C4; --series-2: #C27A12;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.35); --shadow: 0 4px 16px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1826; --surface: #16263D; --surface-2: #1D3150; --ink: #E7EDF5; --muted: #A3B1C4; --faint: #6E809A; --line: #263C5C;
  --navy: #150E2C; --navy-2: #22183F; --on-navy: #ffffff; --on-navy-muted: rgba(255,255,255,.62);
  --cyan: #B9A3FF; --accent: #B79BFF; --accent-ink: #150E2C; --accent-soft: #2E2352;
  --ok: #5FCB8A; --ok-soft: #14352A; --warn: #E8B45A; --warn-soft: #3A2E14; --bad: #F28B82; --bad-soft: #43201F; --info: #8DB8F0; --info-soft: #1B2D4A;
  --series-1: #1BA3C4; --series-2: #C27A12;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.35); --shadow: 0 4px 16px rgba(0,0,0,.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
/* `hidden` oculta siempre, aunque la clase del elemento fije un display (p. ej. .check es inline-flex). */
[hidden] { display: none !important; }
html, body { min-height: 100%; }
/* Sin el margen de 8 px del navegador, que dejaba un borde blanco alrededor de la barra lateral. */
body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.15; text-wrap: balance; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 0.98rem; }
p { margin: 0; }
.num, td.n, .tab { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 0.82em; }
.muted { color: var(--muted); }

/* Estructura */
.app { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: env(safe-area-inset-top, 0px); align-self: start; height: 100vh; border-right: 1px solid var(--line); background: var(--surface); padding: 20px 14px calc(20px + env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand .mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; }
.brand strong { font-family: var(--font-display); font-size: 1.15rem; display: block; line-height: 1.1; }
.brand span { font-size: 0.75rem; color: var(--muted); }
/* El menú se desplaza solo; el pie (sincronización con Holded, cuenta) queda siempre a la vista. */
.nav { display: grid; gap: 2px; align-content: start; flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; }
.nav a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--ink); font-weight: 600; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav .badge { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.nav .badge.alert { background: var(--bad-soft); color: var(--bad); }
.nav-sec { display: grid; gap: 2px; }
.nav-sec .nav-items { display: none; gap: 2px; }
.nav-sec.open .nav-items { display: grid; }
.nav .nav-group { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 8px; padding: 7px 10px; border: 0; border-radius: 8px; background: none; font: inherit; font-size: 0.7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); cursor: pointer; text-align: left; }
.nav .nav-group:hover:not(:disabled) { background: var(--surface-2); }
.nav .nav-group:disabled { cursor: default; }
.nav .nav-group > span:first-child { flex: 1; }
.nav .nav-group .badge { text-transform: none; letter-spacing: 0; }
.nav .nav-group .chev { flex: none; width: 8px; height: 8px; margin-right: 3px; border-right: 2px solid var(--on-navy, currentColor); border-bottom: 2px solid var(--on-navy, currentColor); transform: rotate(-45deg); transition: transform .15s ease; }
.nav-sec.open .nav-group .chev { transform: rotate(45deg); }
.nav .nav-group:disabled .chev { opacity: .45; }
@media (prefers-reduced-motion: reduce) { .nav .nav-group .chev { transition: none; } }
.nav a.mobile-only { display: none; }
.menu-btn { display: none; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.25); border-radius: 10px; background: transparent; color: var(--on-navy, #fff); font: inherit; font-weight: 600; cursor: pointer; max-width: 60vw; }

.menu-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.menu-btn .burger { flex: none; width: 16px; height: 2px; background: currentColor; box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor; }
.side.menu-open .menu-btn .burger { height: 0; box-shadow: none; position: relative; }
.side.menu-open .menu-btn .burger::before, .side.menu-open .menu-btn .burger::after { content: ""; position: absolute; left: 0; top: -1px; width: 16px; height: 2px; background: currentColor; transform: rotate(45deg); }
.side.menu-open .menu-btn .burger::after { transform: rotate(-45deg); }
.menu-btn .badge { font-family: var(--font-mono); font-size: 0.72rem; padding: 1px 7px; border-radius: 99px; background: #F87171; color: #fff; }
.side .foot { flex: none; margin-top: auto; font-size: 0.78rem; color: var(--muted); padding: 0 8px; display: grid; gap: 4px; }
main { min-width: 0; padding-block: 28px 64px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.view { max-width: 110rem; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.view-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px; }
.view-head .sub { color: var(--muted); margin-top: 4px; }
.view-head .title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.help-btn { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: 700 0.85rem/1 var(--font-display); cursor: pointer; display: inline-grid; place-items: center; }
.help-btn:hover, .help-btn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.help-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.view-head .help-text { max-width: 65ch; }
.hero .help-btn { background: transparent; color: rgba(255,255,255,.85); border-color: rgba(255,255,255,.4); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.crumb { font-size: 0.85rem; }

/* Bloques */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; align-content: start; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.panel-head a { font-size: 0.88rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 4px; }
.kpi .label { font-size: 0.82rem; color: var(--muted); }
.kpi .value { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .note { font-size: 0.8rem; color: var(--muted); }
.kpi.bad .value { color: var(--bad); }
.alert-bar { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--bad); background: var(--bad-soft); border-radius: 12px; padding: 12px 16px; }
.alert-bar .icon { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--bad); color: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: 0.85rem; }
.alert-bar strong { display: block; }

/* Tablas */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td.n, th.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover td { background: var(--surface-2); }
tr.sub-row td:first-child { padding-left: 26px; }
.date { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Estados */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 0.76rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.pending { background: var(--warn-soft); color: var(--warn); }
.pill.notified { background: var(--info-soft); color: var(--info); }
.pill.invoiced { background: var(--accent-soft); color: var(--accent); }
.pill.paid, .pill.active, .pill.completed { background: var(--ok-soft); color: var(--ok); }
.pill.overdue, .pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.cancelled, .pill.ended, .pill.archived { background: var(--surface-2); color: var(--muted); }
.tag { font-family: var(--font-mono); font-size: 0.72rem; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.days { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.days.bad { color: var(--bad); font-weight: 600; }
.days.soon { color: var(--warn); font-weight: 600; }

/* Controles */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ovh-filters { margin-bottom: 12px; }
.ovh-filters select.input { width: auto; }
.ovh-filters input[type=search] { flex: 1 1 16rem; max-width: 24rem; }
details.panel > summary { cursor: pointer; }
details.panel[open] > summary { margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { border: none; background: none; padding: 6px 12px; cursor: pointer; font-size: 0.88rem; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.search { border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 6px 12px; min-width: 0; width: 16rem; max-width: 100%; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 5px 10px; cursor: pointer; font-size: 0.84rem; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.84rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.line { height: 2px; border-radius: 1px; vertical-align: 3px; width: 16px; }
.legend i.dash { height: 0; border-top: 2px dashed var(--muted); background: none; width: 16px; vertical-align: 3px; }

/* Listas */
.rows { display: grid; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: center; }
.row:last-child { border-bottom: none; }
.row .t { font-weight: 600; min-width: 0; }
.row .s { font-size: 0.84rem; color: var(--muted); grid-column: 1; }
.row .r { text-align: right; grid-row: 1 / span 2; grid-column: 2; display: grid; gap: 2px; justify-items: end; }
/* «Por facturar» de la ficha: casilla para elegir lo que va en el borrador. */
.row.row-sel { grid-template-columns: auto minmax(0, 1fr) auto; }
.row.row-sel .row-check { grid-column: 1; grid-row: 1 / span 2; margin: 0; }
.row.row-sel .t, .row.row-sel .s { grid-column: 2; }
.row.row-sel .r { grid-column: 3; }
.empty { color: var(--muted); padding: 10px 0; }
details.rev { border-top: 1px solid var(--line); }
details.rev:first-of-type { border-top: none; }
details.rev summary { cursor: pointer; padding: 10px 0; display: flex; justify-content: space-between; gap: 10px; font-weight: 600; list-style: none; }
details.rev summary::-webkit-details-marker { display: none; }
details.rev summary::before { content: "▸"; color: var(--muted); margin-right: 8px; transition: transform .15s; display: inline-block; }
details.rev[open] summary::before { transform: rotate(90deg); }
details.rev summary .left { display: flex; flex: 1; min-width: 0; }
details.rev ul { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 5px; color: var(--muted); font-size: 0.9rem; }
.kv { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 6px 12px; font-size: 0.92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Gráficos */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-family: var(--font-body); font-size: 11px; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .zero { stroke: var(--ink); stroke-width: 1; opacity: .6; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 0.82rem; box-shadow: 0 4px 14px rgb(0 0 0 / .12); min-width: 11rem; z-index: 5; }
.tip strong { display: block; margin-bottom: 4px; }
.tip .l { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.tip .l i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 0.9rem; z-index: 20; max-width: min(36rem, calc(100vw - 32px)); display: flex; align-items: flex-start; gap: 10px; line-height: 1.45; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.toast[hidden] { display: none; }
.toast.error { background: #B42318; color: #fff; }
.toast-text { flex: 1; min-width: 0; }
.toast-close { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0 2px; opacity: .8; line-height: 1.45; }
.toast-close:hover, .toast-close:focus-visible { opacity: 1; }
.proto { font-size: 0.78rem; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; padding: 6px 10px; }

@media (max-width: 980px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  /* Barra arriba y el contenido debajo: sin filas fijas, la rejilla repartía la altura sobrante
     entre las dos y una página corta salía con un hueco grande bajo la barra. */
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .side { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; height: auto; flex-direction: column; gap: 10px; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); border-right: none; border-bottom: 1px solid var(--line); }
  body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 11; background: var(--surface); }
  /* Menú plegado tras el botón «Menú»; abierto, los mismos grupos que en escritorio. */
  .side { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 12px; }
  .menu-btn { display: inline-flex; }
  .side .brand { min-width: 0; }
  .side .brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav, .side .foot { display: none; grid-column: 1 / -1; }
  .side.menu-open .nav { display: grid; max-height: calc(100dvh - 170px); overflow-y: auto; overscroll-behavior: contain; }
  .side.menu-open .foot { display: grid; margin-top: 0; }
  main { padding-block: 18px 56px; }
  /* Filas con botones de texto (Conectores → Apps…): los botones bajan debajo del texto; al lado
     dejaban el texto en una columna de una palabra. Las filas solo con iconos siguen igual. */
  .row:has(.r .actions > .btn:not(.icon)) { grid-template-columns: minmax(0, 1fr); }
  .row:has(.r .actions > .btn:not(.icon)) .r { grid-row: auto; grid-column: 1; justify-items: start; text-align: left; }
  .row:has(.r .actions > .btn:not(.icon)) .r .actions { justify-content: flex-start; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 0 0; }
  .kv dt { margin-top: 8px; }
  .search { width: 100%; }
  /* Que nada sea más ancho que la pantalla: filas de botones que bajan de línea, buscadores a todo
     el ancho y campos de las tarjetas que encogen. */
  .seg { display: flex; flex-wrap: wrap; max-width: 100%; }
  .seg button { flex: 1 1 auto; }
  .seg button + button { border-left: none; }
  .seg button { border-right: 1px solid var(--line); }
  .toolbar > * { max-width: 100%; }
  .toolbar input[type=search], .ovh-filters input[type=search] { flex: 1 1 100%; max-width: none; }
  .toolbar select.input { max-width: 100%; }
  .match-cell select, .match-cell input { min-width: 0; width: 100%; }
  /* En las tarjetas, una celda con un campo lleva la etiqueta encima y el campo debajo, a todo el
     ancho (a su lado no cabe y se salía de la tarjeta). */
  .table-wrap td:has(> .match-cell)::before { float: none; display: block; max-width: none; margin: 0 0 4px; }
  .table-wrap td:has(> .match-cell) { text-align: left; }
  .table-wrap td .input, .table-wrap td select, .table-wrap td input { max-width: 100%; }
  .table-wrap td:empty { display: none; }
  .chart { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Marca kobi.es ---------- */
body { font-size: 14.5px; letter-spacing: -0.003em; }
h1, h2, h3 { letter-spacing: -0.015em; font-weight: 700; }
h1 { font-size: 1.7rem; font-weight: 800; }
.side { background: var(--navy); border-right: none; color: var(--on-navy); }
.brand .mark { background: none; width: 34px; height: 34px; }
.brand .mark svg { width: 34px; height: 34px; display: block; }
.brand strong { color: var(--on-navy); font-weight: 800; letter-spacing: -0.02em; }
.brand span { color: var(--on-navy-muted); }
.nav a { color: var(--on-navy-muted); font-weight: 600; border-radius: 10px; }
.nav a:hover { background: rgba(255,255,255,.07); color: var(--on-navy); }
.nav a[aria-current="page"] { background: rgba(167,139,250,.22); color: var(--on-navy); box-shadow: inset 3px 0 0 var(--cyan); }
.nav .badge { background: rgba(255,255,255,.12); color: var(--on-navy); }
.nav .badge.alert { background: #F87171; color: #fff; }
.nav .nav-group { color: var(--on-navy-muted); }
.nav .nav-group:hover:not(:disabled) { background: rgba(255,255,255,.07); color: var(--on-navy); }
/* La barra del menú, discreta sobre el marino: invisible hasta pasar por encima o moverse con el teclado. */
.nav { scrollbar-width: thin; scrollbar-color: transparent transparent; transition: scrollbar-color .2s; }
.nav:hover, .nav:focus-within { scrollbar-color: rgba(255,255,255,.28) transparent; }
.side .foot { color: var(--on-navy-muted); border-top: 1px solid rgba(255,255,255,.1); padding-top: 14px; gap: 8px; }
.side .foot .btn { background: transparent; color: var(--on-navy); border-color: rgba(255,255,255,.25); }
.side .foot .btn:hover { border-color: var(--cyan); color: var(--cyan); }
.panel, .kpi { border-radius: var(--radius); box-shadow: var(--shadow-sm); border-color: var(--line); }
.kpi { gap: 6px; padding: 16px 18px; }
.kpi .label { font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.kpi .value { font-weight: 800; font-size: 1.7rem; letter-spacing: -0.02em; }
.btn { border-radius: 10px; }
.btn.primary { background: var(--accent); border-color: var(--accent); }
.seg { border-radius: 10px; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.search { border-radius: 10px; }
th { color: var(--faint); font-size: 0.72rem; }
.alert-bar { border-radius: var(--radius); }

/* Cabecera de Inicio: el único degradado de la marca */
.hero { background: linear-gradient(135deg, #2E1F5E 0%, #5B3FA8 55%, #A78BFA 100%); color: #fff; border-radius: 18px; padding: 24px 26px; display: grid; gap: 16px; box-shadow: var(--shadow); }
.daily { position: relative; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.daily img { display: block; width: 100%; height: 100%; min-height: 160px; max-height: 240px; object-fit: cover; }
.daily-text { padding: 20px 52px 20px 24px; display: grid; gap: 6px; min-width: 0; }
.daily blockquote { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; line-height: 1.35; text-wrap: balance; }
.daily-orig { margin: 0; font-size: .85rem; font-style: italic; }
.daily-author { margin: 0; font-weight: 600; color: var(--accent); }
.daily-credit { margin: 4px 0 0; font-size: .78rem; }
.daily-close { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.daily-close:hover, .daily-close:focus-visible { border-color: var(--accent); }
@media (max-width: 760px) { .daily { grid-template-columns: 1fr; } .daily img { max-height: 200px; } .daily-text { padding: 16px 48px 18px 16px; } }
.hero h1 { color: #fff; font-size: 1.9rem; }
.hero .sub { color: rgba(255,255,255,.82); }
.hero .kpis { gap: 10px; }
.hero .kpi { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); box-shadow: none; backdrop-filter: blur(2px); }
.hero .kpi .label { color: rgba(255,255,255,.72); }
.hero .kpi .value { color: #fff; }
.hero .kpi .note { color: rgba(255,255,255,.72); }
.hero .kpi.bad .value { color: #FFC9C4; }
/* Cajas de Inicio que llevan a donde se resuelve lo que cuentan. */
a.kpi { color: inherit; text-decoration: none; transition: background-color .15s, border-color .15s, transform .15s; }
a.kpi:hover { border-color: var(--accent); transform: translateY(-1px); }
a.kpi:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hero a.kpi:hover { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.45); }
.hero a.kpi:focus-visible { outline-color: #fff; }
.hero .alert-bar { background: rgba(0,0,0,.18); border-color: rgba(255,201,196,.55); color: #fff; }
.hero .alert-bar .muted { color: rgba(255,255,255,.8); }
.hero .alert-bar a { color: #9BE7F7; font-weight: 600; }
.hero .alert-bar .icon { background: #F87171; color: #fff; }

@media (max-width: 760px) {
  .side { border-bottom: none; }
  body::before { background: var(--navy); }
  .hero { padding: 18px; border-radius: 14px; }
}

.tag.sepa { background: var(--info-soft); color: var(--info); font-weight: 600; }
.tag.modulards { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tag.modulards.bad { background: var(--bad-soft); color: var(--bad); }
button.tag.sepa, button.tag.modulards { border: none; cursor: pointer; font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; line-height: inherit; }
button.tag.sepa:hover, button.tag.modulards:hover { filter: brightness(0.95); }
.sub-h { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }

/* Formularios */
.form { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.field { display: grid; gap: 5px; align-content: start; font-weight: 600; font-size: 0.88rem; min-width: 0; }
.field small { font-weight: 400; }
.input { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 11px; width: 100%; min-width: 0; font-weight: 400; }
.input:disabled { background: var(--surface-2); color: var(--muted); }
.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.check-help { display: block; margin: -4px 0 4px 26px; }
.form-error { color: var(--bad); background: var(--bad-soft); border-radius: 10px; padding: 8px 12px; }
.btn.danger { color: var(--bad); }
.btn.danger.armed { background: var(--bad); border-color: var(--bad); color: #fff; }
.setting { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 18rem); gap: 6px 24px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.setting:first-of-type { border-top: none; }
.setting-label { font-weight: 600; }
.setting .muted { font-size: 0.85rem; margin-top: 2px; }
.int-status { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 6px; }
.int-status .muted { margin: 0; }
.int-form { display: grid; gap: 8px; }
.int-form .actions, .int-save { justify-content: flex-end; }
.int-save { padding-top: 12px; border-top: 1px solid var(--line); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
tr.muted-row td { opacity: .6; }

/* Tarifas en bloque: hoja editable. En el móvil no se convierte en tarjetas: se desplaza de lado. */
.sheet-wrap { overflow-x: auto; overscroll-behavior-x: contain; margin: 0 -4px; }
table.sheet { min-width: 860px; }
table.sheet th { letter-spacing: 0.02em; }
table.sheet th, table.sheet td { padding-inline: 5px; vertical-align: middle; }
table.sheet td { font-size: 0.92rem; }
table.sheet td.edit { padding: 4px 5px; background: var(--surface-2); }
table.sheet input.cell { width: 5rem; padding: 5px 7px; border-radius: 6px; font-variant-numeric: tabular-nums; }
table.sheet input.cell[data-col="from"] { width: 6.6rem; }
table.sheet select.cell { width: auto; padding: 5px 8px; border-radius: 6px; }
table.sheet input.cell:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
table.sheet td.chg { width: 7rem; min-width: 6rem; white-space: nowrap; font-size: 0.86rem; font-variant-numeric: tabular-nums; }
table.sheet td.chg .sheet-err { display: block; white-space: normal; line-height: 1.3; }
tr.row-bad td { background: var(--bad-soft); }
tr.row-bad input.cell { border-color: var(--bad); }
.sheet-err { color: var(--bad); font-size: 0.85rem; }
.sheet-tools { flex-wrap: wrap; gap: 12px 24px; align-items: end; }
.sheet-tools .actions { justify-content: flex-start; flex-wrap: wrap; }
@media (max-width: 760px) {
  .form-grid, .setting { grid-template-columns: minmax(0, 1fr); }
}

/* Tablas ordenables */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--ink); }
th.sortable::after { content: "↕"; margin-left: 5px; opacity: .35; font-size: .9em; }
th.sortable[aria-sort="ascending"]::after { content: "↑"; opacity: 1; color: var(--accent); }
th.sortable[aria-sort="descending"]::after { content: "↓"; opacity: 1; color: var(--accent); }
th.sortable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Ventas */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.col { background: var(--surface-2); border-radius: var(--radius); padding: 10px; display: grid; gap: 8px; min-width: 0; }
.col-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; padding: 2px 4px 4px; }
.col-head h3 { font-size: .9rem; }
.opp { display: grid; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; color: var(--ink); box-shadow: var(--shadow-sm); }
.opp:hover { border-color: var(--accent); text-decoration: none; }
.opp .muted, .opp-next { font-size: .82rem; }
.opp .tag { justify-self: start; }
.stages { display: flex; flex-wrap: wrap; gap: 6px; }
.stage { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 14px; cursor: pointer; font-weight: 600; color: var(--muted); }
.stage.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stage:disabled { cursor: default; opacity: .6; }
.btn.primary.armed { background: var(--ok); border-color: var(--ok); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.timeline li { border-left: 2px solid var(--line); padding-left: 12px; display: grid; gap: 2px; }
textarea.input { resize: vertical; font: inherit; }
/* Un desplegable dentro de una lista (Inicio → «Última pasada automática»): una sola columna, no la rejilla de .row. */
details.row { display: block; }
details.row summary { cursor: pointer; }
details.row ul { margin: 6px 0 0; padding-left: 1.2em; }
a.row { color: inherit; } a.row:hover { text-decoration: none; background: var(--surface-2); }
@media (max-width: 980px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .board { grid-template-columns: minmax(0, 1fr); } }
.opp[draggable="true"] { cursor: grab; }
.opp.dragging { opacity: .45; }
.col.drop { outline: 2px dashed var(--accent); outline-offset: -4px; background: var(--accent-soft); }

/* Revisión A/B/C */
.rev-items { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.rev-items li { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; }
.rev-items li.decided { background: var(--surface-2); }
.rev-items li p { color: var(--ink); font-size: .92rem; }
.rev-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.choice { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 12px; cursor: pointer; font-size: .84rem; color: var(--muted); }
.choice b { color: var(--accent); }
.choice.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.choice.on b { color: var(--accent-ink); }
.choice:disabled { cursor: default; }
.rev-note { flex: 1 1 14rem; padding: 5px 10px; font-size: .86rem; }

/* Catálogo editable */
tr.edit-row td { background: var(--surface-2); padding: 16px; }
.editor { display: grid; gap: 14px; }
.editor h3 { margin-bottom: 8px; }
table.mini { font-size: .86rem; }
table.mini th { font-size: .7rem; }

/* Botones de icono */
.btn.icon { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 10px; color: var(--muted); }
.btn.icon:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.btn.icon:disabled { opacity: .5; cursor: progress; }
.btn.icon svg { display: block; }
.tag.opened { font-family: var(--font-body); cursor: help; }
.tag.opened.yes { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.inv-mails { list-style: none; margin: 4px 0 0; padding: 0; font-size: 0.82rem; display: grid; gap: 2px; }
.inv-mails li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.tag.notice { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.tag.ok { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
/* Remesas generadas: una línea por factura, con «Marcar como devuelta». */
.rem-inv { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.rem-detail summary { cursor: pointer; color: var(--accent); width: fit-content; }
.rem-detail[open] summary { margin-bottom: 2px; }
.tag.kobi { font-family: var(--font-body); background: var(--info-soft); color: var(--info); font-weight: 600; }
/* Contratos de la ficha: sin desplazamiento lateral. Un buzón o un dominio largo (en letra fija, sin espacios) y las etiquetas se parten en vez de ensanchar la tabla. */
table.subs td { overflow-wrap: anywhere; }
table.subs td .tag { white-space: normal; }
.tag.internal { font-family: var(--font-body); background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* Ventana de correo */
.overlay { position: fixed; inset: 0; z-index: 30; background: rgb(14 24 38 / .45); display: grid; place-items: start center; overflow-y: auto;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.modal { width: 100%; max-width: 44rem; box-shadow: 0 20px 60px rgb(0 0 0 / .3); }
.modal textarea { font: inherit; line-height: 1.5; }
.chips .tag { cursor: pointer; border: none; }
.chips .tag:hover { background: var(--accent-soft); color: var(--accent); }

/* Descuentos */
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; padding: 12px 0; border-top: 1px solid var(--line); margin-top: 8px; }
.inline-form .field { flex: 1 1 14rem; }
fieldset.checks { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
fieldset.checks legend { font-size: .85rem; color: var(--muted); padding: 0 4px; }

/* Enlace a Holded junto al número de factura */
a.ext { text-decoration: none; font-size: .85em; color: var(--muted); }
a.ext:hover { color: var(--accent); }

/* Historial del cliente */
.hist { display: grid; gap: 0; margin-top: 12px; }
.hist-entry { display: grid; gap: 6px; padding: 12px 0; border-top: 1px solid var(--line); }
.hist-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: .85rem; }
.hist-remind { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .88rem; }

/* Prueba de correo: resultado correcto */
.alert-bar.ok-bar { border-color: var(--ok); background: var(--ok-soft); }
.alert-bar.ok-bar .icon { background: var(--ok); }
.alert-bar.info-bar { border-color: var(--info); background: var(--info-soft); }
.alert-bar.info-bar .icon { background: var(--info); }
.match-bar { align-items: center; flex-wrap: wrap; }
.match-bar > div:nth-child(2) { flex: 1 1 16rem; }

/* Mi cuenta */
.sig-preview { width: 100%; min-height: 140px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
/* Editor de correos con formato (richEditor en panel.js). */
.rte { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-width: 0; font-weight: 400; }
.rte:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.rte-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px; border-bottom: 1px solid var(--line); border-radius: 10px 10px 0 0; }
.rte-btn { font: inherit; font-size: .82rem; font-weight: 600; line-height: 1; padding: 7px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); cursor: pointer; }
.rte-btn.rte-icon { padding: 6px; display: inline-grid; place-items: center; }
.rte-btn:hover:not(:disabled) { background: var(--surface-2); }
.rte-btn:disabled { opacity: .45; cursor: default; }
.rte-html { margin-left: auto; }
.rte-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.rte-area { padding: 10px 12px; outline: none; overflow-wrap: anywhere; max-height: 55vh; overflow: auto; line-height: 1.5; }
.rte-area p { margin: 0 0 .8em; }
.rte-area p:last-child { margin-bottom: 0; }
.rte-area ul, .rte-area ol { margin: 0 0 .8em; padding-left: 1.4em; }
.rte-area a { color: var(--accent); text-decoration: underline; }
.rte-area:empty::before { content: attr(data-placeholder); color: var(--muted); }
/* Se ve como el correo (Arial 14 px) y las tablas de una firma, sin el estilo de las tablas del panel
   (relleno, líneas, mayúsculas). Se anulan una a una: «all: revert» quitaría también width, height y cellpadding. */
.rte-area { font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #1E2A38; }
.rte-area :is(h1, h2, h3, h4) { font-family: inherit; letter-spacing: normal; }
.rte-area table { border-collapse: separate; font-size: inherit; }
.rte-area table:not([width]) { width: max-content; }
.rte-area :is(th, td) { overflow-wrap: normal; padding: 0; border: 0; vertical-align: inherit; text-align: inherit; text-transform: none; letter-spacing: normal; font-weight: inherit; font-size: inherit; color: inherit; white-space: normal; }
.rte textarea { border: 0; border-radius: 0 0 10px 10px; width: 100%; }
.mail-preview { width: 100%; height: 22rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; resize: vertical; }
.side .foot a.me-link { color: inherit; text-decoration: none; }
.side .foot a.me-link:hover { text-decoration: underline; }

/* Responsive: pantallas grandes aprovechan el ancho; en el móvil las tablas pasan a tarjetas. */
@media (min-width: 1200px) { main { padding-left: 32px; padding-right: 32px; } }
.chips .tag, .kv dd .tag { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .table-wrap { overflow: visible; margin: 0; }
  .table-wrap table { min-width: 0 !important; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tbody tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .table-wrap tbody tr:last-child { border-bottom: none; }
  .table-wrap td { display: block; padding: 3px 0; border: none; text-align: right; overflow-wrap: anywhere; }
  .table-wrap td::after { content: ""; display: block; clear: both; }
  .table-wrap td::before { content: attr(data-label); float: left; max-width: 45%; margin-right: 12px; color: var(--muted); font-size: 0.8rem; line-height: 1.6; text-align: left; }
  .table-wrap td:not([data-label])::before, .table-wrap td[data-label=""]::before { content: none; }
  .table-wrap td:first-child { display: block; text-align: left; font-size: 1rem; }
  .table-wrap td:first-child::before { content: none; }
  .table-wrap td:not([data-label]) { text-align: left; }
  .table-wrap td .actions { justify-content: flex-start; flex-wrap: wrap; }
  .table-wrap tr.sub-row { padding-left: 14px; border-left: 3px solid var(--line); }
}

/* Gráficos: el texto del SVG escala con el ancho. En grande se limita; en el móvil se desplazan de lado. */
.chart.hbar { max-width: 900px; }
.chart.hbar.compact { max-width: 560px; }
.chart svg { max-height: 340px; }
@media (max-width: 760px) {
  .chart:not(.hbar) { overflow-x: auto; overscroll-behavior-x: contain; }
  .chart:not(.hbar) svg { min-width: 640px; }
  .chart.hbar svg { min-width: 0; }
}
details.rev ul.rev-items { padding-left: 0; color: inherit; font-size: inherit; }

/* Prueba de correo: avisos de configuración */
.alert-bar.warn-bar { border-color: var(--warn); background: var(--warn-soft); }
.alert-bar.warn-bar .icon { background: var(--warn); }
.warn-list { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }

/* Etiquetas de clientes */
.tag.label { font-family: var(--font-body); font-size: 0.75rem; background: var(--accent-soft); color: var(--accent); }
button.tag.label { border: none; cursor: pointer; }
button.tag.label:hover { filter: brightness(0.95); }
.tag-row { margin-top: 4px; }
.tag-editor { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; background: var(--surface); }
.tag-editor .input { border: none; flex: 1 1 12rem; min-width: 8rem; padding: 4px; background: transparent; }
.tag-editor .input:focus { outline: none; }
.tag-editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tag-x { border: none; background: none; color: inherit; cursor: pointer; padding: 0 0 0 4px; font-size: 0.9rem; line-height: 1; }

/* Iconos de acción de las tablas en una sola línea (en el móvil, las tarjetas ya los reparten) */
@media (min-width: 761px) { .table-wrap td .actions { flex-wrap: nowrap; } }

/* Respuesta de los botones: al pasar el ratón cambian de color y al pulsar se hunden un poco. */
.btn, .choice, .seg button, button.tag.label, .tag-x, th.sortable, .nav a {
  transition: background-color .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease, transform .08s ease, filter .12s ease;
}
.btn:not(:disabled):hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); box-shadow: 0 1px 3px rgb(0 0 0 / .08); }
.btn.primary:not(:disabled):hover { background: var(--accent); color: var(--accent-ink); filter: brightness(.9); box-shadow: 0 2px 8px rgb(0 124 153 / .3); }
.btn.danger:not(:disabled):hover { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.btn.danger.armed:not(:disabled):hover { background: var(--bad); color: #fff; filter: brightness(.92); }
.side .foot .btn:not(:disabled):hover { background: rgba(255,255,255,.08); }
.btn:not(:disabled):active, .choice:not(:disabled):active, .seg button:not(:disabled):active, button.tag.label:active { transform: translateY(1px) scale(.97); box-shadow: none; }
.btn.primary:not(:disabled):active { filter: brightness(.8); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.choice:not(:disabled):not(.on):hover { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.choice.on:not(:disabled):hover { filter: brightness(.92); }
.seg button:not([aria-pressed="true"]):not(:disabled):hover { background: var(--surface-2); color: var(--ink); }
.seg button:disabled { opacity: .5; cursor: not-allowed; }
.tag-x:hover { color: var(--bad); }
@media (prefers-reduced-motion: reduce) {
  .btn:active, .choice:active, .seg button:active, button.tag.label:active { transform: none; }
}

/* Selección y acciones en bloque */
th.sel, td.sel { width: 36px; padding-right: 0; }
td.sel input, th.sel input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.bulk-bar { position: sticky; top: 8px; z-index: 6; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  background: var(--navy, #2E1F5E); color: #fff; border-radius: 12px; padding: 10px 14px; box-shadow: 0 6px 18px rgb(0 0 0 / .18); }
.bulk-bar[hidden] { display: none; }
.bulk-bar .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.bulk-bar .btn:not(:disabled):hover { background: rgba(255,255,255,.12); color: #fff; border-color: #fff; }
.bulk-bar select.input { width: auto; color: #1E2A38; background-color: #fff; }
.bulk-bar input.input { color: #1E2A38; background-color: #fff; }
@media (min-width: 761px) { .bulk-bar input.input { width: 20rem; } }
.bulk-bar .muted { color: rgba(255,255,255,.8); }
/* Remesa SEPA: «Cobro el [fecha]» dentro de la barra. */
.bulk-bar .inline-field { display: inline-flex; align-items: center; gap: 6px; }
.bulk-bar .inline-field input.input { width: auto; }
@media (max-width: 760px) {
  .table-wrap td.sel { position: absolute; right: 0; top: 10px; width: auto; }
  .table-wrap tbody tr { position: relative; }
  .bulk-bar { top: 108px; }
  /* La casilla va arriba a la derecha: que no tape el valor de la primera celda. */
  .table-wrap td.sel + td { padding-right: 36px; }
}

/* Editor de contrato encima de la tabla */
.sub-editor { border: 1px solid var(--accent); border-radius: 12px; padding: 14px 16px; margin: 4px 0 14px; background: var(--surface); }

/* Horas de Toggl */
.match-cell { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.match-cell select, .match-cell input { min-width: 12rem; flex: 1; }
.rate-view { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }
.rate-edit { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.rate-edit .input { width: 7rem; }

/* Adjuntos de los correos */
.att-actions { justify-content: flex-start; }
.att-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.att-list[hidden] { display: none; }
.att-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .88rem; }
.att-list .att-name { overflow-wrap: anywhere; font-weight: 600; }
.att-list .btn { padding: 2px 10px; font-size: .8rem; margin-left: auto; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; text-align: left; overflow-wrap: anywhere; }

/* CC y CCO: pasar una dirección de «Para» a CC o CCO */
.move-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.move-row[hidden] { display: none; }
.move-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: .82rem; max-width: 100%; }
.btn.mini { padding: 1px 8px; font-size: .75rem; border-radius: 999px; }
.tag.match-chip { font-family: var(--font-body); white-space: normal; display: inline-block; }

/* Horas: selector de mes y estado de cada registro */
.month-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.month-nav .month-title { margin: 0 4px; min-width: 11rem; text-align: center; font-size: 1.15rem; }
.month-nav > .btn:first-child, .month-nav > .month-title + .btn { min-width: 2.4rem; font-size: 1.1rem; }
tr.selected td { background: var(--accent-soft); }

/* Filtro con muchas opciones (estado de las renovaciones): en el móvil, rejilla de 3 columnas en vez de salirse de la pantalla. */
@media (max-width: 760px) {
  .seg.seg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); width: 100%; }
  .seg.seg-grid button { background: var(--surface); border-left: none; }
  .seg.seg-grid button[aria-pressed="true"] { background: var(--accent-soft); }
}

/* Revisión: enlaces para arreglarlo en la ficha y qué hace cada opción */
.rev-links { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .86rem; }
.rev-links a { color: var(--accent); font-weight: 600; }
.rev-help { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: .8rem; color: var(--muted); }
.rev-help b { color: var(--ink); font-weight: 600; }
tr.focus td { background: var(--accent-soft); }

/* Cajas plegables de Cashflow */
details.fold > summary.fold-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; cursor: pointer; list-style: none; }
details.fold > summary.fold-head::-webkit-details-marker { display: none; }
details.fold > summary.fold-head::before { content: "▸"; color: var(--muted); transition: transform .15s; display: inline-block; }
details.fold[open] > summary.fold-head::before { transform: rotate(90deg); }
details.fold > summary.fold-head h2 { margin: 0; }
details.fold[open] > summary.fold-head { margin-bottom: 12px; }
.fold-actions { display: flex; justify-content: flex-end; margin-bottom: 8px; }
@media (prefers-reduced-motion: reduce) { details.fold > summary.fold-head::before { transition: none; } }
button.link { background: none; border: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-align: left; }
button.link:hover { text-decoration: underline; }

/* Acciones de cada contrato en la ficha: en dos filas de iconos para que no se salgan de la tarjeta. */
@media (min-width: 761px) { .table-wrap td .actions.sub-actions { flex-wrap: wrap; justify-content: flex-end; width: 4.9rem; margin-left: auto; } }
@media (min-width: 761px) { .table-wrap td .actions.sub-actions:has(.btn:not(.icon)) { width: auto; } }

.sub-actions > * { flex: none; }
a.tag-link { text-decoration: none; color: var(--accent, #6D28D9); }
a.tag-link:hover { text-decoration: underline; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.join-hint { font-size: .82rem; margin-top: 2px; }
.btn.icon.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* ---------- Menú: el logo lleva a Inicio y los grupos destacan sobre sus secciones ---------- */
a.brand { color: inherit; text-decoration: none; border-radius: 10px; padding: 4px 8px; margin: -4px 0; }
a.brand:hover { text-decoration: none; background: rgba(255,255,255,.07); }
a.brand[aria-current="page"] strong { color: #fff; }
.nav .nav-group { font-family: var(--font-display); font-size: 0.98rem; font-weight: 800; letter-spacing: -0.01em; text-transform: none; color: var(--on-navy); margin-top: 12px; }
.nav .nav-group:disabled { color: var(--on-navy); }
.nav-sec .nav-items a { padding-left: 22px; font-size: 0.93rem; }

/* ---------- Inicio: cajas que se ordenan entre columnas ---------- */
.home-col { display: grid; gap: 16px; align-content: start; min-height: 120px; border-radius: 14px; }
.home-col.drop { outline: 2px dashed var(--line); outline-offset: 6px; }
.home-box.dragging { opacity: .45; }
.home-box .panel-head h2 { margin-right: auto; }
.grip { flex: none; align-self: center; width: 22px; height: 22px; margin: -2px 0 -2px -6px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: grab; display: grid; place-items: center; opacity: .55; }
.grip span { width: 8px; height: 12px; background: radial-gradient(circle, currentColor 1.2px, transparent 1.6px) 0 0 / 4px 4px; }
.home-box:hover .grip, .grip:focus-visible { opacity: 1; }
.grip:hover { background: var(--surface-2); }
.grip:active { cursor: grabbing; }
.home-reset { justify-self: end; font-size: 0.82rem; }
@media (max-width: 980px) { .grip, .home-reset { display: none; } .home-col { min-height: 0; } .home-col.drop { outline: none; } }
@media (max-width: 760px) { a.brand { margin: 0; } }
.nav > a { font-family: var(--font-display); font-size: 0.98rem; font-weight: 800; letter-spacing: -0.01em; color: var(--on-navy); margin-top: 4px; }
@media (max-width: 760px) { .nav > a { font-family: inherit; font-size: inherit; font-weight: 600; margin-top: 0; color: var(--on-navy-muted); } .nav-sec .nav-items a { padding-left: 10px; font-size: inherit; } }

/* ---------- Conectores: un botón grande por servicio ---------- */
.connector { align-content: start; align-self: start; }
.connector .kv { grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); }
.btn.btn-big { justify-self: stretch; justify-content: center; padding: 14px 18px; font-size: 1.05rem; font-weight: 700; border-radius: 12px; }
.muted.small { font-size: 0.85rem; margin: -4px 0 0; }
.ok-msg { color: var(--ok, #15803D); background: var(--ok-soft, #E7F6EC); border-radius: 10px; padding: 8px 12px; margin: 0; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); margin-top: 6px; overflow: hidden; max-width: 16rem; }
.meter span { display: block; height: 100%; background: var(--cyan, #A78BFA); border-radius: inherit; }
.meter span.high { background: var(--bad); }
@media (max-width: 760px) { .connector .kv { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Integraciones: línea del cron para copiar ---------- */
.cron-line { display: flex; align-items: center; gap: 10px; margin: 6px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.cron-line code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 0.86rem; }

/* ---------- Conectores: registro de las tareas programadas ---------- */
.task-log { margin: 0; max-height: 28rem; overflow: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Hoja del cashflow (como el Excel): se desplaza de lado y la primera columna se queda fija.
   No usa .table-wrap, para que en el móvil no se convierta en tarjetas. */
.cf-sheet { overflow-x: auto; margin-top: 8px; width: 0; min-width: 100%; } /* no ensancha la página: se desplaza dentro */
table.cf-grid { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: .85rem; }
table.cf-grid th, table.cf-grid td { padding: 5px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.cf-grid thead th { font-size: .75rem; }
table.cf-grid tbody th { text-align: left; font-weight: 400; max-width: 16rem; overflow: hidden; text-overflow: ellipsis;
  text-transform: none; letter-spacing: normal; font-size: inherit; color: var(--ink); }
table.cf-grid tr.grp .link { font-size: inherit; }
table.cf-grid th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
table.cf-grid .fc { background: var(--accent-soft); }
table.cf-grid .tot { font-weight: 700; border-left: 1px solid var(--line); }
table.cf-grid tr.grp th, table.cf-grid tr.grp td { background: var(--surface-2); font-weight: 700; }
table.cf-grid tr.grp .link { font-weight: 700; color: var(--ink); }
table.cf-grid tr.grand th, table.cf-grid tr.grand td { font-weight: 700; border-top: 2px solid var(--line); }
@media (max-width: 760px) { table.cf-grid tbody th { max-width: 9rem; } }
/* Hoja: previsión pulsable, lo real debajo y validar meses. */
table.cf-grid .cf-fc { all: unset; display: inline-block; min-width: 2.2rem; min-height: 1.1em; text-align: right; cursor: pointer; padding: 0 2px; border-radius: 4px; font-variant-numeric: tabular-nums; }
table.cf-grid .cf-fc:hover, table.cf-grid .cf-fc:focus-visible { background: var(--surface-2); outline: 1px solid var(--accent); }
table.cf-grid .cf-fc.manual { color: var(--accent); font-weight: 700; text-decoration: underline dotted; }
table.cf-grid .real-under { font-size: .72rem; color: var(--muted); line-height: 1.1; }
table.cf-grid td.real { color: var(--ink); }
table.cf-grid .cf-edit { width: 5.5rem; padding: 2px 6px; text-align: right; font-size: .85rem; }
table.cf-grid .cf-val { display: block; margin: 3px 0 0 auto; padding: 1px 6px; font-size: .68rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--accent); cursor: pointer; text-transform: none; }
table.cf-grid .cf-val.on { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.cf-warn { margin: 6px 0; padding: 6px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: .85rem; }
table.cf-grid td.cf-chk { cursor: help; font-weight: 700; }
table.cf-grid td.cf-chk.warn { background: var(--warn-soft); color: var(--warn); }
table.cf-grid td.cf-chk.bad { background: var(--bad-soft); color: var(--bad); }

/* Conectores: una pestaña por servicio (#conectores/<servicio>), solo con el nombre; el estado va dentro. */
/* Como pestañas de carpeta: borde arriba y a los lados; la activa tapa la línea de abajo con el fondo de la página.
   Sin desplazamiento: si no caben, bajan de línea (con overflow salía una barra de scroll por el píxel de solape). */
.con-tabs { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px; padding: 0 2px; border-bottom: 1px solid var(--line); }
.con-tab { flex: none; padding: 9px 16px; margin-bottom: -1px; border: 1px solid var(--line); border-radius: 9px 9px 0 0; background: var(--surface-2);
  color: var(--muted); font-weight: 600; text-decoration: none; white-space: nowrap; }
.con-tab:hover { color: var(--ink); background: var(--surface); }
.con-tab[aria-current="page"] { color: var(--accent); background: var(--bg); border-bottom-color: var(--bg); }
/* Texto seguido (no flex): en el móvil se parte por palabras, no deja el «·» al principio de otra línea. */
.con-status { margin: 0; color: var(--muted); }
.con-status .dot { display: inline-block; margin-right: 6px; vertical-align: 0.05em; }
.con-status strong { color: var(--ink); }
.dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
@media (max-width: 760px) {
  .con-tabs { row-gap: 0; }
  .con-tab { padding: 8px 11px; }
}
/* En una columna de .grid-2 no caben etiqueta y campo lado a lado: uno encima de otro. */
.grid-2 .setting { grid-template-columns: minmax(0, 1fr); }

/* Ficha → Datos → «Enlazar con Holded» */
.billing-link { margin-top: 12px; display: grid; gap: 8px; min-width: 0; }
.billing-link > .btn { justify-self: start; }
.billing-link h3 { margin: 8px 0 0; font-size: 0.95rem; }
.blink-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.blink-list li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.blink-list li .muted { font-size: 0.85rem; overflow-wrap: anywhere; }
/* Correo enviado abierto desde el registro de Conectores → Correo. */
.email-view { display: grid; gap: 10px; }
.email-view .kv { grid-template-columns: minmax(0, 7rem) minmax(0, 1fr); }
.email-view dd { overflow-wrap: anywhere; }
.email-body { white-space: pre-line; overflow-wrap: anywhere; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); max-height: 60vh; overflow-y: auto; }

/* Desplegables: el mismo aspecto que los campos de texto, con flecha propia (sin la del sistema) */
select, select.input {
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--line); border-radius: 10px; background-color: var(--surface); color: var(--ink);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
  padding: 8px 32px 8px 11px; font-weight: 400; line-height: 1.3; cursor: pointer; max-width: 100%;
}
select:hover:not(:disabled) { border-color: var(--faint); }
select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
select:disabled { background-color: var(--surface-2); color: var(--muted); cursor: not-allowed; }
select option { color: var(--ink); background-color: var(--surface); }
/* En las barras de filtros, a la altura de los botones y del buscador */
.toolbar select, .ovh-filters select { width: auto; padding-top: 6px; padding-bottom: 6px; font-size: 0.88rem; }
table.sheet select.cell { padding: 5px 26px 5px 8px; background-position: calc(100% - 13px) 52%, calc(100% - 8px) 52%; }
/* Ficha del cliente: las mismas pestañas que Conectores, con un recuento pequeño (lo pendiente de facturar, los presupuestos sin respuesta…). */
.tab-count { display: inline-block; min-width: 1.4em; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  color: var(--muted); font-size: .75rem; line-height: 1.4; text-align: center; }
.con-tab[aria-current="page"] .tab-count { color: var(--accent); border-color: currentColor; }

/* Cobros: las dadas por perdidas, al final, plegadas y discretas. */
.lost-box { margin-top: 4px; font-size: .9rem; }
.lost-box summary { cursor: pointer; width: fit-content; padding: 4px 0; }
.lost-box[open] { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
/* Hoja: el nombre de una línea abre su ventana (renombrar, categoría, archivar). */
table.cf-grid .cf-line { color: var(--ink); text-decoration: none; text-align: left; }
table.cf-grid .cf-line:hover, table.cf-grid .cf-line:focus-visible { text-decoration: underline; }
/* Presupuestos: proyecto, «En curso» y «Terminado» bajan de línea en vez de salirse de la tabla. */
@media (min-width: 761px) { .table-wrap td .actions.est-actions { flex-wrap: wrap; min-width: 10rem; } }

/* Proponer contratos: la tabla de líneas necesita más ancho que una ventana normal. */
.modal.pp-modal { max-width: 78rem; }
.pp-table td { vertical-align: top; }
.pp-table select, .pp-table input { min-width: 0; }
.pp-why { display: block; }
.pp-table td:nth-child(2) select { min-width: 7.5rem; }
.pp-table td:nth-child(3) select { min-width: 12rem; }
.pp-table td:nth-child(4) select { min-width: 5rem; }

/* Filtros en desplegable con su nombre encima (Por facturar). */
.filter { display: flex; flex-direction: column; gap: 3px; }
.filter > span { font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.toolbar.filters { align-items: flex-end; gap: 10px 12px; }
.toolbar.filters select { max-width: 22rem; }
@media (max-width: 760px) {
  .toolbar.filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .toolbar.filters select { width: 100%; }
}

/* ======================= Kobi Tareas ======================= */
.nav-label { margin-top: 14px; padding: 4px 10px; font-size: 0.7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--on-navy-muted); }
.nav-empty { padding: 4px 10px; font-size: 0.85rem; color: var(--on-navy-muted) !important; }
.nav .nav-group { margin-top: 2px; text-transform: none; letter-spacing: 0; font-size: 0.92rem; color: var(--on-navy); }
.nav .nav-group:hover:not(:disabled) { background: rgba(255,255,255,.07); }
.nav .nav-group .chev { border-color: var(--on-navy-muted); }
.nav .nav-items a { padding-left: 28px; font-weight: 500; }
.space-dot { flex: none !important; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.nav-add { border: 0; background: none; color: var(--cyan); font: inherit; font-size: 0.85rem; font-weight: 600; padding: 5px 10px 5px 28px; text-align: left; cursor: pointer; border-radius: 8px; }
.nav > .nav-add { padding-left: 10px; }
.nav-add:hover { background: rgba(255,255,255,.07); }
.side .foot a { color: var(--cyan); }

.error { color: var(--bad); }
.bad-text { color: var(--bad); }
.btn.danger { color: var(--bad); border-color: var(--bad-soft); }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.btn.icon { padding: 4px 6px; display: inline-grid; place-items: center; }
.linklike { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; padding: 0; cursor: pointer; text-align: left; }
.linklike:hover { text-decoration: underline; }
.mono, .code { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); white-space: nowrap; }

/* Estados de tarea */
.pill.st-todo { background: var(--surface-2); color: var(--muted); }
.pill.st-doing { background: var(--info-soft); color: var(--info); }
.pill.st-waiting { background: var(--warn-soft); color: var(--warn); }
.pill.st-review { background: var(--accent-soft); color: var(--accent); }
.pill.st-done { background: var(--ok-soft); color: var(--ok); }
.pill.st-cancelled { background: var(--surface-2); color: var(--faint); text-decoration: line-through; }
.prio { font-size: 0.72rem; font-weight: 700; padding: 1px 7px; border-radius: 6px; white-space: nowrap; }
.prio-urgent { background: var(--bad); color: #fff; }
.prio-high { background: var(--bad-soft); color: var(--bad); }
.prio-low { background: var(--surface-2); color: var(--muted); }
.bill { font-size: 0.72rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--ok-soft); color: var(--ok); }
.due { font-size: 0.8rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.due.soon { color: var(--warn); font-weight: 600; }
.due.bad { color: var(--bad); font-weight: 600; }
.avatars { display: inline-flex; }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 0.66rem; font-weight: 700; display: inline-grid; place-items: center; border: 2px solid var(--surface); }
.avatar + .avatar { margin-left: -7px; }

/* Alta rápida y listas de Mis tareas */
.quick-add { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-add input { flex: 1 1 18rem; min-width: 0; }
.quick-add select { flex: 0 1 16rem; min-width: 0; }
input[type=text], input[type=email], input[type=url], input[type=search], input[type=number], input[type=date], textarea, select { border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 7px 10px; min-width: 0; }
textarea { width: 100%; resize: vertical; font: inherit; }
.task-rows { list-style: none; margin: 0; padding: 0; display: grid; }
.task-row { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 8px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; border-radius: 6px; }
.task-rows li:last-child .task-row { border-bottom: 0; }
.task-row:hover { background: var(--surface-2); }
.task-row .title { font-weight: 500; overflow-wrap: anywhere; }
.task-row .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.task-row .proj { font-size: 0.8rem; }

/* Tablero */
.kboard { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(14rem, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; overscroll-behavior-x: contain; }
.kcol { background: var(--surface-2); border-radius: 12px; padding: 10px; display: grid; grid-template-rows: auto 1fr; gap: 8px; min-height: 12rem; min-width: 0; }
.kcol-head { display: flex; justify-content: space-between; align-items: center; }
.kcol-cards { display: grid; gap: 8px; align-content: start; min-height: 4rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; display: grid; gap: 6px; cursor: pointer; box-shadow: var(--shadow-sm); }
.card:hover, .card:focus-visible { border-color: var(--accent); }
.card.dragging { opacity: .45; }
.card-top, .card-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-foot { font-size: 0.8rem; }
.card-foot .avatars { margin-left: auto; }
.card-title { font-weight: 500; overflow-wrap: anywhere; }
.card-wait { font-size: 0.8rem; color: var(--warn); }
.drop-mark { height: 4px; border-radius: 4px; background: var(--accent); }

/* Lista */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 10px; align-items: end; }
.field { display: grid; gap: 4px; font-size: 0.85rem; font-weight: 600; color: var(--muted); min-width: 0; }
.field > input, .field > select, .field > textarea { color: var(--ink); font-weight: 400; width: 100%; }
.field.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; }
fieldset.field { border: 0; padding: 0; margin: 0; }
.checks { display: grid; gap: 6px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--ink); }
table.tasks td.sel, table.tasks th.sel { width: 2rem; }
.row-title { font-weight: 500; }

/* Ficha lateral */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(20, 14, 42, .38); z-index: 9; opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: env(safe-area-inset-top, 0px); right: 0; bottom: 0; width: min(42rem, 100vw); background: var(--surface); box-shadow: -12px 0 40px rgba(20, 14, 42, .22); z-index: 10; overflow-y: auto; overscroll-behavior: contain;
  padding: 0 24px calc(32px + env(safe-area-inset-bottom, 0px)); display: grid; align-content: start; gap: 16px;
  border-radius: 18px 0 0 18px; transform: translateX(104%); visibility: hidden;
  transition: transform .32s cubic-bezier(.22, .9, .3, 1), visibility 0s linear .32s; }
.drawer.open { transform: none; visibility: visible; transition: transform .32s cubic-bezier(.22, .9, .3, 1), visibility 0s; }
@media (prefers-reduced-motion: reduce) { .drawer, .drawer.open, .drawer-backdrop { transition: none; } }
.drawer-head { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 -24px; padding: 14px 24px 12px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.drawer-head .toolbar { gap: 4px; }
.drawer-crumb { font-size: 0.85rem; min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.drawer-crumb .code { background: var(--accent-soft, var(--surface-2)); color: var(--accent, var(--ink)); font-weight: 600; padding: 3px 9px; border-radius: 99px; font-size: 0.8rem; }
.drawer-title { font-size: 1.45rem; line-height: 1.25; outline: none; border-radius: 8px; padding: 4px 6px; margin: 4px -6px 0; overflow-wrap: anywhere; }
.drawer-title[contenteditable]:hover, .drawer-title[contenteditable]:focus { background: var(--surface-2); }
.drawer .props { background: var(--surface-2); border-radius: 14px; padding: 14px 16px; }
.drawer .block { border-top: 0; padding-top: 0; }
.drawer .block h3 { display: flex; align-items: center; gap: 8px; }
.drawer .block h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.drawer details.block > summary { cursor: pointer; font-size: 0.85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.wait-note { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 6px 10px; font-size: 0.9rem; }
.props { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.props .field.check { align-self: end; justify-content: flex-start; padding-bottom: 8px; }
.block { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.block h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 3px 11px; font: inherit; font-size: 0.85rem; cursor: pointer; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip.add { border-style: dashed; color: var(--accent); }
.chip:disabled { cursor: default; }
.rich { overflow-wrap: anywhere; }
.rich p { margin: 0 0 .6em; }
.rich p:last-child { margin-bottom: 0; }
.rich ul, .rich ol { margin: 0 0 .6em; padding-left: 1.3em; }
.desc { display: grid; gap: 8px; justify-items: start; }
.desc textarea { justify-self: stretch; }
.sub-list, ul.plain, .comments, .history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sub-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
ul.plain li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; overflow-wrap: anywhere; }
.inline-add { display: flex; gap: 8px; }
.inline-add input { flex: 1; }
.comment { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: grid; gap: 4px; }
.comment-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 0.88rem; }
.comment-head .btn.icon { margin-left: auto; }
.comment-form { display: grid; gap: 8px; }
.comment-form .toolbar { justify-content: space-between; }
.comment-form input[type=file] { font-size: 0.8rem; max-width: 100%; }
.history summary { cursor: pointer; font-size: 0.85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.history-list { font-size: 0.86rem; margin-top: 8px; }

/* Ventanas */
.dlg { border: 0; border-radius: 14px; padding: 0; width: min(32rem, calc(100vw - 32px)); box-shadow: var(--shadow); background: var(--surface); color: var(--ink); }
.dlg.wide { width: min(46rem, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(14, 24, 38, .45); }
.dlg-form { display: grid; gap: 14px; padding: 18px 20px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dlg-body { display: grid; gap: 12px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.dlg-actions .danger { margin-right: auto; }
.copy-box { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.copy-box code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: 0.82rem; }

@media (max-width: 760px) {
  .task-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .task-row .meta { justify-content: flex-start; }
  .kboard { grid-auto-columns: minmax(78vw, 1fr); }
  .props { grid-template-columns: minmax(0, 1fr); }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drawer { padding: 0 16px calc(32px + env(safe-area-inset-bottom, 0px)); border-radius: 0; }
  .drawer-head { margin: 0 -16px; padding: 12px 16px 10px; }
  table.tasks thead { display: none; }
  table.tasks, table.tasks tbody, table.tasks tr, table.tasks td { display: block; width: 100%; }
  table.tasks tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.tasks td { border: 0; padding: 2px 0; }
  table.tasks td:empty { display: none; }
  table.tasks td[data-label]::before { content: attr(data-label) " · "; color: var(--muted); font-size: 0.78rem; }
  table.tasks td.n { text-align: left; }
}
.bulk-bar select { color: #1E2A38; background-color: #fff; }

/* Avisos */
.task-row.notice.read { opacity: .6; }
.task-row.notice:not(.read) .title { font-weight: 600; }

/* Calendario */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 4px; }
.cal-day { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-height: 6.5rem; padding: 6px; display: grid; align-content: start; gap: 3px; min-width: 0; }
.cal-day.empty { background: transparent; border-color: transparent; }
.cal-day.past { background: var(--surface-2); }
.cal-day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-num { font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.cal-day.today .cal-num { color: var(--accent); }
.cal-task { display: block; width: 100%; border: 0; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 5px; padding: 2px 5px; font: inherit; font-size: 0.75rem; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; color: var(--ink); }
.cal-task.st-done, .cal-task.st-cancelled { opacity: .55; text-decoration: line-through; border-left-color: var(--ok); }
.cal-task.st-waiting { border-left-color: var(--warn); background: var(--warn-soft); }
@media (max-width: 760px) {
  .cal { gap: 3px; }
  .cal-head { font-size: 0.65rem; padding: 0; text-align: center; letter-spacing: 0; }
  .cal-day { min-height: 3.4rem; padding: 4px 3px; border-radius: 8px; gap: 2px; cursor: pointer; }
  .cal-day .cal-task, .cal-day > .muted { display: none; }
  .cal-num-row { flex-direction: column; align-items: center; gap: 1px; }
  .cal-hours { font-size: 0.6rem; padding: 0 4px; }
}
.field.check > input[type=checkbox] { width: auto; flex: none; }

/* Cronómetro */
.timer-chip { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; background: rgba(167,139,250,.18); color: var(--on-navy); }
.timer-chip .linklike { color: var(--on-navy); font-family: var(--font-mono); font-size: 0.82rem; }
.timer-chip .timer-clock { margin-left: auto; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.btn.stop { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.stop:hover, .btn.stop:not(:disabled):hover { background: var(--bad); border-color: var(--bad); color: #fff; filter: brightness(1.1); }
.timer-chip .btn.stop { padding: 2px 8px; }
.task-row.running { background: var(--accent-soft); }
div.task-row { cursor: default; }

/* Listados de espacios y proyectos, e informes de horas */
.archived-row td { opacity: .6; }
.small { font-size: 0.85rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 10px; }
.kpi { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; display: grid; gap: 2px; }
.kpi span { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kpi strong { font-size: 1.15rem; }
.report { display: grid; gap: 2px; margin-top: 12px; }
.rrow > summary { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(4rem, 1fr) auto; gap: 12px; align-items: center; padding: 9px 6px; border-radius: 8px; cursor: pointer; list-style: none; }
.rrow > summary::-webkit-details-marker { display: none; }
.rrow > summary:hover { background: var(--surface-2); }
.rname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rnum { white-space: nowrap; text-align: right; }
.rbar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.rbar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.rsub { list-style: none; margin: 0 0 8px; padding: 0 6px 0 22px; display: grid; gap: 4px; font-size: 0.9rem; }
.rsub li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding: 3px 0; }
@media (max-width: 760px) { .rrow > summary { grid-template-columns: minmax(0, 1fr) auto; } .rbar { grid-column: 1 / -1; grid-row: 2; } }
.timer-chip .chip-edit { padding: 2px 8px; min-height: 0; background: transparent; color: inherit; border-color: transparent; }
.timer-chip .chip-edit:hover { background: rgba(255,255,255,.12); }

/* Inicio */
.hero { position: relative; overflow: hidden; border-radius: 20px; padding: 26px 28px; color: #fff; display: grid; gap: 18px;
  background: radial-gradient(120% 140% at 100% 0%, #7C3AED 0%, transparent 55%), linear-gradient(135deg, #2E1F5E 0%, #4C2A9A 100%); box-shadow: 0 10px 30px rgba(46,31,94,.25); }
.hero::after { content: ""; position: absolute; right: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%; background: rgba(167,139,250,.18); }
.hero h1 { color: #fff; font-size: 1.9rem; margin: 2px 0 4px; }
.hero p { margin: 0; color: rgba(255,255,255,.85); }
.hero-date::first-letter { text-transform: uppercase; }
.hero-date { font-size: 0.85rem; letter-spacing: .03em; color: #C4B5FD !important; font-weight: 600; }
.hkpis { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: 10px; }
.hkpi { display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); color: #fff; text-decoration: none; transition: background .15s, transform .15s; }
.hkpi:hover { background: rgba(255,255,255,.18); transform: translateY(-1px); text-decoration: none; }
.hkpi strong { font-size: 1.5rem; line-height: 1.1; font-family: var(--font-display); }
.hkpi span { font-size: 0.8rem; color: rgba(255,255,255,.8); }
.hkpi.bad { background: rgba(239,68,68,.28); border-color: rgba(252,165,165,.5); }
.hkpi.warn { background: rgba(245,158,11,.25); border-color: rgba(252,211,77,.45); }
.hgrid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.hcol { display: grid; gap: 18px; min-width: 0; }
.hcard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow-sm); display: grid; gap: 10px; min-width: 0; }
.hcard-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.hcard-head h2 { font-size: 1.02rem; margin: 0; }
.hlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.hnotice { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; background: none; border: 0; padding: 8px; border-radius: 10px; cursor: pointer; color: var(--ink); font: inherit; }
.hnotice:hover { background: var(--surface-2); }
.hn-icon { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 0.85rem; }
.hrun { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 4px; }
.hrun .linklike { text-align: left; }
.htl { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.htl > li { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 24px; position: relative; padding: 6px 0 10px; }
.htl > li::before { content: ""; position: absolute; left: 6.5rem; margin-left: 11px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.htl > li::after { content: ""; position: absolute; left: 6.5rem; margin-left: 5px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.htl > li.now::after { background: var(--accent); }
.htl > li.past::after { border-color: var(--bad); }
.tl-day { display: grid; align-content: start; text-align: right; padding-top: 4px; font-size: 0.9rem; }
.tl-day strong::first-letter { text-transform: uppercase; }
.tl-day span { font-size: 0.78rem; }
.tl-items { display: grid; gap: 4px; min-width: 0; }
.tl-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; border-radius: 10px; padding: 6px 8px; cursor: pointer; color: var(--ink); font: inherit; text-decoration: none; min-width: 0; }
.tl-item:hover { background: var(--surface-2); text-decoration: none; }
.tl-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-item.milestone { background: var(--accent-soft); }
.tl-item .flag { color: var(--accent); }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 12px; }
.pcard { display: grid; gap: 8px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; transition: box-shadow .15s, transform .15s, border-color .15s; }
.pcard:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--accent); text-decoration: none; }
.pcard-top { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.pcard-space { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard-name { font-size: 1rem; }
.pbar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.pbar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #6D28D9, #A78BFA); }
.pcard-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 0.82rem; }
.pcard-foot > span:first-child { font-weight: 700; color: var(--accent); }
@media (max-width: 960px) { .hgrid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .tl-title { white-space: normal; } .hero { padding: 20px 18px; border-radius: 16px; } .hero h1 { font-size: 1.5rem; } .htl > li { grid-template-columns: 4.6rem minmax(0, 1fr); gap: 22px; } .htl > li::before, .htl > li::after { left: 4.6rem; } }
.hcard .task-row { grid-template-columns: auto minmax(0, 1fr); }
.hcard .task-row .meta { grid-column: 2; justify-content: flex-start; }
.nav-label-row { display: flex; justify-content: space-between; align-items: baseline; }
.nav-manage { font-size: 0.7rem; text-transform: none; letter-spacing: 0; color: var(--cyan); font-weight: 600; }

/* Formularios uniformes: todos los campos con el mismo aspecto, en ventanas, filtros y fichas */
:is(input:not([type]), input[type=text], input[type=email], input[type=url], input[type=search], input[type=number], input[type=password], input[type=tel],
  input[type=date], input[type=datetime-local], input[type=time], input[type=month], textarea, select) {
  font: inherit; font-size: 0.95rem; font-weight: 400; color: var(--ink); background-color: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-height: 42px; min-width: 0; box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s, background-color .15s; box-shadow: 0 1px 2px rgba(46,31,94,.04);
}
textarea { min-height: 84px; line-height: 1.45; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
:is(input:not([type]), input[type=text], input[type=email], input[type=url], input[type=search], input[type=number], input[type=password], input[type=tel],
  input[type=date], input[type=datetime-local], input[type=time], input[type=month], textarea, select):hover:not(:disabled):not(:focus) { border-color: var(--faint); }
:is(input:not([type]), input[type=text], input[type=email], input[type=url], input[type=search], input[type=number], input[type=password], input[type=tel],
  input[type=date], input[type=datetime-local], input[type=time], input[type=month], textarea, select):focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type=color] { width: 56px; height: 42px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.field { gap: 6px; font-size: 0.84rem; }
.field > span:first-child { color: var(--ink); font-weight: 600; }
.field > small { font-weight: 400; font-size: 0.8rem; line-height: 1.35; }
.field.check { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.field.check > span { font-weight: 500; }

/* Ventanas */
.dlg { border-radius: 18px; width: min(34rem, calc(100vw - 24px)); box-shadow: 0 24px 60px rgba(20,14,42,.28); }
.dlg[open] { animation: dlg-in .2s cubic-bezier(.22,.9,.3,1); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .dlg[open] { animation: none; } }
.dlg::backdrop { background: rgba(20, 14, 42, .42); backdrop-filter: blur(2px); }
.dlg-form { gap: 0; padding: 0; }
.dlg-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font-size: 1.15rem; margin: 0; }
.dlg-body { gap: 16px; padding: 18px 22px; max-height: calc(100vh - 190px); overflow-y: auto; }
.dlg-actions { padding: 14px 22px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 18px 18px; }
.dlg .error { margin: 0 22px; }
.brand-link { display: block; color: inherit; text-decoration: none; border-radius: 10px; }
.brand-link:hover { text-decoration: none; opacity: .9; }
/* Cronómetro en dos líneas: tarea arriba, reloj y botones abajo */
.timer-chip { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 2px 6px; padding: 7px 10px; }
.timer-chip .timer-task { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 6px; min-width: 0; padding: 0; border: 0; background: none; color: var(--on-navy); font: inherit; font-size: 0.84rem; text-align: left; cursor: pointer; }
.timer-chip .timer-task:hover .timer-title { text-decoration: underline; }
.timer-chip .timer-code { flex: none; font-family: var(--font-mono); font-size: 0.78rem; font-weight: 700; color: var(--cyan); }
.timer-chip .timer-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .9; }
.timer-chip .timer-clock { margin-left: 0; font-size: 0.95rem; }
.timer-chip .btn.stop, .timer-chip .chip-edit { min-height: 26px; padding: 0 8px; }
/* Buscador de tareas (formularios de tiempo) */
.picker { position: relative; }
.picker > input { width: 100%; }
.picker-list { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; max-height: 16rem; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(20,14,42,.18); }
.picker-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 7px 9px; border-radius: 8px; cursor: pointer; font-weight: 400; color: var(--ink); }
.picker-list li:hover, .picker-list li.active { background: var(--accent-soft); }
.picker-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-proj { font-size: 0.78rem; white-space: nowrap; }
.picker-list li.picker-empty { display: block; cursor: default; }
/* En una ventana, la lista del buscador va dentro del cuerpo (que se desplaza): así la ventana nunca se sale de la pantalla ni tapa el pie */
.dlg-body .picker-list { position: static; margin-top: 4px; max-height: 14rem; box-shadow: 0 6px 16px rgba(20,14,42,.12); }
.period-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.period-bar > .field { min-width: 12rem; }
.period-bar > .btn { min-height: 42px; }
.period-dates { display: flex; gap: 10px; flex-wrap: wrap; }
.period-dates[hidden] { display: none; }
/* Calendario: horas del día en el mes y vista de semana con el tiempo apuntado */
.cal-num-row { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.cal-num-row a { text-decoration: none; }
.cal-hours { font-size: 0.72rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 99px; padding: 0 6px; white-space: nowrap; }
.cal-hours-toggle { padding: 6px 10px; }
.wk-wrap { overflow: auto; max-height: calc(100vh - 210px); padding: 0; }
.wk { display: grid; grid-template-columns: 3.4rem repeat(7, minmax(6.5rem, 1fr)); min-width: 52rem; }
.wk-corner, .wk-head, .wk-allday-label, .wk-allday { position: sticky; background: var(--surface); z-index: 2; }
.wk-corner, .wk-head { top: 0; }
.wk-head { display: grid; justify-items: center; padding: 8px 4px 6px; border-bottom: 1px solid var(--line); font-size: 0.8rem; color: var(--muted); }
.wk-head strong { font-size: 1.15rem; color: var(--ink); line-height: 1.2; }
.wk-head small { color: var(--accent); font-weight: 700; }
.wk-head.today strong { color: #fff; background: var(--accent); border-radius: 99px; padding: 0 8px; }
.wk-allday-label { top: 62px; font-size: 0.7rem; color: var(--muted); padding: 6px 4px; text-align: right; border-bottom: 1px solid var(--line); }
.wk-allday { top: 62px; display: grid; gap: 3px; align-content: start; padding: 4px; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); min-height: 34px; min-width: 0; }
.wk-times { display: grid; }
.wk-time { font-size: 0.7rem; color: var(--faint); text-align: right; padding-right: 6px; transform: translateY(-0.45em); }
.wk-col { position: relative; border-left: 1px solid var(--line); min-width: 0; }
.wk-col.today { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.wk-line { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.wk-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--bad); z-index: 1; }
.wk-entry { position: absolute; left: 3px; right: 3px; display: grid; align-content: start; gap: 0; padding: 3px 6px; overflow: hidden; text-align: left; font: inherit; font-size: 0.72rem; line-height: 1.25;
  border: 0; border-left: 3px solid var(--faint); border-radius: 6px; background: var(--surface-2); color: var(--ink); cursor: pointer; box-shadow: var(--shadow-sm); }
.wk-entry.bill { border-left-color: var(--accent); background: var(--accent-soft); }
.wk-entry.running { outline: 2px solid var(--accent); }
.wk-entry span, .wk-entry small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-entry small { color: var(--muted); }
.wk-entry:hover { z-index: 3; box-shadow: var(--shadow); }
/* Espacios con sus proyectos como filas hijas */
tr.space-row td { background: var(--surface-2); font-weight: 600; border-top: 2px solid var(--line); }
tr.project-row td:first-child { padding-left: 14px; }
tr.project-row .tree { color: var(--faint); margin-right: 8px; font-family: var(--font-mono); }
tr.project-row .pill { margin-left: 8px; }
tr.add-row td { padding-top: 4px; padding-bottom: 10px; }
/* Tablero con columnas plegables */
.kboard { display: flex; align-items: stretch; }
.kboard > .kcol { flex: 1 0 14rem; }
.kcol-head-right { display: inline-flex; align-items: center; gap: 6px; }
.kcol-fold { border: 0; background: none; color: var(--faint); font-size: 1.05rem; line-height: 1; padding: 2px 6px; border-radius: 6px; cursor: pointer; }
.kcol-fold:hover { background: var(--surface); color: var(--ink); }
.kcol-folded { flex: 0 0 46px; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 0; border: 0; border-radius: 12px; background: var(--surface-2); cursor: pointer; font: inherit; color: var(--ink); min-height: 12rem; }
.kcol-folded:hover, .kcol-folded.drop-on { background: var(--accent-soft); }
.kcol-folded-label { writing-mode: vertical-rl; }
.kcol-folded-label .pill { padding: 9px 2px; }
.kcol-folded-count { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.bill-toggle { width: 28px; height: 28px; border-radius: 8px; border: 1px dashed var(--line); background: none; color: var(--faint); font-weight: 700; cursor: pointer; }
.bill-toggle:hover:not(:disabled) { border-color: var(--ok); color: var(--ok); }
.bill-toggle.on { border: 1px solid transparent; background: var(--ok-soft); color: var(--ok); }
.bill-toggle:disabled { cursor: default; }
th.c, td.c { text-align: center; }
/* Vista de día: una sola columna ancha, con el título entero en cada registro */
.wk.wk-day { grid-template-columns: 3.4rem minmax(0, 1fr); min-width: 0; }
.wk.wk-day .wk-entry { font-size: 0.82rem; right: 12px; }
a.wk-head { text-decoration: none; color: var(--muted); }
a.wk-head:hover strong { color: var(--accent); }
a.wk-head.today strong, a.wk-head.today:hover strong { color: #fff; }
/* En el día, cada registro en una sola línea (código, título y horas), que cabe aunque dure poco */
.wk.wk-day .wk-entry { display: flex; align-items: baseline; gap: 8px; padding-top: 4px; }
.wk.wk-day .wk-entry span { flex: 1; min-width: 0; }
.wk.wk-day .wk-entry small { flex: none; }
.nav a.nav-label-link { display: block; text-decoration: none; padding: 7px 10px; border-radius: 8px; }
.nav a.nav-label-link:hover, .nav a.nav-label-link[aria-current="page"] { background: rgba(255,255,255,.08); color: var(--on-navy); }
.nav a.nav-label.nav-label-link { margin-top: 14px; font-size: 0.7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--on-navy-muted); padding: 6px 10px; }
.nav a.nav-label.nav-label-link:hover, .nav a.nav-label.nav-label-link[aria-current="page"] { color: var(--on-navy); }
.role-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 10px; margin-bottom: 12px; }
.role-card { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; display: grid; gap: 4px; }
.role-card p { margin: 0; font-size: 0.88rem; }
.perm-yes { color: var(--ok); font-weight: 700; }

/* Foto y frase del día en Inicio (copiado de Kobi) */
.daily { position: relative; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.daily img { display: block; width: 100%; height: 100%; min-height: 160px; max-height: 240px; object-fit: cover; }
.daily-text { padding: 20px 52px 20px 24px; display: grid; gap: 6px; min-width: 0; }
.daily blockquote { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; line-height: 1.35; text-wrap: balance; }
.daily-orig { margin: 0; font-size: .85rem; font-style: italic; }
.daily-author { margin: 0; font-weight: 600; color: var(--accent); }
.daily-credit { margin: 4px 0 0; font-size: .78rem; }
.daily-close { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.daily-close:hover, .daily-close:focus-visible { border-color: var(--accent); }
@media (max-width: 760px) { .daily { grid-template-columns: 1fr; } .daily img { max-height: 200px; } .daily-text { padding: 16px 48px 18px 16px; } }
/* Etiquetas de la ficha: solo las que lleva, con × para quitarla */
.chip.on { display: inline-flex; align-items: center; gap: 4px; }
.chip-x { border: 0; background: none; color: inherit; font-size: 1rem; line-height: 1; padding: 0 2px; cursor: pointer; opacity: .7; }
.chip-x:hover { opacity: 1; }
.label-pick { max-height: 12rem; overflow-y: auto; }
/* Calendario en el móvil: puntos por tarea y lista del mes debajo */
.cal-dots { display: none; }
.cal-agenda { display: none; }
@media (max-width: 760px) {
  .cal-dots { display: flex; justify-content: center; gap: 3px; flex-wrap: wrap; }
  .cal-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
  .cal-dots i.st-done, .cal-dots i.st-cancelled { background: var(--ok); opacity: .6; }
  .cal-dots i.st-waiting { background: var(--warn); }
  .cal-agenda { display: grid; margin-top: 12px; }
  .cal-agenda h2 { font-size: 1rem; margin: 0 0 4px; }
  /* Barra superior compacta: logo, nombre y el botón del menú en una línea baja */
  /* El hueco de la barra de estado ya lo deja `top: env(safe-area-inset-top)`: aquí no se suma otra vez */
  .side { padding-top: 8px; padding-bottom: 8px; }
  /* La barra pegada arriba baja `top` (el hueco de la barra de estado); sin este margen, tapaba el título de la página */
  .app { padding-top: env(safe-area-inset-top, 0px); }
  .side .brand .mark { width: 28px; height: 28px; }
  .side .brand strong { font-size: 1rem; }
  .side .brand span { font-size: 0.72rem; }
  .menu-btn { width: 42px; height: 42px; padding: 0; justify-content: center; border-radius: 12px; }
}
/* Tablero en el móvil: una columna casi a lo ancho, que se pasa con el dedo y se ajusta sola */
@media (max-width: 760px) {
  .kboard { scroll-snap-type: x mandatory; gap: 10px; }
  .kboard > .kcol { flex: 0 0 84%; scroll-snap-align: start; }
  .kboard > .kcol-folded { scroll-snap-align: start; }
  .quick-add { gap: 8px; }
}
/* Espacios en el móvil: cada fila en dos líneas (nombre arriba; datos y botones abajo) */
@media (max-width: 760px) {
  table.spaces-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
  table.spaces-table td { display: inline-flex !important; align-items: baseline; gap: 4px; width: auto !important; padding: 0 !important; border: 0 !important; font-size: 0.85rem; }
  table.spaces-table td:first-child { flex: 1 0 100%; font-size: 0.95rem; flex-wrap: wrap; }
  table.spaces-table td[data-label]::before { content: attr(data-label) ":"; color: var(--faint); font-size: 0.72rem; font-weight: 600; flex: none; }
  table.spaces-table td:first-child::before { content: none; }
  table.spaces-table td.n:last-child { margin-left: auto; }
  table.spaces-table td:empty { display: none !important; }
  table.spaces-table tr.space-row { background: var(--surface-2); border-radius: 10px; border-bottom: 0; margin-top: 8px; padding: 10px; }
  table.spaces-table tr.space-row td { background: none; border: 0; }
  table.spaces-table tr.project-row td:first-child { padding-left: 4px !important; }
}
/* Móvil: la etiqueta de cada dato va delante, en línea (no encima del valor) */
@media (max-width: 760px) {
  table.spaces-table td[data-label]::before { position: static !important; display: inline !important; width: auto !important; margin: 0 2px 0 0 !important; transform: none !important; }
  /* Todas las tareas: cada tarea en tres líneas cortas, sin el nombre de cada columna */
  table.tasks tr { display: flex !important; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 10px 4px !important; }
  table.tasks td { display: inline-flex !important; align-items: center; width: auto !important; padding: 0 !important; border: 0 !important; }
  table.tasks td[data-label]::before { content: none !important; display: none !important; }
  table.tasks td[data-label="Tarea"] { flex: 1 0 100%; order: 2; font-weight: 500; }
  table.tasks td.sel, table.tasks td[data-label="Nº"] { order: 1; }
  table.tasks td[data-label="Facturable"] { order: 1; margin-left: auto; }
  table.tasks td:not(.sel):not([data-label="Nº"]):not([data-label="Tarea"]):not([data-label="Facturable"]) { order: 3; font-size: 0.82rem; }
}
.mlabel { display: none; }
@media (max-width: 760px) {
  table.spaces-table td[data-label]::before { content: none !important; display: none !important; }
  table.spaces-table .mlabel { display: inline; margin-right: 4px; color: var(--faint); font-size: 0.72rem; font-weight: 600; }
  table.spaces-table td { text-align: left !important; }
  table.tasks td.sel { position: static !important; }
  table.tasks td.sel input { position: static !important; }
}
/* Iniciador rápido: arriba del menú (sin nada en marcha) y en la cabecera de Inicio */
.timer-start { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0 0 10px; padding: 9px 12px; border: 1px dashed rgba(196,181,253,.55); border-radius: 10px; background: transparent; color: var(--on-navy); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.timer-start:hover, .timer-start:focus-visible { background: rgba(167,139,250,.18); border-style: solid; }
.timer-start .dot { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #A78BFA; color: #2E1F5E; font-size: .72rem; }
.hero-start { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.hero-start .btn { background: #fff; color: #2E1F5E; border-color: transparent; font-weight: 700; }
.hero-start .hero-go { padding: 10px 18px; font-size: 1rem; }
.quick-loose { display: grid; gap: 10px; }
@media (max-width: 760px) { .timer-start { margin: 0; } }
/* Cliente: selector con «+ Nuevo» y aviso de tiempos facturables sin cliente */
.client-pick { display: flex; gap: 8px; align-items: center; }
.client-pick > select { flex: 1; min-width: 0; }
.warn-box { border-color: #F5C2BE; background: #FFF5F4; color: var(--ink); }
.warn-box p { margin: 0; }
/* ---------- Campana de avisos (04/11/2026, como en Kobi): arriba a la derecha; en el móvil, en la barra junto al menú. */
main > .topbar { display: flex; justify-content: flex-end; margin: -14px 0 6px; }
.bell-wrap { position: relative; }
.bell-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; }
.bell-btn:hover { border-color: var(--accent); color: var(--accent); }
.bell-btn:focus-visible { outline: 2px solid #A78BFA; outline-offset: 2px; }
.bell-count { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #DC2626; color: #fff; font: 600 0.7rem/18px var(--font-mono, monospace); text-align: center; }
.bell-count[hidden], .bell-panel[hidden] { display: none; }
.bell-panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; width: min(380px, calc(100vw - 32px)); max-height: min(70vh, 520px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(20, 14, 42, .18); padding: 12px; display: grid; gap: 8px; text-align: left; }
.bell-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px; }
.bell-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.bell-list button { display: grid; gap: 2px; width: 100%; padding: 8px 10px; border: 0; border-left: 3px solid transparent; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.bell-list button:hover, .bell-list button:focus-visible { background: var(--surface-2); }
.bell-list li.unread button { background: var(--accent-soft); border-left-color: var(--accent); }
.bell-list li:not(.unread) strong { font-weight: 500; }
.bell-list span { color: var(--muted); font-size: 0.86rem; }
.bell-list small { font-size: 0.75rem; }
.side .bell-btn { width: 42px; height: 42px; background: transparent; color: var(--on-navy, #fff); border-color: rgba(255,255,255,.25); }
@media (max-width: 760px) {
  .side { grid-template-columns: minmax(0, 1fr) auto auto; }
  .bell-panel { position: fixed; top: calc(64px + env(safe-area-inset-top, 0px)); right: 16px; left: 16px; width: auto; }
}
.connector-form { padding: 0; max-height: none; overflow: visible; max-width: 40rem; }
.hrecent { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.hrecent:last-child { border-bottom: 0; }
.hr-what { display: grid; min-width: 0; }
.hr-what > :first-child { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hr-go { width: 34px; height: 34px; padding: 0; border-radius: 50%; color: var(--accent); }
