/* ─── Avi Home — Optimizador de Cortes ─────────────────────────────────────── */

:root {
  --green:       #42AA57;
  --green-deep:  #2D7A3E;
  --green-light: #A8D5B0;
  --black:       #1A1A1A;
  --cream:       #F5F5F0;
  --white:       #FFFFFF;
  --wood:        #D4A574;
  --gray:        #888;
  --gray-light:  #BBBBB6;
  --border:      #E0E0DB;
  --row-hover:   rgba(66,170,87,0.04);
}

/* ─── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Josefin Sans', sans-serif;
  background: var(--cream);
  color: var(--black);
  display: flex;
  flex-direction: column;
  font-size: 13px;
}

/* ─── Header ─────────────────────────────────────────────────────────────────── */
header {
  background: var(--black);
  height: 52px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 2px solid var(--green);
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-wordmark {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1.5px;
  line-height: 1;
}
.logo-wordmark .avi  { color: var(--green); }
.logo-wordmark .home { color: var(--white); }

.logo-sep {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,0.18);
}

.logo-sub {
  color: #AAAAAA;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  line-height: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}


/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border: none;
  border-radius: 4px;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--green-deep); }

.btn-ghost {
  background: transparent;
  color: rgba(255,255,255,0.65);
  border: 1px solid rgba(255,255,255,0.2);
}
.btn-ghost:hover { color: #fff; border-color: rgba(255,255,255,0.45); }

.btn-outline {
  background: transparent;
  color: var(--green);
  border: 1px solid var(--green);
  padding: 6px 14px;
}
.btn-outline:hover { background: rgba(66,170,87,0.07); }

.btn-add {
  width: 100%;
  padding: 8px;
  background: none;
  border: 1.5px dashed var(--green-light);
  color: var(--green);
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
}
.btn-add:hover { background: rgba(66,170,87,0.06); border-color: var(--green); }

.btn-delete {
  background: none;
  border: none;
  color: var(--gray-light);
  font-size: 15px;
  cursor: pointer;
  padding: 2px 7px;
  border-radius: 3px;
  line-height: 1;
  transition: all 0.15s;
}
.btn-delete:hover { color: #E53935; background: rgba(229,57,53,0.09); }

.btn-nav {
  width: 26px;
  height: 26px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  color: var(--black);
}
.btn-nav:hover:not(:disabled) { background: var(--cream); }
.btn-nav:disabled { opacity: 0.35; cursor: not-allowed; }

/* ─── Main layout ────────────────────────────────────────────────────────────── */
main {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* ─── Left panel ─────────────────────────────────────────────────────────────── */
.left-panel {
  width: 470px;
  min-width: 340px;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 0;
}

/* ─── Tabs ───────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  padding: 11px 6px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--gray);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover   { color: var(--black); }
.tab-btn.active  { color: var(--green); border-bottom-color: var(--green); }

.tab-content { display: none; flex: 1; flex-direction: column; min-height: 0; }
.tab-content.active { display: flex; }

/* ─── Scrollable inner ───────────────────────────────────────────────────────── */
.panel-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.panel-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.piece-count {
  font-size: 10px;
  color: var(--gray);
  letter-spacing: 0.4px;
  flex-shrink: 0;
}

/* ─── Data tables ────────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--white);
  padding: 7px 6px 6px;
  text-align: left;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--gray);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 2px 3px;
  border-bottom: 1px solid #F3F3EF;
  vertical-align: middle;
}

.data-table tr:hover td { background: var(--row-hover); }
.data-table tr.row-disabled td { opacity: 0.45; }

.data-table input[type="text"],
.data-table input[type="number"] {
  width: 100%;
  border: 1px solid transparent;
  padding: 5px 6px;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 12px;
  background: transparent;
  border-radius: 3px;
  color: var(--black);
  transition: border-color 0.12s, background 0.12s;
}

.data-table input[type="number"] { text-align: right; }

.data-table input:focus {
  outline: none;
  border-color: var(--green);
  background: rgba(66,170,87,0.04);
}

.data-table select {
  width: 100%;
  border: 1px solid transparent;
  padding: 5px 4px;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  background: transparent;
  border-radius: 3px;
  color: var(--black);
  cursor: pointer;
  transition: border-color 0.12s;
}
.data-table select:focus { outline: none; border-color: var(--green); }

.data-table input[type="checkbox"] {
  width: 13px;
  height: 13px;
  accent-color: var(--green);
  cursor: pointer;
}

.label-cell {
  display: flex;
  align-items: center;
  gap: 5px;
}

.color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #ccc;
  transition: background 0.3s;
}

/* Column widths */
.col-chk   { width: 22px; text-align: center; }
.col-label { min-width: 80px; }
.col-num   { width: 62px; }
.col-qty   { width: 48px; }
.col-grain { width: 82px; }
.col-canto { width: 48px; text-align: center; }
.col-del   { width: 28px; text-align: center; }
.col-board { min-width: 140px; }

/* ─── Canto (edge banding) selector ─────────────────────────────────────────── */
.canto-box {
  display: inline-block;
  position: relative;
  width: 30px;
  height: 24px;
  margin: auto;
}

.cb {
  position: absolute;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.12s;
}

/* Top & Bottom bars */
.cb-t, .cb-b {
  height: 5px;
  left: 6px;
  right: 6px;
}
.cb-t { top: 0; }
.cb-b { bottom: 0; }

/* Left & Right bars */
.cb-l, .cb-r {
  width: 5px;
  top: 6px;
  bottom: 6px;
}
.cb-l { left: 0; }
.cb-r { right: 0; }

.cb.duro         { background: #E67E22; }
.cb.pvc          { background: #1B5E9E; }
.cb:hover        { background: var(--green-light); }
.cb.duro:hover   { background: #CA6F1E; }
.cb.pvc:hover    { background: #154680; }
.canto-box       { cursor: pointer; }

/* ─── Options panel ──────────────────────────────────────────────────────────── */
.options-inner {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.opt-group { display: flex; flex-direction: column; gap: 7px; }

.opt-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--gray);
}

.opt-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.opt-input {
  width: 78px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 14px;
  color: var(--black);
  text-align: right;
  transition: border-color 0.12s;
}
.opt-input:focus { outline: none; border-color: var(--green); }
.opt-input[readonly] { background: var(--cream); color: var(--black); cursor: default; }

.opt-unit { font-size: 12px; color: var(--gray); }

.opt-fixed {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--white);
  background: var(--gray-light);
  border-radius: 3px;
  padding: 1px 5px;
  vertical-align: middle;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.toggle-info .toggle-title { font-size: 13px; font-weight: 600; }
.toggle-info .toggle-desc  { font-size: 11px; color: var(--gray); margin-top: 3px; }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-track::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 3px;
  left: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.2s;
}
.toggle input:checked + .toggle-track { background: var(--green); }
.toggle input:checked + .toggle-track::before { transform: translateX(16px); }

/* ─── Right panel ────────────────────────────────────────────────────────────── */
.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

/* ─── Canvas toolbar ─────────────────────────────────────────────────────────── */
.canvas-toolbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 7px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  min-height: 42px;
}

.sheet-nav {
  display: none;
  align-items: center;
  gap: 6px;
}

.sheet-counter {
  font-size: 11px;
  color: var(--gray);
  font-weight: 600;
  white-space: nowrap;
}

.sheet-material-name {
  font-size: 10px;
  color: var(--gray-light);
  font-weight: 400;
  white-space: nowrap;
  padding-left: 8px;
  border-left: 1px solid var(--border);
  margin-left: 2px;
}
.sheet-material-name:empty { display: none; }

.sheet-stats {
  display: flex;
  gap: 18px;
  margin-left: auto;
}

.sheet-stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--gray);
}
.sheet-stat-item strong { color: var(--black); font-weight: 700; }
.sheet-stat-item strong.green { color: var(--green); }

/* ─── Section strip labels ───────────────────────────────────────────────────── */
.section-strip {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 4px 16px 3px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--gray-light);
  flex-shrink: 0;
}

.section-strip--footer {
  border-top: 1px solid var(--border);
  border-bottom: none;
}

/* ─── Metrics cards ──────────────────────────────────────────────────────────── */
.sheet-metrics-cards {
  display: flex;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.metric-card {
  flex: 1;
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-right: 1px solid var(--border);
}
.metric-card:last-child { border-right: none; }

.metric-card-lbl {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--gray);
}

.metric-card-val {
  font-size: 26px;
  font-weight: 700;
  color: var(--black);
  line-height: 1;
}

.metric-card--green .metric-card-val { color: var(--green); }

/* ─── Modal: Óptimo teórico ──────────────────────────────────────────────────── */
.qs-modal-box {
  width: 360px;
  text-align: center;
  padding: 0;
}

.qs-modal-icon {
  font-size: 36px;
  font-weight: 700;
  color: var(--white);
  background: var(--green);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 36px auto 24px;
  line-height: 1;
  padding-bottom: 4px;
}

.qs-modal-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: #1B5E20;
  margin-bottom: 10px;
  padding: 0 32px;
  line-height: 1.3;
}

.qs-modal-detail {
  font-size: 12px;
  color: var(--gray);
  padding: 0 32px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.qs-modal-info {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 24px 28px;
  background: #E8F5E9;
  border: 1px solid #A5D6A7;
  border-radius: 6px;
  padding: 13px 16px;
  text-align: left;
  font-size: 11px;
  color: #2E7D32;
  line-height: 1.65;
}

.qs-info-icon {
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 1px;
  line-height: 1;
}

.qs-modal-footer {
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  justify-content: center;
}

.qs-accept-btn {
  min-width: 140px;
  justify-content: center;
}

/* ─── Canvas area ────────────────────────────────────────────────────────────── */
.canvas-area {
  flex: 1;
  display: flex;
  flex-direction: row;   /* canvas izq + cuts-panel der */
  min-height: 0;
  min-width: 0;
}

.canvas-wrapper {
  flex: 1;
  min-height: 0;
  min-width: 0;          /* permite encoger en flex-row */
  position: relative;
  display: flex;
}

/* Placeholder */
.results-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--gray);
  z-index: 2;
  background: var(--cream);
}

.results-placeholder svg { opacity: 0.18; }

.results-placeholder p {
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
  color: var(--gray);
}

.results-placeholder p strong { color: var(--black); }

/* Results */
.results-content {
  flex: 1;
  display: none;
  min-height: 0;
}

#cut-svg {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

/* ─── SVG piezas — hover e interacción (Fase B) ─────────────────────────────── */
.svg-piece-group {
  cursor: pointer;
}

.svg-piece-group rect {
  transition: filter 0.12s ease;
}

/* Hover nativo CSS (cuando el mouse pasa sobre la pieza) */
.svg-piece-group:hover rect:first-child {
  filter: brightness(1.14) drop-shadow(0 0 5px rgba(66,170,87,0.50));
}

/* Highlight explícito: desde la lista de cortes o mousemove */
.svg-piece-group.piece-hl rect:first-child {
  filter: brightness(1.14) drop-shadow(0 0 5px rgba(229,57,53,0.45));
}

/* ─── Unfit pieces ───────────────────────────────────────────────────────────── */
.unfit-container {
  display: none;
  background: #FFF8EE;
  border-top: 2px solid var(--wood);
  padding: 10px 16px;
  flex-shrink: 0;
}

.unfit-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #C05000;
  margin-bottom: 6px;
}

.unfit-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.unfit-list li {
  background: rgba(192,80,0,0.1);
  padding: 3px 9px;
  border-radius: 3px;
  font-size: 11px;
  color: #C05000;
}

/* ─── Stats bar ──────────────────────────────────────────────────────────────── */
.stats-bar {
  display: flex;
  background: var(--white);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.stat-block {
  flex: 1;
  padding: 10px 16px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-block:last-child { border-right: none; }

.stat-lbl {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--gray);
}

.stat-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--black);
  line-height: 1;
}
.stat-val.green { color: var(--green); }

/* ─── Footer ─────────────────────────────────────────────────────────────────── */
footer {
  background: var(--black);
  color: #AAAAAA;
  font-size: 10px;
  text-align: center;
  padding: 5px;
  letter-spacing: 0.6px;
  flex-shrink: 0;
}
footer .brand { color: var(--green); font-weight: 600; }

/* ─── Toast ──────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--black);
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  z-index: 999;
  transition: transform 0.25s ease;
  pointer-events: none;
}
.toast.show       { transform: translateX(-50%) translateY(0); }
.toast.toast-error   { background: #E53935; }
.toast.toast-success { background: var(--green); }

/* ─── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-light); }

/* ─── Leyenda tapacanto ──────────────────────────────────────────────────────── */
.canto-legend {
  position: absolute;
  left: 12px;
  top: 8px;
  flex-direction: column;
  gap: 8px;
  background: rgba(255,255,255,0.92);
  border: 1px solid #E0E0DA;
  border-radius: 6px;
  padding: 10px 12px;
  z-index: 5;
  pointer-events: none;
}
.canto-legend-item {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: #555;
  font-family: 'Josefin Sans', sans-serif;
  white-space: nowrap;
}
.canto-swatch {
  display: inline-block;
  width: 20px;
  height: 8px;
  border-radius: 2px;
  margin-right: 6px;
  flex-shrink: 0;
}
.canto-swatch.pvc  { background: #1B5E9E; }
.canto-swatch.duro { background: #E67E22; }

/* ─── Zoom mini-toolbar (Fase 2) ────────────────────────────────────────────── */
.zoom-toolbar {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 10;
  display: none;            /* shown via JS after calculate */
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  user-select: none;
}

.zoom-btn {
  width: 26px;
  height: 26px;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--black);
  transition: background 0.12s, color 0.12s;
  line-height: 1;
  font-family: 'Josefin Sans', sans-serif;
  flex-shrink: 0;
}
.zoom-btn:hover         { background: var(--cream); }
.zoom-btn.btn-locked    { color: var(--green); }

.zoom-level {
  font-size: 10px;
  font-weight: 700;
  color: var(--gray);
  min-width: 36px;
  text-align: center;
  font-family: 'Josefin Sans', sans-serif;
  letter-spacing: 0.3px;
}

.zoom-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 2px;
  flex-shrink: 0;
}


/* ─── Cuts sub-panel — panel derecho ────────────────────────────────────────── */
.cuts-panel {
  width: 300px;
  min-width: 200px;
  flex-shrink: 0;
  border-left: 2px solid var(--border);
  background: var(--white);
  display: none;            /* shown via JS after calculate */
  flex-direction: column;
  overflow: hidden;
}

.cuts-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px 4px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.cuts-panel-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--gray);
}

.cuts-panel-count {
  font-size: 10px;
  color: var(--green);
  font-weight: 700;
}

.cuts-panel-stale {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 1;
  font-size: 11px;
  color: var(--gray);
  font-style: italic;
  padding: 0 16px;
  text-align: center;
}

.cuts-panel-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* Column widths specific to cuts table */
.col-cut-num { width: 32px; text-align: center; color: var(--gray); font-variant-numeric: tabular-nums; }
.col-panel   { width: 90px; font-variant-numeric: tabular-nums; font-size: 11px; }
.col-cut-dir { width: 60px; font-variant-numeric: tabular-nums; }
.col-result  { }

.cut-axis        { color: var(--gray); font-weight: 700; }
.cut-result-ok   { color: var(--green); font-weight: 700; }
.cut-result-none { color: var(--gray-light); }
.cuts-empty      { text-align: center; color: var(--gray); font-style: italic; padding: 16px 0 !important; }

/* Highlighted row — applied via JS on both canvas-hover and table-hover */
#cuts-tbody tr.row-highlighted td {
  background: rgba(66, 170, 87, 0.13);
  transition: background 0.15s;
}

/* ─── Tooltip de pieza (Fase 1) ──────────────────────────────────────────────── */
.cut-tooltip {
  position: fixed;
  background: rgba(26, 26, 26, 0.93);
  color: #fff;
  border-radius: 5px;
  padding: 8px 12px;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  line-height: 1.7;
  pointer-events: none;
  z-index: 200;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.28);
  min-width: 150px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s;
}

.cut-tooltip.visible {
  opacity: 1;
  visibility: visible;
}

.ct-label {
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 1px;
  color: #fff;
}

.ct-dims {
  color: rgba(255, 255, 255, 0.72);
}

.ct-cut {
  color: var(--green-light);
  font-size: 10px;
  letter-spacing: 0.3px;
  margin-top: 3px;
}

.ct-mat {
  color: rgba(255, 255, 255, 0.45);
  font-size: 10px;
}

/* ─── Viz controls (Fase 3) ──────────────────────────────────────────────────── */
.viz-controls {
  display: none;
  align-items: center;
  gap: 3px;
  flex: 1;
}

.viz-toggle {
  padding: 0 8px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--gray);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.viz-toggle:hover  { border-color: var(--green-light); color: var(--black); }
.viz-toggle.active { background: var(--green); color: #fff; border-color: var(--green); }

.viz-sep-v {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 3px;
  flex-shrink: 0;
}

.viz-select {
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 6px;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--black);
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.12s;
}
.viz-select:focus { outline: none; border-color: var(--green); }

/* ─── Botón WhatsApp ─────────────────────────────────────────────────────────── */
.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 30px;
  border: none;
  border-radius: 4px;
  background: #25D366;
  color: #fff;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(37,211,102,0.35);
}
.btn-whatsapp:hover:not(:disabled) { background: #1DA853; box-shadow: 0 3px 10px rgba(37,211,102,0.45); }
.btn-whatsapp:disabled { opacity: 0.40; cursor: not-allowed; box-shadow: none; }

/* ─── Modal Tapacantos ───────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s, visibility 0.18s;
}
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: var(--white);
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
  width: 460px;
  max-width: calc(100vw - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.modal-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--black);
}

.modal-piece-name {
  font-size: 11px;
  color: var(--gray);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.modal-body {
  padding: 10px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.canto-modal-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.canto-modal-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.canto-side-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--black);
}

.canto-side-dim {
  font-size: 10px;
  color: var(--gray);
  letter-spacing: 0.3px;
}

.canto-select {
  flex-shrink: 0;
  width: 120px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 8px;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 12px;
  color: var(--black);
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.12s, opacity 0.15s;
}
.canto-select:focus { outline: none; border-color: var(--green); }
.canto-select:disabled { opacity: 0.38; cursor: not-allowed; background: var(--cream); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 10px 18px 14px;
  border-top: 1px solid var(--border);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--gray-light);
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1;
  transition: color 0.12s, background 0.12s;
  flex-shrink: 0;
}
.modal-close:hover { color: var(--black); background: var(--cream); }

/* ─── Modal Cotizar ──────────────────────────────────────────────────────────── */
.cotizar-box { max-width: 440px; }

.cotizar-body {
  padding: 20px 20px 16px;
  gap: 14px;
}

.cotizar-subtitle {
  font-size: 12px;
  color: var(--gray);
  line-height: 1.55;
  margin: 0;
}

.cotizar-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cotizar-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: -2px;
}

.cotizar-input {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 13px;
  color: var(--black);
  background: var(--white);
  transition: border-color 0.12s;
}
.cotizar-input:focus { outline: none; border-color: var(--green); }
.cotizar-input.error { border-color: #E53935; background: rgba(229,57,53,0.03); }

.cotizar-banner {
  background: #FFFBEC;
  border: 1px solid #FFD54F;
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 11px;
  color: #7B5700;
  line-height: 1.6;
}

.cotizar-footer { gap: 10px; }

.cotizar-submit {
  background: #25D366;
  color: #fff;
  border: none;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 18px;
}
.cotizar-submit:hover { background: #1DA853; }

/* ─── Excel Import Bar ───────────────────────────────────────────────────────── */
.excel-import-bar {
  background: var(--cream);
  border-left: 3px solid var(--green);
  border-radius: 0 4px 4px 0;
  padding: 7px 12px;
  margin: 10px 12px 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.excel-import-hint {
  font-size: 11px;
  color: #555;
  white-space: nowrap;
  margin-right: 2px;
}

.btn-excel {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  line-height: 1;
}

.btn-excel-dl {
  background: var(--white);
  border: 1.5px solid var(--green);
  color: var(--green);
}
.btn-excel-dl:hover {
  background: rgba(66,170,87,0.08);
}

.btn-excel-import {
  background: var(--green);
  border: 1.5px solid var(--green);
  color: var(--white);
}
.btn-excel-import:hover {
  background: var(--green-deep);
  border-color: var(--green-deep);
}
