/* Diseño del panel (07/10/2026): panel moderno con el azul corporativo de ZeroCatalog (azul marino
   del logo, #173242) como acento. Menu integrado en fondo gris claro, contenido en un lienzo blanco
   flotante, bordes finos, densidad compacta, tipografia Geist y cifras tabulares.
   Se carga DESPUES de styles.css y redefine sus tokens y componentes; las piezas nuevas (barra
   superior, buscador, Inicio) estan al final. Los selectores llevan "html" delante para ganar a
   los de styles.css sin !important.
   El MISMO fichero esta en los paneles de Lurbel, CLENAPAL y Pielsa (estos dos montan la barra
   superior y el buscador con diseno.js); si se cambia, copiarlo a los tres. */

:root {
  --brand:           #173242;
  --brand-2:         #234B63;
  --accent:          #1F6391;
  --accent-soft:     #EEF4F9;
  --accent-line:     #D5E3EF;
  --ring:            0 0 0 3px rgba(31, 99, 145, 0.16);

  --app-bg:          #F3F4F6;
  --bg:              #FFFFFF;
  --bg-accent:       #F7F8FA;
  --surface:         #FFFFFF;
  --surface-muted:   #F9FAFB;
  --sidebar-bg:      transparent;
  --sidebar-border:  transparent;
  --line:            #E7E9EE;
  --line-soft:       #F0F1F4;
  --text:            #111827;
  --text-soft:       #6B7280;
  --text-faint:      #9CA3AF;
  --primary:         #374151;
  --primary-strong:  #111827;
  --primary-soft:    #F3F4F6;
  --shadow-xs:       0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-md:       0 6px 16px rgba(17, 24, 39, 0.08);
  --shadow-lg:       0 20px 48px rgba(17, 24, 39, 0.18);
  --radius-xl:       10px;
  --ctl:             7px;

  font-family: 'Geist', 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html body { background: var(--app-bg); }
html h1,
html h2,
html h3,
html h4 { letter-spacing: -0.015em; font-weight: 600; }

/* ── Estructura: menu sobre el fondo, contenido en lienzo blanco ── */
html .panel-shell { grid-template-columns: 232px minmax(0, 1fr); }
html .panel-content {
  margin: 8px 8px 8px 0; min-height: calc(100vh - 16px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-xs);
}

/* ── Menu ── */
html .panel-sidebar { background: transparent; border-right: 0; }
html .sidebar-logo { padding: 18px 16px 14px 18px; border-bottom: 0; gap: 10px; }
html .sidebar-logo-mark {
  width: 28px; height: 28px; border-radius: 7px; background: var(--brand);
  font-size: 11px; font-weight: 400; letter-spacing: 0.06em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 1px 2px rgba(23, 50, 66, 0.3);
}
html .sidebar-logo-name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
html .sidebar-nav { padding: 4px 10px 16px; gap: 0; }
html .nav-group { padding-top: 16px; gap: 1px; }
html .nav-group:first-child { padding-top: 4px; }
html .nav-group-label {
  padding: 0 8px 4px; font-size: 11.5px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text-faint);
}
html .nav-link {
  gap: 9px; padding: 6px 8px; border-radius: var(--ctl); color: #4B5563;
  border: 1px solid transparent;
}
html .nav-icon { width: 15px; height: 15px; color: #9CA3AF; transition: color 0.12s; }
html .nav-label { font-size: 13px; font-weight: 450; }
html .nav-link:hover { background: rgba(17, 24, 39, 0.045); color: var(--text); }
html .nav-link:hover .nav-icon { color: #6B7280; }
html .nav-link.active {
  background: var(--surface); color: var(--text); border-color: var(--line); box-shadow: var(--shadow-xs);
}
html .nav-link.active .nav-label { font-weight: 550; }
html .nav-link.active .nav-icon { color: var(--accent); }
html .nav-badge { background: var(--accent); }

html .sidebar-footer { padding: 10px 10px 14px; border-top: 0; }
html .sidebar-user,
html .client-badge {
  padding: 7px 8px; margin-bottom: 4px; border-radius: var(--ctl);
  background: transparent; border: 1px solid transparent; box-shadow: none;
}
html .client-badge { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-xs); }
html .sidebar-user-avatar { width: 26px; height: 26px; background: #E5E7EB; color: #374151; }
html .client-badge-avatar { width: 26px; height: 26px; border-radius: 6px; background: var(--brand); font-size: 10px; }
html .client-badge-name { color: var(--text); font-weight: 550; }
html .sidebar-logout { padding: 6px 8px; border-radius: var(--ctl); color: var(--text-soft); font-weight: 450; }
html .sidebar-logout:hover { background: rgba(220, 38, 38, 0.07); color: #B91C1C; }

/* ── Cabecera de pagina ── */
html .panel-section { padding: 0 32px 40px; }
html .page-header {
  align-items: center; margin: 0 -32px 24px; padding: 22px 32px 18px; border-bottom: 1px solid var(--line-soft);
}
html .page-breadcrumb {
  font-size: 12px; font-weight: 450; letter-spacing: 0; text-transform: lowercase; color: var(--text-faint); margin-bottom: 4px;
}
html .page-breadcrumb::first-letter { text-transform: uppercase; }
html .page-title { font-size: 21px; font-weight: 600; letter-spacing: -0.022em; margin-bottom: 3px; color: var(--text); }
html .page-subtitle { font-size: 13px; color: var(--text-soft); max-width: 82ch; }
html .page-header-actions { padding-top: 0; gap: 8px; }

/* ── Botones ── */
html :is(.btn-primary, .btn-save, .btn-outline, .ghost-btn, .soft-btn, .run-btn, .picker-btn, .tarifas-btn, .access-btn) {
  min-height: 32px; padding: 0 12px; border-radius: var(--ctl); font-size: 13px; font-weight: 500;
}
html :is(.btn-primary, .run-btn) {
  background: var(--brand); color: #FFF;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 1px 2px rgba(23, 50, 66, 0.25);
}
html :is(.btn-primary, .run-btn):hover { background: var(--brand-2); }
html :is(.btn-save, .btn-outline, .ghost-btn, .picker-btn, .tarifas-btn, .access-btn) {
  border: 1px solid var(--line); background: var(--surface); color: #374151; box-shadow: var(--shadow-xs);
}
html :is(.btn-save, .btn-outline, .ghost-btn, .picker-btn, .tarifas-btn, .access-btn):hover {
  background: var(--bg-accent); border-color: #D9DCE3; color: var(--text);
}
html .soft-btn { border: 1px solid #F3D0D0; background: #FFF; color: #B91C1C; box-shadow: var(--shadow-xs); }
html .soft-btn:hover { background: #FEF2F2; }
html .icon-action-btn { width: 28px; height: 28px; border-radius: 6px; }
html :is(button, a, summary, [role="tab"]):focus-visible { outline: none; box-shadow: var(--ring); }

/* ── Formularios ── */
html :is(input, select, textarea) {
  min-height: 34px; padding: 0 10px; border-radius: var(--ctl); border-color: var(--line);
  background: var(--surface); font-size: 13px; box-shadow: var(--shadow-xs);
}
html textarea { padding: 8px 10px; }
html :is(input, select, textarea):hover { border-color: #D9DCE3; }
html :is(input, select, textarea):focus { border-color: var(--accent); box-shadow: var(--ring); }
html :is(input[type="checkbox"], input[type="radio"]) { min-height: 0; box-shadow: none; accent-color: var(--accent); }
html :is(.field > span, .field-label) { font-size: 12.5px; font-weight: 500; color: #374151; }

html .list-search {
  min-height: 34px; padding: 0 10px; border-color: var(--line); border-radius: var(--ctl); background: var(--surface); box-shadow: var(--shadow-xs);
}
html .list-search:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
html .list-search :is(input, input:hover, input:focus) {
  border: 0; box-shadow: none; background: transparent; min-height: 32px; padding: 0;
}

/* ── Tarjetas: hairline, sin sombra (el lienzo ya es blanco) ── */
html :is(.panel-card, .summary-card, .dashboard-card, .rp-kpi, .b2b, .b2b-web, .st-card, .b2b-block, .b2b-mini) {
  border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: none; background: var(--surface);
}
html .panel-card { padding: 20px; }
html :is(.dashboard-card, .st-card):hover { border-color: #D9DCE3; box-shadow: var(--shadow-md); transform: none; }
html :is(.rp-empty, .b2b-empty, .message-box) { border-radius: var(--ctl); }
html :is(.section-head h3, .list-title, .upload-title, .dashboard-group-title, .b2b-title) { font-size: 14.5px; font-weight: 600; }
html :is(.summary-card span, .eyebrow, .b2b-list-title, .rp-kpi > span) {
  font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text-soft);
}
html :is(.summary-card strong, .rp-kpi > b, .b2b-mini-value, .b2b-hero-value, .b2b-who-pct) {
  font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.025em;
}

/* Dashboard B2B */

html .b2b-head { background: var(--surface); padding: 16px 20px; border-bottom-color: var(--line-soft); }
html .b2b-badge { width: 34px; height: 34px; border-radius: 8px; font-size: 11px; font-weight: 600; }
html .b2b-tabs { padding: 0 12px; border-bottom-color: var(--line-soft); }
html .b2b-tab { padding: 11px 10px 10px; font-weight: 450; }
html .b2b-tab.is-active { border-bottom-color: var(--text); font-weight: 550; }
html .b2b-mini-label { font-size: 12px; }
html :is(.dashboard-card-cta, .st-eyebrow) { color: var(--accent); }
html .st-card-more { background: var(--accent-soft); color: var(--accent); }

/* Replicas */
html .rp-kpi.is-run { border-color: var(--accent-line); background: var(--accent-soft); }
html .rp-log { border-radius: var(--ctl); background: #0F1720; border: 1px solid #1F2933; }
html .rp-seg { border-radius: var(--ctl); background: var(--bg-accent); border-color: var(--line); }
html .rp-seg button { border-radius: 5px; }
html .rp-seg button.is-on { box-shadow: var(--shadow-xs); }

/* ── Tablas ── */
html th {
  padding: 8px 12px; background: transparent; border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--text-soft);
}
html td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
html tbody tr:hover td { background: #FAFAFB; }
html .list-header { border-bottom: 0; padding-bottom: 12px; }
html .list-count { height: 20px; border: 0; border-radius: 999px; background: var(--primary-soft); color: var(--text-soft); font-weight: 500; }
html .entity-avatar { width: 28px; height: 28px; border-radius: 50%; background: #EEF0F3; color: #374151; font-size: 10.5px; font-weight: 600; }
html .entity-title { font-weight: 500; }

/* ── Pastillas ── */
html :is(.badge, .chip, .status-pill) {
  min-height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--line); background: var(--surface); color: #374151;
}
html .badge.success { border-color: var(--line); background: var(--surface); color: #374151; }
html .badge.success::before { background: #16A34A; width: 6px; height: 6px; }
html .badge.warn { border-color: var(--line); background: var(--surface); color: #374151; }
html .badge.warn::before { background: #DC2626; width: 6px; height: 6px; }
html :is(.b2b-status, .status-chip) { border-radius: 6px; font-weight: 500; }

/* ── Ventanas ── */
html .modal-overlay { background: rgba(17, 24, 39, 0.35); backdrop-filter: blur(3px); }
html .modal-card { border-radius: 12px; border-color: var(--line); box-shadow: var(--shadow-lg); }
html .modal-header { padding: 18px 20px 14px; border-bottom-color: var(--line-soft); }
html .modal-header h3 { font-size: 16px; font-weight: 600; }
html .modal-close-btn { width: 30px; height: 30px; border-radius: var(--ctl); border-color: var(--line); background: var(--surface); }
html .modal-footer { background: var(--surface-muted); border-top-color: var(--line-soft); }

/* ── Login ── */
html body.login-body { background: var(--app-bg); }
html .login-card { border-radius: 12px; border-color: var(--line); box-shadow: var(--shadow-md); }
html .login-card-header { background: none; border-bottom: 0; padding-bottom: 6px; }
html .login-eyebrow { border-radius: 6px; padding: 5px 9px; background: var(--accent-soft); color: var(--accent); text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 12px; }
html .login-title { font-size: 26px; font-weight: 600; letter-spacing: -0.025em; color: var(--text); }
html .login-description { font-size: 13.5px; }
html .login-field span { font-size: 12.5px; font-weight: 500; color: #374151; }
html .login-input { min-height: 38px; border-radius: var(--ctl); }
html .login-input:focus { border-color: var(--accent); box-shadow: var(--ring); }
html .login-sidebar-panel { border-radius: var(--radius-xl); box-shadow: none; border-color: var(--line); }

/* ═══ Piezas nuevas ═══════════════════════════════════════════════════════ */

/* Colores de los graficos (Inicio y Estadisticas) */
html .panel-content,
html .b2b {
  --dash-actual: #173242; --dash-anterior: #d5dbe3; --dash-hoy: #2b6cb0; --dash-grid: #eef0f3;
  --dash-agente: #173242; --dash-cliente: #5b9bd5; --dash-track: var(--accent-soft); --b2b-ink: var(--brand);
}

/* Menu: cabecera con el cliente, buscador, contadores y usuario */
/* El menu hace scroll si no cabe: que nada se encoja */
html .panel-sidebar > * { flex-shrink: 0; }
html .panel-sidebar .sidebar-nav { flex: 1 0 auto; }
html .sidebar-logo-text { display: grid; min-width: 0; line-height: 1.25; }
html .sidebar-logo-sub { font-size: 12px; color: var(--text-faint); white-space: nowrap; }
html .side-search {
  display: flex; align-items: center; gap: 8px; width: calc(100% - 20px); height: 32px; margin: 0 10px 6px; padding: 0 8px 0 10px;
  border: 1px solid var(--line); border-radius: var(--ctl); background: var(--surface); box-shadow: var(--shadow-xs);
  color: var(--text-faint); font: inherit; font-size: 13px; cursor: pointer; text-align: left;
}
html .side-search:hover { border-color: #D9DCE3; color: var(--text-soft); }
html .side-search svg { width: 14px; height: 14px; flex-shrink: 0; }
html .side-search span { flex: 1; }
html .side-search kbd, html .qs-input kbd {
  font: 11px 'Geist Mono', ui-monospace, monospace; padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px; color: var(--text-faint); background: var(--surface);
}
html .nav-count { margin-left: auto; font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
html .nav-count[hidden] { display: none; }
html .nav-badge { margin-left: auto; }
html .sidebar-me { display: flex; align-items: center; gap: 4px; }
html .sidebar-me .sidebar-user { flex: 1; margin: 0; }
html .sidebar-me .sidebar-logout { width: 32px; height: 32px; padding: 0; justify-content: center; flex-shrink: 0; }

/* Barra superior del lienzo */
html .topbar {
  display: flex; align-items: center; gap: 12px; height: 50px; padding: 0 32px; border-bottom: 1px solid var(--line-soft);
}
html .page-breadcrumb { display: none; } /* la ubicacion va en la barra superior */
html .topbar-crumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-faint); }
html .topbar-crumb b { color: var(--text); font-weight: 550; }
html .topbar-sep { color: #D1D5DB; }
html .topbar-space { flex: 1; }
html .sync-chip, html .b2b-status {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border: 0; border-radius: 14px;
  font: inherit; font-size: 12px; font-weight: 500; white-space: nowrap;
}
html .sync-chip { cursor: pointer; }
html .sync-chip[hidden] { display: none; }
html .sync-chip i, html .b2b-status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
html .sync-chip.is-ok, html .b2b-status.is-ok { background: #E8F6F0; color: #12805C; }
html .sync-chip.is-ok i, html .b2b-status.is-ok i { box-shadow: 0 0 0 3px rgba(18, 128, 92, 0.15); }
html .sync-chip.is-warn, html .b2b-status.is-warn { background: #FEF3E2; color: #B45309; }
html .b2b-status:empty { display: none; }
html .panel-section .page-header { margin-top: 0; }

/* Inicio: cabecera con saludo, pestañas a todo el ancho y cuerpo sin tarjeta */
html .home-header { border-bottom: 0; padding-bottom: 14px; margin-bottom: 0; align-items: flex-end; }
html .home-header .page-title { font-size: 24px; }
html .home-header .page-header-actions { gap: 10px; }
html .b2b { border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: visible; margin-bottom: 0; }
html .b2b-tabs { margin: 0 -32px 22px; padding: 0 22px; border-bottom: 1px solid var(--line); gap: 2px; }
html .b2b-tab { padding: 10px 10px 11px; margin-bottom: -1px; color: var(--text-soft); }
html .b2b-tab.is-active { color: var(--text); border-bottom-color: var(--brand); }
html .b2b-body { padding: 0; }
html .b2b-panel.is-active { display: grid; gap: 20px; }
html .b2b-note { margin: -8px 0 0; color: var(--text-faint); font-size: 12px; }
html .b2b-year { min-width: 96px; }

/* Cifras clave en una franja */
html .home-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-xl); overflow: hidden; }
html .home-kpi { display: grid; gap: 7px; padding: 16px 20px 14px; min-width: 0; }
html .home-kpi + .home-kpi { border-left: 1px solid var(--line); }
html .home-kpi-label { font-size: 12.5px; font-weight: 500; color: var(--text-soft); }
html .home-kpi-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
html .home-kpi-value { font-size: 27px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
html .home-kpi-value small { font-size: 15px; font-weight: 500; color: var(--text-faint); margin-left: 3px; letter-spacing: 0; }
html .home-kpi em { font-style: normal; font-size: 12px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html .home-spark { flex-shrink: 0; }
html .home-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 6px; font-size: 12px; font-weight: 550; white-space: nowrap; flex-shrink: 0; }
html .home-chip.is-up { background: #E8F6F0; color: #12805C; }
html .home-chip.is-down { background: #FDF0E8; color: #C2410C; }
html .home-chip.is-flat { background: var(--primary-soft); color: var(--text-soft); }
html .home-meter { width: 88px; height: 6px; border-radius: 3px; background: var(--accent-soft); overflow: hidden; flex-shrink: 0; }
html .home-meter span { display: block; height: 100%; border-radius: 3px; background: var(--brand); }

/* Tarjetas de Inicio */
html .home-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 20px; align-items: stretch; }
html .home-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); min-width: 0; }
html .home-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
html .home-card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
html .home-card-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-faint); }
html .home-card-body { flex: 1; display: flex; flex-direction: column; padding: 14px 20px 18px; }
html .home-card-body--flush { display: block; padding: 10px 0 4px; }
html .home-link { border: 0; background: none; padding: 4px 0; font: inherit; font-size: 12.5px; font-weight: 500; color: var(--accent); cursor: pointer; }
html .home-link:hover { text-decoration: underline; text-underline-offset: 3px; }
html .dash-chart { height: 240px; }
html .home-card .dash-chart { flex: 1; height: auto; min-height: 240px; }
html .dash-legend { gap: 14px; font-size: 12px; color: var(--text-soft); }
html .dash-key i { width: 9px; height: 9px; border-radius: 3px; }
html .dash-tip { border-radius: 8px; border: 0; background: #0F1720; color: #E5E7EB; box-shadow: var(--shadow-md); font-size: 12px; }
html .dash-tip strong { color: #FFFFFF; }
html .dash-tip-row i { height: 8px; width: 8px; border-radius: 2px; }
html .dash-chart .dash-band.is-hover { fill: rgba(17, 24, 39, 0.035); }
html .dash-table-toggle { margin-top: 6px; }

/* ¿Quien hace los pedidos? */
html .home-who { display: flex; align-items: center; gap: 18px; }
html .home-donut { position: relative; flex-shrink: 0; }
html .home-donut > div { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
html .home-donut b { display: block; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text); }
html .home-donut small { font-size: 11.5px; color: var(--text-faint); }
html .home-who-list { display: grid; gap: 12px; flex: 1; min-width: 0; }
html .home-who-row { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 8px; align-items: center; }
html .home-who-row > i { width: 9px; height: 9px; border-radius: 3px; }
html .home-who-name { color: #475467; font-weight: 500; display: flex; align-items: center; gap: 6px; }
html .home-who-pct { font-weight: 600; font-variant-numeric: tabular-nums; }
html .home-who-meta { grid-column: 2 / -1; font-size: 12px; color: var(--text-faint); }
html .home-foot { margin: 12px 0 0; font-size: 12px; color: var(--text-faint); }
html .home-sync { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line-soft); display: grid; gap: 2px; }
html .home-sync[hidden] { display: none; }
html .home-sync-title { margin: 0 0 6px; font-size: 12px; font-weight: 500; color: var(--text-soft); }
html .home-sync-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 9px; align-items: center; width: 100%; padding: 5px 6px; margin: 0 -6px;
  border: 0; border-radius: 6px; background: none; font: inherit; color: #475467; text-align: left; cursor: pointer; box-sizing: content-box;
}
html .home-sync-row:hover { background: var(--bg-accent); }
html .home-sync-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html .home-sync-row i { width: 7px; height: 7px; border-radius: 50%; background: #D1D5DB; }
html .home-sync-row i.is-ok { background: #12805C; }
html .home-sync-row i.is-fail { background: #DC2626; }
html .home-sync-row em { font-style: normal; font: 11.5px 'Geist Mono', ui-monospace, monospace; color: var(--text-faint); white-space: nowrap; }

/* Ultimos pedidos */
html .home-table { width: 100%; min-width: 760px; border-collapse: collapse; }
html .home-table th { padding: 0 20px 8px; background: none; }
html .home-table td { padding: 10px 20px; color: #475467; }
html .home-table tr:last-child td { border-bottom: 0; }
html .home-table .is-num { text-align: right; }
html .home-table b { color: var(--text); font-weight: 550; }
html .home-who-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
html .home-who-cell b { display: block; }
html .home-who-cell small { color: var(--text-faint); font-size: 12px; }
html .home-avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: 11px; font-weight: 600; }
html .home-mono { font: 12px 'Geist Mono', ui-monospace, monospace; color: var(--text-faint); }
html .home-state { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; font-weight: 500; color: #374151; white-space: nowrap; }
html .home-state i { width: 6px; height: 6px; border-radius: 50%; background: #12805C; }
html .home-state.is-pend i { background: #E3A008; }
html .home-card-body--flush { overflow-x: auto; }

/* Pie del menu en una fila (paneles con diseno.js): usuario o cliente + salir solo con icono */
html .sidebar-footer--row { display: flex; align-items: center; gap: 4px; }
html .sidebar-footer--row > form { margin: 0; }
html .sidebar-footer--row .sidebar-user,
html .sidebar-footer--row .client-badge { flex: 1; min-width: 0; margin: 0; }
html .sidebar-footer--row:has(.sidebar-user:not([hidden])) .client-badge { display: none; }
html .sidebar-footer--row .sidebar-logout { width: 32px; height: 32px; padding: 0; justify-content: center; flex-shrink: 0; }
html .sidebar-footer--row .sidebar-logout span { display: none; }
html .client-badge-info { display: grid; min-width: 0; line-height: 1.25; }
html .client-badge-user { font-size: 12px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Piezas propias del panel de Pielsa */
html .btn {
  min-height: 32px; padding: 0 12px; border: 0; border-radius: var(--ctl); font-size: 13px; font-weight: 500;
  background: var(--brand); color: #FFF; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 1px 2px rgba(23, 50, 66, 0.25);
}
html .btn:hover { background: var(--brand-2); }
html :is(.toolbar-card, .table-card, .collapsible-card, .notice-card) {
  border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: none; background: var(--surface);
}
html .notice-card { box-shadow: var(--shadow-lg); }
html .table-card { overflow-x: auto; }
html .pill { border-radius: 6px; font-weight: 500; }
html .dashboard-card-icon { border-radius: 8px; }
html .file-zone { border-radius: var(--radius-xl); border-color: var(--line); background: var(--surface-muted); }
html .file-zone:hover { border-color: var(--accent); background: var(--accent-soft); }

/* Buscador rapido */
html .qs-overlay { position: fixed; inset: 0; z-index: 400; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; background: rgba(17, 24, 39, 0.3); backdrop-filter: blur(2px); }
html .qs-overlay[hidden] { display: none; }
html .qs { width: min(560px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; }
html .qs-input { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line-soft); color: var(--text-faint); }
html .qs-input svg { width: 16px; height: 16px; flex-shrink: 0; }
html .qs-input input, html .qs-input input:focus, html .qs-input input:hover { flex: 1; min-height: 48px; border: 0; box-shadow: none; padding: 0; font-size: 14px; background: transparent; }
html .qs-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
html .qs-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: #374151; cursor: pointer; }
html .qs-item .nav-icon { width: 15px; height: 15px; color: var(--text-faint); display: block; }
html .qs-item span { flex: 1; }
html .qs-item small { font-size: 11.5px; color: var(--text-faint); }
html .qs-item.is-sel { background: var(--accent-soft); color: var(--text); }
html .qs-item.is-sel .nav-icon { color: var(--accent); }
html .qs-empty { padding: 14px 10px; color: var(--text-faint); }

@media (max-width: 1100px) {
  html .home-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html .home-kpi:nth-child(3) { border-left: 0; }
  html .home-kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  html .home-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  /* Movil y tablet: el menu pasa arriba, en filas, y el lienzo ocupa todo el ancho */
  html .panel-shell { grid-template-columns: minmax(0, 1fr); }
  html .panel-sidebar { position: static; height: auto; flex-direction: column; flex-wrap: nowrap; padding: 6px 0 8px; border-bottom: 1px solid var(--line); }
  html .sidebar-logo { padding: 10px 14px 8px; }
  html .side-search { width: calc(100% - 20px); }
  html .side-search kbd { display: none; }
  html .sidebar-nav { flex-direction: row; flex-wrap: wrap; padding: 4px 10px; gap: 2px 4px; }
  html .nav-group { flex-direction: row; flex-wrap: wrap; padding-top: 0; gap: 2px; }
  html .nav-group-label { display: none; }
  html .nav-link { width: auto; }
  html .nav-count { margin-left: 4px; }
  html .sidebar-footer { padding: 4px 10px 0; }
  html .panel-content { margin: 0; min-height: 0; border-radius: 0; border: 0; box-shadow: none; }
  html .topbar { padding: 0 16px; }
  html .sync-chip { max-width: 55vw; overflow: hidden; text-overflow: ellipsis; }
  html .panel-section { padding: 0 16px 32px; }
  html .page-header { margin: 0 -16px 20px; padding: 18px 16px 14px; flex-wrap: wrap; }
  html .home-header { margin-bottom: 0; }
  html .page-header, html .home-header { align-items: stretch; }
  html .page-header-actions { flex-wrap: wrap; }
  html .b2b-tabs { margin: 0 -16px 18px; padding: 0 8px; }
}
@media (max-width: 640px) {
  html .home-kpis { grid-template-columns: minmax(0, 1fr); }
  html .home-kpi + .home-kpi { border-left: 0; border-top: 1px solid var(--line); }
  html .home-who { flex-wrap: wrap; justify-content: center; }
  html .home-card-head { flex-wrap: wrap; }
}
}
