:root {
  --bg: #FAF9F5;
  --side: #F3F1EA;
  --card: #FFFFFF;
  --line: #E6E2D6;
  --line-strong: #DDD8CA;
  --ink: #141413;
  --ink-2: #3D3D3A;
  --muted: #5E5D59;
  --accent: #B9552F;
  --accent-ink: #FFFFFF;
  --accent-strong: #8F3F20;
  --accent-soft: #FBEDE6;
  --good: #2F5A40;
  --good-soft: #EEF3EF;
  --warn: #7A4B0C;
  --warn-soft: #FBF1DE;
  --crit: #8F3F20;
  --crit-soft: #FBEDE6;
  --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"]) {
    --bg: #1C1B19; --side: #23221F; --card: #262522; --line: #34322E; --line-strong: #44413B;
    --ink: #F2EFE7; --ink-2: #D9D5CA; --muted: #A9A498; --accent: #D97757; --accent-ink: #1C1B19;
    --accent-strong: #E79A7E; --accent-soft: #3A2A22; --good: #9CC9AC; --good-soft: #233228;
    --warn: #E5BE7A; --warn-soft: #3A3122; --crit: #F0A587; --crit-soft: #3A2A22;
  }
}
* { 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(--accent); }
a:hover { color: var(--accent-strong); }
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 */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 248px; max-width: 100%; background: var(--side); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 28px; border-bottom: 1px solid var(--line); }
.content { width: 100%; max-width: 1080px; margin: 0 auto; padding: 24px 24px 64px; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 860px) { .side { border-right: 0; border-bottom: 1px solid var(--line); } .topbar { padding: 14px 16px; } .content { padding: 18px 16px 48px; } }

.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 */
:root { --c0: #B9552F; --c1: #2F6B8F; --c2: #4E7D4F; --c3: #C08A2D; --c4: #7A4E8C; --c5: #3E8C86; --c6: #A34E6E; --c7: #77736A; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --c0: #D97757; --c1: #6FA6C9; --c2: #8DBB8E; --c3: #E0B25E; --c4: #B38DC4; --c5: #79C2BB; --c6: #D88AA7; --c7: #ABA597; }
}
.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; }
.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; }
