
/* ─── PRESULAB WEB · DESIGN SYSTEM v2 ──────────────────────────────────────
   Mejora visual global — Fase 3
   Paleta: verde pistacho · azul royal · negro · blanco
   ─────────────────────────────────────────────────────────────────────────── */


:root {
  --green:          #b7ff3c;
  --green-dark:     #8fd41a;
  --green-text:     #0f1115;
  --green-subtle:   #f0ffe0;
  --green-glow:     rgba(183,255,60,.22);
  --green-glow-md:  rgba(183,255,60,.38);

  --blue:           #1f57ff;
  --blue-dark:      #1640cc;
  --blue-subtle:    #eef3ff;
  --blue-glow:      rgba(31,87,255,.18);

  --red:            #dc2626;
  --red-subtle:     #fef2f2;
  --red-border:     #fecaca;

  --ink:            #0f1115;
  --ink-soft:       #1a2540;
  --text-primary:   #111827;
  --text-secondary: #4b5563;
  --text-muted:     #9ca3af;
  --border:         #e8ecf3;
  --border-soft:    #f4f7fc;
  --bg:             #f4f7fc;
  --card:           #ffffff;
  --hover-row:      #f8faff;

  --sidebar-w:        220px;
  --sidebar-bg:       #1a2540;
  --sidebar-hover:    #2a3347;
  --sidebar-active:   #1a3020;
  --sidebar-active-t: #b7ff3c;

  --radius:    12px;
  --radius-sm: 8px;
  --radius-xs: 5px;

  --shadow-sm:    0 1px 4px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 16px rgba(0,0,0,.09);
  --shadow-modal: 0 24px 64px rgba(0,0,0,.22), 0 4px 16px rgba(0,0,0,.1);

  --font-ui:      'DM Sans', sans-serif;
  --font-display: 'Outfit', sans-serif;
  --topbar-h:     60px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { font-size: 16px; }
body  {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a      { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: var(--font-ui); font-size: .9375rem; }

/* ── SHELL ──────────────────────────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }

/* ── SIDEBAR ────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 200;
  transition: transform .24s ease;
  box-shadow: 2px 0 16px rgba(0,0,0,.15);
}
.sidebar-logo {
  height: var(--topbar-h);
  padding: 0 18px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
  user-select: none;
}
.sidebar-logo img {
  display: block;
  max-width: 178px;
  width: 100%;
  height: auto;
  object-fit: contain;
}


.sidebar-section {
  padding: 20px 16px 5px;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.22);
}
.sidebar-nav { flex: 1; padding: 6px 0 12px; overflow-y: auto; }
.sidebar-nav::-webkit-scrollbar { width: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  color: rgba(255,255,255,.55);
  transition: background .14s, color .14s;
  user-select: none;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: rgba(255,255,255,.9);
}
.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-t);
  font-weight: 600;
  box-shadow: inset 3px 0 0 #b7ff3c;  /* línea verde izquierda como Holded */
}
.nav-icon { flex-shrink: 0; opacity: .55; transition: opacity .14s; }
.nav-item:hover  .nav-icon,
.nav-item.active .nav-icon { opacity: 1; }
.nav-item.soon   { opacity: .35; pointer-events: none; }
.badge-soon {
  margin-left: auto;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .04em;
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.3);
  padding: 2px 7px;
  border-radius: 20px;
}

/* CTA verde */
.sidebar-sep { height: 1px; background: rgba(255,255,255,.07); margin: 8px 12px 12px; flex-shrink: 0; }
.sidebar-cta { margin: 0 10px 16px; flex-shrink: 0; }
.sidebar-cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  background: var(--green);
  color: var(--green-text);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: background .15s, box-shadow .15s, transform .1s;
  box-shadow: 0 2px 8px rgba(183,255,60,.28);
}
.sidebar-cta-btn:hover {
  background: #c8ff60;
  box-shadow: 0 4px 18px var(--green-glow-md);
  transform: translateY(-1px);
}
.sidebar-cta-btn:active { transform: scale(.98); }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  font-size: .72rem;
  color: rgba(255,255,255,.18);
  text-align: center;
  flex-shrink: 0;
}

/* ── OVERLAY MÓVIL ──────────────────────────────────────────────────────── */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 199;
  opacity: 0;
  pointer-events: none;          /* ← FIX: no intercepta clicks cuando es invisible */
  transition: opacity .24s;
}
#sidebar-overlay.visible {
  pointer-events: auto;          /* ← solo activo cuando visible */
}

/* ── MAIN ───────────────────────────────────────────────────────────────── */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ── TOPBAR ─────────────────────────────────────────────────────────────── */
#topbar {
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
#menu-toggle {
  display: none;
  width: 36px; height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: background .14s;
}
#menu-toggle:hover { background: var(--border-soft); }
#page-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -.01em;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-badge {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  background: var(--green-subtle);
  color: #4a8a00;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(183,255,60,.4);
}

/* ── CONTENT ────────────────────────────────────────────────────────────── */
#content { padding: 32px 32px 64px; flex: 1; }

/* ── MODULE HEADER ──────────────────────────────────────────────────────── */
.module-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.module-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.2;
}
.module-sub { font-size: .85rem; color: var(--text-muted); margin-top: 4px; }

/* ── CARD ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* ── SEARCH ─────────────────────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.search-bar input {
  border: none; outline: none; flex: 1;
  font-size: .9rem; color: var(--text-primary); background: transparent;
}
.search-bar input::placeholder { color: var(--text-muted); }

/* ── TABLE ──────────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 11px 20px;
  text-align: left;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--border-soft);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 13px 20px;
  border-bottom: 1px solid var(--border-soft);
  font-size: .875rem;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover { background: var(--hover-row); }

.cell-name  { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--blue-subtle);
  color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: .78rem; font-weight: 700;
  flex-shrink: 0;
}
.avatar-green   { background: var(--green-subtle); color: #4a8a00; }
.avatar-product { background: #ede9fe; color: #6d28d9; }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.link { color: var(--blue); transition: color .14s; }
.link:hover { color: var(--blue-dark); text-decoration: underline; }
.col-actions  { width: 110px; text-align: right; }
.col-price    { width: 130px; text-align: right; }
.product-name { font-weight: 500; }

/* ── ESTADOS ────────────────────────────────────────────────────────────── */
.loading-state, .empty-state, .error-state {
  padding: 60px 24px;
  text-align: center;
  color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; font-size: .9rem; line-height: 1.65;
}
.error-state { color: var(--red); }
.spinner {
  width: 26px; height: 26px;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── BOTONES ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: .875rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  transition: background .14s, box-shadow .14s, transform .1s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--green);
  color: var(--green-text);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(34,197,94,.25);
  transition: background .15s, box-shadow .15s, transform .1s;
}
.btn-primary:hover:not(:disabled) {
  background: #c8ff60;
  box-shadow: 0 0 0 3px rgba(34,197,94,.25), 0 4px 20px rgba(34,197,94,.35);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--border-soft); border-color: #cdd5e0; }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-icon {
  padding: 6px 7px;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  border: 1.5px solid transparent;
  transition: background .14s, color .14s, border-color .14s, box-shadow .14s;
}
.btn-icon:hover {
  background: var(--blue-subtle);
  color: var(--blue);
  border-color: #c7d8ff;
  box-shadow: 0 0 0 3px rgba(31,87,255,.15);
}
.btn-icon.btn-icon-green:hover {
  background: var(--green-subtle);
  color: #16a34a;
  border-color: rgba(34,197,94,.4);
  box-shadow: 0 0 0 3px rgba(34,197,94,.18);
}
.btn-icon-danger:hover {
  background: var(--red-subtle);
  color: var(--red);
  border-color: var(--red-border);
  box-shadow: none;
}
.btn-sm { padding: 6px 12px; font-size: .8rem; }

.btn-link {
  background: none; border: none; padding: 0;
  font: inherit; font-weight: 500;
  color: var(--blue); cursor: pointer; text-align: left;
  transition: color .14s;
}
.btn-link:hover { color: var(--blue-dark); text-decoration: underline; }

/* ── MODAL ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,17,21,.55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .15s ease;
}
.modal-overlay.hidden { display: none; }

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 560px;
  animation: slideUp .2s ease;
  overflow: hidden;
}
.modal-sm { max-width: 380px; padding: 28px 28px 24px; overflow: visible; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-sm .modal-header { padding: 0; border: none; margin-bottom: 10px; }
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.02em;
}
.modal-close {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  transition: background .14s, color .14s;
}
.modal-close:hover { background: var(--border-soft); color: var(--text-primary); }

.confirm-text { font-size: .9rem; color: var(--text-secondary); margin-bottom: 22px; line-height: 1.55; }

/* ── FORMULARIO ─────────────────────────────────────────────────────────── */
#client-form, #budget-form, #product-form {
  padding: 24px 28px 28px;
  display: flex; flex-direction: column; gap: 18px;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: .8rem; font-weight: 600; color: var(--text-secondary); letter-spacing: .01em; }
.required { color: var(--red); }

.form-group input,
.form-group textarea,
.form-group select {
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--text-primary);
  background: var(--card);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.form-group textarea { resize: vertical; }
.form-group select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%239CA3AF' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
  cursor: pointer;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-glow);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); }
.input-disabled { background: var(--border-soft) !important; color: var(--text-secondary) !important; cursor: default; }
.form-error {
  padding: 10px 14px;
  background: var(--red-subtle);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-sm);
  color: var(--red); font-size: .84rem;
}
.form-error.hidden { display: none; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }

/* ── STATUS BADGES ──────────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem; font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
  text-transform: uppercase;
}
.status-badge::before {
  content: ''; width: 5px; height: 5px;
  border-radius: 50%; background: currentColor; flex-shrink: 0;
}
.status-draft    { background: #f3f4f6; color: #6b7280; }
.status-sent     { background: var(--blue-subtle); color: var(--blue); }
.status-accepted { background: var(--green-subtle); color: #4a8a00; }
.status-rejected { background: var(--red-subtle); color: var(--red); }

/* ── DISCOUNT BADGE ─────────────────────────────────────────────────────── */
.discount-badge {
  display: inline-block;
  padding: 2px 7px;
  background: var(--green-subtle);
  color: #4a8a00;
  border-radius: 20px;
  font-size: .72rem; font-weight: 700;
}

/* ── SKELETON ───────────────────────────────────────────────────────────── */
.skeleton-line {
  height: 16px;
  background: linear-gradient(90deg, var(--border) 25%, var(--border-soft) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}
.w-180 { width: 180px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── EDITOR DE PRESUPUESTO ───────────────────────────────────────────────── */
.ed-topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.ed-header-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ed-budget-title {
  font-family: var(--font-display);
  font-size: 1.15rem; font-weight: 700;
  color: var(--text-primary); letter-spacing: -.02em;
}

.ed-layout { display: grid; grid-template-columns: 1fr 280px; gap: 20px; align-items: start; }
.ed-main    { min-width: 0; }
.ed-sidebar { display: flex; flex-direction: column; gap: 16px; }

.ed-card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--border-soft);
}
.ed-card-label { font-size: .72rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }

.lines-table th.col-num,
.lines-table td.col-num { width: 90px; text-align: right; }
.lines-table th.col-del,
.lines-table td.col-del { width: 44px; text-align: center; }
.lines-table td.line-name { font-weight: 500; }

.ed-add-section {
  border-top: 1px solid var(--border);
  padding: 16px 20px 20px;
  background: var(--border-soft);
}
.ed-add-title { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px; }
.ed-add-form  { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.ed-add-field { display: flex; flex-direction: column; gap: 5px; }
.ed-add-field label { font-size: .75rem; font-weight: 600; color: var(--text-secondary); }
.ed-add-field input,
.ed-add-field select {
  padding: 8px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  color: var(--text-primary);
  background: var(--card);
  transition: border-color .15s, box-shadow .15s;
}
.ed-add-field input:focus,
.ed-add-field select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-glow);
}
.ed-add-field input::placeholder { color: var(--text-muted); }
.ed-add-field select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' fill='none' stroke='%239CA3AF' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}
.ed-f-picker  { width: 180px; flex-shrink: 0; }
.ed-f-name    { flex: 2; min-width: 160px; }
.ed-f-qty     { width: 82px; }
.ed-f-price   { width: 105px; }
.ed-f-disc    { width: 82px; }
.ed-f-preview { width: 110px; }
.ed-f-btn     { flex-shrink: 0; }
.ed-preview-total { background: #eef3fb !important; color: var(--text-secondary) !important; cursor: default; font-weight: 600; }

.ed-meta-header {
  padding: 12px 18px;
  background: var(--border-soft);
  border-bottom: 1px solid var(--border);
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted);
}
.ed-meta-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.w-full { width: 100%; justify-content: center; }

.ed-totals-card { padding: 18px; }
.ed-total-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; font-size: .9rem; color: var(--text-secondary);
  border-bottom: 1px solid var(--border-soft);
}
.ed-total-row:last-child { border-bottom: none; }
.ed-total-grand { font-size: 1rem; color: var(--text-primary); padding-top: 12px; margin-top: 4px; }
.ed-total-grand strong { font-size: 1.2rem; color: var(--blue); }

/* ── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); box-shadow: var(--shadow-modal); }
  #sidebar-overlay { display: block; }
  #sidebar-overlay.visible { opacity: 1; }
  #main { margin-left: 0; }
  #menu-toggle { display: flex; }
  #content { padding: 20px 16px 48px; }
  .module-header { flex-direction: column; align-items: stretch; }
  .module-header .btn { width: 100%; padding: 13px 18px; font-size: .95rem; }
  .form-row { grid-template-columns: 1fr; gap: 12px; }
  .data-table th:nth-child(2), .data-table td:nth-child(2),
  .data-table th:nth-child(4), .data-table td:nth-child(4) { display: none; }
}
@media (max-width: 900px) {
  .ed-layout { grid-template-columns: 1fr; }
  .ed-sidebar { flex-direction: row; flex-wrap: wrap; }
  .ed-meta-card, .ed-totals-card { flex: 1; min-width: 240px; }
}
@media (max-width: 640px) {
  .ed-add-form { flex-direction: column; }
  .ed-add-field { width: 100% !important; }
  .ed-f-btn .btn, .ed-f-picker { width: 100%; }
  .lines-table th:nth-child(4), .lines-table td:nth-child(4),
  .lines-table th:nth-child(5), .lines-table td:nth-child(5) { display: none; }
}
@media (max-width: 480px) {
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal, .modal-sm { border-radius: var(--radius) var(--radius) 0 0; max-height: 92vh; overflow-y: auto; }
}

/* ── FASE 4 — PRESUPUESTOS ENRIQUECIDOS ─────────────────────────────────────*/

/* Número de documento (PRE-0001) */
.doc-number {
  display: inline-block;
  font-family: var(--font-display);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--blue);
  background: var(--blue-subtle);
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid #c7d8ff;
}

/* Columna Nº Doc en tabla */
.col-docnum { width: 96px; }

/* Modal más ancho para presupuestos (tiene más campos) */
.modal-wide { max-width: 640px; }

/* Badge de número en el header del modal */
.budget-number-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: .78rem;
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-subtle);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid #c7d8ff;
  margin-left: 8px;
  vertical-align: middle;
}
.budget-number-badge.hidden { display: none; }

/* Fila descuento global en meta del editor */
.discount-row {
  display: flex;
  gap: 8px;
}
.discount-row input {
  flex: 1;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--text-primary);
  background: var(--card);
  transition: border-color .15s, box-shadow .15s;
}
.discount-row input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-glow);
}
.discount-row select {
  width: 70px;
  flex-shrink: 0;
  padding: 10px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--card);
  appearance: none;
  -webkit-appearance: none;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s;
}
.discount-row select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-glow);
}

/* Fila de descuento en panel de totales */
#ed-discount-row { color: var(--red); }

/* ── FASE 5 — CLIENTES ENRIQUECIDOS ─────────────────────────────────────────*/

/* Contador de presupuestos en la tabla */
.budget-count {
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 500;
}
.budget-count--has {
  color: var(--blue);
  font-weight: 600;
}

/* Ficha de cliente (modal detalle) */
.client-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 32px;
  padding-top: 8px;
}

.client-detail-col { display: flex; flex-direction: column; gap: 0; }

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.detail-field:last-child { border-bottom: none; }

.detail-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.detail-value {
  font-size: .9rem;
  color: var(--text-primary);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Icono de candado en label de notas internas */
.form-group label svg { opacity: .55; }

@media (max-width: 600px) {
  .client-detail-grid { grid-template-columns: 1fr; }
}

/* ── FASE 6 — EDITOR DE PRODUCTO (TARJETAS) ─────────────────────────────────*/

/* Header zona productos */
.ed-products-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--border-soft);
}

/* Tarjeta de producto */
.product-card {
  border-bottom: 1px solid var(--border-soft);
  transition: background .1s;
}
.product-card:last-child { border-bottom: none; }
.product-card:hover { background: var(--hover-row); }

/* Cabecera de la tarjeta */
.pc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  flex-wrap: nowrap;
}

/* Toggle expand */
.pc-toggle {
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color .14s;
}
.pc-toggle:hover { color: var(--blue); }
.pc-chevron { transition: transform .2s ease; }

/* Bloque título */
.pc-title-block {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.pc-num {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: .7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pc-name-wrap { min-width: 0; }
.pc-name {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.pc-desc {
  display: block;
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.pc-color-badge {
  flex-shrink: 0;
  font-size: .72rem;
  font-weight: 600;
  background: var(--border-soft);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

/* Campos inline (precio, cantidad, dto) */
.pc-inline-fields {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.pc-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pc-field label {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.pc-inline-input {
  width: 76px;
  padding: 6px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: .85rem;
  font-family: var(--font-ui);
  color: var(--text-primary);
  background: var(--card);
  transition: border-color .14s, box-shadow .14s;
}
.pc-inline-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px var(--green-glow);
}

/* Total de la línea */
.pc-total {
  flex-shrink: 0;
  text-align: right;
  min-width: 90px;
}
.pc-total-label {
  display: block;
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.pc-total-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--blue);
  font-family: var(--font-display);
}

/* Acciones */
.pc-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* Cuerpo expandible */
.pc-body {
  padding: 10px 20px 14px 56px;
  background: var(--border-soft);
  border-top: 1px solid var(--border-soft);
}
.pc-body-row {
  display: flex;
  gap: 12px;
  padding: 5px 0;
  font-size: .85rem;
  border-bottom: 1px solid var(--border-soft);
}
.pc-body-row:last-child { border-bottom: none; }
.pc-body-label {
  flex-shrink: 0;
  width: 90px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-top: 1px;
}
.pc-body-value { color: var(--text-primary); line-height: 1.5; }
.pc-body-empty { font-size: .82rem; color: var(--text-muted); font-style: italic; padding: 4px 0; }

/* ── TOTALES OSCUROS (estilo desktop) ────────────────────────────────────── */
.ed-totals-dark {
  background: #1a2540;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.edt-header {
  padding: 14px 18px 10px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.edt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  font-size: .875rem;
  color: rgba(255,255,255,.6);
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.edt-row:last-child { border-bottom: none; }
.edt-row--discount { color: #fca5a5; }

.edt-sep {
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: 4px 0;
}

.edt-total-box {
  padding: 16px 18px 20px;
}
.edt-total-label {
  display: block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  margin-bottom: 4px;
}
.edt-total-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--green);
  letter-spacing: -.02em;
}

/* Responsive tarjetas */
@media (max-width: 640px) {
  .pc-header { flex-wrap: wrap; gap: 8px; }
  .pc-inline-fields { order: 3; width: 100%; }
  .pc-inline-input  { flex: 1; width: auto; }
  .pc-total   { order: 4; }
  .pc-actions { order: 2; margin-left: auto; }
  .pc-body    { padding-left: 16px; }
}

/* ── FASE 7 — TÉCNICAS ───────────────────────────────────────────────────────*/

/* Layout dos columnas */
.tech-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  align-items: start;
}

/* Columna izquierda */
.tech-aside {
  background: var(--sidebar-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.tech-aside-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.tech-aside-title {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
}

.tech-list { padding: 8px; }

.tech-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s;
  border: 1px solid transparent;
}
.tech-list-item:hover  { background: rgba(255,255,255,.06); }
.tech-list-item.active {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.12);
}

.tech-dot {
  flex-shrink: 0;
  width: 10px; height: 10px;
  border-radius: 50%;
}

.tech-list-info { flex: 1; min-width: 0; }

.tech-list-name {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: rgba(255,255,255,.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tech-list-notes {
  display: block;
  font-size: .75rem;
  color: rgba(255,255,255,.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tech-seri-tag {
  flex-shrink: 0;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: rgba(31,87,255,.25);
  color: #93c5fd;
  padding: 2px 6px;
  border-radius: 20px;
}

.tech-list-empty {
  padding: 32px 16px;
  text-align: center;
  color: rgba(255,255,255,.3);
  font-size: .85rem;
  line-height: 1.6;
}

/* Editor derecho */
.tech-editor { min-width: 0; }

.tech-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 300px;
  color: var(--text-muted);
  font-size: .9rem;
  text-align: center;
  line-height: 1.6;
  padding: 40px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.tech-editor-inner { display: flex; flex-direction: column; }

/* Data card */
.tech-data-card { overflow: visible; }
.tech-data-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--border-soft);
}

.tech-color-preview {
  width: 20px; height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(0,0,0,.08);
}

.tech-data-title {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex: 1;
}

.tech-data-body {
  padding: 20px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Color picker */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.color-hex-input {
  width: 110px;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: .875rem;
  color: var(--text-primary);
  background: var(--card);
  transition: border-color .15s, box-shadow .15s;
}
.color-hex-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-glow);
}

.color-dots-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.color-dot-btn {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.color-dot-btn:hover { transform: scale(1.2); }
.color-dot-btn.active {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px currentColor;
  transform: scale(1.15);
}

/* Checkbox custom */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: .9rem;
  color: var(--text-primary);
  user-select: none;
}
.checkbox-native { display: none; }
.checkbox-custom {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  position: relative;
  transition: background .14s, border-color .14s;
}
.checkbox-native:checked + .checkbox-custom {
  background: var(--blue);
  border-color: var(--blue);
}
.checkbox-native:checked + .checkbox-custom::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 6px; height: 10px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}
.checkbox-hint { font-size: .8rem; color: var(--text-muted); }

/* Serigraphy defaults block */
.seri-defaults-block {
  padding: 16px;
  background: var(--blue-subtle);
  border: 1px solid #c7d8ff;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.seri-defaults-block.hidden { display: none; }

.seri-block-label {
  font-size: .82rem;
  font-weight: 700;
  color: var(--blue);
}

.seri-hint {
  font-size: .78rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* Precio save ok */
.save-ok-msg {
  margin-left: 12px;
  font-size: .85rem;
  font-weight: 600;
  color: #4a8a00;
}
.save-ok-msg.hidden { display: none; }

/* Price table */
.tp-table { min-width: 0; }
.tp-table th, .tp-table td { padding: 9px 14px; }

.tp-input {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: .875rem;
  font-family: var(--font-ui);
  color: var(--text-primary);
  background: var(--card);
  transition: border-color .14s, box-shadow .14s;
}
.tp-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px var(--green-glow);
}

.tp-narrow { width: 90px; }
.tp-price  { width: 100px; font-weight: 600; }
.tp-col-size  { width: 110px; }
.tp-col-price { width: 120px; }

.tech-prices-empty {
  padding: 28px 20px;
  font-size: .85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Responsive */
@media (max-width: 900px) {
  .tech-layout { grid-template-columns: 1fr; }
  .tech-aside  { background: var(--card); border: 1px solid var(--border); }
  .tech-aside-header { background: var(--border-soft); }
  .tech-list-item { background: var(--border-soft); }
  .tech-list-item:hover  { background: var(--hover-row); }
  .tech-list-item.active { background: var(--blue-subtle); border-color: #c7d8ff; }
  .tech-aside-title { color: var(--text-muted); }
  .tech-list-name   { color: var(--text-primary); }
  .tech-list-notes  { color: var(--text-muted); }
}

/* ── FASE 8 — DASHBOARD ─────────────────────────────────────────────────────*/

/* Header */
.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

/* KPI strip */
.dash-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.dash-kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--kpi-color, var(--blue));
  transition: box-shadow .14s, transform .12s;
}
.dash-kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.kpi-label {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.kpi-icon {
  font-size: 1.1rem;
  opacity: .6;
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--kpi-color, var(--blue));
  letter-spacing: -.03em;
  line-height: 1;
}
.kpi-hint {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 5px;
}

/* Skeleton loaders */
.dash-kpi-skeleton {
  height: 96px;
  background: linear-gradient(90deg, var(--border) 25%, var(--border-soft) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}

/* Charts grid */
.dash-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.dash-chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-chart-title {
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.01em;
}
.dash-chart-sub {
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.dash-chart-wrap {
  position: relative;
  height: 200px;
}
.dash-chart-wrap--sm { height: 220px; }

/* Benefit card */
.dash-benefit-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-benefit-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  margin-top: 8px;
}

.benefit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.benefit-row:last-of-type { border-bottom: none; }
.benefit-row--total { padding-top: 14px; }

.benefit-label {
  font-size: .875rem;
  color: var(--text-secondary);
}
.benefit-value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.01em;
}
.benefit-total {
  font-size: 1.4rem;
}

.benefit-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.benefit-hint {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.5;
}

/* Dashboard tabla recientes */
#dash-recent-table .data-table th:nth-child(3),
#dash-recent-table .data-table td:nth-child(3) { /* cliente visible */ }

/* Responsive */
@media (max-width: 900px) {
  .dash-kpis        { grid-template-columns: 1fr 1fr; }
  .dash-charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .dash-kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-value { font-size: 1.3rem; }
  #dash-recent-table .data-table th:nth-child(3),
  #dash-recent-table .data-table td:nth-child(3),
  #dash-recent-table .data-table th:nth-child(5),
  #dash-recent-table .data-table td:nth-child(5) { display: none; }
}

/* ── MEJORAS VISUALES — Fase Fix ─────────────────────────────────────────────
   Glow verde, hover SaaS, modales respirados                                 */

/* Glow verde en inputs al hacer focus */
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.ed-add-field input:focus,
.ed-add-field select:focus,
.tp-input:focus,
.color-hex-input:focus,
.pc-inline-input:focus,
.discount-row input:focus,
.discount-row select:focus {
  outline: none;
  border-color: #22c55e !important;
  box-shadow: 0 0 0 3px rgba(34,197,94,.18) !important;
}

/* Sidebar CTA — glow verde intenso */
.sidebar-cta-btn {
  background: #22c55e;
  color: #0a1a0a;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(34,197,94,.3);
  transition: all .18s ease;
}
.sidebar-cta-btn:hover {
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(34,197,94,.25), 0 6px 20px rgba(34,197,94,.4);
  transform: translateY(-1px);
}

/* Botón primario — verde #22c55e */
.btn-primary {
  background: #22c55e !important;
  color: #0a1a0a !important;
  font-weight: 700;
}
.btn-primary:hover:not(:disabled) {
  background: #16a34a !important;
  box-shadow: 0 0 0 3px rgba(34,197,94,.22), 0 4px 18px rgba(34,197,94,.35) !important;
}

/* Hover row en tablas — sutil */
.data-table tbody tr:hover { background: #f7fef9; }

/* Modal — más aire y sombra más pronunciada */
.modal {
  box-shadow: 0 24px 80px rgba(0,0,0,.22), 0 2px 12px rgba(0,0,0,.08);
}
.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

/* Card hover sutil */
.card {
  transition: box-shadow .16s;
}

/* KPI cards hover */
.dash-kpi-card:hover {
  box-shadow: 0 0 0 2px rgba(34,197,94,.2), 0 8px 24px rgba(0,0,0,.1);
}

/* Botón ghost con hover verde */
.btn-ghost:hover:not(:disabled) {
  background: #f0fdf4;
  border-color: rgba(34,197,94,.4);
  color: #16a34a;
}

/* Badge doc-number */
.doc-number {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
}

/* Status badge más legible */
.status-badge {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 3px 10px;
}

/* Producto card total en verde */
.pc-total-value { color: #16a34a; }

/* Totals dark panel - total en verde #22c55e */
.edt-total-value { color: #22c55e; }

/* Scrollbar thin */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── PLACEHOLDER + FIXES FINALES ────────────────────────────────────────────*/

/* Vista placeholder para módulos en preparación */
.placeholder-view {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  min-height:380px; padding:60px 32px; text-align:center;
  background:var(--card); border:1px solid var(--border);
  border-radius:var(--radius); box-shadow:var(--shadow-sm);
}
.placeholder-icon  { font-size:3rem; margin-bottom:20px; display:block; }
.placeholder-title { font-family:var(--font-display); font-size:1.3rem; font-weight:700;
                     color:var(--text-primary); letter-spacing:-.02em; margin-bottom:10px; }
.placeholder-body  { font-size:.9rem; color:var(--text-secondary); max-width:360px;
                     line-height:1.65; margin-bottom:20px; }

/* Nav activo — borde izquierdo verde */
.nav-item.active {
  background:var(--sidebar-active); color:var(--sidebar-active-t);
  font-weight:600; box-shadow:inset 3px 0 0 #22c55e;
}

/* Botón primario verde #22c55e */
.btn-primary { background:#22c55e!important; color:#052e16!important; font-weight:700; }
.btn-primary:hover:not(:disabled) {
  background:#16a34a!important;
  box-shadow:0 0 0 3px rgba(34,197,94,.2),0 4px 16px rgba(34,197,94,.3)!important;
}

/* CTA sidebar */
.sidebar-cta-btn { background:#22c55e; color:#052e16; font-weight:700;
                   box-shadow:0 2px 10px rgba(34,197,94,.28); }
.sidebar-cta-btn:hover { background:#16a34a;
  box-shadow:0 0 0 3px rgba(34,197,94,.2),0 6px 20px rgba(34,197,94,.35);
  transform:translateY(-1px); }

/* Focus verde en inputs */
.form-group input:focus,.form-group textarea:focus,.form-group select:focus,
.tp-input:focus,.pc-inline-input:focus,.ed-add-field input:focus,.ed-add-field select:focus,
.color-hex-input:focus,.discount-row input:focus,.discount-row select:focus {
  outline:none!important; border-color:#22c55e!important;
  box-shadow:0 0 0 3px rgba(34,197,94,.18)!important;
}

/* Overlay móvil — no intercepta clicks cuando invisible */
#sidebar-overlay { pointer-events:none; }
#sidebar-overlay.visible { pointer-events:auto; }

/* Hover tabla verde suave */
.data-table tbody tr:hover { background:#f0fdf4; }

/* Ghost button hover verde */
.btn-ghost:hover:not(:disabled) { background:#f0fdf4; border-color:rgba(34,197,94,.4); color:#16a34a; }

/* Scrollbar thin */
::-webkit-scrollbar { width:5px; height:5px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:#cbd5e1; border-radius:10px; }
::-webkit-scrollbar-thumb:hover { background:#94a3b8; }

/* Total verde */
.edt-total-value { color:#22c55e; }
.pc-total-value  { color:#16a34a; }
/* Dashboard KPIs */
.dash-kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:20px}
.dash-kpi-card{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);padding:18px 20px 16px;box-shadow:var(--shadow-sm);border-top:3px solid var(--kpi-color,var(--blue));transition:box-shadow .14s,transform .12s}
.dash-kpi-card:hover{box-shadow:0 0 0 2px rgba(34,197,94,.2),0 8px 24px rgba(0,0,0,.1);transform:translateY(-1px)}
.kpi-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.kpi-label{font-size:.75rem;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:var(--text-muted)}
.kpi-value{font-family:var(--font-display);font-size:1.65rem;font-weight:800;color:var(--kpi-color,var(--blue));letter-spacing:-.03em;line-height:1}
.dash-kpi-skeleton{height:96px;background:linear-gradient(90deg,var(--border) 25%,var(--border-soft) 50%,var(--border) 75%);background-size:200% 100%;animation:shimmer 1.4s infinite;border-radius:var(--radius)}
/* Placeholder */
.placeholder-view{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:380px;padding:60px 32px;text-align:center;background:var(--card);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow-sm)}
.placeholder-icon{font-size:3rem;margin-bottom:20px;display:block}
.placeholder-title{font-family:var(--font-display);font-size:1.3rem;font-weight:700;color:var(--text-primary);letter-spacing:-.02em;margin-bottom:10px}
.placeholder-body{font-size:.9rem;color:var(--text-secondary);max-width:360px;line-height:1.65;margin-bottom:20px}
/* Fixes */
.nav-item.active{background:var(--sidebar-active);color:var(--sidebar-active-t);font-weight:600;box-shadow:inset 3px 0 0 #22c55e}
.btn-primary{background:#22c55e!important;color:#052e16!important;font-weight:700}
.btn-primary:hover:not(:disabled){background:#16a34a!important;box-shadow:0 0 0 3px rgba(34,197,94,.2),0 4px 16px rgba(34,197,94,.3)!important}
.sidebar-cta-btn{background:#22c55e;color:#052e16;font-weight:700;box-shadow:0 2px 10px rgba(34,197,94,.28)}
.sidebar-cta-btn:hover{background:#16a34a;box-shadow:0 0 0 3px rgba(34,197,94,.2),0 6px 20px rgba(34,197,94,.35);transform:translateY(-1px)}
.form-group input:focus,.form-group textarea:focus,.form-group select:focus{outline:none!important;border-color:#22c55e!important;box-shadow:0 0 0 3px rgba(34,197,94,.18)!important}
#sidebar-overlay{pointer-events:none}
#sidebar-overlay.visible{pointer-events:auto}
.data-table tbody tr:hover{background:#f0fdf4}
.btn-ghost:hover:not(:disabled){background:#f0fdf4;border-color:rgba(34,197,94,.4);color:#16a34a}
::-webkit-scrollbar{width:5px;height:5px}
::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:10px}
.ed-custom-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px 10px;
  margin: 8px 0;
  background: var(--bg-subtle, #f9fafb);
}

.ed-custom-section-header {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pc-technique-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--accent-subtle, #ede9fe);
  color: var(--accent, #6d28d9);
}

.pc-option-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--warning-subtle, #fef3c7);
  color: var(--warning, #92400e);
}

.pc-has-option {
  border-left: 3px solid var(--warning, #f59e0b);
}

.pc-body-section {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle, #f0f0f0);
}

.pc-body-section:last-child {
  border-bottom: none;
}

.pc-body-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.pc-body-section--custom .pc-body-section-label {
  color: var(--accent, #6d28d9);
}

.pc-body-section--pricing .pc-body-section-label {
  color: var(--text-secondary);
}

.pc-body-value--highlight {
  font-weight: 600;
  color: var(--accent, #6d28d9);
}

.pc-body-value--discount {
  color: var(--danger, #dc2626);
}

.pc-body-value--total {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

.pc-body-row--total {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

/* ── Sidebar breakdown ── */
.edt-row--muted        { opacity: .75; font-size: 12px; }
.edt-row--custom span:last-child { color: var(--purple, #8b5cf6); }
.edt-row--neg   span:last-child  { color: var(--red, #ef4444); }

/* ── Modal secciones ── */
.ed-modal-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px 10px;
  margin: 8px 0;
}
.ed-modal-section--custom { background: var(--bg-subtle, #f8f7ff); border-color: var(--purple-border, #ddd6fe); }
.ed-modal-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); margin-bottom: 10px;
}
.ed-modal-section--custom .ed-modal-section-label { color: var(--purple, #7c3aed); }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 3px; display: block; }

/* ── Preview desglose ── */
.ed-price-preview-box {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 16px; background: var(--bg-subtle); margin: 8px 0;
}
.ed-ppb-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); padding: 2px 0; }
.ed-ppb-row--custom span:last-child { color: var(--purple, #7c3aed); }
.ed-ppb-row--disc   span:last-child { color: var(--red, #dc2626); }
.ed-ppb-sep  { border-top: 1px solid var(--border); margin: 6px 0; }
.ed-ppb-total { display: flex; justify-content: space-between; font-weight: 700; font-size: 14px; }
.ed-ppb-total span:last-child { color: var(--accent); }

/* ── Card: total prominente ── */
.pc-total-block { display: flex; flex-direction: column; align-items: flex-end; min-width: 90px; }
.pc-total-value { font-size: 15px; font-weight: 700; color: var(--accent); }
.pc-total-hint  { font-size: 10px; color: var(--purple, #8b5cf6); margin-bottom: 2px; }

/* ── Card: tallas ── */
.pc-sizes-strip { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 16px; border-bottom: 1px solid var(--border-subtle); }
.pc-sizes-label { font-size: 10px; font-weight: 700; color: var(--text-muted); margin-right: 4px; align-self: center; }
.pc-size-badge  { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--border); color: var(--text-secondary); }

/* ── Card: secciones del body ── */
.pc-section { padding: 10px 16px; border-bottom: 1px solid var(--border-subtle); }
.pc-section:last-child { border-bottom: none; }
.pc-section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 6px; }
.pc-section--custom .pc-section-label { color: var(--purple, #7c3aed); }
.pc-section--pricing .pc-section-label { color: var(--text-secondary); }
.pc-body-value--accent { color: var(--purple, #7c3aed); font-weight: 600; }
.pc-body-value--neg    { color: var(--red, #dc2626); }
.pc-body-value--total  { font-weight: 700; font-size: 14px; color: var(--accent); }
.pc-body-row--total    { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 6px; }
.pc-has-option         { border-left: 3px solid var(--yellow, #f59e0b); }
.pc-technique-badge    { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: #ede9fe; color: #6d28d9; }
.pc-option-badge       { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: #fef3c7; color: #92400e; }
.pc-total-main {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.pc-total-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.pc-total-breakdown {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.pc-inline-fields {
  opacity: 0.85;
  transform: scale(0.95);
}
.pc-has-custom {
  border-left: 3px solid #10b981; /* verde */
}

/* ── FIX TOTAL CARD (mejora visual PRO) ── */

.pc-total-block {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 110px;
}

.pc-total-main {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.pc-total-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  text-align: right;
}

.pc-total-breakdown {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* cuando hay personalización → resalta */
.pc-has-custom .pc-total-main {
  color: #10b981;
}

.be-seri-box{
  margin-top:10px;
  padding:12px;
  border-radius:12px;
  background:rgba(0,0,0,.03);
}
.be-seri-grid{
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  gap:8px;
  align-items:end;
}
.be-field-mini{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.be-field-mini label{
  font-size:.8rem;
  font-weight:700;
  opacity:.75;
}
.be-seri-total{
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:4px;
  font-weight:800;
}
@media (max-width: 980px){
  .be-seri-grid{
    grid-template-columns:1fr 1fr;
  }
}

/* =========================
   SETTINGS PAGE
========================= */

.settings-page {
  width: 100%;
}

.settings-wrap {
  width: min(1100px, calc(100% - 48px));
  margin: 0 auto 40px;
}

.settings-header {
  margin-bottom: 20px;
}

.settings-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 22px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
  padding: 28px;
  margin-bottom: 20px;
}

.settings-card__head {
  margin-bottom: 22px;
}

.settings-card__head h3 {
  margin: 0 0 6px;
  font-size: 1.65rem;
  line-height: 1.1;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.03em;
}

.settings-card__head p {
  margin: 0;
  font-size: 0.96rem;
  color: #64748b;
  line-height: 1.5;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-field label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
}

.settings-input {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  color: #0f172a;
  font-size: 0.96rem;
  font-weight: 500;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease, transform .12s ease;
  box-sizing: border-box;
}

.settings-input::placeholder {
  color: #94a3b8;
  font-weight: 500;
}

.settings-input:hover {
  border-color: #94a3b8;
  background: #fff;
}

.settings-input:focus {
  border-color: #22c55e;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

.settings-inline {
  display: flex;
  align-items: end;
  gap: 18px;
  flex-wrap: wrap;
}

.settings-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid #dbe3ee;
  border-radius: 14px;
  background: #f8fafc;
  color: #0f172a;
  font-weight: 700;
}

.settings-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #22c55e;
  cursor: pointer;
}

.settings-check span {
  font-size: 0.96rem;
}

.settings-field--small {
  width: 120px;
}

.settings-card--actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.settings-btn {
  height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 14px;
  font-size: 0.96rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .18s ease, opacity .18s ease;
}

.settings-btn:hover {
  transform: translateY(-1px);
}

.settings-btn:active {
  transform: translateY(0);
}

.settings-btn--primary {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(34, 197, 94, 0.22);
}

.settings-btn--primary:hover {
  box-shadow: 0 16px 30px rgba(34, 197, 94, 0.28);
}

/* Responsive */
@media (max-width: 900px) {
  .settings-wrap {
    width: min(100%, calc(100% - 28px));
  }

  .settings-card {
    padding: 22px;
    border-radius: 18px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .settings-card__head h3 {
    font-size: 1.35rem;
  }

  .settings-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-field--small {
    width: 100%;
  }
}

/* =========================
   PRODUCT EDITOR PRO
========================= */

.products-editor-wrap {
  padding: 10px 18px 28px;
}

/* TOPBAR */
.hbe-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.hbe-title-input {
  font-size: 1.4rem;
  font-weight: 800;
  border: none;
  outline: none;
  background: transparent;
  color: #0f172a;
}

.hbe-title-input::placeholder {
  color: #94a3b8;
}

.hbe-docnum {
  font-size: 0.8rem;
  color: #64748b;
}

/* BOTONES TOP */
.hbe-btn-outline {
  height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #dbe3ee;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: .2s;
}

.hbe-btn-outline:hover {
  background: #f1f5f9;
}

.hbe-btn-save-draft {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  border: none;
}

.hbe-btn-save-draft:hover {
  box-shadow: 0 10px 20px rgba(34,197,94,0.25);
}

/* LAYOUT */
.hbe-body {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 18px;
}

/* CARD */
.products-editor-card {
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 25px rgba(15,23,42,0.05);
}

/* GRID FORM */
.products-editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* INPUTS */
.products-editor-card input,
.products-editor-card textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  padding: 10px 14px;
  font-size: 0.92rem;
  background: #f8fafc;
  transition: .2s;
}

.products-editor-card input:focus,
.products-editor-card textarea:focus {
  border-color: #22c55e;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.15);
}

/* LABELS */
.form-group label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
}

/* TEXTAREAS */
.products-editor-card textarea {
  resize: vertical;
  min-height: 80px;
}

/* CHECKBOX */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

/* PREVIEW LATERAL */
.hbe-aside {
  position: sticky;
  top: 20px;
}

.products-preview-box {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  padding: 16px;
  box-shadow: 0 10px 20px rgba(15,23,42,0.05);
}

.products-preview-image {
  border-radius: 12px;
  overflow: hidden;
  background: #f1f5f9;
}

.products-preview-name {
  font-size: 1.1rem;
  font-weight: 800;
}

.products-preview-price {
  color: #16a34a;
  font-size: 1.3rem;
}

/* BOTON IMPORT */
#pf-import-basic {
  background: #111827;
  color: white;
  border-radius: 10px;
  font-weight: 700;
}

#pf-import-basic:hover {
  background: #1f2937;
}

/* ERROR */
.form-error {
  color: #dc2626;
  font-weight: 600;
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .hbe-body {
    grid-template-columns: 1fr;
  }

  .products-editor-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================
   SHARED EDITOR LAYOUT
========================= */

.hbe-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 100vh;
  background: #f4f6fb;
}

.hbe-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  gap: 12px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 30;
}

.hbe-top-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hbe-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hbe-back {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #dbe3ee;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #334155;
  transition: .18s;
  flex-shrink: 0;
}

.hbe-back:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.hbe-title-block {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.hbe-title-input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 1.3rem;
  font-weight: 800;
  color: #0f172a;
  min-width: 220px;
  padding: 4px 2px;
}

.hbe-title-input::placeholder {
  color: #94a3b8;
}

.hbe-docnum {
  font-size: .8rem;
  font-weight: 700;
  color: #64748b;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.hbe-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid #dbe3ee;
  background: #fff;
  color: #334155;
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: .18s;
}

.hbe-btn-outline:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.hbe-btn-outline:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.hbe-btn-save-draft {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
  border: none;
  box-shadow: 0 10px 22px rgba(34, 197, 94, 0.20);
}

.hbe-btn-save-draft:hover {
  filter: brightness(1.02);
  box-shadow: 0 14px 28px rgba(34, 197, 94, 0.26);
}

.hbe-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  padding: 18px 20px 28px;
  align-items: start;
}

.hbe-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.hbe-aside {
  position: sticky;
  top: 74px;
}

.hbe-summary {
  background: #fff;
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

/* =========================
   PRODUCT EDITOR POLISH
========================= */

.products-editor-wrap {
  padding: 0;
}

.products-editor-card {
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
  padding: 22px;
}

.products-editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 18px;
}

.form-group-span2 {
  grid-column: span 2;
}

.products-editor-card .form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.products-editor-card .form-group label {
  font-size: .84rem;
  font-weight: 700;
  color: #334155;
}

.products-editor-card input[type="text"],
.products-editor-card input[type="number"],
.products-editor-card textarea {
  width: 100%;
  border: 1px solid #d7dee8;
  background: #ffffff;
  color: #0f172a;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: .95rem;
  outline: none;
  transition: .18s;
  box-sizing: border-box;
}

.products-editor-card textarea {
  resize: vertical;
  min-height: 92px;
}

.products-editor-card input:focus,
.products-editor-card textarea:focus {
  border-color: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

.products-editor-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #eef2f7;
}

.products-editor-hint {
  font-size: .78rem;
  color: #94a3b8;
}

.products-preview-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.products-preview-title {
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.products-preview-image {
  height: 210px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.products-preview-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.products-preview-image span {
  font-size: .88rem;
  color: #94a3b8;
}

.products-preview-name {
  font-size: 1.08rem;
  font-weight: 800;
  color: #0f172a;
}

.products-preview-meta {
  font-size: .84rem;
  color: #64748b;
  line-height: 1.5;
}

.products-preview-price {
  font-size: 1.35rem;
  font-weight: 800;
  color: #16a34a;
}

.products-table .col-check {
  width: 44px;
  text-align: center;
}

.products-table .col-actions {
  width: 96px;
}

.products-bulkbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.products-bulkbar__count {
  font-size: .84rem;
  font-weight: 700;
  color: #475569;
}

.products-mini-muted,
.products-cell-sub {
  font-size: .78rem;
  color: #94a3b8;
}

@media (max-width: 980px) {
  .hbe-body {
    grid-template-columns: 1fr;
  }

  .hbe-aside {
    position: static;
  }

  .products-editor-grid {
    grid-template-columns: 1fr;
  }

  .form-group-span2 {
    grid-column: span 1;
  }
}

.product-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:9999;
}

.product-modal-box {
  background:#fff;
  padding:20px;
  width:400px;
  border-radius:10px;
}

.product-list {
  max-height:300px;
  overflow:auto;
}

.product-item {
  padding:10px;
  border-bottom:1px solid #eee;
  cursor:pointer;
}

.product-item:hover {
  background:#f3f4f6;
}

/* ── PROSPECTS MODULE ────────────────────────────────────────────────────── */
/* Utility input/select/textarea clases para uso fuera de .form-group */
.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: .9rem;
  color: var(--text-primary);
  background: var(--card);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--green-dark);
  box-shadow: 0 0 0 3px var(--green-glow);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.textarea { resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%239ca3af' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; cursor: pointer; }
.form-label { font-size: .8rem; font-weight: 600; color: var(--text-secondary); letter-spacing: .01em; }

/* Tag (tipo de prospect) */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--blue-subtle);
  color: var(--blue);
  border: 1px solid rgba(31,87,255,.15);
}

/* Fecha vencida */
.text-overdue { color: var(--red); font-weight: 600; }

/* Botón secundario */
.btn-secondary {
  display: inline-flex; align-items: center;
  padding: 9px 18px;
  background: var(--border-soft);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  transition: background .14s, border-color .14s;
}
.btn-secondary:hover { background: var(--border); color: var(--text-primary); }
/* ── Selección múltiple / borrado masivo ───────────────────────────────── */
.module-list-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0;
  border-bottom: 1px solid var(--border);
}

.module-list-toolbar .search-bar {
  flex: 1 1 260px;
  min-width: 240px;
  border-bottom: 0;
}

.bulk-actions-bar,
.tech-bulkbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-right: 10px;
  border: 1px solid rgba(239, 68, 68, .20);
  border-radius: 999px;
  background: rgba(254, 242, 242, .92);
  color: #991b1b;
  font-size: .82rem;
  font-weight: 800;
  white-space: nowrap;
}

.tech-bulkbar {
  margin: 0 10px 10px;
  justify-content: space-between;
  border-radius: 14px;
}

.col-check {
  width: 44px;
  min-width: 44px;
  text-align: center !important;
}

.col-check input[type="checkbox"],
.tech-check-row,
.data-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--green, #84cc16);
}

.tech-list-item {
  gap: 9px;
}

.tech-list-item .tech-check-row {
  flex: 0 0 auto;
}

@media (max-width: 768px) {
  .module-list-toolbar {
    align-items: stretch;
  }

  .module-list-toolbar .search-bar,
  .bulk-actions-bar {
    width: 100%;
    margin-right: 0;
  }

  .bulk-actions-bar {
    justify-content: space-between;
    border-radius: 14px;
    margin: 0 12px 12px;
  }
}

@media (max-width: 768px) {
  .prospects-table th:nth-child(2),
  .prospects-table td:nth-child(2),
  .products-table th:nth-child(2),
  .products-table td:nth-child(2),
  .budgets-table th:nth-child(3),
  .budgets-table td:nth-child(3),
  .deliveries-table th:nth-child(3),
  .deliveries-table td:nth-child(3),
  .clients-table th:nth-child(3),
  .clients-table td:nth-child(3) {
    display: table-cell !important;
  }
}


/* ─── FIX DOCUMENTOS: editor base para presupuesto/albarán/factura ───────── */
.unsaved-guard-overlay{position:fixed;inset:0;z-index:10000;background:rgba(15,23,42,.55);display:flex;align-items:center;justify-content:center;padding:18px}
.unsaved-guard-modal{width:min(460px,100%);background:#fff;border-radius:18px;border:1px solid #e5e7eb;box-shadow:0 24px 70px rgba(0,0,0,.25);padding:22px}
.unsaved-guard-modal h3{margin:0 0 8px;font-size:1.25rem;font-weight:900;color:#111827}
.unsaved-guard-modal p{margin:0;color:#64748b;line-height:1.55;font-size:.94rem}
.unsaved-guard-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px;flex-wrap:wrap}
.unsaved-guard-actions .btn{min-height:38px}

.hbe-wrap{display:flex;flex-direction:column;min-height:100vh;background:#f4f7fc;color:#111827}
.hbe-topbar{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:12px 20px;background:#fff;border-bottom:1px solid #e5e7eb;position:sticky;top:0;z-index:60}
.hbe-top-left,.hbe-top-right{display:flex;align-items:center;gap:10px;min-width:0;flex-wrap:wrap}.hbe-top-right{justify-content:flex-end}
.hbe-back{width:36px;height:36px;border:1px solid #e5e7eb;border-radius:10px;background:#fff;display:inline-flex;align-items:center;justify-content:center;color:#111827;flex:0 0 auto}.hbe-back:hover{background:#f8fafc}
.hbe-title-block{display:flex;align-items:center;gap:10px;min-width:0}.hbe-title-input{border:0;outline:0;background:transparent;font-size:1.05rem;font-weight:900;color:#111827;min-width:180px;max-width:340px;padding:3px 4px;border-radius:8px}.hbe-title-input:focus,.hbe-title-input:hover{background:#f3f4f6}.hbe-docnum,.hbe-docnum-display{display:inline-flex;align-items:center;min-height:28px;border-radius:999px;background:#f3f4f6;color:#64748b;font-size:.82rem;font-weight:800;padding:4px 10px;white-space:nowrap}
.hbe-btn-outline,.hbe-btn-pdf,.hbe-btn-save-draft,.hbe-btn-ghost{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:38px;padding:0 16px;border-radius:10px;font-weight:800;font-size:.9rem;white-space:nowrap}.hbe-btn-outline{background:#fff;border:1px solid #dbe3ee;color:#334155}.hbe-btn-outline:hover{background:#f8fafc}.hbe-btn-pdf{background:#dc2626;color:#fff;border:1px solid #dc2626}.hbe-btn-save-draft{background:#16a34a;color:#fff;border:1px solid #16a34a}.hbe-btn-ghost{background:transparent;color:#334155}
.hbe-body{display:grid;grid-template-columns:minmax(0,1fr) 280px;gap:18px;padding:18px 22px;align-items:start}.hbe-main{display:flex;flex-direction:column;gap:14px;min-width:0}.hbe-aside{position:sticky;top:78px;min-width:0}.hbe-card{background:#fff;border:1px solid #e5e7eb;border-radius:16px;overflow:hidden;box-shadow:0 8px 24px rgba(15,23,42,.035)}.hbe-meta-card{padding:18px}.hbe-meta-row{display:grid;grid-template-columns:200px 140px 150px 140px minmax(220px,1fr);gap:12px;align-items:end}.hbe-meta-field{display:flex;flex-direction:column;gap:6px;min-width:0}.hbe-meta-grow{grid-column:auto}.hbe-label{font-size:.72rem;font-weight:900;text-transform:uppercase;letter-spacing:.06em;color:#94a3b8}.hbe-input,.hbe-select{width:100%;height:40px;border:1px solid #dbe3ee;border-radius:10px;background:#fff;color:#111827;padding:0 11px;outline:none}.hbe-input:focus,.hbe-select:focus{border-color:#2563eb;box-shadow:0 0 0 3px rgba(37,99,235,.10)}.hbe-select-group{display:flex;gap:8px}.hbe-select-contact{min-width:0}.hbe-add-btn{width:40px;height:40px;border-radius:10px;background:#2563eb;color:#fff;font-weight:900}
.hbe-lines-card{overflow:hidden}.hbe-table{width:100%;border-collapse:collapse;table-layout:fixed}.hbe-table th{padding:10px 10px;background:#f8fafc;border-bottom:1px solid #e5e7eb;color:#94a3b8;font-size:.75rem;text-transform:uppercase;letter-spacing:.06em;text-align:left}.hbe-table td{padding:9px 10px;border-bottom:1px solid #eef2f7;vertical-align:top}.th-drag,.td-drag{width:34px}.th-qty,.td-qty{width:110px}.th-price,.td-price{width:130px}.th-disc,.td-disc{width:90px}.th-disctype,.td-disctype{width:64px}.th-applies,.td-applies{width:140px}.th-total,.td-total{width:120px;text-align:right}.th-del,.td-del{width:42px}.hbe-concept-wrap{display:flex;flex-direction:column;gap:6px;min-width:0}.hbe-concept-input,.hbe-cell-input,.hbe-cell-select{width:100%;height:36px;border:1px solid #dbe3ee;border-radius:10px;background:#fff;color:#111827;padding:0 10px;outline:none}.hbe-concept-input{font-weight:700}.hbe-cell-input:focus,.hbe-cell-select:focus,.hbe-concept-input:focus{border-color:#2563eb;box-shadow:0 0 0 3px rgba(37,99,235,.09)}.hbe-custom-pill{align-self:flex-start;min-height:28px;border:1px dashed #cbd5e1;border-radius:999px;background:#fff;color:#2563eb;font-weight:800;font-size:.82rem;padding:3px 10px}.hbe-pill-active{background:#eff6ff;border-color:#93c5fd}.hbe-line-total{display:block;font-weight:900;line-height:36px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.hbe-del-btn{width:32px;height:32px;border-radius:9px;color:#94a3b8}.hbe-del-btn:hover{background:#fee2e2;color:#dc2626}.hbe-table-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:13px 16px;border-top:1px solid #e5e7eb;flex-wrap:wrap}.hbe-add-line-btn{display:inline-flex;align-items:center;justify-content:center;min-height:36px;border:1px dashed #cbd5e1;border-radius:10px;background:#fff;color:#64748b;font-weight:900;padding:0 14px}.hbe-add-line-btn:hover{border-color:#2563eb;color:#2563eb;background:#eff6ff}.hbe-global-disc{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.hbe-disc-input{width:90px;height:36px;border:1px solid #dbe3ee;border-radius:10px;padding:0 10px;text-align:right}.hbe-disc-type{height:36px;border:1px solid #dbe3ee;border-radius:10px;padding:0 8px;background:#fff}.hbe-bottom-opts{background:#fff;border:1px solid #e5e7eb;border-radius:16px;padding:14px 18px;display:flex;flex-direction:column;gap:10px}.hbe-opt-check{display:flex;align-items:center;gap:9px;color:#334155;font-weight:700}.hbe-vat-input{width:62px;height:32px;border:1px solid #dbe3ee;border-radius:9px;padding:0 8px;text-align:right}.hbe-summary{background:#fff;border:1px solid #e5e7eb;border-radius:18px;padding:18px;box-shadow:0 12px 30px rgba(15,23,42,.06)}.hbe-sum-row{display:flex;justify-content:space-between;gap:10px;padding:7px 0;border-bottom:1px solid #f1f5f9;color:#334155}.hbe-sum-sep{border-top:1px solid #e5e7eb;margin:8px 0}.hbe-sum-disc{color:#dc2626}.hbe-sum-total{display:flex;justify-content:space-between;align-items:baseline;gap:12px;margin-top:8px;padding-top:12px;border-top:2px solid #111827}.hbe-sum-total strong{font-size:1.5rem}.hbe-sum-vat{display:flex;justify-content:flex-end;gap:5px;color:#64748b;font-size:.82rem}
.hbe-custom-panel,.invoice-custom-panel{padding:14px 16px;background:#f8fafc;border-top:1px solid #e5e7eb}.hbe-cust-row,.invoice-cust-row{background:#fff;border:1px solid #e5e7eb;border-radius:14px;padding:12px;margin-top:10px}.hbe-cust-line1,.hbe-cust-line2{display:grid;gap:8px;align-items:end}.hbe-cust-line1{grid-template-columns:1fr 1fr 1fr 1fr 32px}.hbe-cust-line2{grid-template-columns:90px 96px 78px 110px 1fr 120px}.hbe-cust-select,.hbe-cust-input{width:100%;height:36px;border:1px solid #dbe3ee;border-radius:10px;padding:0 10px}.hbe-cust-del{width:32px;height:32px;border-radius:9px;color:#94a3b8}.hbe-cust-total{font-weight:900;white-space:nowrap}.hbe-seri-box,.invoice-seri-box{margin-top:10px;padding:10px;border:1px solid #e5e7eb;border-radius:12px;background:#f8fafc}.hbe-seri-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.hbe-seri-field label{display:block;font-size:.7rem;font-weight:900;text-transform:uppercase;color:#94a3b8;margin-bottom:4px}.hbe-seri-field input,.hbe-seri-field select{width:100%;height:34px;border:1px solid #dbe3ee;border-radius:9px;padding:0 8px;background:#fff}

@media(max-width:1200px){.hbe-body{grid-template-columns:1fr}.hbe-aside{position:static}.hbe-meta-row{grid-template-columns:repeat(3,minmax(0,1fr))}.hbe-meta-grow{grid-column:1/-1}}
@media(max-width:900px){.hbe-meta-row{grid-template-columns:1fr 1fr}.th-disc,.th-disctype,.th-applies,.td-disc,.td-disctype,.td-applies{display:none}.hbe-cust-line1{grid-template-columns:1fr 1fr 1fr 32px}.hbe-cust-line2{grid-template-columns:1fr 1fr}.hbe-seri-grid{grid-template-columns:1fr 1fr}}
@media(max-width:720px){html,body{max-width:100%;overflow-x:hidden}#content{padding-left:10px!important;padding-right:10px!important;overflow-x:hidden}.hbe-wrap{width:100%;max-width:100%;overflow-x:hidden}.hbe-topbar{padding:10px;align-items:flex-start}.hbe-top-left,.hbe-top-right{width:100%;min-width:0}.hbe-top-right{display:grid;grid-template-columns:1fr 1fr;gap:8px}.hbe-top-right button{width:100%;padding:0 8px}.hbe-title-input{min-width:0;max-width:100%;width:100%}.hbe-docnum{display:none}.hbe-body{display:block;padding:10px}.hbe-main{width:100%;max-width:100%}.hbe-card{width:100%;max-width:100%;overflow:visible}.hbe-meta-card{padding:12px}.hbe-meta-row,.invoice-meta-grid{grid-template-columns:1fr!important;gap:10px}.hbe-meta-grow,.invoice-notes-field{grid-column:auto!important}.hbe-table,.hbe-table tbody{display:block;width:100%;max-width:100%}.hbe-table thead{display:none}.hbe-line-row,.invoice-line-row{display:grid!important;grid-template-columns:30px minmax(0,1fr) minmax(0,1fr) 40px;gap:10px 8px;width:100%;padding:12px;border-bottom:1px solid #e5e7eb;background:#fff;position:relative}.hbe-line-row td,.invoice-line-row td{display:block!important;padding:0!important;border-bottom:0!important;min-width:0;width:auto!important}.td-drag{grid-column:1;grid-row:1;align-self:start;padding-top:8px!important}.td-concept{grid-column:2/4;grid-row:1}.td-del{grid-column:4;grid-row:1;align-self:start;justify-self:end}.td-qty,.td-price,.td-total{background:#f8fafc;border:1px solid #e5e7eb!important;border-radius:10px;padding:7px!important;min-height:56px}.td-qty{grid-column:1/3;grid-row:2}.td-price{grid-column:3/4;grid-row:2}.td-total{grid-column:4/5;grid-row:2;text-align:right}.td-qty:before,.td-price:before,.td-total:before{display:block;margin-bottom:3px;font-size:.64rem;font-weight:900;text-transform:uppercase;letter-spacing:.04em;color:#94a3b8;line-height:1.1}.td-qty:before{content:'Cant.'}.td-price:before{content:'Precio'}.td-total:before{content:'Total'}.hbe-line-total{line-height:28px;font-size:.9rem}.hbe-cell-input{height:28px;padding:2px 4px;background:transparent}.hbe-concept-input{width:100%;min-width:0}.hbe-panel-row,.hbe-panel-row td,.td-panel{display:block!important;width:100%!important;max-width:100%}.hbe-custom-panel,.invoice-custom-panel{padding:12px;width:100%;overflow:visible}.hbe-cust-line1,.hbe-cust-line2,.invoice-cust-grid{grid-template-columns:1fr!important}.hbe-seri-grid,.invoice-seri-box{grid-template-columns:1fr!important}.hbe-table-footer{display:grid;grid-template-columns:1fr;gap:10px;padding:12px}.hbe-add-line-btn{width:100%}.hbe-global-disc{display:grid;grid-template-columns:1fr 82px 60px;width:100%}.hbe-aside{margin-top:12px}.unsaved-guard-actions{display:grid;grid-template-columns:1fr}.unsaved-guard-actions .btn{width:100%}}
@media(max-width:420px){.hbe-top-right{grid-template-columns:1fr}.hbe-line-row,.invoice-line-row{grid-template-columns:28px minmax(0,1fr) 40px}.td-concept{grid-column:2/3}.td-del{grid-column:3}.td-qty{grid-column:1/2}.td-price{grid-column:2/3}.td-total{grid-column:3/4}.hbe-global-disc{grid-template-columns:1fr 76px 54px}}


/* === PRESULAB FIX DOCUMENTOS V4: editores + móvil === */
@media (max-width: 720px) {
  #content {
    padding: 10px !important;
    overflow-x: hidden !important;
  }

  .hbe-body,
  .invoice-body {
    display: block !important;
    padding: 10px !important;
  }

  .hbe-main,
  .hbe-aside {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .hbe-aside {
    position: static !important;
    margin-top: 12px !important;
  }

  .hbe-card,
  .hbe-lines-card,
  .invoice-lines-card {
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    border-radius: 16px !important;
  }

  .hbe-table,
  .hbe-table tbody,
  .hbe-table tr,
  .hbe-table td,
  .invoice-table,
  .invoice-table tbody,
  .invoice-table tr,
  .invoice-table td {
    box-sizing: border-box !important;
  }

  .hbe-table thead,
  .invoice-table thead {
    display: none !important;
  }

  .hbe-table,
  .hbe-table tbody,
  .invoice-table,
  .invoice-table tbody {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .hbe-line-row,
  .invoice-line-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 14px !important;
    border-bottom: 1px solid #e5e7eb !important;
    background: #fff !important;
    position: relative !important;
  }

  .hbe-line-row td,
  .invoice-line-row td {
    display: block !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: 100% !important;
    padding: 0 !important;
    border: 0 !important;
  }

  .hbe-line-row .td-drag,
  .invoice-line-row .td-drag {
    display: none !important;
  }

  .hbe-line-row .td-concept,
  .invoice-line-row .td-concept {
    grid-column: 1 / -1 !important;
    padding-right: 36px !important;
  }

  .hbe-line-row .td-del,
  .invoice-line-row .td-del {
    position: absolute !important;
    top: 14px !important;
    right: 12px !important;
    width: 32px !important;
    justify-self: auto !important;
  }

  .hbe-line-row .td-qty,
  .invoice-line-row .td-qty,
  .hbe-line-row .td-price,
  .invoice-line-row .td-price,
  .hbe-line-row .td-disc,
  .invoice-line-row .td-disc,
  .hbe-line-row .td-disctype,
  .invoice-line-row .td-disctype,
  .hbe-line-row .td-applies,
  .invoice-line-row .td-applies,
  .hbe-line-row .td-total,
  .invoice-line-row .td-total {
    background: #f8fafc !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 12px !important;
    padding: 9px 10px !important;
    min-height: 62px !important;
    text-align: left !important;
  }

  .hbe-line-row .td-qty,
  .invoice-line-row .td-qty { grid-column: 1 / 2 !important; }
  .hbe-line-row .td-price,
  .invoice-line-row .td-price { grid-column: 2 / 3 !important; }
  .hbe-line-row .td-disc,
  .invoice-line-row .td-disc { grid-column: 1 / 2 !important; }
  .hbe-line-row .td-disctype,
  .invoice-line-row .td-disctype { grid-column: 2 / 3 !important; }
  .hbe-line-row .td-applies,
  .invoice-line-row .td-applies { grid-column: 1 / 2 !important; }
  .hbe-line-row .td-total,
  .invoice-line-row .td-total { grid-column: 2 / 3 !important; }

  .hbe-line-row .td-qty::before,
  .invoice-line-row .td-qty::before,
  .hbe-line-row .td-price::before,
  .invoice-line-row .td-price::before,
  .hbe-line-row .td-disc::before,
  .invoice-line-row .td-disc::before,
  .hbe-line-row .td-disctype::before,
  .invoice-line-row .td-disctype::before,
  .hbe-line-row .td-applies::before,
  .invoice-line-row .td-applies::before,
  .hbe-line-row .td-total::before,
  .invoice-line-row .td-total::before {
    display: block !important;
    margin-bottom: 5px !important;
    font-size: .68rem !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
    letter-spacing: .055em !important;
    color: #94a3b8 !important;
    line-height: 1.1 !important;
  }

  .hbe-line-row .td-qty::before,
  .invoice-line-row .td-qty::before { content: 'Cantidad' !important; }
  .hbe-line-row .td-price::before,
  .invoice-line-row .td-price::before { content: 'Precio' !important; }
  .hbe-line-row .td-disc::before,
  .invoice-line-row .td-disc::before { content: 'Dto.' !important; }
  .hbe-line-row .td-disctype::before,
  .invoice-line-row .td-disctype::before { content: 'Tipo dto.' !important; }
  .hbe-line-row .td-applies::before,
  .invoice-line-row .td-applies::before { content: 'Aplicar a' !important; }
  .hbe-line-row .td-total::before,
  .invoice-line-row .td-total::before { content: 'Total' !important; }

  .hbe-concept-input,
  .hbe-cell-input,
  .hbe-cell-select,
  .invoice-line-row input,
  .invoice-line-row select {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .hbe-cell-input,
  .hbe-cell-select {
    height: 34px !important;
  }

  .hbe-line-total {
    display: block !important;
    width: 100% !important;
    line-height: 34px !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
    font-size: 1rem !important;
  }

  .hbe-panel-row,
  .invoice-panel-row,
  .hbe-panel-row td,
  .invoice-panel-row td {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .hbe-custom-panel,
  .invoice-custom-panel {
    width: 100% !important;
    max-width: 100% !important;
    padding: 14px !important;
  }

  .hbe-cust-line1,
  .hbe-cust-line2,
  .invoice-cust-grid {
    grid-template-columns: 1fr !important;
  }

  .hbe-summary,
  .invoice-summary {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 480px) {
  .hbe-line-row,
  .invoice-line-row {
    grid-template-columns: 1fr !important;
  }

  .hbe-line-row .td-qty,
  .invoice-line-row .td-qty,
  .hbe-line-row .td-price,
  .invoice-line-row .td-price,
  .hbe-line-row .td-disc,
  .invoice-line-row .td-disc,
  .hbe-line-row .td-disctype,
  .invoice-line-row .td-disctype,
  .hbe-line-row .td-applies,
  .invoice-line-row .td-applies,
  .hbe-line-row .td-total,
  .invoice-line-row .td-total {
    grid-column: 1 / -1 !important;
  }
}
/* === /PRESULAB FIX DOCUMENTOS V4 END === */

/* === PRESULAB FIX FACTURAS ESCRITORIO V5 === */
@media (min-width: 1281px) {
  .invoice-editor-wrap {
    width: 100%;
    min-width: 0;
  }

  .invoice-body {
    grid-template-columns: minmax(0, 1fr) 300px !important;
    gap: 18px !important;
    align-items: start !important;
  }

  .invoice-meta-card {
    overflow: visible !important;
  }

  .invoice-meta-grid {
    display: grid !important;
    grid-template-columns: minmax(220px, 1.25fr) minmax(120px, .7fr) minmax(135px, .75fr) minmax(135px, .75fr) !important;
    gap: 12px !important;
    align-items: end !important;
  }

  .invoice-notes-field {
    grid-column: span 2 !important;
  }

  .invoice-lines-card {
    overflow-x: auto !important;
    overflow-y: visible !important;
  }

  .invoice-table {
    min-width: 980px !important;
  }

  .invoice-summary {
    width: 100% !important;
    box-sizing: border-box !important;
  }
}

.invoice-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.invoice-panel-header .hbe-panel-header-left,
.invoice-panel-header .hbe-panel-header-right,
.invoice-compare-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.invoice-panel-header .hbe-panel-label {
  font-weight: 900;
  color: #111827;
}

.invoice-panel-header .hbe-btn-sm,
.invoice-panel-header .hbe-btn-sm-ghost,
.invoice-compare-tabs .hbe-tab,
.invoice-compare-tabs .hbe-tab-mini {
  min-height: 30px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 900;
  cursor: pointer;
}

.invoice-panel-header .hbe-btn-sm {
  padding: 0 12px;
  border: 1px solid #16a34a;
  background: #16a34a;
  color: #fff;
}

.invoice-panel-header .hbe-btn-sm-ghost,
.invoice-compare-tabs .hbe-tab,
.invoice-compare-tabs .hbe-tab-mini {
  padding: 0 10px;
  border: 1px solid #dbe3ee;
  background: #fff;
  color: #475569;
}

.invoice-compare-tabs .hbe-tab.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.invoice-compare-tabs .hbe-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: .65rem;
  margin-left: 3px;
  padding: 0 4px;
}

.invoice-compare-tabs .hbe-tab-danger {
  color: #dc2626;
  border-color: #fecaca;
}
/* === /PRESULAB FIX FACTURAS ESCRITORIO V5 === */

/* === PRESULAB FIX FACTURAS RESPONSIVE V6: sin scroll lateral === */
.invoice-editor-wrap,
.invoice-body,
.invoice-body *,
.invoice-lines-card,
.invoice-table,
.invoice-table tbody,
.invoice-table tr,
.invoice-table td,
.invoice-panel-row,
.invoice-panel-row td,
.invoice-custom-panel,
.invoice-panel-body,
.invoice-cust-row,
.invoice-cust-grid,
.invoice-seri-box {
  box-sizing: border-box;
  min-width: 0;
}

.invoice-editor-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.invoice-body {
  max-width: 100%;
  overflow-x: hidden;
}

.invoice-main,
.invoice-body .hbe-main {
  min-width: 0 !important;
  max-width: 100% !important;
}

.invoice-lines-card {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  overflow-y: visible !important;
}

.invoice-table {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}

.invoice-table th,
.invoice-table td {
  overflow: hidden;
}

.invoice-table .th-drag,
.invoice-table .td-drag { width: 28px !important; }
.invoice-table .th-qty,
.invoice-table .td-qty { width: 88px !important; }
.invoice-table .th-price,
.invoice-table .td-price { width: 105px !important; }
.invoice-table .th-disc,
.invoice-table .td-disc { width: 70px !important; }
.invoice-table .th-disctype,
.invoice-table .td-disctype { width: 56px !important; }
.invoice-table .th-applies,
.invoice-table .td-applies { width: 116px !important; }
.invoice-table .th-total,
.invoice-table .td-total { width: 100px !important; }
.invoice-table .th-del,
.invoice-table .td-del { width: 36px !important; }

.invoice-table .hbe-cell-input,
.invoice-table .hbe-cell-select,
.invoice-table .hbe-concept-input {
  min-width: 0 !important;
  max-width: 100% !important;
}

.invoice-panel-row,
.invoice-panel-row td,
.invoice-panel-row .td-panel {
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

.invoice-custom-panel {
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

.invoice-panel-body {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.invoice-cust-row {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.invoice-cust-grid {
  display: grid !important;
  grid-template-columns:
    minmax(105px, 1.1fr)
    minmax(95px, .95fr)
    minmax(80px, .8fr)
    minmax(100px, .95fr)
    minmax(58px, .55fr)
    minmax(82px, .65fr)
    minmax(78px, .7fr)
    minmax(78px, .7fr)
    32px;
  gap: 8px;
  align-items: end;
  width: 100%;
  max-width: 100%;
}

.invoice-cust-field,
.invoice-seri-field,
.invoice-cust-total-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  width: 100%;
}

.invoice-cust-field > span,
.invoice-seri-field > span,
.invoice-cust-total-box > span {
  display: block;
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .055em;
  line-height: 1.1;
  text-transform: uppercase;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.invoice-cust-grid .hbe-cust-select,
.invoice-cust-grid .hbe-cust-input,
.invoice-cust-notes-wrap .hbe-cust-input,
.invoice-seri-field input {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 36px;
}

.invoice-manual-toggle {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  margin: 0;
  padding: 0 8px;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  background: #fff;
  color: #475569;
  font-size: .78rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.invoice-manual-toggle.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.invoice-manual-toggle input {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
}

.invoice-cust-total-box .hbe-cust-total {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invoice-cust-delete {
  align-self: end;
  flex: 0 0 auto;
}

.invoice-cust-notes-wrap {
  margin-top: 10px;
}

.invoice-seri-box {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 100%;
}

.invoice-seri-field input {
  border: 1px solid #dbe3ee;
  border-radius: 9px;
  padding: 0 8px;
  background: #fff;
}

@media (max-width: 1280px) {
  .invoice-body {
    grid-template-columns: 1fr !important;
  }

  .invoice-body .hbe-aside,
  .invoice-aside {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .invoice-cust-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  .invoice-cust-delete {
    width: 100%;
  }

  .invoice-seri-box {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 900px) {
  .invoice-table .th-disc,
  .invoice-table .td-disc,
  .invoice-table .th-disctype,
  .invoice-table .td-disctype,
  .invoice-table .th-applies,
  .invoice-table .td-applies {
    display: block !important;
  }

  .invoice-cust-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .invoice-seri-box {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 720px) {
  html,
  body,
  #app,
  #content,
  .app-shell,
  .main-content,
  .invoice-editor-wrap,
  .invoice-body,
  .invoice-main,
  .invoice-lines-card,
  .invoice-custom-panel,
  .invoice-cust-row {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  #content {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .invoice-body {
    display: block !important;
    width: 100% !important;
    padding: 10px !important;
  }

  .invoice-meta-grid,
  .invoice-bottom-opts {
    grid-template-columns: 1fr !important;
  }

  .invoice-notes-field {
    grid-column: auto !important;
  }

  .invoice-line-row {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  .invoice-panel-header,
  .invoice-panel-header .hbe-panel-header-left,
  .invoice-panel-header .hbe-panel-header-right {
    display: grid !important;
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 8px !important;
  }

  .invoice-panel-header .hbe-btn-sm,
  .invoice-panel-header .hbe-btn-sm-ghost {
    width: 100% !important;
    min-height: 36px !important;
  }

  .invoice-compare-tabs {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    gap: 8px !important;
  }

  .invoice-compare-tabs .hbe-tab,
  .invoice-compare-tabs .hbe-tab-mini {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 36px !important;
  }

  .invoice-cust-grid,
  .invoice-seri-box {
    grid-template-columns: 1fr !important;
    gap: 9px !important;
  }

  .invoice-cust-row {
    padding: 10px !important;
  }

  .invoice-cust-delete {
    width: 100% !important;
    height: 36px !important;
    border: 1px solid #fecaca !important;
    background: #fff !important;
    color: #dc2626 !important;
  }

  .invoice-cust-total-box .hbe-cust-total {
    justify-content: flex-start !important;
    font-size: 1rem !important;
  }

  .invoice-summary {
    width: 100% !important;
    max-width: 100% !important;
  }
}

@media (max-width: 420px) {
  .invoice-compare-tabs {
    grid-template-columns: 1fr !important;
  }
}
/* === /PRESULAB FIX FACTURAS RESPONSIVE V6 END === */

/* ────────────────────────────────────────────────────────────────
   PRESULAB DASHBOARD PRO v1.6
   Layout tipo contabilidad, responsive y sin scroll lateral.
   ──────────────────────────────────────────────────────────────── */
.dash-pro{
  display:flex;
  flex-direction:column;
  gap:20px;
  width:100%;
  max-width:100%;
  overflow:hidden;
}
.dash-pro *{box-sizing:border-box;min-width:0}
.dash-pro-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
  flex-wrap:wrap;
  margin-bottom:2px;
}
.dash-pro-header h2{
  margin:0;
  font-family:var(--font-display);
  font-size:clamp(1.45rem,2.1vw,2rem);
  line-height:1.05;
  letter-spacing:-.035em;
  color:var(--text-primary);
}
.dash-pro-header p{
  margin:8px 0 0;
  color:var(--text-secondary);
  font-size:.96rem;
}
.dash-period-box{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
  max-width:100%;
}
.dash-period-box label{
  display:flex;
  align-items:center;
  gap:8px;
  height:40px;
  padding:0 10px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
  box-shadow:var(--shadow-xs,0 1px 2px rgba(15,23,42,.04));
  color:var(--text-muted);
  font-size:.76rem;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.04em;
}
.dash-period-box input{
  width:132px;
  border:0;
  outline:0;
  background:transparent;
  color:var(--text-primary);
  font-size:.9rem;
  font-weight:700;
}
.dash-period-quick,
.dash-period-apply{
  height:40px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
  color:var(--text-primary);
  padding:0 12px;
  font-weight:800;
  cursor:pointer;
  transition:transform .12s,box-shadow .12s,border-color .12s,background .12s;
}
.dash-period-quick:hover,
.dash-period-apply:hover{
  transform:translateY(-1px);
  border-color:rgba(34,197,94,.45);
  box-shadow:0 8px 22px rgba(15,23,42,.08);
}
.dash-period-apply{
  background:#111827;
  border-color:#111827;
  color:#fff;
}

.dash-pro-kpis{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:18px!important;
  margin:0!important;
}
.dash-pro-kpi{
  position:relative;
  min-height:152px;
  overflow:hidden;
  border:1px solid rgba(226,232,240,.95);
  border-radius:20px;
  background:#fff;
  padding:20px 20px 16px;
  box-shadow:0 16px 40px rgba(15,23,42,.06);
  transition:transform .14s,box-shadow .14s,border-color .14s;
}
.dash-pro-kpi:hover{
  transform:translateY(-2px);
  box-shadow:0 24px 54px rgba(15,23,42,.1);
  border-color:rgba(34,197,94,.32);
}
.dash-kpi-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.dash-kpi-label{
  color:#475569;
  font-size:.84rem;
  font-weight:800;
}
.dash-kpi-icon{
  width:52px;
  height:52px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  font-size:1.35rem;
  font-weight:900;
  background:var(--tone-soft);
  color:var(--tone);
}
.dash-kpi-number{
  display:block;
  position:relative;
  z-index:2;
  color:var(--tone);
  font-family:var(--font-display);
  font-size:clamp(1.28rem,2vw,1.72rem);
  line-height:1.05;
  letter-spacing:.02em;
}
.dash-kpi-footer{
  position:relative;
  z-index:2;
  display:flex;
  align-items:center;
  gap:7px;
  flex-wrap:wrap;
  margin-top:14px;
  color:#64748b;
  font-size:.78rem;
  font-weight:700;
}
.dash-trend{font-weight:900}
.dash-trend-up{color:#059669}
.dash-trend-down{color:#dc2626}
.dash-trend-flat{color:#64748b}
.dash-trend-warn{color:#f59e0b}
.dash-spark{
  position:absolute;
  right:14px;
  bottom:5px;
  width:120px;
  height:50px;
  opacity:.82;
  color:var(--tone);
}
.dash-tone-blue{--tone:#2563eb;--tone-soft:#dbeafe}
.dash-tone-green{--tone:#059669;--tone-soft:#d1fae5}
.dash-tone-red{--tone:#dc2626;--tone-soft:#fee2e2}
.dash-tone-purple{--tone:#7c3aed;--tone-soft:#ede9fe}

.dash-pro-skeleton{
  height:152px;
  border-radius:20px;
  background:linear-gradient(90deg,#eef2f7 25%,#f8fafc 50%,#eef2f7 75%);
  background-size:200% 100%;
  animation:shimmer 1.25s infinite;
}

.dash-pro-grid{
  display:grid;
  gap:20px;
  width:100%;
}
.dash-pro-grid-main{grid-template-columns:minmax(0,1.1fr) minmax(320px,.9fr)}
.dash-pro-grid-bottom{grid-template-columns:repeat(3,minmax(0,1fr))}
.dash-pro-card{
  overflow:hidden;
  border:1px solid rgba(226,232,240,.95);
  border-radius:20px;
  background:#fff;
  padding:20px;
  box-shadow:0 16px 40px rgba(15,23,42,.06);
}
.dash-pro-card-wide{min-height:326px}
.dash-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:16px;
}
.dash-card-head h3{
  margin:0;
  color:#0f172a;
  font-family:var(--font-display);
  font-size:1rem;
  letter-spacing:-.015em;
}
.dash-card-head p{
  margin:5px 0 0;
  color:#64748b;
  font-size:.8rem;
  font-weight:700;
}
.dash-card-chip{
  border:1px solid var(--border);
  border-radius:999px;
  padding:7px 10px;
  color:#475569;
  background:#f8fafc;
  font-size:.75rem;
  font-weight:900;
}
.dash-mini-loader,
.dash-chart-loading,
.dash-list-loading{
  min-height:120px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  color:#64748b;
  font-size:.88rem;
  font-weight:800;
}
.dash-mini-loader span{
  width:16px;
  height:16px;
  border-radius:50%;
  border:2px solid #e2e8f0;
  border-top-color:#22c55e;
  animation:spin .8s linear infinite;
}

.dash-legend{
  display:flex;
  align-items:center;
  gap:22px;
  flex-wrap:wrap;
  color:#475569;
  font-size:.78rem;
  font-weight:800;
  margin-bottom:14px;
}
.dash-legend span{display:flex;align-items:center;gap:8px}
.dash-legend i,
.dash-donut-row i{
  width:9px;
  height:9px;
  border-radius:50%;
  display:inline-block;
  flex:0 0 auto;
}
.legend-budget{background:#22c55e}
.legend-invoice{background:#f43f5e}
.legend-paid{background:#2563eb}
.dash-bars{
  position:relative;
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:18px;
  min-height:230px;
  padding:8px 8px 0;
  background:repeating-linear-gradient(to bottom,transparent 0,transparent 41px,rgba(148,163,184,.18) 42px,transparent 43px);
}
.dash-bar-group{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
}
.dash-bar-stack{
  height:170px;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  gap:10px;
  width:100%;
}
.dash-bar{
  display:block;
  width:min(28px,40%);
  min-width:12px;
  border-radius:9px 9px 2px 2px;
  box-shadow:0 10px 20px rgba(15,23,42,.08);
}
.dash-bar-budget{background:linear-gradient(180deg,#22c55e,#10b981)}
.dash-bar-invoice{background:linear-gradient(180deg,#fb7185,#ef4444)}
.dash-bar-group small{
  color:#64748b;
  font-size:.76rem;
  font-weight:800;
  white-space:nowrap;
}

.dash-donut-wrap{
  display:grid;
  grid-template-columns:minmax(160px,220px) minmax(0,1fr);
  gap:22px;
  align-items:center;
}
.dash-donut-chart{
  --d1:#2563eb;
  --d2:#22c55e;
  --d3:#f59e0b;
  --d4:#8b5cf6;
  width:100%;
  aspect-ratio:1;
  max-width:220px;
  border-radius:50%;
  position:relative;
  box-shadow:inset 0 0 0 1px rgba(15,23,42,.04),0 18px 40px rgba(15,23,42,.06);
}
.dash-donut-chart:after{
  content:"";
  position:absolute;
  inset:26%;
  border-radius:50%;
  background:#fff;
  box-shadow:inset 0 0 0 1px rgba(226,232,240,.88);
}
.dash-donut-chart span{
  position:absolute;
  inset:34%;
  z-index:2;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  color:#0f172a;
  font-size:.78rem;
  font-weight:900;
  line-height:1.2;
}
.dash-donut-list{display:grid;gap:12px}
.dash-donut-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) 44px minmax(80px,.8fr);
  gap:10px;
  align-items:center;
  color:#475569;
  font-size:.84rem;
}
.dash-donut-row span{display:flex;align-items:center;gap:9px;font-weight:800}
.dash-donut-row strong{color:#334155;text-align:right}
.dash-donut-row em{font-style:normal;color:#334155;text-align:right;font-weight:800}
.d1{background:#2563eb}.d2{background:#22c55e}.d3{background:#f59e0b}.d4{background:#8b5cf6}

.dash-line-chart{
  position:relative;
  width:100%;
  height:216px;
  overflow:hidden;
}
.dash-line-chart svg{
  position:absolute;
  inset:0 0 24px 0;
  width:100%;
  height:190px;
}
.dash-line-grid{
  fill:none;
  stroke:#e2e8f0;
  stroke-width:1;
  stroke-dasharray:4 5;
}
.dash-line-path{
  fill:none;
  stroke:currentColor;
  stroke-width:3;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.dash-line-a{color:#2563eb}.dash-line-b{color:#22c55e}
.dash-line-chart circle{fill:#fff;stroke:currentColor;stroke-width:3}
.dash-line-labels{
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  display:grid;
  grid-template-columns:repeat(6,1fr);
  gap:4px;
  color:#64748b;
  font-size:.72rem;
  font-weight:800;
  text-align:center;
}
.dash-legend-flow{margin:4px 0 0}

.dash-progress-list,
.dash-recent-list{display:grid;gap:11px}
.dash-progress-row,
.dash-recent-row{
  width:100%;
  border:0;
  background:transparent;
  padding:0;
  text-align:left;
  cursor:pointer;
  color:inherit;
}
.dash-progress-row{
  display:grid;
  grid-template-columns:minmax(90px,1fr) minmax(72px,1.15fr) auto;
  align-items:center;
  gap:12px;
}
.dash-pr-name{
  color:#475569;
  font-size:.84rem;
  font-weight:800;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.dash-pr-bar{
  height:7px;
  border-radius:999px;
  background:#e5e7eb;
  overflow:hidden;
}
.dash-pr-bar i{
  display:block;
  height:100%;
  border-radius:999px;
  background:#4f7cff;
}
.dash-progress-row strong{
  color:#334155;
  font-size:.84rem;
  font-weight:900;
  white-space:nowrap;
}
.dash-progress-row:hover .dash-pr-name,
.dash-recent-row:hover strong{color:#16a34a}
.dash-recent-row{
  display:grid;
  grid-template-columns:12px minmax(0,1fr) auto;
  align-items:center;
  gap:12px;
  padding:4px 0;
}
.dash-doc-dot{
  width:10px;
  height:10px;
  border-radius:50%;
  background:#94a3b8;
}
.dash-doc-dot.budgets{background:#22c55e}
.dash-doc-dot.invoices{background:#ef4444}
.dash-doc-dot.delivery{background:#2563eb}
.dash-doc-main,
.dash-doc-side{display:grid;gap:2px}
.dash-doc-main strong,
.dash-doc-side strong{
  color:#0f172a;
  font-size:.86rem;
  font-weight:900;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.dash-doc-main small,
.dash-doc-side small{
  color:#64748b;
  font-size:.73rem;
  font-weight:700;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.dash-doc-side{text-align:right}
.dash-empty-good{
  min-height:150px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  color:#64748b;
  border:1px dashed #cbd5e1;
  border-radius:16px;
  background:#f8fafc;
  padding:20px;
  font-size:.88rem;
  font-weight:800;
  line-height:1.5;
}

@media (max-width:1180px){
  .dash-pro-kpis{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .dash-pro-grid-main{grid-template-columns:1fr}
  .dash-pro-grid-bottom{grid-template-columns:1fr 1fr}
  .dash-pro-grid-bottom .dash-pro-card:last-child{grid-column:1/-1}
}
@media (max-width:760px){
  .dash-pro{gap:14px}
  .dash-pro-header{gap:12px}
  .dash-period-box{width:100%;justify-content:stretch;display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .dash-period-box label{width:100%;justify-content:space-between;padding:0 9px}
  .dash-period-box input{width:110px;font-size:.82rem}
  .dash-period-quick,.dash-period-apply{width:100%;padding:0 8px}
  .dash-pro-kpis{grid-template-columns:1fr!important;gap:12px!important}
  .dash-pro-kpi{min-height:136px;padding:17px}
  .dash-kpi-icon{width:44px;height:44px;font-size:1.1rem}
  .dash-spark{width:106px;height:44px;right:10px;bottom:2px}
  .dash-pro-grid-main,.dash-pro-grid-bottom{grid-template-columns:1fr}
  .dash-pro-grid-bottom .dash-pro-card:last-child{grid-column:auto}
  .dash-pro-card{padding:16px;border-radius:18px}
  .dash-bars{gap:8px;padding-inline:0;min-height:210px}
  .dash-bar-stack{gap:5px;height:150px}
  .dash-bar{min-width:8px}
  .dash-bar-group small{font-size:.65rem;transform:rotate(-20deg);transform-origin:center top}
  .dash-donut-wrap{grid-template-columns:1fr;justify-items:center}
  .dash-donut-list{width:100%}
  .dash-donut-row{grid-template-columns:minmax(0,1fr) 38px auto;font-size:.78rem}
  .dash-progress-row{grid-template-columns:1fr;gap:6px;padding:7px 0;border-bottom:1px solid #eef2f7}
  .dash-progress-row strong{text-align:left}
  .dash-recent-row{grid-template-columns:10px minmax(0,1fr);gap:9px;padding:8px 0;border-bottom:1px solid #eef2f7}
  .dash-doc-side{grid-column:2;text-align:left;display:flex;gap:8px;align-items:center;justify-content:space-between}
}
@media (max-width:420px){
  .dash-period-box{grid-template-columns:1fr}
  .dash-period-box label{height:auto;min-height:40px}
  .dash-period-box input{width:100%;text-align:right}
}


/* Serigrafía simplificada v1.7 */
.hbe-cust-row.is-serigraphy {
  border-left: 3px solid #2563eb;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}
.hbe-seri-box-simple {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #f9fafb;
  overflow: hidden;
}
.hbe-seri-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.4fr) minmax(135px, .8fr) minmax(145px, .8fr) minmax(140px, .8fr);
  gap: 10px;
  align-items: end;
}
.hbe-seri-field,
.invoice-seri-box .hbe-seri-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.hbe-seri-field label,
.invoice-seri-box .hbe-seri-field span {
  font-size: .68rem;
  font-weight: 800;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.hbe-seri-field input,
.invoice-seri-box .hbe-seri-field input {
  width: 100%;
  height: 38px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0 10px;
  background: #fff;
  color: #111827;
}
.hbe-seri-field input:disabled,
.invoice-seri-box .hbe-seri-field input:disabled,
.hbe-cust-price:disabled,
.invoice-cust-price-wrap input:disabled {
  background: #f3f4f6;
  color: #6b7280;
  cursor: not-allowed;
}
.hbe-seri-color-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.hbe-seri-color-btn {
  min-width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid #dbe3ef;
  background: #fff;
  color: #334155;
  font-weight: 800;
  cursor: pointer;
}
.hbe-seri-color-btn:hover { border-color: #2563eb; color: #2563eb; }
.hbe-seri-color-btn.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  box-shadow: 0 8px 18px rgba(37,99,235,.18);
}
.hbe-seri-screen-toggle {
  height: 38px;
  justify-content: center;
  align-self: end;
  white-space: nowrap;
}
.hbe-seri-breakdown {
  margin-top: 10px;
  border-top: 1px dashed #d7dde8;
  padding-top: 9px;
  display: grid;
  gap: 6px;
}
.hbe-seri-breakdown > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: .82rem;
  color: #64748b;
}
.hbe-seri-breakdown strong { color: #111827; font-weight: 800; }
.hbe-seri-breakdown-total {
  margin-top: 4px;
  padding-top: 7px;
  border-top: 1px solid #e5e7eb;
  color: #111827 !important;
}
.invoice-seri-box.hbe-seri-box-simple {
  margin: 8px 12px 0;
}
@media (max-width: 980px) {
  .hbe-seri-row {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 640px) {
  .hbe-seri-row {
    grid-template-columns: 1fr;
  }
  .hbe-seri-breakdown > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
  .hbe-seri-color-buttons { gap: 5px; }
  .hbe-seri-color-btn { flex: 1 1 32px; }
}

/* ════════════════════════════════════════════════════════════════════
   PRESULAB · ASISTENTE GUIADO V1
   ════════════════════════════════════════════════════════════════════ */
.nav-assistant {
  position: relative;
  overflow: hidden;
}
.nav-assistant::after {
  content: 'nuevo';
  margin-left: auto;
  font-size: 9px;
  line-height: 1;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: .08em;
  padding: 4px 6px;
  border-radius: 999px;
  color: #07110b;
  background: #a3e635;
}

.assistant-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(2, 6, 23, .62);
  backdrop-filter: blur(10px);
}
.assistant-modal {
  width: min(1180px, 100%);
  height: min(780px, calc(100vh - 36px));
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 28px;
  background: #f8fafc;
  box-shadow: 0 30px 90px rgba(15, 23, 42, .35);
  border: 1px solid rgba(255,255,255,.7);
}
.assistant-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  color: #fff;
  background:
    radial-gradient(circle at top left, rgba(163,230,53,.38), transparent 34%),
    linear-gradient(135deg, #0f172a 0%, #111827 46%, #172554 100%);
}
.assistant-head h2 {
  margin: 2px 0 4px;
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: -.03em;
}
.assistant-head p {
  margin: 0;
  max-width: 650px;
  color: rgba(255,255,255,.76);
  font-size: .92rem;
}
.assistant-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #bef264;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.assistant-close {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 14px;
  background: rgba(255,255,255,.10);
  color: #fff;
  font-size: 28px;
  line-height: 34px;
  cursor: pointer;
}
.assistant-content {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}
.assistant-steps {
  padding: 18px;
  border-right: 1px solid #e5e7eb;
  background: #ffffff;
}
.assistant-step {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: #64748b;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}
.assistant-step:disabled {
  cursor: not-allowed;
  opacity: .45;
}
.assistant-step span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e5e7eb;
  color: #334155;
  font-size: .78rem;
}
.assistant-step.is-active {
  color: #0f172a;
  border-color: #bfdbfe;
  background: #eff6ff;
}
.assistant-step.is-active span {
  background: #2563eb;
  color: #fff;
}
.assistant-step.is-done span {
  background: #22c55e;
  color: #07110b;
}
.assistant-panel {
  min-width: 0;
  overflow: auto;
  padding: 24px;
}
.assistant-step-body h3 {
  margin: 0 0 6px;
  color: #0f172a;
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: -.02em;
}
.assistant-step-body h4 {
  margin: 20px 0 10px;
  color: #111827;
  font-size: .95rem;
}
.assistant-muted {
  margin: 0 0 18px;
  color: #64748b;
  font-size: .92rem;
}
.assistant-choice-grid,
.assistant-vat-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.assistant-choice,
.assistant-vat,
.assistant-client,
.assistant-product {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 18px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.assistant-choice:hover,
.assistant-vat:hover,
.assistant-client:hover,
.assistant-product:hover {
  transform: translateY(-1px);
  border-color: #93c5fd;
  box-shadow: 0 10px 24px rgba(15,23,42,.08);
}
.assistant-choice.is-active,
.assistant-vat.is-active,
.assistant-client.is-active,
.assistant-product.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.assistant-choice strong,
.assistant-vat strong,
.assistant-client strong {
  display: block;
  color: #0f172a;
  font-size: .98rem;
  font-weight: 900;
}
.assistant-choice span,
.assistant-vat span,
.assistant-client span {
  display: block;
  margin-top: 5px;
  color: #64748b;
  font-size: .84rem;
  line-height: 1.4;
}
.assistant-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
}
.assistant-field label,
.assistant-custom-fields span,
.assistant-seri-fields span {
  color: #475569;
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.assistant-input,
.assistant-custom-fields input,
.assistant-custom-fields select,
.assistant-seri-fields input,
.assistant-seri-fields select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #dbe3ef;
  border-radius: 13px;
  padding: 0 12px;
  background: #fff;
  color: #0f172a;
  font-weight: 700;
  outline: none;
}
.assistant-input:focus,
.assistant-custom-fields input:focus,
.assistant-custom-fields select:focus,
.assistant-seri-fields input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.assistant-client-list,
.assistant-product-list,
.assistant-custom-list,
.assistant-summary-list,
.assistant-review-list {
  display: grid;
  gap: 10px;
}
.assistant-product-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
}
.assistant-product {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
}
.assistant-product img,
.assistant-product-img {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 12px;
  object-fit: contain;
  background: #f1f5f9;
}
.assistant-product-img {
  display: grid;
  place-items: center;
  color: #2563eb;
  font-weight: 900;
}
.assistant-product strong,
.assistant-product small {
  display: block;
}
.assistant-product strong {
  color: #0f172a;
  font-size: .88rem;
  font-weight: 900;
}
.assistant-product small {
  margin-top: 3px;
  color: #64748b;
  font-size: .76rem;
}
.assistant-product-side,
.assistant-selected-product,
.assistant-help-box,
.assistant-review-head {
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  background: #fff;
  padding: 16px;
}
.assistant-help-box {
  color: #475569;
  line-height: 1.5;
  background: #f8fafc;
}
.assistant-qty {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  gap: 8px;
}
.assistant-qty button,
.assistant-chip,
.assistant-seri-buttons button {
  min-height: 40px;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #fff;
  color: #0f172a;
  font-weight: 900;
  cursor: pointer;
}
.assistant-qty input {
  min-width: 0;
  text-align: center;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  font-weight: 900;
}
.assistant-selected-product strong,
.assistant-selected-product span {
  display: block;
}
.assistant-selected-product span {
  margin-top: 4px;
  color: #64748b;
  font-size: .84rem;
}
.assistant-chip-group {
  margin-top: 14px;
}
.assistant-chip-group > span {
  display: block;
  margin-bottom: 8px;
  color: #475569;
  font-size: .76rem;
  font-weight: 900;
}
.assistant-chip-group > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.assistant-chip.is-active,
.assistant-seri-buttons button.is-active {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}
.assistant-custom-card {
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  padding: 16px;
  background: #fff;
}
.assistant-custom-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.assistant-custom-head strong {
  color: #0f172a;
  font-weight: 900;
}
.assistant-custom-head button {
  border: 0;
  border-radius: 999px;
  padding: 7px 11px;
  background: #fee2e2;
  color: #991b1b;
  font-weight: 900;
  cursor: pointer;
}
.assistant-custom-fields,
.assistant-seri-fields {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.assistant-custom-fields label,
.assistant-seri-fields label {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.assistant-toggle {
  justify-content: center;
  gap: 9px !important;
  flex-direction: row !important;
  align-items: center;
  min-height: 42px;
  border: 1px solid #dbe3ef;
  border-radius: 13px;
  background: #f8fafc;
  padding: 0 12px;
}
.assistant-toggle input {
  width: auto;
  min-height: auto;
}
.assistant-seri-fields {
  margin-top: 12px;
  grid-template-columns: 1.2fr .8fr 1fr 1fr;
  padding-top: 12px;
  border-top: 1px dashed #dbe3ef;
}
.assistant-seri-buttons {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}
.assistant-add-customs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.assistant-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.assistant-summary > div,
.assistant-summary-list > div {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #fff;
  padding: 12px;
}
.assistant-summary span,
.assistant-summary-list span {
  display: block;
  color: #64748b;
  font-size: .78rem;
}
.assistant-summary strong,
.assistant-summary-list strong {
  display: block;
  color: #0f172a;
  font-weight: 900;
  margin-top: 4px;
}
.assistant-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.assistant-review-issue,
.assistant-review-ok {
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 800;
}
.assistant-review-issue {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}
.assistant-review-ok {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #bbf7d0;
}
.assistant-empty,
.assistant-loading {
  border: 1px dashed #cbd5e1;
  border-radius: 18px;
  padding: 18px;
  color: #64748b;
  text-align: center;
  background: #fff;
}
.assistant-loading {
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.assistant-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}
.assistant-foot-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.assistant-field-help {
  display: block;
  margin-top: -3px;
  color: #64748b;
  font-size: .78rem;
  font-weight: 700;
}
.assistant-selected-bar,
.assistant-occasional-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  border: 1px solid #dbeafe;
  border-radius: 18px;
  background: #eff6ff;
  padding: 12px;
}
.assistant-selected-bar span {
  display: block;
  color: #64748b;
  font-size: .75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.assistant-selected-bar strong {
  display: block;
  margin-top: 3px;
  color: #0f172a;
  font-weight: 900;
}
.assistant-occasional-box {
  align-items: flex-end;
  margin-top: 14px;
  background: #fff;
  border-color: #e5e7eb;
}
.assistant-occasional-box .assistant-field {
  flex: 1 1 auto;
  margin-bottom: 0;
}
.assistant-save-product-toggle {
  justify-content: flex-start;
  margin: -2px 0 14px;
  min-height: 42px;
}
.assistant-vat-options-simple {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.assistant-selected-bar {
  align-items: flex-start;
}
.assistant-occasional-box .btn,
.assistant-selected-bar .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .assistant-overlay { padding: 0; align-items: stretch; }
  .assistant-modal { width: 100%; height:100vh; max-height: 100vh; border-radius: 0; }
  .assistant-content { grid-template-columns: 1fr; min-height: 0; }
  .assistant-steps {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px;
  }
  .assistant-step { width: auto; white-space: nowrap; margin-bottom: 0; flex: 0 0 auto; }
  .assistant-panel { padding: 16px; }
  .assistant-choice-grid,
  .assistant-vat-options,
  .assistant-product-grid,
  .assistant-summary,
  .assistant-custom-fields,
  .assistant-seri-fields { grid-template-columns: 1fr; }
  .assistant-head { padding: 18px; }
  .assistant-head h2 { font-size: 1.2rem; }
  .assistant-foot { align-items: stretch; flex-direction: column; }
  .assistant-foot .btn,
  .assistant-foot-actions,
  .assistant-foot-actions .btn { width: 100%; }
  .assistant-selected-bar,
  .assistant-occasional-box { flex-direction: column; align-items: stretch; }
  .assistant-selected-bar .btn,
  .assistant-occasional-box .btn { width: 100%; }
}

/* ────────────────────────────────────────────────────────────────
   PRESULAB · INFORMES / LIBROS FISCALES v1
   ──────────────────────────────────────────────────────────────── */
.reports-header { align-items:center; }
.reports-datebar { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.reports-datebar input,
.reports-quarter-filter input,
.reports-quarter-filter select {
  height:38px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fff;
  color:var(--text-primary);
  padding:0 11px;
  font-weight:650;
  outline:none;
}
.reports-datebar input:focus,
.reports-quarter-filter input:focus,
.reports-quarter-filter select:focus,
.reports-field input:focus,
.reports-field select:focus {
  border-color:#93c5fd;
  box-shadow:0 0 0 3px rgba(37,99,235,.12);
}
.reports-layout {
  display:grid;
  grid-template-columns:230px minmax(0,1fr);
  gap:18px;
  align-items:start;
}
.reports-tabs {
  position:sticky;
  top:calc(var(--topbar-h) + 18px);
  background:#fff;
  border:1px solid var(--border);
  border-radius:16px;
  padding:8px;
  box-shadow:var(--shadow-sm);
}
.reports-tab {
  width:100%;
  display:flex;
  align-items:center;
  justify-content:flex-start;
  min-height:38px;
  padding:8px 11px;
  border-radius:11px;
  color:#64748b;
  font-size:.84rem;
  font-weight:800;
  text-align:left;
}
.reports-tab:hover { background:#f8fafc; color:#0f172a; }
.reports-tab.active { background:#eaf8dc; color:#184706; box-shadow:inset 3px 0 0 #22c55e; }
.reports-panel { min-width:0; }
.reports-grid { display:grid; gap:14px; margin-bottom:16px; }
.reports-grid-4 { grid-template-columns:repeat(4,minmax(0,1fr)); }
.reports-grid-2 { grid-template-columns:repeat(2,minmax(0,1fr)); }
.reports-kpi,
.reports-card {
  background:#fff;
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:var(--shadow-sm);
}
.reports-kpi {
  min-height:126px;
  padding:18px 18px 16px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  border-top:4px solid #2563eb;
}
.reports-kpi span { color:#64748b; font-size:.82rem; font-weight:800; }
.reports-kpi strong { font-size:1.55rem; font-family:var(--font-display); letter-spacing:-.04em; }
.reports-kpi small { color:#94a3b8; font-weight:700; }
.reports-kpi-blue { border-top-color:#2563eb; }
.reports-kpi-green { border-top-color:#22c55e; }
.reports-kpi-orange { border-top-color:#f59e0b; }
.reports-kpi-red { border-top-color:#ef4444; }
.reports-card { margin-bottom:16px; overflow:hidden; }
.reports-card-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:18px 18px 14px;
  border-bottom:1px solid var(--border-soft);
}
.reports-card-head h3 { font-family:var(--font-display); font-size:1.05rem; letter-spacing:-.02em; }
.reports-card-head p { color:#64748b; font-size:.84rem; margin-top:2px; }
.reports-metrics { padding:8px 18px 18px; }
.reports-metrics div {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 0;
  border-bottom:1px solid #f1f5f9;
}
.reports-metrics div:last-child { border-bottom:none; }
.reports-metrics span { color:#64748b; font-weight:700; }
.reports-metrics strong { font-weight:900; }
.reports-issues,
.reports-audit-list { list-style:none; padding:14px 18px 18px; display:flex; flex-direction:column; gap:8px; }
.reports-issues li,
.reports-audit-list li {
  display:flex;
  gap:10px;
  align-items:flex-start;
  background:#fff7ed;
  border:1px solid #fed7aa;
  color:#9a3412;
  border-radius:12px;
  padding:10px 12px;
  font-size:.86rem;
  font-weight:700;
}
.reports-audit-list li span { flex:0 0 auto; }
.reports-ok {
  margin:18px;
  padding:14px;
  border-radius:12px;
  background:#f0fdf4;
  border:1px solid #bbf7d0;
  color:#166534;
  font-weight:800;
}
.reports-ok-big { min-height:120px; display:flex; align-items:center; justify-content:center; text-align:center; }
.reports-legal-card { padding-bottom:12px; }
.reports-legal-card h3 { padding:18px 18px 0; font-family:var(--font-display); }
.reports-legal-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; padding:16px 18px 18px; }
.reports-legal-grid div { background:#f8fafc; border:1px solid #e2e8f0; border-radius:14px; padding:14px; }
.reports-legal-grid strong { display:block; margin-bottom:5px; }
.reports-legal-grid span { display:block; color:#64748b; font-size:.84rem; line-height:1.45; }
.reports-warning {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  margin-bottom:16px;
  border-radius:14px;
  background:#fff7ed;
  border:1px solid #fed7aa;
  color:#9a3412;
  font-size:.88rem;
}
.reports-warning code { background:#ffedd5; border:1px solid #fed7aa; border-radius:7px; padding:2px 6px; }
.reports-table-wrap { width:100%; overflow:auto; }
.reports-table th,
.reports-table td { white-space:nowrap; }
.reports-table td:nth-last-child(1),
.reports-table th:nth-last-child(1) { text-align:left; }
.reports-form {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  padding:16px 18px;
  border-bottom:1px solid var(--border-soft);
  background:#fbfdff;
}
.reports-form-compact { grid-template-columns:repeat(3,minmax(0,1fr)); }
.reports-form-title { grid-column:1/-1; font-weight:900; font-family:var(--font-display); font-size:1rem; }
.reports-field { display:flex; flex-direction:column; gap:5px; min-width:0; }
.reports-field span {
  font-size:.7rem;
  font-weight:900;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:#94a3b8;
}
.reports-field input,
.reports-field select {
  width:100%;
  min-height:38px;
  border:1px solid #dbe3ee;
  border-radius:10px;
  background:#fff;
  color:#0f172a;
  padding:0 10px;
  font-weight:700;
  outline:none;
}
.reports-check {
  display:flex;
  align-items:center;
  gap:8px;
  min-height:38px;
  margin-top:19px;
  font-weight:800;
  color:#334155;
}
.reports-check input { width:16px; height:16px; accent-color:#2563eb; }
.reports-form-total {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  min-height:38px;
  margin-top:19px;
  padding:0 12px;
  border-radius:10px;
  background:#f1f5f9;
  color:#64748b;
  font-weight:800;
}
.reports-form-total strong { color:#0f172a; font-size:1rem; }
.reports-form-actions {
  grid-column:1/-1;
  display:flex;
  justify-content:flex-end;
  gap:8px;
  padding-top:4px;
}
.reports-row-actions { display:flex; gap:6px; justify-content:flex-end; }
.reports-quarter-filter { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.reports-quarter-filter input { width:92px; }
.reports-quarter-filter select { min-width:82px; }
.reports-export-grid {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
  padding:18px;
}
.reports-export-btn {
  display:flex;
  flex-direction:column;
  gap:4px;
  align-items:flex-start;
  min-height:88px;
  padding:16px;
  border-radius:15px;
  border:1px solid #dbe3ee;
  background:#fff;
  color:#0f172a;
  transition:background .14s,border-color .14s,transform .1s;
}
.reports-export-btn:hover { background:#f8fafc; border-color:#93c5fd; transform:translateY(-1px); }
.reports-export-btn strong { font-size:.95rem; }
.reports-export-btn span { color:#64748b; font-size:.82rem; font-weight:700; }
.reports-note { padding:16px 18px; color:#475569; line-height:1.55; }
.btn-sm { padding:7px 11px!important; font-size:.78rem!important; }

@media (max-width: 1180px) {
  .reports-grid-4 { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .reports-legal-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .reports-form { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .reports-layout { grid-template-columns:1fr; }
  .reports-tabs {
    position:static;
    display:flex;
    overflow-x:auto;
    gap:6px;
    padding:8px;
  }
  .reports-tab { width:auto; flex:0 0 auto; min-width:max-content; }
  .reports-datebar { width:100%; display:grid; grid-template-columns:1fr 1fr; }
  .reports-datebar .btn { grid-column:1/-1; }
  .reports-grid-4,
  .reports-grid-2,
  .reports-legal-grid,
  .reports-export-grid { grid-template-columns:1fr; }
  .reports-card-head { flex-direction:column; align-items:stretch; }
  .reports-card-head .btn { width:100%; }
  .reports-form,
  .reports-form-compact { grid-template-columns:1fr; }
  .reports-check,
  .reports-form-total { margin-top:0; }
  .reports-form-actions { flex-direction:column; }
  .reports-form-actions .btn { width:100%; }
  .reports-warning { flex-direction:column; align-items:flex-start; }
}
@media (max-width: 520px) {
  #content { padding-left:12px!important; padding-right:12px!important; }
  .reports-datebar { grid-template-columns:1fr; }
  .reports-kpi strong { font-size:1.35rem; }
}

/* ─── Informes contables v2 ───────────────────────────────────── */
.reports-toolbar {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 18px;
  border-bottom:1px solid var(--border-soft);
  background:#fbfdff;
}
.reports-search {
  flex:1 1 auto;
  min-width:0;
  height:40px;
  border:1px solid #dbe3ee;
  border-radius:12px;
  padding:0 12px;
  font-weight:750;
  outline:none;
  background:#fff;
  color:#0f172a;
}
.reports-search:focus {
  border-color:#93c5fd;
  box-shadow:0 0 0 3px rgba(37,99,235,.12);
}
.reports-toolbar-note {
  color:#64748b;
  font-size:.82rem;
  font-weight:750;
  white-space:nowrap;
}
.reports-head-actions { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.reports-card-head-tools { align-items:center; }
.reports-form-total strong { display:flex; flex-direction:column; align-items:flex-end; gap:1px; }
.reports-form-total small { color:#64748b; font-size:.72rem; font-weight:800; }
.btn-success {
  background:#dcfce7!important;
  color:#166534!important;
  border:1px solid #bbf7d0!important;
}
.btn-success:hover { background:#bbf7d0!important; }
.reports-action-grid .reports-export-btn { cursor:pointer; }
.reports-mini-kpis .reports-kpi { min-height:104px; }
@media (max-width: 820px) {
  .reports-toolbar { flex-direction:column; align-items:stretch; }
  .reports-toolbar-note { white-space:normal; }
  .reports-head-actions { justify-content:stretch; }
  .reports-head-actions .btn { flex:1 1 100%; }
}

/* PresuLab · Contabilidad v3 */
.dash-bar-paid{background:linear-gradient(180deg,#2563eb,#60a5fa)!important}
.dash-line-c{color:#f59e0b}
.invoice-pay-chip{display:block;margin-top:3px;font-size:.67rem;font-weight:800;color:#2563eb;text-transform:uppercase;letter-spacing:.04em}
.text-danger{color:#dc2626!important}.text-success{color:#16a34a!important}
.reports-ok-mini{display:inline-flex;align-items:center;min-height:28px;padding:0 9px;border-radius:999px;background:#dcfce7;color:#166534;font-size:.74rem;font-weight:800}
.reports-row-actions{display:flex;flex-wrap:wrap;gap:6px;align-items:center}.reports-row-actions .btn{white-space:nowrap}
.reports-table td:nth-last-child(1){min-width:140px}
@media(max-width:760px){.reports-row-actions{display:grid;grid-template-columns:1fr;min-width:120px}.reports-row-actions .btn{width:100%}.invoice-pay-chip{display:inline-block;margin-left:6px}}

/* PresuLab · Informes exportaciones v4 */
.reports-datebar-pro{flex-wrap:wrap;max-width:860px;justify-content:flex-end}
.reports-datebar-pro input{min-width:150px}.reports-datebar-pro .btn{min-height:38px}
.reports-export-pro-card{overflow:hidden}.reports-export-sections{display:grid;gap:16px;padding:18px}.reports-export-section{border:1px solid #e2e8f0;border-radius:18px;background:#fbfdff;overflow:hidden}.reports-export-section-head{padding:16px 16px 0}.reports-export-section-head h4{font-family:var(--font-display);font-size:1rem;margin:0 0 3px;color:#0f172a}.reports-export-section-head p{margin:0;color:#64748b;font-size:.84rem;font-weight:650}.reports-export-grid-pro{grid-template-columns:repeat(3,minmax(0,1fr));padding:14px 16px 16px}.reports-export-btn-main{background:linear-gradient(135deg,#0f172a,#1e293b)!important;color:#fff!important;border-color:#0f172a!important}.reports-export-btn-main span{color:#dbeafe!important}.reports-print-page{max-width:960px!important;width:100%;background:#fff}.reports-print-overlay .pdf-preview-area{align-items:flex-start}.reports-print-overlay .pdf-page-shadow{overflow:visible}.reports-print-overlay .report-print-doc{box-shadow:none}
@media(max-width:1080px){.reports-export-grid-pro{grid-template-columns:repeat(2,minmax(0,1fr))}.reports-datebar-pro{justify-content:stretch}.reports-datebar-pro input,.reports-datebar-pro .btn{flex:1 1 auto}}
@media(max-width:820px){.reports-datebar-pro{display:grid!important;grid-template-columns:1fr 1fr}.reports-datebar-pro input,.reports-datebar-pro .btn{width:100%;min-width:0}.reports-export-grid-pro{grid-template-columns:1fr}.reports-export-sections{padding:12px}.reports-export-section-head{padding:14px 14px 0}.reports-print-page{width:100%;max-width:100%!important}.reports-print-overlay .pdf-preview-area{padding:12px}.reports-print-overlay .report-print-doc{padding:18px}}
@media(max-width:520px){.reports-datebar-pro{grid-template-columns:1fr}.reports-export-btn{min-height:74px}.reports-print-overlay .pdf-modal-bar{height:auto;min-height:52px;padding:10px;align-items:flex-start}.reports-print-overlay .pdf-modal-bar-right{width:100%;justify-content:flex-end;flex-wrap:wrap}}

/* ─── PresuLab v5 · Auditoría / trazabilidad ───────────────────────────── */
.reports-audit-table th,
.reports-audit-table td { font-size:.82rem; vertical-align:top; }
.audit-severity {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:58px;
  padding:4px 8px;
  border-radius:999px;
  font-size:.72rem;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.02em;
  background:#eef2ff;
  color:#3730a3;
}
.audit-warning { background:#fff7ed; color:#9a3412; }
.audit-error { background:#fef2f2; color:#991b1b; }
.audit-info { background:#eff6ff; color:#1d4ed8; }
.audit-success { background:#f0fdf4; color:#166534; }
.reports-empty-soft {
  margin:18px;
  padding:22px;
  border:1px dashed #cbd5e1;
  border-radius:16px;
  background:#f8fafc;
  color:#64748b;
  font-weight:800;
  text-align:center;
}
.reports-warning-inside { margin:18px; }
.invoice-lock-notice {
  margin:0 0 14px;
  padding:12px 14px;
  border:1px solid #fed7aa;
  border-radius:14px;
  background:#fff7ed;
  color:#9a3412;
  font-size:.84rem;
  font-weight:800;
  line-height:1.45;
}
@media (max-width: 780px) {
  .reports-audit-table { min-width:720px; }
}
.reports-grid-3 { grid-template-columns:repeat(3,minmax(0,1fr)); }
@media (max-width: 960px) { .reports-grid-3 { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width: 640px) { .reports-grid-3 { grid-template-columns:1fr; } }

/* PresuLab v6 · Rectificativas */
.invoice-type-chip{
  display:inline-flex;
  margin-top:4px;
  padding:2px 7px;
  border-radius:999px;
  background:#fff7ed;
  color:#9a3412;
  border:1px solid #fed7aa;
  font-size:.68rem;
  font-weight:900;
  letter-spacing:.02em;
}
.invoice-rectify-notice{
  margin:12px 18px 0;
  padding:11px 14px;
  border:1px solid #fecaca;
  background:#fff7ed;
  color:#9a3412;
  border-radius:14px;
  font-size:.84rem;
  font-weight:800;
  line-height:1.35;
}
.hbe-btn-rectify{
  border-color:#fed7aa!important;
  background:#fff7ed!important;
  color:#9a3412!important;
}
.invoice-rectifying-field input[disabled]{
  background:#f8fafc;
  color:#64748b;
  font-weight:800;
}
.invoice-rectifying-reason{grid-column:span 2;}
@media(max-width:760px){.invoice-rectifying-reason{grid-column:auto}.hbe-btn-rectify{width:100%}}


/* Fix albaranes: cabecera flexible y sin recortes */
.hde-meta-row{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))!important;align-items:end}
.hde-meta-row .hbe-meta-contact{grid-column:span 2}
.hde-meta-row .hbe-meta-grow{grid-column:span 2}
.hbe-card.hbe-meta-card{overflow:visible}
@media(max-width:900px){.hde-meta-row .hbe-meta-contact,.hde-meta-row .hbe-meta-grow{grid-column:1/-1}}

/* ─── Técnicas PRO · Tarifas JF v7 ─────────────────────────────────────── */
.tech-pro-header{align-items:flex-start;gap:16px;flex-wrap:wrap}
.tech-pro-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.tech-pro-tabs{display:flex;gap:10px;flex-wrap:wrap;margin:4px 0 12px}
.tech-tab,.tech-aud{border:1px solid var(--border);background:#fff;border-radius:999px;padding:10px 16px;font-weight:800;color:var(--text-secondary);cursor:pointer}
.tech-tab.active,.tech-aud.active{background:linear-gradient(135deg,var(--blue),#114ee8);color:#fff;border-color:transparent;box-shadow:0 10px 22px rgba(37,99,235,.18)}
.tech-pro-audience{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}
.tech-pro-panel{background:#fff;border:1px solid var(--border);border-radius:22px;padding:18px;box-shadow:0 18px 42px rgba(15,23,42,.06);overflow:hidden}
.tech-pro-titlebar{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;margin-bottom:14px}
.tech-pro-titlebar h3{font-size:22px;margin:0 0 4px;color:var(--text-primary)}
.tech-pro-titlebar p{margin:0;color:var(--text-muted)}
.tech-pro-tablewrap{overflow:auto;border-radius:16px;border:1px solid var(--border)}
.tech-pro-matrix,.tech-pro-mini{width:100%;border-collapse:separate;border-spacing:0;background:#fff;font-size:13px}
.tech-pro-matrix th,.tech-pro-mini th{background:#0f172a;color:#fff;text-align:left;padding:11px 12px;font-size:11px;text-transform:uppercase;letter-spacing:.04em;white-space:nowrap}
.tech-pro-matrix td,.tech-pro-mini td{border-top:1px solid var(--border);padding:8px 10px;vertical-align:middle;white-space:nowrap}
.tech-pro-matrix td:first-child{min-width:260px;white-space:normal}
.tech-price-cell{width:96px;min-width:84px;border:1px solid var(--border);border-radius:10px;padding:8px 10px;text-align:right;font-weight:800;background:#fff}
.tech-price-cell:focus{border-color:var(--blue);box-shadow:0 0 0 3px rgba(37,99,235,.12);outline:0}
.tech-pro-grid2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.tech-pro-grid2 .card{box-shadow:none}
.pl-alert{border-radius:16px;padding:12px 14px;margin:0 0 14px;font-size:14px;line-height:1.45;border:1px solid var(--border)}
.pl-alert-warn{background:#fffbeb;border-color:#fde68a;color:#92400e}
.hbe-cust-tariff{min-width:130px;max-width:160px}
.invoice-cust-tariff{min-width:130px}
@media(max-width:900px){
  .tech-pro-actions{width:100%;justify-content:stretch}.tech-pro-actions .btn{flex:1}
  .tech-pro-panel{padding:12px;border-radius:18px}.tech-pro-grid2{grid-template-columns:1fr}
  .tech-pro-matrix td:first-child{min-width:210px}.tech-price-cell{width:86px}
}


/* === PRESULAB V7.1 · Técnicas visibles + editor más claro === */
.tech-price-cell{
  min-width:86px;
  height:38px;
  border:1px solid #dbe3ee;
  border-radius:12px;
  padding:0 10px;
  text-align:center;
  font-weight:850;
  color:#0f172a;
  background:#fff;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.6);
}
.tech-price-cell:focus{
  outline:none;
  border-color:#2563eb;
  box-shadow:0 0 0 4px rgba(37,99,235,.12);
}
.tech-pro-matrix td:not(:first-child),
.tech-pro-mini td:not(:first-child){text-align:center}
.tech-pro-tablewrap{background:#fff}
.tech-pro-matrix tbody tr:hover td{background:#f8fafc}
.tech-pro-matrix td:first-child strong{display:block;line-height:1.25}

/* Editor de documentos: personalizaciones tipo tarjeta, más legibles */
.hbe-custom-panel,
.invoice-custom-panel{
  background:#f8fafc!important;
}
.hbe-cust-row,
.invoice-cust-row{
  border:1px solid #dbeafe!important;
  border-left:4px solid #2563eb!important;
  border-radius:18px!important;
  padding:14px!important;
  background:linear-gradient(180deg,#ffffff 0%,#fbfdff 100%)!important;
  box-shadow:0 10px 28px rgba(15,23,42,.05)!important;
  overflow:visible!important;
}
.hbe-cust-row.is-manual,
.invoice-cust-row.is-manual{
  border-left-color:#22c55e!important;
}
.hbe-cust-line1,
.hbe-cust-line2{
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(142px,1fr))!important;
  gap:10px!important;
  align-items:end!important;
}
.hbe-cust-line2{
  margin-top:10px!important;
  padding-top:10px!important;
  border-top:1px dashed #e2e8f0!important;
}
.invoice-cust-grid{
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(138px,1fr))!important;
  gap:10px!important;
  align-items:end!important;
}
.invoice-cust-field,
.hbe-cust-qty-group,
.hbe-cust-price-wrap,
.hbe-cust-notes-wrap,
.hbe-cust-total-wrap,
.invoice-cust-total-box{
  min-width:0!important;
}
.hbe-cust-select,
.hbe-cust-input,
.invoice-cust-grid .hbe-cust-select,
.invoice-cust-grid .hbe-cust-input{
  min-width:0!important;
  width:100%!important;
  height:42px!important;
  border-radius:13px!important;
  border:1px solid #dbe3ee!important;
  background:#fff!important;
  color:#0f172a!important;
  font-weight:760!important;
}
.hbe-cust-select:focus,
.hbe-cust-input:focus,
.invoice-cust-grid .hbe-cust-select:focus,
.invoice-cust-grid .hbe-cust-input:focus{
  outline:none!important;
  border-color:#2563eb!important;
  box-shadow:0 0 0 4px rgba(37,99,235,.12)!important;
}
.hbe-cust-sublabel,
.invoice-cust-field > span,
.invoice-cust-total-box > span,
.hbe-seri-field label,
.hbe-seri-field > span{
  display:block!important;
  margin-bottom:5px!important;
  font-size:.68rem!important;
  line-height:1.1!important;
  text-transform:uppercase!important;
  letter-spacing:.055em!important;
  font-weight:950!important;
  color:#94a3b8!important;
}
.hbe-cust-autoprice{
  height:42px!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  border:1px solid #e2e8f0!important;
  border-radius:13px!important;
  background:#f8fafc!important;
  font-weight:950!important;
  color:#334155!important;
}
.hbe-manual-toggle,
.invoice-manual-toggle{
  min-height:42px!important;
  border-radius:13px!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:6px!important;
  padding:0 12px!important;
  border:1px solid #dbe3ee!important;
  background:#fff!important;
  color:#64748b!important;
  font-weight:950!important;
  cursor:pointer!important;
  white-space:nowrap!important;
}
.hbe-manual-toggle.is-active,
.invoice-manual-toggle.is-active{
  border-color:#16a34a!important;
  background:#ecfdf5!important;
  color:#15803d!important;
}
.hbe-vat-toggle.is-active,
.invoice-vat-toggle.is-active{
  border-color:#2563eb!important;
  background:#eff6ff!important;
  color:#1d4ed8!important;
}
.hbe-seri-box,
.invoice-seri-box{
  margin-top:12px!important;
  padding:14px!important;
  border-radius:16px!important;
  border:1px solid #e2e8f0!important;
  background:#f8fafc!important;
}
.hbe-seri-row{
  display:grid!important;
  grid-template-columns:minmax(190px,1.3fr) minmax(150px,1fr) minmax(150px,1fr) minmax(150px,1fr)!important;
  gap:10px!important;
  align-items:end!important;
}
.hbe-seri-color-buttons{
  display:flex!important;
  flex-wrap:wrap!important;
  gap:8px!important;
}
.hbe-seri-color-btn{
  width:38px!important;
  height:38px!important;
  border-radius:999px!important;
  border:1px solid #dbe3ee!important;
  background:#fff!important;
  color:#334155!important;
  font-weight:950!important;
}
.hbe-seri-color-btn.is-active{
  background:#2563eb!important;
  border-color:#2563eb!important;
  color:#fff!important;
  box-shadow:0 8px 18px rgba(37,99,235,.22)!important;
}
.hbe-seri-field input,
.hbe-seri-field select{
  height:42px!important;
  border-radius:13px!important;
  border:1px solid #dbe3ee!important;
  background:#fff!important;
  padding:0 10px!important;
  width:100%!important;
  min-width:0!important;
  font-weight:800!important;
}
.hbe-seri-breakdown{
  margin-top:12px!important;
  border-top:1px dashed #dbe3ee!important;
  padding-top:10px!important;
}
.hbe-seri-breakdown > div{
  display:flex!important;
  justify-content:space-between!important;
  gap:12px!important;
  padding:5px 0!important;
  color:#475569!important;
}
.hbe-seri-breakdown-total{
  border-top:1px solid #e2e8f0!important;
  margin-top:6px!important;
  padding-top:10px!important;
  color:#0f172a!important;
}
.hbe-cust-total,
.invoice-cust-total-box strong{
  color:#0f172a!important;
  font-size:1.02rem!important;
}
.hbe-cust-del,
.invoice-cust-delete{
  border-radius:12px!important;
  border:1px solid #fecaca!important;
  background:#fff!important;
  color:#dc2626!important;
  font-weight:950!important;
}
@media (max-width:1100px){
  .hbe-seri-row{grid-template-columns:1fr 1fr!important}
}
@media (max-width:720px){
  .hbe-cust-line1,
  .hbe-cust-line2,
  .invoice-cust-grid,
  .hbe-seri-row{
    grid-template-columns:1fr!important;
  }
  .hbe-seri-breakdown > div{
    align-items:flex-start!important;
    flex-direction:column!important;
    gap:2px!important;
  }
}
/* === /PRESULAB V7.1 === */


/* === PRESULAB V7.2 · Correcciones editor clientes + serigrafía === */
.hbe-select-group{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) 42px!important;
  gap:8px!important;
  align-items:center!important;
}
.hbe-select-group .hbe-select{min-width:0!important;width:100%!important;}
.hbe-add-btn{
  width:42px!important;
  height:42px!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  border-radius:13px!important;
  border:1px solid #dbe3ee!important;
  background:#fff!important;
  color:#2563eb!important;
  font-weight:950!important;
  font-size:1.15rem!important;
  cursor:pointer!important;
  box-shadow:0 1px 2px rgba(15,23,42,.04)!important;
}
.hbe-add-btn:hover{background:#2563eb!important;color:#fff!important;border-color:#2563eb!important;}

.hbe-cust-row.is-serigraphy .hbe-cust-line1{
  grid-template-columns: minmax(130px,1fr) minmax(120px,.8fr) minmax(160px,1.2fr) minmax(130px,.9fr) minmax(130px,.8fr) minmax(155px,.9fr) 42px!important;
}
.hbe-cust-row.is-serigraphy .hbe-cust-line2{
  grid-template-columns: minmax(90px,.7fr) minmax(135px,.9fr) minmax(122px,.8fr) minmax(92px,.65fr) minmax(145px,.9fr) minmax(180px,1.3fr) minmax(110px,.8fr)!important;
}
.hbe-cust-row.is-serigraphy .hbe-seri-badge{
  min-height:42px!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  border:1px dashed #bfdbfe!important;
  border-radius:13px!important;
  background:#eff6ff!important;
  color:#1d4ed8!important;
  font-weight:850!important;
  font-size:.78rem!important;
  text-align:center!important;
  padding:0 10px!important;
}
.hbe-seri-box-simple{
  display:block!important;
  position:relative!important;
  overflow:visible!important;
  margin-top:12px!important;
}
.hbe-seri-box-simple .hbe-seri-row{
  display:grid!important;
  grid-template-columns:minmax(190px,1.25fr) minmax(150px,.9fr) minmax(155px,.9fr) minmax(150px,.9fr)!important;
  gap:12px!important;
  align-items:end!important;
}
.hbe-seri-box-simple .hbe-seri-breakdown{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:10px!important;
  margin-top:14px!important;
  padding-top:14px!important;
  border-top:1px dashed #cbd5e1!important;
}
.hbe-seri-box-simple .hbe-seri-breakdown > div{
  display:flex!important;
  flex-direction:column!important;
  align-items:flex-start!important;
  justify-content:center!important;
  gap:4px!important;
  min-height:62px!important;
  padding:10px 12px!important;
  border:1px solid #e2e8f0!important;
  border-radius:14px!important;
  background:#fff!important;
}
.hbe-seri-box-simple .hbe-seri-breakdown > div span{
  font-size:.68rem!important;
  text-transform:uppercase!important;
  letter-spacing:.055em!important;
  font-weight:950!important;
  color:#94a3b8!important;
}
.hbe-seri-box-simple .hbe-seri-breakdown > div strong{
  font-size:.92rem!important;
  line-height:1.22!important;
  color:#0f172a!important;
}
.hbe-seri-box-simple .hbe-seri-breakdown-total{
  margin:0!important;
  border:1px solid #bfdbfe!important;
  background:#eff6ff!important;
}
.hbe-seri-box-simple .hbe-seri-color-buttons{min-height:42px!important;align-items:center!important;}
.hbe-seri-box-simple .hbe-seri-screen-toggle{min-height:42px!important;align-self:end!important;}

@media(max-width:1320px){
  .hbe-cust-row.is-serigraphy .hbe-cust-line1,
  .hbe-cust-row.is-serigraphy .hbe-cust-line2{
    grid-template-columns:repeat(auto-fit,minmax(145px,1fr))!important;
  }
  .hbe-seri-box-simple .hbe-seri-row{grid-template-columns:repeat(2,minmax(0,1fr))!important;}
  .hbe-seri-box-simple .hbe-seri-breakdown{grid-template-columns:1fr!important;}
}
@media(max-width:720px){
  .hbe-select-group{grid-template-columns:minmax(0,1fr) 42px!important;}
  .hbe-cust-row.is-serigraphy .hbe-cust-line1,
  .hbe-cust-row.is-serigraphy .hbe-cust-line2,
  .hbe-seri-box-simple .hbe-seri-row,
  .hbe-seri-box-simple .hbe-seri-breakdown{grid-template-columns:1fr!important;}
}
/* === /PRESULAB V7.2 === */

/* === PRESULAB V7.3 · Editor responsive y serigrafía limpia === */
.hbe-cust-row,
.invoice-cust-row{
  max-width:100%!important;
  overflow:visible!important;
}

.hbe-cust-row.is-serigraphy .hbe-cust-line1,
.hbe-cust-row.is-serigraphy .hbe-cust-line2,
.invoice-cust-row.is-serigraphy .invoice-cust-grid{
  gap:12px!important;
  align-items:end!important;
}

.hbe-cust-row.is-serigraphy .hbe-cust-line1{
  grid-template-columns: minmax(145px,1fr) minmax(145px,1fr) minmax(150px,1.1fr) minmax(135px,.9fr) minmax(135px,.85fr) minmax(44px,44px)!important;
}
.hbe-cust-row.is-serigraphy .hbe-cust-line2{
  grid-template-columns: minmax(90px,.7fr) minmax(145px,.95fr) minmax(130px,.9fr) minmax(120px,.8fr) minmax(175px,1.1fr) minmax(210px,1.4fr) minmax(110px,.75fr)!important;
}
.hbe-cust-row.is-serigraphy .hbe-cust-del{
  align-self:end!important;
}
.hbe-cust-row.is-serigraphy .hbe-seri-badge{
  min-height:42px!important;
  line-height:1.25!important;
  white-space:normal!important;
}

.hbe-seri-box-clean,
.hbe-seri-box-simple.hbe-seri-box-clean,
.invoice-seri-box.hbe-seri-box-clean{
  width:100%!important;
  margin:14px 0 0!important;
  padding:14px!important;
  border:1px solid #dbe7f5!important;
  border-radius:16px!important;
  background:#f8fbff!important;
  overflow:visible!important;
  display:block!important;
  position:relative!important;
}

.hbe-seri-box-clean .hbe-seri-controls{
  display:grid!important;
  grid-template-columns:minmax(185px,1.1fr) minmax(150px,.9fr) minmax(170px,1fr) minmax(155px,.9fr)!important;
  gap:12px!important;
  align-items:end!important;
  width:100%!important;
}

.hbe-seri-box-clean .hbe-seri-field,
.hbe-seri-box-clean label.hbe-seri-field{
  display:flex!important;
  flex-direction:column!important;
  gap:6px!important;
  min-width:0!important;
  width:100%!important;
  margin:0!important;
}
.hbe-seri-box-clean .hbe-seri-field label,
.hbe-seri-box-clean .hbe-seri-field span{
  display:block!important;
  font-size:.68rem!important;
  line-height:1!important;
  font-weight:950!important;
  text-transform:uppercase!important;
  letter-spacing:.055em!important;
  color:#94a3b8!important;
  margin:0!important;
}
.hbe-seri-box-clean .hbe-seri-field input{
  width:100%!important;
  min-width:0!important;
  height:42px!important;
  border-radius:13px!important;
  border:1px solid #dbe3ee!important;
  background:#fff!important;
  padding:0 12px!important;
  font-weight:850!important;
}
.hbe-seri-box-clean .hbe-seri-field input:disabled{
  background:#f1f5f9!important;
  color:#64748b!important;
}
.hbe-seri-box-clean .hbe-seri-color-buttons{
  display:flex!important;
  flex-wrap:wrap!important;
  gap:8px!important;
  min-height:42px!important;
  align-items:center!important;
  width:100%!important;
}
.hbe-seri-box-clean .hbe-seri-color-btn{
  width:40px!important;
  height:40px!important;
  flex:0 0 40px!important;
  border-radius:999px!important;
  border:1px solid #dbe3ee!important;
  background:#fff!important;
  color:#334155!important;
  font-weight:950!important;
  padding:0!important;
  box-shadow:none!important;
}
.hbe-seri-box-clean .hbe-seri-color-btn.is-active{
  background:#2563eb!important;
  color:#fff!important;
  border-color:#2563eb!important;
}
.hbe-seri-box-clean .hbe-seri-screen-toggle{
  width:100%!important;
  height:42px!important;
  min-height:42px!important;
  align-self:end!important;
  margin:0!important;
}

.hbe-seri-box-clean .hbe-seri-summary-list{
  margin-top:14px!important;
  padding-top:12px!important;
  border-top:1px dashed #cbd5e1!important;
  display:grid!important;
  gap:8px!important;
  width:100%!important;
}
.hbe-seri-box-clean .hbe-seri-summary-row{
  display:grid!important;
  grid-template-columns:minmax(110px,160px) minmax(0,1fr)!important;
  align-items:center!important;
  gap:12px!important;
  padding:9px 12px!important;
  border:1px solid #e2e8f0!important;
  border-radius:13px!important;
  background:#fff!important;
  min-height:auto!important;
  width:100%!important;
}
.hbe-seri-box-clean .hbe-seri-summary-row span{
  font-size:.72rem!important;
  text-transform:uppercase!important;
  letter-spacing:.055em!important;
  font-weight:950!important;
  color:#94a3b8!important;
  white-space:nowrap!important;
}
.hbe-seri-box-clean .hbe-seri-summary-row strong{
  text-align:right!important;
  font-size:.92rem!important;
  line-height:1.25!important;
  color:#0f172a!important;
  overflow-wrap:anywhere!important;
}
.hbe-seri-box-clean .hbe-seri-summary-total{
  border-color:#bfdbfe!important;
  background:#eff6ff!important;
}
.hbe-seri-box-clean .hbe-seri-summary-total strong{
  font-size:1rem!important;
  font-weight:950!important;
}

/* Freno definitivo a estilos antiguos de desglose */
.hbe-seri-box-clean .hbe-seri-breakdown,
.hbe-seri-box-clean .hbe-seri-breakdown > div{
  display:none!important;
}

/* Un poco más de aire en cabeceras de cada editor */
.hbe-meta-card,
.invoice-meta-card{
  overflow:visible!important;
}
.hbe-topbar .hbe-top-right button,
.invoice-topbar .hbe-top-right button{
  white-space:nowrap!important;
}

@media(max-width:1280px){
  .hbe-cust-row.is-serigraphy .hbe-cust-line1,
  .hbe-cust-row.is-serigraphy .hbe-cust-line2,
  .invoice-cust-row.is-serigraphy .invoice-cust-grid{
    grid-template-columns:repeat(3,minmax(150px,1fr))!important;
  }
  .hbe-seri-box-clean .hbe-seri-controls{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}

@media(max-width:900px){
  .hbe-body{
    display:block!important;
  }
  .hbe-main,
  .hbe-aside{
    width:100%!important;
    max-width:100%!important;
  }
  .hbe-aside{
    position:static!important;
    margin-top:14px!important;
  }
  .hbe-cust-row.is-serigraphy .hbe-cust-line1,
  .hbe-cust-row.is-serigraphy .hbe-cust-line2,
  .invoice-cust-row.is-serigraphy .invoice-cust-grid,
  .hbe-seri-box-clean .hbe-seri-controls{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}

@media(max-width:640px){
  html,body{
    max-width:100%!important;
    overflow-x:hidden!important;
  }
  #content{
    padding-left:8px!important;
    padding-right:8px!important;
    max-width:100%!important;
    overflow-x:hidden!important;
  }
  .hbe-wrap,
  .hbe-card,
  .hbe-main,
  .hbe-custom-panel,
  .invoice-custom-panel{
    max-width:100%!important;
    width:100%!important;
    overflow:visible!important;
  }
  .hbe-cust-row,
  .invoice-cust-row{
    padding:12px!important;
    border-radius:16px!important;
  }
  .hbe-cust-row.is-serigraphy .hbe-cust-line1,
  .hbe-cust-row.is-serigraphy .hbe-cust-line2,
  .invoice-cust-row.is-serigraphy .invoice-cust-grid,
  .hbe-seri-box-clean .hbe-seri-controls,
  .hbe-seri-box-clean .hbe-seri-summary-row{
    grid-template-columns:1fr!important;
  }
  .hbe-seri-box-clean{
    padding:12px!important;
    border-radius:14px!important;
  }
  .hbe-seri-box-clean .hbe-seri-summary-row strong{
    text-align:left!important;
  }
  .hbe-seri-box-clean .hbe-seri-color-btn{
    flex:1 1 42px!important;
    width:auto!important;
  }
  .hbe-top-right{
    grid-template-columns:1fr!important;
  }
  .hbe-top-right button{
    width:100%!important;
  }
}
/* === /PRESULAB V7.3 === */


/* PresuLab v8 · PWA móvil + marca */
.pwa-install-btn{
  display:none;
  align-items:center;
  gap:7px;
  border:1px solid rgba(16,36,92,.12);
  background:#fff;
  color:#10245c;
  border-radius:999px;
  padding:8px 12px;
  font-weight:850;
  font-size:.78rem;
  box-shadow:0 10px 24px rgba(15,23,42,.08);
}
.pwa-install-btn.visible{display:inline-flex;}
.pwa-install-btn:hover{background:#f8fbff;transform:translateY(-1px);}
.pwa-toast{
  position:fixed;
  left:50%;
  bottom:18px;
  transform:translateX(-50%);
  z-index:9000;
  width:min(520px,calc(100vw - 26px));
  background:#0b1220;
  color:#fff;
  border:1px solid rgba(255,255,255,.13);
  border-radius:18px;
  box-shadow:0 22px 70px rgba(0,0,0,.35);
  padding:14px;
  display:none;
  gap:12px;
  align-items:center;
}
.pwa-toast.visible{display:flex;}
.pwa-toast img{width:42px;height:42px;border-radius:12px;flex:0 0 auto;}
.pwa-toast strong{display:block;font-size:.92rem;line-height:1.2;}
.pwa-toast span{display:block;color:#cbd5e1;font-size:.78rem;margin-top:2px;line-height:1.35;}
.pwa-toast-actions{margin-left:auto;display:flex;gap:8px;flex:0 0 auto;}
.pwa-toast-actions button{border-radius:12px;padding:8px 10px;font-weight:900;font-size:.78rem;}
.pwa-toast-install{background:#a6e85f;color:#0b1220;}
.pwa-toast-close{background:rgba(255,255,255,.1);color:#fff;}
@media(max-width:760px){
  .sidebar-logo{justify-content:center;padding:0 14px;}
  .sidebar-logo img{max-width:164px;}
  .pwa-install-btn{padding:7px 9px;font-size:0;}
  .pwa-install-btn svg{width:18px;height:18px;}
  .pwa-toast{bottom:12px;align-items:flex-start;}
  .pwa-toast-actions{flex-direction:column;}
}
@media(display-mode:standalone){
  body{overscroll-behavior-y:none;}
  .pwa-install-btn,.pwa-toast{display:none!important;}
}


/* === PRESULAB V8.1 · PWA topbar, scroll móvil y actualizaciones === */
:root{
  --app-titlebar-h: 38px;
}

#app-titlebar{
  display:none;
}

#topbar{
  background:rgba(255,255,255,.88)!important;
  backdrop-filter:blur(18px);
  -webkit-backdrop-filter:blur(18px);
  border-bottom:1px solid rgba(226,232,240,.82)!important;
  box-shadow:0 12px 34px rgba(15,23,42,.055)!important;
}
#topbar::before{
  content:"";
  position:absolute;
  left:0;
  right:0;
  top:0;
  height:2px;
  background:linear-gradient(90deg,#b7ff3c,#1f57ff,#0b1220);
  opacity:.75;
}
#page-title{
  font-size:1.05rem!important;
  letter-spacing:-.025em!important;
}

@media (display-mode: window-controls-overlay){
  :root{ --app-titlebar-h: env(titlebar-area-height, 38px); }
  #app-titlebar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    position:fixed;
    z-index:10000;
    top:env(titlebar-area-y, 0px);
    left:env(titlebar-area-x, 0px);
    width:env(titlebar-area-width, 100vw);
    height:var(--app-titlebar-h);
    padding:0 146px 0 12px;
    color:#fff;
    background:linear-gradient(90deg,#07111f 0%,#10245c 48%,#173b8f 100%);
    border-bottom:1px solid rgba(255,255,255,.10);
    box-shadow:0 12px 34px rgba(15,23,42,.18);
    -webkit-app-region:drag;
    user-select:none;
  }
  .app-titlebar-brand{
    display:flex;
    align-items:center;
    gap:8px;
    min-width:0;
    white-space:nowrap;
    overflow:hidden;
  }
  .app-titlebar-brand img{
    width:22px;
    height:22px;
    border-radius:7px;
    flex:0 0 auto;
  }
  .app-titlebar-brand strong{
    font-family:var(--font-display);
    font-size:.88rem;
    letter-spacing:-.02em;
  }
  .app-titlebar-brand span{
    color:rgba(255,255,255,.62);
    font-size:.72rem;
    font-weight:750;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .app-titlebar-status{
    font-size:.68rem;
    font-weight:900;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:#b7ff3c;
    opacity:.9;
  }
  #main{
    padding-top:var(--app-titlebar-h);
    min-height:calc(100dvh - var(--app-titlebar-h))!important;
  }
  #sidebar{
    inset:var(--app-titlebar-h) auto 0 0!important;
    height:auto!important;
  }
  #topbar{
    top:var(--app-titlebar-h)!important;
  }
}

.pwa-update-toast{
  position:fixed;
  left:50%;
  bottom:18px;
  transform:translateX(-50%);
  z-index:9200;
  width:min(560px,calc(100vw - 28px));
  display:none;
  align-items:center;
  gap:12px;
  padding:14px;
  border-radius:18px;
  background:linear-gradient(135deg,#07111f,#10245c);
  color:#fff;
  border:1px solid rgba(255,255,255,.14);
  box-shadow:0 24px 70px rgba(15,23,42,.42);
}
.pwa-update-toast.visible{display:flex;}
.pwa-update-icon{
  width:42px;
  height:42px;
  border-radius:14px;
  display:grid;
  place-items:center;
  background:#b7ff3c;
  color:#07111f;
  font-weight:950;
  font-size:1.25rem;
  flex:0 0 auto;
}
.pwa-update-copy{min-width:0;}
.pwa-update-copy strong{display:block;font-size:.94rem;line-height:1.2;}
.pwa-update-copy span{display:block;color:#cbd5e1;font-size:.78rem;margin-top:3px;line-height:1.35;}
.pwa-update-actions{margin-left:auto;display:flex;gap:8px;flex:0 0 auto;}
.pwa-update-actions button{border-radius:12px;padding:9px 11px;font-weight:950;font-size:.78rem;}
.pwa-update-now{background:#b7ff3c;color:#07111f;box-shadow:0 10px 22px rgba(183,255,60,.22);}
.pwa-update-later{background:rgba(255,255,255,.10);color:#fff;}

html,body{
  width:100%;
  min-height:100%;
  overflow-x:hidden;
  overflow-y:auto;
}
body{
  min-height:100dvh;
  overscroll-behavior-y:none;
}
#app{
  min-height:100dvh;
}
#main{
  min-height:100dvh;
  overflow:visible;
}
#content{
  min-height:calc(100dvh - var(--topbar-h));
  overflow:visible;
  -webkit-overflow-scrolling:touch;
}

@media(max-width:768px){
  html,body{
    height:auto!important;
    min-height:100dvh!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    touch-action:pan-y;
  }
  #app{
    display:block!important;
    height:auto!important;
    min-height:100dvh!important;
    overflow:visible!important;
  }
  #main{
    height:auto!important;
    min-height:100dvh!important;
    overflow:visible!important;
    margin-left:0!important;
  }
  #topbar{
    min-height:58px;
    height:auto;
    padding:10px 12px!important;
  }
  #content{
    height:auto!important;
    max-height:none!important;
    overflow:visible!important;
    padding-bottom:calc(92px + env(safe-area-inset-bottom, 0px))!important;
  }
  #sidebar{
    height:100dvh!important;
    max-height:100dvh!important;
  }
  .pwa-update-toast{
    bottom:12px;
    align-items:flex-start;
  }
  .pwa-update-actions{
    flex-direction:column;
  }
}
/* === /PRESULAB V8.1 === */

/* === PRESULAB V8.2 · FIX SCROLL REAL MAIN/PWA ===
   El scroll principal queda en #main, no en body. Así rueda/táctil
   funciona sobre la página y no depende del rebote del menú lateral. */
html,
body{
  height:100%!important;
  min-height:0!important;
  overflow:hidden!important;
  overscroll-behavior:none!important;
}
body{
  position:relative!important;
}
#app{
  height:100dvh!important;
  min-height:0!important;
  overflow:hidden!important;
}
#main{
  height:100dvh!important;
  min-height:0!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  -webkit-overflow-scrolling:touch!important;
  overscroll-behavior:contain!important;
  scroll-behavior:auto!important;
  touch-action:pan-y!important;
}
#content{
  min-height:calc(100dvh - var(--topbar-h))!important;
  overflow:visible!important;
}
#topbar{
  position:sticky!important;
  top:0!important;
}
#sidebar{
  height:100dvh!important;
  max-height:100dvh!important;
  overflow:hidden!important;
}
.sidebar-nav{
  overflow-y:auto!important;
  overflow-x:hidden!important;
  overscroll-behavior:contain!important;
  -webkit-overflow-scrolling:touch!important;
}
.sidebar-footer,
.sidebar-cta{
  flex-shrink:0!important;
}

@media (display-mode: window-controls-overlay){
  #main{
    height:100dvh!important;
    padding-top:var(--app-titlebar-h)!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
  }
  #topbar{
    top:0!important;
  }
  #sidebar{
    top:var(--app-titlebar-h)!important;
    height:calc(100dvh - var(--app-titlebar-h))!important;
    max-height:calc(100dvh - var(--app-titlebar-h))!important;
  }
}

@media(max-width:768px){
  html,
  body{
    height:100%!important;
    min-height:0!important;
    overflow:hidden!important;
    touch-action:pan-y!important;
  }
  #app{
    display:block!important;
    height:100dvh!important;
    min-height:0!important;
    overflow:hidden!important;
  }
  #main{
    margin-left:0!important;
    height:100dvh!important;
    min-height:0!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch!important;
    padding-bottom:env(safe-area-inset-bottom,0px)!important;
  }
  #content{
    min-height:auto!important;
    padding-bottom:calc(96px + env(safe-area-inset-bottom,0px))!important;
    overflow:visible!important;
  }
  #sidebar{
    height:100dvh!important;
    max-height:100dvh!important;
    overflow:hidden!important;
  }
  #sidebar.open{
    touch-action:pan-y!important;
  }
}
/* === /PRESULAB V8.2 === */

/* ═══════════════ PresuLab · Copias de seguridad v9 ═══════════════ */
.backup-header{align-items:flex-start;gap:18px}.backup-kicker{display:inline-flex;align-items:center;border-radius:999px;background:#ecfccb;color:#365314;font-size:11px;font-weight:900;letter-spacing:.08em;text-transform:uppercase;padding:6px 10px;margin-bottom:8px}.backup-header-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}.backup-grid{display:grid;grid-template-columns:1.1fr 1fr;gap:18px}.backup-card{background:#fff;border:1px solid #e5e7eb;border-radius:22px;padding:18px;box-shadow:0 16px 38px rgba(15,23,42,.06)}.backup-card h3{margin:0 0 14px;font-size:18px;color:#0f172a}.backup-status-card{background:linear-gradient(135deg,#0f172a,#15337a);color:#fff;border-color:rgba(255,255,255,.15)}.backup-status-top{display:flex;align-items:flex-start;justify-content:space-between;gap:14px}.backup-status-top h3{color:#fff;font-size:26px;margin:4px 0 0}.backup-label{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:#a9b7d0;font-weight:900}.backup-pill{display:inline-flex;border-radius:999px;padding:7px 10px;font-size:12px;font-weight:900}.backup-pill.ok{background:#22c55e;color:#052e16}.backup-pill.muted{background:#e2e8f0;color:#334155}.backup-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-top:18px}.backup-stats div{border:1px solid rgba(255,255,255,.14);background:rgba(255,255,255,.07);border-radius:16px;padding:12px}.backup-stats span,.backup-preview-grid span{display:block;color:#94a3b8;font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.06em;margin-bottom:4px}.backup-stats strong{display:block;color:#fff;font-size:13px}.backup-note{color:#64748b;font-size:13px;line-height:1.45;margin:10px 0 0}.backup-status-card .backup-note{color:#cbd5e1}.backup-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.backup-form-grid label:not(.backup-check){display:grid;gap:6px}.backup-form-grid label span{font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.06em;color:#64748b}.backup-form-grid input:not([type=checkbox]),.backup-form-grid select{width:100%;height:44px;border:1px solid #dbe3ef;border-radius:14px;padding:0 12px;background:#fff;font-weight:800;color:#0f172a}.backup-check,.backup-radio{display:flex;align-items:center;gap:9px;border:1px solid #e5e7eb;border-radius:14px;padding:11px 12px;font-weight:800;color:#0f172a;background:#f8fafc}.backup-check input,.backup-radio input{width:auto}.backup-check{grid-column:span 2}.backup-choice-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.backup-radio.disabled{opacity:.55}.backup-actions-line{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}.backup-table-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;max-height:280px;overflow:auto;padding-right:2px}.backup-table-list div{border:1px solid #e5e7eb;border-radius:14px;padding:10px;background:#f8fafc}.backup-table-list span{display:block;font-weight:900;color:#0f172a}.backup-table-list small{display:block;color:#64748b;margin-top:2px;font-size:12px}.backup-status-box{background:#0f172a;color:#e2e8f0;border-radius:16px;padding:14px;font-weight:800;min-height:52px}.backup-preview{margin-top:12px}.backup-preview-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.backup-preview-grid div{border:1px solid #e5e7eb;background:#f8fafc;border-radius:14px;padding:12px}.backup-preview-grid strong{display:block;color:#0f172a;font-size:13px;word-break:break-word}.backup-skipped{margin-top:10px;color:#92400e;background:#fffbeb;border:1px solid #fde68a;border-radius:14px;padding:10px;font-size:12px}.backup-alert{grid-column:1/-1;background:#f8fafc}.backup-alert strong{display:block;color:#0f172a}.backup-alert p{margin:5px 0 0;color:#475569}.backup-alert.danger{background:#fef2f2;border-color:#fecaca}.backup-alert.danger strong,.backup-alert.danger p{color:#991b1b}.backup-due-toast{position:fixed;right:18px;bottom:18px;z-index:99990;display:none;align-items:center;gap:12px;width:min(560px,calc(100vw - 36px));background:#0f172a;color:#fff;border:1px solid rgba(255,255,255,.14);box-shadow:0 24px 70px rgba(15,23,42,.35);border-radius:22px;padding:14px}.backup-due-toast.visible{display:flex}.backup-due-icon{width:40px;height:40px;border-radius:14px;background:#b6ff00;color:#0f172a;display:flex;align-items:center;justify-content:center;font-weight:950;font-size:22px;flex:0 0 auto}.backup-due-toast strong{display:block}.backup-due-toast span{display:block;color:#cbd5e1;font-size:13px;margin-top:2px}.backup-due-actions{margin-left:auto;display:flex;gap:8px;flex-wrap:wrap}.backup-due-actions button{border:0;border-radius:12px;padding:10px 12px;font-weight:900;cursor:pointer}.backup-due-actions #backup-due-now{background:#22c55e;color:#052e16}.backup-due-actions #backup-due-later{background:#1e293b;color:#fff}.muted{color:#94a3b8}
@media(max-width:900px){.backup-grid{grid-template-columns:1fr}.backup-header-actions{width:100%;justify-content:flex-start}.backup-stats{grid-template-columns:1fr}.backup-form-grid{grid-template-columns:1fr}.backup-check{grid-column:auto}.backup-choice-row{grid-template-columns:1fr}.backup-table-list{grid-template-columns:1fr}.backup-preview-grid{grid-template-columns:1fr}.backup-due-toast{left:10px;right:10px;bottom:10px;width:auto;align-items:flex-start;flex-direction:column}.backup-due-actions{margin-left:0;width:100%}.backup-due-actions button{flex:1}}
