/* ============================================================
   CotizaPro — Hoja de estilos principal
   Diseño limpio y moderno, pensado para usuarios de todas las edades
   ============================================================ */

:root{
  --bg:#f1f5f9;
  --surface:#ffffff;
  --border:#e2e8f0;
  --border-strong:#cbd5e1;
  --text:#111827;
  --muted:#4b5563;
  --primary:#2563eb;
  --primary-strong:#1d4ed8;
  --primary-soft:#eff6ff;
  --primary-soft-2:#dbeafe;
  --primary-contrast:#ffffff;
  --primary-ring:rgba(37,99,235,.32);
  --primary-ring-soft:rgba(37,99,235,.16);
  --green:#16a34a;
  --green-soft:#f0fdf4;
  --red:#dc2626;
  --red-soft:#fef2f2;
  --amber:#d97706;
  --amber-soft:#fffbeb;
  --radius:12px;
  --radius-lg:16px;
  --shadow:0 1px 2px rgba(15,23,42,.06), 0 8px 24px -12px rgba(15,23,42,.18);
  --shadow-lg:0 4px 8px rgba(15,23,42,.06), 0 24px 48px -16px rgba(15,23,42,.28);
  --font:'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

*{ box-sizing:border-box; margin:0; padding:0; }

html,body{ height:100%; }

body{
  font-family:'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size:15px;
  line-height:1.5;
  color:var(--text);
  background:var(--bg);
  -webkit-font-smoothing:antialiased;
}

.hidden{ display:none !important; }
.muted{ color:var(--muted); }
.mono{ font-variant-numeric:tabular-nums; }

/* ---------- Scrollbars discretas ---------- */
::-webkit-scrollbar{ width:10px; height:10px; }
::-webkit-scrollbar-thumb{ background:#cbd5e1; border-radius:8px; border:2px solid transparent; background-clip:content-box; }
::-webkit-scrollbar-thumb:hover{ background:#94a3b8; background-clip:content-box; border:2px solid transparent; }
::-webkit-scrollbar-track{ background:transparent; }

:focus-visible{ outline:3px solid var(--primary-ring); outline-offset:1px; border-radius:6px; }

.icon{ flex:none; vertical-align:-3px; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-view{
  min-height:100vh;
  display:flex; align-items:center; justify-content:center;
  padding:24px;
  background:
    radial-gradient(1000px 500px at 80% -10%, #e0e7ff 0%, rgba(224,231,255,0) 60%),
    radial-gradient(800px 400px at 10% 100%, #dbeafe 0%, rgba(219,234,254,0) 55%),
    var(--bg);
}

.login-card{
  width:min(410px, 94vw);
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius-lg);
  box-shadow:var(--shadow-lg);
  padding:36px 34px 28px;
  animation:fadeUp .35s ease both;
}

.login-brand{
  display:flex; align-items:center; gap:12px; margin-bottom:22px;
}
.brand-logo{
  width:46px; height:46px; border-radius:12px;
  background:linear-gradient(135deg,var(--primary),var(--primary-strong));
  color:var(--primary-contrast); display:flex; align-items:center; justify-content:center;
  box-shadow:0 6px 16px -6px var(--primary-ring);
}
.brand-name{ font-size:20px; font-weight:800; letter-spacing:-.02em; }
.brand-tag{ font-size:12.5px; color:var(--muted); }

.login-card h1{ font-size:19px; font-weight:700; margin-bottom:4px; }
.login-card .login-sub{ color:var(--muted); font-size:14px; margin-bottom:20px; }

.login-error{
  display:flex; align-items:center; gap:8px;
  background:var(--red-soft); color:#b91c1c;
  border:1px solid #fecaca; border-radius:10px;
  padding:10px 12px; font-size:13.5px; font-weight:500;
  margin-bottom:14px;
}

.login-hint{
  margin-top:18px; padding-top:14px; border-top:1px dashed var(--border);
  font-size:12.5px; color:var(--muted); line-height:1.6;
}
.login-hint b{ color:var(--text); }

/* ============================================================
   BOTONES
   ============================================================ */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 16px; border-radius:10px;
  border:1px solid transparent;
  font:inherit; font-size:14.5px; font-weight:600;
  cursor:pointer; white-space:nowrap;
  transition:background .15s ease, border-color .15s ease, transform .05s ease, box-shadow .15s ease;
  background:var(--surface); color:var(--text); border-color:var(--border);
}
.btn:hover{ background:#f8fafc; }
.btn:active{ transform:translateY(1px); }

.btn-primary{ background:var(--primary); border-color:var(--primary); color:var(--primary-contrast); }
.btn-primary:hover{ filter:brightness(.92); }

.btn-soft{ background:var(--primary-soft); border-color:var(--primary-soft); color:var(--primary-strong); }
.btn-soft:hover{ background:var(--primary-soft-2); }

.btn-success{ background:var(--green); border-color:var(--green); color:#fff; }
.btn-success:hover{ background:#15803d; }

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

.btn-ghost{ background:transparent; border-color:transparent; color:var(--muted); }
.btn-ghost:hover{ background:#f1f5f9; color:var(--text); }

.btn-danger-ghost{ background:transparent; border-color:transparent; color:var(--red); }
.btn-danger-ghost:hover{ background:var(--red-soft); }

.btn-lg{ padding:13px 22px; font-size:15.5px; border-radius:12px; }
.btn-sm{ padding:7px 12px; font-size:13.5px; border-radius:8px; }
.btn-block{ width:100%; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }

.icon-btn{
  display:inline-flex; align-items:center; justify-content:center;
  width:34px; height:34px; border-radius:9px;
  border:1px solid var(--border); background:var(--surface); color:var(--muted);
  cursor:pointer; transition:background .15s ease, color .15s ease, border-color .15s ease;
}
.icon-btn:hover{ background:#f8fafc; color:var(--text); }
.icon-btn.danger:hover{ background:var(--red-soft); color:var(--red); border-color:#fecaca; }
.icon-btn.primary{ color:var(--primary-strong); }
.icon-btn.primary:hover{ background:var(--primary-soft); }

/* ============================================================
   FORMULARIOS
   ============================================================ */
.input, .select, .textarea{
  width:100%;
  padding:10px 12px;
  font:inherit; font-size:14.5px; color:var(--text);
  background:var(--surface);
  border:1.5px solid var(--border-strong); border-radius:10px;
  transition:border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder, .textarea::placeholder{ color:#94a3b8; }
.input:focus, .select:focus, .textarea:focus{
  outline:none; border-color:var(--primary);
  box-shadow:0 0 0 3px var(--primary-ring-soft);
}
.textarea{ resize:vertical; min-height:74px; }
.select{ appearance:none; background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat:no-repeat; background-position:right 10px center; padding-right:32px; }

.field{ display:flex; flex-direction:column; gap:6px; min-width:0; }
.label{ font-size:13px; font-weight:600; color:#1f2937; }
.hint{ font-size:12px; color:var(--muted); }
.req{ color:var(--red); }

.input-wrap{ position:relative; }
.input-wrap .input{ width:100%; padding-left:38px; }
.input-wrap .input-ico{
  position:absolute; left:11px; top:50%; transform:translateY(-50%);
  color:#94a3b8; display:flex;
}
.input-wrap .input-eye{
  position:absolute; right:6px; top:50%; transform:translateY(-50%);
  border:none; background:none; cursor:pointer; color:#94a3b8; padding:6px; border-radius:8px; display:flex;
}
.input-wrap .input-eye:hover{ color:var(--text); background:#f1f5f9; }

.search-box{ position:relative; }
.search-box .input{ padding-left:38px; }
.search-box .ico{
  position:absolute; left:11px; top:50%; transform:translateY(-50%);
  color:#94a3b8; display:flex; pointer-events:none;
}

/* ============================================================
   LAYOUT DE LA APLICACIÓN
   ============================================================ */
.app{ display:flex; flex-direction:column; height:100vh; overflow:hidden; }

/* ---------- Barra superior (navegación) ---------- */
.topbar{
  flex:0 0 auto;
  background:var(--surface); border-bottom:1px solid var(--border);
  display:flex; align-items:center; gap:12px;
  padding:8px 20px;
  box-shadow:0 1px 2px rgba(15,23,42,.04);
  z-index:40;
}
.topbar-brand{ display:flex; align-items:center; gap:10px; padding-right:10px; flex:1; min-width:0; }
.topbar .brand-logo{ width:38px; height:38px; border-radius:10px; }
.topbar .brand-name{ font-size:16.5px; }
.topbar .brand-tag{ font-size:11px; }
.topbar-nav{ display:flex; align-items:center; gap:4px; }
.topbar-admin{
  display:flex; align-items:center;
  border-left:1px solid var(--border); padding-left:14px; margin-left:8px;
}
.topbar-admin-label{
  font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.08em;
  color:var(--muted); margin-right:4px;
}
.topbar-spacer{ flex:1; }

/* Menú desplegable del usuario (incluye ADMIN si corresponde) */
.user-area{ flex:1; display:flex; justify-content:flex-end; position:relative; min-width:0; }
.user-chip.as-button{ border:none; background:none; cursor:pointer; font:inherit; max-width:100%; }
.user-chip.as-button:hover{ background:#f1f5f9; }
.user-menu{
  position:absolute; top:calc(100% + 8px); right:0;
  min-width:256px; background:var(--surface);
  border:1px solid var(--border); border-radius:14px;
  box-shadow:var(--shadow-lg); padding:6px; z-index:90;
  animation:popIn .15s ease both;
}
.user-menu-head{ padding:10px 12px 9px; border-bottom:1px solid var(--border); margin-bottom:6px; }
.user-menu-head .user-name{ font-size:14px; }
.user-menu-item{
  display:flex; align-items:center; gap:10px; width:100%;
  padding:10px 12px; border:none; background:none; border-radius:9px;
  font:inherit; font-size:14px; font-weight:600; color:#374151;
  cursor:pointer; text-align:left;
}
.user-menu-item:hover{ background:#f1f5f9; color:var(--text); }
.user-menu-item.danger{ color:var(--red); }
.user-menu-item.danger:hover{ background:var(--red-soft); }
.user-menu-sep{ border-top:1px solid var(--border); margin:6px 4px; }
.user-menu-label{
  font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.08em;
  color:var(--muted); padding:6px 12px 2px;
}

.nav-item{
  display:inline-flex; align-items:center; gap:8px;
  padding:9px 15px; border:none; background:none; border-radius:10px;
  font:inherit; font-size:14.5px; font-weight:600; color:#374151;
  cursor:pointer; white-space:nowrap;
  transition:background .15s ease, color .15s ease;
}
.nav-item:hover{ background:#f1f5f9; color:var(--text); }
.nav-item.active{ background:var(--primary-soft); color:var(--primary-strong); font-weight:700; }
.nav-item .nav-badge{
  min-width:21px; height:21px; padding:0 6px;
  border-radius:99px; background:#e2e8f0; color:#374151;
  font-size:11.5px; font-weight:700; display:inline-flex; align-items:center; justify-content:center;
}
.nav-item.active .nav-badge{ background:var(--primary-soft-2); color:var(--primary-strong); }

.user-chip{
  display:flex; align-items:center; gap:10px;
  padding:4px 4px; border-radius:12px;
}
.user-avatar{
  width:36px; height:36px; border-radius:99px; flex:none;
  background:var(--primary-soft-2); color:var(--primary-strong);
  display:flex; align-items:center; justify-content:center;
  font-weight:800; font-size:14px;
}
.user-meta{ min-width:0; flex:1; }
.user-name{ font-size:13.5px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-role{ font-size:11.5px; color:var(--muted); }
.user-actions{ display:flex; gap:2px; }
.user-actions .icon-btn{ width:30px; height:30px; border:none; }

.view-root{ flex:1; overflow-y:auto; padding:20px 26px; }
.page{ max-width:1800px; margin:0 auto; animation:fadeUp .3s ease both; }

.page-head{
  display:flex; align-items:flex-end; justify-content:space-between; gap:16px;
  margin-bottom:20px; flex-wrap:wrap;
}
.page-title{ font-size:22px; font-weight:800; letter-spacing:-.02em; display:flex; align-items:center; gap:10px; }
.page-sub{ color:var(--muted); font-size:14px; margin-top:3px; }
.page-actions{ display:flex; gap:10px; flex-wrap:wrap; }

/* ============================================================
   COMPONENTES GENERALES
   ============================================================ */
.card{
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-lg); box-shadow:var(--shadow);
}

.panel{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); box-shadow:var(--shadow); display:flex; flex-direction:column; overflow:hidden; }
.panel-head{
  display:flex; align-items:center; gap:10px;
  padding:14px 18px; border-bottom:1px solid var(--border);
}
.panel-title{ font-size:15px; font-weight:700; display:flex; align-items:center; gap:8px; }
.panel-head .spacer{ flex:1; }

.chip{
  display:inline-flex; align-items:center; gap:6px;
  padding:7px 14px; border-radius:99px;
  border:1px solid var(--border); background:var(--surface);
  font:inherit; font-size:13.5px; font-weight:600; color:#374151;
  cursor:pointer; transition:all .15s ease;
}
.chip:hover{ border-color:var(--border-strong); }
.chip.active{ background:var(--primary-soft); border-color:var(--primary); color:var(--primary-strong); }
.chips{ display:flex; gap:8px; flex-wrap:wrap; }

.badge{
  display:inline-flex; align-items:center; gap:5px;
  padding:4px 10px; border-radius:99px;
  font-size:12px; font-weight:700;
}
.badge.b-pendiente{ background:var(--amber-soft); color:#b45309; border:1px solid #fde68a; }
.badge.b-aprobada{ background:var(--green-soft); color:#15803d; border:1px solid #bbf7d0; }
.badge.b-rechazada{ background:var(--red-soft); color:#b91c1c; border:1px solid #fecaca; }

.count-badge{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:24px; height:24px; padding:0 7px;
  background:var(--primary-soft-2); color:var(--primary-strong);
  border-radius:99px; font-size:12px; font-weight:800;
}

/* Tablas */
.table-wrap{ overflow-x:auto; }
table.data{
  width:100%; border-collapse:collapse; font-size:14.5px;
}
table.data th{
  text-align:left; padding:12px 14px;
  font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.05em;
  color:var(--muted); border-bottom:1px solid var(--border);
  white-space:nowrap; user-select:none;
}
table.data th.sortable{ cursor:pointer; }
table.data th.sortable:hover{ color:var(--text); }
table.data th .sort-ind{ margin-left:5px; color:var(--primary); display:inline-flex; vertical-align:-2px; }
table.data td{ padding:13px 14px; border-bottom:1px solid var(--border); vertical-align:middle; }
table.data tbody tr{ transition:background .12s ease; }
table.data tbody tr:hover{ background:#f8fafc; }
table.data tbody tr.clickable{ cursor:pointer; }
table.data tbody tr:last-child td{ border-bottom:none; }
table.data.compact th{ padding:9px 10px; font-size:11px; }
table.data.compact td{ padding:8px 10px; font-size:13.5px; }
.cat-name{ font-weight:600; line-height:1.3; }
.cat-sku{ font-size:11px; color:var(--muted); font-weight:600; }
.cat-specs{ font-size:11.5px; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:360px; }
.sup-cell{ display:flex; align-items:center; gap:4px; min-width:0; }
.sup-cell .sup-cell-name{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:600; font-size:13px; }
.sup-line{ display:flex; align-items:center; gap:9px; font-size:14px; min-width:0; }
.sup-line .icon{ color:var(--muted); }
.sup-link{ color:var(--primary-strong); font-weight:600; text-decoration:none; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sup-link:hover{ text-decoration:underline; }
.sup-divider{ border-top:1px dashed var(--border-strong); margin:14px 0 10px; }
.stock-zero{ color:var(--red); font-weight:800; }

/* Tarjetas de suplidores (cuadrícula autoajustable ~5 por fila) */
.sup-cards{ display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:14px; }
.sup-card{
  border:1px solid var(--border); border-radius:14px; padding:16px;
  background:var(--surface); display:flex; flex-direction:column; gap:8px;
  transition:box-shadow .15s ease, border-color .15s ease;
}
.sup-card:hover{ box-shadow:var(--shadow); border-color:var(--primary-soft-2); }
.sup-card.clickable{ cursor:pointer; }
.sup-card.clickable:hover{ border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-ring-soft); }
.sup-card.selected{ border-color:var(--primary); background:var(--primary-soft); }
.sup-card .sc-name{ font-size:15px; font-weight:700; }
.sup-card .sc-line{ display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--muted); min-width:0; }
.sup-card .sc-line .sup-link{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sup-card .sc-foot{ border-top:1px dashed var(--border); padding-top:9px; margin-top:2px; display:flex; align-items:center; gap:8px; }
.picker-grid{ margin-top:12px; max-height:56vh; overflow-y:auto; padding:2px; }

/* Suplidor elegido en el formulario de producto */
.sup-chosen{
  flex:1; min-width:180px; display:flex; align-items:center; gap:12px;
  border:1px solid var(--border); border-radius:10px;
  padding:8px 12px; background:#f8fafc; min-width:0;
}
.sup-chosen .sc-name{ font-weight:700; font-size:13.5px; }

/* Código interno de cliente (solo lectura) */
.client-code{ width:88px; text-align:center; background:#f8fafc; flex:none; }

/* Sugerencias de clientes (buscador del editor) */
.client-suggestions{
  position:absolute; top:calc(100% + 4px); left:0; right:0;
  background:var(--surface); border:1px solid var(--border); border-radius:10px;
  box-shadow:var(--shadow-lg); z-index:60; max-height:240px; overflow-y:auto;
  padding:4px;
}
.client-sug{
  display:block; width:100%; text-align:left;
  background:none; border:none; border-radius:8px;
  padding:8px 10px; font:inherit; cursor:pointer;
}
.client-sug:hover{ background:var(--primary-soft); }
.client-sug .cs-name{ font-size:13.5px; font-weight:700; color:var(--text); }
.client-sug .cs-sub{ font-size:11.5px; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* Selector de color (tema) */
.color-input{ width:52px; height:38px; padding:3px; border:1px solid var(--border-strong); border-radius:10px; background:var(--surface); cursor:pointer; }
.swatches{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.swatch{ width:26px; height:26px; border-radius:8px; border:none; cursor:pointer; box-shadow:inset 0 0 0 1px rgba(15,23,42,.14); transition:transform .1s ease; }
.swatch:hover{ transform:scale(1.12); }
.swatch.active{ box-shadow:0 0 0 2px var(--surface), 0 0 0 4px var(--primary); }
.cell-strong{ font-weight:700; }
.cell-actions{ display:flex; gap:6px; justify-content:flex-end; }

/* Estado vacío */
.empty-state{
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  text-align:center; padding:54px 24px; gap:8px;
}
.empty-ico{
  width:64px; height:64px; border-radius:20px;
  background:var(--primary-soft); color:var(--primary);
  display:flex; align-items:center; justify-content:center; margin-bottom:6px;
}
.empty-title{ font-size:16.5px; font-weight:700; }
.empty-text{ color:var(--muted); font-size:14px; max-width:420px; line-height:1.55; }
.empty-action{ margin-top:10px; }

/* ============================================================
   MODALES Y TOASTS
   ============================================================ */
.modal-overlay{
  position:fixed; inset:0; z-index:100;
  background:rgba(15,23,42,.48); backdrop-filter:blur(2px);
  display:flex; align-items:center; justify-content:center; padding:20px;
  animation:fadeIn .18s ease both;
}
.modal{
  width:min(620px, 96vw); max-height:92vh;
  background:var(--surface); border-radius:var(--radius-lg);
  box-shadow:var(--shadow-lg);
  display:flex; flex-direction:column;
  animation:popIn .22s cubic-bezier(.2,.9,.3,1.2) both;
}
.modal-head{
  display:flex; align-items:center; gap:12px;
  padding:16px 20px; border-bottom:1px solid var(--border);
}
.modal-title{ font-size:16.5px; font-weight:700; flex:1; }
.modal-body{ padding:20px; overflow-y:auto; }
.modal-foot{
  padding:14px 20px; border-top:1px solid var(--border);
  display:flex; justify-content:flex-end; gap:10px; flex-wrap:wrap;
}

.confirm-msg{ font-size:14.5px; line-height:1.6; color:#1f2937; }

.form-grid{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.form-grid .full{ grid-column:1 / -1; }

/* Elección reemplazar / nueva versión */
.save-options{ display:flex; flex-direction:column; gap:10px; margin:16px 0 4px; }
.save-opt{
  display:flex; flex-direction:column; gap:3px; text-align:left;
  padding:14px 16px; border-radius:12px;
  border:1.5px solid var(--border); background:var(--surface);
  font:inherit; cursor:pointer; transition:all .15s ease;
}
.save-opt:hover{ border-color:var(--primary); background:var(--primary-soft); }
.save-opt .so-title{ font-size:14.5px; font-weight:700; display:flex; align-items:center; gap:8px; }
.save-opt .so-sub{ font-size:13px; color:var(--muted); line-height:1.45; }

/* Toasts */
#toast-root{
  position:fixed; bottom:22px; right:22px; z-index:1000;
  display:flex; flex-direction:column; gap:8px; align-items:flex-end;
}
.toast{
  display:flex; align-items:center; gap:10px;
  background:#111827; color:#fff;
  padding:12px 16px; border-radius:12px;
  font-size:14px; font-weight:500;
  box-shadow:var(--shadow-lg);
  animation:toastIn .25s cubic-bezier(.2,.9,.3,1.2) both;
  max-width:min(420px, 90vw);
}
.toast.success .t-ico{ color:#4ade80; }
.toast.error .t-ico{ color:#f87171; }
.toast.info .t-ico{ color:#93c5fd; }
.toast.out{ opacity:0; transform:translateY(8px); transition:all .3s ease; }

/* ============================================================
   VENTAS  (catálogo + editor de cotización)
   ============================================================ */
.ventas-layout{
  display:grid; grid-template-columns:minmax(400px,1fr) minmax(0,2fr);
  gap:18px; height:calc(100vh - 188px); min-height:520px;
}
.editor-panel .panel-body{ overflow-y:auto; flex:1; padding:16px 18px; }

.catalog-panel .panel-body{ overflow-y:auto; flex:1; padding:0 14px 14px; }
.catalog-panel table.data{ margin-top:10px; }
.prod-first{ display:flex; align-items:flex-start; gap:9px; min-width:0; }
.prod-first .icon-btn{ margin-top:1px; flex:none; }
.prod-id{ min-width:0; }
.catalog-toolbar{
  display:flex; flex-direction:column; gap:10px; padding:12px; border-bottom:1px solid var(--border);
}

.prod-row{
  display:flex; align-items:center; gap:14px;
  padding:13px 14px; border:1px solid var(--border); border-radius:12px;
  margin-bottom:10px; background:var(--surface);
  transition:border-color .15s ease, box-shadow .15s ease;
}
.prod-row:hover{ border-color:var(--primary-soft-2); box-shadow:var(--shadow); }
.pr-main{ flex:1; min-width:0; }
.pr-name{ font-size:15px; font-weight:700; line-height:1.3; }
.pr-sku{
  margin-left:8px; font-size:11px; font-weight:700; color:#4b5563;
  background:#f1f5f9; border:1px solid var(--border);
  padding:2px 7px; border-radius:6px; vertical-align:1px;
}
.pr-prices{ display:flex; align-items:baseline; gap:12px; margin-top:4px; flex-wrap:wrap; }
.pr-sale{ font-size:15.5px; font-weight:800; color:var(--primary-strong); }
.pr-buy{ font-size:12.5px; color:var(--muted); }
.pr-sup{
  width:220px; flex:none; border-left:1px solid var(--border); padding-left:14px;
}
.pr-sup-name{ font-size:13px; font-weight:700; margin-bottom:3px; }
.pr-sup-line{
  display:flex; align-items:center; gap:6px;
  font-size:12px; color:var(--muted); line-height:1.5;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}

/* Editor de cotización */
.qeditor{ display:flex; flex-direction:column; gap:14px; }
.ec{
  border:1px solid var(--border); border-radius:14px; padding:16px;
  background:var(--surface);
}

/* Secciones plegables del editor (p. ej. DATOS DEL CLIENTE) */
.ec-collapse{ padding:0; overflow:hidden; }
.ec-toggle{
  display:flex; align-items:center; gap:10px; width:100%;
  background:none; border:none; font:inherit; cursor:pointer;
  padding:13px 16px; text-align:left;
}
.ec-toggle:hover{ background:#f8fafc; }
.ec-toggle-title{
  font-size:13px; font-weight:800; text-transform:uppercase; letter-spacing:.06em;
  color:#374151; display:inline-flex; align-items:center; gap:8px; flex:none;
}
.ec-toggle-summary{
  flex:1; font-size:13.5px; color:var(--muted);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.ec-toggle-summary.has-name{ color:var(--text); font-weight:600; }
.ec-chevron{ color:var(--muted); display:inline-flex; flex:none; }
.ec-collapse .ec-body{ display:none; padding:0 16px 16px; }
.ec-collapse.open .ec-body{ display:block; }
.ec-title{
  font-size:13px; font-weight:800; text-transform:uppercase; letter-spacing:.06em;
  color:#374151; margin-bottom:12px; display:flex; align-items:center; gap:8px;
}
.ec .form-grid{ gap:12px; }

.items-head{
  display:grid; grid-template-columns:minmax(0,1fr) 64px 118px 122px 40px;
  gap:8px; padding:7px 10px;
  font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:#4b5563;
  background:#f1f5f9; border:1px solid var(--border); border-radius:8px;
}
.items-head .num{ text-align:right; }
.item-row{
  display:grid; grid-template-columns:minmax(0,1fr) 64px 118px 122px 40px;
  gap:8px; align-items:center; margin-bottom:0; padding:6px 2px;
  border-bottom:1px solid var(--border);
  animation:fadeIn .15s ease both;
}
.ir-total{ text-align:right; font-weight:700; font-size:14px; padding-right:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ir-qty{ text-align:right; }
.ir-price{ text-align:right; }
.items-empty{
  border:1.5px dashed var(--border-strong); border-radius:12px;
  padding:18px; text-align:center; color:var(--muted); font-size:13.5px;
  margin-bottom:10px;
}
.item-specs{
  font-size:11px; color:var(--muted); line-height:1.35;
  margin-top:3px; white-space:pre-wrap;
}
.items-actions{ display:flex; gap:8px; flex-wrap:wrap; }

.totals-card{
  border:1px solid var(--border); border-radius:14px; padding:16px;
  background:#f8fafc; margin-left:auto; width:min(340px,100%);
}
.t-row{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:5px 0; font-size:14px; color:#1f2937;
}
.t-row input[type="checkbox"]{ width:16px; height:16px; accent-color:var(--primary); cursor:pointer; flex:none; }
.t-row .t-label.t-check{ cursor:pointer; gap:7px; }
.t-row input[type="number"]:disabled, .input:disabled{
  background:#f1f5f9; color:#6b7280; cursor:not-allowed;
}

/* Casillas de verificación en formularios */
.check-row{
  display:flex; align-items:flex-start; gap:10px;
  font-size:14px; font-weight:600; color:#1f2937; cursor:pointer;
}
.check-row input[type="checkbox"]{ width:17px; height:17px; accent-color:var(--primary); cursor:pointer; margin-top:2px; flex:none; }
.check-row .check-hint{ display:block; font-size:12px; font-weight:500; color:var(--muted); margin-top:2px; }
.t-row .t-label{ display:flex; align-items:center; gap:6px; }
.t-row .t-val{ font-weight:700; font-variant-numeric:tabular-nums; }
.t-row input{
  width:64px; padding:5px 8px; text-align:right;
  border:1px solid var(--border-strong); border-radius:8px;
  font:inherit; font-size:13.5px;
}
.t-row input:focus{ outline:none; border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-ring-soft); }
.t-divider{ border-top:1px dashed var(--border-strong); margin:6px 0; }
.t-grand{ font-size:17px; font-weight:800; color:var(--text); }
.t-grand .t-val{ color:var(--primary-strong); font-size:19px; }

.qeditor-foot{ display:flex; justify-content:flex-end; gap:10px; }

.editor-banner{
  display:flex; gap:10px; align-items:flex-start;
  background:var(--amber-soft, #fffbeb); background:#fffbeb;
  border:1px solid #fde68a; color:#92400e;
  border-radius:12px; padding:12px 14px; font-size:13.5px; line-height:1.5;
  margin-bottom:14px;
}

/* ============================================================
   COTIZACIONES
   ============================================================ */
.q-toolbar{
  display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin-bottom:16px;
}
.q-toolbar .search-box{ flex:1; min-width:240px; }

.stat-mini{
  display:flex; flex-direction:column; gap:2px;
  background:#f8fafc; border:1px solid var(--border);
  border-radius:12px; padding:12px 16px; min-width:130px;
}
.stat-mini .st-label{ font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); }
.stat-mini .st-value{ font-size:16px; font-weight:800; margin-top:2px; }

.detail-grid{
  display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:10px;
  margin:14px 0;
}

/* Versiones */
.versions-list{ display:flex; flex-direction:column; gap:10px; }
.version-item{
  border:1.5px solid var(--border); border-radius:12px; padding:13px 15px;
  transition:border-color .15s ease;
}
.version-item:hover{ border-color:var(--border-strong); }
.version-item.current{ border-color:var(--primary); background:var(--primary-soft); }
.v-head{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.v-chip{
  font-size:12.5px; font-weight:800; color:var(--primary-strong);
  background:var(--primary-soft-2); border-radius:8px; padding:3px 9px;
}
.version-item.current .v-chip{ background:var(--primary); color:#fff; }
.v-current-tag{
  font-size:11.5px; font-weight:800; color:var(--green);
  background:var(--green-soft); border:1px solid #bbf7d0;
  padding:3px 9px; border-radius:99px; display:inline-flex; align-items:center; gap:5px;
}
.v-date{ font-size:13px; color:#1f2937; font-weight:600; }
.v-by{ font-size:12.5px; color:var(--muted); }
.v-note{
  font-size:12.5px; color:#92400e; background:#fffbeb; border:1px solid #fde68a;
  border-radius:8px; padding:5px 9px; margin-top:7px; display:inline-block;
}
.v-replaced{ font-size:12px; color:var(--muted); margin-top:6px; font-style:italic; }
.internal-note{
  font-size:12.5px; color:#374151; background:#f8fafc;
  border:1px dashed var(--border-strong);
  border-radius:8px; padding:7px 10px; margin-top:8px;
}
.sig-chip{
  display:inline-flex; align-items:center; gap:5px;
  font-size:11.5px; font-weight:800; color:var(--primary-strong);
  background:var(--primary-soft); border:1px solid var(--primary-soft-2);
  padding:3px 9px; border-radius:99px; margin-top:8px;
}
.v-totals{ margin-left:auto; text-align:right; }
.v-total{ font-size:15.5px; font-weight:800; }
.v-items{ font-size:12px; color:var(--muted); }
.v-actions{ display:flex; gap:6px; margin-top:10px; }

.versions-banner{
  display:flex; align-items:center; gap:10px;
  background:var(--primary-soft); border:1px solid var(--primary-soft-2);
  color:var(--primary-strong); font-size:13.5px; font-weight:600;
  border-radius:10px; padding:10px 14px; margin-bottom:14px;
}

.preview-wrap{ border:1px solid var(--border); border-radius:12px; overflow:hidden; background:#f8fafc; }
.preview-frame{ width:100%; height:min(66vh,720px); border:none; display:block; background:#fff; }

/* ============================================================
   PRODUCTOS  (explorador por categorías)
   ============================================================ */
.productos-layout{
  display:grid; grid-template-columns:262px minmax(0,1fr);
  gap:18px; height:calc(100vh - 188px); min-height:520px;
}

.cats-panel .panel-body{ overflow-y:auto; flex:1; padding:10px; }
.cat-item{
  display:flex; align-items:center; gap:9px;
  width:100%; padding:10px 12px; margin-bottom:2px;
  border:none; background:none; border-radius:10px;
  font:inherit; font-size:14px; font-weight:600; color:#374151;
  cursor:pointer; text-align:left;
  transition:background .12s ease, color .12s ease;
}.cat-item:hover{ background:#f1f5f9; color:var(--text); }
.cat-item.active{ background:var(--primary-soft); color:var(--primary-strong); }
.cat-item .cat-count{
  margin-left:auto; font-size:11.5px; font-weight:700; color:#4b5563;
  background:#e2e8f0; border-radius:99px; padding:2px 8px; min-width:26px; text-align:center;
}
.cat-item.active .cat-count{ background:var(--primary-soft-2); color:var(--primary-strong); }
.cat-item .cat-actions{ display:none; gap:2px; }
.cat-item:hover .cat-actions{ display:flex; }
.cat-item:hover .cat-count{ display:none; }
.cat-item .cat-actions .icon-btn{ width:26px; height:26px; border:none; }
.cat-add{
  display:flex; align-items:center; justify-content:center; gap:7px;
  width:100%; padding:10px; margin-top:8px;
  border:1.5px dashed var(--border-strong); border-radius:10px; background:none;
  font:inherit; font-size:13.5px; font-weight:700; color:var(--primary-strong);
  cursor:pointer; transition:all .15s ease;
}
.cat-add:hover{ border-color:var(--primary); background:var(--primary-soft); }

.prods-panel .prods-toolbar{
  display:flex; gap:10px; padding:12px; border-bottom:1px solid var(--border);
}
.prods-panel .panel-body{ overflow-y:auto; flex:1; padding:0; }

.pc-cat{
  font-size:11.5px; font-weight:700; color:var(--primary-strong);
  background:var(--primary-soft); padding:3px 9px; border-radius:99px;
  display:inline-block; white-space:nowrap;
}

/* ============================================================
   DOCUMENTO PDF / IMPRESIÓN (usado en la vista previa)
   ============================================================ */
.quote-doc{ font-family:'Inter',system-ui,'Segoe UI',Arial,sans-serif; color:#1e293b; }

/* ============================================================
   ANIMACIONES
   ============================================================ */
@keyframes fadeIn{ from{ opacity:0; } to{ opacity:1; } }
@keyframes fadeUp{ from{ opacity:0; transform:translateY(10px); } to{ opacity:1; transform:none; } }
@keyframes popIn{ from{ opacity:0; transform:scale(.96) translateY(8px); } to{ opacity:1; transform:scale(1); } }
@keyframes toastIn{ from{ opacity:0; transform:translateY(14px) scale(.96); } to{ opacity:1; transform:none; } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width:1180px){
  .ventas-layout{ grid-template-columns:1fr; height:auto; }
  .catalog-panel .panel-body{ max-height:380px; }
}
@media (max-width:980px){
  .productos-layout{ grid-template-columns:1fr; height:auto; }
  .cats-panel .panel-body{ max-height:200px; }
  .view-root{ padding:16px 14px; }
  .topbar{ flex-wrap:wrap; }
  .topbar .brand-meta{ display:none; }
  .user-meta{ display:none; }
}
@media (max-width:720px){
  .topbar{ padding:8px 10px; gap:8px; }
  .topbar-admin-label{ display:none; }
  .nav-item{ padding:8px 11px; font-size:13.5px; }
  .user-actions{ display:none; }
  .form-grid{ grid-template-columns:1fr; }
}