/* Tema: claro neutro y oscuro neutro (sin color de marca); el acento es tinta. */
:root {
  color-scheme: light;
  --bg: #FAF9F5;
  --side: #F3F2EC;
  --card: #FFFFFF;
  --raise: #FFFFFF;
  --line: #E8E6DD;
  --line-strong: #D9D6CB;
  --ink: #141413;
  --ink-2: #3D3D3A;
  --muted: #6B6A64;
  --accent: #1F1E1D;
  --accent-ink: #FFFFFF;
  --accent-strong: #000000;
  --accent-soft: #EDEBE4;
  --link: #141413;
  --focus: rgba(20, 20, 19, .28);
  --hover: rgba(20, 20, 19, .045);
  --sel: rgba(20, 20, 19, .07);
  --good: #1F6B3A;
  --good-soft: #E7F3EA;
  --warn: #8A5A00;
  --warn-soft: #FBF1DC;
  --crit: #B42318;
  --crit-soft: #FDECEA;
  --scroll: rgba(20, 20, 19, .18);
  --scroll-hover: rgba(20, 20, 19, .32);
  --shadow: 0 1px 2px rgba(20, 20, 19, .04), 0 4px 16px rgba(20, 20, 19, .05);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #262624; --side: #1F1E1D; --card: #30302E; --raise: #393937; --line: #3B3A37; --line-strong: #4A4945;
    --ink: #F5F4EE; --ink-2: #DEDCD3; --muted: #A3A097; --accent: #F5F4EE; --accent-ink: #1F1E1D;
    --accent-strong: #FFFFFF; --accent-soft: #3A3936; --link: #F5F4EE; --focus: rgba(245, 244, 238, .35);
    --hover: rgba(245, 244, 238, .05); --sel: rgba(245, 244, 238, .09);
    --good: #7FCB98; --good-soft: #20332A; --warn: #E8C26E; --warn-soft: #3A3122; --crit: #F28B82; --crit-soft: #3D2523;
    --scroll: rgba(245, 244, 238, .16); --scroll-hover: rgba(245, 244, 238, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 6px 20px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #262624; --side: #1F1E1D; --card: #30302E; --raise: #393937; --line: #3B3A37; --line-strong: #4A4945;
  --ink: #F5F4EE; --ink-2: #DEDCD3; --muted: #A3A097; --accent: #F5F4EE; --accent-ink: #1F1E1D;
  --accent-strong: #FFFFFF; --accent-soft: #3A3936; --link: #F5F4EE; --focus: rgba(245, 244, 238, .35);
  --hover: rgba(245, 244, 238, .05); --sel: rgba(245, 244, 238, .09);
  --good: #7FCB98; --good-soft: #20332A; --warn: #E8C26E; --warn-soft: #3A3122; --crit: #F28B82; --crit-soft: #3D2523;
  --scroll: rgba(245, 244, 238, .16); --scroll-hover: rgba(245, 244, 238, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 6px 20px rgba(0, 0, 0, .25);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; font-family: var(--sans); }
code, pre { font-family: var(--mono); font-size: 13px; }
pre { background: var(--side); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow: auto; white-space: pre-wrap; word-break: break-word; }

/* Estructura: el menú y el contenido se desplazan cada uno por su lado; la página no. */
.shell { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.side { flex: 0 0 256px; width: 256px; background: var(--side); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; overscroll-behavior: contain; }
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.topbar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 28px; border-bottom: 1px solid var(--line); background: var(--bg); }
.topbar h1 { font-size: 22px; }
.scroller { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }
.content { width: 100%; max-width: 1080px; margin: 0 auto; padding: 24px 28px 64px; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 860px) {
  .shell { display: block; height: auto; overflow: visible; }
  .side { width: auto; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .main { overflow: visible; }
  .scroller { overflow: visible; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px 16px 48px; }
}

/* Barras de desplazamiento delgadas y discretas */
* { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); background-clip: padding-box; border: 3px solid transparent; }
::-webkit-scrollbar-corner { background: transparent; }

.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px; color: var(--ink); text-decoration: none; }
.brand b { font-family: var(--serif); font-size: 21px; font-weight: 600; }
.brand small { color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 10px 6px; }
.nav a { display: flex; align-items: center; justify-content: space-between; min-height: 38px; padding: 0 10px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.nav a:hover { background: var(--line); }
.nav a.on { background: var(--line); font-weight: 600; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.who { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--bg); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex: none; }
.who span { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.who small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }

.kbd-hint { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; width: 100%; }
kbd { font-family: var(--mono); font-size: 11.5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; color: var(--ink-2); background: var(--bg); }

/* Componentes */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.card > h2, .card > h3 { margin-bottom: 12px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.kpi small { color: var(--muted); font-size: 13px; display: block; }
.kpi b { font-family: var(--serif); font-size: 30px; font-weight: 600; }
.muted { color: var(--muted); }
.lead { font-family: var(--serif); font-size: 17px; line-height: 1.6; margin: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--line-strong); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink); }
.btn.danger { color: var(--crit); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.linkbtn { border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }
form.inline { display: inline; }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 10px 14px; }
table.t td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: top; }
table.t tr:hover td { background: color-mix(in srgb, var(--side) 55%, transparent); }
.scroll { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; white-space: nowrap; background: var(--side); color: var(--ink-2); border: 1px solid var(--line); }
.badge-good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge-warning { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-critical { background: var(--crit-soft); color: var(--crit); border-color: transparent; font-weight: 600; }

.flash { border-radius: 12px; padding: 12px 16px; border: 1px solid var(--line); background: var(--card); }
.flash.success { background: var(--good-soft); color: var(--good); border-color: transparent; }
.flash.error { background: var(--crit-soft); color: var(--crit); border-color: transparent; }
.flash.warning { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

.attention { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.attention a { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 12px; text-decoration: none; color: var(--ink); background: var(--side); }
.attention a.critical { background: var(--crit-soft); color: var(--crit); }
.attention a.warning { background: var(--warn-soft); color: var(--warn); }
.attention a .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-top: 8px; flex: none; }

/* Formularios */
.form { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.form .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 500; }
.field .req { color: var(--accent); }
.field input, .field select, .field textarea { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 10px; font: inherit; color: var(--ink); background: var(--card); width: 100%; }
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .btn:focus-visible, .nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field .hint { color: var(--muted); font-size: 13px; }
.field .error { color: var(--crit); font-size: 13px; }
.field.has-error input, .field.has-error select { border-color: var(--crit); border-width: 2px; }
.checks { display: grid; gap: 6px 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0; }
legend { font-weight: 600; font-size: 14px; padding: 0 6px; }
.secret { font-family: var(--mono); font-size: 18px; letter-spacing: .08em; background: var(--side); border: 1px dashed var(--line-strong); border-radius: 10px; padding: 12px; text-align: center; word-break: break-all; }

/* Organigrama */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 18px; padding-left: 16px; border-left: 2px solid var(--line); }
.tree li { margin: 10px 0; }
.unit { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.unit-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.unit-head b { font-family: var(--serif); font-size: 16px; }
.pos { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 9px 0; border-top: 1px solid var(--line); margin-top: 8px; font-size: 14px; }
.pos .who-list { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--side); font-size: 13px; }
.chip.vacant { background: var(--warn-soft); color: var(--warn); }
details > summary { cursor: pointer; color: var(--accent); font-size: 14px; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 10px; }

/* Acceso */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 18px; }
.auth .card { padding: 26px; }

/* Paleta de comandos */
.palette-bg { position: fixed; inset: 0; background: rgba(20, 20, 19, .35); display: none; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; z-index: 50; }
.palette-bg.open { display: flex; }
.palette { width: 100%; max-width: 560px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 50px rgba(0, 0, 0, .18); overflow: hidden; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 16px 18px; font: inherit; font-size: 16px; background: transparent; color: var(--ink); outline: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
.palette li a { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.palette li a small { color: var(--muted); }
.palette li.active a { background: var(--side); }
.palette .empty { padding: 14px 16px; color: var(--muted); font-size: 14px; }

/* Progreso de actualización */
.progress { height: 10px; border-radius: 6px; background: var(--side); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.steps li { padding: 6px 12px; border-radius: 999px; background: var(--side); font-size: 13px; color: var(--muted); }
.steps li.done { background: var(--good-soft); color: var(--good); }
.steps li.now { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }

[hidden] { display: none !important; }
.menu-toggle { display: none; }
@media (max-width: 860px) {
  .side { flex-basis: 100%; gap: 12px; padding: 12px 16px; }
  .side-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .menu-toggle { display: inline-flex; }
  .side .collapsible { display: none; }
  .side.menu-open .collapsible { display: flex; flex-direction: column; gap: 14px; }
}
@media (min-width: 861px) {
  .side .collapsible { display: flex; flex-direction: column; gap: 18px; flex: 1; }
  .side-top { display: block; }
}
@media (max-width: 860px) { .shell { align-content: flex-start; } }

/* Vistas y tableros */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.select-sm { min-height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--card); color: var(--ink); font: inherit; font-size: 14px; }
.board { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.widget { min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; }
.widget.w-3 { grid-column: span 3; } .widget.w-4 { grid-column: span 4; } .widget.w-6 { grid-column: span 6; } .widget.w-8 { grid-column: span 8; } .widget.w-12 { grid-column: span 12; }
@media (max-width: 1100px) { .widget.w-3, .widget.w-4 { grid-column: span 6; } .widget.w-8 { grid-column: span 12; } }
@media (max-width: 700px) { .board .widget { grid-column: span 12; } }
.widget-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.widget-head h3 a { color: var(--ink); text-decoration: none; }
.widget-head h3 a:hover { color: var(--accent); }
.widget .t th, .widget .t td { padding: 8px 10px; }
.vr { min-width: 0; }
.more { margin: 8px 0 0; font-size: 14px; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
a.sort { color: inherit; text-decoration: none; }
a.sort:hover { color: var(--accent); }

.kpi-view { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; }
.field input.sys-value { background: transparent; border-style: dashed; color: var(--muted); }
.big-number { font-family: var(--serif); font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; font-size: clamp(48px, 9vw, 120px); }
.big-number small { font-size: .35em; color: var(--muted); font-weight: 500; }
.kpi-big { font-family: var(--serif); font-size: 40px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 14px; }
.kpi-delta { font-size: 13.5px; margin-top: 6px; }
.kpi-delta.up { color: var(--good); } .kpi-delta.down { color: var(--crit); }

.chart { display: block; max-width: 100%; overflow: visible; }
.chart .tick { fill: var(--muted); font: 11.5px var(--sans); }
.chart .val { fill: var(--ink-2); font: 12px var(--sans); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .today { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 3; }
.chart .bar.soft { opacity: .35; }
.chart .line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { stroke: var(--card); stroke-width: 1.5; }
.chart .slice { stroke: var(--card); stroke-width: 2; }
.chart .donut-total { fill: var(--ink); font: 600 20px var(--serif); }
.chart rect:hover, .chart circle:hover, .chart path:hover { opacity: .85; }
.c0 { fill: var(--c0); } .c1 { fill: var(--c1); } .c2 { fill: var(--c2); } .c3 { fill: var(--c3); } .c4 { fill: var(--c4); } .c5 { fill: var(--c5); } .c6 { fill: var(--c6); } .c7 { fill: var(--c7); }
.s0 { stroke: var(--c0); } .s1 { stroke: var(--c1); } .s2 { stroke: var(--c2); } .s3 { stroke: var(--c3); } .s4 { stroke: var(--c4); } .s5 { stroke: var(--c5); } .s6 { stroke: var(--c6); } .s7 { stroke: var(--c7); }
.legend { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend .sw.c0 { background: var(--c0); } .legend .sw.c1 { background: var(--c1); } .legend .sw.c2 { background: var(--c2); } .legend .sw.c3 { background: var(--c3); }
.legend .sw.c4 { background: var(--c4); } .legend .sw.c5 { background: var(--c5); } .legend .sw.c6 { background: var(--c6); } .legend .sw.c7 { background: var(--c7); }
.legend-col { flex-direction: column; gap: 8px; margin: 0; }
.legend-col li { display: grid; grid-template-columns: 10px 1fr auto auto; gap: 8px; align-items: center; }
.legend-col b { font-weight: 600; font-variant-numeric: tabular-nums; }
.lg-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-wrap { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.donut-wrap .legend-col { flex: 1 1 180px; }

.kanban { display: flex; gap: 12px; align-items: flex-start; min-width: min-content; padding-bottom: 4px; }
.lane { flex: 0 0 240px; background: var(--side); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.lane.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.lane header { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px; font-size: 14px; }
.lane-count { font-size: 12.5px; color: var(--muted); background: var(--card); border-radius: 999px; padding: 0 8px; }
.lane-cards { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.kcard { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; font-size: 14px; cursor: grab; }
.kcard[draggable="true"]:active { cursor: grabbing; }
.kcard.moving { opacity: .55; }
.kcard a { color: var(--ink); text-decoration: none; }
.kcard a:hover { color: var(--accent); }
.kcard small { font-size: 12.5px; }
.kmove { margin-top: 6px; min-height: 30px; font: inherit; font-size: 12.5px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink-2); }

.designer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.designer .preview { position: sticky; top: 16px; min-height: 240px; display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 1100px) { .designer { grid-template-columns: 1fr; } .designer .preview { position: static; } }
.kinds { display: flex; flex-wrap: wrap; gap: 8px; }
.kind { position: relative; }
.kind input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.kind span { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 14px; background: var(--card); }
.kind input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); font-weight: 600; }
.kind input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.filter-row, .measure-row, .layout-row { align-items: center; }
.filter-row select, .filter-row input, .measure-row select, .layout-row select { min-height: 38px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 10px; font: inherit; font-size: 14px; color: var(--ink); background: var(--card); max-width: 100%; }
.filter-val { flex: 1 1 200px; }
.filter-val input { flex: 1 1 120px; min-width: 0; }
.filter-val .check { font-size: 13.5px; }
details.card > summary { font-weight: 600; }

.board { align-items: start; }
.content:has(> .board), .content:has(> .designer) { max-width: 1320px; }
.t td:first-child b { white-space: nowrap; }

/* Conversación */
.content:has(> .chat) { max-width: 1240px; }
.chat { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.chat-list { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 120px); overflow: auto; }
.chat-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.chat-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; max-width: 860px; }
@media (max-width: 900px) { .chat { grid-template-columns: 1fr; } .chat-list { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; } .chat-list .nav { display: none; } }
.thread { display: flex; flex-direction: column; gap: 18px; min-height: 40vh; }
.msg { display: flex; gap: 12px; align-items: flex-start; }
.msg.me { justify-content: flex-end; }
.msg.me .bubble { background: var(--side); border: 1px solid var(--line); border-radius: 18px 18px 4px 18px; padding: 10px 16px; max-width: 80%; white-space: pre-wrap; overflow-wrap: anywhere; }
.avatar-bot { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 600 15px var(--serif); display: flex; align-items: center; justify-content: center; flex: none; margin-top: 2px; }
.bot-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; flex: 1; }
.md { font-family: var(--serif); font-size: 16.5px; line-height: 1.6; overflow-wrap: anywhere; }
.md p { margin: 0 0 8px; } .md p:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 22px; } .md li { margin: 2px 0; }
.md code { background: var(--side); border-radius: 6px; padding: 1px 5px; }
.md-h { font-weight: 600; }
.block { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.block h3 { margin: 0; }
.block ul { margin: 0; padding-left: 20px; font-size: 14.5px; }
.block-foot { margin-top: 2px; }
.block .flash ul { margin-top: 4px; }
.t.kv th { width: 38%; color: var(--muted); font-weight: 500; font-size: 14px; }
.t.kv th, .t.kv td { padding: 7px 10px; border-top: 1px solid var(--line); }
.t.kv tr:first-child th, .t.kv tr:first-child td { border-top: 0; }
.typing .dots { display: flex; gap: 5px; padding: 12px 4px; }
.typing .dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out; }
.typing .dots span:nth-child(2) { animation-delay: .2s; } .typing .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing .dots span { animation: none; opacity: .6; } }
.composer { position: sticky; bottom: 12px; display: flex; gap: 10px; align-items: flex-end; background: var(--card); border: 1px solid var(--line-strong); border-radius: 18px; padding: 10px 10px 10px 16px; box-shadow: 0 6px 24px rgba(0, 0, 0, .06); }
.composer textarea { flex: 1; border: 0; resize: none; font: inherit; font-size: 16px; background: transparent; color: var(--ink); outline: none; min-height: 28px; max-height: 220px; padding: 6px 0; }
.composer:focus-within { border-color: var(--accent); }
.chat-foot { font-size: 12.5px; margin: 0; }
.chat-empty { text-align: center; padding: 8vh 0 2vh; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.chat-empty h2 { font-size: 28px; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 640px; }
.chip-btn { border: 1px solid var(--line-strong); background: var(--card); color: var(--ink-2); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 14px; cursor: pointer; }
.chip-btn:hover { border-color: var(--accent); color: var(--accent-strong); }
.ask-home { gap: 10px; }
.ask-label { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.ask-row { display: flex; gap: 10px; flex-wrap: wrap; }
.ask-row input { flex: 1 1 260px; min-height: 46px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 12px; font: inherit; background: var(--card); color: var(--ink); }
.ask-row input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.prov-row { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.nav a .count { background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: 12px; font-weight: 600; min-width: 22px; padding: 1px 7px; text-align: center; }
.aviso.nuevo { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }

/* Documentos y archivos */
.doc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line, #E6E2D6); }
.doc-row:first-of-type { border-top: 0; }
.doc-row form { margin: 0; }
.doc-send { background: var(--side); border-radius: 12px; padding: 14px; }
.upload input[type=file] { max-width: 100%; }
.blocks { display: flex; flex-direction: column; gap: 12px; }
.block-item { border: 1px solid var(--line, #E6E2D6); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--card, #fff); }
.block-item .block-bar { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.block-item .block-bar select { width: auto; }
.pick { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.tot-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
@media (max-width: 640px) { .tot-row { grid-template-columns: 1fr; } }
.block-bar select, .tot-row input, .tot-row select { min-height: 40px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 10px; font: inherit; color: var(--ink); background: var(--card); width: 100%; }
.block-bar select { width: auto; font-weight: 600; }
.block-bar select:focus, .tot-row input:focus, .tot-row select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Código QR (verificación en dos pasos): siempre sobre blanco, también en modo oscuro */
.qr-box { display: flex; justify-content: center; }
.qr-box svg { display: block; width: 200px; height: 200px; max-width: 100%; border-radius: 12px; border: 1px solid var(--line); background: #fff; }

/* =====================================================================
   Pulido general (tema neutro)
   ===================================================================== */
body { font-size: 14.5px; }
::selection { background: var(--sel); }
.brand b { font-size: 19px; }
.nav { gap: 1px; }
.nav a { min-height: 34px; padding: 0 10px; border-radius: 8px; color: var(--ink-2); font-size: 14px; transition: background .12s; }
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a.on { background: var(--sel); color: var(--ink); font-weight: 600; }
.nav .label { padding-top: 6px; }
.nav a .count { background: var(--accent); color: var(--accent-ink); font-size: 11.5px; min-width: 20px; padding: 0 6px; line-height: 18px; }
.kbd-hint { min-height: 36px; border-radius: 10px; font-size: 13.5px; background: var(--card); }
.side .field label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.side .field select { min-height: 38px; font-size: 13.5px; }
.avatar { width: 30px; height: 30px; font-size: 12px; }

.card { border-radius: 14px; box-shadow: var(--shadow); }
.kpi { box-shadow: var(--shadow); }
.btn { min-height: 38px; border-radius: 10px; border-color: var(--line-strong); background: var(--card); font-size: 14px; transition: background .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--hover); border-color: var(--line-strong); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink); }
.btn.danger { color: var(--crit); }
.btn.danger:hover { background: var(--crit-soft); border-color: transparent; }
.btn.small { min-height: 32px; font-size: 13.5px; border-radius: 8px; }
.btn:focus-visible, .field input:focus, .field select:focus, .field textarea:focus, .nav a:focus-visible, .chip-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field input, .field select, .field textarea { min-height: 40px; border-radius: 10px; }
.field .req { color: var(--crit); }
.check input, input[type=radio] { accent-color: var(--accent); }
.linkbtn { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
details > summary { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }

table.t { font-size: 13.5px; }
table.t th { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--card); }
table.t tr:hover td { background: var(--hover); }
table.t a { font-weight: 500; }
.scroll { overflow-x: auto; overscroll-behavior-x: contain; }
.card.flush > .scroll > table.t th { position: sticky; top: 0; z-index: 1; }

.badge { font-size: 12px; padding: 1px 9px; background: var(--side); border-color: var(--line); }
.flash { border-radius: 10px; font-size: 14px; }
.lead { font-size: 16px; color: var(--ink-2); }
.kind input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.lane.over { outline-color: var(--ink); }
.steps li.now { background: var(--accent); color: var(--accent-ink); }
.aviso.nuevo { border-color: var(--line-strong); box-shadow: inset 3px 0 0 var(--accent), var(--shadow); }

/* Gráficas: paleta sobria (la primera serie es tinta) */
:root { --c0: #2B2A27; --c1: #4C6FA5; --c2: #4F8A63; --c3: #C49A3E; --c4: #7E66AE; --c5: #3F8F8C; --c6: #B5606F; --c7: #8E8B82; }
:root[data-theme="dark"] { --c0: #E9E6DD; --c1: #7EA3D8; --c2: #7FBF93; --c3: #E2BE6E; --c4: #AE97D6; --c5: #74C1BC; --c6: #DE8E9C; --c7: #A7A498; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --c0: #E9E6DD; --c1: #7EA3D8; --c2: #7FBF93; --c3: #E2BE6E; --c4: #AE97D6; --c5: #74C1BC; --c6: #DE8E9C; --c7: #A7A498; } }
.chart .today { stroke: var(--crit); }

/* Interruptor de tema */
.theme-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.theme-switch button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; padding: 4px 9px; cursor: pointer; }
.theme-switch button[aria-pressed="true"] { background: var(--sel); color: var(--ink); font-weight: 600; }

/* Aviso de datos nuevos */
.live-note { position: fixed; right: 20px; bottom: 20px; z-index: 40; display: flex; gap: 10px; align-items: center; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; }
.live-note button { border: 0; background: transparent; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }

/* =====================================================================
   Conversación a pantalla completa: la lista y el hilo se desplazan solos;
   la caja para escribir queda fija abajo.
   ===================================================================== */
.scroller:has(.chat) { overflow: hidden; display: flex; }
.content:has(> .chat) { max-width: none; flex: 1; min-height: 0; padding: 0; gap: 0; }
.content:has(> .chat) > .flash { margin: 12px 24px 0; }
.chat { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 0; height: 100%; min-height: 0; align-items: stretch; flex: 1; }
.chat-list { position: static; max-height: none; height: 100%; overflow-y: auto; padding: 16px 12px; border-right: 1px solid var(--line); gap: 10px; }
.chat-list .nav a { min-height: 34px; }
.chat-main { max-width: none; height: 100%; min-height: 0; display: flex; flex-direction: column; gap: 0; }
.thread-wrap { flex: 1 1 auto; min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
.thread { max-width: 820px; margin: 0 auto; padding: 24px 24px 16px; min-height: 0; gap: 22px; }
.chat-dock { flex: none; padding: 8px 24px 14px; background: linear-gradient(to bottom, transparent, var(--bg) 18px); }
.chat-dock .composer, .chat-dock .chat-foot, .chat-dock > .flash { max-width: 820px; margin-left: auto; margin-right: auto; }
.composer { position: static; border-radius: 16px; box-shadow: var(--shadow); border-color: var(--line-strong); }
.composer:focus-within { border-color: var(--ink-2); }
.composer .btn.primary { border-radius: 10px; }
.chat-foot { text-align: center; margin-top: 8px; font-size: 12px; }
.avatar-bot { background: var(--accent); color: var(--accent-ink); font-family: var(--sans); font-size: 13px; width: 28px; height: 28px; }
.msg.me .bubble { background: var(--sel); border: 0; border-radius: 16px; font-size: 15px; }
.md { font-size: 16px; }
.bot-col .block.card { box-shadow: none; }
.bot-col .vr { max-height: 440px; overflow: auto; overscroll-behavior: contain; }
.bot-col .vr table.t th { position: sticky; top: 0; z-index: 1; }
.chat-empty { padding: 10vh 0 2vh; }
.chat-empty h2 { font-size: 30px; }
.chip-btn { background: var(--card); border-color: var(--line); color: var(--ink-2); }
.chip-btn:hover { border-color: var(--line-strong); background: var(--hover); color: var(--ink); }
@media (max-width: 900px) {
  .chat { grid-template-columns: 1fr; height: auto; }
  .chat-list { height: auto; border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; }
  .chat-list .nav { display: none; }
  .scroller:has(.chat) { display: block; overflow: visible; }
  .thread-wrap { overflow: visible; }
  .chat-dock { position: sticky; bottom: 0; background: var(--bg); }
}

/* ---------- Barra lateral: grupos, ocultar y barras fijas (0.7.4) ---------- */
.side { transition: margin-left .18s ease, opacity .18s ease; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.topbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-title h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-show { display: none; margin-left: -6px; }
.side-head { display: flex; flex-direction: column; gap: 12px; }
.side-nav { display: flex; flex-direction: column; gap: 6px; }
.nav-group > summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 10px; border-radius: 8px; cursor: pointer; user-select: none; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin-right: 2px; }
.nav-group[open] > summary::before { transform: rotate(45deg); }
.nav-group > summary:hover { color: var(--ink); background: var(--hover); }
.nav-group > summary:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.nav-group > summary small { margin-left: auto; font-weight: 500; letter-spacing: 0; opacity: .7; }
.nav-group > summary .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.nav-group[open] > summary .dot { display: none; }
.nav-group .nav { padding: 2px 0 6px; }
.nav a .nav-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

@media (min-width: 861px) {
  .side { overflow: hidden; padding-bottom: 12px; }
  .side .collapsible { min-height: 0; gap: 14px; }
  .side-nav { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -6px; padding: 0 6px; scrollbar-gutter: stable; }
  .side-nav { mask-image: linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 14px), transparent 100%); padding-top: 4px; }
  .side-foot { margin-top: 0; flex: none; }
  :root[data-side="hidden"] .side { margin-left: -256px; opacity: 0; pointer-events: none; }
  :root[data-side="hidden"] .side-show { display: inline-flex; }
}
@media (max-width: 860px) {
  .side-hide, .side-show { display: none !important; }
  .side-top .menu-toggle { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

/* Barras de acción fijas al pie en formularios largos */
.form-actions { position: sticky; bottom: 0; z-index: 6; background: var(--bg); margin: 0 -2px; padding: 12px 2px; border-top: 1px solid var(--line); }
.card .form-actions, .card.form-actions { background: var(--card); }
.card .form-actions { margin: 0 -20px -20px; padding: 12px 20px; border-radius: 0 0 14px 14px; }
.card.form-actions { border-radius: 14px; box-shadow: 0 -6px 18px -12px rgba(0,0,0,.25); }
/* Herramientas del tablero fijas arriba */
.sticky-tools { position: sticky; top: 0; z-index: 6; background: var(--bg); padding: 10px 0; margin-top: -10px; border-bottom: 1px solid transparent; }
/* Menú de la persona al pie de la barra */
.side-foot { padding-top: 8px; position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; border-radius: 10px; padding: 6px; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover, .user-menu[open] > summary { background: var(--hover); }
.user-menu > summary:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.user-menu .who span { flex: 1; }
.user-menu .who b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu .chev { width: 7px; height: 7px; border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); transform: rotate(-135deg); margin: 4px 6px 0 0; flex: none; }
.user-menu[open] .chev { transform: rotate(45deg); margin-top: -4px; }
.user-pop { position: absolute; left: 0; right: 0; bottom: calc(100% + 4px); z-index: 30; background: var(--card); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow-lg, 0 12px 32px rgba(0,0,0,.22)); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.user-pop a, .user-pop form button { display: flex; align-items: center; min-height: 36px; padding: 0 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font: inherit; font-size: 14px; background: none; border: 0; width: 100%; cursor: pointer; text-align: left; }
.user-pop a:hover, .user-pop form button:hover { background: var(--hover); }
.user-pop .pop-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; font-size: 13px; }
.user-pop form { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
@media (min-width: 861px) { .side { overflow: visible; } .side-nav { overflow-y: auto; } }
.nav-group > summary, .user-menu > summary { text-decoration: none; margin-bottom: 0 !important; }
.user-menu > summary { color: var(--ink); font-size: inherit; }
.user-pop .pop-row { flex-direction: column; align-items: stretch; gap: 6px; }
.user-pop .theme-switch { display: flex; }
.user-pop .theme-switch button { flex: 1; padding: 5px 4px; }
.card.form-actions { margin: 0; padding: 14px 20px; }
.sticky-tools { margin: -10px -28px 0; padding: 10px 28px; border-bottom: 1px solid var(--line); }
@media (max-width: 860px) { .sticky-tools { position: static; margin: 0; padding: 0; border: 0; } }
/* Opciones excluyentes con descripción */
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .12s, background .12s; }
.choice:hover { background: var(--hover); }
.choice:has(input:checked) { border-color: var(--ink); background: var(--sel); }
.choice input { margin-top: 3px; accent-color: var(--ink); flex: none; }
.choice span { display: flex; flex-direction: column; gap: 2px; }
.choice small { color: var(--muted); font-size: 13.5px; line-height: 1.45; }

/* Conversación: propuestas de baja y habilidades (0.7.6) */
.proposal-danger { border-color: color-mix(in srgb, var(--crit) 45%, var(--line)); }
.skill-chip { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 3px 10px 3px 8px; border-radius: 999px; background: var(--side); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.skill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.skill-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.skill-bar button { border: 1px solid var(--line); background: var(--card); color: var(--ink-2); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
.skill-bar button:hover { background: var(--hover); color: var(--ink); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr; } }
.starter { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; transition: border-color .12s, background .12s; }
.starter:hover { border-color: var(--line-strong); background: var(--hover); }
.starter span { font-size: 13.5px; line-height: 1.45; }
.starter small { color: var(--muted); font-size: 12.5px; }
.cal-grid td { padding: 4px 8px; vertical-align: middle; }
.cal-grid input { min-height: 34px; padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--card); color: var(--ink); font: inherit; width: 100%; }
.cal-grid tr.sub td { border-top: 0; }

/* Meta contra real, andon y avisos en vivo */
.big-number.is-bad, .tone-critical .big-number { color: var(--crit); }
.tone-good .big-number { color: var(--good, #2f7d4f); }
.goal-view { display: flex; flex-direction: column; gap: 10px; }
.goal-nums { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.goal-of { display: flex; flex-direction: column; align-items: flex-end; font-size: clamp(14px, 1.2vw, 18px); text-align: right; }
.tv-board .goal-of { font-size: clamp(18px, 1.8vw, 30px); }
.goal-bar { height: 14px; border-radius: 99px; background: var(--line); overflow: hidden; }
.goal-fill { display: block; height: 100%; border-radius: 99px; background: var(--good, #2f7d4f); transition: width .6s ease; }
.goal-fill.warning { background: var(--warn, #b7791f); } .goal-fill.critical { background: var(--crit); }
.goal-foot { display: flex; gap: 10px; align-items: baseline; font-size: 15px; }
.andon { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.andon-tile { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 12px; color: #fff; text-decoration: none; min-height: 92px; }
.andon-tile b { font-size: 17px; line-height: 1.2; }
.andon-tile .andon-state { font-size: 14px; opacity: .95; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.andon-tile small { opacity: .85; }
.andon-tile.good { background: #2f7d4f; } .andon-tile.warning { background: #b7791f; } .andon-tile.critical { background: #c0392b; animation: sr-blink 1.6s ease-in-out infinite; }
@keyframes sr-blink { 50% { filter: brightness(1.25); } }
@media (prefers-reduced-motion: reduce) { .andon-tile.critical { animation: none; } }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.feed li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); }
.feed li.is-new { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* Plan contra real por línea */
.pr-sum { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: baseline; margin-bottom: 12px; }
.pr-sum > span { display: flex; flex-direction: column; }
.pr-sum b { font-family: var(--serif); font-size: 24px; font-variant-numeric: tabular-nums; }
.pr-sum .is-bad b { color: var(--crit); }
.pr-src { margin-left: auto; align-self: center; }
.pr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pr-grid.pr-detail { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.pr-card { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); border-left: 6px solid var(--line-strong); background: var(--card); min-width: 0; }
.pr-card.tone-good { border-left-color: var(--good); }
.pr-card.tone-warning { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 7%, var(--card)); }
.pr-card.tone-critical { border-left-color: var(--crit); background: color-mix(in srgb, var(--crit) 8%, var(--card)); }
.pr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.pr-name { font-size: 16px; line-height: 1.25; color: var(--ink); text-decoration: none; }
a.pr-name:hover { text-decoration: underline; }
.pr-chip { flex: none; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 9px; border-radius: 99px; background: var(--line); color: var(--muted); }
.tone-good .pr-chip { background: var(--good); color: #fff; } .tone-warning .pr-chip { background: var(--warn); color: #fff; } .tone-critical .pr-chip { background: var(--crit); color: #fff; }
.pr-sub { font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pr-stop { color: var(--crit); font-weight: 700; }
.pr-nums { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.pr-nums > div { display: flex; flex-direction: column; min-width: 0; }
.pr-big { font-family: var(--serif); font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; }
.pr-plan b, .pr-pct b { font-size: 22px; font-variant-numeric: tabular-nums; }
.pr-pct { text-align: right; }
.pr-pct b, .pr-plan b, .pr-big { white-space: nowrap; }
.tone-good .pr-pct b { color: var(--good); } .tone-warning .pr-pct b { color: var(--warn); } .tone-critical .pr-pct b, .tone-critical .pr-big { color: var(--crit); }
.pr-bar { position: relative; height: 12px; border-radius: 99px; background: var(--line); }
.pr-fill { display: block; height: 100%; border-radius: 99px; background: var(--muted); transition: width .6s ease; }
.tone-good .pr-fill { background: var(--good); } .tone-warning .pr-fill { background: var(--warn); } .tone-critical .pr-fill { background: var(--crit); }
.pr-mark { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1px; border-radius: 2px; background: var(--ink); }
.pr-foot { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 13.5px; }
.pr-foot .is-bad, .pr-orders .is-bad { color: var(--crit); font-weight: 700; }
.pr-spark-box { display: flex; flex-direction: column; gap: 2px; }
.pr-spark { width: 100%; height: 56px; display: block; }
.pr-sp-plan { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.pr-sp-real { fill: none; stroke: var(--accent); stroke-width: 3; vector-effect: non-scaling-stroke; }
.tone-critical .pr-sp-real { stroke: var(--crit); } .tone-warning .pr-sp-real { stroke: var(--warn); } .tone-good .pr-sp-real { stroke: var(--good); }
.pr-spark-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.pr-ord { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; min-width: 0; }
.pr-ord span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-other b { color: var(--warn); }
.pr-orders { margin-top: 4px; font-size: 13px; }
.pr-orders tr.is-now td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.tv-board .pr-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.tv-board .pr-name { font-size: clamp(17px, 1.25vw, 24px); }
.tv-board .pr-big { font-size: clamp(40px, 3.2vw, 66px); }
.tv-board .pr-plan b, .tv-board .pr-pct b { font-size: clamp(20px, 1.6vw, 32px); }
.tv-board .pr-sub, .tv-board .pr-foot, .tv-board .pr-ord { font-size: clamp(14px, 1.1vw, 19px); }
.tv-board .pr-sum b { font-size: clamp(24px, 2.2vw, 40px); }
.tv-board .pr-bar { height: 16px; }
.tv-board .pr-card.tone-critical { animation: sr-blink 2.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .tv-board .pr-card.tone-critical { animation: none; } }

/* Pantallas (TV y estaciones) */
.tv-body { min-height: 100vh; display: flex; flex-direction: column; gap: 14px; padding: 18px 22px; background: var(--bg); color: var(--ink); }
.tv-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.tv-titles { display: flex; flex-direction: column; }
.tv-titles b { font-family: var(--serif); font-size: clamp(24px, 2.6vw, 40px); line-height: 1.1; }
.tv-titles small { color: var(--muted); font-size: clamp(13px, 1.1vw, 18px); }
.tv-right { display: flex; align-items: center; gap: 12px; }
.tv-clock { font-variant-numeric: tabular-nums; font-size: clamp(22px, 2.4vw, 38px); font-weight: 600; }
.tv-dot { width: 12px; height: 12px; border-radius: 50%; background: #2f9e5f; box-shadow: 0 0 0 4px color-mix(in srgb, #2f9e5f 25%, transparent); }
.tv-dot.off { background: var(--crit); box-shadow: 0 0 0 4px color-mix(in srgb, var(--crit) 25%, transparent); }
.tv-pages { color: var(--muted); font-variant-numeric: tabular-nums; }
.tv-alerts { display: flex; flex-direction: column; gap: 6px; }
.tv-alert { background: #c0392b; color: #fff; border-radius: 12px; padding: 12px 18px; font-size: clamp(16px, 1.6vw, 26px); font-weight: 600; animation: sr-blink 1.6s ease-in-out infinite; }
.tv-alert.more { background: #8e2b20; animation: none; }
.tv-board { flex: 1; }
.tv-board .widget h3 { font-size: clamp(16px, 1.4vw, 24px); }
.tv-board .t { font-size: clamp(14px, 1.15vw, 20px); }
.tv-board .kpi-big { font-size: clamp(40px, 5vw, 88px); }
.tv-board .big-number { font-size: clamp(56px, 8vw, 150px); }
.tv-board .andon { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tv-board .andon-tile { min-height: 120px; } .tv-board .andon-tile b { font-size: clamp(18px, 1.5vw, 26px); }
.tv-board .feed li { font-size: clamp(15px, 1.2vw, 22px); }
.tv-foot { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.tv-stop { max-width: 640px; margin: 10vh auto; text-align: center; }
@media (prefers-reduced-motion: reduce) { .tv-alert { animation: none; } }

.input-sm { min-height: 34px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--card); color: var(--ink); font: inherit; font-size: 14px; }

/* Terminal de piso */
.floor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.floor-card { display: flex; flex-direction: column; gap: 6px; color: var(--ink); text-decoration: none; }
.floor-card:hover { border-color: var(--accent); }
.floor-kpi { display: flex; justify-content: space-between; align-items: baseline; }
.floor-kpi b { font-family: var(--serif); font-size: 30px; }
.term-body { min-height: 100vh; display: flex; flex-direction: column; gap: 14px; padding: 16px 20px; background: var(--bg); color: var(--ink); max-width: 1280px; margin: 0 auto; }
.term-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.term-title { font-family: var(--serif); font-size: clamp(24px, 3vw, 36px); }
.term-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.term-oee.good b { color: var(--good); } .term-oee.warning b { color: var(--warn); } .term-oee.critical b { color: var(--crit); }
.term-oee small:last-child { margin-top: 4px; }
.term-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.term-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.term-body label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.term-body label.check { flex-direction: row; align-items: center; font-weight: 500; font-size: 16px; }
.term-body label.check input { width: 22px; height: 22px; margin: 0; }
.input-lg, .input-xl { min-height: 52px; padding: 10px 14px; font: inherit; font-size: 18px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--card); color: var(--ink); width: 100%; }
.input-xl { min-height: 72px; font-size: 32px; font-variant-numeric: tabular-nums; text-align: center; }
.btn-xl { min-height: 64px; font-size: 20px; }
.cause-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.btn-cause { min-height: 72px; font-size: 17px; white-space: normal; background: color-mix(in srgb, var(--crit) 12%, var(--card)); border-color: color-mix(in srgb, var(--crit) 35%, var(--line)); }
.term-stop { display: grid; grid-template-columns: 1fr minmax(200px, 1fr) auto; gap: 12px; align-items: center; border-color: var(--crit); background: color-mix(in srgb, var(--crit) 10%, var(--card)); }
@media (max-width: 860px) { .term-kpis { grid-template-columns: 1fr 1fr; } .term-grid, .term-stop { grid-template-columns: 1fr; } }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.timeline li { position: relative; }
.timeline li::before { content: ''; position: absolute; left: -24px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

/* Procesos con flujo */
.flow-edit { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .flow-edit { grid-template-columns: 1fr; } }
textarea.code, pre.code { font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; tab-size: 2; }
textarea.code { width: 100%; min-height: 420px; resize: vertical; white-space: pre; overflow-x: auto; }
pre.guide { font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; margin: 10px 0 0; }
ul.errs { margin: 6px 0 0; padding-left: 18px; }
.danger-text { color: var(--crit); }
.flow-head { font-size: 13px; }
.flow-map { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: step; }
.flow-step { border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; background: var(--card); display: grid; gap: 4px; }
.flow-step.flow-decision { border-left-color: var(--warn); }
.flow-step.flow-cambio { border-left-color: var(--muted); border-style: dashed solid dashed solid; }
.flow-step.done { border-left-color: var(--good); }
.flow-step.on { border-left-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.flow-edges { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; font-size: 13.5px; }
.flow-edges a { font-weight: 600; }
.edge-label { display: inline-block; padding: 0 6px; border-radius: 6px; background: var(--raise, var(--side)); border: 1px solid var(--line); }
.sla { display: grid; gap: 4px; }
.sla .bar { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; }
.sla .bar span { display: block; height: 100%; background: var(--good); }
.sla.near .bar span { background: var(--warn); }
.sla.late .bar span { background: var(--crit); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .kpis { grid-template-columns: 1fr 1fr; } }
.kpi em.kunit { font-style: normal; font-family: var(--sans, system-ui); font-size: 14px; font-weight: 500; color: var(--muted); }
table.t td.num { white-space: nowrap; }
.hbar { height: 8px; background: var(--line); border-radius: 6px; overflow: hidden; min-width: 60px; }
.hbar span { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.row-hot td { background: var(--crit-soft); }
.split { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr 90px; gap: 10px; align-items: center; font-size: 13.5px; margin-top: 6px; }
.weeks { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 6px; }
.weeks .wk { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.weeks .wk span { display: block; width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.weeks .wk small { color: var(--muted); font-size: 11px; }
.sim td input { width: 90px; }
.better { color: var(--good); font-weight: 600; }
.worse { color: var(--crit); font-weight: 600; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.secret-once { border-color: var(--warn); background: var(--warn-soft); }
code.secret { font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; word-break: break-all; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 10px; }
.perm-grid > div { display: grid; gap: 4px; font-size: 13.5px; }
.ep { display: grid; grid-template-columns: 70px 1fr; gap: 10px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--line); }
.verb { font: 600 12px ui-monospace, Menlo, monospace; padding: 2px 6px; border-radius: 6px; text-align: center; background: var(--side); border: 1px solid var(--line); }
.verb.get { color: var(--good); } .verb.post { color: var(--accent); } .verb.patch { color: var(--warn); } .verb.delete { color: var(--crit); }

/* Trabajos en segundo plano e importación */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--side); border: 1px solid var(--line); font-size: 13px; }
.map-table th { vertical-align: bottom; white-space: nowrap; }
.map-table thead tr:nth-child(2) th { background: var(--side); font-weight: 400; }
.map-table select { min-width: 150px; font-size: 13px; padding: 4px 6px; }
.map-table select.muted { color: var(--muted); }
.export-menu { position: relative; }
.export-menu > div { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 280px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: var(--shadow); }

/* Inventario */
.trace { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.trace li { padding: 6px 10px; border-left: 3px solid var(--line); background: var(--side); border-radius: 0 8px 8px 0; font-size: 14px; }
.inline-form summary { list-style: none; cursor: pointer; }
.inline-form summary::-webkit-details-marker { display: none; }
.inline-form[open] form { margin-top: 6px; justify-content: flex-end; }
.xform select { min-width: 190px; max-width: 260px; }
.xform input, .xform select { font-size: 14px; padding: 6px 8px; }
.trace-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 800px) { .trace-cols { grid-template-columns: 1fr; } }
.xform select[aria-label="Lugar"] { min-width: 140px; max-width: 170px; }
.xform input[type=date] { width: 140px; }

/* Lugares y plano */
.crumbs { font-size: 14px; color: var(--muted); }
.crumbs a { color: inherit; }
.plano-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.plano-bar { padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.plano { display: block; width: 100%; height: auto; max-height: 520px; background: var(--side); touch-action: none; }
.plano .grid line { stroke: var(--line); stroke-width: 0.02; }
.plano .grid line.g5 { stroke-width: 0.05; }
.plano .border { fill: none; stroke: var(--ink, #222); stroke-width: 0.08; }
.plano .room rect { fill: var(--card); stroke: var(--muted); stroke-width: 0.06; }
.plano .room.ok rect:first-of-type { fill: color-mix(in srgb, var(--good) 22%, var(--card)); stroke: var(--good); }
.plano .room.nuevo rect:first-of-type { stroke-dasharray: 0.2 0.15; }
.plano .room text { fill: var(--ink, #222); pointer-events: none; font-family: var(--sans, system-ui); }
.plano .room { cursor: pointer; }
.plano-wrap.editing .plano .room { cursor: move; }
.plano .room .handle { fill: var(--accent); stroke: none; cursor: nwse-resize; }
.plano .room:focus rect:first-of-type, .plano .room:hover rect:first-of-type { stroke-width: 0.12; }
.plano-tools { padding: 8px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; gap: 10px; font-size: 14px; }
.plano-legend { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.plano-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--muted); background: var(--card); margin-left: 6px; }
.plano-legend i.ok { background: color-mix(in srgb, var(--good) 22%, var(--card)); border-color: var(--good); }

/* Actividad del registro */
.mention-box { position: relative; }
.mention-box textarea { width: 100%; }
.mention-list { position: absolute; left: 0; top: 100%; z-index: 30; list-style: none; margin: 4px 0 0; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); min-width: 260px; }
.mention-list li { padding: 6px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.mention-list li.active, .mention-list li:hover { background: var(--side); }
.mention { background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 4px; padding: 0 3px; font-weight: 500; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.feed li { padding: 10px 0 10px 16px; border-left: 2px solid var(--line); position: relative; }
.feed li::before { content: ''; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.feed li.feed-comentario::before { background: var(--accent); }
.feed li.feed-archivo::before { background: var(--good); }
.feed-head { font-size: 14px; }
.feed-cambio .feed-head { color: var(--ink-2); }
.feed-body { margin-top: 4px; padding: 8px 12px; background: var(--side); border-radius: 10px; font-size: 15px; }
.feed li:target .feed-body { outline: 2px solid var(--accent); }
.feed > li { display: block; border: 0; border-left: 2px solid var(--line); border-radius: 0; background: none; margin: 0; box-shadow: none; }
.comment-form textarea { font: inherit; font-size: 15px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); resize: vertical; }
.comment-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.plano-el { display: grid; gap: 6px; }
.plano-el .plano { max-height: none; border-radius: 10px; }
.t.compact { font-size: 13.5px; }
.t.compact td, .t.compact th { padding-left: 8px; padding-right: 8px; }
/* 0.9.3: resúmenes precalculados, existencias en la conversación y control */
.precalc { display: block; margin-top: 6px; font-size: 12px; text-align: right; }
.block .stock-head { margin: 10px 0 4px; }
.block .stock-head a { font-weight: 600; }
.control-box { border-left: 3px solid var(--warn, #b7791f); padding-left: 10px; }
.tag.muted { opacity: .6; }
/* 0.9.4: almacén en el teléfono */
.phone { max-width: 620px; margin: 0 auto; }
.phone .tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.phone .tile { display: flex; flex-direction: column; gap: 4px; padding: 20px 16px; min-height: 110px; border: 1px solid var(--line); border-radius: 14px; background: var(--card, #fff); text-decoration: none; color: inherit; }
.phone .tile b { font-size: 20px; }
.phone .tile small { color: var(--muted); }
.phone .tile:active, .phone .tile:hover { border-color: var(--accent); }
.phone .back { text-decoration: none; color: var(--muted); font-size: 15px; }
.phone .scan-form label, .phone .field > label { font-weight: 600; }
.scan-row { display: flex; gap: 8px; }
.scan-row input { flex: 1; min-width: 0; font-size: 18px; padding: 12px; }
.phone .btn.big { width: 100%; padding: 14px; font-size: 18px; }
.phone .row .btn.big { flex: 1; width: auto; }
.phone input[inputmode="decimal"] { font-size: 18px; }
.plist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.plist li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.plist li:last-child { border-bottom: 0; }
.plist.pick li { padding: 0; }
.plist.pick li a { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 12px 6px; text-decoration: none; color: inherit; }
.plist li.on { background: var(--side); border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.plist.route { counter-reset: s; }
.plist.count li.done { opacity: .6; }
.plist.count .qty { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.plist.count .qty input { width: 90px; text-align: right; padding: 10px; }
.phone .stop { border: 2px solid var(--accent); }
.scan-cam { position: fixed; inset: 0; z-index: 1000; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; color: #fff; }
.scan-cam video { width: 100%; max-width: 560px; border-radius: 12px; }
@media print { .route-print .no-print { display: none; } }
/* Chat de empleados (app) */
.chatapp { display: grid; grid-template-columns: 270px 1fr; gap: 16px; height: calc(100vh - 150px); min-height: 420px; }
.chatapp-side { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.chatapp-list { display: flex; flex-direction: column; }
.chatapp-list a { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 8px; text-decoration: none; color: inherit; }
.chatapp-list a:hover { background: var(--side); }
.chatapp-list a.on { background: var(--side); font-weight: 600; }
.chatapp-list .unread { background: var(--accent); color: #fff; border-radius: 10px; font-size: 12px; padding: 1px 7px; }
.chatapp-main { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.chatapp-head { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chatapp-back { display: none; text-decoration: none; font-size: 20px; margin-right: 4px; }
.chatapp-msgs { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.cm { max-width: 78%; align-self: flex-start; }
.cm .cm-head { margin-top: 10px; font-size: 14px; }
.cm .cm-text { background: var(--side); border-radius: 12px; padding: 7px 11px; margin-top: 2px; overflow-wrap: anywhere; }
.cm.mine { align-self: flex-end; text-align: right; }
.cm.mine .cm-text { background: var(--accent); color: #fff; text-align: left; }
.cm.mine .cm-text a { color: #fff; }
.cm .mention { color: inherit; }
.chatapp-compose { position: relative; display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); align-items: flex-end; }
.chatapp-compose textarea { flex: 1; resize: none; font: inherit; padding: 10px; }
.chatapp-compose .mention-list { bottom: 100%; top: auto; }
@media (max-width: 860px) {
  .chatapp { grid-template-columns: 1fr; height: calc(100vh - 120px); }
  .chatapp.has-channel .chatapp-side { display: none; }
  .chatapp:not(.has-channel) .chatapp-main { display: none; }
  .chatapp-back { display: inline; }
  .cm { max-width: 90%; }
}
/* 0.10.0: antigüedad de saldos */
.aging-bar { display: flex; height: 28px; border-radius: 8px; overflow: hidden; font-size: 12px; }
.aging-bar span { display: flex; align-items: center; justify-content: center; color: #fff; white-space: nowrap; overflow: hidden; }
.aging-bar .ab-corriente { background: #3F7D58; }
.aging-bar .ab-d30 { background: #C99A2E; }
.aging-bar .ab-d60 { background: #D9772B; }
.aging-bar .ab-d90 { background: #C2512F; }
.aging-bar .ab-mas { background: #8E2C2C; }

/* Embudo por etapas */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.kanban-col { flex: 0 0 260px; background: var(--side); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; max-height: 72vh; }
.kanban-col.is-over { outline: 2px dashed var(--muted); outline-offset: -4px; }
.kanban-col.closed { flex-basis: 220px; opacity: .92; }
.kanban-head { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.kanban-head h3 { margin: 0; font-size: 15px; display: flex; justify-content: space-between; gap: 8px; }
.kanban-head small { color: var(--muted); display: block; font-size: 12px; margin-top: 2px; }
.kanban-cards { padding: 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kcard { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 14px; cursor: grab; box-shadow: var(--shadow); }
.kcard:active { cursor: grabbing; }
.kcard a { font-weight: 600; text-decoration: none; color: var(--ink); }
.kcard .kmeta { color: var(--muted); font-size: 12px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.kcard .kamt { font-variant-numeric: tabular-nums; font-weight: 600; }
.kcard select { margin-top: 6px; width: 100%; font-size: 12px; padding: 4px 6px; }
.kcard.dragging { opacity: .5; }
.prob-bar { height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 6px; }
.prob-bar span { display: block; height: 100%; background: var(--c1); }
.funnel-row { display: grid; grid-template-columns: 160px 1fr 70px; gap: 10px; align-items: center; font-size: 14px; }
.funnel-row .fbar { height: 22px; background: var(--c1); border-radius: 6px; min-width: 2px; }

/* Agenda semanal */
.week { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: 8px; overflow-x: auto; }
.week-day { background: var(--side); border: 1px solid var(--line); border-radius: var(--radius); min-height: 220px; display: flex; flex-direction: column; }
.week-day.today { border-color: var(--ink); }
.week-day h3 { margin: 0; padding: 8px 10px; font-size: 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.week-day .evs { padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.ev { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--c1); border-radius: 8px; padding: 6px 8px; font-size: 13px; }
.ev a { font-weight: 600; color: var(--ink); text-decoration: none; }
.ev.cancel { opacity: .55; text-decoration: line-through; }
.ev.clash { border-left-color: var(--crit); }
.ev.done { border-left-color: var(--c2); }
@media (max-width: 760px) { .week { grid-template-columns: 1fr; } .week-day { min-height: 0; } }
/* Conector SAP: tabla de campos del mapeo */
.sapmap input, .sapmap select, .sapmap textarea { width: 100%; min-height: 36px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 14px; color: var(--ink); background: var(--card); }
.sapmap textarea { resize: vertical; min-width: 200px; }
.sapmap input.mono, .sapmap textarea.mono { font-family: var(--mono); font-size: 13px; }
.sapmap td { vertical-align: top; }
.sapmap td:nth-child(2) { width: 20px; padding-top: 14px; }
.sapmap tr.has-error input, .sapmap tr.has-error select { border-color: var(--crit); }
/* Agenda de recursos */
:root { --rv-conf: #DDE7F3; --rv-conf-line: #5B7FA8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --rv-conf: #24324A; --rv-conf-line: #7FA3CF; } }
:root[data-theme="dark"] { --rv-conf: #24324A; --rv-conf-line: #7FA3CF; }
.rv-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.rv-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .rv-layout { grid-template-columns: 1fr; } }
.rv-board { padding-bottom: 6px; }
.rv-scale, .rv-row { display: grid; grid-template-columns: 190px minmax(0, 1fr); }
.rv-scale { position: sticky; top: 0; background: var(--card); z-index: 2; border-bottom: 1px solid var(--line); }
.rv-hours { position: relative; height: 30px; }
.rv-hours span { position: absolute; top: 8px; transform: translateX(-50%); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rv-hours span:first-child { transform: none; padding-left: 4px; }
.rv-row { border-bottom: 1px solid var(--line); min-height: 58px; }
.rv-name { padding: 8px 12px 8px 16px; display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; }
.rv-name a { text-decoration: none; color: var(--ink); }
.rv-track { position: relative; cursor: copy; overflow: hidden; }
.rv-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.rv-off { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, var(--side) 0 6px, transparent 6px 12px); opacity: .9; pointer-events: none; }
.rv-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--crit); z-index: 3; pointer-events: none; }
.rv-b { position: absolute; top: 6px; bottom: 6px; border-radius: 8px; padding: 4px 7px; font-size: 12px; line-height: 1.25; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-decoration: none; color: var(--ink); z-index: 1;
  background: var(--rv-conf); border: 1px solid var(--rv-conf-line); border-left-width: 3px; }
.rv-b small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.rv-b.pend { background: var(--warn-soft); border: 1px dashed var(--warn); border-left: 3px solid var(--warn); }
.rv-b.uso { background: var(--good-soft); border-color: var(--good); }
.rv-b.past { background: var(--side); border-color: var(--line-strong); color: var(--muted); }
.rv-b.none { background: transparent; border: 1px dashed var(--crit); border-left: 3px solid var(--crit); color: var(--crit); }
.rv-b:hover { box-shadow: var(--shadow); z-index: 4; }
.rv-legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 10px 16px 4px; font-size: 12px; }
.rv-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rv-legend .rv-b, .rv-legend .rv-off { position: static; display: inline-block; width: 22px; height: 12px; padding: 0; border-radius: 4px; }
.rv-legend .rv-off { background: repeating-linear-gradient(135deg, var(--line-strong) 0 3px, transparent 3px 6px); }
.rv-track.pick { background: var(--accent-soft); }
.rv-ghost { position: absolute; top: 6px; bottom: 6px; border: 2px solid var(--ink); border-radius: 8px; pointer-events: none; z-index: 5; }
.rv-week td { vertical-align: top; min-width: 110px; }
.rv-week .rv-today { background: var(--accent-soft); }
.rv-chip { display: block; font-size: 12px; padding: 3px 6px; margin: 2px 0; border-radius: 6px; text-decoration: none; color: var(--ink); background: var(--rv-conf); border-left: 3px solid var(--rv-conf-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.rv-chip.pend { background: var(--warn-soft); border-left-color: var(--warn); }
.rv-chip.uso { background: var(--good-soft); border-left-color: var(--good); }
.rv-chip.past { background: var(--side); border-left-color: var(--line-strong); color: var(--muted); }
.rv-chip.none { background: transparent; border-left-color: var(--crit); color: var(--crit); text-decoration: line-through; }
.rv-item { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.rv-item:first-of-type { border-top: 0; }
.rv-form { grid-template-columns: 1fr 1fr; }
.rv-form .row .field { flex: 1; }
@media (max-width: 700px) { .rv-scale, .rv-row { grid-template-columns: 120px minmax(0, 1fr); } .rv-name { padding-left: 10px; } }
.rv-in { min-height: 34px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 14px; background: var(--card); color: var(--ink); min-width: 180px; }
.rv-scroll { overflow-x: auto; }
.rv-layout { grid-template-columns: minmax(0, 1fr) 300px; }
@media (max-width: 1100px) { .rv-layout { grid-template-columns: 1fr; } }
.rv-form .field { min-width: 0; }
.rv-layout.wide { grid-template-columns: 1fr; }
.rv-layout.wide > aside { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.rv-week td { min-width: 0; }
.rv-chip { max-width: 170px; }
.rv-week { table-layout: fixed; width: 100%; }
.rv-week th:first-child { width: 150px; }
.rv-week th:last-child { width: 90px; }
.rv-week .rv-chip { max-width: 100%; }
/* Plan de trabajo: Gantt */
.gt { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.gt-head, .gt-body { display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.gt-head { border-bottom: 1px solid var(--line); background: var(--side); font-size: 12px; color: var(--muted); }
.gt-head .gt-l { padding: 6px 10px; }
.gt-head .gt-r { position: relative; height: 28px; overflow: hidden; }
.gt-head .gt-r span { position: absolute; top: 7px; padding-left: 3px; border-left: 1px solid var(--line-strong); white-space: nowrap; }
.gt-names { border-right: 1px solid var(--line); }
.gt-n { height: 30px; line-height: 30px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; border-bottom: 1px solid var(--line); box-sizing: border-box; }
.gt-n.fase { font-weight: 600; background: var(--side); }
.gt-track { position: relative; height: calc(var(--rows) * 30px); background: repeating-linear-gradient(to bottom, transparent 0 29px, var(--line) 29px 30px); }
.gt-we { position: absolute; top: 0; bottom: 0; background: var(--side); opacity: .7; }
.gt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--crit); z-index: 3; }
.gt-deps { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; overflow: visible; }
.gt-deps path { fill: none; stroke: var(--muted); stroke-width: 1.2; vector-effect: non-scaling-stroke; opacity: .7; }
.gt-deps path.crit { stroke: var(--crit); opacity: .8; }
.gt-bar { position: absolute; height: 18px; border-radius: 5px; background: var(--rv-conf); border: 1px solid var(--rv-conf-line); z-index: 2; overflow: hidden; box-sizing: border-box; }
.gt-bar b { display: block; height: 100%; background: var(--rv-conf-line); opacity: .75; }
.gt-bar.crit { border-color: var(--crit); border-width: 2px; }
.gt-bar.late { background: var(--crit-soft); }
.gt-bar.late b { background: var(--crit); }
.gt-bar.done { background: var(--good-soft); border-color: var(--good); }
.gt-bar.done b { background: var(--good); opacity: .5; }
.gt-bar.fase { height: 10px; background: var(--ink); border: 0; border-radius: 2px; opacity: .8; }
.gt-bar.fase b { background: var(--good); opacity: 1; }
.gt-bar.hito { width: 14px; height: 14px; transform: rotate(45deg); border-radius: 2px; background: var(--ink); border: 0; }
.gt-bar.hito.done { background: var(--good); }
.gt-base { position: absolute; height: 4px; border-radius: 2px; background: var(--muted); opacity: .45; z-index: 1; }
.gt .rv-legend { border-top: 1px solid var(--line); padding: 8px 12px; }
.gt-l1, .gt-l2, .gt-l3 { display: inline-block; width: 22px; height: 10px; border-radius: 3px; background: var(--rv-conf); border: 1px solid var(--rv-conf-line); }
.gt-l1.crit { border: 2px solid var(--crit); }
.gt-l1.late { background: var(--crit-soft); border-color: var(--crit); }
.gt-l2 { height: 4px; background: var(--muted); opacity: .5; border: 0; }
.gt-l3 { width: 2px; height: 12px; background: var(--crit); border: 0; }
.gt-fase-row td { background: var(--side); }
.gt-act { position: relative; }
.gt-act[open] form { position: absolute; right: 0; z-index: 10; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 12px; width: 320px; grid-template-columns: 1fr 1fr; }
.gt-act summary { list-style: none; cursor: pointer; }
.gt-act summary::-webkit-details-marker { display: none; }
@media (max-width: 800px) { .gt-head, .gt-body { grid-template-columns: 150px minmax(0, 1fr); } }
/* Editor del plan */
.pe input, .pe select { width: 100%; min-height: 34px; padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 13px; background: var(--card); color: var(--ink); box-sizing: border-box; }
.pe td { vertical-align: middle; padding: 4px 4px; }
.pe .lvl { display: inline-flex; gap: 2px; }
.pe .lvl button, .pe .mv button { border: 1px solid var(--line); background: var(--card); color: var(--ink-2); border-radius: 6px; width: 24px; height: 26px; cursor: pointer; font-size: 12px; padding: 0; }
.pe tr.fase input[name$="[nombre]"] { font-weight: 600; }
.pe tr.has-error td { background: var(--crit-soft); }
.pe .calc { font-size: 12px; color: var(--muted); white-space: nowrap; }
.pe .calc.crit { color: var(--crit); }
/* Carga de trabajo */
.wl td.h { text-align: center; font-variant-numeric: tabular-nums; font-size: 13px; }
.wl td.h.l0 { color: var(--muted); }
.wl td.h.l1 { background: var(--good-soft); }
.wl td.h.l2 { background: var(--warn-soft); }
.wl td.h.l3 { background: var(--crit-soft); color: var(--crit); font-weight: 700; }
.ts input { width: 64px; min-height: 32px; padding: 4px 6px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 13px; text-align: right; background: var(--card); color: var(--ink); }
.ts td.day { text-align: center; }
.ts td.today, .ts th.today { background: var(--accent-soft); }
.pbar { position: relative; height: 8px; border-radius: 4px; background: var(--side); overflow: visible; margin: 4px 0; }
.pbar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--rv-conf-line); }
.pbar u { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }
.pe { table-layout: fixed; min-width: 1500px; }
.pe .mv, .pe .lvl { white-space: nowrap; }
.pe tr.fase td.nf > * { visibility: hidden; }
/* Planeación de producción */
.pg { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pg-head, .pg-row { display: grid; grid-template-columns: 210px minmax(0, 1fr); }
.pg-head { background: var(--side); border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.pg-head .pg-l { padding: 6px 10px; }
.pg-head .pg-r { position: relative; height: 28px; overflow: hidden; }
.pg-head .pg-r span { position: absolute; top: 7px; padding-left: 3px; border-left: 1px solid var(--line-strong); white-space: nowrap; }
.pg-row { border-bottom: 1px solid var(--line); min-height: 52px; }
.pg-row .pg-l { padding: 8px 10px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line); }
.pg-row .pg-r { position: relative; overflow: hidden; }
.pg-we { position: absolute; top: 0; bottom: 0; background: var(--side); opacity: .8; }
.pg-b { position: absolute; top: 7px; height: 30px; border-radius: 6px; padding: 3px 6px; font-size: 11px; line-height: 1.2; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-decoration: none; color: var(--ink);
  background: var(--good-soft); border: 1px solid var(--good); box-sizing: border-box; z-index: 1; }
.pg-b small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.pg-b.late { background: var(--crit-soft); border-color: var(--crit); }
.pg-b.run { background: var(--rv-conf); border-color: var(--rv-conf-line); }
.pg-b.frz { background: var(--side); border: 1px dashed var(--line-strong); }
.pg-b:hover { z-index: 4; box-shadow: var(--shadow); }
.pg-empty { position: absolute; left: 10px; top: 16px; font-size: 12px; }
.pg-k { display: inline-block; width: 22px; height: 10px; border-radius: 3px; background: var(--good-soft); border: 1px solid var(--good); }
.pg-k.late { background: var(--crit-soft); border-color: var(--crit); }
.pg-k.run { background: var(--rv-conf); border-color: var(--rv-conf-line); }
.pg-k.frz { background: var(--side); border: 1px dashed var(--line-strong); }
.pg .rv-legend { padding: 8px 12px; }
.kcmp td.best { font-weight: 700; color: var(--good); }
.kcmp td.worst { color: var(--crit); }
.pe-cap input, .pe-cap select { width: 100%; min-height: 34px; padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 13px; background: var(--card); color: var(--ink); box-sizing: border-box; }
.opt-res td { vertical-align: middle; }
.opt-res input[type=number] { width: 80px; min-height: 32px; padding: 4px 6px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; background: var(--card); color: var(--ink); }
