/* Trazo · hoja de estilos
   Paleta: tinta violeta #524E9C (principal) y rosa señal #E94167 (acento, solo para lo que exige atención).
   Tipografía: Bricolage Grotesque para títulos y códigos; Instrument Sans para lectura. */

:root {
  --primary: #524E9C;
  --primary-700: #3F3B80;
  --primary-50: #EEEDF7;
  --primary-100: #DEDCF0;
  --accent: #E94167;
  --accent-700: #C92C51;
  --accent-50: #FDECF0;
  --ink: #23213F;
  --ink-2: #4A4868;
  --muted: #74728C;
  --line: #E4E3EE;
  --line-2: #D3D1E2;
  --bg: #F4F4F8;
  --surface: #FFFFFF;
  --surface-2: #F9F9FC;
  --side: #26234A;
  --side-2: #332F5E;
  --ok: #2E9467;
  --warn: #C98A12;
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Bricolage Grotesque", "Instrument Sans", system-ui, sans-serif;
  --side-w: 248px;
  --shadow: 0 1px 2px rgba(35, 33, 63, .06), 0 8px 24px -12px rgba(35, 33, 63, .18);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-700); }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(24px, 3vw, 32px); }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 .6em; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

.ico { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.muted { color: var(--muted); }
.small, small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.late { color: var(--accent-700); }
.soon { color: var(--warn); }
.ok { color: var(--ok); }
.upper { text-transform: uppercase; }
.link { font-weight: 600; font-size: 14px; }
.code {
  font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .02em;
  color: var(--primary); font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-700); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-700); color: #fff; }
.btn-ghost { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger:hover { border-color: var(--accent); color: var(--accent-700); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--primary-50); color: var(--primary); }
.icon-btn.subtle { width: 32px; height: 32px; color: var(--muted); }
.link-btn { background: none; border: 0; color: var(--primary); font-weight: 600; cursor: pointer; padding: 0; }
.link-btn:disabled { color: var(--muted); cursor: default; }

/* ---------- Estructura ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side); color: #CFCDE6;
  display: flex; flex-direction: column; z-index: 40; overflow-y: auto; padding-bottom: 24px;
}
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 16px; }
.logo { font-family: var(--display); font-size: 24px; font-weight: 700; color: #fff; letter-spacing: -.02em; }
.logo:hover { color: #fff; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-left: 4px; vertical-align: 2px; }
.side-close { display: none; color: #CFCDE6; }
.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.side-nav a, .side-companies a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: #CFCDE6; font-weight: 500;
}
.side-nav a:hover, .side-companies a:hover { background: var(--side-2); color: #fff; }
.side-nav a.active { background: var(--primary); color: #fff; }
.side-label { font-size: 12px; color: #8F8CB3; margin: 18px 12px 6px; font-weight: 600; }
.side-companies { padding: 0 12px; margin-top: 8px; }
.side-companies a { padding: 6px 12px; font-size: 14px; }
.side-companies i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.side-companies span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scrim { display: none; }

.shell { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; }
.search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; color: var(--muted); }
.search input, .search input[type=search] { border: 0; outline: 0; box-shadow: none; background: transparent; height: 40px; min-height: 0; padding: 0; width: 100%; color: var(--ink); }
.search:focus-within { border-color: var(--primary); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.bell b {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}
.avatar-btn { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.avatar {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-100); color: var(--primary-700); font-weight: 700; font-size: 13px; flex: none;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

.main { padding: 28px; width: 100%; max-width: 1360px; margin: 0 auto; flex: 1; }
.bottom-nav { display: none; }

/* Menús desplegables */
.dropdown { position: relative; }
.menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 200px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; display: none; z-index: 50;
}
.menu-right { left: auto; right: 0; }
.dropdown.open .menu { display: block; }
.menu a, .menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; color: var(--ink);
  border: 0; background: none; cursor: pointer; text-align: left; font-size: 14px;
}
.menu a:hover, .menu button:hover { background: var(--primary-50); color: var(--primary); }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: flex; flex-direction: column; }
.menu-head small { color: var(--muted); }

/* ---------- Encabezados de página ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p.muted { margin: 6px 0 0; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-actions form { margin: 0; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary); }
.section-h { margin-bottom: 4px; }
.sub-h { font-size: 14px; color: var(--ink-2); margin: 18px 0 10px; }

/* Héroe de proyecto: la franja de color de la empresa es el elemento distintivo */
.project-hero, .task-head {
  position: relative; display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 24px 22px 32px;
  margin-bottom: 18px; overflow: hidden;
}
.project-hero::before, .task-head::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 8px; background: var(--c); }
.project-hero-main { flex: 1; min-width: 260px; }
.hero-code { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.hero-code > span:first-child { font-family: var(--display); font-weight: 700; font-size: 15px; color: var(--c, var(--primary)); letter-spacing: .03em; }
.hero-progress { margin-top: 18px; max-width: 560px; }
.hero-progress p { margin: 8px 0 0; font-size: 14px; color: var(--ink-2); }
.hero-progress strong { font-family: var(--display); font-size: 20px; color: var(--ink); }

/* ---------- Paneles ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel + .panel { margin-top: 0; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.panel-head h2 { margin-right: auto; }
.panel-alert { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: inset 4px 0 0 var(--accent); }
.count { font-size: 12px; font-weight: 700; color: var(--primary); background: var(--primary-50); border-radius: 20px; padding: 2px 8px; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.empty { color: var(--muted); font-size: 14px; margin: 4px 0; }
.empty-state { text-align: center; padding: 56px 20px; background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty-state h2 { margin: 10px 0 6px; font-size: 20px; }
.empty-state .btn { margin-top: 10px; }
.empty-ico { width: 44px; height: 44px; color: var(--primary); }
.error-page .error-code { font-family: var(--display); font-size: 64px; font-weight: 700; color: var(--primary-100); margin: 0; line-height: 1; }
.prose { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink-2); }
.notice { display: flex; gap: 12px; align-items: flex-start; background: var(--primary-50); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; color: var(--ink-2); }
.notice .ico { color: var(--primary); margin-top: 2px; }
.notice-lock { background: var(--accent-50); }
.notice-lock .ico { color: var(--accent-700); }
.code-block { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 13px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }

/* Resumen de estatus (inicio) */
.pulse { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.pulse-sm { grid-template-columns: repeat(2, minmax(0, 220px)); }
.pulse-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--ink);
  display: flex; flex-direction: column; border-top: 3px solid var(--s);
}
.pulse-item strong { font-family: var(--display); font-size: 28px; line-height: 1.1; }
.pulse-item span { font-size: 13px; color: var(--muted); }
a.pulse-item:hover { border-color: var(--s); color: var(--ink); }

/* ---------- Etiquetas, estatus y píldoras ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px; font-size: 12.5px; font-weight: 600;
  background: color-mix(in srgb, var(--b) 12%, white); color: color-mix(in srgb, var(--b) 80%, black); white-space: nowrap;
}
.badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--b); }
.badge em { font-style: normal; font-weight: 500; padding-left: 6px; margin-left: 2px; border-left: 1px solid color-mix(in srgb, var(--b) 35%, white); }
.badge-por_hacer { --b: #8A89A6; }
.badge-en_progreso { --b: #524E9C; }
.badge-en_revision { --b: #C98A12; }
.badge-bloqueado { --b: #E94167; }
.badge-hecho { --b: #2E9467; }
.pill {
  --p: var(--muted); display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: color-mix(in srgb, var(--p) 12%, white); color: color-mix(in srgb, var(--p) 85%, black); border: 0; white-space: nowrap;
}
.pill .ico { width: 13px; height: 13px; }
.pill-alta { --p: var(--warn); }
.pill-urgente { --p: var(--accent); }
.pill.is-paid { --p: var(--ok); }
.pill.is-pending { --p: var(--warn); }
.pill-btn { cursor: pointer; }
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip {
  --t: var(--primary); display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 500;
  background: color-mix(in srgb, var(--t) 10%, white); color: color-mix(in srgb, var(--t) 85%, black);
}
.dot-label { display: inline-flex; align-items: center; gap: 7px; }
.dot-label i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.due { font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.due .ico { width: 14px; height: 14px; }
.due-late { color: var(--accent-700); }
.due-soon { color: var(--warn); }
.lock { color: var(--accent); display: inline-flex; }
.lock .ico { width: 15px; height: 15px; }
.role { font-size: 13px; font-weight: 600; }
.role-admin { color: var(--accent-700); }
.role-gerente { color: var(--primary); }
.role-veedor { color: var(--muted); }
.req { font-size: 11px; color: var(--accent-700); font-weight: 600; }

/* Barras de progreso */
.progress { display: block; height: 8px; border-radius: 8px; background: var(--primary-50); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 8px; background: var(--accent); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.progress-lg { height: 12px; }
.progress-sm { display: inline-block; width: 64px; height: 6px; vertical-align: middle; }
.progress.is-hot > span { background: var(--accent-700); }
.stackbar { display: flex; height: 10px; border-radius: 10px; overflow: hidden; gap: 2px; margin-bottom: 10px; }
.legend { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.legend strong { color: var(--ink); margin-left: 2px; }

/* ---------- Tarjetas de proyecto ---------- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.pcard {
  position: relative; display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 18px 16px; color: var(--ink); overflow: hidden;
}
.pcard::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--c); }
.pcard:hover { border-color: color-mix(in srgb, var(--c) 55%, var(--line)); color: var(--ink); }
.pcard-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pcard-code { font-family: var(--display); font-weight: 700; font-size: 13px; color: var(--c); letter-spacing: .03em; }
.pcard-name { font-family: var(--display); font-size: 18px; font-weight: 700; line-height: 1.2; }
.pcard-company { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--ink-2); }
.pcard-company i { width: 9px; height: 9px; border-radius: 3px; background: var(--c); }
.pcard-meta { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.pcard-meta .ico { width: 14px; height: 14px; }
.pcard-progress { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.pcard-pct { font-size: 13px; }
.pcard-pct strong { font-family: var(--display); }
.pcard-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pcard-foot .chips { margin: 0; }
.mini-projects { display: flex; flex-direction: column; gap: 8px; }
.mini-project { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; border-left: 4px solid var(--c); background: var(--surface-2); color: var(--ink); }
.mini-project:hover { background: var(--primary-50); color: var(--ink); }
.mini-top { display: flex; justify-content: space-between; }
.mini-name { font-weight: 600; font-size: 14px; }
.mini-project .progress { height: 5px; }

/* Empresas */
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ccard { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; color: var(--ink); }
.ccard:hover { border-color: var(--c); color: var(--ink); }
.ccard-badge { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 12px; background: var(--c); font-family: var(--display); font-weight: 700; font-size: 14px; flex: none; }
.ccard-body { display: flex; flex-direction: column; min-width: 0; }
.ccard-body small { color: var(--muted); }

/* ---------- Filas de tareas ---------- */
.tlist { display: flex; flex-direction: column; }
.trow { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); color: var(--ink); }
.trow:last-child { border-bottom: 0; }
.trow:hover { background: var(--surface-2); color: var(--ink); }
.trow-bar { width: 4px; align-self: stretch; border-radius: 4px; flex: none; }
.trow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.trow-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.trow-top .muted { white-space: nowrap; }
.trow-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.trow-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* ---------- Tablas ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.table-wrap.flat { border: 0; border-radius: 0; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table a { color: var(--ink); }
.table a.code, .table a:hover { color: var(--primary); }
.table th.num { text-align: right; }
.is-sub td:first-child { padding-left: 30px; }
.is-off td { opacity: .55; }
.is-alert td { background: color-mix(in srgb, var(--accent) 5%, white); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.row-actions form { margin: 0; }
.person-inline { display: inline-flex; align-items: center; gap: 10px; }

/* ---------- Formularios ---------- */
.form-panel { padding: 24px; }
.form-panel fieldset { border: 0; padding: 0; margin: 0 0 24px; }
.form-panel fieldset + fieldset > legend { width: 100%; padding-top: 22px; border-top: 1px solid var(--line); }
legend { font-family: var(--display); font-weight: 700; font-size: 16px; margin-bottom: 14px; padding: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid legend { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-full { grid-column: 1 / -1; }
.field.narrow { max-width: 240px; }
.field > span:first-child { font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.field small { color: var(--muted); }
.field .static { margin: 0; padding: 9px 0; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date],
input[type=time], input[type=tel], input[type=url], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface);
  color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 80px; }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2374728C' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
input[type=color] { width: 48px; height: 42px; padding: 4px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); cursor: pointer; }
.color-field { display: flex; align-items: center; gap: 10px; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; }
.check.field { flex-direction: row; align-items: center; padding-top: 24px; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { appearance: none; width: 40px; height: 22px; border-radius: 22px; background: var(--line-2); position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(18px); }
.actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; flex-wrap: wrap; }
.actions.left { justify-content: flex-start; }
.actions form { margin: 0; }
.parent-rule { display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); border-radius: 10px; padding: 14px; }
.type-fields:empty { display: none; }
.type-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; padding: 16px; border-radius: 10px; background: var(--primary-50); }
.type-fields .tf-title { grid-column: 1 / -1; font-family: var(--display); font-weight: 700; color: var(--primary-700); margin: 0; }
.unit-wrap { display: flex; align-items: center; gap: 8px; }
.unit-wrap span { color: var(--muted); font-size: 13px; }
.inline-form { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.inline-form input[type=text], .inline-form select { flex: 1; min-width: 140px; }
.inline-form input[type=date] { width: auto; flex: none; }
.mini-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.mini-form .btn { grid-column: 1 / -1; justify-self: start; }
.inline-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.inline-label input { width: auto; }

/* Selector múltiple con chips */
.ms { position: relative; }
.ms-box { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 42px; padding: 5px 8px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); cursor: text; }
.ms.open .ms-box, .ms-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.ms-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--primary-50); color: var(--primary-700); border-radius: 6px; padding: 3px 4px 3px 9px; font-size: 13px; font-weight: 500; }
.ms-chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 4px; font-size: 16px; line-height: 1; border-radius: 4px; }
.ms-chip button:hover { background: var(--primary-100); }
.ms-input { flex: 1; min-width: 120px; border: 0 !important; outline: 0; box-shadow: none !important; padding: 4px !important; min-height: 28px !important; background: transparent !important; }
.ms-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); z-index: 20; padding: 4px; display: none; }
.ms.open .ms-list { display: block; }
.ms-opt { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.ms-opt:hover, .ms-opt.hl { background: var(--primary-50); }
.ms-empty { padding: 10px; color: var(--muted); font-size: 13px; }

/* ---------- Pestañas, segmentos y filtros ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs-scroll { overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--primary); border-bottom-color: var(--primary); }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; }
.seg a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.seg a:hover { color: var(--ink); }
.seg a.on { background: var(--primary); color: #fff; }
.seg .ico { width: 16px; height: 16px; }
.viewbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.filters input[type=search] { width: 240px; flex: 0 1 240px; }
.filters select { width: auto; min-width: 150px; flex: 0 1 auto; }
.filters .check { align-items: center; }
.filters-box { margin-bottom: 14px; }
.filters-box summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; color: var(--ink-2); padding: 6px 0; list-style: none; }
.filters-box summary::-webkit-details-marker { display: none; }
.filters-box[open] summary { margin-bottom: 10px; }
.quick-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.qf { padding: 6px 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line-2); color: var(--ink-2); font-weight: 600; font-size: 13.5px; }
.qf.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.qf:hover:not(.on) { border-color: var(--primary); color: var(--primary); }
.pager { display: flex; gap: 12px; justify-content: center; align-items: center; margin-top: 18px; }

/* ---------- Ficha: datos ---------- */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; margin: 0; }
.facts dt { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
.facts dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.facts dd small { display: block; width: 100%; }
.facts-full { grid-column: 1 / -1; }
.facts-type { background: var(--surface-2); padding: 14px; border-radius: 10px; }
.person { display: inline-flex; flex-direction: column; background: var(--surface-2); border-radius: 8px; padding: 4px 10px; font-size: 14px; }
.person small { color: var(--muted); font-size: 12px; }
.person.provider em { font-style: normal; font-size: 11px; color: var(--warn); font-weight: 600; }

/* Barra de estatus */
.status-bar { margin-bottom: 18px; display: flex; flex-direction: column; gap: 12px; }
.status-current { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.status-form select { width: auto; min-width: 180px; }
.status-steps { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.step { position: relative; cursor: pointer; }
.step input { position: absolute; opacity: 0; pointer-events: none; }
.step span { display: inline-block; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line-2); font-weight: 600; font-size: 13.5px; color: var(--ink-2); background: var(--surface); }
.step:hover span { border-color: var(--s); }
.step input:checked + span { background: var(--s); border-color: var(--s); color: #fff; }
.step input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--s) 40%, transparent); outline-offset: 2px; }
.step.off { cursor: not-allowed; }
.step.off span { opacity: .4; text-decoration: line-through; }

/* Subtareas, secuencia, hitos */
.subtasks, .seq-list, .milestones, .files, .people, .comments, .timeline, .type-list, .field-list, .notes, .pay-list { list-style: none; margin: 0; padding: 0; }
.subtasks li, .seq-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.subtasks li:last-child, .seq-list li:last-child { border-bottom: 0; }
.subtasks li a, .seq-list li a { color: var(--ink); font-weight: 500; }
.subtasks li.done a { color: var(--muted); text-decoration: line-through; }
.sub-meta { display: flex; gap: 8px; align-items: center; }
.sequence { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.sequence .sub-h { margin-top: 0; }
.milestones { position: relative; }
.milestones li { display: flex; align-items: center; gap: 10px; padding: 8px 0; position: relative; }
.milestones li:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 36px; bottom: -8px; border-left: 2px dotted var(--line-2); }
.milestones form { margin: 0; }
.ms-check { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--surface); color: transparent; cursor: pointer; padding: 0; flex: none; }
.ms-check .ico { width: 15px; height: 15px; }
.milestones li.done .ms-check { background: var(--ok); border-color: var(--ok); color: #fff; }
.milestones li.late .ms-check { border-color: var(--accent); }
.ms-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ms-body small { color: var(--muted); }
.milestones li.late small { color: var(--accent-700); }
.milestones li.done strong { color: var(--muted); text-decoration: line-through; }

/* Adjuntos */
.files li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.files li:last-child { border-bottom: 0; }
.files form { margin: 0; }
.file-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--primary-50); color: var(--primary); flex: none; }
.file-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-body a { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-body small { color: var(--muted); }
.uploader { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.uploader .btn { align-self: flex-start; }
.drop { display: block; border: 2px dashed var(--line-2); border-radius: 10px; padding: 16px; text-align: center; cursor: pointer; position: relative; }
.drop.over, .drop:hover { border-color: var(--primary); background: var(--primary-50); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop span { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ink-2); font-size: 14px; }
.drop small { color: var(--muted); font-size: 12px; }
.drop .ico { width: 22px; height: 22px; color: var(--primary); }
.upload-progress { height: 6px; border-radius: 6px; background: var(--primary-50); overflow: hidden; }
.upload-progress span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.upload-note { font-size: 13px; margin: 0; padding: 8px 10px; border-radius: 8px; }
.upload-note.warn { background: #FDF4E3; color: #8A5D07; }
.upload-note.heavy { background: var(--accent-50); color: var(--accent-700); }
.upload-note.err { background: var(--accent-50); color: var(--accent-700); font-weight: 600; }

/* Personas, comentarios e historial */
.people li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.people li > span:not(.avatar), .people li > a { flex: 1; display: flex; flex-direction: column; min-width: 0; color: var(--ink); }
.people small { color: var(--muted); }
.people form { margin: 0; }
.comments li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.comments li:target { background: var(--primary-50); border-radius: 10px; padding-left: 8px; }
.comment-body { flex: 1; min-width: 0; }
.comment-body p { margin: 0; overflow-wrap: anywhere; }
.comment-meta { margin-bottom: 4px !important; }
.comment-form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.comment-form .btn { align-self: flex-end; }
.history summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.history summary::-webkit-details-marker { display: none; }
.history summary h2::after { content: " ▸"; color: var(--muted); }
.history[open] summary h2::after { content: " ▾"; }
.timeline { margin-top: 14px; border-left: 2px solid var(--line); padding-left: 16px; }
.timeline li { position: relative; padding: 0 0 14px; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.timeline p { margin: 0; }
.changes { list-style: none; padding: 6px 0 0; margin: 0; font-size: 13px; }
.changes li { padding: 2px 0; overflow-wrap: anywhere; }
.changes span { color: var(--muted); }
.changes del { color: var(--accent-700); text-decoration: line-through; }
.changes ins { color: var(--ok); text-decoration: none; }
.audit-changes summary { cursor: pointer; font-size: 13px; color: var(--primary); margin-top: 4px; }
.act { font-weight: 600; font-size: 13px; }
.act-login_failed, .act-2fa_failed, .act-login_blocked, .act-purge { color: var(--accent-700); }
.act-login, .act-create, .act-restore { color: var(--ok); }

/* Notificaciones */
.notes { padding: 0; overflow: hidden; }
.notes li a { display: flex; flex-direction: column; padding: 14px 20px; border-bottom: 1px solid var(--line); color: var(--ink); }
.notes li:last-child a { border-bottom: 0; }
.notes li a:hover { background: var(--surface-2); }
.notes li.unread a { box-shadow: inset 4px 0 0 var(--accent); background: color-mix(in srgb, var(--accent) 3%, white); }
.notes span { color: var(--ink-2); font-size: 14px; }

/* Finanzas */
.money-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.money-strip div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; }
.money-strip span { font-size: 13px; color: var(--muted); }
.money-strip strong { font-family: var(--display); font-size: 22px; font-variant-numeric: tabular-nums; }
.money-strip .neg strong { color: var(--accent-700); }
.budget-bar { display: flex; height: 10px; border-radius: 10px; background: var(--primary-50); overflow: hidden; margin-bottom: 18px; }
.budget-bar .paid { background: var(--ok); }
.budget-bar .pend { background: var(--warn); }
.pay-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pay-list li span { display: flex; flex-direction: column; }
.pay-list small { color: var(--muted); }

/* Ajustes */
.type-list li, .field-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.type-list li > span:nth-child(2) { margin-left: auto; }
.type-list li.is-off { opacity: .55; }
.field-list li { display: block; }
.field-list summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; list-style: none; }
.field-list summary::-webkit-details-marker { display: none; }
.field-edit { margin-top: 14px; padding: 14px; background: var(--surface-2); border-radius: 10px; }
.field-del { margin-top: 8px; }
.label-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.label-col { border-top: 3px solid var(--s); background: var(--surface-2); border-radius: 10px; padding: 12px; }
.label-col h3 { margin-bottom: 10px; }
.label-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.label-row input[type=text] { flex: 1; min-height: 36px; padding: 6px 10px; }
.label-row select { width: auto; min-height: 36px; padding: 6px 30px 6px 10px; }
.label-row input[type=color] { width: 36px; height: 36px; }
.label-row.is-off input[type=text] { opacity: .55; }
.label-row-inner { display: flex; gap: 6px; align-items: center; flex: 1; margin: 0; }
.tag-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 4px 16px; }
.tag-admin form { margin: 0; }
.storage-meter p { margin: 10px 0 0; }
.roles-help { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.roles-help div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.roles-help span { color: var(--muted); }

/* ---------- Avisos ---------- */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 10px; font-size: 14px; font-weight: 500; }
.flash span { flex: 1; }
.flash-success { background: #E6F4EC; color: #1E6B49; }
.flash-error { background: var(--accent-50); color: var(--accent-700); }
.flash-info { background: var(--primary-50); color: var(--primary-700); }
.flash-close { border: 0; background: none; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; opacity: .6; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 90; max-width: min(420px, calc(100vw - 40px)); }
.toast { padding: 12px 16px; border-radius: 10px; background: var(--ink); color: #fff; box-shadow: var(--shadow); font-size: 14px; animation: toast-in .25s ease-out; }
.toast.error { background: var(--accent-700); }
.toast.warn { background: #8A5D07; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

/* ---------- Vistas de tareas: Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.kcol { background: color-mix(in srgb, var(--s) 6%, var(--bg)); border-radius: var(--radius); padding: 10px; min-height: 200px; border-top: 3px solid var(--s); }
.kcol.over { background: color-mix(in srgb, var(--s) 14%, var(--bg)); }
.kcol-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 10px; }
.kcol-head h3 { font-size: 14px; }
.kcol-head span { font-size: 12px; font-weight: 700; color: var(--muted); }
.kcards { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 10px 14px; cursor: grab; position: relative; display: block; color: var(--ink); }
.kcard::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--c, var(--line-2)); }
.kcard:hover { border-color: var(--line-2); color: var(--ink); }
.kcard.dragging { opacity: .5; }
.kcard.locked { cursor: default; }
.kcard-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.kcard-title { display: block; font-weight: 500; margin: 4px 0 8px; font-size: 14px; line-height: 1.35; }
.kcard-meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.kcard-label { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 5px; background: var(--surface-2); color: var(--ink-2); }
.kcard-move { position: absolute; right: 4px; bottom: 4px; width: 28px; height: 28px; opacity: 0; }
.kcard:hover .kcard-move, .kcard-move:focus { opacity: 1; }
.kmenu { position: absolute; right: 4px; bottom: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; z-index: 10; min-width: 160px; }
.kmenu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.kmenu button:hover { background: var(--primary-50); }

/* Calendario */
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); gap: 8px; }
.cal-head h3 { font-size: 18px; text-transform: capitalize; }
.cal-nav { display: flex; gap: 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px; text-align: center; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.cal-day { min-height: 116px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.out { background: var(--surface-2); }
.cal-day.out .cal-num { color: var(--line-2); }
.cal-num { font-size: 12.5px; font-weight: 600; color: var(--ink-2); align-self: flex-end; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .cal-num { background: var(--accent); color: #fff; }
.cal-ev { display: block; font-size: 12px; padding: 2px 6px; border-radius: 5px; background: color-mix(in srgb, var(--s) 14%, white); color: color-mix(in srgb, var(--s) 80%, black); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid var(--s); }
.cal-ev:hover { color: var(--ink); background: color-mix(in srgb, var(--s) 24%, white); }
.cal-ev.ms { --s: var(--accent); font-weight: 600; }
.cal-more { font-size: 11.5px; color: var(--muted); padding-left: 6px; background: none; border: 0; text-align: left; cursor: pointer; }
.cal-list { display: none; }

/* Gantt */
.gantt { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.gantt-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.gantt-body { display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.gantt-names { border-right: 1px solid var(--line); }
.gantt-scroll { overflow-x: auto; position: relative; }
.gantt-row-name { height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--line); font-size: 13px; overflow: hidden; white-space: nowrap; color: var(--ink); }
.gantt-row-name:hover { background: var(--surface-2); color: var(--ink); }
.gantt-row-name.sub { padding-left: 28px; }
.gantt-row-name span:last-child { overflow: hidden; text-overflow: ellipsis; }
.gantt-scale { display: flex; height: 44px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; }
.gantt-names-head { height: 44px; border-bottom: 1px solid var(--line); background: var(--surface-2); display: flex; align-items: center; padding: 0 12px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.gantt-cell { flex: none; border-right: 1px solid var(--line); font-size: 11px; color: var(--muted); display: flex; flex-direction: column; justify-content: center; align-items: center; line-height: 1.2; }
.gantt-cell.we { background: color-mix(in srgb, var(--line) 40%, transparent); }
.gantt-cell.today { color: var(--accent-700); font-weight: 700; }
.gantt-canvas { position: relative; }
.gantt-line { height: 40px; border-bottom: 1px solid var(--line); position: relative; }
.gantt-bar { position: absolute; top: 9px; height: 22px; border-radius: 6px; background: var(--s); color: #fff; font-size: 11.5px; font-weight: 600; padding: 0 8px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; min-width: 8px; }
.gantt-bar:hover { color: #fff; filter: brightness(1.08); }
.gantt-bar.nodates { background: repeating-linear-gradient(45deg, var(--line-2), var(--line-2) 4px, var(--line) 4px, var(--line) 8px); color: var(--muted); }
.gantt-bar.late { box-shadow: 0 0 0 2px var(--accent); }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); z-index: 2; pointer-events: none; }
.gantt-ms { position: absolute; top: 12px; width: 14px; height: 14px; transform: rotate(45deg); background: var(--accent); border: 2px solid #fff; z-index: 3; }
.gantt-arrows { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 1; }
.gantt-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.gantt-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Acceso (invitados) ---------- */
.guest { background: var(--surface); }
.guest-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.guest-brand { background: var(--primary); color: #fff; padding: 48px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.guest-logo { font-family: var(--display); font-size: 30px; font-weight: 700; }
.guest-trace { color: rgba(255, 255, 255, .55); margin: auto 0 32px; width: 100%; max-width: 460px; }
.guest-claim { font-family: var(--display); font-size: clamp(28px, 3.4vw, 44px); font-weight: 700; line-height: 1.08; max-width: 14ch; margin: 0; letter-spacing: -.02em; }
.guest-org { margin-top: 24px; color: rgba(255, 255, 255, .7); font-size: 14px; }
.guest-panel { display: flex; flex-direction: column; justify-content: center; padding: 48px; max-width: 480px; width: 100%; margin: 0 auto; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form h1 { font-size: 28px; }
.auth-form > p.muted { margin-top: -8px; }
.auth-alt { text-align: center; font-size: 14px; color: var(--muted); margin-top: 16px; }
.code-input { font-family: var(--display); font-size: 28px !important; letter-spacing: 10px; text-align: center; font-weight: 700; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .layout-side { grid-template-columns: minmax(0, 1fr) 320px; }
  .roles-help { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: none; }
  body.side-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  body.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(35, 33, 63, .45); z-index: 35; }
  .side-close { display: inline-grid; }
  .shell { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .layout-side, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .pulse { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .money-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guest-wrap { grid-template-columns: 1fr; }
  .guest-brand { padding: 28px 24px; min-height: 0; }
  .guest-trace { display: none; }
  .guest-claim { font-size: 26px; margin-top: 18px; }
  .gantt-body { grid-template-columns: 180px minmax(0, 1fr); }
}
@media (max-width: 680px) {
  body { font-size: 15px; }
  .topbar { padding: 10px 14px; gap: 8px; }
  .search { display: none; }
  .hide-sm { display: none; }
  .btn-accent.btn { padding: 0 12px; }
  .main { padding: 18px 16px 96px; }
  .page-head { margin-bottom: 16px; }
  .form-grid, .type-fields, .facts, .sequence, .mini-form { grid-template-columns: minmax(0, 1fr); }
  .check.field { padding-top: 0; }
  .pulse { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pulse-item:last-child { grid-column: span 2; }
  .project-hero, .task-head { padding: 18px 16px 18px 24px; }
  .filters input[type=search], .filters select { flex: 1 1 100%; width: 100%; }
  .status-steps { width: 100%; }
  .status-form select, .status-form .btn { flex: 1; }
  .roles-help { grid-template-columns: minmax(0, 1fr); }
  .trow { flex-wrap: wrap; }
  .trow-main { flex-basis: calc(100% - 20px); }
  .trow-meta { flex-direction: row; align-items: center; margin-left: 16px; }
  .trow-top .muted { display: none; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 4px; font-weight: 600; }
  .bottom-nav a.active { color: var(--primary); }
  .bottom-nav .ico { width: 22px; height: 22px; }
  .toasts { bottom: 84px; right: 16px; left: 16px; max-width: none; }
  .kanban { grid-template-columns: repeat(5, 84vw); scroll-snap-type: x mandatory; }
  .kcol { scroll-snap-align: start; }
  .kcard-move { opacity: 1; }
  .cal-grid, .cal-dow-row { display: none; }
  .cal-list { display: block; }
  .cal-list-day { padding: 10px 16px; border-bottom: 1px solid var(--line); }
  .cal-list-day h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); text-transform: capitalize; }
  .cal-list-day .cal-ev { white-space: normal; font-size: 13.5px; padding: 6px 8px; margin-bottom: 4px; }
  .gantt-body { grid-template-columns: 130px minmax(0, 1fr); }
  .gantt-row-name { font-size: 12px; padding: 0 8px; }
  .guest-panel { padding: 28px 20px; }
  .table td, .table th { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  .sidebar, .topbar, .bottom-nav, .page-actions, .uploader, .inline-form, .comment-form, .status-form { display: none !important; }
  .shell { margin: 0; }
  .main { padding: 0; }
}

/* ===================== 1.1.0 ===================== */

/* Menú lateral colapsable */
.side-collapse { color: #8F8CB3; margin-left: auto; }
.side-collapse:hover { background: var(--side-2); color: #fff; }
.side-version { order: 10; margin: auto 24px 0; padding-top: 18px; font-size: 11.5px; color: #6F6C97; }
.shell, .sidebar { transition: margin-left .2s ease, width .2s ease; }
@media (min-width: 981px) {
  body.side-mini { --side-w: 76px; }
  body.side-mini .side-head { flex-direction: column; gap: 8px; padding: 16px 0 12px; }
  body.side-mini .logo { font-size: 0; }
  body.side-mini .logo .dot { width: 12px; height: 12px; margin: 0; }
  body.side-mini .side-collapse { margin: 0; transform: scaleX(-1); }
  body.side-mini .side-nav, body.side-mini .side-companies { padding: 0 10px; }
  body.side-mini .side-nav a, body.side-mini .side-companies a { justify-content: center; padding: 10px 0; }
  body.side-mini .side-nav a span, body.side-mini .side-companies a span:not(.logo-badge), body.side-mini .side-label, body.side-mini .side-version { display: none; }
  body.side-mini .side-companies { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--side-2); }
}

/* Insignias de empresa (logo o siglas) */
.logo-badge { display: inline-grid; place-items: center; flex: none; border-radius: 8px; overflow: hidden; background: #fff; font-family: var(--display); font-weight: 700; line-height: 1; }
.logo-badge img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-badge.xs { width: 20px; height: 20px; border-radius: 5px; font-size: 8px; }
.logo-badge.sm { width: 30px; height: 30px; font-size: 10px; }
.logo-badge.md { width: 52px; height: 52px; border-radius: 12px; font-size: 14px; }
.logo-badge.lg { width: 84px; height: 84px; border-radius: 14px; font-size: 15px; }
.logo-badge:not(.is-text) { box-shadow: inset 0 0 0 1px var(--line); }
.side-companies .logo-badge:not(.is-text) { box-shadow: none; }
.side-companies .logo-badge.is-text { font-size: 0; width: 10px; height: 10px; border-radius: 3px; }
body.side-mini .side-companies .logo-badge.is-text { width: 20px; height: 20px; border-radius: 5px; font-size: 8px; }
.pcard-company .logo-badge.is-text { font-size: 0; width: 9px; height: 9px; border-radius: 3px; }
.logo-field { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.logo-inputs { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 220px; }
.logo-inputs input[type=file] { font-size: 14px; }
.old-code { --t: #8A89A6; text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }

/* Altas rápidas */
.quick-add { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; margin-top: 2px; align-self: flex-start; }
.quick-add .ico { width: 15px; height: 15px; }
.modal { border: 0; border-radius: var(--radius); padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: 0 24px 60px -20px rgba(35, 33, 63, .45); color: var(--ink); }
.modal::backdrop { background: rgba(35, 33, 63, .45); }
.quick-form { display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.quick-form h2 { font-size: 20px; }
.quick-form > p.muted { margin: -8px 0 0; }
.quick-error { background: var(--accent-50); color: var(--accent-700); padding: 8px 12px; border-radius: 8px; font-size: 14px; margin: 0; }

/* Borradores recuperados */
.draft-note { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: #FDF4E3; color: #6E4A05; border-radius: 10px; padding: 10px 14px; margin-bottom: 20px; font-size: 14px; }
.draft-note .link-btn { color: #6E4A05; text-decoration: underline; }

/* Reportes */
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.report-choice { display: flex; gap: 8px; flex-wrap: wrap; }
.report-choice label { cursor: pointer; }
.report-choice input { position: absolute; opacity: 0; pointer-events: none; }
.report-choice span { display: inline-block; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line-2); font-weight: 600; font-size: 13.5px; background: var(--surface); }
.report-choice input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.report-choice input:focus-visible + span { outline: 3px solid var(--primary-100); }
.report-count { font-family: var(--display); font-size: 15px; }
.report-formats { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 680px) { .report-grid { grid-template-columns: minmax(0, 1fr); } }
