/**
 * Bill · VIRTUAL FORCE — styles.css
 * Shell + design tokens.
 *
 * Tokens: heredan SAGE de Lu/Tom (lu-theme.css v1.2 · 2026-04-21).
 * Shell:  layout Obsidian (hdr + rail + body + ftr) destilado del patrón Tom.
 * Accent: salvia VF como punto de partida; iteración posterior define accent Bill.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

/* ═══════════════════════════════════════════════
   TOKENS DE COLOR — SAGE (compartido con Lu y Tom)
═══════════════════════════════════════════════ */
:root {
  /* Superficies */
  --bg:           #f0eee9;
  --surface:      #ffffff;
  --surface-2:    #f5f2eb;
  --surface-3:    #ebe7dc;

  /* Bordes */
  --border:       #e4e0d5;
  --border-soft:  #ebe7dc;
  --divider:      #ebe7dc;

  /* Texto */
  --text:         #1a1815;
  --text-2:       #5f5a4f;
  --text-3:       #a39e8f;
  --text-inv:     #ffffff;

  /* Acento — salvia VF */
  --accent:       #6e8871;
  --accent-bg:    #e4ebe2;
  --accent-text:  #3d4f41;

  /* Categorías / Tags */
  --cat-finanzas:     #1a6b5a;
  --cat-finanzas-bg:  #e6f4f1;
  --cat-impuestos:    #b8412c;
  --cat-impuestos-bg: #f6e4de;
  --cat-clientes:     #5a7a9e;
  --cat-clientes-bg:  #e6edf7;

  /* Semáforo */
  --red:          #b8412c;
  --red-bg:       #f6e4de;
  --orange:       #b8752a;
  --orange-bg:    #f3ead3;
  --yellow:       #c9a234;
  --yellow-bg:    #f3ead3;
  --green:        #6e8871;
  --green-bg:     #e4ebe2;
  --blue:         #5a7a9e;
  --blue-bg:      #e6edf7;
  --purple:       #7a6aa8;

  /* Tipografía */
  --font-sans: 'Inter', -apple-system, 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'Menlo', 'Courier New', monospace;

  --fs-xs:   0.8rem;
  --fs-sm:   0.9rem;
  --fs-base: 1rem;
  --fs-md:   1.125rem;
  --fs-lg:   1.5rem;
  --fs-xl:   1.75rem;

  --fw-light:   300;
  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semi:    600;
  --fw-bold:    700;
  --fw-black:   900;

  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;

  --radius-sm:   0.375rem;
  --radius:      0.625rem;
  --radius-lg:   1rem;
  --radius-pill: 6.25rem;

  --shadow-weak: 0 1px 2px rgba(30,25,15,.04), 0 2px 8px rgba(30,25,15,.03);
  --shadow-card: 0 1px 3px rgba(30,25,15,.05), 0 6px 20px rgba(30,25,15,.04);
}

/* ═══════════════════════════════════════════════
   RESET
═══════════════════════════════════════════════ */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html { font-size: 125%; }   /* base 20px: toda la UI está en rem y escala junta */
@media (max-width: 640px) { html { font-size: 112.5%; } }
html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body { font-size: var(--fs-base); }

/* ═══════════════════════════════════════════════
   APP SHELL — grid Obsidian (hdr + rail + body + ftr, sin graph en F1)
═══════════════════════════════════════════════ */
.app {
  display: grid;
  height: 100vh;
  grid-template-rows: 3.4rem 1fr 3.2rem;
  grid-template-columns: 56px 1fr 0;
  grid-template-areas:
    "hdr  hdr  hdr"
    "rail body body"
    "ftr  ftr  ftr";
  background: var(--bg);
  transition: grid-template-columns .28s cubic-bezier(.4,0,.2,1);
}
.app.rail-closed { grid-template-columns: 0 1fr 0; }

/* ─── HEADER ─────────────────────────────── */
.hdr {
  grid-area: hdr;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 12px;
  gap: 10px;
  z-index: 30;
}
.hdr-brand { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.hdr-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--cat-clientes));
  display: grid; place-items: center;
  color: #fff; font-size: 0.8125rem; font-weight: var(--fw-bold);
  box-shadow: 0 0 0 1.5px rgba(255,255,255,.6), 0 2px 6px rgba(110,136,113,.25);
}
.hdr-name-wrap { display: flex; flex-direction: column; line-height: 1; }
.hdr-name {
  font-weight: var(--fw-black); font-size: 1rem; color: var(--text);
  letter-spacing: -.02em; line-height: 1;
}
.hdr-name-sub {
  font-family: var(--font-mono); font-size: var(--fs-xs);
  color: var(--text-3); letter-spacing: .14em; text-transform: uppercase;
  margin-top: 2px;
}
.hdr-sep { width: 1px; height: 22px; background: var(--border); flex-shrink: 0; }

.ws-tabs {
  display: flex; gap: 2px; padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}
.ws-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  font-size: var(--fs-xs); font-weight: var(--fw-medium);
  color: var(--text-2); cursor: pointer;
  border-radius: var(--radius-pill);
  transition: all .15s;
  user-select: none;
  border: none; background: transparent;
  font-family: var(--font-sans);
}
.ws-tab:hover { color: var(--text); }
.ws-tab.active {
  background: var(--surface); color: var(--accent);
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

.hdr-spacer { flex: 1; }

.hdr-greet {
  font-size: var(--fs-xs); color: var(--text-2);
  display: flex; align-items: center; gap: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
}
.hdr-greet b { color: var(--text); font-weight: var(--fw-semi); }

.hdr-date {
  font-family: var(--font-mono); font-size: var(--fs-xs);
  color: var(--text-3); white-space: nowrap;
  padding: 4px 10px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}

.hdr-ctrls { display: flex; gap: 4px; flex-shrink: 0; }
.ic-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-sm);
  cursor: pointer;
  display: grid; place-items: center;
  transition: all .15s;
  font-family: inherit;
}
.ic-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }

/* ─── LEFT RAIL ─────────────────────────── */
.rail {
  grid-area: rail;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 10px 0;
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  overflow: hidden;
}
.rail-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-3);
  font-size: var(--fs-md);
  cursor: pointer;
  display: grid; place-items: center;
  transition: all .15s;
  position: relative;
  font-family: inherit;
}
.rail-btn:hover { background: var(--surface-2); color: var(--text); }
.rail-btn.active {
  background: var(--accent-bg); color: var(--accent-text);
  border-color: var(--accent);
}
.rail-sep { width: 24px; height: 1px; background: var(--border); margin: 6px 0; }
.rail-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }

.rail-tip {
  position: absolute; left: 46px;
  background: var(--text); color: var(--surface);
  font-size: var(--fs-xs); padding: 3px 8px; border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .15s;
  z-index: 100;
}
.rail-btn:hover .rail-tip { opacity: 1; }

/* ─── BODY — workspace panels ───────────── */
.body {
  grid-area: body;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}
.ws {
  position: absolute; inset: 0;
  display: none; flex-direction: column;
  overflow: hidden;
}
.ws.active { display: flex; }
.ws-scroll {
  flex: 1; overflow-y: auto;
  padding: 16px 20px 24px;
}

/* ─── PANEL ────────────────────────────── */
.panel { margin-bottom: 24px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 2px;
}
.panel-title {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.panel-count {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-3);
  padding: 2px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}
.panel-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.panel-body-table {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* ─── CARD BASE ────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--shadow-weak);
}
.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-card);
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.card-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-black);
  color: var(--text);
  letter-spacing: -.01em;
  line-height: 1.2;
}
.card-sub {
  font-size: var(--fs-xs);
  color: var(--text-3);
  font-family: var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-top: 3px;
}
.card-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--fs-sm);
  padding: 4px 0;
}
.card-row + .card-row { border-top: 1px dashed var(--border-soft); }
.card-label { color: var(--text-2); }
.card-value {
  font-family: var(--font-mono);
  font-weight: var(--fw-medium);
  color: var(--text);
}
.card-value.accent { color: var(--accent); }

.card-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--divider);
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--text-3);
  font-family: var(--font-mono);
  letter-spacing: .06em;
}

/* ─── PANEL SUMMARY (kpis del dashboard) ── */
.panel-summary .panel-body {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.kpi-label {
  font-size: var(--fs-xs);
  color: var(--text-3);
  font-family: var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.kpi-value {
  font-size: var(--fs-xl);
  font-weight: var(--fw-black);
  color: var(--text);
  letter-spacing: -.02em;
  font-family: var(--font-mono);
  line-height: 1.1;
}
.kpi-sub {
  font-size: var(--fs-xs);
  color: var(--text-3);
}

/* ─── TABLE — Clientes (estilo spreadsheet sobrio) ─── */
.row-client {
  display: grid;
  grid-template-columns: 1.6fr 1.1fr 0.8fr 1.4fr 0.9fr 0.7fr;
  gap: 12px;
  padding: 10px 14px;
  align-items: center;
  border-bottom: 1px solid var(--border-soft);
  font-size: var(--fs-sm);
  transition: background .15s;
}
.row-client:last-child { border-bottom: none; }
.row-client:hover { background: var(--surface-2); }
.row-client.row-head {
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: var(--fw-semi);
}
.row-client .col-name b {
  font-weight: var(--fw-semi);
  color: var(--text);
}
.row-client .col-name .col-sub {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-top: 2px;
}
.row-client .col-cuit,
.row-client .col-iva,
.row-client .col-tipo {
  font-family: var(--font-mono);
  color: var(--text-2);
}
.row-client .col-email {
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-client .col-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

/* ─── TABLE — Catálogo ─── */
.row-catalog {
  display: grid;
  grid-template-columns: 3fr 1fr 1.3fr 0.6fr;
  gap: 12px;
  padding: 10px 14px;
  align-items: center;
  border-bottom: 1px solid var(--border-soft);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background .15s;
}
.row-catalog:last-child { border-bottom: none; }
.row-catalog:hover { background: var(--surface-2); }
.row-catalog.row-head {
  cursor: default;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: var(--fw-semi);
}
.row-catalog .col-name b { font-weight: var(--fw-semi); color: var(--text); }
.row-catalog .col-precio { font-family: var(--font-mono); color: var(--text-2); white-space: nowrap; }
.row-catalog .col-actions { display: flex; justify-content: flex-end; }
@media (max-width: 640px) {
  .row-catalog { grid-template-columns: 1fr auto; }
  .row-catalog .col-uso, .row-catalog .col-actions { display: none; }
}

/* ─── TAG / BADGE ──────────────────────── */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: 1.6;
  white-space: nowrap;
  font-family: var(--font-sans);
}
.tag.recurrente { background: var(--accent-bg); color: var(--accent-text); }
.tag.eventual   { background: var(--surface-2); color: var(--text-2); }
.tag.ri         { background: var(--blue-bg);   color: var(--blue); }
.tag.mt         { background: var(--green-bg);  color: var(--green); }
.tag.ex         { background: var(--orange-bg); color: var(--orange); }
.tag.cf         { background: var(--surface-2); color: var(--text-3); }

/* ─── CHAT PANEL (drawer sobre el footer) ─ */
.chat-panel {
  position: fixed;
  right: 14px;
  bottom: 58px;
  width: min(380px, calc(100vw - 28px));
  max-height: min(60vh, 520px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  z-index: 40;
}
.chat-panel[hidden] { display: none; }
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi, 600);
}
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-bubble {
  max-width: 88%;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  line-height: 1.4;
  white-space: pre-wrap;
}
.chat-user     { align-self: flex-end; background: var(--accent-bg); color: var(--accent-text); }
.chat-assistant{ align-self: flex-start; background: var(--surface-2); color: var(--text); }
.chat-error    { align-self: flex-start; background: var(--red-bg); color: var(--red); }
.chat-thinking { color: var(--text-3); font-style: italic; }
.chat-proposal {
  align-self: stretch;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: var(--fs-sm);
}
.chat-proposal-title { font-weight: var(--fw-semi, 600); margin-bottom: 6px; }
.chat-proposal-items { margin: 0 0 8px; padding-left: 18px; color: var(--text-2); }
.chat-proposal-total { font-weight: var(--fw-semi, 600); margin-bottom: 8px; }
.chat-proposal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.chat-proposal-ok { color: var(--green); font-weight: var(--fw-semi, 600); }

/* ─── FOOTER (chat bar) ──────────────────── */
.ftr {
  grid-area: ftr;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
}
.ftr-input {
  flex: 1;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  padding: 0 14px;
  font-size: var(--fs-sm);
  color: var(--text);
  font-family: var(--font-sans);
  outline: none;
}
.ftr-input:focus { border-color: var(--accent); background: var(--surface); }
.ftr-input::placeholder { color: var(--text-3); }
.ftr-status {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-3);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.ftr-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-bg);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: .45; transform: scale(.85); }
}

/* ─── EMPTY STATE ──────────────────────── */
.empty {
  grid-column: 1 / -1;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: var(--fs-sm);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}
.empty code {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-2);
}

/* ─── SCROLLBAR ─────────────────────────── */
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
*::-webkit-scrollbar-track { background: transparent; }

/* ─── RESPONSIVE ────────────────────────── */
@media (max-width: 720px) {
  .panel-body { grid-template-columns: 1fr; }
  .hdr-greet  { display: none; }
  .hdr-date   { display: none; }
  .row-client { grid-template-columns: 1fr 1fr; }
  .row-client.row-head { display: none; }
  .row-client .col-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ─── UTILIDADES ────────────────────────── */
.mono  { font-family: var(--font-mono); }
.muted { color: var(--text-3); }
.small { font-size: var(--fs-sm); }

/* ═══════════════════════════════════════════════════════════
   Emisión — botones, fila de factura, modal wizard (paso emisión)
   ═══════════════════════════════════════════════════════════ */

/* Botones */
.btn {
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi, 600);
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--text-inv); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.06); color: var(--text-inv); background: var(--accent); }

.panel-head-actions { display: flex; gap: 8px; }
.panel-head:has(.panel-head-actions) .panel-count { margin-right: auto; margin-left: 10px; }

/* Fila de factura (tabla) */
.row-invoice {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr 0.9fr 1fr 1.3fr 0.8fr;
  align-items: center;
  gap: 10px;
  padding: 11px 8px;
  border-bottom: 1px solid var(--divider);
  font-size: var(--fs-sm);
}
.row-invoice:last-child { border-bottom: none; }
.row-invoice:hover { background: var(--surface-2); }
.row-invoice.row-head {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.row-invoice.row-head:hover { background: none; }
.row-invoice .col-total { text-align: right; }

/* Fila de "factura por emitir" (checkbox + editable) */
.row-pendiente {
  display: grid;
  grid-template-columns: 32px 1.6fr 0.7fr 1fr 0.9fr 1fr;
  align-items: center;
  gap: 10px;
  padding: 11px 8px;
  border-bottom: 1px solid var(--divider);
  font-size: var(--fs-sm);
}
.row-pendiente:last-child { border-bottom: none; }
.row-pendiente:hover { background: var(--surface-2); }
.row-pendiente.row-head {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.row-pendiente.row-head:hover { background: none; }
.row-pendiente .col-monto { text-align: right; font-family: var(--font-mono); }
.row-pendiente .col-periodo { font-family: var(--font-mono); color: var(--text-2); }
.row-pendiente .col-check { display: flex; justify-content: center; }

/* Tags de estado de factura */
.tag.issued     { background: var(--blue-bg);   color: var(--blue); }
.tag.sent       { background: var(--accent-bg); color: var(--accent-text); }
.tag.paid       { background: var(--green-bg);  color: var(--green); }
.tag.overdue    { background: var(--red-bg);    color: var(--red); }
.tag.rejected   { background: var(--red-bg);    color: var(--red); }
.tag.in_reclamo { background: var(--orange-bg); color: var(--orange); }
.tag.draft,
.tag.cancelled  { background: var(--surface-2); color: var(--text-3); }

/* Modal wizard */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(26, 24, 21, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: min(640px, 100%);
  max-height: 90vh; overflow: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .28);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px; border-bottom: 1px solid var(--divider);
}
.modal-title { font-size: var(--fs-md); font-weight: var(--fw-semi, 600); }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 15px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 18px; border-top: 1px solid var(--divider);
}

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: var(--fs-xs); color: var(--text-2); font-weight: var(--fw-semi, 600); }
.field input, .field select, .field textarea, .item-row input {
  font-family: var(--font-sans); font-size: var(--fs-sm);
  padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .item-row input:focus {
  outline: none; border-color: var(--accent);
}

.items-head { display: flex; align-items: center; justify-content: space-between; }
.items-title {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-3); font-family: var(--font-mono);
}
.items-cols, .item-row {
  display: grid; grid-template-columns: 1fr 68px 112px 64px 34px; gap: 8px;
}
.items-cols { font-size: var(--fs-xs); color: var(--text-3); padding: 0 2px; }
.item-row { margin-top: 7px; }

.modal-result { font-size: var(--fs-sm); padding: 10px 12px; border-radius: 8px; }
.result-ok   { background: var(--green-bg); color: var(--accent-text); }
.result-err  { background: var(--red-bg);   color: var(--red); }
.result-wait { background: var(--surface-2); color: var(--text-2); }

@media (max-width: 640px) {
  .field-grid { grid-template-columns: 1fr; }
  .row-invoice { grid-template-columns: 1fr 1fr; }
  .row-invoice.row-head { display: none; }
}

/* ═══════════════════════════════════════════════
   PÁGINAS SUELTAS — login y chat del tenant (/login, /)
═══════════════════════════════════════════════ */
.page-solo { overflow: auto; }
.login-card {
  width: min(380px, calc(100vw - 32px));
  margin: 12vh auto 0;
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: var(--space-5);
}
.login-form { display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--fs-sm); }
.login-form input {
  height: 36px; padding: 0 var(--space-3);
  border: 1px solid var(--border); border-radius: var(--radius);
  font: inherit; background: var(--surface-2); color: var(--text);
}
.login-form .btn { margin-top: var(--space-2); justify-content: center; }
.login-error { color: var(--red); font-size: var(--fs-sm); }

.chat-page {
  height: 100%;
  max-width: 820px;
  margin: 0 auto;
  display: flex; flex-direction: column;
  padding: 0 16px;
}
.chat-page-hdr {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.chat-page-nav { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.chat-page-nav a.btn { text-decoration: none; }
.chat-page-log { padding: var(--space-4) 0; }
.chat-page-log .chat-bubble { font-size: var(--fs-sm); }
.chat-page-bar {
  display: flex; gap: var(--space-2);
  padding: var(--space-3) 0 var(--space-4);
  border-top: 1px solid var(--border);
}
.chat-page-bar .ftr-input { height: 38px; padding: 0 var(--space-4); }
.chat-mcp {
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  display: flex; flex-direction: column; gap: var(--space-2);
}
.chat-mcp pre {
  font-family: var(--font-mono); font-size: var(--fs-xs);
  white-space: pre-wrap; word-break: break-all;
  background: var(--surface); padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm); border: 1px solid var(--border-soft);
}
.chat-mcp[hidden] { display: none; }

/* ─── Créditos (footer de todas las páginas) ─ */
.ftr-credit, .site-credit {
  font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap;
}
.ftr-credit a, .site-credit a { color: var(--text-2); text-decoration: none; font-weight: var(--fw-semi, 600); }
.ftr-credit a:hover, .site-credit a:hover { color: var(--accent); }
.site-credit { text-align: center; padding: var(--space-3) 0 var(--space-4); }
.page-solo > .site-credit { margin-top: var(--space-5); }
.chat-page .site-credit { padding-top: 0; }
.hdr-name { white-space: nowrap; }
/* Header del panel: el título largo no puede empujar el layout (sin scroll lateral). */
.hdr { overflow: hidden; }
.hdr .hdr-brand { min-width: 0; flex-shrink: 1; }
.hdr-avatar { flex-shrink: 0; }
.hdr .hdr-name-wrap { min-width: 0; }
.hdr .hdr-name { overflow: hidden; text-overflow: ellipsis; }
.hdr .ws-tabs { min-width: 0; flex-shrink: 1; overflow-x: auto; scrollbar-width: none; }
.hdr .ws-tabs::-webkit-scrollbar { display: none; }
@media (max-width: 1280px) { .hdr-date { display: none; } }
@media (max-width: 1140px) { .hdr-greet { display: none; } }
@media (max-width: 900px) { .ftr-credit { display: none; } }
@media (max-width: 640px) { .hdr .hdr-name { font-size: 0.875rem; } }

/* ─── Alta de cliente (modal con form) ───── */
.modal-foot-inline { padding: 0; border-top: none; }

/* ─── Lote de facturas por sesiones (chat) ── */
.lote-tabla { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); margin: var(--space-2) 0; }
.lote-tabla th { text-align: left; font-size: var(--fs-xs); color: var(--text-3); font-weight: var(--fw-semi, 600); padding: 4px 6px; border-bottom: 1px solid var(--border); }
.lote-tabla td { padding: 6px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.lote-tabla tfoot td { font-weight: var(--fw-semi, 600); border-bottom: none; }
.lote-tabla .r { text-align: right; white-space: nowrap; }
.lote-fechas { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-2); margin-top: 2px; }
.lote-errores { background: var(--orange-bg); border-radius: var(--radius); padding: 8px 12px; font-size: var(--fs-sm); margin: var(--space-2) 0; }
.lote-errores ul { margin: 4px 0 0 18px; padding: 0; }
.lote-mail { display: flex; gap: 6px; align-items: center; font-size: var(--fs-sm); color: var(--text-2); margin: var(--space-2) 0; }
.lote-err { color: var(--red); }
@media (max-width: 640px) { .lote-tabla { font-size: var(--fs-xs); } }

/* Chat: área de texto multilínea (pegar sesiones) */
.chat-page-bar { align-items: flex-end; }
.chat-page-bar .chat-textarea {
  height: auto; min-height: 38px; max-height: 260px; resize: none;
  padding: 9px var(--space-4); line-height: 1.4; border-radius: 19px;
  font-family: var(--font-sans); overflow-y: auto;
}
.chat-bubble.chat-user { white-space: pre-wrap; }

/* ─── Tablero del período mensual (chat) ──── */
.periodo {
  margin-top: var(--space-3); padding: var(--space-3) var(--space-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  display: flex; flex-direction: column; gap: var(--space-2);
}
.periodo[hidden] { display: none; }
.periodo-head { display: flex; align-items: center; gap: var(--space-2); }
.periodo-title { font-size: var(--fs-sm); color: var(--text-2); }
.periodo-title b { color: var(--text); text-transform: capitalize; }
.periodo-spacer { flex: 1; }
.periodo-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pchip {
  display: flex; align-items: baseline; gap: 5px; padding: 4px 10px;
  border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--border-soft);
  font-size: var(--fs-xs); color: var(--text-2);
}
.pchip b { font-size: var(--fs-sm); color: var(--text); }
.pc-azul { background: var(--blue-bg); } .pc-verde { background: var(--green-bg); }
.pc-amarillo { background: var(--yellow-bg); } .pc-naranja { background: var(--orange-bg); }
.pc-alerta { background: var(--red-bg); }
.periodo-detalle { max-height: 46vh; overflow: auto; }
.periodo-detalle[hidden] { display: none; }
.st { display: inline-block; padding: 1px 7px; border-radius: var(--radius-pill); font-size: var(--fs-xs); white-space: nowrap; }
.st-gris { background: var(--surface-3); color: var(--text-2); } .st-azul { background: var(--blue-bg); color: var(--blue); }
.st-amarillo { background: var(--yellow-bg); color: var(--orange); } .st-naranja { background: var(--orange-bg); color: var(--orange); }
.st-verde { background: var(--green-bg); color: var(--accent-text); }
@media (max-width: 640px) { .per-tabla th:nth-child(5), .per-tabla td:nth-child(5) { display: none; } }


/* ═══════════════════════════════════════════════
   BANDAS (header y footer): mismo color, distinto del cuerpo
═══════════════════════════════════════════════ */
:root {
  --banner-bg:     #24352b;
  --banner-text:   #f4f2ea;
  --banner-text-2: #c5cfc2;
  --banner-line:   rgba(255, 255, 255, .16);
  --banner-hover:  rgba(255, 255, 255, .12);
}
.banner, .hdr, .ftr {
  background: var(--banner-bg);
  color: var(--banner-text);
  border-color: var(--banner-bg);
}
.banner .hdr-name, .hdr .hdr-name { color: var(--banner-text); }
.banner .hdr-name-sub, .hdr .hdr-name-sub { color: var(--banner-text-2); }
.banner .hdr-avatar, .hdr .hdr-avatar { box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.hdr .hdr-sep { background: var(--banner-line); }
.hdr .ws-tabs { background: rgba(255,255,255,.07); border-color: var(--banner-line); }
.hdr .ws-tab { color: var(--banner-text-2); }
.hdr .ws-tab:hover { color: #fff; }
.hdr .ws-tab.active { background: var(--banner-text); color: var(--banner-bg); box-shadow: none; }
.hdr .hdr-greet, .hdr .hdr-date { color: var(--banner-text-2); }
.hdr .hdr-greet b { color: #fff; }
.banner .btn, .hdr .ic-btn {
  background: transparent; color: var(--banner-text); border-color: var(--banner-line);
}
.banner .btn:hover, .hdr .ic-btn:hover { background: var(--banner-hover); color: #fff; border-color: rgba(255,255,255,.3); }
.ftr .ftr-input { background: #fff; border-color: transparent; }
.ftr .ftr-status, .ftr .ftr-credit, .banner .site-credit { color: var(--banner-text-2); }
.ftr .ftr-credit a, .banner .site-credit a { color: #fff; }
.ftr .ftr-credit a:hover, .banner .site-credit a:hover { color: var(--accent-bg); }

/* Páginas sueltas (chat, login): banda arriba, contenido, banda abajo */
.page-solo { display: flex; flex-direction: column; min-height: 100%; height: 100%; }
.banner { flex-shrink: 0; }
.banner-inner {
  max-width: 980px; margin: 0 auto; padding: var(--space-3) var(--space-4);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap;
}
.banner .hdr-name { font-size: 1.05rem; white-space: normal; }
.banner .hdr-avatar { width: 34px; height: 34px; font-size: 0.9rem; }
.banner-foot { margin-top: auto; }
.banner-foot .banner-inner { justify-content: center; padding: var(--space-3) var(--space-4); }
.banner-foot .banner-inner.site-credit { padding: var(--space-4) var(--space-4); font-size: var(--fs-sm); }
.chat-page { flex: 1; min-height: 0; height: auto; max-width: 980px; width: 100%; }
.chat-page .chat-page-bar { border-top: none; }
.login-card { margin-top: 10vh; }
.login-title { font-weight: var(--fw-semi); font-size: var(--fs-md); }
@media (max-width: 640px) {
  .banner-inner { padding: var(--space-2) var(--space-3); }
  .banner .hdr-name { font-size: 0.95rem; }
}

.periodo-sub { color: var(--text-3); font-size: var(--fs-xs); }
.per-email { font-size: var(--fs-xs); color: var(--text-2); word-break: break-all; }

/* ─── Logo como link al inicio ───────────── */
a.hdr-brand { text-decoration: none; color: inherit; cursor: pointer; }
a.hdr-brand:hover .hdr-name { text-decoration: underline; text-underline-offset: 3px; }
.hdr-link { color: var(--banner-text-2); text-decoration: none; font-size: var(--fs-sm); white-space: nowrap; }
.hdr-link:hover { color: #fff; }

/* ─── Menú Facturaciones ─────────────────── */
.menu-wrap { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  width: min(420px, calc(100vw - 32px)); max-height: 60vh; overflow: auto;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 16px 40px rgba(0,0,0,.22); padding: 6px;
}
.menu-pop[hidden] { display: none; }
.menu-item {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
  padding: 8px 10px; border: none; background: transparent; border-radius: var(--radius-sm);
  font: inherit; color: inherit; cursor: pointer;
}
.menu-item:hover, .menu-item.activo { background: var(--accent-bg); }
.mi-titulo { font-weight: var(--fw-semi); font-size: var(--fs-sm); text-transform: none; }
.mi-sub { font-size: var(--fs-xs); color: var(--text-2); }
@media (max-width: 640px) { .menu-pop { position: fixed; left: 16px; right: 16px; top: 120px; width: auto; } }

/* ─── Ficha del paciente ─────────────────── */
.modal-ancho { width: min(980px, 100%); }
.row-client:not(.row-head) { cursor: pointer; }
.row-client:not(.row-head):hover { background: var(--accent-bg); }
.ver-ficha { color: var(--accent-text); font-size: var(--fs-xs); font-weight: var(--fw-semi); white-space: nowrap; }
.ficha-historial { border-top: 1px solid var(--divider); padding-top: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); overflow-x: auto; }
.ficha-acciones { flex-wrap: wrap; }
.btn-peligro { color: var(--red); border-color: var(--red-bg); }
.btn-peligro:hover { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.per-link { color: inherit; text-decoration: none; font-weight: var(--fw-semi); }
.per-link:hover { text-decoration: underline; color: var(--accent-text); }
.field code { font-family: var(--font-mono); font-size: var(--fs-xs); background: var(--surface-2); padding: 0 3px; border-radius: 3px; }
.hdr .hdr-date { background: rgba(255,255,255,.08); border-color: var(--banner-line); color: var(--banner-text); }
.hdr .hdr-greet { color: var(--banner-text); }
.btn-chico { padding: 3px 10px; font-size: var(--fs-xs); }
.row-baja { opacity: .55; }
.row-baja .col-name b::after { content: " · de baja"; font-weight: 400; color: var(--text-3); font-size: var(--fs-xs); }
.row-client .col-tipo { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.row-client .col-tipo .col-sub { font-size: var(--fs-xs); color: var(--text-2); }
a.ws-tab, a.rail-btn { text-decoration: none; display: flex; align-items: center; justify-content: center; }
.hdr .ws-tab-inicio { font-weight: var(--fw-semi); color: var(--banner-text); }

/* ═══════════════════════════════════════════════
   RESPONSIVE — panel en tablet y celular
═══════════════════════════════════════════════ */
@media (max-width: 900px) {
  .app { grid-template-rows: auto 1fr auto; }
  .hdr { flex-wrap: wrap; row-gap: 6px; padding: 8px 12px; height: auto; }
  .hdr .hdr-sep, .hdr .hdr-spacer, .hdr .hdr-greet, .hdr .hdr-date { display: none; }
  .hdr .hdr-brand { order: 1; flex: 1 1 auto; }
  .hdr .hdr-link { order: 2; }
  .hdr .hdr-ctrls { order: 3; }
  .hdr .ws-tabs { order: 4; flex: 1 1 100%; }
  .ftr { padding: 8px 12px; height: auto; }
  .ftr .ftr-status { display: none; }
}
@media (max-width: 640px) {
  .hdr .hdr-name { font-size: 0.95rem; white-space: normal; line-height: 1.2; }
  .ws-scroll { padding: 10px; }
  .panel-head { flex-wrap: wrap; row-gap: 8px; }
  .panel-head-actions { flex-wrap: wrap; }
  .modal-backdrop { padding: 8px; }
  .modal { max-height: 94vh; }
  .ficha-acciones .btn { flex: 1 1 auto; }
  .lote-tabla { display: block; overflow-x: auto; white-space: nowrap; }
  .lote-tabla td div { white-space: normal; }
  .periodo-head { flex-wrap: wrap; }
  .chat-page { padding: 0 10px; }
}
/* Tablero: la tabla de detalle scrollea adentro de su caja en pantallas angostas */
.periodo-detalle { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.per-tabla { min-width: 780px; }
.per-tabla td:first-child { min-width: 190px; }
.per-email { word-break: normal; overflow-wrap: anywhere; }
.ficha-historial .lote-tabla { min-width: 720px; }
@media (max-width: 640px) {
  .per-tabla, .ficha-historial .lote-tabla { display: table; white-space: normal; }
}
@media (max-width: 640px) {
  /* inicio: la página entera scrollea (el tablero no empuja el chat fuera de la pantalla) */
  html, body { overflow: auto; height: auto; }
  .page-solo { height: auto; min-height: 100vh; }
  .chat-page { flex: 1 0 auto; }
  .chat-page-log { min-height: 35vh; }
  .chat-page-bar { position: sticky; bottom: 0; background: var(--bg); z-index: 5; }
  .banner .chat-page-nav { gap: 6px; }
  .banner .chat-page-nav .btn { padding: 4px 10px; font-size: var(--fs-xs); }
  #btn-mcp { display: none; }
  .periodo-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; }
  .periodo-head .periodo-title { grid-column: 1 / -1; order: -1; }
  .periodo-head .periodo-spacer { display: none; }
  .periodo-head #per-toggle { justify-self: center; }
  .periodo-detalle { max-height: none; }
}
@media (max-width: 640px) { .page-solo { overflow: visible; } }

/* ─── Config ─────────────────────────────── */
.config-body { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-4); }
.config-item h3 { font-size: var(--fs-md); margin-bottom: 4px; }
.config-item .chat-mcp { margin-top: var(--space-2); }

/* Chat: caja de texto bien visible (marco fuerte, 4 líneas, crece al pegar) */
.chat-page-bar .chat-textarea {
  min-height: 6.6rem; max-height: 22rem;
  background: #fff; border: 2px solid var(--accent); border-radius: 14px;
  padding: 12px 16px; color: var(--text); line-height: 1.45;
  box-shadow: 0 2px 10px rgba(36, 53, 43, .08);
}
.chat-page-bar .chat-textarea:focus { border-color: var(--banner-bg); box-shadow: 0 0 0 3px var(--accent-bg); }
.chat-page-bar .chat-textarea::placeholder { color: var(--text-2); opacity: 1; }
.chat-page-bar .btn-primary { align-self: stretch; padding: 0 22px; font-size: var(--fs-base); }
@media (max-width: 640px) {
  .chat-page-bar .chat-textarea { min-height: 5.4rem; }
  .chat-page-bar .btn-primary { align-self: flex-end; padding: 10px 16px; }
}

/* Rail: tooltip con nombre + explicación, por encima del contenido */
.rail { position: relative; z-index: 40; overflow: visible; }
.rail-btn { position: relative; }
.rail-tip {
  left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  z-index: 60; display: flex; flex-direction: column; gap: 2px;
  min-width: 190px; max-width: 260px; white-space: normal; text-align: left;
  padding: 7px 10px; line-height: 1.3; font-size: var(--fs-xs);
  background: var(--banner-bg); color: var(--banner-text);
  box-shadow: 0 6px 18px rgba(0,0,0,.22);
}
.rail-tip b { font-size: var(--fs-sm); }
.rail-tip-desc { color: var(--banner-text-2); font-weight: 400; }
.rail-btn:hover .rail-tip, .rail-btn:focus-visible .rail-tip { opacity: 1; }

/* ─── Bitácora de actividad ──────────────── */
.act-lista { display: flex; flex-direction: column; padding: 4px 0; }
.act-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 16px; border-bottom: 1px solid var(--border-soft); }
.act-item:last-child { border-bottom: none; }
.act-ico {
  flex: 0 0 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text-2); font-size: var(--fs-sm);
}
.act-factura_emitida .act-ico, .act-pago .act-ico { background: var(--green-bg); color: var(--accent-text); }
.act-factura_leida .act-ico, .act-factura_enviada .act-ico { background: var(--blue-bg); color: var(--blue); }
.act-factura_rechazada .act-ico, .act-paciente_borrado .act-ico { background: var(--red-bg); color: var(--red); }
.act-paciente_baja .act-ico { background: var(--orange-bg); color: var(--orange); }
.act-txt { min-width: 0; }
.act-res { font-size: var(--fs-sm); color: var(--text); overflow-wrap: anywhere; }
.act-meta { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
.act-mas { display: flex; justify-content: center; padding: 10px; }
.act-filtro { font: inherit; font-size: var(--fs-sm); padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.ficha-actividad { border-top: 1px solid var(--divider); padding-top: var(--space-3); }
.ficha-actividad .act-lista { max-height: 320px; overflow: auto; }
.ficha-actividad .act-item { padding: 8px 4px; }

/* ─── Reportes ───────────────────────────── */
.rep-controles { flex-wrap: wrap; gap: 8px; }
.rep-tipos { display: flex; gap: 2px; padding: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill); }
.rep-tipo { border: none; background: transparent; padding: 5px 14px; border-radius: var(--radius-pill); font: inherit; font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; }
.rep-tipo.activo { background: var(--banner-bg); color: var(--banner-text); }
.rep-scroll { overflow-x: auto; padding: 16px; }
.rep-hoja { background: #fff; color: #1a1815; max-width: 900px; min-width: 640px; margin: 0 auto; padding: 32px 36px; border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow-card); font-size: 0.85rem; }
.rep-header { border-bottom: 3px solid var(--banner-bg); padding-bottom: 12px; margin-bottom: 18px; }
.rep-titulo { font-size: 1.35rem; font-weight: 800; color: var(--banner-bg); }
.rep-periodo { font-size: 1rem; font-weight: 600; margin-top: 2px; }
.rep-periodo span { font-weight: 400; color: #5f5a4f; }
.rep-fecha { font-size: 0.75rem; color: #7a756a; margin-top: 4px; }
.rep-tabla { width: 100%; border-collapse: collapse; }
.rep-tabla th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; color: #5f5a4f; padding: 6px 8px; border-bottom: 2px solid #d9d4c7; }
.rep-tabla td { padding: 7px 8px; border-bottom: 1px solid #ebe7dc; vertical-align: middle; }
.rep-tabla .r { text-align: right; white-space: nowrap; }
.rep-tabla tfoot td { font-weight: 700; border-top: 2px solid var(--banner-bg); border-bottom: none; padding-top: 10px; }
.rep-barra-th { width: 32%; }
.rep-barra { height: 14px; background: #f0eee9; border-radius: 3px; overflow: hidden; }
.rep-barra span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.rep-pct { color: #5f5a4f; font-size: 0.8rem; }
.rep-falta { font-weight: 600; color: #b8412c; font-size: 0.8rem; }
.rep-vacio td { color: #a39e8f; }
.rep-ficha, .rep-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.rep-ficha div, .rep-kpis div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; background: #f8f6f1; border-radius: 6px; }
.rep-ficha span, .rep-kpis span { font-size: 0.7rem; text-transform: uppercase; letter-spacing: .04em; color: #7a756a; }
.rep-kpis b { font-size: 1.05rem; }
.rep-deuda { color: #b8412c; }
.rep-pie { margin-top: 22px; padding-top: 8px; border-top: 1px solid #ebe7dc; font-size: 0.7rem; color: #a39e8f; text-align: center; }
.rep-imprimiendo { box-shadow: none; border: none; }
@media (max-width: 640px) { .rep-ficha, .rep-kpis { grid-template-columns: 1fr 1fr; } .rep-hoja { padding: 20px; } }
@media print {
  body * { visibility: hidden; }
  #rep-hoja, #rep-hoja * { visibility: visible; }
  #rep-hoja { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; border: none; }
}
.banner .hdr-name-sub { text-transform: none; letter-spacing: .02em; font-family: var(--font-sans); }
#cat-borrar { margin-right: auto; }
