/* Tablero de proyectos. Colores en variables; el modo oscuro solo las redefine. */
:root {
  --bg: #edf1f2;
  --surface: #ffffff;
  --ink: #12252c;
  --muted: #56696f;
  --line: #d3dcdf;
  --line-soft: #e4eaec;
  --accent: #0b6b78;
  --ok: #2a8453;
  --risk: #a96c00;
  --late: #bb3832;
  --done: #4c636d;
  --todo: #8d9da4;
  --progress: #0b6b78;
  --namecol: 320px;
  --display: "Archivo", "Segoe UI", system-ui, sans-serif;
  --body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1a1f;
    --surface: #16262d;
    --ink: #e5edef;
    --muted: #94a8af;
    --line: #2b3f47;
    --line-soft: #21333a;
    --accent: #58bccb;
    --ok: #5cc08a;
    --risk: #e2a83f;
    --late: #f0736c;
    --done: #93a9b2;
    --todo: #5d727a;
    --progress: #58bccb;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--body);
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px;
}
code { font-size: .9em; background: var(--line-soft); padding: 1px 5px; border-radius: 3px; }
.muted { color: var(--muted); }
.is-late { color: var(--late); }
.is-neg { color: var(--late); }

/* ---- cabecera ---- */
.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font: 600 17px/1 var(--display); font-stretch: 112%; color: var(--ink); text-decoration: none;
}
.brand-mark {
  width: 22px; height: 14px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) 0 62%, color-mix(in srgb, var(--accent) 28%, var(--surface)) 62%);
}
.top nav { display: flex; gap: 4px; }
.top nav a {
  padding: 6px 12px; border-radius: 4px; color: var(--muted); text-decoration: none; font-weight: 600;
}
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current] { color: var(--ink); background: var(--bg); }
.top-tools { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.pm-filter { display: flex; align-items: center; gap: 8px; }
.pm-filter label, .sync { color: var(--muted); font-size: 14px; }
.sync a { margin-left: 6px; }
select, input[type=search], input[type=password] {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; min-height: 36px;
}

.notice {
  margin: 0; padding: 8px clamp(16px, 4vw, 40px); font-size: 14px;
  background: color-mix(in srgb, var(--risk) 14%, var(--bg)); border-bottom: 1px solid var(--line);
}
.notice ul { margin: 6px 0 0; padding-left: 20px; }

main { max-width: 1320px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 64px; }
section { margin-top: 40px; }

/* ---- tipografía ---- */
h1, h2 { font-family: var(--display); font-stretch: 112%; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(26px, 3.4vw, 40px); line-height: 1.12; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 19px; line-height: 1.3; font-weight: 600; }
.headline { max-width: 22em; }
.lead { margin: 8px 0 24px; max-width: 70ch; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin-bottom: 12px; }
.two h2 { margin-bottom: 10px; }
.two h2:not(:first-child) { margin-top: 28px; }
.foot { color: var(--muted); font-size: 14px; max-width: 80ch; margin: 12px 0 0; }
.empty { color: var(--muted); padding: 14px 0; margin: 0; }
.crumb { margin: 0 0 8px; font-size: 14px; }

/* ---- fila de indicadores ---- */
.stats { display: flex; flex-wrap: wrap; margin: 22px 0 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stats > div { flex: 1 1 180px; padding: 14px 24px 14px 0; margin-right: 24px; border-right: 1px solid var(--line); }
.stats > div:last-child { border-right: 0; margin-right: 0; }
.stats dt { color: var(--muted); font-size: 14px; }
.stats dd { margin: 2px 0 0; font: 600 28px/1.15 var(--display); font-stretch: 112%; }
.stats dd small { font: 400 15px var(--body); color: var(--muted); }

/* ---- estados ---- */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--c); }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.s-ok { --c: var(--ok); } .s-risk { --c: var(--risk); } .s-late { --c: var(--late); }
.s-done { --c: var(--done); } .s-todo { --c: var(--todo); } .s-progress { --c: var(--progress); }
.s-summary { --c: var(--ink); } .s-load { --c: var(--accent); }
.st.s-todo, .st.s-done { color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter {
  font: inherit; font-size: 14px; color: var(--ink); background: transparent; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; min-height: 32px;
  display: inline-flex; align-items: center; gap: 6px;
}
.filter[class*="s-"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.filter b { color: var(--muted); font-weight: 600; }
.filter[aria-pressed=true] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filter[aria-pressed=true] b { color: inherit; }

/* ---- cronograma ---- */
.tl { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.tl-head, .tl-row { display: grid; grid-template-columns: var(--namecol) minmax(0, 1fr); }
.tl-head { border-bottom: 1px solid var(--line); }
.tl-axis { position: relative; height: 30px; margin-right: 16px; }
.tl-axis span { position: absolute; top: 6px; padding-left: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.tl-body { position: relative; }
.tl-lines { position: absolute; top: 0; bottom: 0; left: var(--namecol); right: 16px; pointer-events: none; }
.tl-lines i { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line-soft); }
.tl-lines b { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--ink); z-index: 2; }
.tl-lines b span {
  position: absolute; top: 0; left: 50%; transform: translate(-50%, -100%);
  font: 600 12px/1 var(--body); padding: 3px 6px; border-radius: 3px 3px 0 0; background: var(--ink); color: var(--bg);
}
.tl-row { color: inherit; text-decoration: none; border-top: 1px solid var(--line-soft); min-height: 52px; }
.tl-row:first-of-type { border-top: 0; }
a.tl-row:hover { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
a.tl-row:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.tl-name { padding: 8px 14px 8px calc(16px + var(--nivel, 0) * 16px); min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.tl-name strong { font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-name > span { font-size: 13px; color: var(--muted); display: flex; gap: 10px; align-items: center; white-space: nowrap; overflow: hidden; }
.tl-track { position: relative; margin-right: 16px; }
.bar {
  position: absolute; top: 50%; height: 16px; margin-top: -8px; border-radius: 3px; overflow: hidden;
  background: color-mix(in srgb, var(--c) 26%, var(--surface));
}
.bar i { display: block; height: 100%; background: var(--c); }
.bar-label { position: absolute; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--muted); white-space: nowrap; }
.diamond { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; transform: rotate(45deg); background: var(--c); border-radius: 1px; }

.tl-tasks .tl-row { min-height: 40px; }
.tl-tasks .tl-name strong { font-weight: 400; }
.tl-tasks .is-summary { background: color-mix(in srgb, var(--ink) 4%, var(--surface)); }
.tl-tasks .is-summary .tl-name strong { font-weight: 600; }
.tl-tasks .is-summary .bar { height: 6px; margin-top: -3px; border-radius: 1px; }

/* ---- listas ---- */
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 0 48px; }
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.list li { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.list .when { font-weight: 600; white-space: nowrap; }
.list li > span:last-child { display: flex; flex-direction: column; }
.list a, .list em { font-size: 14px; font-style: normal; color: var(--muted); }
.list a:hover { color: var(--accent); }
.list.sub { margin: 8px 0 4px 38px; }

/* ---- tablas ---- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
table.data { width: 100%; border-collapse: collapse; }
.data th, .data td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.data tbody tr:last-child td { border-bottom: 0; }
.data th { font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; border-bottom-color: var(--line); }
.data th[data-type] { cursor: pointer; user-select: none; }
.data th[aria-sort=ascending]::after { content: " ▲"; font-size: 10px; }
.data th[aria-sort=descending]::after { content: " ▼"; font-size: 10px; }
.data .num, .data td:last-child { white-space: nowrap; }
.data .num { text-align: right; }
.data td a { color: var(--ink); font-weight: 600; text-decoration: none; }
.data td a:hover { color: var(--accent); text-decoration: underline; }
.data.compact { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; border-collapse: separate; border-spacing: 0; }
.is-unassigned td { color: var(--muted); font-style: italic; }
details > summary { cursor: pointer; }

.who { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.avatar {
  position: relative; flex: none; width: 26px; height: 26px; border-radius: 50%; overflow: hidden;
  display: inline-grid; place-items: center; font: 600 11px/1 var(--body); font-style: normal;
  background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--accent);
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.meter { display: flex; align-items: center; gap: 12px; min-width: 210px; }
.meter-bar { position: relative; flex: 1; height: 8px; border-radius: 2px; background: color-mix(in srgb, var(--c) 22%, var(--surface)); }
.meter-bar i { display: block; height: 100%; border-radius: 2px; background: var(--c); }
.meter-bar u { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--ink); }
.meter > span { white-space: nowrap; min-width: 92px; }
.meter small { color: var(--muted); font-size: 13px; }

/* ---- detalle de proyecto ---- */
.p-head h1 { max-width: 26em; }
.p-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin: 12px 0 0; color: var(--muted); }
.progress { margin-top: 28px; }
.big-meter { position: relative; height: 22px; margin-top: 30px; border-radius: 3px; background: color-mix(in srgb, var(--c) 22%, var(--surface)); }
.big-meter i { display: block; height: 100%; border-radius: 3px; background: var(--c); }
.big-meter u { position: absolute; top: -6px; bottom: -6px; width: 2px; margin-left: -1px; background: var(--ink); text-decoration: none; }
.big-meter u span {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 4px;
  font-size: 13px; color: var(--muted); white-space: nowrap;
}
.progress-text { margin: 10px 0 0; }
.progress-text strong { font: 600 22px var(--display); font-stretch: 112%; }

.stack-list { list-style: none; margin: 0; padding: 0; }
.stack-list li { padding: 10px 0; border-top: 1px solid var(--line-soft); }
.stack-list li:first-child { border-top: 1px solid var(--line); }
.stack-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.stack-head span { color: var(--muted); font-size: 14px; }
.stack { display: flex; gap: 2px; height: 20px; }
.stack i { min-width: 20px; border-radius: 2px; background: var(--c); color: var(--surface); font: 600 12px/20px var(--body); text-align: center; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; background: var(--c); }

/* ---- paneles (login, errores) ---- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 28px; }
.narrow { max-width: 620px; margin: 6vh auto 0; }
.panel h1 { font-size: 26px; margin-bottom: 10px; }
.panel label { display: block; margin: 16px 0 6px; font-weight: 600; }
.panel input { width: 100%; }
.alert { padding: 10px 14px; border-left: 3px solid var(--late); background: color-mix(in srgb, var(--late) 9%, var(--surface)); overflow-wrap: anywhere; }
button[type=submit], .button {
  display: inline-block; margin-top: 18px; font: 600 16px var(--body); cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--surface); border: 0; border-radius: 4px; padding: 9px 18px; min-height: 40px;
}

/* ---- pantallas angostas ---- */
@media (max-width: 860px) {
  :root { --namecol: 0px; }
  .tl-head > div:first-child { display: none; }
  .tl-head, .tl-row { grid-template-columns: minmax(0, 1fr); }
  .tl-axis, .tl-track { margin-left: 16px; }
  .tl-lines { left: 16px; }
  .tl-track { height: 26px; }
  .tl-name { padding-bottom: 2px; }
  .tl-name strong { white-space: normal; }
  .stats > div { flex-basis: 40%; border-right: 0; margin-right: 0; }
  .top-tools { margin-left: 0; width: 100%; }
}
@media print {
  .top-tools, .filters, #buscar { display: none; }
  body { background: #fff; }
}
