/* ============================================================
   COTIZACIONES MANILA — Estilos
   ============================================================ */

/* --- Variables --- */
:root {
  --carbon:        #2F2C2B;
  --green:         #40543B;
  --blue:          #365A6E;
  --orange:        #C94707;
  --gold:          #F5C32B;
  --cream:         #EEE1B7;
  --gray-50:       #f9f9f8;
  --gray-100:      #f2f1ef;
  --gray-200:      #e5e3e0;
  --gray-300:      #ccc9c4;
  --gray-400:      #aaa7a3;
  --gray-500:      #706c68;
  --gray-700:      #4a4744;
  --accent:        var(--carbon);
  --accent-light:  #eaeaea;
  --radius:        6px;
  --panel-w:       400px;
  --font:          'Inter', system-ui, sans-serif;
  --font-heading:  'Playfair Display', serif;
  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  /* Feedback colors */
  --error:         #C94707;
  --error-bg:      #fff3ee;
  --success:       #2d7a40;
  --success-bg:    #e6f4ea;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--gray-100);
  color: var(--carbon);
  min-height: 100vh;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--carbon);
}
.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 40px 48px;
  width: 360px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}
.login-card .login-logo-wrap {
  display: flex;
  justify-content: center;
  margin: 0 auto 32px;
}
.login-card .login-logo-wrap .login-logo {
  height: 64px;
  display: block;
  background: var(--carbon);
  padding: 10px 20px;
  border-radius: 8px;
  filter: brightness(0) invert(1);
}
.login-card .login-logo {
  display: block;
  height: 64px;
  margin: 0 auto 32px;
}
.login-card h1 {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 8px;
}
.login-card .login-sub {
  font-size: 12px;
  color: var(--gray-500);
  text-align: center;
  margin-bottom: 28px;
}
.login-card .form-group {
  margin-bottom: 16px;
}
.login-card label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--gray-700);
}
.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
}
.login-card input:focus { border-color: var(--accent); }
.login-card .btn-primary {
  width: 100%;
  margin-top: 8px;
}
.forgot-link {
  display: block;
  text-align: center;
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 12px;
  cursor: pointer;
  text-decoration: none;
}
.forgot-link:hover { color: var(--carbon); text-decoration: underline; }
.login-error {
  color: var(--orange);
  font-size: 12px;
  text-align: center;
  margin-top: 12px;
  min-height: 18px;
}
.login-success {
  color: var(--green);
  font-size: 12px;
  text-align: center;
  margin-top: 4px;
  min-height: 18px;
}

/* ============================================================
   TOP NAV
   ============================================================ */
.topnav {
  background: var(--carbon);
  color: #fff;
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topnav .nav-logo {
  height: 56px;
  opacity: 0.95;
  filter: brightness(0) invert(1);
}
.topnav .nav-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: rgba(255,255,255,0.9);
}
.topnav .nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  height: 100%;
}
.topnav .nav-links a {
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 4px;
  transition: all 0.15s;
}
.topnav .nav-links a:hover,
.topnav .nav-links a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.topnav .nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.topnav .nav-user {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}
.topnav .nav-version {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 2px 7px;
  font-family: monospace;
  letter-spacing: 0.3px;
}
.topnav .btn-logout {
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.7);
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}
.topnav .btn-logout:hover { border-color: rgba(255,255,255,0.5); color: #fff; }
.nav-hamburger { display: none; }

/* ============================================================
   BOTONES COMUNES
   ============================================================ */
.btn-primary {
  background: var(--gold);
  color: var(--carbon);
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background 0.15s, transform 0.15s;
}
.btn-primary:hover { background: #e0b225; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary.loading { opacity: 0.7; pointer-events: none; cursor: wait; }
.btn-primary.loading::after {
  content: ''; display: inline-block; width: 14px; height: 14px; margin-left: 8px;
  border: 2px solid var(--carbon); border-top-color: transparent; border-radius: 50%;
  animation: spin 0.6s linear infinite; vertical-align: middle;
}

.btn-secondary {
  background: #fff;
  color: var(--carbon);
  border: 1px solid var(--gray-200);
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.btn-secondary:hover { border-color: var(--gray-400); background: var(--gray-50); }

.btn-danger {
  background: none;
  color: var(--orange);
  border: 1px solid var(--orange);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}
.btn-danger:hover { background: var(--orange); color: #fff; }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--gray-500);
  font-size: 16px;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.btn-icon:hover { color: var(--orange); background: #fef1ec; }

.btn-add {
  background: none;
  border: 1px dashed var(--gray-300);
  color: var(--gray-500);
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: all 0.15s;
  margin-top: 6px;
}
.btn-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* ============================================================
   DASHBOARD (index.html)
   ============================================================ */
.dashboard-page { padding: 32px 40px; }
.dashboard-page h1 { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
.dashboard-page .dash-sub { color: var(--gray-500); font-size: 13px; margin-bottom: 32px; }

.dash-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}
.dash-card {
  background: #fff;
  border-radius: 10px;
  padding: 24px 28px;
  border: 1px solid var(--gray-200);
  text-decoration: none;
  color: var(--carbon);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow 0.15s, transform 0.15s;
}
.dash-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); transform: translateY(-1px); }
.dash-card .dash-card-icon { font-size: 28px; line-height: 1; }
.dash-card .dash-card-title { font-size: 15px; font-weight: 600; }
.dash-card .dash-card-desc { font-size: 12px; color: var(--gray-500); line-height: 1.5; }

.dash-section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.dash-section-title a {
  font-size: 12px;
  font-weight: 400;
  color: var(--gray-500);
  text-decoration: none;
  margin-left: auto;
}
.dash-section-title a:hover { color: var(--accent); }

/* ============================================================
   QUOTE BUILDER (quote.html)
   ============================================================ */
.quote-layout {
  display: flex;
  height: calc(100vh - 52px);
  overflow: hidden;
}

/* Panel izquierdo */
.quote-panel {
  width: var(--panel-w);
  min-width: var(--panel-w);
  background: #fff;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.panel-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-header h2 { font-size: 14px; font-weight: 600; }
.panel-header .quote-number {
  font-size: 11px;
  color: var(--gray-500);
  font-weight: 400;
}

.panel-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
}
.panel-section h3 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  margin-bottom: 12px;
}

/* Product selector */
.product-selector {
  display: flex;
  align-items: center;
  gap: 12px;
}
.product-thumb {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.product-thumb-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  background: var(--gray-100);
  border: 1px dashed var(--gray-300);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  font-size: 20px;
  flex-shrink: 0;
}

/* Brand switcher */
.brand-switcher {
  display: flex;
  gap: 6px;
}
.brand-btn {
  flex: 1;
  padding: 7px 8px;
  border: 1px solid var(--gray-200);
  border-radius: 5px;
  background: #fff;
  font-size: 11px;
  font-family: var(--font);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  color: var(--gray-700);
  line-height: 1.3;
}
.brand-btn:hover { border-color: var(--gray-400); }
.brand-btn.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}

/* Form inputs en panel */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.form-row:last-child { margin-bottom: 0; }
.form-row label {
  font-size: 11px;
  font-weight: 500;
  color: var(--gray-500);
}
.form-row input,
.form-row select,
.form-row textarea {
  padding: 7px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  color: var(--carbon);
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus { border-color: var(--accent); }
.form-row textarea { resize: vertical; min-height: 60px; }

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.form-row-2col label {
  font-size: 11px;
  font-weight: 500;
  color: var(--gray-500);
  margin-bottom: 4px;
  display: block;
}
.form-row-2col input,
.form-row-2col select {
  padding: 7px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  color: var(--carbon);
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}
.form-row-2col input:focus,
.form-row-2col select:focus { border-color: var(--accent); }

/* Live summary */
.cost-summary {
  background: var(--gray-50);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}
.cost-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding: 3px 0;
  color: var(--gray-700);
}
.cost-summary-row.separator { border-top: 1px solid var(--gray-200); margin-top: 6px; padding-top: 8px; }
.cost-summary-row .label { color: var(--gray-500); }
.cost-summary-row .value { font-weight: 500; font-variant-numeric: tabular-nums; }

.price-highlight {
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
  text-align: center;
}
.price-highlight .price-label { font-size: 11px; opacity: 0.8; margin-bottom: 4px; }

.margin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.margin-row label { font-size: 12px; font-weight: 500; color: var(--gray-500); white-space: nowrap; flex: 1; }
.margin-row.target-price-row label { color: var(--accent); }
.margin-row.target-price-row.below-cost {
  background: #fff0f0;
  border: 1.5px solid #d32f2f;
  border-radius: 6px;
  padding: 6px 8px;
  margin: -6px -8px;
}
.margin-row.target-price-row.below-cost label { color: #d32f2f; }
.margin-row.target-price-row.below-cost input { border-color: #d32f2f; color: #d32f2f; }
.target-price-error {
  color: #d32f2f;
  font-size: 11px;
  font-weight: 500;
  margin-top: 4px;
  margin-bottom: 4px;
}
.margin-row input {
  width: 80px;
  padding: 7px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
}
.margin-row input:focus { border-color: var(--accent); }
.margin-row .margin-hint { font-size: 11px; color: var(--gray-400); }
.margin-row input.field-computed {
  background: var(--gray-50);
  color: var(--gray-400);
  border-style: dashed;
}

/* Toggle fijar margen / precio */
.lock-toggle {
  display: flex;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
}
.lock-btn {
  flex: 1;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 500;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--gray-500);
  font-family: var(--font);
  transition: background 0.15s, color 0.15s;
}
.lock-btn:hover { background: var(--gray-100); }
.lock-btn.active { background: var(--carbon); color: #fff; }

/* Unit toggle (kg/lb) */
.unit-toggle {
  display: inline-flex;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}
.unit-btn {
  padding: 3px 8px;
  font-size: 11px;
  font-family: var(--font);
  border: none;
  background: #fff;
  color: var(--gray-500);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.unit-btn:first-child { border-right: 1px solid var(--gray-200); }
.unit-btn:hover { background: var(--gray-100); }
.unit-btn.active { background: var(--carbon); color: #fff; }

/* Advertencias de incoherencia */
.quote-warnings {
  display: none;
  margin-bottom: 10px;
  border-radius: 6px;
  overflow: hidden;
}
.quote-warning-item {
  background: #fff5f5;
  border-left: 3px solid #e53e3e;
  color: #c53030;
  font-size: 11px;
  font-weight: 500;
  padding: 7px 10px;
  line-height: 1.4;
  margin-bottom: 2px;
}
.quote-warning-item:last-child { margin-bottom: 0; }

.margin-negocio-row {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 6px 10px;
}
.margin-negocio-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  min-width: 60px;
  text-align: right;
}
.margin-hint-info {
  font-size: 10px;
  color: var(--gray-400);
}

.panel-actions {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--gray-200);
  margin-top: auto;
}
.chk-margin-pdf {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--gray-500);
  cursor: pointer;
}
.chk-margin-pdf input { accent-color: var(--accent); }
.print-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.btn-excel {
  background: #217346;
  color: #fff;
  border-color: #1a5c38;
  font-size: 12px;
  padding: 7px 4px;
}
.btn-excel:hover { opacity: 0.85; }
.print-grid .btn-print {
  font-size: 12px;
  padding: 7px 4px;
}

/* Columna derecha — capas de costo */
.quote-layers {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.layer-section {
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  overflow: hidden;
  flex-shrink: 0;
}
.layer-header {
  display: flex;
  align-items: center;
  padding: 13px 16px;
  cursor: pointer;
  user-select: none;
  gap: 10px;
  transition: background 0.1s;
}
.layer-header:hover { background: var(--gray-50); }
.layer-header .layer-toggle { font-size: 12px; color: var(--gray-400); transition: transform 0.15s; }
.layer-header.collapsed .layer-toggle { transform: rotate(-90deg); }
.layer-header h3 { font-size: 13px; font-weight: 600; flex: 1; }
.layer-header .layer-total {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.layer-header .layer-yield-badge {
  font-size: 10px;
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
}

.layer-body {
  padding: 0 16px 14px;
  border-top: 1px solid var(--gray-100);
}

/* Ítem de costo — tarjeta de 2 filas */
.cost-item {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 12px;
}
.cost-item:last-of-type { margin-bottom: 0; }

.cost-item-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.cost-item-row1 .item-name {
  flex: 1;
  min-width: 0;
}
.cost-item-row2 {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.cost-item-row2 .item-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cost-item-row2 .item-field label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--gray-400);
  white-space: nowrap;
}
.cost-item-row2 .item-field.field-value  { width: 80px; }
.cost-item-row2 .item-field.field-unit   { width: 100px; }
.cost-item-row2 .item-field.field-unitkg { width: 70px; }
.cost-item-row2 .item-field.field-fship  { width: 80px; }
.cost-item-row2 .item-field.field-fquote { width: 80px; }

.cost-item input,
.cost-item select {
  padding: 5px 8px;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font);
  color: var(--carbon);
  outline: none;
  width: 100%;
  transition: border-color 0.12s;
  background: #fff;
}
.cost-item input:focus,
.cost-item select:focus { border-color: var(--accent); }

.cost-item .item-result {
  margin-left: auto;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  align-self: flex-end;
  padding-bottom: 1px;
}
.cost-item .item-result.na { color: var(--gray-400); font-weight: 400; font-size: 11px; }

/* Header de columnas — ya no necesario con tarjetas */
.cost-items-header { display: none; }

/* Badge de moneda */
.currency-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.currency-badge.usd { background: #dce9f0; color: #365A6E; }
.currency-badge.ars { background: #fef3cd; color: #7c5a00; }

/* Toggle de moneda en ítem de cotización */
.currency-toggle {
  display: flex;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}
.currency-toggle button {
  padding: 5px 7px;
  border: none;
  background: #fff;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  color: var(--gray-500);
  transition: all 0.12s;
  white-space: nowrap;
}
.currency-toggle button.active {
  background: #dce9f0;
  color: #365A6E;
  font-weight: 700;
}
.currency-toggle button.active.ars-active {
  background: #fef3cd;
  color: #7c5a00;
}

/* Ítem en ARS — borde amarillo */
.cost-item.ars-item {
  border-left: 3px solid #f59e0b;
}

/* Resultado ARS */
.item-result .ars-raw {
  display: block;
  font-size: 9px;
  font-weight: 600;
  color: #7c5a00;
  line-height: 1.3;
}
.item-result .ars-usd {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.3;
}
.item-result .ars-notc {
  display: block;
  font-size: 9px;
  color: var(--orange);
  font-weight: 600;
}

/* Campo tipo de cambio — warning */
#usd-ars-rate.rate-warning {
  border-color: var(--orange) !important;
  background: #fef1ec;
  box-shadow: 0 0 0 2px rgba(201,71,7,0.15);
}
label.rate-warning-label {
  color: var(--orange);
  font-weight: 600;
}

/* Resumen: nota ARS */
.cost-summary-row.ars-rate-note .label { color: #7c5a00; font-style: italic; }
.cost-summary-row.ars-rate-note .value { color: #7c5a00; font-weight: 600; }
.cost-summary-row.ars-rate-warn .label { color: var(--orange); }
.cost-summary-row.ars-rate-warn .value { color: var(--orange); }

/* Fuente: manual / tabla */
.source-toggle {
  display: flex;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}
.source-toggle button {
  flex: 1;
  padding: 5px 4px;
  border: none;
  background: #fff;
  font-size: 10px;
  font-family: var(--font);
  cursor: pointer;
  color: var(--gray-500);
  transition: all 0.12s;
}
.source-toggle button.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

/* Comisión — sección especial */
.commission-section {
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  padding: 16px;
  flex-shrink: 0;
}
.commission-section h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.commission-section h3 .comm-total {
  font-size: 12px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.commission-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: end;
}
.commission-grid label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--gray-400);
  display: block;
  margin-bottom: 4px;
}
.commission-grid input,
.commission-grid select {
  padding: 7px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  color: var(--carbon);
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}
.commission-grid input:focus,
.commission-grid select:focus { border-color: var(--accent); }

/* ============================================================
   PANEL: precio ambas unidades + cert picker
   ============================================================ */
.price-both {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-top: 2px;
}
.price-both .price-kg,
.price-both .price-lb { font-size: 17px; font-weight: 700; }
.price-both .price-sep { font-size: 14px; opacity: 0.5; }
.price-highlight .price-label { font-size: 11px; opacity: 0.8; margin-bottom: 4px; }

/* ============================================================
   PDF / PRINT
   ============================================================ */
.pdf-container { display: none; }

.pdf-page {
  width: 210mm;
  min-height: 297mm;
  padding: 11mm 14mm 22mm;
  background: #fff;
  page-break-after: always;
  font-family: 'Inter', sans-serif;
  box-sizing: border-box;
  position: relative;
  color: #2F2C2B;
}
.pdf-page:last-child { page-break-after: auto; }

/* ---- HEADER — logos sobre la línea ---- */
.pdf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 4mm;
  border-bottom: 2px solid var(--pdf-accent, #2F2C2B);
  margin-bottom: 2.5mm;
}
.pdf-brand-logo {
  max-height: 22mm;
  height: auto;
  max-width: 85mm;
  object-fit: contain;
  object-position: left center;
}
.pdf-manila-small {
  max-height: 18mm;
  height: auto;
  max-width: 40mm;
  opacity: 0.55;
  object-fit: contain;
  object-position: right center;
}

/* ---- BARRA DEBAJO DE LA LÍNEA: número + fecha + validez ---- */
.pdf-quote-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4mm;
  padding-bottom: 2mm;
}
.pdf-quote-number { font-size: 11pt; font-weight: 800; color: var(--pdf-accent, #2F2C2B); }
.pdf-quote-meta { display: flex; gap: 5mm; font-size: 7.5pt; color: #888; }
.pdf-date, .pdf-valid { font-size: 7.5pt; color: #888; }

/* ---- FOTO PRODUCTO — siempre visible, fallback de color brand ---- */
.pdf-photo-wrap {
  width: 100%;
  height: 54mm;
  margin-bottom: 3mm;
  border-radius: 5px;
  overflow: hidden;
  background: var(--pdf-accent, #2F2C2B);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pdf-photo-wrap.has-photo { background: transparent; }
.pdf-product-photo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

/* ---- NOMBRE PRODUCTO — Playfair Display como fichas ---- */
.pdf-product-block {
  margin-bottom: 3mm;
  border-bottom: 1px solid var(--pdf-accent, #2F2C2B);
  padding-bottom: 2.5mm;
}
.pdf-product-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 18pt;
  font-weight: 700;
  margin-bottom: 1mm;
  line-height: 1.2;
  color: var(--pdf-accent, #2F2C2B);
}
.pdf-product-spec { font-size: 8pt; color: #666; letter-spacing: 0.2px; }

/* ---- INCOTERM BANNER — prominente ---- */
.pdf-incoterm-banner {
  display: flex;
  align-items: stretch;
  border: 2px solid var(--pdf-accent, #2F2C2B);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 3mm;
}
.pdf-incoterm-id {
  background: var(--pdf-accent, #2F2C2B);
  color: #fff;
  font-size: 22pt;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 3mm 6mm;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28mm;
}
.pdf-incoterm-info {
  padding: 2.5mm 5mm;
  flex: 1;
}
.pdf-incoterm-fullname {
  font-size: 11pt;
  font-weight: 700;
  color: var(--pdf-accent, #2F2C2B);
  line-height: 1.2;
}
.pdf-incoterm-desc {
  font-size: 7.5pt;
  color: #666;
  margin-top: 0.5mm;
  line-height: 1.3;
}
.pdf-incoterm-origin {
  font-size: 7.5pt;
  font-weight: 600;
  color: #444;
  margin-top: 1mm;
}

/* ---- PRECIO: kg y lb al mismo nivel ---- */
.pdf-price-block {
  background: var(--pdf-accent, #2F2C2B);
  color: #fff;
  border-radius: 8px;
  padding: 4mm 8mm;
  margin-bottom: 4mm;
}
.pdf-prices-row {
  display: flex;
  align-items: center;
  gap: 0;
}
.pdf-price-unit {
  flex: 1;
  text-align: center;
}
.pdf-price-val {
  display: block;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 28pt;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1;
}
.pdf-price-unit-label {
  display: block;
  font-size: 9pt;
  opacity: 0.8;
  margin-top: 1mm;
}
.pdf-price-divider {
  font-size: 30pt;
  opacity: 0.25;
  padding: 0 4mm;
  line-height: 1;
}

/* ---- SECTION LABEL — encabezado tipo fichas ---- */
.pdf-section-label {
  font-size: 7pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--pdf-accent, #2F2C2B);
  border-bottom: 1.5px solid var(--pdf-accent, #2F2C2B);
  padding-bottom: 1mm;
  margin-bottom: 2.5mm;
}

/* ---- INFO GRID — estilo tabla limpia (sin cajas) ---- */
.pdf-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 8mm;
  margin-bottom: 4mm;
}
.pdf-info-cell {
  display: flex;
  align-items: baseline;
  gap: 2.5mm;
  border-bottom: 1px solid #ece9e5;
  padding: 1.2mm 0;
}
.pdf-info-cell .cell-label {
  font-size: 6.5pt;
  font-weight: 700;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  width: 16mm;
  flex-shrink: 0;
  line-height: 1.4;
  padding-top: 0.2mm;
}
.pdf-info-cell .cell-val {
  font-size: 8.5pt;
  font-weight: 500;
  color: #2F2C2B;
  line-height: 1.4;
  flex: 1;
}

/* ---- CERTIFICACIONES — pills sin borde ---- */
.pdf-certs {
  display: flex;
  gap: 3mm;
  flex-wrap: wrap;
  margin-bottom: 3mm;
  align-items: center;
}
.pdf-cert-item {
  display: flex;
  align-items: center;
  gap: 2mm;
  background: #f2f1ef;
  border-radius: 20px;
  padding: 1.5mm 4mm;
  font-size: 7.5pt;
}
.pdf-cert-item img { height: 16px; width: auto; }
.pdf-cert-badge {
  background: var(--pdf-accent, #2F2C2B);
  color: #fff;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 7pt;
  letter-spacing: 0.3px;
}
.pdf-cert-name { font-size: 8pt; color: #555; }

/* ---- COMENTARIOS ---- */
.pdf-comments {
  border-left: 3px solid var(--pdf-accent, #2F2C2B);
  padding: 3mm 4mm;
  margin-bottom: 5mm;
  background: #fafafa;
  border-radius: 0 4px 4px 0;
}
.pdf-comments-label {
  font-size: 7.5pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #888;
  margin-bottom: 1.5mm;
}
.pdf-comments-text {
  font-size: 8.5pt;
  color: #444;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ---- FOOTER ---- */
.pdf-footer {
  position: absolute;
  bottom: 8mm;
  left: 14mm;
  right: 14mm;
  border-top: 1px solid #e5e3e0;
  padding-top: 3mm;
  display: flex;
  justify-content: space-between;
  font-size: 7.5pt;
  color: #aaa;
}

/* ============================================================
   PÁGINA INTERNA — rediseño compacto 1 hoja
   ============================================================ */
.pdf-internal-page {
  padding: 8mm 10mm 12mm;
  font-size: 7pt;
}

/* Header compacto */
.pdi-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 2px solid #2F2C2B;
  padding-bottom: 2mm;
  margin-bottom: 2.5mm;
}
.pdi-header-left {
  display: flex;
  align-items: baseline;
  gap: 3mm;
}
.pdi-title {
  font-size: 11pt;
  font-weight: 800;
  color: #2F2C2B;
}
.pdi-quote-num {
  font-size: 9pt;
  font-weight: 700;
  color: var(--pdf-accent, #40543B);
}
.pdi-alias {
  font-size: 8pt;
  font-weight: 400;
  color: #888;
  font-style: italic;
}
.pdi-header-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5mm;
}
.pdi-confidential {
  font-size: 6pt;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #c00;
  text-transform: uppercase;
  border: 1px solid #c00;
  border-radius: 2px;
  padding: 0.5mm 2mm;
}
.pdi-date {
  font-size: 7pt;
  color: #888;
}

/* Logistics inline strip */
.pdi-logistics {
  display: flex;
  flex-wrap: wrap;
  gap: 1mm 4mm;
  background: #f7f6f4;
  border-radius: 3px;
  padding: 2mm 3mm;
  margin-bottom: 2.5mm;
  font-size: 7pt;
  line-height: 1.5;
}
.pdi-log-item {
  white-space: nowrap;
}
.pdi-log-volume {
  font-size: 10pt;
  color: var(--carbon);
  letter-spacing: 0.3px;
}
.pdi-log-label {
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  font-size: 6pt;
  letter-spacing: 0.3px;
}

/* Tabla de costos — 4 columnas, compacta */
.pdi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 7pt;
  margin-bottom: 2mm;
}
.pdi-table th {
  background: #2F2C2B;
  color: #fff;
  padding: 1.5mm 2.5mm;
  text-align: left;
  font-size: 6.5pt;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.pdi-table th.num { text-align: right; }
.pdi-table td {
  padding: 1mm 2.5mm;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
  line-height: 1.3;
}
.pdi-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Layer title row */
.pdi-table tr.pdi-layer-title td {
  background: #f5f4f2;
  font-weight: 700;
  font-size: 7pt;
  padding-top: 1.5mm;
  color: #2F2C2B;
  border-bottom: 1px solid #ddd;
}
.pdi-yield {
  font-weight: 400;
  font-size: 6pt;
  color: #888;
}

/* Currency badge ARS */
.pdi-cur-ars {
  font-size: 5.5pt;
  font-weight: 700;
  padding: 0.5px 3px;
  border-radius: 2px;
  background: #fef3cd;
  color: #7c5a00;
  vertical-align: middle;
  margin-left: 1mm;
}

/* Layer subtotal */
.pdi-table tr.pdi-subtotal td {
  font-weight: 600;
  font-size: 6.5pt;
  color: #666;
  background: #fafafa;
  border-bottom: 1px solid #ddd;
}

/* Stage subtotal — highlighted */
.pdi-table tr.pdi-stage-total td {
  background: #f0eeeb;
  font-weight: 700;
  font-size: 7.5pt;
  border-top: 1.5px solid #ccc;
  border-bottom: 1.5px solid #ccc;
  padding: 1.5mm 2.5mm;
  color: #2F2C2B;
}

/* Commission row */
.pdi-table tr.pdi-comm-row td {
  font-style: italic;
  color: #555;
  border-bottom: 1px solid #ddd;
}

/* Grand total (precio final) */
.pdi-table tr.pdi-grand-total td {
  background: #2F2C2B;
  color: #fff;
  font-weight: 800;
  font-size: 8pt;
  padding: 2mm 2.5mm;
}


/* Summary strip horizontal */
.pdi-summary {
  display: flex;
  border: 1.5px solid #2F2C2B;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 2mm;
}
.pdi-sum-cell {
  flex: 1;
  padding: 2mm 3mm;
  text-align: center;
  border-right: 1px solid #e5e3e0;
}
.pdi-sum-cell:last-child { border-right: none; }
.pdi-sum-label {
  display: block;
  font-size: 5.5pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
}
.pdi-sum-val {
  display: block;
  font-size: 9pt;
  font-weight: 800;
  margin-top: 0.5mm;
  color: #2F2C2B;
}
.pdi-sum-sub {
  display: block;
  font-size: 6.5pt;
  color: #999;
}
.pdi-sum-highlight {
  background: #2F2C2B;
}
.pdi-sum-highlight .pdi-sum-label { color: rgba(255,255,255,0.6); }
.pdi-sum-highlight .pdi-sum-val { color: #fff; }
.pdi-sum-highlight .pdi-sum-sub { color: rgba(255,255,255,0.7); }

/* Plant Price muted cell */
.pdi-sum-muted {
  background: #f5f4f2;
}
.pdi-sum-muted .pdi-sum-label { color: #bbb; }
.pdi-sum-muted .pdi-sum-val { color: #999; font-weight: 600; }
.pdi-sum-muted .pdi-sum-sub { color: #bbb; }

/* Rate note */
.pdi-rate-note {
  font-size: 7pt;
  font-weight: 600;
  color: #666;
  text-align: center;
  margin-bottom: 1mm;
  display: none;
}
.pdi-rate-note.visible { display: block; }

/* Footer */
.pdi-footer {
  font-size: 6.5pt;
  color: #bbb;
  text-align: center;
  position: absolute;
  bottom: 6mm;
  left: 10mm;
  right: 10mm;
}

/* ---- EXPORT PAGE ---- */
.pdf-export-page .pdf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 4mm;
  border-bottom: 2px solid var(--pdf-accent, #2F2C2B);
  margin-bottom: 2.5mm;
}
.pdf-exp-header-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 1mm;
}
.pdf-exp-title {
  font-size: 14pt;
  font-weight: 700;
  color: var(--pdf-accent, #2F2C2B);
  margin: 2mm 0 3mm;
}

/* Print-only: visibility rules */
@media print {
  @page { size: A4 portrait; margin: 0; }

  body > *:not(.pdf-container) { display: none !important; }
  .pdf-container { display: block !important; }

  /* PDF Cliente: solo página cliente */
  body.print-client .pdf-plant-page { display: none !important; }
  body.print-client .pdf-export-page { display: none !important; }

  /* PDF Export: export + cliente */
  body.print-export .pdf-plant-page { display: none !important; }

  /* PDF Planta: solo planta */
  body.print-plant .pdf-export-page { display: none !important; }
  body.print-plant .pdf-client-page { display: none !important; }

  /* PDF Completo (internal): las 3 páginas */

  /* ---- INSCRIPCIÓN "COPIA ENVIADA AL CLIENTE" ---- */
  .pdf-copy-label { display: none; }
  body.print-internal .pdf-copy-label {
    display: block;
    text-align: center;
    font-size: 7pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--pdf-accent, #2F2C2B);
    border: 1px dashed var(--pdf-accent, #2F2C2B);
    border-radius: 3px;
    padding: 1.5mm 4mm;
    margin-bottom: 4mm;
    opacity: 0.5;
  }
}

/* ============================================================
   HISTORY PAGE
   ============================================================ */
.history-page { padding: 28px 40px; }
.history-page h1 { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.history-page .history-sub { color: var(--gray-500); font-size: 13px; margin-bottom: 24px; }

.history-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.history-filters input,
.history-filters select {
  padding: 7px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  background: #fff;
  transition: border-color 0.15s;
  color: var(--carbon);
}
.history-filters input:focus,
.history-filters select:focus { border-color: var(--accent); }
.history-filters input[type="text"] { min-width: 200px; }

.quotes-table {
  width: 100%;
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  overflow: hidden;
  border-collapse: collapse;
}
.quotes-table th {
  background: var(--gray-50);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
}
.quotes-table td {
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.quotes-table tr:last-child td { border-bottom: none; }
.quotes-table tr:hover td { background: var(--gray-50); }
.quotes-table tr { cursor: pointer; transition: background 0.1s; }

.quotes-table .num { font-variant-numeric: tabular-nums; font-weight: 500; }
.quotes-table .quote-number { font-weight: 700; color: var(--accent); }
.quotes-table .status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}
.status-badge.confirmed { background: #e6f4ea; color: #2d7a40; }
.status-badge.draft { background: #fef3e2; color: #b06400; }
.dash-pdf-link {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--blue);
  background: #eef4f7;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
}
.dash-pdf-link:hover { background: #daeaf1; }

/* Modal de detalle */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 12px;
  width: 820px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.modal-header h2 { font-size: 17px; font-weight: 700; }
.modal-body { padding: 24px; flex: 1; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: #fff;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}
.detail-cell {
  padding: 10px 14px;
  background: var(--gray-50);
  border-radius: 6px;
  border: 1px solid var(--gray-100);
}
.detail-cell .dc-label { font-size: 10px; font-weight: 600; text-transform: uppercase; color: var(--gray-400); margin-bottom: 3px; }
.detail-cell .dc-val { font-size: 13px; font-weight: 500; }

.detail-price-block {
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.detail-price-block .dpr-incoterm { font-size: 11px; opacity: 0.75; }
.detail-price-block .dpr-kg { font-size: 26px; font-weight: 800; }
.detail-price-block .dpr-lb { font-size: 14px; opacity: 0.85; }
.detail-price-block .dpr-margin { margin-left: auto; font-size: 13px; opacity: 0.8; }

.detail-cost-section { margin-bottom: 16px; }
.detail-cost-section h4 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--gray-500);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
}
.detail-cost-section h4 span { color: var(--accent); font-variant-numeric: tabular-nums; }

.detail-cost-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--gray-100);
}
.detail-cost-item:last-child { border-bottom: none; }
.detail-cost-item .dci-name { color: var(--gray-700); flex: 1; }
.detail-cost-item .dci-source { font-size: 10px; color: var(--gray-400); margin-left: 8px; }
.detail-cost-item .dci-val { font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ============================================================
   ADMIN PAGE
   ============================================================ */
.admin-page { padding: 28px 40px; }
.admin-page h1 { font-size: 20px; font-weight: 600; margin-bottom: 6px; }

.admin-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--gray-200);
}
.admin-tab {
  padding: 9px 20px;
  border: none;
  background: none;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.admin-tab:hover:not(.active) { color: var(--carbon); }

.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }

.admin-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.admin-list-header h2 { font-size: 15px; font-weight: 600; }

.admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.admin-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.admin-card-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--gray-100);
  flex-shrink: 0;
}
.admin-card-body { flex: 1; min-width: 0; }
.admin-card-name { font-size: 13px; font-weight: 600; }
.admin-card-sub { font-size: 11px; color: var(--gray-500); margin-top: 2px; }
.admin-card-actions { display: flex; gap: 6px; flex-shrink: 0; }

.admin-form-panel {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 24px;
  display: none;
  margin-bottom: 24px;
}
.admin-form-panel.open { display: block; }
.admin-form-panel h3 { font-size: 15px; font-weight: 600; margin-bottom: 20px; }

.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
.admin-form-grid.single { grid-template-columns: 1fr; }
.admin-form-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.admin-form-field input,
.admin-form-field select,
.admin-form-field textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  color: var(--carbon);
  outline: none;
  transition: border-color 0.15s;
}
.admin-form-field input:focus,
.admin-form-field select:focus,
.admin-form-field textarea:focus { border-color: var(--accent); }
.admin-form-field textarea { min-height: 80px; resize: vertical; }

/* ─── Photo picker admin ─── */
.photo-picker { display: flex; gap: 12px; align-items: flex-start; }

.photo-picker-preview {
  width: 100px;
  height: 72px;
  border-radius: 6px;
  border: 2px dashed var(--gray-200);
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.photo-picker-preview.has-photo { border-color: var(--accent); border-style: solid; }
.photo-picker-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-picker-empty { font-size: 11px; color: var(--gray-400); text-align: center; padding: 8px; }

.photo-picker-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.photo-pick-item {
  width: 72px;
  height: 52px;
  border-radius: 5px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  background: var(--gray-100);
}
.photo-pick-item:hover { border-color: var(--accent); transform: scale(1.05); }
.photo-pick-item.selected { border-color: var(--green, #40543B); }
.photo-pick-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

.photo-pick-none {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--gray-400);
  border-style: dashed;
  border-color: var(--gray-200);
}
.photo-pick-none:hover { border-color: var(--orange); color: var(--orange); }
.photo-pick-none.selected { border-color: var(--gray-400); border-style: solid; }

.photo-pick-upload {
  display: flex; align-items: center; justify-content: center;
  border-style: dashed !important;
  color: var(--gray-400);
  font-size: 18px;
}
.photo-pick-upload:hover { border-color: var(--green) !important; color: var(--green); }
.photo-pick-upload.uploading { opacity: 0.5; pointer-events: none; }

/* Wrapper para fotos propias del producto (con X de eliminar) */
.photo-pick-wrapper {
  position: relative;
  flex-shrink: 0;
}
.photo-pick-del {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  border: 2px solid #fff;
  font-size: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  font-family: var(--font);
  font-weight: 700;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.15s;
}
.photo-pick-wrapper:hover .photo-pick-del { opacity: 1; }

.admin-form-actions {
  display: flex;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-100);
}

.cert-checkboxes {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.cert-checkboxes label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  padding: 6px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  transition: all 0.12s;
  text-transform: none !important;
  letter-spacing: 0 !important;
}
.cert-checkboxes label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}
.cert-checkboxes input[type="checkbox"] { accent-color: var(--accent); }

/* Suggestions */
.suggestions-bar {
  margin-top: 8px;
}
.btn-suggest {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 11px;
  font-family: var(--font);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: background 0.15s, color 0.15s;
}
.btn-suggest:hover {
  background: var(--accent);
  color: #fff;
}
.suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
}
.suggestion-chip {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 7px 11px;
  font-size: 11.5px;
  font-family: var(--font);
  color: var(--carbon);
  text-align: left;
  cursor: pointer;
  line-height: 1.5;
  transition: border-color 0.15s, background 0.15s;
}
.suggestion-chip:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

/* Cost tables admin */
.cost-table-item {
  display: grid;
  grid-template-columns: 1.5fr 1fr 80px 80px 80px 80px auto;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 12px;
}
.cost-table-item .cti-name { font-weight: 500; }
.cost-table-item .cti-layer {
  font-size: 11px;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 2px 8px;
  border-radius: 20px;
  text-align: center;
}
.cost-table-item .cti-val { font-variant-numeric: tabular-nums; text-align: right; }

/* ============================================================
   UTILS
   ============================================================ */
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-small { font-size: 11px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--gray-400);
  font-size: 13px;
}
.empty-state .empty-icon { font-size: 36px; margin-bottom: 10px; }

/* ============================================================
   CALIBRE BUILDER — admin de productos
   ============================================================ */
.caliber-field { grid-column: 1 / -1; }
.caliber-builder { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.caliber-empty { font-size: 12px; color: var(--gray-400); padding: 6px 0; }

.caliber-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 6px 10px;
}
.caliber-entry .cal-min,
.caliber-entry .cal-max {
  width: 62px;
  text-align: center;
  padding: 4px 6px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  font-size: 13px;
}
.caliber-entry .cal-dash { color: var(--gray-400); font-weight: 500; }
.caliber-entry .cal-unit {
  width: 58px;
  padding: 4px 6px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
}
.caliber-entry .cal-preview {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  text-align: right;
  padding-right: 4px;
}
.btn-add-caliber {
  align-self: flex-start;
  background: none;
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius);
  color: var(--gray-500);
  padding: 5px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-add-caliber:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   YIELD EFECTIVO — header Proceso en Planta
   ============================================================ */
.layer-yield-effective {
  font-size: 10px;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}
.layer-yield-effective.undefined {
  background: var(--gray-100);
  color: var(--gray-500);
  font-weight: 400;
}

/* Campo Rdto% dentro de la fila de ítem */
.item-field.field-yield { min-width: 60px; max-width: 72px; }
.item-field.field-yield-placeholder { min-width: 60px; max-width: 72px; }

/* Anotación de rendimiento en la fila de Materia Prima del resumen */
.cost-summary-row .label { display: flex; flex-direction: column; gap: 1px; }
.yield-annotation {
  font-style: normal;
  font-size: 10px;
  font-weight: 400;
  color: var(--gray-500);
  font-variant-numeric: tabular-nums;
}

/* Columna de valor con total debajo */
.value-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.total-annotation {
  font-size: 10px;
  font-weight: 500;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  font-style: normal;
  opacity: 0.85;
}
.total-annotation strong {
  font-weight: 700;
}

/* Subtotal Costo de mercadería */
.cost-summary-row.production-subtotal {
  background: var(--gray-100);
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
  margin: 2px 0;
  padding: 4px 8px;
  border-radius: 4px;
}
.cost-summary-row.production-subtotal .label {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  flex-direction: row;
  align-items: center;
}
.cost-summary-row.production-subtotal .value {
  font-weight: 700;
  color: var(--green);
}

/* PDF breakdown: subtotal producción */
.pdf-breakdown-row.production-subtotal-pdf {
  background: #f0f7f0;
  border-top: 1px solid #c8e6c9;
  border-bottom: 1px solid #c8e6c9;
  padding: 1.5mm 0;
  margin: 1mm 0;
}
.pdf-breakdown-row.production-subtotal-pdf .bd-label { font-weight: 600; color: #2e7d32; }
.pdf-breakdown-row.production-subtotal-pdf .bd-val   { font-weight: 700; color: #2e7d32; }

/* ============================================================
   INCOTERM COVERAGE — checklist bajo el selector
   ============================================================ */
.incoterm-coverage {
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 11px;
}
.incoterm-hint {
  color: var(--gray-700);
  margin-bottom: 6px;
  line-height: 1.4;
}
.incoterm-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.incoterm-check {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
  font-size: 10px;
}
.incoterm-check.ok {
  background: #e8f5e9;
  color: #2e7d32;
}
.incoterm-check.missing {
  background: var(--gray-100);
  color: var(--gray-500);
}

/* ============================================================
   NAV DROPDOWNS — Export / Local
   ============================================================ */
.nav-dropdown {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}
.nav-dropdown > .nav-dropdown-label {
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 4px;
  transition: all 0.15s;
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font);
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-dropdown > .nav-dropdown-label:hover,
.nav-dropdown.has-active > .nav-dropdown-label {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.nav-dropdown-arrow {
  font-size: 9px;
  opacity: 0.6;
  transition: transform 0.15s;
}
.nav-dropdown:hover .nav-dropdown-arrow { transform: rotate(180deg); }
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.18);
  min-width: 180px;
  padding: 6px 0;
  z-index: 200;
  margin-top: 0;
  padding-top: 10px;
}
.nav-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 12px;
}
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.topnav .nav-links .nav-dropdown-menu a {
  display: block;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--carbon);
  text-decoration: none;
  transition: background 0.1s;
  background: none;
  border-radius: 0;
}
.topnav .nav-links .nav-dropdown-menu a:hover { background: var(--gray-100); color: var(--carbon); }
.topnav .nav-links .nav-dropdown-menu a.active { color: var(--accent); font-weight: 600; }

/* ============================================================
   INCOTERM STAGE LAYERS
   ============================================================ */
.stage-layer { border-left: 3px solid var(--accent); }
.stage-layer .layer-header { background: var(--accent-light, #e8efe7); }
.stage-hint-badge {
  font-size: 10px;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 500;
  margin-left: 4px;
  white-space: nowrap;
}
.cost-summary-row.stage-subtotal {
  border-top: 1px solid var(--gray-200);
  padding-top: 4px;
  margin-top: 2px;
  margin-bottom: 8px;
}
.cost-summary-row.stage-subtotal .label strong {
  font-size: 12px;
  color: var(--accent);
}
.cost-summary-row.plant-price-row {
  background: var(--accent-light);
  border-radius: var(--radius);
  padding: 6px 8px;
}
.stage-subtotal-row td { background: var(--gray-50); }
.stage-subtotal-pdf { border-top: 1px solid #ddd; padding-top: 1mm; margin-top: 1mm; margin-bottom: 2mm; }

/* ============================================================
   PAYMENT TERMS BLOCK — cotizaciones locales
   ============================================================ */
.payment-terms-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.payment-term-btn {
  padding: 5px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  font-size: 12px;
  font-family: var(--font);
  background: #fff;
  cursor: pointer;
  color: var(--gray-700);
  transition: all 0.12s;
}
.payment-term-btn:hover { border-color: var(--accent); color: var(--accent); }
.payment-term-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 500;
}

/* Delivery term coverage (como incoterm coverage) */
.delivery-coverage {
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 11px;
}
.delivery-hint {
  color: var(--gray-700);
  margin-bottom: 6px;
  line-height: 1.4;
}
.delivery-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.delivery-check {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
  font-size: 10px;
}
.delivery-check.ok { background: #e8f5e9; color: #2e7d32; }
.delivery-check.missing { background: var(--gray-100); color: var(--gray-500); }

/* ============================================================
   PDF LOCAL — Estilos adicionales
   ============================================================ */
/* Página interna local — override padding (export usa 8mm 10mm, local más holgado) */
.pdf-internal-page:has(.pdf-internal-title) {
  padding: 9mm 12mm 15mm;
  font-size: inherit;
}

/* Página interna local — estilos legacy */
.pdf-internal-title {
  font-size: 12pt;
  font-weight: 700;
  margin-bottom: 3mm;
  padding-bottom: 2mm;
  border-bottom: 1px solid #e5e3e0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.pdf-internal-title .int-sub { font-size: 7.5pt; font-weight: 400; color: #888; }
.pdf-int-alias {
  font-size: 9.5pt;
  font-weight: 400;
  color: #666;
  margin-left: 4mm;
  font-style: italic;
}
.pdf-int-logistics { margin-bottom: 4mm; }
.pil-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: 6mm;
}
.pil-cell {
  display: flex;
  align-items: baseline;
  gap: 2mm;
  border-bottom: 1px solid #ece9e5;
  padding: 1mm 0;
}
.pil-label {
  font-size: 6pt;
  font-weight: 700;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  white-space: nowrap;
}
.pil-label::after { content: ':'; margin-right: 0.5mm; }
.pil-val {
  font-size: 7.5pt;
  font-weight: 500;
  color: #2F2C2B;
  line-height: 1.3;
}

/* Tabla de costos para PDF local (reutiliza clases viejas) */
.pdf-cost-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 7.5pt;
  margin-bottom: 4mm;
}
.pdf-cost-table th {
  background: #f2f1ef;
  padding: 2mm 3mm;
  text-align: left;
  font-size: 7pt;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.pdf-cost-table td {
  padding: 1.5mm 3mm;
  border-bottom: 1px solid #f0eeec;
  vertical-align: middle;
}
.pdf-cost-table tr.layer-title td {
  background: #f9f9f8;
  font-weight: 700;
  font-size: 8pt;
  padding-top: 2mm;
}
.pdf-cost-table tr.subtotal td {
  font-weight: 600;
  background: #f2f1ef;
}
.pdf-cost-table tr.grand-total td {
  font-weight: 800;
  font-size: 9pt;
  background: #2F2C2B;
  color: #fff;
  padding: 2mm 3mm;
}
.pdf-cost-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.pdf-summary-box {
  border: 2px solid #2F2C2B;
  border-radius: 6px;
  padding: 3mm 5mm;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 3mm;
  margin-bottom: 4mm;
  font-size: 8pt;
}
.pdf-summary-box .sum-cell .sum-label { font-size: 7pt; color: #888; font-weight: 600; text-transform: uppercase; }
.pdf-summary-box .sum-cell .sum-val { font-size: 12pt; font-weight: 800; margin-top: 0.5mm; }
.pdf-summary-box .sum-cell .sum-sub { font-size: 7.5pt; color: #888; }
.pdf-rate-note {
  font-size: 8pt;
  font-weight: 600;
  color: #555;
  background: #f5f4f2;
  border: 1px solid #e5e3e0;
  border-radius: 4px;
  padding: 2mm 4mm;
  margin-bottom: 3mm;
  display: none;
}
.pdf-rate-note.visible { display: block; }
.pdf-meta-footer {
  font-size: 7.5pt;
  color: #aaa;
  text-align: center;
  position: absolute;
  bottom: 8mm;
  left: 14mm;
  right: 14mm;
}

/* Bloque de condiciones de pago en PDF local */
.pdf-payment-block {
  background: #f9f8f7;
  border: 1.5px solid #e5e3e0;
  border-radius: 6px;
  padding: 3mm 4mm;
  margin-bottom: 4mm;
}
.pdf-payment-label {
  font-size: 7pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #888;
  margin-bottom: 1.5mm;
}
.pdf-payment-value {
  font-size: 10pt;
  font-weight: 700;
  color: #2F2C2B;
}

/* Precio en ARS para PDF local */
.pdf-price-block.local-price .pdf-price-val {
  font-size: 24pt;
}
.pdf-price-block.local-price .pdf-price-unit-label {
  font-size: 8.5pt;
}

/* Aviso IVA */
.pdf-iva-notice {
  font-size: 7.5pt;
  color: #888;
  text-align: center;
  margin-top: 2mm;
  font-style: italic;
}

/* Detalles producto (conservación, vida útil, etiqueta) */
.pdf-product-details {
  font-size: 8pt;
  color: #666;
  margin-top: 1mm;
  text-align: center;
}

/* Equivalente USD en PDF costos local */
.pdf-ars-equiv {
  font-size: 7.5pt;
  color: #888;
  font-weight: 500;
  margin-top: 1mm;
  text-align: center;
}

/* ============================================================
   DASHBOARD — secciones export + local
   ============================================================ */
.dash-section-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
}
.dash-section-badge.export { background: #dce9f0; color: #365A6E; }
.dash-section-badge.local  { background: #e8f5e9; color: #2e7d32; }

/* ============================================================
   DASHBOARD HERO
   ============================================================ */
.dashboard-hero {
  position: relative;
  height: 200px;
  background: url('../img/hero-bg.jpg') center/cover no-repeat;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.dashboard-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(47,44,43,0.65), rgba(47,44,43,0.82));
}
.dashboard-hero img {
  position: relative;
  height: 90px;
  filter: brightness(0) invert(1);
}
.dashboard-hero .hero-sub {
  position: relative;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  margin-top: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 500;
}

/* ============================================================
   SVG ICONS — dashboard cards
   ============================================================ */
.dash-card-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dash-card-icon svg {
  width: 28px;
  height: 28px;
  stroke: var(--carbon);
  stroke-width: 1.5;
  fill: none;
}
.dash-card:hover .dash-card-icon svg {
  stroke: var(--accent);
}

/* ============================================================
   CHECKLIST DE COMPLETITUD
   ============================================================ */
.checklist-section {
  padding: 12px 20px;
  border-bottom: 1px solid var(--gray-100);
}
.checklist-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.checklist-counter {
  font-size: 12px;
  font-weight: 700;
  background: var(--gray-100);
  padding: 3px 10px;
  border-radius: 20px;
  margin-right: 4px;
}
.checklist-item {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.checklist-item.ok { background: #e8f5e9; color: #2e7d32; }
.checklist-item.pending { background: #fff8e1; color: #f57c00; }

/* Ítems obligatorios — borde accent, nombre readonly */
.cost-item.mandatory-item {
  border-left: 3px solid var(--accent);
}
.cost-item.mandatory-item .item-name input[readonly] {
  background: var(--gray-50);
  color: var(--gray-700);
  font-weight: 500;
}

/* ============================================================
   YIELD DEVIATION WARNING
   ============================================================ */
.yield-warning {
  color: #e65100;
  font-size: 11px;
  background: #fff3e0;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

/* ============================================================
   QUOTE PHOTO GALLERY
   ============================================================ */
.quote-photo-gallery {
  display: flex;
  gap: 8px;
  padding: 10px 0;
  flex-wrap: wrap;
  align-items: center;
  background: var(--gray-50);
  border-radius: 8px;
  padding: 10px 12px;
}
.qpg-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  width: 100%;
  margin-bottom: 2px;
}
.qpg-item {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.6;
  transition: all 0.15s;
  flex-shrink: 0;
}
.qpg-item.selected, .qpg-item:hover {
  border-color: var(--accent);
  opacity: 1;
}
.qpg-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.qpg-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  border: 2px dashed var(--gray-300);
  opacity: 1;
  font-size: 24px;
  color: var(--gray-400);
}
.qpg-upload:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.qpg-upload.uploading {
  opacity: 0.5;
  pointer-events: none;
}

/* ============================================================
   COST ADMIN TABLE (grouped)
   ============================================================ */
.cost-admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
}
.cost-admin-table th {
  background: var(--gray-50);
  padding: 8px 10px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.cost-admin-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.cost-admin-table .cat-group-header {
  cursor: pointer;
  user-select: none;
}
.cost-admin-table .cat-group-header td {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 10px 12px;
}
.cost-admin-table .cat-group-header:hover td {
  background: var(--gray-200);
}
.cost-admin-table .cat-item-row:hover td {
  background: var(--gray-50);
}
.cost-admin-table .cti-name { font-weight: 500; }
.cost-admin-table .cti-val { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.cost-admin-table .cti-notes { font-size: 11px; color: var(--gray-500); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cost-admin-table .cti-date { font-size: 11px; color: var(--gray-500); white-space: nowrap; }

/* ============================================================
   RESPONSIVE — Tablet
   ============================================================ */
@media (max-width: 768px) {
  .quote-layout { flex-direction: column; height: auto; overflow: visible; }
  .quote-panel { width: 100%; min-width: 0; border-right: none; border-bottom: 1px solid var(--gray-200); }
  .quote-layers { padding: 16px; }
  .dash-cards { grid-template-columns: 1fr; }
  .cost-item { grid-template-columns: 1fr; }
  .cost-items-header { display: none; }
  .nav-dropdown-menu { position: static; box-shadow: none; background: rgba(255,255,255,0.08); margin-top: 0; }
  .nav-dropdown-menu a { color: rgba(255,255,255,0.7); }
  .nav-dropdown-menu a:hover { background: rgba(255,255,255,0.12); }
}

/* ============================================================
   RESPONSIVE — Mobile
   ============================================================ */
@media (max-width: 640px) {
  /* --- NAV: hamburger toggle --- */
  .topnav {
    height: auto;
    min-height: 52px;
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
  }
  .topnav .nav-logo { height: 36px; }
  .topnav .nav-title { font-size: 12px; }
  .topnav .nav-links {
    order: 10;
    width: 100%;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: 0;
    display: none;
    height: auto;
  }
  .topnav.nav-open .nav-links { display: flex; }
  .topnav .nav-links a { font-size: 12px; padding: 6px 10px; }
  .topnav .nav-right { gap: 8px; }
  .topnav .nav-user { display: none; }
  .topnav .nav-version { display: none; }
  .topnav .btn-logout { font-size: 11px; padding: 4px 10px; }
  .nav-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 4px;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    font-family: var(--font);
    margin-left: auto;
    order: 5;
  }
  .nav-hamburger:hover { border-color: rgba(255,255,255,0.5); }

  /* Dropdowns en mobile: inline */
  .nav-dropdown-menu { position: static; box-shadow: none; background: rgba(255,255,255,0.08); margin-top: 0; padding: 2px 0; }
  .nav-dropdown-menu::before { display: none; }
  .nav-dropdown:hover .nav-dropdown-menu { display: none; }
  .nav-dropdown.open .nav-dropdown-menu { display: block; }
  .nav-dropdown-label { font-size: 12px; padding: 6px 10px; }

  /* --- DASHBOARD --- */
  .dashboard-hero { height: 120px; }
  .dashboard-hero img { height: 50px; }
  .dashboard-hero .hero-sub { font-size: 11px; margin-top: 6px; }
  .dashboard-page { padding: 16px; }
  .dashboard-page h1 { font-size: 18px; }
  .dash-section-title { font-size: 13px; flex-wrap: wrap; gap: 6px; }
  .dash-section-title a { font-size: 12px; }

  /* --- TABLAS: scroll horizontal --- */
  #recent-quotes-export,
  #recent-quotes-local,
  #table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .quotes-table { min-width: 580px; font-size: 12px; }
  .quotes-table th { padding: 8px 8px; font-size: 10px; }
  .quotes-table td { padding: 8px; font-size: 12px; }

  /* --- HISTORY --- */
  .history-page { padding: 16px; }
  .history-page h1 { font-size: 18px; }
  .history-filters { gap: 6px; }
  .history-filters input,
  .history-filters select { font-size: 12px; padding: 6px 10px; min-width: 0; flex: 1; }
  .history-filters input[type="text"] { min-width: 0; }

  /* --- MODAL --- */
  .modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 32px);
    border-radius: 10px;
  }
  .modal-header { padding: 14px 16px 12px; }
  .modal-header h2 { font-size: 15px; }
  .modal-body { padding: 16px; }
  .modal-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .modal-footer > div {
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }
  .modal-footer .btn-secondary,
  .modal-footer .btn-primary {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    padding: 8px 6px;
    text-align: center;
  }
  .detail-grid { grid-template-columns: 1fr; gap: 8px; }

  /* --- LOGIN --- */
  .login-card { width: calc(100vw - 32px); padding: 28px 24px; }

  /* --- QUOTE EDITOR (read-only view) --- */
  .print-grid { grid-template-columns: 1fr 1fr; }

  /* --- Hamburger touch target --- */
  .nav-hamburger { width: 44px; height: 44px; font-size: 20px; }
}

/* ============================================================
   BRAND TYPOGRAPHY — Playfair Display for headings
   ============================================================ */
.dashboard-page h1,
.history-page h1,
.panel-header h2,
.dash-card-title,
.admin-page h1,
.pdf-product-name { font-family: var(--font-heading); }

/* ============================================================
   TOAST SYSTEM
   ============================================================ */
.toast {
  position: fixed; bottom: var(--space-lg); right: var(--space-lg); z-index: 9999;
  padding: 12px 20px; border-radius: 8px; font-size: 13px; font-family: var(--font);
  color: #fff; box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  animation: toastIn 0.25s ease;
  max-width: 420px;
}
.toast.toast-success { background: var(--success); }
.toast.toast-error { background: var(--error); }
.toast.toast-info { background: var(--carbon); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   FORM VALIDATION STATES
   ============================================================ */
.field-error input,
.field-error select,
.field-error textarea { border-color: var(--error) !important; background: var(--error-bg); }
.error-msg { color: var(--error); font-size: 11px; margin-top: 2px; }
input:disabled, select:disabled, textarea:disabled {
  background: var(--gray-100); color: var(--gray-500); cursor: not-allowed; border-color: var(--gray-200);
}

/* ============================================================
   FOCUS & ACCESSIBILITY
   ============================================================ */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(47,44,43,0.15);
}

/* ============================================================
   STATUS BADGES — improved contrast
   ============================================================ */
.status-badge.draft { background: #fef3e2; color: #7d4700; }

/* ============================================================
   EMPTY STATES — styled
   ============================================================ */
.empty-state {
  text-align: center; padding: var(--space-xl) var(--space-md);
  color: var(--gray-500); font-size: 13px;
}
.empty-state .empty-icon { font-size: 32px; margin-bottom: var(--space-sm); opacity: 0.6; }
.empty-state .empty-title { font-size: 14px; font-weight: 600; color: var(--gray-700); margin-bottom: var(--space-xs); }
.empty-state .empty-sub { margin-bottom: var(--space-md); }
.empty-state .btn-primary { display: inline-block; text-decoration: none; }

/* ============================================================
   LOADING SKELETON
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 4px;
  height: 16px; margin-bottom: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ============================================================
   CONFIRM DIALOG
   ============================================================ */
.confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease;
}
.confirm-dialog {
  background: #fff; border-radius: 12px; padding: var(--space-xl); max-width: 380px; width: 90%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}
.confirm-dialog h3 { font-size: 16px; font-weight: 600; margin-bottom: var(--space-sm); }
.confirm-dialog p { font-size: 13px; color: var(--gray-500); margin-bottom: var(--space-lg); line-height: 1.5; }
.confirm-dialog .confirm-actions { display: flex; gap: var(--space-sm); justify-content: flex-end; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================
   STICKY TABLE HEADERS
   ============================================================ */
.quotes-table thead th {
  position: sticky; top: 0; z-index: 5; background: var(--gray-50);
}

/* ============================================================
   TEXT OVERFLOW for table cells
   ============================================================ */
.quotes-table td { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quotes-table td.num { max-width: none; overflow: visible; }

/* ============================================================
   RESPONSIVE — Tablet intermediate (768-1200px)
   ============================================================ */
@media (max-width: 1200px) and (min-width: 901px) {
  .quote-layout { --panel-w: 340px; }
}
@media (max-width: 900px) and (min-width: 769px) {
  .quote-layout { --panel-w: 300px; }
}
