/* Superficie interna de IRT. Los documentos comerciales de cliente no cargan esta hoja. */
:root {
  --ink: #1b2028;
  --sub: #525b66;
  --muted: #626c78;
  --line: #e2dfd9;
  --line-strong: #c9c4bb;
  --rail: #f6f5f2;
  --soft: #faf9f6;
  --canvas: #f4f2ee;
  --surface: #ffffff;
  --brand: #f2762e;
  --blue: #c44b10;
  --blue-deep: #9e3908;
  --tint: #fff1e6;
  --tint-border: #f6c9a9;
  --focus: rgba(242, 118, 46, .28);
  --red: #a62c22;
  --red-bg: #fdeeed;
  --red-line: #f2c0bb;
  --amber: #8a5607;
  --amber-bg: #fef7e0;
  --amber-line: #ecd28a;
  --green: #1d6142;
  --green-bg: #e9f6ef;
  --green-line: #b8dfca;
  --neutral-bg: #f0eeea;
  --neutral-line: #dbd7cf;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 12px;
  --shadow-xs: 0 1px 2px rgba(27, 32, 40, .045);
  --shadow-sm: 0 2px 6px -1px rgba(27, 32, 40, .065), 0 1px 2px rgba(27, 32, 40, .035);
  --shadow-md: 0 12px 28px -8px rgba(27, 32, 40, .11), 0 2px 6px -1px rgba(27, 32, 40, .045);
  --t-fast: 150ms cubic-bezier(.2, .8, .2, 1);
  color: var(--ink);
  background: var(--surface);
  font: 100%/1.5 "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  accent-color: var(--blue);
  scrollbar-color: #cdc7be transparent;
}

body {
  background: var(--surface);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.plain-shell { background: var(--canvas); min-height: 100dvh; }
::selection { background: #ffe0c8; color: var(--ink); }

*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #cfc9c0; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #b4ada2; border: 2px solid transparent; background-clip: content-box; }

a { color: var(--blue); text-underline-offset: .22em; transition: color var(--t-fast); }
a:hover { color: var(--blue-deep); text-decoration: underline; }
:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.skip:focus { color: var(--ink); border: 1px solid var(--ink); border-radius: var(--r-sm); box-shadow: var(--shadow-md); }

.icon { width: 1.125rem; height: 1.125rem; flex: none; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3 { color: var(--ink); text-wrap: balance; }
h1 { font-size: 2.25rem; line-height: 1.14; letter-spacing: -.035em; font-weight: 680; }
h2 { font-size: 1.12rem; line-height: 1.32; letter-spacing: -.018em; font-weight: 650; }
h3 { font-size: .98rem; line-height: 1.35; letter-spacing: -.01em; font-weight: 650; }
small, .help, .muted, .dateline, .ledger-foot { font-size: .855rem; color: var(--sub); }
.help { max-width: 68ch; line-height: 1.5; }
.wrap { width: 100%; max-width: none; margin: 0; }

/* Barra superior fija con identidad IRT */
.mast {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(8px);
  color: var(--ink);
  border: 0;
  border-top: 2px solid var(--brand);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(27, 32, 40, .03);
}
.bar {
  height: 3.75rem;
  min-height: 3.75rem;
  padding: 0 clamp(1.15rem, 2.4vw, 2.5rem);
  gap: 1rem;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
}
.bar nav, .bar nav form { display: flex; align-items: center; margin: 0; }
.bar nav { gap: .45rem; }
.bar a, .bar .quiet { color: var(--sub); }
.identity { gap: .8rem; display: inline-flex; align-items: center; }
.bar .identity, .identity:hover { text-decoration: none; color: var(--ink); }
.brand-logo { display: block; height: 1.85rem; width: auto; object-fit: contain; }
.brand-name {
  border-left: 1px solid var(--line);
  padding-left: .8rem;
  font-size: .88rem;
  font-weight: 560;
  color: var(--sub);
  line-height: 1.25;
}
.bar .home-link, .bar .quiet, .shortcuts a {
  font-size: .855rem;
  gap: .4rem;
  font-weight: 560;
  text-decoration: none;
  padding: .42rem .7rem;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  transition: background var(--t-fast), color var(--t-fast);
}
.bar .quiet { background: transparent; border: 0; box-shadow: none; }
.bar .quiet:hover, .bar .home-link:hover { color: var(--ink); background: var(--rail); text-decoration: none; }
.home-link[aria-current] { color: var(--blue-deep); background: var(--tint); font-weight: 650; text-decoration: none; box-shadow: inset 0 0 0 1px var(--tint-border); }
.bar .user { color: var(--muted); font-weight: 450; }

/* Disparador de búsqueda rápida (Ctrl+K) */
.cmd-trigger {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 36px;
  padding: .34rem .62rem .34rem .72rem;
  background: var(--soft);
  color: var(--sub);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: none;
  font-size: .835rem;
  font-weight: 520;
}
.cmd-trigger[hidden] { display: none; }
.cmd-trigger:hover { background: var(--surface); border-color: var(--line-strong); color: var(--ink); box-shadow: var(--shadow-xs); }
.cmd-trigger .icon { width: .92rem; height: .92rem; color: var(--muted); }
.cmd-trigger kbd {
  font: 600 .7rem/1 "Segoe UI", system-ui, sans-serif;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .18rem .36rem;
  margin-left: .2rem;
}

/* Paleta de navegación rápida (<dialog>) */
.cmd-dialog {
  width: min(34rem, calc(100vw - 1.5rem));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  margin: min(14vh, 6rem) auto auto;
  overflow: hidden;
}
.cmd-dialog::backdrop { background: rgba(27, 32, 40, .38); backdrop-filter: blur(2px); }
.cmd-head { display: flex; align-items: center; gap: .6rem; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
.cmd-head input {
  flex: 1;
  border: 0;
  margin: 0;
  padding: .25rem 0;
  min-height: 34px;
  box-shadow: none;
  background: transparent;
  font-size: .96rem;
}
.cmd-head input:focus { box-shadow: none; border: 0; outline: none; }
.cmd-esc {
  font: 600 .72rem/1 "Segoe UI", system-ui, sans-serif;
  color: var(--muted);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .25rem .42rem;
}
.cmd-list { list-style: none; margin: 0; padding: .45rem; max-height: min(55vh, 22rem); overflow: auto; }
.cmd-list li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .58rem .75rem;
  border-radius: 7px;
  color: var(--ink);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 540;
}
.cmd-list li a small { font-size: .76rem; color: var(--muted); font-weight: 500; }
.cmd-list li a:hover, .cmd-list li a.is-active { background: var(--tint); color: var(--blue-deep); text-decoration: none; }
.cmd-empty { padding: 1.4rem 1rem; text-align: center; color: var(--muted); font-size: .88rem; }
.cmd-foot {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  padding: .55rem 1rem;
  background: var(--soft);
  border-top: 1px solid var(--line);
  font-size: .76rem;
  color: var(--muted);
}

/* Pulso operativo de 4 indicadores en Ficha de obra */
.work-pulse {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .8rem;
  margin: 1rem 0 1.85rem;
}
.pulse-card {
  display: flex;
  flex-direction: column;
  gap: .28rem;
  padding: .95rem 1.05rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  color: var(--ink);
  text-decoration: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.pulse-card:hover { border-color: var(--tint-border); box-shadow: var(--shadow-sm); transform: translateY(-1px); text-decoration: none; color: var(--ink); }
.pulse-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .8rem; font-weight: 560; color: var(--sub); }
.pulse-head .icon { width: .98rem; height: .98rem; color: #8c867d; transition: color var(--t-fast); }
.pulse-card:hover .pulse-head .icon { color: var(--brand); }
.pulse-card strong { font-size: 1.28rem; font-weight: 680; letter-spacing: -.025em; line-height: 1.25; font-variant-numeric: tabular-nums; color: var(--ink); }
.pulse-card strong small { font-size: .78rem; font-weight: 620; color: var(--muted); }
.pulse-card > small { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Equipo y línea de tiempo en Ficha de obra */
.member-list, .activity-list { list-style: none; margin: .45rem 0 1rem; padding: 0; }
.member-list li {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem .45rem;
  border-top: 1px solid var(--line);
}
.member-avatar {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  background: var(--tint);
  border: 1px solid var(--tint-border);
  color: var(--blue-deep);
  font-size: .78rem;
  font-weight: 700;
  flex: none;
}
.member-name { font-size: .9rem; font-weight: 600; flex: 1; min-width: 0; }
.activity-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: .65rem;
  padding: .55rem .45rem;
  border-top: 1px solid var(--line);
  font-size: .86rem;
}
.activity-actor {
  font-size: .76rem;
  font-weight: 650;
  padding: .15rem .5rem;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--ink);
}
.activity-action { color: var(--ink); overflow-wrap: anywhere; }
.activity-time { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Interacción del gráfico de 13 semanas */
.insights-readout {
  font-size: .84rem;
  font-weight: 640;
  color: var(--blue-deep);
  background: var(--tint);
  border: 1px solid var(--tint-border);
  border-radius: 999px;
  padding: .18rem .68rem;
  font-variant-numeric: tabular-nums;
}
.insights-readout[hidden] { display: none; }
.insights-guide { stroke: var(--brand); stroke-width: 1.25; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.insights-active-halo { fill: none; stroke: var(--surface); stroke-width: 13; stroke-linecap: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.insights-active-dot { fill: none; stroke: var(--brand); stroke-width: 8.5; stroke-linecap: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.insights-hit { fill: transparent; cursor: pointer; }

/* Vista previa inline y visor ampliado de facturas */
.invoice-preview { margin: .65rem 0 .85rem; display: grid; gap: .55rem; }
.invoice-preview img {
  display: block;
  width: 100%;
  max-height: 22rem;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: zoom-in;
}
.preview-zoom[hidden] { display: none; }
.lightbox-dialog {
  max-width: min(92vw, 68rem);
  max-height: 92vh;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.lightbox-dialog::backdrop { background: rgba(27, 32, 40, .62); backdrop-filter: blur(3px); }
.lightbox-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.lightbox-head strong { font-size: .92rem; overflow-wrap: anywhere; }
.lightbox-dialog img { display: block; max-width: 100%; max-height: calc(88vh - 4rem); margin: 0 auto; object-fit: contain; border-radius: 6px; }

/* Herramientas de sección, exportación CSV, avance y ayudas rápidas */
.section-tools { display: inline-flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.export-link {
  display: inline-flex;
  align-items: center;
  gap: .36rem;
  padding: .34rem .68rem;
  min-height: 34px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink) !important;
  font-size: .815rem !important;
  font-weight: 580 !important;
  text-decoration: none !important;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.export-link:hover { border-color: var(--brand); background: var(--tint); color: var(--blue-deep) !important; text-decoration: none !important; }
.export-link .icon { width: .9rem; height: .9rem; transform: none !important; }

.print-btn[hidden] { display: none; }
.print-btn { color: var(--sub); font-weight: 580; min-height: 38px; padding: .3rem .6rem; border-radius: var(--r-sm); }
.print-btn:hover { color: var(--blue-deep); background: var(--tint); }
.print-banner { display: none; }

.metric-pct { font-size: .9rem; font-weight: 560; opacity: .88; }
.settlement-bar {
  display: flex;
  align-items: center;
  gap: .85rem;
  margin: -.8rem 0 1.4rem;
  padding: .65rem 1rem;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: .82rem;
  color: var(--sub);
}
.settlement-bar span { white-space: nowrap; font-weight: 620; font-variant-numeric: tabular-nums; color: var(--ink); }

.date-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .32rem;
  margin: -.35rem 0 .65rem;
}
.date-chip {
  min-height: 24px;
  padding: .16rem .5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--sub);
  font-size: .74rem;
  font-weight: 580;
  box-shadow: none;
}
.date-chip:hover { background: var(--tint); border-color: var(--tint-border); color: var(--blue-deep); box-shadow: none; }

.calc-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem 1.25rem;
  padding: .75rem 1rem;
  margin: .35rem 0 .85rem;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: .855rem;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
}
.calc-preview strong { color: var(--ink); font-weight: 660; }
.calc-preview.warn { background: var(--red-bg); border-color: var(--red-line); color: var(--red); }
.calc-preview[hidden] { display: none; }

.record-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .55rem .85rem;
  margin: 0 0 .75rem;
}
.status-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.status-chip {
  min-height: 30px;
  padding: .2rem .62rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--sub);
  font-size: .79rem;
  font-weight: 560;
  box-shadow: none;
}
.status-chip:hover { background: var(--surface); border-color: var(--line-strong); color: var(--ink); box-shadow: none; }
.status-chip[aria-pressed="true"] {
  background: var(--tint);
  border-color: var(--tint-border);
  color: var(--blue-deep);
  font-weight: 660;
  box-shadow: none;
}

/* Seguimiento de expediente y licitación (Cuenta del cliente) */
.pulse-alert { color: var(--red) !important; font-weight: 640; }
.record-money { text-align: right; }
.record-money small { font-size: .76rem; color: var(--muted); }
.docket-inline { margin-top: .18rem; font-weight: 540; }
.docket-radar { margin: 0 0 1.3rem; }
.docket-panel {
  background: linear-gradient(180deg, #fcfbf9 0%, #f7f5f1 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.35rem 1.5rem;
  margin: 1.1rem 0 1.4rem;
  box-shadow: var(--shadow-xs);
}
.docket-panel .sectionline { margin-bottom: 1rem; align-items: flex-start; }
.docket-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .85rem 1.15rem;
  padding: .95rem 1.1rem;
  margin: 0 0 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.docket-meta dt { font-size: .76rem; font-weight: 560; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.docket-meta dd { font-size: .94rem; font-weight: 650; color: var(--ink); margin-top: .2rem; overflow-wrap: anywhere; }
.docket-meta dd small { display: block; font-size: .78rem; font-weight: 480; color: var(--sub); margin-top: .12rem; }
.docket-alert { margin: 0 0 1.1rem; }
.docket-alert h3 { font-size: .95rem; color: #7b241c; margin: 0 0 .2rem; }
.docket-alert p { margin: 0; font-size: .88rem; }

.docket-stepper {
  list-style: none;
  margin: 0 0 1.15rem;
  padding: .85rem .95rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: .45rem;
}
.docket-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .42rem;
  color: var(--muted);
}
.docket-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: .82rem;
  left: calc(50% + 1.1rem);
  right: calc(-50% + .65rem);
  height: 2px;
  background: var(--line);
}
.docket-step.is-done:not(:last-child)::after { background: var(--green); }
.step-dot {
  position: relative;
  z-index: 1;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: .76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--soft);
  border: 1.5px solid var(--line-strong);
  color: var(--muted);
}
.docket-step.is-done .step-dot { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.docket-step.is-done .step-name { color: var(--ink); font-weight: 560; }
.docket-step.is-current .step-dot { background: var(--brand); border-color: var(--blue); color: white; box-shadow: 0 0 0 3px var(--tint); }
.docket-step.is-current .step-name { color: var(--blue-deep); font-weight: 680; }
.docket-step.is-stalled .step-dot { background: var(--red); border-color: #7b241c; color: white; box-shadow: 0 0 0 3px var(--red-bg); }
.docket-step.is-stalled .step-name { color: var(--red); font-weight: 680; }
.step-name { font-size: .75rem; line-height: 1.25; }

.docket-history { margin: 1rem 0 .4rem; }
.docket-history h3 { margin: 0 0 .55rem; font-size: .95rem; }
.docket-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.docket-timeline li { padding: .82rem 1rem; border-top: 1px solid var(--line); }
.docket-timeline li:first-child { border-top: 0; }
.docket-timeline li.is-latest { background: #fffcf8; }
.docket-move-head { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .75rem; }
.docket-move-head strong { font-size: .92rem; color: var(--ink); }
.docket-move-date { margin-left: auto; font-size: .8rem; font-weight: 600; color: var(--sub); font-variant-numeric: tabular-nums; }
.docket-move-note { margin: .38rem 0 .2rem; font-size: .88rem; color: var(--ink); }
.docket-drawer { border-top: 1px solid var(--line); margin-top: .75rem; padding-top: .2rem; }
.docket-drawer > summary { padding: .65rem .4rem; }

/* Fondo de reparo y tablero consolidado de empresa */
.retention-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .8rem 1rem;
  padding: .9rem 1.15rem;
  margin: 0 0 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
}
.retention-strip strong { display: block; font-size: .95rem; font-variant-numeric: tabular-nums; }
.retention-strip small { display: block; margin-top: .12rem; }
.retention-strip form { margin: 0; }
.retention-strip button { min-height: 36px; padding: .35rem .75rem; font-size: .83rem; }
.portal-link { border-color: var(--tint-border); background: var(--tint); color: var(--blue-deep) !important; }
.portal-link:hover { border-color: var(--brand); background: #ffe4cf; }

.company-page { width: min(74rem, calc(100% - 3rem)); margin: 2.25rem auto 4rem; }
.company-currency { margin: 0 0 1.75rem; }
.company-kpis { margin: .5rem 0 0; }
.company-radar-body { min-width: 0; flex: 1; }
.company-alerts { display: flex; flex-wrap: wrap; gap: .35rem; }
.company-alerts a { text-decoration: none; }
.company-alerts a:hover { text-decoration: underline; }
.company-grid { margin-top: 1.5rem; }

/* Control de tres vías (FIN-02B) y botón copiar expediente */
.match-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  margin: 0 0 1.2rem;
  padding: .95rem 1.15rem;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.match-strip small { display: block; font-size: .78rem; color: var(--muted); }
.match-strip strong { display: block; font-size: .96rem; margin-top: .18rem; font-variant-numeric: tabular-nums; }
.copy-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: .1rem .48rem;
  margin-left: .3rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--sub);
  font-size: .72rem;
  font-weight: 600;
  box-shadow: none;
  vertical-align: middle;
}
.copy-chip[hidden] { display: none; }
.copy-chip:hover { border-color: var(--brand); background: var(--tint); color: var(--blue-deep); box-shadow: none; }
.copy-chip.is-copied { border-color: var(--green-line); background: var(--green-bg); color: var(--green); }
.hub-links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 0 0 1.45rem;
}
.hub-links a {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .46rem .85rem;
  min-height: 38px;
  font-size: .855rem;
  font-weight: 580;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.hub-links a:hover {
  border-color: var(--tint-border);
  background: var(--tint);
  color: var(--blue-deep);
}
.hub-links a .icon { width: .92rem; height: .92rem; color: var(--brand); }
.inline-drawer { margin-top: .4rem; }
.inline-drawer > summary { min-height: 34px; font-size: .83rem; padding: .28rem .4rem; }
.inline-form { display: inline-block; margin-left: .35rem; }
.compact-btn { min-height: 34px; padding: .28rem .68rem; font-size: .82rem; }
.daily-card + .daily-card { margin-top: 1rem; }
.photo-strip {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin: .8rem 0;
}
.photo-thumb {
  margin: 0;
  width: 9.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  padding: .35rem;
}
.photo-thumb img {
  display: block;
  width: 100%;
  height: 6.2rem;
  object-fit: cover;
  border-radius: 5px;
}
.photo-thumb figcaption {
  font-size: .74rem;
  color: var(--sub);
  margin-top: .3rem;
  overflow-wrap: anywhere;
}
.dashboard-home { width: min(74rem, calc(100% - 3rem)); }
.ai-dashboard-box { margin: 1.4rem 0 1.6rem; }
.ai-dashboard-box h2 { display: inline-flex; align-items: center; gap: .45rem; margin: 0; font-size: 1.08rem; }
.ai-dashboard-box h2 .icon { color: var(--brand); }
.ai-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .85rem; }
.ai-dash-form { display: flex; gap: .6rem; align-items: stretch; flex-wrap: wrap; }
.ai-dash-form input[type="text"] { flex: 1 1 18rem; margin: 0; }
.ai-dash-form button { flex: none; }
.ai-dash-reply {
  margin-top: .95rem;
  padding: .95rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--tint-border);
  border-radius: var(--r-md);
}
.ai-dash-reply strong { display: block; margin-bottom: .35rem; color: var(--ink); }
.ai-dash-reply p { margin: 0 0 .55rem; white-space: pre-line; color: var(--ink); font-size: .92rem; line-height: 1.5; }
.alloc-chip { display: flex; align-items: center; gap: .25rem; margin-bottom: .25rem; }
.scanner-card h2 { display: inline-flex; align-items: center; gap: .45rem; margin: 0; font-size: 1.1rem; }
.scanner-card h2 .icon { color: var(--brand); }
.camera-drop {
  display: grid;
  gap: .45rem;
  margin: .75rem 0;
}
.camera-drop input[type="file"] { width: 100%; min-height: 52px; padding: .65rem; }
.scan-cta { min-height: 48px; width: 100%; font-size: .98rem; margin-top: .4rem; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1rem; }
.field-work-card { margin: 0; }
.field-work-card .hub-links { margin: .75rem 0 0; }

/* Estructura principal de escritorio */
.desk {
  display: grid;
  grid-template-columns: clamp(15.25rem, 18vw, 17.25rem) minmax(0, 1fr);
  align-items: stretch;
  min-height: calc(100dvh - 3.75rem - 3px);
}
.rail {
  background: var(--rail);
  border-right: 1px solid var(--line);
  padding: 1.15rem clamp(.75rem, 1.3vw, 1.1rem) 2rem;
}
.rail nav { position: sticky; top: 5.2rem; }

/* Selector rápido de obra en la barra lateral */
.rail-project { margin-bottom: 1.1rem; position: relative; }
.rail-project-static, .project-switcher > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .62rem .75rem;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-xs);
  min-height: 0;
}
.project-switcher > summary::before { display: none; }
.project-switcher > summary::after {
  content: "";
  width: .42rem;
  height: .42rem;
  border-right: 1.8px solid var(--sub);
  border-bottom: 1.8px solid var(--sub);
  transform: rotate(45deg);
  flex: none;
  margin-top: -.15rem;
  transition: transform var(--t-fast);
}
.project-switcher[open] > summary::after { transform: rotate(-135deg); margin-top: .15rem; }
.project-switcher > summary:hover { border-color: var(--tint-border); background: var(--surface); }
.rail-project-meta, .rail-project-static { flex-direction: column; align-items: flex-start; gap: .08rem; min-width: 0; }
.rail-project-meta { display: flex; }
.rail-project-meta strong, .rail-project-static strong {
  font-size: .88rem;
  font-weight: 660;
  color: var(--ink);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.rail-project-meta small, .rail-project-static small { font-size: .75rem; color: var(--muted); font-weight: 500; }
.switcher-menu {
  position: absolute;
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 19.5rem;
  top: calc(100% + .35rem);
  z-index: 25;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .35rem;
  box-shadow: var(--shadow-md);
  max-height: 18rem;
  overflow: auto;
}
.switcher-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  padding: .46rem .65rem;
  min-height: 36px;
  border-radius: 5px;
  font-size: .84rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}
.switcher-menu a:hover { background: var(--soft); color: var(--blue-deep); text-decoration: none; }
.switcher-menu a[aria-current] { background: var(--tint); color: var(--blue-deep); font-weight: 650; }
.switcher-menu a span { overflow: hidden; text-overflow: ellipsis; }
.switcher-menu a small { font-size: .73rem; color: var(--muted); flex: none; }

.rail section + section, .mobile-nav nav section + section { margin-top: 1.25rem; }
.rail h2, .mobile-nav nav h2 {
  font-size: .69rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: .075em;
  margin: 0 0 .35rem;
  padding-left: .65rem;
}
.rail nav a, .mobile-nav nav a {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-height: 36px;
  padding: .4rem .62rem;
  border-radius: var(--r-sm);
  color: var(--sub);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  line-height: 1.25;
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.rail nav a + a, .mobile-nav nav a + a { margin-top: 2px; }
.rail nav a .nav-label, .mobile-nav nav a .nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rail nav a .icon, .mobile-nav nav a .icon { width: 1.05rem; height: 1.05rem; color: #717b88; transition: color var(--t-fast); }
.rail nav a:hover, .mobile-nav nav a:hover { background: #ebe8e3; color: var(--ink); text-decoration: none; }
.rail nav a:hover .icon, .mobile-nav nav a:hover .icon { color: var(--ink); }
.rail nav a[aria-current], .mobile-nav nav a[aria-current] {
  background: var(--tint);
  color: var(--blue-deep);
  font-weight: 660;
  box-shadow: inset 0 0 0 1px var(--tint-border);
}
.rail nav a[aria-current] .icon, .mobile-nav nav a[aria-current] .icon { color: var(--brand); stroke-width: 2; }

.nav-count {
  font-size: .72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  padding: .2rem .44rem;
  border-radius: 999px;
  background: #e7e4de;
  color: var(--ink);
  flex: none;
}
.nav-count.alert { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-line); }
a[aria-current] .nav-count:not(.alert) { background: rgba(242, 118, 46, .18); color: var(--blue-deep); }

.desk-main {
  width: 100%;
  max-width: 78rem;
  min-width: 0;
  margin: 0 auto;
  padding: .5rem clamp(1.5rem, 3.8vw, 4rem) 3.75rem;
}
.trail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.1rem;
  margin-bottom: 1.15rem;
}
.trail > nav {
  display: flex;
  gap: .4rem;
  align-items: center;
  font-size: .82rem;
  color: var(--muted);
  min-width: 0;
}
.trail > nav a { color: var(--sub); text-decoration: none; overflow-wrap: anywhere; font-weight: 500; }
.trail > nav a:hover { color: var(--blue); text-decoration: underline; }
.trail > nav .icon { width: .75rem; height: .75rem; color: #9a948b; }
.mobile-nav { display: none; }

/* Encabezados y acciones */
.page-title, .sectionline, .record, .dispatch-review li, .completion {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.page-title, .hero, .desk-heading { padding: 0 0 1.45rem; }
.desk-heading:has(> .invoice-state) { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.page-title p, .hero > p:not(.eyebrow), .desk-heading p, .login > p { margin: .42rem 0 0; color: var(--sub); max-width: 68ch; }
.page-title p span { margin: 0 .22rem; color: #a7a198; }
.hero h1 { margin: 0; }
.hero .eyebrow { display: none; }

/* Botones y enlaces de acción */
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .48rem;
  min-height: 42px;
  background: var(--blue);
  color: white;
  border: 1px solid rgba(158, 57, 8, .25);
  border-radius: var(--r-sm);
  padding: .52rem 1rem;
  font-family: inherit;
  font-size: .895rem;
  line-height: 1.35;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(158, 57, 8, .22), inset 0 1px 0 rgba(255, 255, 255, .15);
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform 100ms ease;
}
button:hover, .button:hover {
  background: var(--blue-deep);
  color: white;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(158, 57, 8, .28);
}
button:active:not(:disabled), .button:active { transform: translateY(1px); }
.page-title > .button { flex: none; }
button:disabled, input:disabled, select:disabled { opacity: .6; cursor: not-allowed; }

button.secondary, .button.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-xs);
}
button.secondary:hover, .button.secondary:hover {
  background: var(--soft);
  border-color: var(--brand);
  color: var(--blue-deep);
  box-shadow: var(--shadow-xs);
}
.danger, button.danger, .button.danger {
  background: var(--red);
  border-color: rgba(130, 32, 24, .28);
  box-shadow: 0 1px 2px rgba(166, 44, 34, .22);
}
.danger:hover, button.danger:hover, .button.danger:hover {
  background: #872219;
  box-shadow: 0 2px 6px rgba(135, 34, 25, .28);
}

.action-link, .sectionline a, .text-action, .row-action {
  display: inline-flex;
  align-items: center;
  gap: .38rem;
  color: var(--blue);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 600;
  transition: color var(--t-fast), background var(--t-fast);
}
.action-link:hover, .sectionline a:hover, .text-action:hover, .row-action:hover {
  color: var(--blue-deep);
  text-decoration: underline;
}
.action-link .icon, .row-action .icon, .sectionline a .icon {
  width: .95rem;
  height: .95rem;
  transition: transform var(--t-fast);
}
.action-link:hover .icon, .row-action:hover .icon, .sectionline a:hover .icon {
  transform: translateX(2px);
}
.row-action.back { margin-bottom: .65rem; font-size: .84rem; color: var(--sub); font-weight: 560; }
.row-action.back:hover { color: var(--blue); }
.row-action.back:hover .icon { transform: translateX(-2px); }

/* Controles de formulario */
input, select, textarea {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: .56rem .72rem;
  min-width: 0;
  min-height: 42px;
  caret-color: var(--brand);
  margin: .3rem 0 .7rem;
  box-shadow: inset 0 1px 2px rgba(27, 32, 40, .03);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) {
  border-color: #a9a296;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--focus);
  outline: none;
}
input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  min-height: initial;
  margin: 0;
  padding: 0;
  box-shadow: none;
  cursor: pointer;
}
input[type="file"] {
  padding: .42rem .6rem;
  border: 1.5px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--sub);
  font-size: .88rem;
  cursor: pointer;
  box-shadow: none;
}
input[type="file"]:hover, input[type="file"].is-dragging {
  border-color: var(--brand);
  background: #fffaf6;
}
input[type="file"]::file-selector-button {
  font: inherit;
  font-weight: 600;
  font-size: .84rem;
  color: var(--blue-deep);
  background: var(--tint);
  border: 1px solid var(--tint-border);
  border-radius: 5px;
  padding: .38rem .78rem;
  margin-inline-end: .8rem;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
input[type="file"]::file-selector-button:hover {
  background: #ffe4cf;
  border-color: var(--brand);
}
.file-picked {
  font-size: .8rem;
  color: var(--green);
  font-weight: 560;
  margin-top: .35rem;
}
input[aria-invalid="true"] { border-color: var(--red); background: #fffafa; }
input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(166, 44, 34, .2); }
label { font-weight: 560; font-size: .89rem; color: var(--ink); line-height: 1.35; }
input::placeholder, textarea::placeholder { color: #727b86; }

form { max-width: 100%; }
fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .85rem 1.05rem;
  background: var(--soft);
  margin: .75rem 0;
}
fieldset legend { padding: 0 .45rem; font-weight: 620; font-size: .86rem; color: var(--ink); }
.formgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  align-items: end;
  gap: .35rem 1rem;
  margin: .85rem 0;
}
.formgrid:has(.date-chips) { align-items: start; }
.sectionline { margin: 0 0 .8rem; flex-wrap: wrap; }
.sectionline h2 { margin: 0; }
.sectionline .muted { font-size: .83rem; }

/* Buscador en vivo progresivo para listados largos */
.live-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin: 0 0 .7rem;
  flex-wrap: wrap;
}
.live-filter {
  width: min(20rem, 100%);
  min-height: 36px;
  padding: .38rem .7rem;
  margin: 0;
  font-size: .855rem;
  border-radius: 7px;
}
.live-filter-status { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.char-counter { font-size: .78rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; margin-top: -.25rem; }
.char-counter.near { color: var(--amber); font-weight: 600; }

/* Tarjeta principal de contrato */
.contract {
  background: linear-gradient(180deg, #fcfbf9 0%, #f6f4f0 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.4rem 1.65rem 1.3rem;
  box-shadow: var(--shadow-xs);
}
.contract-values, .balance-strip, .metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 1.1rem 0;
}
.contract-values > div + div,
.balance-strip > div + div,
.metrics > div + div {
  border-left: 1px solid var(--line);
  padding-left: clamp(.85rem, 2vw, 1.85rem);
}
.contract-values > div,
.balance-strip > div,
.metrics > div {
  padding-right: clamp(.6rem, 1.4vw, 1.2rem);
}
.contract-values dt, .balance-strip dt, .dispatch-route dt, .metrics small {
  font-size: .82rem;
  font-weight: 520;
  color: var(--sub);
}
.contract-values dd, .balance-strip dd, .metrics strong {
  font-size: 1.62rem;
  padding-top: .2rem;
  font-weight: 660;
  letter-spacing: -.028em;
  line-height: 1.25;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.contract-values dd small, .balance-strip dd small {
  font-size: .84rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .01em;
}
.completion { font-size: .8rem; color: var(--sub); gap: .85rem; margin-top: .25rem; }
.completion span { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 560; }
progress {
  width: 100%;
  height: 7px;
  border: 0;
  border-radius: 999px;
  background: #e5e1da;
  color: var(--brand);
  appearance: none;
  overflow: hidden;
}
progress::-webkit-progress-bar { border-radius: 999px; background: #e5e1da; }
progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, var(--blue) 0%, var(--brand) 100%); transition: width 240ms ease; }
progress::-moz-progress-bar { border-radius: 999px; background: linear-gradient(90deg, var(--blue) 0%, var(--brand) 100%); }

/* Franjas de métricas unificadas */
.balance-strip, .metrics {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  padding: 1.05rem 1.35rem;
  margin: .35rem 0 1.45rem;
  box-shadow: var(--shadow-xs);
}
.metrics > div { border: 0; border-radius: 0; margin: 0; padding: .1rem 1rem .1rem 0; background: transparent; }
.metrics > div + div { border-left: 1px solid var(--line); padding-left: clamp(.85rem, 2vw, 1.6rem); }

/* Vencimientos en ficha de obra */
.due-preview { margin: 1.85rem 0 2.1rem; }
.due-row {
  display: grid;
  grid-template-columns: 3.1rem minmax(0, 1fr) auto 1.1rem;
  align-items: center;
  gap: .9rem;
  padding: .72rem .65rem;
  margin-inline: -.65rem;
  border-top: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  transition: background var(--t-fast);
}
.due-row:hover { background: var(--soft); text-decoration: none; }
.due-row:hover .due-name strong { color: var(--blue-deep); }
.due-row:hover > .icon { color: var(--brand); transform: translateX(2px); }
.date-cell {
  text-align: center;
  line-height: 1.05;
  display: grid;
  gap: .18rem;
  width: 3rem;
  padding: .38rem .2rem;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
}
.date-cell b { font-size: 1.08rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.date-cell span { font-size: .68rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.due-name strong, .due-money b, .dispatch-review b { font-size: .95rem; font-weight: 620; }
.due-name small, .due-money small, .dispatch-review small, .record small { display: block; font-size: .815rem; color: var(--sub); }
.due-money { text-align: right; font-variant-numeric: tabular-nums; }
.due-row > .icon { width: .9rem; color: #9a948b; transition: color var(--t-fast), transform var(--t-fast); }

.state.overdue, .field-error { color: var(--red); font-weight: 600; }
.state.today { color: var(--amber); font-weight: 600; }
.state.ok { color: var(--green); font-weight: 600; }
.state.future { color: var(--sub); }

/* Paneles, registros y estados unificados */
.work-registers {
  display: grid;
  grid-template-columns: 1.22fr 1fr;
  gap: 2.25rem;
  margin-bottom: 1.35rem;
  scroll-margin: 5rem;
}
.panel, .ledger, .portfolio, .movement-sheet {
  padding: 1.35rem 0;
  margin: 1rem 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  border-top: 1px solid var(--line);
}
.work-registers .panel { margin: 0; padding: 1rem 0; }
.panel h2, .movement-sheet h2, .ledger > h2 { margin: 0 0 .85rem; }
.panel h3 { margin: .95rem 0 .4rem; }
.panel p { margin: .45rem 0 .8rem; }

.record, .dispatch-review li {
  padding: .76rem .65rem;
  margin-inline: -.65rem;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 8px;
  gap: 1rem;
  flex-wrap: wrap;
  transition: background var(--t-fast);
}
.record:hover { background: var(--soft); }
.record > div:last-child { display: inline-flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.record a, .record strong { font-size: .94rem; }
.record a, .ledger-table tbody a, .project-row a:not(.action-link) {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.record a:hover, .ledger-table tbody a:hover, .project-row a:hover {
  text-decoration: underline;
  color: var(--blue);
}
.record > div:last-child strong, .amount-list dd, .dispatch-review b { font-variant-numeric: tabular-nums; }

/* Insignias de estado consistentes */
.pill, .status-mark, .invoice-state {
  display: inline-flex;
  align-items: center;
  gap: .36rem;
  padding: .22rem .62rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 640;
  line-height: 1.25;
  white-space: nowrap;
  background: var(--neutral-bg);
  color: var(--sub);
  border: 1px solid var(--neutral-line);
}
.pill::before, .status-mark::before, .invoice-state::before {
  content: "";
  height: .42rem;
  width: .42rem;
  border-radius: 100%;
  background: currentColor;
  flex: none;
}
.pill.green, .status-mark.confirmed, .invoice-state.reviewed, .invoice-state.registered {
  background: var(--green-bg);
  border-color: var(--green-line);
  color: var(--green);
}
.pill.amber, .status-mark.draft, .invoice-state.draft {
  background: var(--amber-bg);
  border-color: var(--amber-line);
  color: var(--amber);
}
.pill.overdue, .pill.red, .status-mark.void {
  background: var(--red-bg);
  border-color: var(--red-line);
  color: var(--red);
}
.invoice-state.discarded {
  background: var(--neutral-bg);
  border-color: var(--neutral-line);
  color: var(--sub);
}
.record .pill { margin-right: 0; }

/* Paneles desplegables con chevron animado */
details.panel { margin: 0; padding: 0; border: 0; border-top: 1px solid var(--line); }
summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  color: var(--ink);
  font-size: .94rem;
  font-weight: 620;
  padding: .62rem .5rem;
  margin-inline: -.5rem;
  border-radius: var(--r-sm);
  transition: background var(--t-fast), color var(--t-fast);
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  width: .45rem;
  height: .45rem;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: rotate(-45deg);
  flex: none;
  margin-left: .15rem;
  opacity: .68;
  transition: transform var(--t-fast), opacity var(--t-fast);
}
details[open] > summary::before { transform: rotate(45deg); opacity: 1; }
summary:hover { color: var(--blue-deep); background: var(--soft); }
details.panel > summary { padding: .85rem .5rem; }
details > form { margin: .65rem 0 1.25rem; }
.mobile-nav summary::before { display: none; }

.amount-list > div {
  display: flex;
  justify-content: space-between;
  gap: .6rem;
  border-top: 1px solid var(--line);
  padding: .48rem .4rem;
}
.amount-list > div:hover { background: var(--soft); border-radius: 4px; }
.amount-list dd { white-space: nowrap; font-weight: 600; }
dd { font-variant-numeric: tabular-nums; }

.ledger-foot { padding: .8rem 0; color: var(--sub); border-top: 1px solid var(--line); margin: 0; }
.empty, .empty-note {
  background: var(--soft);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  padding: 1.2rem 1.35rem;
  margin: .75rem 0;
  color: var(--sub);
}
.empty-note strong { display: block; color: var(--ink); margin-bottom: .25rem; }
.empty-note p { margin: 0; }

/* Tablas con marco limpio y cabecera pegajosa */
.table-wrap {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: 65vh;
  overscroll-behavior-inline: contain;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.ledger-table th, .ledger-table td, .table-wrap th, .table-wrap td {
  border-bottom: 1px solid var(--line);
  padding: .7rem .9rem;
}
.ledger-table thead, .table-wrap thead { background: var(--soft); }
.table-wrap caption {
  color: var(--sub);
  font-size: .82rem;
  padding: .65rem .9rem;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}
.table-wrap thead th {
  color: var(--sub);
  font-size: .76rem;
  font-weight: 680;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--line);
}
.table-wrap tbody tr { transition: background var(--t-fast); }
.table-wrap tbody tr:hover td,
.table-wrap tbody tr:hover th[scope="row"] { background: #fbf9f6; }
.ledger-table .number { text-align: right; font-variant-numeric: tabular-nums; }
.ledger-table th small, .ledger-table td small { display: block; font-weight: 450; color: var(--sub); margin-top: .12rem; }
.ledger-table tbody tr:last-child > *, .table-wrap tbody tr:last-child > * { border-bottom: 0; }

/* Barra de filtros estilo control segmentado */
.filter-bar {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin: .2rem 0 1.35rem;
  padding: .25rem;
  background: var(--rail);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.filter-bar a {
  color: var(--sub);
  text-decoration: none;
  font-size: .865rem;
  font-weight: 560;
  padding: .44rem .85rem;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.filter-bar a:hover { color: var(--ink); background: rgba(255, 255, 255, .7); text-decoration: none; }
.filter-bar a[aria-current] {
  background: var(--surface);
  color: var(--blue-deep);
  font-weight: 680;
  box-shadow: var(--shadow-xs);
}

/* Mínimos y alertas */
.stock-summary {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  margin: .6rem 0 1.35rem;
  padding: 1rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
}
.stock-summary > strong {
  font-size: 2rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.stock-summary small { display: block; }
.stock-list, .compact-only { display: none; }
.actions { margin: .5rem 0; }

/* Avisos y alertas */
.notice, .dispatch-error {
  border: 1px solid var(--amber-line);
  border-left-width: 1px;
  background: var(--amber-bg);
  color: #5e3d0a;
  padding: .82rem 1.05rem;
  border-radius: 8px;
  margin: .75rem 0 1rem;
  font-size: .92rem;
  line-height: 1.48;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}
.notice a { color: #5e3d0a; font-weight: 650; text-decoration: underline; }
.notice-close {
  background: transparent;
  color: inherit;
  border: 0;
  box-shadow: none;
  min-height: 26px;
  padding: .1rem .4rem;
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 4px;
  opacity: .72;
  flex: none;
}
.notice-close:hover { background: rgba(94, 61, 10, .1); color: inherit; opacity: 1; box-shadow: none; }
.dispatch-error {
  justify-content: flex-start;
  background: var(--red-bg);
  border-color: var(--red-line);
  color: #6b221a;
  margin: 0 0 1.4rem;
}
.dispatch-error > .icon { margin-top: .15rem; color: var(--red); }
.dispatch-error h2 { font-size: 1rem; color: #7b241c; margin: 0; }
.dispatch-error p { font-size: .91rem; margin: .25rem 0; }
.dispatch-error a { color: #7b241c; font-weight: 650; }

/* Remitos */
.dispatch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(15rem, 1fr);
  align-items: start;
  gap: 1.25rem 2.1rem;
}
.movement-sheet { margin: 0; padding: .9rem 0; grid-column: 1; }
.dispatch-layout .decision, .dispatch-layout .edit-panel { grid-column: 2; }
.dispatch-layout .edit-panel:not([open]) { grid-column: 1 / -1; }
.decision {
  padding: 1.15rem 1.25rem;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
}
.decision p { color: var(--sub); font-size: .9rem; margin: .45rem 0 1rem; }
.dispatch-route { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem 1.4rem; padding: .5rem 0 1.2rem; }
.dispatch-route dd { font-weight: 620; }
.route-arrow { color: var(--muted); }
.list-head { margin: .25rem 0 .4rem; }
.dispatch-review { list-style: none; margin: 0; padding: 0; }
.dispatch-review strong { display: block; }
.dispatch-review li { flex-wrap: nowrap; }
.dispatch-layout > .edit-panel[open] {
  background: var(--soft);
  padding: .2rem 1.15rem .5rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.dispatch-layout > .edit-panel > summary { padding: .85rem .4rem; }
.dispatch-row { border: 0; border-top: 1px solid var(--line); margin: .6rem 0; padding: .45rem 0; min-inline-size: 0; background: transparent; border-radius: 0; }
.dispatch-row legend { padding: 0 .55rem 0 0; color: var(--sub); font-weight: 620; font-size: .82rem; }
.line-controls { display: grid; grid-template-columns: minmax(0, 2fr) minmax(5rem, 1fr) auto; gap: .8rem; align-items: end; }
.edit-panel .line-controls { grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .6rem; }
.edit-panel .line-controls > label:first-child { grid-column: 1 / -1; }
.text-action { padding: .2rem .55rem; background: transparent; border: 0; box-shadow: none; min-height: 40px; }
.text-action:hover { background: var(--tint); color: var(--blue-deep); box-shadow: none; text-decoration: none; }
[data-editor] [hidden] { display: none; }
[data-editor] { margin: .7rem 0 1rem; }
.field-error { font-size: .85rem; }
.formgrid > *, .line-controls > *, .dispatch-review li > div { min-width: 0; }

/* Pantalla de inicio (Mis obras) y Login */
.home { width: min(62rem, calc(100% - 3rem)); margin: 2.5rem auto 4rem; }
.portfolio { padding: 0; margin: .25rem 0 1.75rem; border-top: 0; }
.project-row {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr) auto;
  gap: .35rem 1.15rem;
  align-items: center;
  padding: 1.25rem 1.4rem;
  margin-bottom: .85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.project-row:hover {
  border-color: var(--tint-border);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.project-symbol {
  display: grid;
  place-items: center;
  width: 3.2rem;
  height: 3.2rem;
  background: var(--tint);
  border: 1px solid var(--tint-border);
  border-radius: 10px;
}
.project-symbol img { display: block; width: 1.85rem; height: 1.85rem; object-fit: contain; }
.project-row h2 { font-size: 1.22rem; margin: .15rem 0; font-weight: 660; }
.project-row p { color: var(--sub); font-size: .89rem; }
.project-stats {
  grid-column: 2 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .45rem;
}
.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .79rem;
  font-weight: 560;
  color: var(--sub);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .22rem .58rem;
  font-variant-numeric: tabular-nums;
}
.stat-chip b { color: var(--ink); font-weight: 680; }
.stat-chip.warn { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }
.stat-chip.alert { background: var(--red-bg); border-color: var(--red-line); color: var(--red); }

.shortcuts {
  grid-column: 2 / -1;
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
  margin-top: .5rem;
  padding-top: .55rem;
  border-top: 1px solid var(--line);
}
.shortcuts a {
  color: var(--sub) !important;
  font-weight: 540 !important;
  font-size: .81rem;
  padding: .26rem .62rem;
  min-height: 32px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.shortcuts a:hover {
  color: var(--blue-deep) !important;
  background: var(--tint);
  border-color: var(--tint-border);
  text-decoration: none;
}
.shortcuts a .icon { width: .88rem; height: .88rem; }

.home details.panel.config {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: .25rem 1.35rem;
  box-shadow: var(--shadow-xs);
}
.home details.panel.config > summary { margin-inline: 0; padding-inline: 0; }
.home details.panel.config > summary:hover { background: transparent; }

.login {
  width: min(26rem, calc(100% - 2rem));
  margin: clamp(3rem, 10vh, 6rem) auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 2.15rem 2rem 2rem;
  box-shadow: var(--shadow-md);
}
.login-brand { margin-bottom: 1.35rem; }
.login-brand img { display: block; height: 2.5rem; width: auto; }
.login h1 { font-size: 1.75rem; }
.login form { margin: 1.4rem 0 0; }
.login input { margin-bottom: 1.05rem; }
.login button { width: 100%; justify-content: space-between; min-height: 44px; padding-inline: 1.15rem; }
.login button:hover .icon { transform: translateX(2px); transition: transform var(--t-fast); }

.error-card {
  width: min(36rem, calc(100% - 2rem));
  margin: 4rem auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.dateline { display: block; margin-top: .4rem; }
a, button, input, summary { scroll-margin: 5rem; }

/* Cronograma */
.schedule-calendar {
  padding: 1.35rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  margin-bottom: 1.4rem;
}
.schedule-calendar h2 { margin: 0; }
.schedule-month, .schedule-legend, .schedule-legend span { display: flex; align-items: center; flex-wrap: wrap; gap: .85rem; }
.schedule-month a { font-size: .855rem; padding: .35rem .65rem; border-radius: var(--r-sm); background: var(--soft); border: 1px solid var(--line); text-decoration: none; }
.schedule-month a:hover { background: var(--tint); border-color: var(--tint-border); color: var(--blue-deep); text-decoration: none; }
.schedule-legend { margin: 1.15rem 0 .45rem; color: var(--muted); font-size: .84rem; }
.schedule-legend span { gap: .4rem; }
.schedule-legend i { display: inline-block; width: 1.25rem; height: .45rem; background: var(--brand); border-radius: 3px; }
.schedule-legend i.real { height: .3rem; background: var(--green); }
.schedule-row {
  display: grid;
  grid-template-columns: minmax(7rem, 32%) minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--line);
}
.schedule-row strong { overflow-wrap: anywhere; }
.schedule-row small { display: block; color: var(--sub); }
.schedule-row svg { width: 100%; height: 26px; background: var(--rail); border-radius: 4px; }
.sched-tick { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.sched-plan { fill: var(--brand); }
.sched-real { fill: var(--green); }
.schedule-scale { border: 0; padding: .2rem 0; color: var(--sub); font-size: .78rem; }
.schedule-scale div { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.schedule-form { max-width: 48rem; display: grid; gap: 1rem; }
.schedule-form fieldset { margin: 0; padding: .85rem 1.05rem 1rem; border: 1px solid var(--line); }
.schedule-form button { justify-self: start; }
.schedule-form .formgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.schedule-list { min-width: 38rem; }

.ledger-table td small.treasury-mobile-state { display: none; }

/* Proyección de caja */
.forecast-currencies a { flex: 0 0 auto; min-width: 4rem; text-align: center; }
.forecast-checks {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin: 1rem 0 1.5rem;
  padding: 1rem 1.2rem;
}
.forecast-checks ul { margin: .55rem 0 0; padding-inline-start: 1.2rem; }
.forecast-checks li + li { margin-top: .4rem; }
.forecast-checks details { margin-top: .25rem; }
.forecast-checks summary { font-size: .875rem; min-height: 36px; }
.forecast-summary th[scope="row"] { min-inline-size: 7.6rem; }
.forecast-summary .forecast-selected th,
.forecast-summary .forecast-selected td { background: var(--tint); }
.forecast-summary a[aria-current] { font-weight: 700; color: var(--blue-deep); }
.forecast-flow td small { display: block; }
.forecast-flow th small { font-weight: 450; }

/* Indicadores por obra */
.insights-heading { display: flex; align-items: end; justify-content: space-between; gap: 1.25rem; flex-wrap: wrap; }
.insights-heading .filter-bar { margin: 0; }
.insights-heading .dateline { display: block; margin-top: .45rem; }
.insights-cash {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #fcfbf9 0%, #f6f4f0 100%);
  padding: 1.35rem 1.55rem;
  box-shadow: var(--shadow-xs);
}
.insights-cash > .sectionline { margin-bottom: .85rem; }
.insights-kpis { margin: 0 0 1.15rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.insights-figure {
  margin: 0;
  padding: 1.05rem 1.15rem .9rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.insights-figure figcaption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem 1rem;
  flex-wrap: wrap;
  font-size: .92rem;
}
.insights-figure .help { margin-top: .6rem; }
.insights-negative { color: var(--red); font-weight: 650; }
.insights-plot { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .75rem; margin: .75rem 0 0; }
.insights-axis-y {
  font-size: .74rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  text-align: right;
  padding-block: .45rem 2rem;
  font-variant-numeric: tabular-nums;
}
.insights-line-chart { display: block; width: 100%; height: 8.8rem; overflow: visible; }
.insights-axis-x {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: .25rem;
  font-size: .76rem;
  color: var(--muted);
  margin: .25rem 0 .2rem;
}
.insights-axis-x span:nth-child(2) { position: absolute; inset-inline-start: calc(100% * 7 / 13); transform: translateX(-50%); }
.insights-plot-grid { stroke: #eae6df; stroke-width: 1; vector-effect: non-scaling-stroke; }
.insights-zero-line { stroke: #9f988d; stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.insights-area { fill: url(#insights-area-grad); }
.insights-trend {
  fill: none;
  stroke: var(--brand);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.insights-dot, .insights-marker {
  fill: none;
  stroke: var(--blue);
  stroke-width: 7;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.insights-marker-halo {
  fill: none;
  stroke: var(--surface);
  stroke-width: 11;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.insights-cash details { border-top: 1px solid var(--line); padding: .5rem 0 0; margin-top: .65rem; font-size: .875rem; }
.insights-cash details summary { min-height: 36px; color: var(--blue-deep); font-size: .88rem; }
.insights-notes ul { color: var(--sub); padding-inline-start: 1.2rem; margin: .35rem 0 .65rem; }
.insights-notes li + li { margin-top: .32rem; }
.insights-table { margin: .5rem 0 .25rem; background: var(--surface); }
.insights-table th[scope="row"] { min-inline-size: 7rem; }
.insights-operations, .insights-contract { margin-top: 1.65rem; }
.insights-documents { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.15rem; margin-bottom: .75rem; }
.insights-document {
  min-inline-size: 0;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
}
.insights-document .sectionline { gap: .5rem; margin-bottom: .5rem; }
.insights-composition { display: block; width: 100%; height: 9px; margin: .65rem 0 .85rem; border-radius: 999px; overflow: hidden; }
.insights-track { fill: #eae6df; }
.insights-settled { fill: var(--brand); }
.insights-breakdown { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.insights-breakdown dt { font-size: .78rem; color: var(--sub); }
.insights-breakdown dd { font-variant-numeric: tabular-nums; font-weight: 660; font-size: .96rem; overflow-wrap: anywhere; margin-top: .12rem; }

.work-title-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: .6rem 1.1rem; }
.work-title-actions .action-link { min-height: 42px; }

/* Asistente de obra */
.assistant-workspace { max-inline-size: 50rem; display: grid; gap: 1.6rem; }
.assistant-workspace p { margin-block: .35rem .75rem; }
.assistant-answer {
  border: 1px solid var(--tint-border);
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: clamp(1.1rem, 3vw, 1.55rem);
  box-shadow: var(--shadow-sm);
  scroll-margin-block-start: 5rem;
}
.assistant-answer h2, .assistant-examples h2 { margin: 0 0 .5rem; }
.assistant-amounts { margin-block: .85rem 1.05rem; }
.assistant-amounts > div {
  display: flex;
  gap: .5rem 1rem;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  border-block-end: 1px solid var(--line);
  padding-block: .52rem;
}
.assistant-amounts dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 660; margin-inline-start: auto; }
.assistant-composer {
  display: grid;
  gap: .5rem;
  margin: 0;
  padding: 1.35rem 1.45rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.assistant-composer > label { font-weight: 650; font-size: .95rem; }
.assistant-composer #question-hint { margin: 0; }
.assistant-composer textarea {
  padding: .75rem .9rem;
  inline-size: 100%;
  min-block-size: 5.5rem;
  resize: vertical;
  margin: .3rem 0 .45rem;
  font: inherit;
  font-size: max(1rem, 1em);
}
.assistant-remote { border-block-start: 1px solid var(--line); margin-block-start: .7rem; padding-block-start: .5rem; }
.assistant-remote summary { font-weight: 600; font-size: .9rem; }
.assistant-consent {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .65rem .85rem;
  margin: .6rem 0 .85rem;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
}
.assistant-consent > input { width: 1.15rem; flex: none; }
.assistant-consent > label { margin: 0; cursor: pointer; font-weight: 540; }
.assistant-examples ul {
  list-style: none;
  padding: 0;
  margin: .5rem 0 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.assistant-examples li + li { border-block-start: 1px solid var(--line); }
.assistant-examples button {
  inline-size: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  min-block-size: 2.85rem;
  margin: 0;
  padding: .65rem 1rem;
  text-align: start;
  color: var(--blue);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-weight: 560;
}
.assistant-examples button:hover {
  background: var(--soft);
  color: var(--blue-deep);
  text-decoration: none;
  box-shadow: none;
}
.assistant-examples button .icon { transition: transform var(--t-fast); }
.assistant-examples button:hover .icon { transform: translateX(3px); }

/* Borradores de factura */
.invoice-upload {
  padding: 1.4rem 1.55rem;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #fcfbf9 0%, #f6f4f0 100%);
  box-shadow: var(--shadow-xs);
}
.invoice-upload h2, .invoice-context h2 { margin: 0 0 .55rem; font-size: 1.08rem; }
.invoice-upload form { margin: 0; }
.invoice-upload-actions, .invoice-actions { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; margin-top: .65rem; }
.invoice-upload-actions input { flex: 1 1 20rem; min-width: 0; width: 100%; margin: 0; }
.invoice-list { margin-block-start: 1.6rem; }
.invoice-list ul {
  list-style: none;
  padding: 0;
  margin: .5rem 0 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.invoice-list li + li { border-top: 1px solid var(--line); }
.invoice-list li a {
  display: flex;
  gap: .85rem;
  justify-content: space-between;
  align-items: center;
  padding: .9rem 1.05rem;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: background var(--t-fast);
}
.invoice-list li a:hover { background: var(--soft); text-decoration: none; }
.invoice-list li a:hover strong { color: var(--blue-deep); text-decoration: underline; }
.invoice-list li small, .invoice-fields small { display: block; color: var(--muted); }
.invoice-row-meta { display: inline-flex; flex: none; align-items: center; gap: .5rem; color: #9a948b; }
.invoice-review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 1.5rem; align-items: start; }
.invoice-context {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.35rem;
  background: var(--soft);
  box-shadow: var(--shadow-xs);
}
.invoice-filename { overflow-wrap: anywhere; font-weight: 560; margin-bottom: .6rem; }
.invoice-ai { border-top: 1px solid var(--line); margin-top: 1.05rem; padding-top: 1.05rem; }
.invoice-ai form { margin-block: .75rem 0; }
.invoice-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: .85rem 1rem; }
.invoice-field-grid input, .invoice-field-grid select { width: 100%; min-width: 0; }
.invoice-actions { margin-top: 1.25rem; }
.invoice-posting { border-top: 1px solid var(--line); margin-top: 1.35rem; padding-top: 1.35rem; }
.invoice-posting .assistant-consent { background: var(--tint); border-color: var(--tint-border); }
.invoice-discard { padding-block: .65rem; margin-block-start: 1rem; border-top: 1px solid var(--line); }
.invoice-readonly { overflow-wrap: anywhere; }
.invoice-readonly dt { font-size: .8rem; color: var(--sub); }
.invoice-readonly dd { margin: .15rem 0 0; font-weight: 650; }
.invoice-review .invoice-context button { min-block-size: 2.8rem; width: 100%; }

/* Adaptación responsiva */
@media (max-width: 65rem) {
  .desk { grid-template-columns: 14rem minmax(0, 1fr); }
  .rail { padding-inline: .65rem; }
  .desk-main { padding-inline: 1.5rem; }
  .dispatch-layout { gap: 1rem; }
  .work-registers { gap: 1.5rem; }
  .work-pulse { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contract-values dd { font-size: 1.4rem; }
}
@media (max-width: 52rem) {
  .desk { display: block; }
  .rail { display: none; }
  .trail { position: relative; min-height: 3.35rem; margin: 0 0 .85rem; }
  .mobile-nav { display: block; }
  .mobile-nav summary {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    min-height: 38px;
    padding: .35rem .72rem;
    margin: 0;
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
  }
  .mobile-nav nav {
    position: absolute;
    z-index: 30;
    right: 0;
    top: calc(100% + .35rem);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: .85rem;
    width: min(21rem, calc(100vw - 2rem));
    max-height: 70vh;
    overflow: auto;
    box-shadow: var(--shadow-md);
  }
  .mobile-nav nav a { min-height: 42px; }
  .mobile-nav nav section + section { margin-top: .75rem; }
  .desk-main { padding: .2rem 1.25rem 3rem; }
  .dispatch-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 48rem) {
  .invoice-review { grid-template-columns: 1fr; gap: 1.1rem; }
}
@media (max-width: 39rem) {
  .schedule-calendar { padding: 1rem; }
  .schedule-calendar .sectionline { align-items: flex-start; flex-direction: column; gap: .4rem; }
  .schedule-row { gap: .5rem; }
  .schedule-form .formgrid { grid-template-columns: 1fr; }
  .schedule-form input, .schedule-form select { min-width: 0; width: 100%; }
}
@media (max-width: 37.5rem) {
  h1 { font-size: 1.85rem; }
  .bar { height: 3.4rem; min-height: 3.4rem; padding: .15rem .9rem; gap: .35rem; }
  .brand-logo { height: 1.55rem; }
  .brand-name { display: none; }
  .identity { gap: .5rem; }
  .bar nav { gap: .25rem; }
  .bar .quiet, .bar .home-link { font-size: .8rem; padding: .35rem .5rem; white-space: nowrap; }
  .bar .user, .bar .home-link .icon, .bar .nav-extra, .cmd-trigger kbd { display: none; }
  .cmd-trigger span { display: none; }
  .cmd-trigger { padding: .35rem .5rem; }
  .work-pulse { grid-template-columns: 1fr; gap: .6rem; }
  .docket-panel { padding: 1rem; }
  .docket-meta { grid-template-columns: 1fr; gap: .65rem; }
  .docket-stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
  .docket-step:not(:last-child)::after { display: none; }
  .docket-move-date { margin-left: 0; width: 100%; }
  .activity-list li { grid-template-columns: auto minmax(0, 1fr); }
  .activity-time { grid-column: 1 / -1; }
  .desk-main { padding-inline: 1rem; }
  .trail { margin-bottom: .65rem; }
  .page-title, .sectionline { align-items: flex-start; }
  .page-title { flex-wrap: wrap; gap: .7rem; padding-bottom: 1.15rem; }
  .page-title .button { font-size: .86rem; }
  .work-title-actions { justify-content: flex-start; }
  .contract { padding: 1.05rem; }
  .contract-values { grid-template-columns: 1fr; gap: .35rem; margin: .75rem 0 .9rem; }
  .contract-values > div, .contract-values > div + div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .4rem;
    border: 0;
    padding: 0;
  }
  .contract-values dd { font-size: 1.16rem; }
  .contract-values dt { font-size: .82rem; }
  .due-preview { margin: 1.45rem 0; }
  .due-row { grid-template-columns: 2.6rem minmax(0, 1fr) auto .85rem; gap: .55rem; padding-inline: .35rem; margin-inline: -.35rem; }
  .due-row > .icon { width: .8rem; }
  .date-cell { width: 2.5rem; padding: .28rem .15rem; }
  .date-cell b { font-size: .96rem; }
  .due-name strong, .due-money b { font-size: .88rem; }
  .due-name small, .due-money small { font-size: .76rem; }
  .work-registers, .dispatch-layout { display: block; }
  .dispatch-layout .edit-panel, .dispatch-layout .decision { margin: .6rem 0 1.2rem; }
  .work-registers .panel + .panel { margin-top: .5rem; }
  .line-controls { grid-template-columns: minmax(0, 1fr) auto; gap: .25rem .6rem; }
  .line-controls > label:first-child { grid-column: 1 / -1; }
  .filter-bar { display: flex; width: 100%; }
  .filter-bar a { flex: 1; text-align: center; padding: .48rem .35rem; font-size: .82rem; min-height: 40px; }
  .balance-strip, .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .9rem 1rem; gap: .7rem; }
  .balance-strip > div + div, .metrics > div + div { border-left: 0; padding-left: 0; }
  .balance-strip dd, .metrics strong { font-size: 1.2rem; }
  .due-table th:nth-child(3), .due-table td:nth-child(3), .stock-table { display: none; }
  .compact-only { display: inline; }
  .due-table th, .due-table td { padding: .55rem .45rem; }
  .due-table th[scope="row"] { min-width: 5rem; max-width: none; }
  .stock-list { display: block; list-style: none; margin: 0; padding: 0; }
  .stock-list li {
    padding: .85rem 1rem;
    margin-bottom: .6rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
  }
  .stock-list dl { display: flex; gap: 1.5rem; margin-top: .45rem; }
  .stock-list dt { font-size: .8rem; color: var(--sub); }
  .home { width: calc(100% - 1.5rem); margin: 1.75rem auto; }
  .company-page { width: calc(100% - 1.5rem); margin: 1.6rem auto 3rem; }
  .project-row { grid-template-columns: 2.6rem minmax(0, 1fr); gap: .45rem .7rem; padding: 1rem; }
  .project-symbol { width: 2.55rem; height: 2.55rem; }
  .project-symbol img { width: 1.5rem; height: 1.5rem; }
  .project-row > .action-link, .project-stats, .shortcuts { grid-column: 1 / -1; }
  .shortcuts { gap: .4rem; }
  .dispatch-review li > div, .record > div, .due-name strong { overflow-wrap: anywhere; }
  .ledger-table td small.treasury-mobile-state { display: block; }
  .purchase-summary, .forecast-metrics, .insights-kpis, .match-strip { grid-template-columns: 1fr; gap: 0; }
  .match-strip { gap: .6rem; }
  .purchase-summary > div { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; padding: .35rem 0; }
  .purchase-summary > div + div,
  .forecast-metrics > div + div,
  .insights-kpis > div + div { border-left: 0; border-top: 1px solid var(--line); padding: .55rem 0 0; margin-top: .55rem; }
  .purchase-summary dd { text-align: end; }
  .purchase-table table { min-width: 0; }
  .purchase-table th, .purchase-table td { padding-inline: .45rem; overflow-wrap: anywhere; }
  .ledger-table[aria-labelledby="loan-installments"] :is(th, td) { white-space: normal; padding-inline: .45rem; overflow-wrap: anywhere; }
  .ledger-table[aria-labelledby="loan-installments"] th[scope="row"] { min-inline-size: 0; }
  .forecast-summary th[scope="row"] { min-inline-size: 7.25rem; }
  .insights-heading { gap: .8rem; padding-bottom: 1rem; }
  .insights-cash { padding: .95rem; }
  .insights-figure { padding: .85rem; }
  .insights-cash details summary { min-height: 44px; }
  .insights-line-chart { height: 6.8rem; }
  .insights-documents { grid-template-columns: minmax(0, 1fr); gap: .7rem; }
  .insights-document .sectionline { flex-direction: column; align-items: flex-start; gap: .22rem; }
  .insights-axis-y { font-size: .68rem; }
  .login { padding: 1.65rem 1.35rem; margin: 2rem auto; }
}
@media (max-width: 36rem) {
  .invoice-field-grid { grid-template-columns: 1fr; }
  .invoice-upload-actions button, .invoice-actions button { width: 100%; }
}
@media (pointer: coarse) {
  .assistant-examples button, .assistant-composer button,
  .invoice-review input:not([type="checkbox"]), .invoice-review select,
  .invoice-review button, .invoice-upload button { min-block-size: 2.85rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  .mast, .rail, .mobile-nav, .trail, .skip, .live-filter-bar, .record-toolbar, .date-chips, .notice-close, .export-link, .print-btn, .work-title-actions { display: none !important; }
  .print-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: .75rem;
    margin-bottom: 1.15rem;
    border-bottom: 2px solid var(--brand);
  }
  .print-banner img { height: 2rem; width: auto; }
  .print-banner div { text-align: right; }
  .print-banner strong { display: block; font-size: 1rem; }
  .print-banner small { font-size: .78rem; color: var(--sub); }
  .desk, .dispatch-layout, .work-registers { display: block; }
  .work-pulse { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .desk-main, .home { padding: 0; width: 100%; max-width: none; }
}
