/* PMO BIZZARRO · hoja de estilos principal
   Línea gráfica: fondo claro, texto negro, acentos amarillos y logotipo oficial Bizzarro.
   Propuesta visual del producto; no sustituye el manual de identidad de la marca. */

:root {
  /* Color */
  --c-bg: #f6f6f3;
  --c-surface: #ffffff;
  --c-surface-2: #fafaf8;
  --c-border: #e3e3de;
  --c-border-strong: #c7c7c0;
  --c-text: #111111;
  --c-text-muted: #55575c;
  --c-nav: #111111;
  --c-nav-hover: #232323;
  --c-nav-text: #f1f1f1;
  --c-nav-muted: #a9a9a9;
  --c-accent: #f5c400;
  --c-accent-strong: #dcae00;
  --c-accent-soft: #fff5cc;
  --c-link: #111111;

  --c-green: #1d6f38;   --c-green-bg: #e5f3e9;
  --c-amber: #7d5200;   --c-amber-bg: #fff0d1;
  --c-red: #b0251a;     --c-red-bg: #fdeceb;
  --c-blue: #1f4fbf;    --c-blue-bg: #e9effc;
  --c-gray: #4a4f57;    --c-gray-bg: #eef0f2;
  --c-violet: #5b3fb0;  --c-violet-bg: #efeafb;

  /* Espaciado (escala 4/8) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 1px 2px rgba(17, 17, 17, .06);
  --shadow-panel: -8px 0 24px rgba(17, 17, 17, .12);

  /* Tipografía (fuentes del sistema; sin dependencias externas) */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Didot", "Bodoni 72", "Bodoni MT", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  /* v2.1: títulos en la misma familia del menú (más legible y amigable que la serif de la marca) */
  --font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: 12px; --fs-sm: 13px; --fs-base: 15px; --fs-md: 16px; --fs-lg: 19px; --fs-xl: 24px; --fs-2xl: 30px;

  --sidebar-w: 256px;
  --panel-w: 560px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--c-bg); color: var(--c-text);
  font-family: var(--font-sans); font-size: var(--fs-base); line-height: 1.5;
}
img { max-width: 100%; }
a { color: var(--c-link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--c-accent-strong); text-decoration-thickness: 2px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 var(--s-3); }
h1 { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -.015em; }
h2 { font-size: var(--fs-lg); font-weight: 700; }
h3 { font-size: var(--fs-md); font-weight: 700; }
p { margin: 0 0 var(--s-3); }
small, .muted { color: var(--c-text-muted); }
.muted { font-size: var(--fs-sm); }
hr { border: 0; border-top: 1px solid var(--c-border); margin: var(--s-5) 0; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }

/* Foco visible y accesible en fondos claros y oscuros */
:focus-visible { outline: 3px solid var(--c-text); outline-offset: 2px; box-shadow: 0 0 0 6px var(--c-accent); border-radius: 3px; }
.sidebar :focus-visible { outline-color: var(--c-accent); box-shadow: none; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--c-accent); color: #111; padding: 8px 12px; z-index: 100; font-weight: 700; }
.skip-link:focus { left: 8px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon-sm { width: 15px; height: 15px; vertical-align: -2px; }
.icon-lg { width: 22px; height: 22px; }

/* ------------------------------------------------------------------ Layout */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; background: linear-gradient(90deg, var(--c-nav) 0 var(--sidebar-w), var(--c-bg) var(--sidebar-w)); }
.sidebar {
  background: var(--c-nav); color: var(--c-nav-text); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; overflow-y: auto; z-index: 30;
}
.brand { display: block; padding: 22px 20px 16px; text-decoration: none; color: inherit; border-bottom: 1px solid #2a2a2a; }
.brand img { display: block; width: 150px; height: auto; }
.brand .brand-sub { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 11px; letter-spacing: 2.4px; font-weight: 700; color: var(--c-accent); text-transform: uppercase; }
.brand .brand-sub::before { content: ""; width: 18px; height: 2px; background: var(--c-accent); }
.nav { list-style: none; margin: 0; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius);
  color: var(--c-nav-text); text-decoration: none; font-size: 14.5px; border-left: 3px solid transparent;
}
.nav a:hover { background: var(--c-nav-hover); }
.nav a[aria-current="page"] { background: #1d1d1d; border-left-color: var(--c-accent); color: #fff; font-weight: 600; }
.nav a[aria-current="page"] .icon { color: var(--c-accent); }
.nav .nav-count { margin-left: auto; background: var(--c-accent); color: #111; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 0 7px; line-height: 18px; }
.sidebar-foot { margin-top: auto; padding: 14px 20px 18px; border-top: 1px solid #2a2a2a; font-size: 13px; color: var(--c-nav-muted); }
.sidebar-foot strong { color: var(--c-nav-text); display: block; font-size: 14px; }
.sidebar-foot form { margin-top: 10px; }
.sidebar-foot button { background: none; border: 1px solid #3a3a3a; color: var(--c-nav-text); border-radius: var(--radius); padding: 6px 10px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; font: inherit; }
.sidebar-foot button:hover { border-color: var(--c-accent); }

.main { min-width: 0; display: flex; flex-direction: column; }
.mobilebar { display: none; }
.pagehead { background: var(--c-surface); border-bottom: 3px solid var(--c-accent); padding: 18px 28px 14px; }
.pagehead .crumbs { font-size: var(--fs-sm); color: var(--c-text-muted); margin-bottom: 4px; }
.pagehead .crumbs a { color: var(--c-text-muted); }
.pagehead-row { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; }
.pagehead h1 { margin: 0; }
.pagehead .subtitle { margin: 4px 0 0; color: var(--c-text-muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.content { padding: 24px 28px 48px; flex: 1; }
.content-narrow { max-width: 920px; }
.footer { padding: 12px 28px; color: var(--c-text-muted); font-size: 12px; border-top: 1px solid var(--c-border); background: var(--c-surface); }

/* ----------------------------------------------------------------- Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px;
  padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--c-border-strong);
  background: var(--c-surface); color: var(--c-text); font: inherit; font-size: 14px; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap; line-height: 1.2;
}
.btn:hover { border-color: var(--c-text); text-decoration: none; }
.btn-primary { background: #111; border-color: #111; color: #fff; }
.btn-primary:hover { background: #2b2b2b; }
.btn-accent { background: var(--c-accent); border-color: var(--c-accent); color: #111; }
.btn-accent:hover { background: var(--c-accent-strong); border-color: var(--c-accent-strong); }
.btn-danger { background: var(--c-surface); border-color: var(--c-red); color: var(--c-red); }
.btn-danger:hover { background: var(--c-red-bg); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--c-gray-bg); border-color: transparent; }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-link { background: none; border: 0; padding: 0; color: var(--c-link); text-decoration: underline; cursor: pointer; font: inherit; }

/* --------------------------------------------------------------- Formularios */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field > .label, fieldset > legend { font-weight: 600; font-size: 14px; }
.field .req { color: var(--c-red); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=url],
input[type=search], input[type=file], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--c-border-strong); border-radius: var(--radius);
  background: #fff; color: var(--c-text); font: inherit; font-size: 15px;
}
textarea { min-height: 96px; resize: vertical; }
select[multiple] { min-height: 120px; padding: 4px; }
input:hover, select:hover, textarea:hover { border-color: #8f8f88; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--c-red); background: #fffafa; }
.help { font-size: var(--fs-sm); color: var(--c-text-muted); }
.errorlist, .field-error { color: var(--c-red); font-size: var(--fs-sm); margin: 0; padding: 0; list-style: none; font-weight: 600; }
.checkbox, .radio { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.checkbox input, .radio input { width: 18px; height: 18px; margin-top: 2px; accent-color: #111; }
fieldset { border: 1px solid var(--c-border); border-radius: var(--radius); padding: 12px 14px; margin: 0; min-width: 0; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 14px; max-height: 260px; overflow: auto; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--c-border); }
.segmented { display: inline-flex; border: 1px solid var(--c-border-strong); border-radius: var(--radius); overflow: hidden; background: #fff; flex-wrap: wrap; }
.segmented label { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; cursor: pointer; font-size: 14px; border-right: 1px solid var(--c-border); }
.segmented label:last-child { border-right: 0; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented label:has(input:checked) { background: #111; color: #fff; font-weight: 600; }
.segmented label:has(input:focus-visible) { outline: 3px solid var(--c-accent); outline-offset: -3px; }

/* ----------------------------------------------------------------- Tarjetas */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.stack > * + * { margin-top: 16px; }
.dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.dl dt { color: var(--c-text-muted); font-size: 14px; }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 12px; }
.kpi {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--c-surface);
  border: 1px solid var(--c-border); border-radius: var(--radius-lg); text-decoration: none; color: inherit;
  border-top: 3px solid var(--c-border-strong); min-width: 0;
}
a.kpi:hover { border-color: var(--c-text); border-top-color: var(--c-accent); text-decoration: none; }
.kpi .kpi-label { font-size: 13px; color: var(--c-text-muted); font-weight: 600; display: flex; gap: 6px; align-items: center; }
.kpi .kpi-value { font-size: 28px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .kpi-note { font-size: 12px; color: var(--c-text-muted); line-height: 1.35; }
.kpi.t-red { border-top-color: var(--c-red); }
.kpi.t-amber { border-top-color: #e3a008; }
.kpi.t-green { border-top-color: var(--c-green); }
.kpi.t-blue { border-top-color: var(--c-blue); }
.kpi.t-accent { border-top-color: var(--c-accent); }
.kpi-group-title { margin: 22px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--c-text-muted); font-weight: 700; }
.meter { height: 8px; background: var(--c-gray-bg); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.meter > span { display: block; height: 100%; background: #111; }
.meter.m-accent > span { background: var(--c-accent-strong); }

/* ----------------------------------------------------------------- Insignias */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; line-height: 20px; white-space: nowrap; background: var(--c-gray-bg); color: var(--c-gray);
}
.badge .icon { width: 14px; height: 14px; }
.b-green { background: var(--c-green-bg); color: var(--c-green); }
.b-amber { background: var(--c-amber-bg); color: var(--c-amber); }
.b-red { background: var(--c-red-bg); color: var(--c-red); }
.b-blue { background: var(--c-blue-bg); color: var(--c-blue); }
.b-gray { background: var(--c-gray-bg); color: var(--c-gray); }
.b-violet { background: var(--c-violet-bg); color: var(--c-violet); }
.b-dark { background: #111; color: #fff; }
.b-accent { background: var(--c-accent-soft); color: #5c4700; }
.b-outline { background: transparent; border: 1px solid var(--c-border-strong); color: var(--c-text); }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.pending { color: var(--c-amber); font-weight: 600; font-style: italic; }

/* ------------------------------------------------------------------- Alertas */
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid; margin-bottom: 16px; align-items: flex-start; }
.alert .icon { margin-top: 2px; }
.alert-info { background: var(--c-blue-bg); border-color: #c4d3f6; color: #143a8f; }
.alert-success { background: var(--c-green-bg); border-color: #bfe0c9; color: #134d27; }
.alert-warning { background: var(--c-amber-bg); border-color: #f1d79c; color: #5f3e00; }
.alert-error { background: var(--c-red-bg); border-color: #f2c3bf; color: #8a1c13; }
.alert-neutral { background: var(--c-surface-2); border-color: var(--c-border); color: var(--c-text); }
.alert p:last-child, .alert ul:last-child { margin-bottom: 0; }
.messages { margin-bottom: 8px; }

/* ------------------------------------------------------------------- Tablas */
.table-wrap {
  position: relative; overflow: auto; border: 1px solid var(--c-border); border-radius: var(--radius-lg); max-height: 72vh;
  /* Sombras de desplazamiento: indican que hay más columnas a la derecha o a la izquierda. */
  background:
    linear-gradient(90deg, var(--c-surface) 30%, rgba(255,255,255,0)) left center / 40px 100% no-repeat local,
    linear-gradient(270deg, var(--c-surface) 30%, rgba(255,255,255,0)) right center / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(17,17,17,.18), rgba(17,17,17,0)) left center / 14px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(17,17,17,.18), rgba(17,17,17,0)) right center / 14px 100% no-repeat scroll,
    var(--c-surface);
}
.table-wrap.no-max { max-height: none; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table tbody tr { background: transparent; }
.table th, .table td { padding: 9px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--c-border); }
.table thead th {
  position: sticky; top: 0; z-index: 2; background: #f1f1ed; font-size: 12.5px; text-transform: uppercase;
  letter-spacing: .5px; color: #3d3f44; font-weight: 700; line-height: 1.3;
}
.table thead th a { color: inherit; text-decoration: none; display: inline-flex; gap: 4px; align-items: center; }
.table tbody tr:hover { background: #fcfbf3; }
.table tbody tr.is-selected { background: var(--c-accent-soft); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }
.table .code { font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }
.table .text-cell { min-width: 230px; max-width: 420px; }
.table .clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.table .row-link { color: inherit; text-decoration: none; font-weight: 500; }
.table .row-link:hover { text-decoration: underline; }
.table tfoot td { font-weight: 700; background: var(--c-surface-2); }
.table-note { font-size: 12.5px; color: var(--c-text-muted); margin-top: 6px; }
.scroll-hint { display: none; font-size: 12.5px; color: var(--c-text-muted); margin: 6px 0; }
.empty { padding: 36px 16px; text-align: center; color: var(--c-text-muted); }
.empty .icon { width: 30px; height: 30px; margin-bottom: 6px; }

/* ------------------------------------------------------------------ Filtros */
.filters { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 14px; }
.filters-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 12px; align-items: end; }
.filters .field > label { font-size: 13px; }
.filters details > summary { cursor: pointer; font-weight: 600; font-size: 14px; list-style: none; display: inline-flex; gap: 6px; align-items: center; }
.filters details > summary::-webkit-details-marker { display: none; }
.filters details[open] > summary { margin-bottom: 10px; }
.multi { position: relative; }
.multi > summary { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; gap: 6px; min-height: 40px; border: 1px solid var(--c-border-strong); border-radius: var(--radius); padding: 8px 10px; background: #fff; display: flex !important; justify-content: space-between; font-weight: 400 !important; font-size: 15px !important; }
.multi[open] > summary { margin-bottom: 0 !important; }
.multi .multi-box { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 100%; max-width: 340px; max-height: 300px; overflow: auto; background: #fff; border: 1px solid var(--c-border-strong); border-radius: var(--radius); padding: 8px 10px; box-shadow: 0 8px 20px rgba(0,0,0,.12); }
.multi .multi-box label { display: flex; gap: 8px; padding: 4px 2px; font-size: 14px; font-weight: 400; align-items: center; }
.multi .multi-box input { width: 17px; height: 17px; accent-color: #111; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 12px; font-size: 13px; }
.chip { display: inline-flex; gap: 4px; align-items: center; background: #fff; border: 1px solid var(--c-border-strong); border-radius: 999px; padding: 2px 10px; }
.chip strong { font-weight: 600; }
.cutoff { font-size: 13px; color: var(--c-text-muted); display: inline-flex; gap: 6px; align-items: center; }

/* ---------------------------------------------------------------- Pestañas */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--c-border); margin: 0 0 18px; overflow-x: auto; scrollbar-width: thin; }
.tabs a { display: inline-flex; gap: 7px; align-items: center; padding: 10px 14px; text-decoration: none; color: var(--c-text-muted); border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 600; font-size: 14.5px; margin-bottom: -1px; }
.tabs a:hover { color: var(--c-text); }
.tabs a[aria-current="page"] { color: var(--c-text); border-bottom-color: var(--c-accent); }

/* ------------------------------------------------------------- Panel lateral */
.panel-backdrop { position: fixed; inset: 0; background: rgba(17,17,17,.28); z-index: 40; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(var(--panel-w), 100vw); background: var(--c-surface);
  z-index: 41; box-shadow: var(--shadow-panel); display: flex; flex-direction: column; border-left: 3px solid var(--c-accent);
}
.panel[hidden], .panel-backdrop[hidden] { display: none; }
.panel-content { display: flex; flex-direction: column; height: 100%; min-height: 0; }
#task-main .panel-body { overflow: visible; }
.panel-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 16px 20px 12px; border-bottom: 1px solid var(--c-border); }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-body { overflow-y: auto; padding: 16px 20px 32px; flex: 1; }
.panel-section { padding: 14px 0; border-bottom: 1px solid var(--c-border); }
.panel-section:last-child { border-bottom: 0; }
.panel-section > h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--c-text-muted); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.original-text { background: var(--c-surface-2); border: 1px solid var(--c-border); border-left: 4px solid #111; border-radius: var(--radius); padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15.5px; }
.original-label { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--c-text-muted); margin-bottom: 6px; }
.commit-box { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.commit-box > div { background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 8px 10px; }
.commit-box .k { font-size: 12px; color: var(--c-text-muted); }
.commit-box .v { font-weight: 700; }

/* ------------------------------------------------------------- Línea de tiempo */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; border-left: 2px solid var(--c-border); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px; background: #fff; border: 2px solid #111; border-radius: 50%; }
.timeline li.t-accent::before { background: var(--c-accent); border-color: #111; }
.timeline .when { font-size: 12.5px; color: var(--c-text-muted); }
.timeline .what { font-size: 14px; }
.timeline .diff { font-size: 13px; color: var(--c-text-muted); margin-top: 2px; overflow-wrap: anywhere; }

/* ----------------------------------------------------------------- Diálogos */
dialog { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(0,0,0,.25); color: var(--c-text); }
dialog::backdrop { background: rgba(17,17,17,.45); }
.dialog-head { padding: 16px 20px; border-bottom: 3px solid var(--c-accent); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog-body { padding: 16px 20px; }
.dialog-foot { padding: 12px 20px 16px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* -------------------------------------------------------------------- Avisos */
.toast-zone { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: #111; color: #fff; border-left: 4px solid var(--c-accent); padding: 12px 14px; border-radius: var(--radius); box-shadow: 0 8px 20px rgba(0,0,0,.2); font-size: 14px; }
.toast.t-error { border-left-color: #ff6b5e; }

/* -------------------------------------------------------------------- Tablero */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.board-col { background: #efefea; border-radius: var(--radius-lg); padding: 10px; min-height: 160px; border: 2px dashed transparent; }
.board-col.is-over { border-color: #111; background: var(--c-accent-soft); }
.board-col h2 { font-size: 14px; display: flex; justify-content: space-between; align-items: center; margin: 2px 4px 10px; }
.card-task { background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius); padding: 10px 11px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab; }
.card-task:active { cursor: grabbing; }
.card-task.is-dragging { opacity: .5; }
.card-task .code { font-family: var(--font-mono); font-size: 12px; color: var(--c-text-muted); }
.card-task .ttl { font-size: 14px; margin: 3px 0 6px; overflow-wrap: anywhere; }
.card-task .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: var(--c-text-muted); }
.card-task .move { margin-top: 8px; display: flex; gap: 6px; align-items: center; }
.card-task .move select { min-height: 32px; font-size: 13px; padding: 3px 6px; }

/* ------------------------------------------------------------------ Calendario */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--c-border); border-radius: var(--radius-lg); overflow: hidden; background: var(--c-border); gap: 1px; }
.cal .dow { background: #f1f1ed; font-size: 12px; font-weight: 700; text-transform: uppercase; padding: 6px 8px; letter-spacing: .6px; }
.cal .day { background: #fff; min-height: 110px; padding: 6px; min-width: 0; }
.cal .day.out { background: #fafaf8; color: #9a9a95; }
.cal .day.today { box-shadow: inset 0 0 0 2px #111; }
.cal .day .n { font-size: 12.5px; font-weight: 700; margin-bottom: 4px; display: flex; justify-content: space-between; }
.cal .ev { display: block; font-size: 12px; padding: 2px 6px; border-radius: 4px; margin-bottom: 3px; text-decoration: none; color: #111; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid #111; background: var(--c-gray-bg); }
.cal .ev.compromiso { background: #fff; border: 1px solid var(--c-border-strong); border-left: 3px solid #111; }
.cal .ev.vencida { border-left-color: var(--c-red); background: var(--c-red-bg); }
.cal .ev.seguimiento { border-left-color: var(--c-blue); background: var(--c-blue-bg); font-style: italic; }
.cal .ev.hito { border-left-color: var(--c-accent-strong); background: var(--c-accent-soft); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--c-text-muted); margin: 10px 0; align-items: center; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; border-left: 3px solid #111; background: #fff; border-top: 1px solid var(--c-border-strong); border-right: 1px solid var(--c-border-strong); border-bottom: 1px solid var(--c-border-strong); }
.legend i.l-venc { border-left-color: var(--c-red); background: var(--c-red-bg); }
.legend i.l-seg { border-left-color: var(--c-blue); background: var(--c-blue-bg); }
.legend i.l-hito { border-left-color: var(--c-accent-strong); background: var(--c-accent-soft); }

/* ------------------------------------------------------------------ Cronograma */
.gantt { border: 1px solid var(--c-border); border-radius: var(--radius-lg); background: #fff; overflow-x: auto; }
.gantt-inner { min-width: 900px; }
.gantt-row { display: grid; grid-template-columns: 300px minmax(0, 1fr); border-bottom: 1px solid var(--c-border); min-height: 36px; }
.gantt-row.head { background: #f1f1ed; font-size: 12px; font-weight: 700; position: sticky; top: 0; }
.gantt-row.phase { background: var(--c-surface-2); font-weight: 700; }
.gantt-label { padding: 7px 10px; border-right: 1px solid var(--c-border); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-track { position: relative; }
.gantt-scale { position: relative; height: 100%; }
.gantt-scale span { position: absolute; top: 8px; font-size: 11.5px; color: var(--c-text-muted); padding-left: 4px; border-left: 1px solid var(--c-border); height: 100%; }
.gantt-bar { position: absolute; top: 9px; height: 18px; background: #111; border-radius: 4px; min-width: 6px; }
.gantt-bar.b-closed { background: var(--c-green); }
.gantt-bar.b-late { background: var(--c-red); }
.gantt-bar.b-nodate { background: repeating-linear-gradient(45deg, #ddd, #ddd 4px, #f4f4f4 4px, #f4f4f4 8px); border: 1px dashed #999; }
.gantt-bar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--c-accent); border-radius: 4px 0 0 4px; opacity: .9; }
.gantt-ms { position: absolute; top: 9px; width: 16px; height: 16px; background: var(--c-accent); border: 2px solid #111; transform: rotate(45deg); margin-left: -8px; }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--c-red); opacity: .6; }

/* ------------------------------------------------------------------- Gráficas */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font-sans); fill: #3d3f44; font-size: 12px; }
.chart .bar { fill: #111; }
.chart .bar-alt { fill: var(--c-accent-strong); }
.chart .grid line { stroke: var(--c-border); }

/* --------------------------------------------------------------------- Acceso */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-brand { background: #111; color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-brand img { width: min(360px, 80%); }
.auth-brand .rule { width: 72px; height: 4px; background: var(--c-accent); margin: 28px 0 18px; }
.auth-brand h2 { font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -.01em; color: #fff; }
.auth-brand p { color: #cfcfcf; max-width: 420px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #fff; }
.auth-card { width: min(400px, 100%); }
.auth-card h1 { font-size: 28px; }
.btn-microsoft { justify-content: center; gap: 10px; }
.btn-microsoft .ms-logo { background: #fff; padding: 2px; border-radius: 3px; box-sizing: content-box; }
.auth-or { display: flex; align-items: center; gap: 10px; margin: 18px 0 14px; color: var(--c-text-muted); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--c-border); }

/* ------------------------------------------------------------------- Portal */
.portal-head { background: #fff; border-bottom: 3px solid var(--c-accent); }
.portal-head-inner { max-width: 1200px; margin: 0 auto; padding: 14px 24px; display: flex; gap: 16px 28px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.portal-head img { height: 34px; width: auto; display: block; }
.portal-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.portal-nav a { padding: 8px 12px; text-decoration: none; font-weight: 600; border-radius: var(--radius); }
.portal-nav a[aria-current="page"] { background: #111; color: #fff; }
.portal-main { max-width: 1200px; margin: 0 auto; padding: 24px; }
.ribbon { background: #111; color: #fff; font-size: 13px; }
.ribbon-inner { max-width: 1200px; margin: 0 auto; padding: 6px 24px; display: flex; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.ribbon a { color: var(--c-accent); }

/* ------------------------------------------------------------- Utilidades */
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.wrap-any { overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; }
.pagination { display: flex; gap: 6px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 12px; font-size: 14px; }
.htmx-indicator { opacity: 0; transition: opacity .15s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.loading-bar { height: 3px; background: linear-gradient(90deg, transparent, var(--c-accent), transparent); background-size: 200% 100%; animation: load 1s linear infinite; }
@keyframes load { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.compact-list { display: none; }
.kbd { font-family: var(--font-mono); font-size: 12px; border: 1px solid var(--c-border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }
.notice-demo { background: repeating-linear-gradient(-45deg, var(--c-accent-soft), var(--c-accent-soft) 10px, #fff 10px, #fff 20px); border: 1px solid var(--c-accent); padding: 8px 12px; border-radius: var(--radius); font-weight: 600; font-size: 14px; margin-bottom: 14px; }

/* ------------------------------------------------------------------ Responsivo */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); background: var(--c-bg); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.is-open { transform: none; box-shadow: 8px 0 24px rgba(0,0,0,.3); }
  .mobilebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #111; color: #fff; padding: 10px 16px; position: sticky; top: 0; z-index: 25; }
  .mobilebar img { height: 20px; width: auto; }
  .mobilebar button { background: none; border: 1px solid #3a3a3a; color: #fff; border-radius: var(--radius); min-height: 40px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; }
  .pagehead { padding: 14px 16px 12px; }
  .content { padding: 16px 16px 40px; }
  .footer { padding: 12px 16px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { padding: 28px 24px; }
  .auth-brand .auth-brand-extra { display: none; }
}
@media (max-width: 700px) {
  h1 { font-size: 24px; }
  .form-grid, .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .commit-box { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .kpi-value { font-size: 24px; }
  .scroll-hint { display: block; }
  .table-wrap.compactable { display: none; }
  .table-wrap.compactable.force-table { display: block; }
  .compact-list { display: block; }
  .compact-list.force-hidden { display: none; }
  .filters-row { grid-template-columns: minmax(0, 1fr); }
  .dl { grid-template-columns: minmax(0, 1fr); }
  .dl dt { margin-top: 6px; }
  .portal-main { padding: 16px; }
  .portal-head-inner, .ribbon-inner { padding-left: 16px; padding-right: 16px; }
  .pagehead-row .actions { width: 100%; }
}
.compact-item { display: block; background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; text-decoration: none; color: inherit; }
.compact-item .code { font-family: var(--font-mono); font-size: 12px; color: var(--c-text-muted); }
.compact-item .ttl { margin: 2px 0 6px; overflow-wrap: anywhere; }

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

/* Cronogramas: estados adicionales */
.gantt-bar.b-assumed { opacity: .5; }
.gantt-bar.b-warn { background: #b7791f; }
.gantt-bar.b-plan { background: transparent; border: 2px dashed #111; top: 11px; height: 14px; }
.gantt-orig { position: absolute; top: 5px; bottom: 5px; width: 0; border-left: 2px dotted #111; }
.gantt-row.group { background: #111; color: #fff; font-weight: 700; }
.gantt-row.group .gantt-label { border-right-color: #333; }
.gantt-sub { display: block; font-size: 12px; color: var(--c-text-muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.gantt-row.tall { min-height: 46px; }
.gantt-row.tall .gantt-bar { top: 14px; }
.gantt-row.tall .gantt-label { white-space: normal; }

/* Listas agrupadas y edición en lote */
.table tr.group-row th { background: #111; color: #fff; text-align: left; padding: 8px 10px; }
.table tr.group-row a { color: #fff; font-weight: 700; }
.table tr.group-row .muted { color: #cfcfcf; font-weight: 400; }
.table tr.group-row .badge { background: #fff; color: #111; }
.table tr.group-row .btn-ghost { color: #fff; border-color: #555; }
.group-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.table th.sel, .table td.sel { width: 34px; text-align: center; }
.compact-group { background: #111; color: #fff; padding: 8px 10px; border-radius: 6px; font-weight: 700; margin: 12px 0 6px; }
.compact-group .muted { color: #cfcfcf; }
.bulkbar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px; align-items: end; background: #fff;
  border: 2px solid #111; border-top: 4px solid var(--c-accent); border-radius: var(--radius-lg); padding: 12px; margin-top: 12px;
  box-shadow: 0 -6px 18px rgba(0,0,0,.12); }
.bulkbar[hidden] { display: none; }
.bulkbar .field { margin: 0; min-width: 150px; }
.bulkbar .field.grow { flex: 1 1 220px; }
.bulkbar-count { align-self: center; min-width: 120px; }
.bulkbar-actions { display: flex; gap: 8px; }

/* Vista previa de «Pegar varios»: controles legibles por fila */
.import-preview select { min-width: 150px; }
.import-preview input[type=date] { min-width: 150px; }

/* Edición en la tabla */
.cell-btn { all: unset; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; padding: 2px 4px; margin: -2px -4px; border-radius: 6px; }
.cell-btn:hover, .cell-btn:focus-visible { background: var(--c-accent-soft); outline: 2px solid var(--c-accent); }
.cell-pencil { opacity: 0; color: var(--c-text-muted); }
.cell-btn:hover .cell-pencil, .cell-btn:focus-visible .cell-pencil { opacity: 1; }
.cell-form { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-width: 170px; }
.cell-form select, .cell-form input { max-width: 190px; padding: 4px 6px; font-size: 13px; }
td.cell-saved { animation: celda-ok 1.6s ease-out; }
@keyframes celda-ok { from { background: var(--c-accent-soft); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { td.cell-saved { animation: none; } }
.fold-btn { all: unset; cursor: pointer; display: inline-flex; padding: 2px; border-radius: 4px; color: #fff; }
.fold-btn:focus-visible { outline: 2px solid var(--c-accent); }
.fold-btn.is-folded svg { transform: rotate(-90deg); }

/* Cronograma interactivo */
.gantt-bar[data-url] { cursor: grab; touch-action: none; }
.gantt-bar[data-url]:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }
.gantt-bar.is-dragging { cursor: grabbing; box-shadow: 0 0 0 2px var(--c-accent); opacity: .85; }
.gantt-bar .gh { position: absolute; top: -2px; bottom: -2px; width: 8px; cursor: ew-resize; background: var(--c-accent); border: 1px solid #111; border-radius: 3px; opacity: 0; }
.gantt-bar .gh-l { left: -4px; }
.gantt-bar .gh-r { right: -4px; }
.gantt-bar[data-url]:hover .gh, .gantt-bar.is-dragging .gh, .gantt-bar[data-url]:focus-visible .gh { opacity: 1; }
.gantt-bar[data-preview]::after { content: attr(data-preview); position: absolute; top: -24px; left: 0; white-space: nowrap; background: #111; color: #fff; font-size: 11.5px; padding: 2px 6px; border-radius: 4px; z-index: 3; }

/* Utilidades */
[hidden] { display: none !important; }
.alert > div, .help { overflow-wrap: anywhere; }


/* ===================================================================== v2.0 */
.b-orange { background: #ffe8d6; color: #8a3b00; }
.text-red { color: var(--c-red); }
.inline { display: inline; }
.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li { padding: 6px 0; border-bottom: 1px solid var(--c-border); }
.link-list li:last-child { border-bottom: 0; }
.table.compact th, .table.compact td { padding: 6px 8px; font-size: 13.5px; }
.step { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%;
        background: var(--c-text); color: #fff; font-size: 12.5px; font-weight: 700; margin-right: 8px; flex: none; }
.views-switch { flex-wrap: wrap; gap: 4px; }

/* Espacios */
.space-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s-4); }
.space-card { display: flex; flex-direction: column; gap: 6px; border-top: 3px solid var(--c-text); }
.space-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.space-card h2 { margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.space-card h2 a { color: inherit; text-decoration: none; }
.space-meta { margin: 0; }
.space-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 6px; margin: 6px 0; }
.space-kpis div { background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 6px 8px; }
.space-kpis strong { display: block; font-size: 20px; }
.space-kpis span { font-size: 12px; color: var(--c-text-muted); }
.space-kpis .is-warn { border-color: var(--c-red); background: var(--c-red-bg); }
.space-kpis .is-accent { border-color: var(--c-accent); background: var(--c-accent-soft); }
.space-areas { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--c-border);
        background: var(--c-surface); font-size: 12.5px; }
.chip-x { cursor: pointer; }
.chip-x::after { content: "×"; font-weight: 700; margin-left: 2px; }

/* Formas de trabajo */
.method-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s-3); }
.method-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--c-border); border-radius: var(--radius-lg);
               background: var(--c-surface); cursor: pointer; margin: 0; }
.method-card:has(input:checked) { border-color: var(--c-text); box-shadow: inset 0 0 0 1px var(--c-text); background: var(--c-accent-soft); }
.method-card input { margin-top: 4px; }
.method-icon { color: var(--c-text); }

/* Selector de sucursales */
.branch-picker { margin-top: 8px; border: 1px solid var(--c-border); border-radius: var(--radius); padding: 10px; background: var(--c-surface-2); }
.branch-picker input[type=search] { flex: 1; min-width: 12rem; }
.branch-chosen { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.branch-list { max-height: 260px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 12px; }
.branch-list .checkbox[hidden] { display: none !important; }

/* Hoja (tipo Smartsheet) */
.sheet-wrap { max-height: 70vh; overflow: auto; }
.sheet thead th { position: sticky; top: 0; z-index: 1; background: var(--c-surface); }
.sheet td, .sheet th { border-right: 1px solid var(--c-border); }
.sheet-num { width: 3rem; color: var(--c-text-muted); text-align: right; }
.sheet-text { min-width: 22rem; padding-left: calc(8px + var(--lvl, 0) * 26px) !important; }
.sheet-child .sheet-text { border-left: 3px solid var(--c-accent); }
.sheet-parent .sheet-text a { font-weight: 600; }
.sheet-add textarea { width: 100%; }

/* Scrum */
.backlog { list-style: none; margin: 0; padding: 0 12px 12px; }
.backlog-item { display: flex; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--c-border); border-radius: var(--radius);
                background: var(--c-surface); margin-bottom: 6px; }
.backlog-item.is-dragging { opacity: .5; }
.backlog-item .grip { cursor: grab; color: var(--c-text-muted); }
.backlog-main { flex: 1; min-width: 0; }
.backlog-plan { display: flex; gap: 4px; }
.backlog-plan select { min-width: 4.5rem; }
.burndown { width: 100%; height: auto; }
.burndown .bd-grid { stroke: var(--c-border); stroke-width: 1; }
.burndown .bd-axis { font-size: 11px; fill: var(--c-text-muted); }
.burndown .bd-ideal { fill: none; stroke: var(--c-border-strong); stroke-width: 2; stroke-dasharray: 5 5; }
.burndown .bd-real { fill: none; stroke: var(--c-text); stroke-width: 2.5; }
.burndown .bd-dot { fill: var(--c-accent); stroke: var(--c-text); stroke-width: 1.5; }
.kpis-compact { grid-template-columns: 1fr; }

/* Tablero con límite WIP */
.board-col.is-over-limit { background: var(--c-red-bg); }

/* Firmas */
.signers { display: grid; gap: 6px; margin-bottom: 8px; }
.signer-row { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px; align-items: center; }
.signer-status { list-style: none; margin: 0; padding: 0; }
.signer-status li { padding: 8px 0 8px 12px; border-left: 3px solid var(--c-border); margin-bottom: 6px; }
.signer-status li.is-signed { border-left-color: var(--c-green); }
.signer-status li.is-rejected { border-left-color: var(--c-red); }
.pdf-frame { width: 100%; height: 72vh; border: 1px solid var(--c-border); border-radius: var(--radius); background: #fff; }
.sign-card { border-top: 3px solid var(--c-accent); }

/* Menú desplegable simple con <details> */
.dropdown { position: relative; display: inline-block; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu { position: absolute; right: 0; z-index: 20; background: var(--c-surface); border: 1px solid var(--c-border);
                 border-radius: var(--radius); box-shadow: 0 8px 24px rgba(17,17,17,.12); min-width: 14rem; padding: 6px; }
.dropdown-menu a { display: block; padding: 8px 10px; border-radius: var(--radius); color: var(--c-text); text-decoration: none; }
.dropdown-menu a:hover { background: var(--c-surface-2); }

@media (max-width: 720px) {
  .signer-row { grid-template-columns: auto 1fr; }
  .signer-row input { grid-column: 2; }
  .sheet-text { min-width: 14rem; }
}
.space-grid > .card, .grid > .card, .grid-2 > .card, .grid-main > .card { margin-top: 0; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 7px 0; border-bottom: 1px solid var(--c-border); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list .ttl { flex: 1; min-width: 0; }


/* ---------------------------------------------------------------- v2.1: dirección → áreas */
.cascade-dir select { width: 100%; }
.cascade-dir-inline { margin-right: 6px; max-width: 14rem; }
.area-groups { display: flex; flex-direction: column; gap: 4px; }
.multi .multi-box.area-groups { max-width: 380px; min-width: 300px; max-height: 360px; }
.area-group { border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); }
.area-group > summary { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; cursor: pointer; font-weight: 600; font-size: 14px; list-style: none; }
.area-group > summary::-webkit-details-marker { display: none; }
.area-group > summary::before { content: "▸"; color: var(--c-text-muted); margin-right: 4px; }
.area-group[open] > summary::before { content: "▾"; }
.area-group > summary .area-group-name { flex: 1; }
.area-group-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 14px; padding: 4px 10px 8px; border-top: 1px solid var(--c-border); }
.multi .area-group-body { grid-template-columns: 1fr; }
.area-group-all { font-size: 13px; color: var(--c-text-muted); }
.area-groups-help { margin: 0; font-size: 12px; }
.form-actions .spacer, .flex .spacer { flex: 1; }


/* ---------------------------------------------------------------- v2.1: menú por secciones con árbol de espacios */
.sidenav { padding-bottom: 8px; }
.sidenav > .nav { padding: 10px 10px 2px; }
.nav-section { margin: 2px 0; }
/* v2.2.1 · Secciones del menú con ícono propio y encabezado más grande (estilo portal de Microsoft), mismos colores. */
.nav-section > summary { list-style: none; display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none;
  margin: 4px 10px 0; padding: 10px 12px; border: 1px solid transparent; border-radius: var(--radius);
  font-size: 15px; font-weight: 600; color: var(--c-nav-text); letter-spacing: 0; text-transform: none; }
.nav-section > summary .icon { width: 21px; height: 21px; }
.nav-section-title { flex: 1; min-width: 0; }
.nav-section > summary::-webkit-details-marker, .nav-space > summary::-webkit-details-marker { display: none; }
.nav-section > summary:hover { background: var(--c-nav-hover); }
.nav-section[open] > summary { border-color: #3a3a3a; }
.nav-section > summary:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 1px; }
.nav-section > summary::after { content: ""; flex: none; width: 7px; height: 7px; margin: 0 4px 3px 0;
  border-right: 1.6px solid var(--c-nav-muted); border-bottom: 1.6px solid var(--c-nav-muted); transform: rotate(45deg); transition: transform .15s; }
.nav-section[open] > summary::after { transform: rotate(-135deg); margin: 4px 4px 0 0; }
.nav-section > .nav { padding: 4px 10px 8px 18px; }
.nav-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-accent); display: inline-block; }
.nav-section[open] .nav-dot { display: none; }
.nav a { font-size: 14px; padding: 8px 12px; }
/* v2.3 · Espacios: lista simple (sin desplegar proyectos); «Todos los espacios» primero. */
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.nav-num { font-size: 11px; color: var(--c-nav-muted); margin-left: auto; padding-left: 6px; }
.nav a.nav-context { background: #1d1d1d; border-left-color: var(--c-nav-muted); color: #fff; }
.share-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.share-row input { flex: 1; min-width: 16rem; font-family: var(--font-mono); font-size: 13px; }
.dialog-body label + .share-row { margin-top: 6px; }

/* ---------------------------------------------------------------- v2.1: tableros de mando */
.board-tabs { margin-bottom: 16px; }
.board-tabs .board-tabs-admin { margin-left: auto; }
.board-filters { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin-bottom: 16px; }
.board-filters .field { min-width: 14rem; }
.board-cut { margin: 0 0 6px auto; font-size: 13px; }
.board-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.board-grid > .card { margin-top: 0; }
.board-span-1 { grid-column: span 1; }
.board-span-2 { grid-column: span 2; }
.board-span-3 { grid-column: 1 / -1; }
@media (max-width: 1100px) { .board-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .board-span-2 { grid-column: 1 / -1; } }
@media (max-width: 700px) { .board-grid { grid-template-columns: 1fr; } .board-span-1, .board-span-2 { grid-column: 1 / -1; } }
.board-panel h2 { font-size: 15px; font-weight: 650; margin: 0 0 8px; }
.board-sub { font-size: 13px; margin: 0 0 10px; }
.board-kpi { display: flex; flex-direction: column; }
.kpi-big { font-size: 44px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; color: var(--c-text); text-decoration: none; align-self: flex-start; }
.kpi-big:hover { text-decoration: underline; text-decoration-color: var(--c-accent-strong); text-decoration-thickness: 3px; }
.kpi-big.is-late { color: var(--c-red); }
.kpi-note { margin: 4px 0 0; font-size: 13px; }
.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hbar-row { display: grid; grid-template-columns: minmax(7rem, 38%) minmax(0, 1fr); gap: 10px; align-items: center; text-decoration: none; color: inherit; border-radius: 4px; padding: 2px 4px; }
a.hbar-row:hover, a.hbar-row:focus-visible { background: var(--c-surface-2); }
.hbar-label { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-text); }
a.hbar-label { text-decoration: none; }
a.hbar-label:hover { text-decoration: underline; }
.hbar-track { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; height: 22px; }
.hbar-area { display: flex; min-width: 0; height: 16px; }
.meter-area { background: #cde2fb; border-radius: 0 4px 4px 0; }
.hbar { display: block; height: 16px; border-radius: 0 4px 4px 0; background: #2a78d6; min-width: 2px; flex: none; }
.hbar.is-over { background: #d03b3b; }
.hbar-value { font-size: 13px; color: var(--c-text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.hstack { gap: 2px; }
.hseg { display: block; height: 16px; min-width: 3px; }
.hseg:last-child { border-radius: 0 4px 4px 0; }
.hseg:hover, .hseg:focus-visible { filter: brightness(1.12); outline: 2px solid var(--c-text); outline-offset: 1px; }
.late-note, .late-text { color: var(--c-red); font-weight: 600; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 10px; padding: 0; font-size: 13px; color: var(--c-text-muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.swatch-line { height: 3px; width: 16px; border-radius: 2px; }
.trend-wrap svg { width: 100%; max-width: 760px; height: auto; display: block; }
svg.trend { font-family: var(--font-sans); outline-offset: 4px; }
svg.trend .grid { stroke: #e1e0d9; stroke-width: 1; }
svg.trend .tick { fill: #898781; font-size: 11px; font-variant-numeric: tabular-nums; }
svg.trend .end { fill: var(--c-text); font-size: 12px; font-weight: 600; }
svg.trend .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.trend .dot { stroke: #fff; stroke-width: 2; }
svg.trend .cross { stroke: #898781; stroke-width: 1; }
.chart-tip { position: fixed; z-index: 80; background: #111; color: #f1f1f1; padding: 8px 10px; border-radius: 6px; font-size: 13px; pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.2); max-width: 280px; }
.chart-tip strong { color: #fff; font-size: 14px; }
.chart-tip .tip-title { color: #b9b9b9; font-size: 12px; margin-top: 2px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 4px; }
.chart-tip .tip-key { width: 12px; height: 3px; border-radius: 2px; display: inline-block; margin-right: 4px; }
.panel-data { margin-top: 10px; font-size: 13px; }
.panel-data > summary { cursor: pointer; color: var(--c-text-muted); }
.panel-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.panel-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface-2); flex-wrap: wrap; }
.kind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.kind-card { display: flex; gap: 8px; align-items: center; border: 1px solid var(--c-border-strong); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; background: var(--c-surface); }
.kind-card:has(input:checked) { border-color: var(--c-text); box-shadow: inset 0 0 0 1px var(--c-text); background: var(--c-accent-soft); }
@media print {
  .board-filters, .board-tabs, .panel-data, .actions, .sidebar, .mobilebar { display: none !important; }
  .board-grid { grid-template-columns: repeat(3, 1fr); }
  .board-panel { break-inside: avoid; }
}
.item-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.item-list li { padding: 8px 0; border-bottom: 1px solid var(--c-border); }
.item-list li:last-child { border-bottom: 0; }
.item-list a { text-decoration: none; font-size: 14px; }
.item-list a:hover { text-decoration: underline; }
.item-list .code { font-size: 12px; color: var(--c-text-muted); margin-right: 4px; }
.item-meta { font-size: 12.5px; color: var(--c-text-muted); margin-top: 2px; }

/* v2.2 · menciones */
.mention-field { position: relative; }
.mention-list { position: absolute; left: 0; top: 100%; z-index: 60; min-width: 240px; max-width: 360px; margin: 4px 0 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--c-border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.mention-list li { padding: 7px 10px; border-radius: 6px; cursor: pointer; display: flex; flex-direction: column; font-size: 14px; }
.mention-list li span { font-size: 12px; color: var(--c-text-muted); }
.mention-list li[aria-selected="true"], .mention-list li:hover { background: var(--c-accent-soft); }
.mention { font-weight: 600; color: var(--c-text); background: var(--c-accent-soft); border-radius: 4px; padding: 0 3px; }

/* v2.2 · Mi semana */
.list-plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.list-plain li { line-height: 1.4; }
.list-plain .inline-form { display: inline; }
.list-plain .btn-link { text-align: left; }
.list-plain .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c-accent-strong); margin-right: 6px; vertical-align: middle; }
.list-plain li.unread .btn-link { font-weight: 600; }
.week-section .card-head h2 { display: flex; align-items: center; gap: 8px; }
.week-count { background: var(--c-gray-bg); color: var(--c-text); border-radius: 999px; font-size: 12px; font-weight: 700; padding: 0 8px; line-height: 20px; }
.week-count.t-red { background: var(--c-red-bg); color: var(--c-red); }
.week-count.t-amber { background: var(--c-amber-bg); color: var(--c-amber); }
.week-count.t-blue { background: var(--c-blue-bg); color: var(--c-blue); }
fieldset.field label.checkbox { font-weight: 400; }

/* v2.3 · Reporte ejecutivo incrustado en Reportes › Ejecutivo semanal */
.report-frame { display: block; width: 100%; min-height: 70vh; border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); }

/* v2.3 · Resumen de Dirección General: una tarjeta por dirección */
.dir-grid { align-items: start; }
.dir-card { padding-bottom: 8px; }
.dir-card .card-head { flex-wrap: wrap; gap: 4px 12px; }
.dir-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 10px; font-size: 13.5px; }
@media (max-width: 1100px) { .dir-grid { grid-template-columns: minmax(0, 1fr); } }
