/* Evolutivo Work. Identidad visual 009a (inspirada en Stripe, sin su marca): la paleta de Evolutivo YA NO es la referencia.
   Todo color es una ficha de este :root; los componentes solo usan var(--…). Reglas y tabla: docs/CONVENCIONES.md. */
:root {
  /* Lienzo y superficies */
  --bg: #ffffff;
  --bg-soft: #f6f9fc;
  --bg-hover: #eef2f7;
  --bg-active: #e3e8ee;
  --bg-elev: #ffffff;
  --border: #e3e8ee;
  --border-strong: #c9d2dc;
  /* Texto */
  --title: #0a2540;
  --text: #0a2540;
  --text-chip: #2d3f55;
  --text-2: #425466;
  --text-3: #5b6b82;          /* tono ajustado por AA */
  /* Acción */
  --primary: #533afd;
  --primary-hover: #4434d4;
  --primary-press: #2e2b8c;
  --primary-soft: #eeebff;
  --on-primary-soft: #2e2b8c;
  --on-primary: #ffffff;
  /* Estados */
  --ok: #0e6b30;
  --ok-fill: #15be53;
  --danger: #df1b41;
  --danger-strong: #b8102f;
  --danger-soft: #fdecef;
  --warn: #9b6829;
  --warn-bg: #fdf3e3;
  --warn-text: #7a4f16;
  --neutral: #c1c9d2;
  --accent: #0e7490;
  --chart: #1f6feb;           /* barras de las gráficas (3c), validado: L, croma y 3:1 contra el fondo */
  --accent-2: #6b55f0;        /* tono ajustado por AA */
  --badge-admin: #2e2b8c;
  --progress-fill: #533afd;
  /* Prioridad (iconos y la Lista) */
  --prio-urgent: #df1b41;
  --prio-high: #b54708;
  --prio-medium: #533afd;
  --prio-low: #2e2b8c;
  --prio-off: #c1c9d2;
  /* Avatares (iniciales en blanco, todos ≥ 4.5:1) */
  --av-1: #533afd; --av-2: #0a2540; --av-3: #0e7490; --av-4: #6b55f0; --av-5: #b54708; --av-6: #2e2b8c; --av-7: #0e6b30;
  /* Barra del navegador en celular (meta theme-color) */
  --theme-bar: #533afd;
  --on-color: #ffffff;
  --toast-bg: #0a2540;
  --toast-text: #ffffff;
  --btn-danger: #b8102f;
  --btn-danger-hover: #930c25;
  --star-fill: #f5a623;
  --star-line: #9b6829;
  /* Barra lateral (clara) */
  --sidebar-bg: #f6f9fc;
  --sidebar-text: #0a2540;
  --sidebar-muted: #5b6b82;
  --sidebar-hover: #eaeff5;
  --sidebar-active: #eeebff;
  --sidebar-active-text: #2e2b8c;
  --sidebar-line: #e3e8ee;
  /* Forma y profundidad */
  --shadow: 0 2px 5px rgba(50, 50, 93, 0.1), 0 1px 1px rgba(0, 0, 0, 0.07);
  --shadow-pop: 0 2px 5px rgba(50, 50, 93, 0.1), 0 1px 1px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 13px 27px -5px rgba(50, 50, 93, 0.25), 0 8px 16px -8px rgba(0, 0, 0, 0.3);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px #533afd;
  --radius: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-pill: 4px;
  --sidebar-w: 236px;
  --panel-w: 520px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  /* Degradado de malla: solo inicio de sesión y cabecera de la vista pública (nunca en pantallas de trabajo) */
  --mesh-1: #533afd; --mesh-2: #7e6bfd; --mesh-3: #00d4ff; --mesh-4: #ff5996; --mesh-base: #f6f9fc;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #0a2540;
  --bg-soft: #0d2a4a;
  --bg-hover: #183a68;
  --bg-active: #1f4275;
  --bg-elev: #11305a;
  --border: #1f3c66;
  --border-strong: #2d4f80;
  --title: #ffffff;
  --text: #f6f9fc;
  --text-chip: #dde5ee;
  --text-2: #d3dde7;
  --text-3: #adbdcc;
  --primary: #9590ff;         /* tono ajustado por AA */
  --primary-hover: #a9a5ff;
  --primary-press: #c9c4ff;
  --primary-soft: #2a2a6e;
  --on-primary-soft: #d9d6ff;
  --on-primary: #0a2540;
  --ok: #4ade80;
  --ok-fill: #15be53;
  --danger: #ff7a93;
  --danger-strong: #ff9aad;
  --danger-soft: #3b1630;
  --warn: #f0b46a;
  --warn-bg: #3a2a12;
  --warn-text: #f6d7a8;
  --neutral: #4a6488;
  --accent: #5ad8f5;
  --chart: #3b8eea;           /* barras de las gráficas en oscuro, validado contra --bg-elev */
  --accent-2: #b3a8ff;
  --badge-admin: #c9c4ff;
  --progress-fill: #9590ff;
  --prio-urgent: #ff7a93;
  --prio-high: #f0a35e;
  --prio-medium: #9590ff;
  --prio-low: #c9c4ff;
  --prio-off: #3a5680;
  --theme-bar: #0a2540;
  --av-2: #1f4275;
  --toast-bg: #f6f9fc;
  --toast-text: #0a2540;
  --star-fill: #f5b947;
  --star-line: #f0b46a;
  --sidebar-bg: #0d2a4a;
  --sidebar-text: #f6f9fc;
  --sidebar-muted: #adbdcc;
  --sidebar-hover: #16365f;
  --sidebar-active: #2a2a6e;
  --sidebar-active-text: #d9d6ff;
  --sidebar-line: #1f3c66;
  --shadow: 0 2px 5px rgba(0, 0, 0, 0.35), 0 1px 1px rgba(0, 0, 0, 0.3);
  --shadow-pop: 0 2px 8px rgba(0, 0, 0, 0.45), 0 1px 1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 13px 27px -5px rgba(0, 0, 0, 0.6), 0 8px 16px -8px rgba(0, 0, 0, 0.5);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px #9590ff;
  --mesh-base: #0a2540;
  color-scheme: dark;
}

/* Inter (licencia OFL), servida desde public/fonts/: archivo variable, subconjuntos latin y latin-ext. */
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900; src: url('fonts/inter-latin-wght.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900; src: url('fonts/inter-latin-ext-wght.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

*, *::before, *::after { box-sizing: border-box; }
/* Degradado de malla (009a): solo inicio de sesión y cabecera de la vista pública. */
:root {
  --mesh: radial-gradient(at 12% 18%, var(--mesh-1) 0, transparent 52%), radial-gradient(at 88% 12%, var(--mesh-3) 0, transparent 48%),
    radial-gradient(at 78% 88%, var(--mesh-4) 0, transparent 50%), radial-gradient(at 22% 92%, var(--mesh-2) 0, transparent 55%), var(--mesh-base);
  --mesh-suave: radial-gradient(at 8% 0%, color-mix(in srgb, var(--mesh-1) 22%, transparent) 0, transparent 45%),
    radial-gradient(at 60% 0%, color-mix(in srgb, var(--mesh-3) 20%, transparent) 0, transparent 40%),
    radial-gradient(at 100% 0%, color-mix(in srgb, var(--mesh-4) 18%, transparent) 0, transparent 40%);
}
@keyframes malla { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }
/* Números tabulares en horas, fechas, conteos, resúmenes y porcentajes (009a). */
.num, .hrs, .tt-due, .tt-key, .tt-count, .gcount, .count, .nbadge, .lt-gcount, .lt-sum-h, .lt-range, .lt-subs-btn, .lt-row > .tc.hours,
.lt-row > .tc.due, .stat .num, .msum-v, .mkpi, .pct, .share, .ikey, .bc-key, .chip, .pchip, .entry, .day-num, .cal-day, input[type="date"],
time { font-variant-numeric: tabular-nums; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-2);       /* texto normal; títulos y texto fuerte en tinta (--title, --text) */
  background: var(--bg);
  font-feature-settings: "ss01", "cv11";  /* Inter: a de un piso y 1 con base, se leen mejor en la interfaz */
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--title); margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
/* Los contenedores que se desplazan de lado llevan posición: así lo absoluto de adentro (p. ej. el "Vencida:" de .sr-only)
   queda recortado en ellos y no ensancha la página. */
.iboard, .lt-scroll, .mtable-wrap, .table-wrap { position: relative; }
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Botones y campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--text);
  font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--danger); border-color: var(--border-strong); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger-solid { background: var(--btn-danger); border-color: var(--btn-danger); color: var(--on-color); }
.btn.danger-solid:hover { background: var(--btn-danger-hover); border-color: var(--btn-danger-hover); }
.confirm-msg { margin: 0; font-size: 14px; color: var(--text); }
.confirm-detail { margin: 8px 0 0; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }
.btn.icon-only { width: 32px; padding: 0; }
.btn.sm.icon-only { width: 26px; }

.input, .select, .textarea {
  width: 100%; height: 32px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--bg-elev); color: var(--text); font-size: 13px;
}
.textarea { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.select { appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23889' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label, .label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field-error { color: var(--danger); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

/* Campos "en línea": parecen texto hasta que se tocan (edición en línea). */
.inline-select, .inline-date {
  appearance: none; border: 1px solid transparent; background: transparent; border-radius: var(--radius);
  height: 26px; padding: 0 6px; font-size: 12px; color: var(--text); cursor: pointer; max-width: 100%;
}
.inline-select:hover, .inline-date:hover { border-color: var(--border-strong); background: var(--bg-elev); }
.inline-select:focus, .inline-date:focus { outline: none; border-color: var(--primary); background: var(--bg-elev); }
.inline-date::-webkit-calendar-picker-indicator { opacity: 0.55; cursor: pointer; }
:root[data-theme='dark'] .inline-date::-webkit-calendar-picker-indicator,
:root[data-theme='dark'] .input[type='date']::-webkit-calendar-picker-indicator { filter: invert(1); }

/* ---------- Estructura ---------- */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--sidebar-bg); color: var(--sidebar-text); border-right: 1px solid var(--sidebar-line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; line-height: 1.1; }
.brand-name small { display: block; font-weight: 400; font-size: 11px; color: var(--sidebar-muted); letter-spacing: 0; }
.nav { padding: 4px 8px; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; flex: 1; }
.nav-section { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--sidebar-muted); padding: 14px 10px 6px; display: flex; align-items: center; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius);
  color: var(--sidebar-text); font-weight: 500; font-size: 13px; position: relative;
}
.nav a:hover { background: var(--sidebar-hover); text-decoration: none; }
.nav a.active { background: var(--sidebar-active); color: var(--sidebar-active-text); font-weight: 600; }
.nav a.active .count { color: var(--sidebar-active-text); }
.nav a .count { margin-left: auto; font-size: 11px; color: var(--sidebar-muted); font-weight: 600; }
.nav a.sub { font-weight: 400; padding-left: 12px; }
.nav .proj-code { font-size: 10px; font-weight: 600; border-radius: 4px; padding: 1px 4px; background: var(--bg-active); color: var(--text-2); min-width: 34px; text-align: center; }
.sidebar-foot { border-top: 1px solid var(--sidebar-line); padding: 10px 8px; display: flex; align-items: center; gap: 8px; }
.sidebar-foot .who { flex: 1; min-width: 0; font-size: 12px; line-height: 1.25; }
.sidebar-foot .who a { color: var(--sidebar-text); font-weight: 600; }
.sidebar-foot .who small { color: var(--sidebar-muted); display: block; }
.sidebar .btn.ghost { color: var(--sidebar-text); }
.sidebar .btn.ghost:hover { background: var(--sidebar-hover); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.page-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 24px; border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 20;
}
.page-head .crumbs { font-size: 12px; color: var(--text-2); display: flex; gap: 6px; align-items: center; }
.page-head .crumbs a { color: var(--text-2); }
.page-body { padding: 20px 24px 48px; flex: 1; min-width: 0; }
.page-body.flush { padding: 0; display: flex; flex-direction: column; }

/* ---------- Tarjetas, tablas ---------- */
.card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.card-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.card-body { padding: 14px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { padding: 14px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--bg-elev); position: relative; overflow: hidden; }
.stat .num { font-size: 26px; font-weight: 600; color: var(--title); line-height: 1.1; }
.stat .lbl { font-size: 12px; color: var(--text-2); font-weight: 600; }
.stat::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, var(--primary)); }
.stat.warn .num { color: var(--text); }
.stat.warn::after { background: var(--warn); }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--bg-soft); white-space: nowrap; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--bg-hover); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-elev); }
.table-wrap .table tr:last-child td { border-bottom: 0; }

.empty { text-align: center; padding: 36px 16px; color: var(--text-2); }
.empty svg { width: 32px; height: 32px; color: var(--text-3); margin-bottom: 6px; }

/* ---------- Pequeños elementos ---------- */
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; background: var(--c, var(--neutral)); }
.state-icon { width: 14px; height: 14px; border-radius: 50%; flex: none; border: 2px solid var(--c); display: inline-block; position: relative; }
.state-icon.done { background: var(--c); }
.state-icon.done::after { content: ''; position: absolute; left: 3px; top: 0; width: 3px; height: 6px; border: solid var(--on-color); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 999px;
  font-size: 11px; font-weight: 600; border: 1px solid var(--border-strong); color: var(--text-2); white-space: nowrap; max-width: 100%;
}
.chip .dot { width: 7px; height: 7px; }
.chip.warn { background: var(--warn-bg); border-color: var(--warn-bg); color: var(--warn-text); }
.chip.today { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.code { font-size: 11px; font-weight: 600; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.avatar {
  width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; color: var(--on-color); background: var(--c, var(--primary)); flex: none; text-transform: uppercase;
}
.avatar.lg { width: 30px; height: 30px; font-size: 12px; }
.avatar.none { background: transparent; border: 1.5px dashed var(--text-3); color: var(--text-3); }
.prio { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.prio i { width: 3px; border-radius: 1px; background: var(--border-strong); display: block; }
.prio i:nth-child(1) { height: 5px; } .prio i:nth-child(2) { height: 8px; } .prio i:nth-child(3) { height: 12px; }
.prio.low i:nth-child(1), .prio.medium i:nth-child(-n+2), .prio.high i { background: var(--c); }
.prio.low { --c: var(--text-2); } .prio.medium { --c: var(--primary); } .prio.high { --c: var(--accent-2); }
:root[data-theme='dark'] .prio.medium { --c: var(--primary); }
.badge-admin { font-size: 10px; font-weight: 600; color: var(--badge-admin); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; }
.progress { height: 6px; border-radius: 99px; background: var(--bg-hover); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--progress-fill); border-radius: 99px; }
.notice { background: var(--warn-bg); color: var(--warn-text); padding: 8px 12px; border-radius: var(--radius); font-weight: 600; font-size: 13px; }
.alert { background: var(--danger-soft); color: var(--danger); padding: 8px 12px; border-radius: var(--radius); font-size: 13px; font-weight: 600; }

/* ---------- Vistas de proyecto ---------- */
.view-tabs { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 2px; gap: 2px; }
.view-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 4px; color: var(--text-2); font-weight: 600; font-size: 12px; }
.view-tabs a:hover { text-decoration: none; color: var(--text); }
.view-tabs a.active { background: var(--bg-elev); color: var(--primary); box-shadow: inset 0 0 0 1px var(--border); }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 24px; border-bottom: 1px solid var(--border); background: var(--bg); }
.toolbar .input, .toolbar .select { height: 28px; font-size: 12px; width: auto; }
.toolbar .search { width: 200px; }

.proj-badge { flex: none; font-size: 10px; font-weight: 600; letter-spacing: 0.02em; color: var(--on-color); background: var(--c, var(--primary)); border-radius: 6px; padding: 0 6px; height: 24px; display: inline-flex; align-items: center; }
.vbtn {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--text-chip);
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; font-family: inherit;
}
.vbtn:hover { background: var(--bg-hover); text-decoration: none; }
.vbtn.focus, .vbtn:focus-visible { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.vbtn.on { border-color: var(--primary); color: var(--primary); }
.vbtn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.vbtn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.vbtn.primary:active, .btn.primary:active { background: var(--primary-press); border-color: var(--primary-press); }
.vbadge { min-width: 16px; height: 16px; border-radius: 9999px; background: var(--primary); color: var(--on-primary); font-size: 10px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; }
.icon-btn { width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; padding: 0; }
.icon-btn.lg { width: 28px; height: 28px; }
.icon-btn:hover { background: var(--bg-hover); }
.seg { display: inline-flex; align-items: center; gap: 1px; padding: 2px; border-radius: 6px; background: var(--bg-active); height: 28px; }
.seg button { width: 28px; height: 24px; border: 0; border-radius: 4px; background: transparent; color: var(--text-chip); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--bg-elev); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.vsearch { display: inline-flex; align-items: center; gap: 6px; height: 28px; border: 1px solid var(--border-strong); border-radius: 6px; padding: 0 8px; color: var(--text-2); background: var(--bg-elev); }
.vsearch input { border: 0; background: transparent; width: 130px; font-size: 13px; height: 26px; color: var(--text); }
.vsearch input:focus { outline: none; }
.vsearch:focus-within { border-color: var(--primary); box-shadow: var(--focus-ring); }
.vfilters { display: flex; align-items: center; gap: 12px; padding: 6px 24px; font-size: 12px; color: var(--text-2); border-bottom: 1px solid var(--border); background: var(--bg); }
.link-btn { border: 0; background: none; color: var(--primary); font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; font-family: inherit; }
.link-btn:hover { text-decoration: underline; }

/* Menús desplegables (Filtros, Mostrar, etiquetas) */
.dropdown { position: relative; display: inline-flex; }
.dropdown-panel {
  position: absolute; top: calc(100% + 4px); z-index: 50; min-width: 220px; max-width: calc(100vw - 16px);
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
  padding: 6px; color: var(--text); text-align: left;
}
.dropdown-panel.align-right { right: 0; }
.dropdown-panel.align-left { left: 0; }
.filters-panel { width: 318px; padding: 16px 16px 12px; }
.fsearch { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 8px; border: 1px solid var(--primary); border-radius: 6px; box-shadow: var(--focus-ring); color: var(--text-2); }
.fsearch input { border: 0; background: transparent; flex: 1; min-width: 0; font-size: 13px; height: 26px; color: var(--text); }
.fsearch input:focus { outline: none; }
.fscroll { max-height: min(60vh, 460px); overflow-y: auto; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px; }
.fsec { padding-top: 12px; }
.fsec + .fsec { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
.fsec-head { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; background: none; padding: 4px 0; font-size: 11px; font-weight: 500; color: var(--text-2); cursor: pointer; font-family: inherit; }
.fsec-body { display: flex; flex-direction: column; }
.fopt { display: flex; align-items: center; gap: 10px; min-height: 28px; padding: 0 2px; border-radius: 6px; font-size: 12px; color: var(--text-chip); cursor: pointer; }
.fopt:hover { background: var(--bg-hover); }
.fopt input { width: 14px; height: 14px; margin: 0; accent-color: var(--primary); flex: none; }
.fopt-icon { width: 16px; display: inline-flex; justify-content: center; flex: none; }
.ffoot { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
.display-panel { width: 320px; padding: 12px; }
.dsec + .dsec { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; }
.dtitle { font-size: 11px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.dnote { font-size: 11px; color: var(--text-2); margin: 6px 0 0; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { height: 24px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--border-strong); background: transparent; color: var(--text-chip); font-size: 12px; cursor: pointer; font-family: inherit; }
.pill:hover { background: var(--bg-hover); }
.pill.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.menu-list { display: flex; flex-direction: column; max-height: 260px; overflow-y: auto; }
.menu-opt { display: flex; align-items: center; gap: 8px; min-height: 28px; padding: 0 6px; border-radius: 6px; font-size: 12px; cursor: pointer; color: var(--text-chip); }
.menu-opt:hover { background: var(--bg-hover); }
.menu-opt input { accent-color: var(--primary); margin: 0; }
.menu-empty { font-size: 12px; color: var(--text-2); padding: 6px; }

/* Iconos de estado y prioridad */
.state-svg { flex: none; }
.state-svg .ring { fill: none; stroke: var(--c); stroke-width: 1.4; }
.state-svg.todo .ring { stroke: var(--text-chip); }
.state-svg .ring.dashed { stroke: var(--text-3); stroke-dasharray: 1.6 1.6; }
.state-svg .fill { fill: var(--c); }
.state-svg.started .ring { stroke: var(--c); }
.state-svg .mark { fill: none; stroke: var(--on-color); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.state-svg.done .fill { fill: var(--c); }
.state-svg.cancel .fill { fill: var(--text-3); }
.prio-icon { flex: none; }
.prio-icon .off { fill: var(--prio-off); }
.prio-icon.high .on { fill: var(--prio-high); }
.prio-icon.medium .on { fill: var(--prio-medium); }
.prio-icon.low .on { fill: var(--prio-low); }
.prio-icon.urgent .fill { fill: var(--prio-urgent); }
.prio-icon.urgent .mark { stroke: var(--on-color); stroke-width: 1.8; stroke-linecap: round; }
.prio-icon.none path { stroke: var(--text-2); stroke-width: 1.4; stroke-linecap: round; }

/* Chips de propiedades */
.chips { display: flex; align-items: center; gap: 8px; flex: none; min-width: 0; }
.pchip {
  position: relative; display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: transparent; color: var(--text-chip); font-size: 12px; font-weight: 500;
  white-space: nowrap; max-width: 180px; font-family: inherit; line-height: 1; cursor: default;
}
button.pchip, .chips .pchip:has(.chip-native) { cursor: pointer; }
.pchip > .icon { color: var(--text-chip); }
.pchip:hover { background: var(--bg-hover); }
.pchip.ghost { border-color: transparent; color: var(--text-2); padding: 0 4px; }
.pchip.warn { background: var(--warn-bg); border-color: var(--warn-bg); color: var(--warn-text); }
.pchip.warn > .icon { color: var(--warn-text); }
.pchip.icon-only { width: 24px; padding: 0; justify-content: center; }
.pchip.avatar-chip { width: 24px; padding: 0; justify-content: center; }
.pchip.avatar-chip.has { border-color: transparent; }
.pchip .dot { width: 8px; height: 8px; }
.pchip .dots { display: inline-flex; }
.pchip .dots .dot + .dot { margin-left: -3px; box-shadow: 0 0 0 1.5px var(--bg); }
.chip-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; margin: 0; font-size: 16px; }
.chip-native::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.mini-avatar { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 600; color: var(--on-color); background: var(--c, var(--primary)); flex: none; }
.mini-avatar.none { background: transparent; color: var(--text-2); border: 1px dashed var(--text-3); }
.chip-dd .dropdown-panel { min-width: 200px; }
.chip-dd { display: inline-flex; }
.menu-cap { font-size: 11px; font-weight: 500; color: var(--text-2); padding: 2px 6px 4px; }
button.menu-opt { width: 100%; border: 0; background: none; font: inherit; font-size: 12px; text-align: left; }
.menu-opt.on { color: var(--text); font-weight: 600; }

.igroup-head {
  display: flex; align-items: center; gap: 8px; min-height: 43px; padding: 0 8px; background: var(--bg-soft);
  border-bottom: 1px solid var(--border); position: sticky; top: 60px; z-index: 3; cursor: pointer; user-select: none;
}
.igroup-head:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.gicon { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.gicon .avatar { width: 18px; height: 18px; font-size: 8px; }
.gname { font-size: 14px; font-weight: 500; color: var(--text); }
.gcount { font-size: 13px; color: var(--text-2); margin-left: 4px; }
.irow {
  display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 13px 0 8px;
  border-bottom: 1px solid var(--border); background: var(--bg); cursor: pointer; outline: none;
}
.irow:hover, .irow:focus-visible { background: var(--bg-hover); }
.irow.selected { background: var(--primary-soft); }
.irow-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding-left: 15px; }
.ikey { font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap; flex: none; font-variant-numeric: tabular-nums; }
.ititle { margin: 0; font-size: 13px; font-weight: 500; color: var(--text); line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.irow.done .ititle, .icard.done .ititle { color: var(--text-2); }
.quick-add { display: flex; align-items: center; gap: 8px; padding: 0 13px 0 23px; min-height: 40px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.quick-add input { border: none; background: transparent; flex: 1; height: 30px; font-size: 13px; color: var(--text); }
.quick-add input:focus { outline: none; }
.quick-add-btn { color: var(--text-2); font-size: 12px; font-weight: 500; border: none; background: none; cursor: pointer; display: flex; gap: 6px; align-items: center; padding: 0 23px; min-height: 36px; width: 100%; text-align: left; border-bottom: 1px solid var(--border); font-family: inherit; }
.quick-add-btn:hover { color: var(--primary); background: var(--bg-hover); }

/* ---------- Tablero ---------- */
.iboard { display: flex; gap: 16px; padding: 16px 20px 24px; overflow-x: auto; align-items: flex-start; flex: 1; background: var(--bg-soft); min-height: calc(100vh - 61px); }
.icol { width: 320px; flex: none; display: flex; flex-direction: column; border-radius: 8px; max-height: calc(100vh - 100px); }
.icol-head { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 4px 0 8px; position: sticky; top: 0; }
.icol-body { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 80px; padding: 2px 2px 8px; border-radius: 8px; }
.icol.drag-over .icol-body { background: var(--primary-soft); }
.icard {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px; padding: 12px; cursor: pointer;
  display: flex; flex-direction: column; gap: 6px; outline: none;
}
.icard[draggable='true'] { cursor: grab; }
.icard:hover, .icard:focus-visible { border-color: var(--border-strong); background: var(--bg-elev); }
.icard.selected { border-color: var(--primary); }
.icard.dragging { opacity: 0.4; }
.icard .ititle { white-space: normal; overflow: visible; word-break: break-word; line-height: 1.4; margin-bottom: 4px; }
.icard .chips { flex-wrap: wrap; gap: 6px; }
.drop-marker { height: 3px; border-radius: 3px; background: var(--primary); margin: -2px 0; flex: none; }
.icol .quick-add { border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--bg-elev); padding: 0 10px; min-height: 36px; }
.icol .quick-add-btn { border: 0; padding: 0 8px; border-radius: 8px; }

/* ---------- Vista pública ---------- */
/* La página no se desplaza entera: el encabezado queda fijo y solo se desplaza la lista o el tablero. */
.pub { height: 100vh; height: 100dvh; overflow: hidden; background: var(--bg); display: flex; flex-direction: column; }
.pub .pub-body { overflow: auto; min-height: 0; }
.pub .igroup-head { top: 0 !important; }
.pub .iboard { min-height: 100%; }
.pub-head { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 28px 0 24px; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
  background: var(--bg); background-image: var(--mesh-suave); background-size: 160% 160%; animation: malla 24s ease-in-out infinite alternate; }
.pub-title { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; }
.pub-title h1 { font-size: 16px; font-weight: 500; color: var(--text); letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-pin { width: 16px; height: 16px; flex: none; border-radius: 4px; background: var(--c, var(--primary)); transform: rotate(45deg) scale(0.8); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.35); }
.pub-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.pub-body { flex: 1; display: flex; flex-direction: column; }
.shell .igroup-head { position: static; }
.pub-badge { position: fixed; right: 0; bottom: 0; margin: 0 20px 10px 0; z-index: 30; display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 6px; background: var(--bg-active); color: var(--text); font-size: 11px; text-decoration: none; box-shadow: var(--shadow-pop); }
.pub-badge:hover { text-decoration: none; background: var(--bg-hover); }
.pub-badge img { border-radius: 4px; }
.panel-title { min-width: 0; }
.panel-title h2 { font-size: 15px; font-weight: 600; color: var(--text); letter-spacing: 0; }
.panel-key { color: var(--text-2); font-weight: 500; font-size: 13px; margin-right: 8px; }
.panel-crumb { display: block; color: var(--text-2); }

/* Calendario */
.cal-head { display: flex; align-items: center; gap: 8px; padding: 12px 24px; }
.cal-head h2 { min-width: 170px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); margin: 0 24px 24px; border-radius: var(--radius-lg); overflow: hidden; }
.cal-dow { padding: 6px 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-2); background: var(--bg-soft); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cal-day { min-height: 112px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; display: flex; flex-direction: column; gap: 3px; background: var(--bg); min-width: 0; }
.cal-day.other { background: var(--bg-soft); }
.cal-day.other .cal-num { color: var(--text-3); }
.cal-day.today .cal-num { background: var(--primary); color: var(--on-primary); }
.cal-day.drag-over { background: var(--primary-soft); }
.cal-num { font-size: 11px; font-weight: 600; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.cal-day-head { display: flex; align-items: center; justify-content: space-between; }
.cal-day-head .btn { opacity: 0; }
.cal-day:hover .cal-day-head .btn { opacity: 1; }
.cal-task { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 6px; border-radius: 4px; background: var(--bg-soft); border: 1px solid var(--border); border-left: 3px solid var(--c); cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal-task.done { color: var(--text-3); text-decoration: line-through; }  /* sin opacidad: el texto sigue pasando AA */
.cal-task span { overflow: hidden; text-overflow: ellipsis; }
.agenda { display: none; }

/* ---------- Panel lateral de tarea ---------- */
.panel-backdrop { position: fixed; inset: 0; background: rgba(8, 20, 50, 0.25); z-index: 60; animation: fade 0.15s ease; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--panel-w); max-width: 100vw; z-index: 61;
  background: var(--bg); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slide 0.18s ease;
}
@keyframes slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.panel-body { flex: 1; overflow-y: auto; padding: 16px 20px 32px; display: flex; flex-direction: column; gap: 18px; }
.title-input { font-size: 18px; font-weight: 600; color: var(--title); border: 1px solid transparent; background: transparent; width: 100%; padding: 4px 6px; margin: 0 -6px; border-radius: var(--radius); resize: none; overflow: hidden; line-height: 1.3; }
.title-input:hover { border-color: var(--border); }
.title-input:focus { outline: none; border-color: var(--primary); }
.props { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 4px 10px; align-items: center; font-size: 13px; }
.props > .k { color: var(--text-2); font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.props .inline-select, .props .inline-date { font-size: 13px; height: 30px; }
.section-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2); display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.desc { border: 1px solid transparent; background: transparent; width: 100%; min-height: 60px; resize: vertical; border-radius: var(--radius); padding: 6px; margin: 0 -6px; font-size: 13px; line-height: 1.55; }
.desc:hover { border-color: var(--border); }
.desc:focus { outline: none; border-color: var(--primary); background: var(--bg-elev); }
.check-item { display: flex; align-items: center; gap: 8px; padding: 4px 6px; margin: 0 -6px; border-radius: var(--radius); }
.check-item:hover { background: var(--bg-hover); }
.check-item.done .txt { text-decoration: line-through; color: var(--text-2); }
.check-item .btn { opacity: 0; }
.check-item:hover .btn { opacity: 1; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tabs button { border: none; background: none; padding: 8px 10px; font-weight: 600; font-size: 13px; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.comment { display: flex; gap: 10px; padding: 8px 0; }
.comment .bubble { flex: 1; min-width: 0; }
.comment .body { white-space: pre-wrap; word-break: break-word; font-size: 13px; margin-top: 2px; }
.activity-item { display: flex; gap: 8px; font-size: 12px; color: var(--text-2); padding: 4px 0; }
.activity-item::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); margin-top: 6px; flex: none; }
.entry { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.entry .hrs { font-weight: 600; color: var(--title); min-width: 46px; font-variant-numeric: tabular-nums; }
.time-form { display: grid; grid-template-columns: 140px 90px minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.label-picker { position: relative; }
.popover { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 220px; background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 6px; max-height: 300px; overflow-y: auto; }
.popover .opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius); cursor: pointer; font-size: 13px; }
.popover .opt:hover { background: var(--bg-hover); }

/* ---------- Modal y avisos ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(8, 20, 50, 0.4); z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; overflow-y: auto; animation: fade 0.12s ease; }
.modal { width: 100%; max-width: 520px; background: var(--bg); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--bg-soft); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--toast-bg); color: var(--toast-text); padding: 9px 14px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-weight: 600; font-size: 13px; animation: fade 0.15s ease; }
.toast.error { background: var(--danger); }
/* R11: aviso con acción ("Deshacer"); el botón sí recibe clics aunque la pila no. */
.toast.has-act { display: flex; align-items: center; gap: 12px; pointer-events: auto; }
.toast-act { background: none; border: 0; padding: 2px 4px; margin: -2px -4px -2px 0; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; border-radius: 4px; }
.toast-act:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }

/* ---------- Mi día (Inicio) y reporte ---------- */
.day-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.day-list .task-line { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--border); cursor: pointer; }
.day-list .task-line:first-child { border-top: 0; }
.day-list .task-line:hover { background: var(--bg-hover); }
.task-line .title { font-weight: 600; font-size: 13px; }
.task-line.done .title { text-decoration: line-through; color: var(--text-2); }
.task-line .sub { font-size: 11px; color: var(--text-2); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 1px; }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 110px; padding-top: 8px; }
.bar { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; font-size: 11px; color: var(--text-2); }
.bar span.fill { width: 100%; max-width: 28px; border-radius: 4px 4px 2px 2px; background: var(--primary); min-height: 2px; }
.bar.today span.fill { background: var(--progress-fill); }
.bar.today { color: var(--title); font-weight: 600; }
.bar .v { font-size: 10px; font-weight: 600; color: var(--text); }
.log-inline { display: flex; gap: 6px; padding: 8px 14px 10px 42px; background: var(--bg-soft); border-top: 1px dashed var(--border); flex-wrap: wrap; }
.log-inline .input { height: 30px; }

/* ---------- Reporte ---------- */
.report-row td:first-child { padding-left: calc(12px + var(--lvl, 0) * 20px); }
.report-row.lvl0 td { font-weight: 600; background: var(--bg-soft); }
.report-row.lvl1 td { font-weight: 600; }
.share { display: inline-block; width: 80px; height: 6px; background: var(--bg-hover); border-radius: 99px; overflow: hidden; vertical-align: middle; margin-left: 8px; }
.share > span { display: block; height: 100%; background: var(--accent-2); }

/* ---------- Login ---------- */
.auth-page { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--mesh); background-size: 160% 160%; animation: malla 24s ease-in-out infinite alternate; }
.auth-title { font-size: 20px; line-height: 1.1; }
.auth-card { overflow: hidden; width: 100%; max-width: 380px; background: var(--bg-elev); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 28px; }
.auth-card .brand { padding: 0 0 18px; color: var(--title); }
.auth-card .brand img { width: 40px; height: 40px; border-radius: 10px; }
.auth-card .brand-name { font-size: 20px; }
.auth-card .brand-name small { color: var(--text-2); font-size: 12px; }
.auth-foot { margin: 16px auto 0; width: fit-content; padding: 4px 10px; border-radius: 99px; font-size: 12px; color: var(--text-2); background: var(--bg-elev); text-align: center; }
.auth-accent { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); margin: -28px -28px 24px; border-radius: 14px 14px 0 0; }

.loading { padding: 40px; text-align: center; color: var(--text-2); }
/* A2: franja de versión nueva, arriba y sobre todo lo demás. */
.version-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 120; display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 8px 16px calc(8px); padding-top: calc(8px + env(safe-area-inset-top)); background: var(--primary); color: var(--on-primary); font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg); }
.version-btn { background: var(--on-primary); color: var(--primary); border: 0; border-radius: 6px; padding: 4px 12px; font: inherit; cursor: pointer; }
.version-btn:focus-visible { outline: 2px solid var(--on-primary); outline-offset: 2px; }
/* A1: la carga falló: motivo y "Reintentar" en lugar del indicador que gira. */
.load-error { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 16px; text-align: center; color: var(--text); }
.load-error .icon { color: var(--danger); }
.load-error .muted { max-width: 46ch; overflow-wrap: anywhere; }
.load-error .btn { margin-top: 6px; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.mobile-only { display: none; }

/* ---------- Tableta ---------- */
@media (max-width: 1100px) {
  .day-grid { grid-template-columns: minmax(0, 1fr); }
  .shell .irow .pchip.ghost { display: none; }
}

/* ---------- Celular ---------- */
@media (max-width: 767px) {
  body { font-size: 15px; }
  .mobile-only { display: initial; }
  .desktop-only { display: none !important; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform 0.2s ease; width: 270px; box-shadow: var(--shadow-lg); }
  .shell.nav-open .sidebar { transform: none; }
  .nav-scrim { position: fixed; inset: 0; background: rgba(8, 20, 50, 0.4); z-index: 39; }
  .topbar {
    display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 8px; position: sticky; top: 0; z-index: 30;
    background: var(--bg); color: var(--title); padding-top: env(safe-area-inset-top); border-bottom: 1px solid var(--border);
  }
  .topbar .btn.ghost { color: var(--title); }
  .topbar .t { font-weight: 600; font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page-head { position: static; padding: 12px 14px; }
  .page-head h1 { font-size: 18px; }
  .page-body { padding: 14px 12px 40px; }
  .toolbar { padding: 8px 12px; }
  .toolbar .search { width: 100%; flex: 1 1 100%; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat .num { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .input, .select, .textarea { font-size: 16px; height: 40px; }
  .textarea { height: auto; }
  .btn { height: 38px; }
  .btn.sm { height: 30px; }
  /* Lista como tarjetas apiladas: clave y título arriba, chips abajo (se acomodan en varias líneas). */
  .irow { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 8px 14px; }
  .irow-main { padding-left: 15px; }
  .irow .chips { flex-wrap: wrap; }
  .pchip { height: 26px; font-size: 13px; }
  .pchip.avatar-chip, .pchip.icon-only { width: 26px; }
  .quick-add, .quick-add-btn { padding-left: 23px; padding-right: 12px; }
  /* Tablero con desplazamiento horizontal: columnas casi del ancho de la pantalla. */
  .iboard { padding: 12px; gap: 12px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
  .icol { width: 84vw; max-width: 340px; scroll-snap-align: start; max-height: none; }
  .vsearch { flex: 1; min-width: 120px; }
  .vsearch input { width: 100%; }
  .igroup-head { top: 0; }
  .pub-head { padding: 0 12px 0 16px; gap: 8px; }
  .pub-title { gap: 10px; }
  .pub-tools { gap: 6px; }
  .pub-tools .vbtn { padding: 0 8px; }
  .pub-badge { margin-right: 12px; }
  .filters-panel, .display-panel { position: fixed; top: 48px; left: 6px; right: auto; width: 318px; max-width: calc(100vw - 12px); }
  .shell .filters-panel, .shell .display-panel { top: 60px; }
  /* En celular los chips quedan a la izquierda, debajo del título: su menú se abre hacia la derecha. */
  .chip-dd .dropdown-panel.align-right { right: auto; left: 0; }
  .cal, .cal-head .desktop-only { display: none; }
  .cal-head { padding: 10px 12px; }
  .agenda { display: block; padding: 0 12px 24px; }
  .agenda-day { margin-top: 12px; }
  .agenda-day h3 { font-size: 13px; margin-bottom: 6px; color: var(--text-2); }
  .agenda-day.today h3 { color: var(--primary); }
  .agenda .cal-task { padding: 9px 10px; font-size: 13px; margin-bottom: 6px; white-space: normal; }
  .panel { width: 100vw; border-left: 0; }
  .panel-body { padding: 14px 14px 32px; }
  .props { grid-template-columns: 100px minmax(0, 1fr); }
  .time-form { grid-template-columns: 1fr 1fr; }
  .time-form .note { grid-column: 1 / -1; }
  .time-form .btn { grid-column: 1 / -1; }
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal { max-width: none; border-radius: 0; min-height: 100%; }
  .day-list .task-line { padding: 11px 12px; }
  .log-inline { padding: 8px 12px 10px; }
  .log-inline .input { height: 40px; }
  .table th, .table td { padding: 8px; }
  .hide-sm { display: none; }
}

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

/* Ilustración del formulario de metas (fichas, sin colores sueltos) */
.il-diana .il-fondo { fill: var(--bg); } .il-diana .il-suave { fill: var(--primary-soft); } .il-diana .il-centro { fill: var(--star-fill); }
.il-diana .il-bandera { fill: var(--accent); } .il-diana .il-tinta { stroke: var(--title); } .il-diana .il-accion { stroke: var(--primary); }
.il-diana .il-lila { stroke: var(--accent-2); } .il-diana path:not(.il-bandera) { fill: none; }

/* ---------- Objetivos (metas) ---------- */
/* Estados y tipos de meta (fichas; como texto pasan AA sobre el lienzo y la superficie en los dos temas). */
:root {
  --m-curso: var(--ok);
  --m-riesgo: var(--warn);
  --m-retraso: var(--danger-strong);
  --m-lograda: var(--primary);
  --m-cancelada: var(--text-3);
  --m-empresa: var(--title);
  --m-equipo: var(--accent-2);
  --m-individual: var(--accent);
}
:root[data-theme='dark'] { --m-empresa: var(--text-2); }
.e-en_curso { --mc: var(--m-curso); }
.e-en_riesgo { --mc: var(--m-riesgo); }
.e-con_retraso { --mc: var(--m-retraso); }
.e-lograda { --mc: var(--m-lograda); }
.e-cancelada { --mc: var(--m-cancelada); }
.e-tiempo { --mc: var(--neutral); }
.t-empresa { --mt: var(--m-empresa); }
.t-equipo { --mt: var(--m-equipo); }
.t-individual { --mt: var(--m-individual); }

.mdot { width: 8px; height: 8px; border-radius: 50%; background: var(--mc, var(--neutral)); display: inline-block; flex: none; }
.mchip {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  white-space: nowrap; color: var(--mc); background: color-mix(in srgb, var(--mc) 12%, transparent); border: 1px solid color-mix(in srgb, var(--mc) 35%, transparent);
}
.mchip.e-en_riesgo { color: var(--warn-text); background: var(--warn-bg); border-color: var(--warn); }
.mchip.e-en_riesgo .mdot { background: var(--warn-text); }
.mchip.sug { background: transparent; border-style: dashed; color: var(--text-2); }
.mchip.sug.e-en_riesgo { border-color: var(--warn); }
.mchip.sug .mdot { background: var(--mc); }
.mchip.tipo { color: var(--mt, var(--text-2)); background: color-mix(in srgb, var(--mt, var(--neutral)) 12%, transparent); border: 0; }
.mtipo { display: inline-flex; align-items: center; justify-content: center; color: var(--mt, var(--text-2)); flex: none; }
.mbadge { background: var(--title); width: 24px; padding: 0; justify-content: center; }

.mbar { position: relative; display: inline-block; width: 96px; height: 6px; border-radius: 99px; background: var(--bg-active); overflow: hidden; flex: none; vertical-align: middle; }
.mbar > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--mc, var(--primary)); }
.mprog { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.mpct { font-size: 12px; font-weight: 600; color: var(--text-chip); min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.mring .track { stroke: var(--bg-active); }
.mring .val { stroke: var(--mc, var(--primary)); transition: stroke-dashoffset 0.4s ease; }
.mring .rtext { fill: var(--title); font-weight: 600; font-family: var(--font); }
.mchart { display: block; overflow: visible; max-width: 100%; height: auto; margin: 0 auto; }
.mchart .clabel { font-size: 12px; font-weight: 600; fill: var(--text); font-family: var(--font); }
.mchart .csub { font-size: 10px; fill: var(--text-3); font-family: var(--font); }
.mchart .ctrack { fill: var(--bg-active); }
.mchart .cbar { fill: var(--primary); }
.mchart .cval { font-size: 12px; font-weight: 600; fill: var(--text-chip); font-family: var(--font); }

.tree { min-width: 760px; }

.stat.e-en_curso, .stat.e-en_riesgo, .stat.e-con_retraso, .stat.e-lograda, .stat.e-cancelada { --c: var(--mc); }
.mpanel-grid { display: grid; grid-template-columns: minmax(220px, 0.8fr) 1fr 1fr; gap: 16px; align-items: start; }
.attn-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.attn-row:last-child { border-bottom: 0; }
.attn-row:hover { background: var(--bg-hover); text-decoration: none; }

.mdesc { margin: 0 0 14px; color: var(--text-2); white-space: pre-wrap; }
.msug { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--radius-lg); margin-bottom: 14px; font-size: 13px;
  border: 1px solid color-mix(in srgb, var(--mc) 45%, transparent); background: color-mix(in srgb, var(--mc) 10%, var(--bg)); }
.msug.e-en_riesgo { background: color-mix(in srgb, var(--warn) 22%, var(--bg)); border-color: var(--warn); }
.mmanual { display: flex; align-items: flex-end; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.mmanual input[type='range'] { width: 100%; accent-color: var(--primary); }
.mdesglose { margin-bottom: 4px; }
.mdesglose .mdrow { padding: 8px 14px; }
.mdrow { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--border); font-size: 13px; }
.mdrow:last-child { border-bottom: 0; }
.mdrow > .icon { color: var(--text-2); flex: none; }
.mdrow a { color: var(--text); font-weight: 600; }
.mpeso { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-2); }
.mpeso .input { width: 64px; height: 28px; padding: 0 6px; }
.mlink-search { margin-top: 12px; }
.mlink-search .vsearch { width: 100%; height: 34px; }
.mlink-search .vsearch input { width: 100%; }
.mlink-results { border: 1px solid var(--border); border-radius: var(--radius-lg); margin-top: 6px; padding: 0 10px; background: var(--bg-elev); }
.mnote { font-size: 12px; color: var(--text-2); background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; margin: 0 0 10px; }
.mupdate { border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--bg-elev); margin-top: 12px; overflow: hidden; }
.mupdate:focus-within { border-color: var(--primary); box-shadow: var(--focus-ring); }
.mupdate .textarea { border: 0; border-radius: 0; min-height: 76px; background: transparent; box-shadow: none; }
.mupdate-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border-top: 1px solid var(--border); background: var(--bg-soft); }
.row.wrap { flex-wrap: wrap; }
.sm-select { width: auto; height: 30px; font-size: 12px; }

/* Integraciones */
.contrib { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11px; color: var(--text-2); min-width: 0; }
.panel-title .contrib { display: flex; margin-top: 4px; }
.contrib > .icon { color: var(--m-empresa); flex: none; }
.contrib-k { font-weight: 600; }
.contrib-link { display: inline-flex; align-items: center; gap: 5px; max-width: 260px; height: 20px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-chip); font-weight: 600; }
.contrib-link:hover { background: var(--bg-hover); text-decoration: none; }
.contrib-link .mpct { min-width: 0; font-size: 11px; color: var(--text-2); }
.mymeta { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.mymeta:last-child { border-bottom: 0; }
.mymeta:hover { background: var(--bg-hover); text-decoration: none; }
.mymeta .mbar { flex: 1; width: auto; }

@media (max-width: 1100px) {
}
@media (max-width: 767px) {
  .tree { min-width: 640px; }
  .mpanel-grid { grid-template-columns: 1fr; }
  .attn-row { flex-wrap: wrap; }
  .mdrow { flex-wrap: wrap; }
  .mdrow .mprog { margin-left: 24px; }
  .contrib-link { max-width: 200px; }
}

/* ---------- Metas: encabezado con pestañas ---------- */
.mhead { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--border); padding: 0 24px; }
.mhead-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 52px; padding-top: 6px; }
.mhead-top h1 { font-size: 18px; font-weight: 600; color: var(--title); }
.mhead-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.mhead-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px 9px; font-size: 13px; font-weight: 600; color: var(--text-2);
  border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; border-radius: 6px 6px 0 0; }
.mhead-tabs a:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.mhead-tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.mhead-detail .mhead-top { min-height: 50px; padding-bottom: 6px; }
.mhead-detail .crumbs { font-size: 12px; color: var(--text-2); display: flex; gap: 6px; align-items: center; min-width: 0; }
.mhead-detail .crumbs a { color: var(--text-2); }
.mhero { max-width: 620px; margin: 40px auto; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.mhero-t { font-size: 22px; font-weight: 600; color: var(--title); }

/* Tabla de metas */
/* Con pantallas angostas la tabla se desliza dentro de su contenedor, nunca la página. */
.mtable-wrap { background: var(--bg); overflow-x: auto; }
.mtable-wrap.boxed { border: 1px solid var(--border); border-radius: var(--radius-lg); }
.mtable { min-width: min-content; }
.mt-row {
  display: grid; grid-template-columns: minmax(260px, 1fr) 150px 160px 96px 92px 170px 74px; align-items: center;
  min-height: 46px; border-bottom: 1px solid var(--border); background: var(--bg); cursor: pointer; outline: none;
}
.mt-row > div { padding: 0 10px; min-width: 0; display: flex; align-items: center; gap: 6px; height: 100%; border-right: 1px solid var(--border); }
.mt-row > div:last-child { border-right: 0; }
.mt-row:hover, .mt-row:focus-visible { background: var(--bg-hover); }
.mt-head { min-height: 34px; cursor: default; background: var(--bg-soft); }
.mt-head:hover { background: var(--bg-soft); }
.mt-head > div { font-size: 11px; font-weight: 600; color: var(--text-2); }
.mtable-wrap.boxed .mt-head { position: static; }
.mt-name { padding-left: calc(10px + var(--d, 0) * 24px) !important; }
.mt-caret { width: 22px; height: 22px; flex: none; color: var(--text-2); }
.mt-caret-sp { width: 22px; flex: none; }
.mt-titlebox { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; row-gap: 0; }
.mt-title { color: var(--text); font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.mt-row.sub .mt-title { font-weight: 500; }
.mt-sub { font-size: 11px; color: var(--text-3); flex-basis: 100%; }
.mt-sug { display: inline-flex; color: var(--mc); }
.mt-sug.e-en_riesgo { color: var(--warn); }
.mt-prog .mbar { flex: 1; width: auto; min-width: 50px; }
.mt-per, .mt-tipo, .mt-vinc { font-size: 12px; color: var(--text-chip); white-space: nowrap; }
.mt-per .icon, .mt-vinc .icon { color: var(--text-3); }
.mt-empty { padding: 14px 24px; font-size: 12px; color: var(--text-3); border-bottom: 1px solid var(--border); }
.mt-group { position: static; min-height: 38px; gap: 6px; }
.mperson { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; color: var(--text-chip); }
.mperson .mini-avatar { width: 22px; height: 22px; font-size: 9px; }

/* Mapa de metas */
.omap-wrap { position: relative; }
.omap-canvas { overflow: auto; height: calc(100vh - 140px); min-height: 420px; background-color: var(--bg-soft);
  background-image: radial-gradient(var(--border-strong) 1px, transparent 1px); background-size: 18px 18px; }
.omap { display: inline-block; min-width: 100%; padding: 28px 24px 80px; }
.omap ul { display: flex; justify-content: center; padding: 26px 0 0; margin: 0; position: relative; }
.omap > ul { padding-top: 0; }
.omap li { list-style: none; position: relative; padding: 26px 10px 0; display: flex; flex-direction: column; align-items: center; }
.omap li::before, .omap li::after { content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 26px; border-top: 1.5px solid var(--border-strong); }
.omap li::after { right: auto; left: 50%; border-left: 1.5px solid var(--border-strong); }
.omap li:only-child::before, .omap li:only-child::after { display: none; }
.omap li:only-child { padding-top: 0; }
.omap li:first-child::before, .omap li:last-child::after { border: 0 none; }
.omap li:last-child::before { border-right: 1.5px solid var(--border-strong); border-radius: 0 8px 0 0; }
.omap li:first-child::after { border-radius: 8px 0 0 0; }
.omap ul ul::before { content: ''; position: absolute; top: 0; left: 50%; height: 26px; border-left: 1.5px solid var(--border-strong); }
.ocard { width: 268px; background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); text-align: left;
  cursor: pointer; overflow: hidden; outline: none; }
.ocard:hover { border-color: var(--primary); }
.ocard.selected, .ocard:focus-visible { border-color: var(--primary); box-shadow: var(--focus-ring); }
.ocard.root { cursor: default; text-align: center; padding: 22px 16px; border-color: var(--border); }
.ocard.root:hover { border-color: var(--border); }
.ocard-root-k { font-size: 11px; color: var(--text-2); font-weight: 600; }
.ocard-root-t { font-size: 17px; font-weight: 600; color: var(--title); margin: 2px 0 4px; }
.ocard-head { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--bg-soft); border-bottom: 1px solid var(--border); font-size: 11px; color: var(--text-2); }
.ocard-head .mchip { height: 18px; font-size: 10px; padding: 0 6px; }
.ocard-body { padding: 10px 12px 8px; display: flex; flex-direction: column; gap: 6px; }
.ocard-title { font-size: 13px; font-weight: 600; color: var(--primary); line-height: 1.3; }
.ocard-body .mbar { width: 100%; height: 5px; }
.ocard-meta { font-size: 11px; color: var(--text-2); }
.ocard-warn { font-size: 11px; color: var(--warn-text); background: var(--warn-bg); border-radius: 4px; padding: 1px 6px; display: inline-flex; gap: 4px; align-items: center; align-self: flex-start; }
.ocard-foot { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-2); }
.ocard-foot .mperson { font-size: 11px; }
.ocard-foot .mini-avatar { width: 18px; height: 18px; font-size: 8px; }
.ocard-toggle { position: relative; z-index: 2; margin-top: -9px; height: 18px; min-width: 32px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--bg-elev); color: var(--text-2); font-size: 11px; font-weight: 600; cursor: pointer; font-family: inherit; }
.ocard-toggle:hover { color: var(--primary); border-color: var(--primary); }
.omap li > .ocard-toggle + ul { padding-top: 17px; }
.omap li > .ocard-toggle + ul::before { height: 17px; }
.omap-zoom { position: absolute; right: 18px; bottom: 18px; display: flex; align-items: center; gap: 2px; background: var(--bg-elev); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 3px; box-shadow: var(--shadow); }
.omap-zoom .icon-btn { font-size: 16px; font-weight: 600; }
.omap-zv { border: 0; background: none; font: inherit; font-size: 12px; color: var(--text-2); cursor: pointer; min-width: 48px; }

/* Panel de metas */
.mkpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.mkpi { padding: 14px 16px 12px; text-align: center; }
.mkpi-t { text-align: left; font-size: 13px; font-weight: 600; color: var(--text); }
.mkpi-v { font-size: 38px; font-weight: 400; color: var(--title); line-height: 1.2; margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.mkpi-n { font-size: 11px; color: var(--text-3); }
.mkpi.warn { border-color: var(--warn); box-shadow: inset 0 3px 0 var(--warn); }
.mpanel-grid { grid-template-columns: 1fr 1fr; }
.mdonut { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; justify-content: center; }
.mdonut .dseg { stroke: var(--mc); }
.mdonut .ctrack-stroke { stroke: var(--bg-active); }
.mdonut .dnum { font-size: 30px; font-weight: 600; fill: var(--title); font-family: var(--font); }
.mdonut .csub { font-size: 11px; fill: var(--text-3); font-family: var(--font); }
.mlegend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-width: 150px; font-size: 12px; }
.mlegend li { display: flex; align-items: center; gap: 8px; }
.mdot.sq { border-radius: 2px; width: 10px; height: 10px; }
.mchart .caxis { font-size: 10px; fill: var(--text-3); font-family: var(--font); }
.mchart .cgrid, .mpchart .cgrid { stroke: var(--border); stroke-width: 1; }
.mchart .cbar.v0 { fill: var(--primary); }
.mchart .cbar.v1 { fill: var(--accent-2); }
.mchart .cbar.v2 { fill: var(--accent); }
.mchart .cbar.v3 { fill: var(--title); }
.mchart .cstem { stroke: var(--accent-2); stroke-width: 3; stroke-linecap: round; opacity: 0.45; }
.mchart .cdot { fill: var(--accent-2); }
.mchart .cini { font-size: 8px; font-weight: 600; fill: var(--on-color); font-family: var(--font); }
.mring-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }

/* Curva de progreso */
.mpchart { display: block; overflow: visible; }
.mpchart .csub { font-size: 10px; fill: var(--text-3); font-family: var(--font); }
.mpchart .clabel { font-size: 11px; fill: var(--text-2); font-family: var(--font); font-weight: 600; }
.mpchart .pexpected { fill: var(--bg-active); }
.mpchart .ptoday { stroke: var(--primary); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.7; }
.mpchart .pline { stroke: var(--mc, var(--primary)); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.mpchart .pdot { fill: var(--bg); stroke: var(--mc, var(--primary)); stroke-width: 2.5; }
.mpchart .pline.e-en_riesgo, .mpchart .pdot.e-en_riesgo { stroke: var(--warn); }
.mchart-legend { display: flex; gap: 16px; font-size: 11px; color: var(--text-2); margin: 2px 0 8px 44px; }
.mchart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-exp { width: 14px; height: 10px; background: var(--bg-active); border-radius: 2px; display: inline-block; }
.lg-real { width: 14px; height: 3px; background: var(--mc, var(--primary)); border-radius: 2px; display: inline-block; }

/* Detalle en columna */
.mdoc { max-width: 780px; margin: 0 auto; padding: 26px 24px 64px; width: 100%; }
.mdoc-title { display: flex; align-items: flex-start; gap: 10px; font-size: 26px; font-weight: 600; color: var(--title); letter-spacing: -0.01em; line-height: 1.25; margin-bottom: 18px; }
.mdoc-title .mtipo { margin-top: 7px; }
.mdoc-title .mtipo .icon { width: 20px; height: 20px; }
.mprops { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px 14px; margin: 0; font-size: 13px; align-items: center; }
.mprops dt { color: var(--text-2); font-size: 12px; }
.mprops dd { margin: 0; color: var(--text); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.mrule { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }
.msum { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.msum-card { border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 14px 12px; text-align: center; background: var(--bg-elev); }
.msum-k { font-size: 11px; color: var(--text-2); }
.msum-v { font-size: 24px; font-weight: 600; color: var(--title); margin: 2px 0; display: flex; align-items: center; justify-content: center; gap: 8px; }
.msum-v.estado { color: var(--mc); }
.msum-v.estado.e-en_riesgo { color: var(--warn); }
.msum-v .mdot { width: 12px; height: 12px; }
.msum-n { font-size: 12px; color: var(--text-2); }
.msum.compact .msum-v { font-size: 20px; }
.msec { margin-top: 30px; }
.msec-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.msec-head h2 { font-size: 16px; font-weight: 600; color: var(--title); letter-spacing: 0; }
.msec-head h3 { font-size: 14px; }
.mformula { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); }
.mruta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.mruta a { font-weight: 600; color: var(--text); }
.mlink-add { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--text-2); font: inherit; font-size: 12px; font-weight: 600;
  padding: 8px 2px; cursor: pointer; }
.mlink-add:hover { color: var(--primary); }
.mdesglose { margin-top: 8px; border-top: 1px solid var(--border); }
.mdesglose .mdrow { padding: 7px 2px; }
.mfeed { display: flex; flex-direction: column; }
.mfeed-ev { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); padding: 6px 0; }
.mfeed-item { display: flex; gap: 10px; padding: 12px 0; border-top: 1px solid var(--border); font-size: 13px; }
.mfeed-item .mini-avatar, .mfeed-ev .mini-avatar { width: 26px; height: 26px; font-size: 10px; }
.mfeed-text { margin-top: 4px; white-space: pre-wrap; }
.mstate-sel { border-color: var(--mc); font-weight: 600; }
.mside { width: 560px; }
.mside-title { display: flex; align-items: flex-start; gap: 8px; font-size: 19px; font-weight: 600; color: var(--title); letter-spacing: 0; }
.mshare { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px; }
.mshare h3 { margin-bottom: 2px; }
.mshare p { margin: 0; }

/* Formulario con ilustración */
.modal.with-aside { max-width: 820px; display: grid; grid-template-columns: 210px minmax(0, 1fr); overflow: hidden; }
.modal-aside { background: var(--primary-soft); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px 16px; text-align: center; }
.modal-aside p { margin: 0; font-size: 12px; font-weight: 600; color: var(--title); }
:root[data-theme='dark'] .modal-aside p { color: var(--text-2); }
.modal-main { min-width: 0; display: flex; flex-direction: column; }
.modal.with-aside .modal-foot { border-radius: 0 0 var(--radius-lg) 0; }
.mmembers { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.mmore { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; font: inherit; font-size: 12px; font-weight: 600; color: var(--primary); cursor: pointer; padding: 2px 0; justify-self: start; }

@media (max-width: 1100px) {
  .mt-row { grid-template-columns: minmax(220px, 1fr) 140px 150px 90px 150px; }
  .mt-c-tipo, .mt-c-vinc { display: none !important; }
}
@media (max-width: 767px) {
  .mhead { padding: 0 12px; position: static; }
  .mhead-top { flex-wrap: wrap; padding: 8px 0 6px; }
  .mhead-top .vsearch { order: 5; flex: 1 1 100%; }
  .mt-head { display: none !important; }
  .mt-row { display: flex; flex-wrap: wrap; gap: 6px 10px; padding: 12px 12px 12px calc(12px + var(--d, 0) * 0px); }
  .mt-row > div { border-right: 0; padding: 0; height: auto; }
  .mt-name { flex: 1 1 100%; padding-left: calc(var(--d, 0) * 16px) !important; }
  .mt-prog { flex: 1 1 100%; }
  .mt-group { top: 0; }
  .omap-canvas { height: calc(100vh - 200px); }
  .mkpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mkpi-v { font-size: 30px; }
  .mpanel-grid { grid-template-columns: 1fr; }
  .mdoc { padding: 18px 14px 48px; }
  .mdoc-title { font-size: 21px; }
  .mprops { grid-template-columns: 96px minmax(0, 1fr); }
  .msum { grid-template-columns: 1fr; }
  .mchart-legend { margin-left: 0; }
  .mside { width: 100vw; }
  .modal.with-aside { display: block; }
  .modal-aside { display: none; }
}

/* ---------- Fase 1b: accesibilidad ---------- */
/* ACC-6: filas, tarjetas y metas tenían outline:none; el foco de teclado vuelve a verse. */
.irow:focus-visible, .icard:focus-visible, .mrow:focus-visible, .mt-row:focus-visible {
  outline: 2px solid var(--primary); outline-offset: -2px;
}
@media (max-width: 767px) {
  /* ACC-8: con letra menor de 16 px, iOS hace zoom al enfocar el campo. */
  input, select, textarea, .cbox-area, .tt-title-input, .fsearch { font-size: 16px; }
  /* ACC-14: con el panel de tarea abierto (pantalla completa), el fondo no se desplaza. */
  body.task-panel-open { overflow: hidden; }
}
