/* Ventas: pipeline + captura. Layout de reporte_incidencias (folder tabs + tarjetas)
   y formulario con la estructura de Captura de reporte_servicio. */

.page-ventas {
  --vn-sec-bg: color-mix(in srgb, var(--panel) 55%, var(--bg-0));
  --vn-field-bg: var(--bg-0);
  --vn-head-bg: color-mix(in srgb, var(--panel) 70%, var(--bg-0));
  --vn-hover: rgba(255, 255, 255, 0.04);
  --vn-hover-bd: color-mix(in srgb, var(--fg-1) 22%, var(--line));
  --vn-selected-bg: rgba(255, 255, 255, 0.07);
  --vn-selected-bd: color-mix(in srgb, var(--fg-1) 40%, var(--line));
  --vn-warn-fg: color-mix(in srgb, #d97706 80%, white);
  --vn-warn-bg: color-mix(in srgb, #d97706 14%, var(--panel));
  --vn-warn-bd: color-mix(in srgb, #d97706 42%, var(--line));
  --vn-neutral-bg: color-mix(in srgb, var(--fg-1) 6%, var(--panel));
  --vn-neutral-bd: color-mix(in srgb, var(--fg-1) 18%, var(--line));
  --vn-req: #e11d48;

  margin: 0;
  min-height: 100dvh;
  background: var(--bg-0);
  color: var(--fg-1);
  font: 14px/1.45 "Montserrat", "Roboto", sans-serif;
  color-scheme: dark;
}

:root[data-theme="light"] .page-ventas {
  --vn-sec-bg: #f8fafc;
  --vn-field-bg: #ffffff;
  --vn-head-bg: #f5f7fb;
  --vn-hover: #f5f7fb;
  --vn-selected-bg: #eef2f8;
  --vn-warn-fg: #b45309;
  --vn-warn-bg: #fffbeb;
  --vn-warn-bd: #fde68a;
  --vn-neutral-bg: #f3f4f6;
  --vn-neutral-bd: #d1d5db;
  --ok-fg: #15803d;
  --ok-bg: #f0fdf4;
  --ok-bd: #bbf7d0;
  --err-fg: #b91c1c;
  --err-bg: #fef2f2;
  --err-bd: #fecaca;
  color-scheme: light;
}

.page-ventas *,
.page-ventas *::before,
.page-ventas *::after {
  box-sizing: border-box;
}

.page-ventas button,
.page-ventas input,
.page-ventas select,
.page-ventas textarea {
  font: inherit;
  color: inherit;
}

.page-ventas [hidden] {
  display: none !important;
}

.vn-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.vn-wrap {
  max-width: 2000px;
  margin: 0 auto;
  padding: 0 0 24px;
}

/* =========================
   Header: new record action
   ========================= */
.page-ventas header.app-header.hdr-controls > .page-title {
  display: none !important;
}

.page-ventas {
  --seg-folder-surface: var(--panel);
}

.page-ventas header.app-header.hdr-controls.vn-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 12px;
  min-width: 0;
  width: auto;
  margin: 0 16px;
  padding: 8px 0 0;
  background: var(--bg-0) !important;
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}

.vn-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 12px;
  min-width: 0;
  margin-left: auto;
  padding-bottom: 8px;
}

.page-ventas header.hdr-controls .vn-tabs > .tab {
  font-size: 14px;
  font-weight: 700;
}

.vn-panel > .vn-card:first-child {
  border-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* Currency view (same control as almacen) */
.vn-money-ctl {
  display: inline-flex;
  align-items: stretch;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
}

.vn-cur-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
}

/* header_controls.css forces bg/color/border with !important on every header button */
header.hdr-controls .vn-money-ctl button {
  height: auto;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  color: var(--fg-2) !important;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: background-color .15s ease, color .15s ease;
}

header.hdr-controls .vn-money-ctl .vn-cur-toggle button {
  padding: 0 10px;
  border: 1px solid transparent !important;
  border-radius: 7px;
}

header.hdr-controls .vn-money-ctl .vn-cur-toggle button[aria-pressed="true"] {
  border-color: var(--vn-selected-bd) !important;
  background: var(--vn-selected-bg) !important;
  color: var(--fg-1) !important;
}

header.hdr-controls .vn-money-ctl .vn-fx-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border-left: 1px solid var(--line) !important;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.vn-fx-btn .ui-icon {
  width: 12px;
  height: 12px;
  opacity: .8;
}

/* Month picker: shared .month-picker markup (header_controls.css), same geometry as solicitudes */
header.app-header.hdr-controls .vn-month {
  display: flex;
  width: auto;
}

header.app-header.hdr-controls .vn-month[hidden] {
  display: none;
}

header.app-header.hdr-controls .vn-month > button:not(.month-picker-trigger) {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  box-shadow: none;
}

header.app-header.hdr-controls .vn-month .month-picker-trigger {
  width: auto;
  min-width: 132px;
  height: 36px;
  min-height: 36px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
}

header.app-header.hdr-controls .vn-month .month-picker-trigger strong {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
}

header.app-header.hdr-controls .vn-month .month-picker-popover {
  left: 0;
  right: auto;
  transform: none;
  width: min(400px, calc(100vw - 24px));
  box-sizing: border-box;
  grid-template-columns: minmax(max-content, 1.5fr) minmax(6rem, .7fr) auto;
  box-shadow: none;
  letter-spacing: 0;
}

header.app-header.hdr-controls .vn-month .month-picker-field select {
  width: 100%;
  min-width: 0;
}

header.app-header.hdr-controls .vn-month .month-picker-apply {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  box-shadow: none;
}

header.hdr-controls .vn-money-ctl .vn-cur-toggle button[aria-pressed="false"]:hover,
header.hdr-controls .vn-money-ctl .vn-fx-btn:not(:disabled):hover {
  background: var(--vn-hover) !important;
}

header.hdr-controls .vn-money-ctl button:active {
  transform: none;
}

header.hdr-controls .vn-money-ctl button:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--hc-focus);
}

header.hdr-controls .vn-money-ctl .vn-fx-btn.is-warn {
  background: var(--vn-warn-bg) !important;
  color: var(--vn-warn-fg) !important;
}

.vn-fx-btn.is-busy .ui-icon {
  animation: vn-fx-spin .8s linear infinite;
}

@keyframes vn-fx-spin {
  to { transform: rotate(360deg); }
}

.vn-money-val {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
}

.vn-money-orig {
  color: var(--fg-2);
  font-size: 11px;
  font-weight: 500;
}

td.num .vn-money-val {
  align-items: flex-end;
}

@media (max-width: 680px) {
  .vn-fx-btn [data-fx-label] {
    display: none;
  }
}

/* =========================
   Cards
   ========================= */
.vn-card {
  margin: 0 16px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.vn-filterbar {
  overflow: visible;
}

.vn-forbidden {
  margin-top: 16px;
}

/* =========================
   Buttons
   ========================= */
.vn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}

.vn-btn:hover {
  background: var(--btn-hover);
}

.vn-btn svg, .vn-btn .ui-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.vn-btn.ghost {
  background: transparent;
  color: var(--fg-1);
  border-color: var(--line);
}

.vn-btn.ghost:hover {
  background: var(--vn-hover);
  border-color: var(--vn-hover-bd);
}

.vn-btn.ghost[aria-expanded="true"] {
  background: var(--vn-selected-bg);
  border-color: var(--vn-selected-bd);
}

.vn-btn.accent {
  background: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 70%, #000);
  color: #111;
}

.vn-btn.accent:hover {
  background: color-mix(in srgb, var(--accent) 88%, #000);
}

.vn-btn:disabled {
  opacity: .6;
  cursor: default;
}

.vn-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-2);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.vn-icon-btn .ui-icon {
  width: 16px;
  height: 16px;
}

.vn-cm-del .ui-icon {
  width: 14px;
  height: 14px;
}

.vn-cm-ptile-x .ui-icon {
  width: 10px;
  height: 10px;
}

.vn-icon-btn:hover {
  background: var(--vn-hover);
  border-color: var(--vn-hover-bd);
  color: var(--fg-1);
}

.page-ventas .vn-btn:focus-visible,
.page-ventas .vn-icon-btn:focus-visible,
.page-ventas .vn-seg-btn:focus-visible,
.page-ventas .vn-view-btn:focus-visible {
  outline: 2px solid var(--hc-focus);
  outline-offset: 2px;
}

/* =========================
   Search bar + filters
   ========================= */
.vn-searchbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px;
}

.vn-searchbox {
  position: relative;
  flex: 1 1 280px;
  display: flex;
  align-items: center;
  min-width: 0;
}

.vn-searchbox svg, .vn-searchbox .ui-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--fg-2);
  pointer-events: none;
}

.vn-searchbox input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--vn-field-bg);
  color: var(--fg-1);
  outline: none;
}

.vn-searchbox input::placeholder,
.vn-input::placeholder,
.vn-area::placeholder {
  color: color-mix(in srgb, var(--fg-2) 80%, transparent);
}

.vn-searchbox input:focus,
.vn-input:focus,
.vn-select:focus,
.vn-area:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
  outline: none;
}

.vn-seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--vn-field-bg);
  scrollbar-width: none;
}

.vn-seg::-webkit-scrollbar {
  display: none;
}

.vn-seg-btn {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-2);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.vn-seg-btn:hover:not(.is-active) {
  background: var(--panel);
  color: var(--fg-1);
}

.vn-seg-btn.is-active {
  background: var(--panel);
  border-color: var(--vn-selected-bd);
  color: var(--fg-1);
}

.vn-seg-btn.is-neg.is-active {
  background: var(--vn-warn-bg);
  border-color: var(--vn-warn-bd);
  color: var(--vn-warn-fg);
}

.vn-seg-btn.is-won.is-active {
  background: var(--ok-bg);
  border-color: var(--ok-bd);
  color: var(--ok-fg);
}

.vn-seg-btn.is-lost.is-active {
  background: var(--err-bg);
  border-color: var(--err-bd);
  color: var(--err-fg);
}

.vn-searchbar-actions {
  display: flex;
  gap: 8px;
}

.vn-searchbar-actions .vn-btn {
  height: 40px;
}

.vn-filters-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--accent);
  color: #111;
  font-size: 11px;
  font-weight: 800;
}

.vn-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

/* =========================
   Fields
   ========================= */
.vn-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.vn-field label,
.vn-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-1);
}

.vn-filters .vn-field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-2);
}

.req {
  color: var(--vn-req);
  font-weight: 700;
}

.vn-input,
.vn-select,
.vn-area {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--vn-field-bg);
  color: var(--fg-1);
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease, background-color .15s ease;
}

.vn-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  cursor: pointer;
}

.vn-select-wrap {
  position: relative;
}

.vn-select-wrap .vn-select {
  width: 100%;
}

.vn-select-chev {
  position: absolute;
  top: 50%;
  right: 13px;
  width: 12px;
  height: 12px;
  color: var(--fg-2);
  transform: translateY(-50%);
  pointer-events: none;
}

.vn-area {
  min-height: 88px;
  resize: vertical;
  line-height: 1.5;
}

.vn-input.is-invalid,
.vn-area.is-invalid {
  border-color: var(--err-bd);
  background: var(--err-bg);
}

.vn-error {
  margin: 0;
  color: var(--err-fg);
  font-size: 12px;
  font-weight: 600;
}

.vn-money {
  position: relative;
  display: flex;
  align-items: center;
}

.vn-amount-cur {
  position: absolute;
  z-index: 1;
  top: 4px;
  bottom: 4px;
  left: 4px;
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: var(--vn-sec-bg);
}

.vn-amount-cur button {
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--fg-2);
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .03em;
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease;
}

.vn-amount-cur button[aria-pressed="true"] {
  border-color: var(--line);
  background: var(--panel);
  color: var(--fg-1);
}

.vn-amount-cur button[aria-pressed="false"]:not(:disabled):hover {
  color: var(--fg-1);
}

.vn-amount-cur button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.vn-amount-cur button:focus-visible {
  outline: 2px solid var(--hc-focus);
  outline-offset: 1px;
}

.vn-money .vn-input {
  padding-left: 158px;
  font-variant-numeric: tabular-nums;
}

/* =========================
   KPIs (mismo look que almacen: .ti-kpi-row)
   ========================= */
.vn-picon {
  display: inline-block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  background-color: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat;
  mask: var(--ico) center / contain no-repeat;
}

.vn-picon--sm {
  width: 13px;
  height: 13px;
}

.kpi-row.vn-kpi-row {
  --grid: var(--line);
  --row-bg: color-mix(in srgb, var(--panel) 70%, var(--bg));
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 16px 12px;
}

:root[data-theme="light"] .kpi-row.vn-kpi-row {
  --grid: #d7dee8;
  --row-bg: #f5f7fb;
}

.vn-kpi-row > .kpi.vn-kpi,
.vn-kpi-row > .kpi.vn-kpi:hover {
  width: 100%;
  min-width: 0;
  color: var(--text);
  text-align: left;
  animation: none;
  transform: none;
  box-shadow: none;
}

.vn-kpi .kpi-ico {
  color: var(--text);
  opacity: .92;
}

.vn-kpi .kpi-body {
  display: flex;
  flex-direction: column;
}

.vn-kpi .kpi-label,
.vn-kpi .kpi-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vn-kpi .kpi-value {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.vn-kpi .kpi-value .vn-sk {
  width: 48px;
  height: 16px;
  margin: 2px 0 1px;
}

.vn-kpi .kpi-sub .vn-sk {
  width: 80px;
  height: 10px;
  margin-top: 3px;
}

/* =========================
   Dashboard: summary by customer
   ========================= */
.vn-dash-table {
  min-width: 820px;
}

.vn-dash-table .vn-dash-client {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 180px;
  text-align: left;
}

.vn-dash-table th.vn-dash-client {
  z-index: 3;
}

.vn-dash-table tfoot td.vn-dash-client {
  z-index: 2;
}

@media (max-width: 720px) {
  .vn-dash-table .vn-dash-client {
    min-width: 150px;
  }
}

.vn-th-stage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.vn-dash-table td.vn-dash-n {
  width: 1%;
  min-width: 96px;
  padding: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.vn-dash-table td.vn-dash-n.is-zero {
  padding: 8px 10px;
  color: var(--fg-2);
  font-weight: 500;
  opacity: .55;
}

.vn-dash-link {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: right;
  cursor: pointer;
}

.vn-dash-link:hover {
  background: var(--vj-row-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.vn-dash-link:focus-visible {
  outline: 2px solid var(--hc-focus);
  outline-offset: -2px;
}

.vn-dash-n.is-neg:not(.is-zero) { color: var(--vn-warn-fg); }
.vn-dash-n.is-won:not(.is-zero) { color: var(--ok-fg); }
.vn-dash-n.is-lost:not(.is-zero) { color: var(--err-fg); }

.vn-dash-table td.vn-dash-money {
  min-width: 120px;
}

.vn-dash-table td.vn-dash-money.is-zero {
  color: var(--fg-2);
  font-weight: 500;
}

.vn-dash-table tbody tr:hover td {
  background: var(--vj-row-hover);
}

.vn-dash-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 1;
  background: var(--vj-th-bg);
  border-color: var(--vj-border);
  border-style: solid;
  border-width: 1px 1px 0 0;
  font-weight: 800;
}

.vn-dash-table tfoot td:last-child {
  border-right-width: 0;
}

.vn-dash-table tfoot td.vn-dash-n {
  padding: 10px;
}

.vn-dash-table tfoot td.vn-dash-client {
  font-size: 11px;
  letter-spacing: .10em;
  text-transform: uppercase;
}

/* Opportunities by stage: one chip per stage in each row (dot + stage name + count) */
.vn-table.vn-dash-table th.vn-dash-stages {
  padding: 8px 10px;
}

.vn-dash-stages-hint {
  margin-left: 4px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.vn-dash-table td.vn-dash-stages {
  min-width: 280px;
}

.vn-stage-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.vn-stage-chips .vn-stage-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border: 1px solid var(--vn-neutral-bd);
  border-radius: 6px;
  background: var(--vn-neutral-bg);
  color: var(--fg-1);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}

.vn-stage-chip .vn-legend-dot {
  width: 7px;
  height: 7px;
}

button.vn-stage-chip {
  cursor: pointer;
}

button.vn-stage-chip:hover {
  border-color: var(--vn-hover-bd);
  background: var(--vn-hover);
}

button.vn-stage-chip:focus-visible {
  outline: 2px solid var(--hc-focus);
  outline-offset: 1px;
}

.vn-stage-chip-label {
  color: var(--fg-2);
}

.vn-stage-chip-n {
  font-variant-numeric: tabular-nums;
}

.vn-dash-table tfoot .vn-stage-chips .vn-stage-chip {
  font-weight: 600;
}

.vn-stage-chip.is-zero {
  opacity: .55;
}

/* Open pipeline: amount, full-width share bar and percent */
.vn-dash-table td.vn-dash-open {
  min-width: 170px;
}

.vn-dash-open-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.vn-dash-open.is-zero .vn-dash-open-val {
  color: var(--fg-2);
  font-weight: 500;
}

.vn-dash-open .vn-share {
  justify-content: stretch;
}

.vn-dash-open .vn-share-track {
  flex: 1 1 auto;
  width: auto;
  height: 6px;
  border-radius: 3px;
}

.vn-dash-open .vn-share-pct {
  text-align: right;
}

.vn-legend-dot {
  --dot: var(--fg-2);
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot);
}

.is-first > .vn-legend-dot,
.is-first .vn-legend-dot { --dot: color-mix(in srgb, var(--fg-2) 40%, var(--panel)); }
.is-neg > .vn-legend-dot,
.is-neg .vn-legend-dot { --dot: var(--vn-warn-fg); }
.is-won > .vn-legend-dot,
.is-won .vn-legend-dot { --dot: var(--ok-fg); }
.is-lost > .vn-legend-dot,
.is-lost .vn-legend-dot { --dot: var(--err-fg); }

.vn-table.vn-dash-table th {
  letter-spacing: .04em;
  white-space: normal;
}

.vn-dash-table th .vn-sort {
  padding: 8px 6px;
  line-height: 1.25;
}

.vn-dash-table td.vn-dash-n {
  min-width: 76px;
}

/* Share of the open pipeline under the amount */
.vn-share {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
}

.vn-share-track {
  width: 64px;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--line);
}

.vn-share-fill {
  display: block;
  height: 100%;
  background: var(--fg-2);
}

.vn-share-pct {
  min-width: 32px;
  color: var(--fg-2);
  font-size: 11.5px;
  font-weight: 500;
}

.vn-dash-rate-val {
  font-weight: 700;
}

.vn-dash-rate-val.is-won { color: var(--ok-fg); }
.vn-dash-rate-val.is-lost { color: var(--err-fg); }

.vn-dash-table td.vn-dash-rate {
  min-width: 96px;
}

.vn-dash-table td.vn-dash-rate.is-zero {
  color: var(--fg-2);
}

/* =========================
   List card
   ========================= */
.vn-list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.vn-list-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .2px;
}

.vn-count {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--vn-neutral-bd);
  border-radius: 8px;
  background: var(--vn-neutral-bg);
  color: var(--fg-2);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.vn-list-tools {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.vn-export-btn {
  height: 38px;
}

@media (max-width: 520px) {
  .vn-export-btn {
    width: 38px;
    padding: 0;
  }

  .vn-export-btn > span:not(.ui-icon) {
    display: none;
  }
}

.vn-view {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--vn-field-bg);
}

.vn-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-2);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.vn-view-btn svg, .vn-view-btn .ui-icon {
  width: 15px;
  height: 15px;
}

.vn-view-btn:hover:not([aria-pressed="true"]) {
  background: var(--panel);
  color: var(--fg-1);
}

.vn-view-btn[aria-pressed="true"] {
  background: var(--panel);
  border-color: var(--vn-selected-bd);
  color: var(--fg-1);
}

.vn-list .vn-table-wrap,
.vn-list .vn-board {
  transition: opacity .15s ease;
}

.vn-list.is-busy .vn-table-wrap,
.vn-list.is-busy .vn-board {
  opacity: .55;
}

.vn-list-foot {
  display: grid;
  gap: 4px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--line);
}

.vn-list-foot:not(:has(> :not([hidden]))) {
  display: none;
}

.vn-hint,
.vn-muted,
.vn-meta {
  margin: 0;
  color: var(--fg-2);
  font-size: 12px;
  line-height: 1.45;
}

.vn-lock-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--vn-warn-bd);
  border-radius: 10px;
  background: var(--vn-warn-bg);
  color: var(--vn-warn-fg);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
}

.vn-lock-note[hidden] {
  display: none;
}

.vn-lock-note svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
}

/* States */
.vn-state {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 44px 20px;
  text-align: center;
  color: var(--fg-2);
}

.vn-state p {
  margin: 0;
  max-width: 44ch;
}

.vn-state-ico-slot {
  display: contents;
}

.vn-state-ico {
  width: 40px;
  height: 40px;
  color: var(--fg-2);
  opacity: .7;
}

.vn-state-title {
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--fg-1);
}

.vn-state .vn-btn {
  margin-top: 10px;
}

.vn-state.is-error,
.vn-banner.is-error {
  border: 1px solid var(--err-bd);
  background: var(--err-bg);
  color: var(--err-fg);
  border-radius: 10px;
}

.vn-state.is-error {
  margin: 14px;
  padding: 18px;
}

.vn-banner {
  padding: 12px 14px;
  font-weight: 600;
}

/* =========================
   Table
   ========================= */
/* Grid table: same look as the almacen main table (.vj-grid-host .ti-table--grid). */
.vn-table-wrap {
  --vj-border: color-mix(in srgb, var(--line) 88%, #0b1220);
  --vj-wrap-bg: var(--panel);
  --vj-th-bg: color-mix(in srgb, var(--panel) 70%, #000);
  --vj-th-fg: color-mix(in srgb, var(--fg-1) 68%, transparent);
  --vj-row-odd: var(--panel);
  --vj-row-even: color-mix(in srgb, var(--panel) 86%, var(--fg-1) 10%);
  --vj-row-hover: color-mix(in srgb, var(--panel) 76%, var(--fg-1) 14%);
  width: 100%;
  overflow: auto;
  background: var(--vj-wrap-bg);
}

:root[data-theme="light"] .vn-table-wrap {
  --vj-border: #d7dee8;
  --vj-wrap-bg: #ffffff;
  --vj-th-bg: #f1f5f9;
  --vj-th-fg: #0f172a;
  --vj-row-odd: #ffffff;
  --vj-row-even: #f8fafc;
  --vj-row-hover: #eef2f8;
}

.vn-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  background: var(--vj-wrap-bg);
  color: var(--fg-1);
}

.vn-table th,
.vn-table td {
  padding: 8px 10px;
  border-color: var(--vj-border);
  border-style: solid;
  border-width: 0 1px 1px 0;
  font-size: 13px;
  text-align: left;
  vertical-align: middle;
}

.vn-table th:last-child,
.vn-table td:last-child {
  border-right-width: 0;
}

.vn-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--vj-th-bg);
  color: var(--vj-th-fg);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .10em;
  line-height: 1.15;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
}

.vn-table th:has(.vn-sort) {
  padding: 0;
}

.vn-table th:has(.vn-sort):hover {
  background: color-mix(in srgb, var(--vj-th-bg) 86%, var(--fg-1, currentColor) 8%);
}

.vn-sort {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  min-height: 34px;
  padding: 8px 10px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.vn-sort::after {
  content: "";
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  background: currentColor;
  -webkit-mask: url(/assets/icons/icon-down.png) center / contain no-repeat;
  mask: url(/assets/icons/icon-down.png) center / contain no-repeat;
  opacity: 0;
  transition: opacity .12s ease, transform .12s ease;
}

.vn-sort:hover::after {
  opacity: .4;
}

.vn-table th.is-sorted .vn-sort::after {
  opacity: .9;
  transform: rotate(180deg);
}

.vn-table th.is-sorted.is-desc .vn-sort::after {
  transform: none;
}

.vn-sort:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--hc-focus, currentColor);
}

.vn-table tbody td {
  background: var(--vj-row-odd);
}

.vn-table tbody tr:nth-child(even) td {
  background: var(--vj-row-even);
}

.vn-table tbody tr:last-child td {
  border-bottom-width: 0;
}

.vn-table td.num {
  text-align: right;
  white-space: nowrap;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.vn-table td.num.is-blank,
.vn-card-amount.is-blank {
  color: var(--fg-2);
  font-weight: 500;
}

.vn-table tbody tr.vn-row:hover td {
  background: var(--vj-row-hover);
}

.vn-col-client {
  min-width: 200px;
}

.vn-client {
  font-weight: 700;
  color: var(--fg-1);
  overflow-wrap: anywhere;
}

.vn-sub {
  display: -webkit-box;
  margin-top: 2px;
  color: var(--fg-2);
  font-size: 12.5px;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.vn-col-owner {
  min-width: 120px;
}

.vn-col-close {
  white-space: nowrap;
}

.vn-col-next {
  min-width: 200px;
  max-width: 340px;
  color: var(--fg-2);
}

.vn-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.4;
}

.vn-dash {
  color: var(--fg-2);
}

.vn-row-acts {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.vn-table .vn-col-act {
  width: 1%;
  text-align: center;
  white-space: nowrap;
}

.vn-close.is-overdue {
  color: var(--vn-warn-fg);
  font-weight: 700;
}

/* Stage chip */
.vn-stage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--vn-neutral-bd);
  border-radius: 8px;
  background: var(--vn-neutral-bg);
  color: var(--fg-1);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.page-ventas .pill {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--fg-2);
}

.vn-stage.is-neg {
  border-color: var(--vn-warn-bd);
  background: var(--vn-warn-bg);
  color: var(--vn-warn-fg);
}

.vn-stage.is-won {
  border-color: var(--ok-bd);
  background: var(--ok-bg);
  color: var(--ok-fg);
}

.vn-stage.is-lost {
  border-color: var(--err-bd);
  background: var(--err-bg);
  color: var(--err-fg);
}

.is-neg > .pill,
.is-neg .vn-col-name .pill {
  background: var(--vn-warn-fg);
}

.is-won > .pill,
.is-won .vn-col-name .pill {
  background: var(--ok-fg);
}

.is-lost > .pill,
.is-lost .vn-col-name .pill {
  background: var(--err-fg);
}

/* Skeleton */
.vn-sk {
  display: block;
  height: 12px;
  max-width: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--sk-base) 0%, var(--sk-hi) 50%, var(--sk-base) 100%);
  background-size: 200% 100%;
  animation: vn-shimmer 1.2s ease-in-out infinite;
}

.vn-sk-row td {
  padding: 16px 14px;
}

@keyframes vn-shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .vn-sk { animation: none; }
}

/* =========================
   Board
   ========================= */
.vn-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(232px, 1fr);
  align-items: start;
  gap: 10px;
  padding: 12px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding: 12px;
}

.vn-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--vn-sec-bg);
  scroll-snap-align: start;
  transition: background-color .12s ease, border-color .12s ease;
}

.vn-col.is-over {
  border-color: var(--vn-hover-bd);
  background: var(--vn-neutral-bg);
}

.vn-col-head {
  display: grid;
  gap: 4px;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--line);
}

.vn-col-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.vn-col-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--fg-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.vn-col-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: 0 6px;
  border: 1px solid var(--vn-neutral-bd);
  border-radius: 6px;
  background: var(--panel);
  color: var(--fg-2);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
}

.vn-col-sum {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.vn-col-share {
  display: grid;
  gap: 3px;
  color: var(--fg-2);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.vn-col-bar {
  height: 3px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--vn-neutral-bd);
}

.vn-col-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--fg-2);
}

.is-neg .vn-col-bar > span { background: var(--vn-warn-fg); }
.is-won .vn-col-bar > span { background: var(--ok-fg); }
.is-lost .vn-col-bar > span { background: var(--err-fg); }

.vn-col-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: max(360px, calc(100dvh - 280px));
  padding: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.vn-col-empty {
  margin: 0;
  padding: 14px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--fg-2);
  font-size: 12px;
  text-align: center;
}

.vn-card-opp {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease, opacity .12s ease;
}

.vn-card-opp[draggable="true"] {
  cursor: grab;
}

.vn-card-opp.is-dragging {
  opacity: .45;
}

.vn-card-opp.is-saving {
  opacity: .6;
  pointer-events: none;
}

.vn-card-opp:hover {
  border-color: var(--vn-hover-bd);
  background: color-mix(in srgb, var(--panel) 92%, var(--fg-1));
}

:root[data-theme="light"] .vn-card-opp:hover {
  background: var(--vn-hover);
}

.vn-card-opp:focus-visible {
  outline: 2px solid var(--hc-focus);
  outline-offset: 2px;
}

.vn-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.vn-card-top .vn-icon-btn {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin: -4px -6px -4px 0;
  opacity: 0;
  transition: opacity .12s ease;
}

.vn-card-opp:hover .vn-icon-btn,
.vn-card-opp:focus-within .vn-icon-btn {
  opacity: 1;
}

@media (hover: none) {
  .vn-card-top .vn-icon-btn { opacity: 1; }
}

.vn-card-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.vn-card-sub {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  color: var(--fg-2);
  font-size: 12px;
  line-height: 1.3;
}

.vn-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  margin-top: 3px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
}

.vn-card-amount {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.vn-card-amount.is-blank {
  color: var(--fg-2);
  font-size: 12px;
  font-weight: 400;
}

.vn-card-owners {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--fg-2);
}

.vn-avatars {
  display: flex;
  flex: 0 0 auto;
}

.vn-avatar {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--vn-neutral-bd);
  border-radius: 50%;
  background: var(--vn-neutral-bg);
  color: var(--fg-1);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .02em;
}

.vn-avatar + .vn-avatar {
  margin-left: -6px;
}

.vn-card-foot .vn-avatar {
  width: 20px;
  height: 20px;
  font-size: 9px;
}

.vn-card-owner-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vn-card-date {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  color: var(--fg-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.vn-card-date .ui-icon {
  width: 13px;
  height: 13px;
}

.vn-card-date.is-overdue {
  padding: 1px 6px;
  border: 1px solid var(--vn-warn-bd);
  border-radius: 6px;
  background: var(--vn-warn-bg);
  color: var(--vn-warn-fg);
}

/* =========================
   Form (Captura)
   ========================= */
.vn-form-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.vn-logo {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #111;
  font-weight: 800;
}

.vn-form-titles {
  min-width: 0;
  flex: 1 1 auto;
}

.vn-form-titles h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.vn-form-titles .vn-muted {
  margin-top: 2px;
  font-size: 13px;
}

.vn-edit-chip {
  flex: 0 1 auto;
  max-width: 40%;
  padding: 4px 10px;
  border: 1px solid var(--vn-warn-bd);
  border-radius: 8px;
  background: var(--vn-warn-bg);
  color: var(--vn-warn-fg);
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vn-form-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
}

.vn-sec {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--vn-sec-bg);
}

.vn-sec h3 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 800;
}

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

.vn-span-2 {
  grid-column: 1 / -1;
}

.vn-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-radius: 10px;
}

.vn-opts .vn-opt {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--vn-field-bg);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background-color .12s ease, border-color .12s ease;
}

.vn-opt input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.vn-opt:hover {
  border-color: var(--vn-hover-bd);
}

.vn-opt:has(input:checked) {
  background: var(--vn-selected-bg);
  border-color: var(--vn-selected-bd);
  font-weight: 700;
}

.vn-opt.is-neg:has(input:checked) {
  background: var(--vn-warn-bg);
  border-color: var(--vn-warn-bd);
  color: var(--vn-warn-fg);
}

.vn-opt.is-won:has(input:checked) {
  background: var(--ok-bg);
  border-color: var(--ok-bd);
  color: var(--ok-fg);
}

.vn-opt.is-lost:has(input:checked) {
  background: var(--err-bg);
  border-color: var(--err-bd);
  color: var(--err-fg);
}

.vn-opt:has(input:focus-visible) {
  outline: 2px solid var(--hc-focus);
  outline-offset: 2px;
}

.vn-opts.is-invalid .vn-opt {
  border-color: var(--err-bd);
}

.vn-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.vn-req-note {
  color: var(--fg-2);
  font-size: 12.5px;
}

.vn-form-buttons {
  display: flex;
  gap: 10px;
}

.page-ventas .vn-form-buttons .vn-btn {
  padding: 0 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
}

.page-ventas .vn-form-buttons .vn-btn:not(.ghost) {
  color: var(--btn-fg);
}

@media (min-width: 1200px) {
  .vn-form-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .vn-form-body > .vn-banner,
  .vn-form-body > .vn-sec:last-child {
    grid-column: 1 / -1;
  }
}

/* =========================
   Detail stats (modal)
   ========================= */

.vn-detail-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.vn-stat {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--vn-sec-bg);
}

.vn-stat-ico {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--fg-2);
}

.vn-stat-ico .ui-icon {
  width: 16px;
  height: 16px;
}

.vn-stat-body {
  min-width: 0;
}

.vn-stat-sub {
  margin-top: 3px;
  overflow: hidden;
  color: var(--fg-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vn-stat-sub.is-warn {
  color: var(--vn-warn-fg);
  font-weight: 600;
}

.vn-stat-sub.is-err {
  color: var(--err-fg);
  font-weight: 600;
}

.vn-notes-empty {
  margin: 10px 0 0;
  color: var(--fg-2);
  font-size: 13px;
}

.vn-stat-label {
  color: var(--fg-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.vn-stat-value {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.vn-dl {
  margin: 4px 0 0;
}

.vn-dl dt {
  margin-top: 16px;
  color: var(--fg-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.vn-dl dd {
  margin: 4px 0 0;
  white-space: pre-wrap;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.vn-dl dd.is-blank {
  color: var(--fg-2);
}

/* Combobox (cliente, planta, responsable) */
.vn-combo {
  position: relative;
}

.vn-combo .vn-input {
  padding-left: 38px;
  padding-right: 38px;
}

.vn-combo-ico {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 17px;
  height: 17px;
  color: var(--fg-2);
  transform: translateY(-50%);
  pointer-events: none;
}

.vn-combo-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-2);
  transform: translateY(-50%);
  cursor: pointer;
}

.vn-combo-toggle:hover {
  background: var(--vn-hover);
  color: var(--fg-1);
}

.vn-combo-toggle svg, .vn-combo-toggle .ui-icon {
  width: 12px;
  height: 12px;
  transition: transform .15s ease;
}

.vn-combo.is-open .vn-combo-toggle svg, .vn-combo.is-open .vn-combo-toggle .ui-icon {
  transform: rotate(180deg);
}

.vn-combo.is-disabled .vn-input {
  background: var(--vn-hover);
  color: var(--fg-2);
  cursor: not-allowed;
}

.vn-combo.is-disabled .vn-combo-ico,
.vn-combo.is-disabled .vn-combo-toggle {
  opacity: .5;
  pointer-events: none;
}

.vn-combo-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  max-height: 280px;
  margin: 0;
  padding: 4px;
  overflow: auto;
  list-style: none;
  border: 1px solid var(--vn-hover-bd);
  border-radius: 10px;
  background: var(--panel);
  overscroll-behavior: contain;
}

:root[data-theme="light"] .vn-combo-panel {
  background: #fff;
  border-color: #cbd5e1;
}

.vn-combo-opt {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.vn-combo-opt:hover,
.vn-combo-opt.is-active {
  background: var(--vn-selected-bg);
  border-color: var(--vn-selected-bd);
}

.vn-combo-opt.is-selected .vn-combo-name {
  font-weight: 800;
}

.vn-combo-name {
  font-size: 13.5px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.vn-combo-sub {
  color: var(--fg-2);
  font-size: 12px;
}

.vn-combo-empty {
  padding: 10px;
  color: var(--fg-2);
  font-size: 13px;
}

.vn-field-hint {
  margin: 0;
  color: var(--fg-2);
  font-size: 12px;
  line-height: 1.4;
}

/* Responsables: chips + combo para agregar */
.vn-owner-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.vn-owner-list[hidden] {
  display: none;
}

.vn-owner-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  max-width: 100%;
  padding: 3px 6px 3px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--vn-neutral-bg);
  font-size: 12.5px;
}

.vn-owner-chip:not(:has(.vn-owner-rm)) {
  padding-right: 10px;
}

.vn-owner-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.vn-owner-main {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--fg-2);
  font-size: 10.5px;
  font-weight: 500;
}

.page-ventas .vn-owner-promote {
  padding: 1px 6px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--fg-2);
  font-size: 10.5px;
  font-weight: 500;
  cursor: pointer;
}

.page-ventas .vn-owner-promote:hover {
  border-style: solid;
  border-color: var(--vn-hover-bd);
  background: var(--vn-hover);
  color: var(--fg);
}

.page-ventas .vn-owner-promote:focus-visible {
  outline: 2px solid var(--focus, var(--accent));
  outline-offset: 1px;
}

.page-ventas .vn-owner-rm {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--fg-2);
  cursor: pointer;
}

.page-ventas .vn-owner-rm:hover {
  background: var(--vn-hover);
  color: var(--fg);
}

.page-ventas .vn-owner-rm:focus-visible {
  outline: 2px solid var(--focus, var(--accent));
  outline-offset: 1px;
}

.vn-owner-rm .ui-icon {
  width: 12px;
  height: 12px;
}

.vn-owner-avatar,
.vn-cm-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  font-weight: 800;
  letter-spacing: .02em;
}

.vn-owner-avatar {
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: #111;
  font-size: 10px;
}

/* Fecha con boton de calendario */
.vn-date {
  position: relative;
}

.vn-date .vn-input {
  padding-right: 42px;
}

.vn-date input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0;
}

.vn-date-btn {
  position: absolute;
  z-index: 3;
  top: 50%;
  right: 4px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-2);
  transform: translateY(-50%);
  cursor: pointer;
}

.vn-date-btn:hover {
  background: var(--vn-hover);
  color: var(--fg-1);
}

.vn-date-btn svg, .vn-date-btn .ui-icon {
  width: 18px;
  height: 18px;
}

.page-ventas .vn-combo-toggle:focus-visible,
.page-ventas .vn-date-btn:focus-visible,
.page-ventas .vn-cm-tool:focus-visible,
.page-ventas .vn-cm-send:focus-visible,
.page-ventas .vn-cm-del:focus-visible,
.page-ventas .vn-cm-thumb:focus-visible {
  outline: 2px solid var(--hc-focus);
  outline-offset: 2px;
}

.vn-form {
  overflow: visible;
}

/* =========================
   Detail modal
   ========================= */
body.vj-modal-open.page-ventas {
  overflow: hidden;
}

.vn-modal-backdrop {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
}

.vn-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1140px, 100%);
  height: min(88vh, 880px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--fg-1);
}

.vn-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  padding: 12px 14px 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.vn-modal-head .vn-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.vn-modal-titles {
  min-width: 0;
}

.vn-modal-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  min-width: 0;
}

.vn-modal-titles h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.vn-modal-titles .vn-stage {
  font-size: 11.5px;
  font-weight: 500;
}

.vn-modal-titles .vn-muted {
  margin-top: 1px;
  font-size: 12.5px;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.vn-modal-head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.vn-modal-head-actions .vn-btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
}

.vn-icon-btn[hidden] {
  display: none;
}

.vn-icon-btn.vn-history-btn.is-active {
  background: var(--vn-hover);
  border-color: var(--vn-hover-bd);
  color: var(--fg-1);
}

.vn-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.vn-history-head .vn-sec-title {
  margin: 0;
}

.page-ventas .vn-history-back {
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
}

.vn-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
  min-height: 0;
}

.vn-modal-info {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  padding: 18px 20px;
  overflow: auto;
}

.vn-detail-view:not([hidden]) {
  display: contents;
}

/* New record modal; also hosts the form in the detail modal while editing. */
.vn-modal--form {
  grid-template-rows: auto minmax(0, 1fr);
  width: min(680px, 100%);
  height: auto;
  max-height: min(92vh, 960px);
}

.vn-modal--form .vn-modal-info {
  padding-top: 6px;
}

.vn-notes-grid {
  align-items: stretch;
}

.vn-note-area {
  height: 120px;
  min-height: 120px;
  max-height: 360px;
}

.vn-dl.vn-note-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  margin-top: 12px;
}

.vn-note-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  min-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--vn-field-bg);
}

.vn-notes .vn-note-card dt,
.vn-note-card dt {
  margin: 0;
}

.vn-note-card dd {
  margin: 0;
  max-height: 240px;
  overflow: auto;
  font-size: 14px;
}

.vn-note-card.is-blank dd {
  color: var(--fg-2);
  font-style: italic;
}

@media (max-width: 720px) {
  .vn-dl.vn-note-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .vn-note-card {
    min-height: 0;
  }
}

.vn-form-host .vn-form-body {
  gap: 0;
}

.vn-form-host .vn-sec {
  padding: 16px 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.vn-form-host .vn-sec:first-of-type {
  padding-top: 8px;
  border-top: 0;
}

.vn-form-host .vn-sec h3 {
  margin: 0 0 12px;
  color: var(--fg-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.vn-form-host .vn-opts {
  gap: 6px;
}

.vn-form-host .vn-opts .vn-opt {
  min-height: 34px;
  padding: 0 12px;
  gap: 7px;
  font-size: 13px;
}

.vn-form-host .vn-form {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.vn-form-host .vn-form-head {
  display: none;
}

.vn-form-host .vn-form-body {
  grid-template-columns: minmax(0, 1fr);
  padding: 0 0 14px;
}

.vn-form-host .vn-form-body > .vn-sec:last-child {
  grid-column: auto;
}

.vn-form-host .vn-form-actions {
  position: sticky;
  z-index: 20;
  bottom: -18px;
  margin: 0 -20px -18px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
}

.vn-modal .vn-detail-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.vn-stat.is-amount .vn-stat-value {
  font-size: 18px;
  font-weight: 800;
}

.vn-stat.is-blank .vn-stat-value {
  color: var(--fg-2);
  font-weight: 500;
}

.vn-progress-card,
.vn-notes,
.vn-history {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--vn-sec-bg);
}

/* Historial de cambios (detalle) */
.vn-history-list {
  display: grid;
  gap: 0;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.vn-tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 16px;
}

.vn-tl-item:last-child {
  padding-bottom: 0;
}

.vn-tl-item:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 32px;
  bottom: 4px;
  left: 13.5px;
  width: 1px;
  background: var(--line);
}

.vn-avatar.vn-tl-avatar {
  width: 28px;
  height: 28px;
  background: var(--panel);
  font-size: 10.5px;
}

.vn-tl-body {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding-top: 4px;
}

.vn-tl-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
  font-size: 13px;
  line-height: 1.4;
}

.vn-tl-who {
  font-weight: 600;
}

.vn-tl-what {
  color: var(--fg-2);
}

.vn-tl-when {
  color: var(--fg-2);
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.vn-tl-changes {
  display: grid;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  list-style: none;
}

.vn-tl-change {
  display: grid;
  gap: 4px;
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.45;
}

.vn-tl-change + .vn-tl-change {
  border-top: 1px solid var(--line);
}

.vn-tl-field {
  color: var(--fg-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.vn-tl-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  min-width: 0;
}

.vn-tl-stack {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  margin: 0;
}

.vn-tl-stack dt {
  color: var(--fg-2);
  font-size: 12px;
}

.vn-tl-stack dd {
  min-width: 0;
  margin: 0;
}

.vn-tl-old,
.vn-tl-new {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.vn-tl-old {
  color: var(--fg-2);
}

.vn-tl-new {
  color: var(--fg-1);
  font-weight: 500;
}

.vn-tl-old.is-blank,
.vn-tl-new.is-blank {
  color: var(--fg-2);
  font-style: italic;
  font-weight: 400;
}

.vn-tl-arrow {
  flex: 0 0 auto;
  color: var(--fg-2);
}

.vn-history-note {
  margin: 10px 0 0;
  color: var(--fg-2);
  font-size: 12.5px;
}

.page-ventas .vn-history-more {
  height: 32px;
  margin-top: 8px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}

.vn-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 520px) {
  .vn-tl-item {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 10px;
  }

  .vn-avatar.vn-tl-avatar {
    width: 24px;
    height: 24px;
    font-size: 9.5px;
  }

  .vn-tl-item:not(:last-child)::before {
    top: 28px;
    left: 11.5px;
  }
}

.vn-sec-title {
  margin: 0;
  color: var(--fg-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.vn-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 14px 0 2px;
  padding: 0;
  list-style: none;
}

.vn-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--fg-2);
  font-size: 12px;
  text-align: center;
}

.vn-step::before {
  content: "";
  position: absolute;
  top: 6px;
  right: calc(50% + 10px);
  left: calc(-50% + 10px);
  height: 2px;
  border-radius: 2px;
  background: var(--line);
}

.vn-step:first-child::before {
  display: none;
}

.vn-step-dot {
  position: relative;
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
}

.vn-step-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vn-step.is-done::before,
.vn-step.is-current::before {
  background: var(--fg-2);
}

.vn-step.is-done .vn-step-dot {
  border-color: var(--fg-2);
  background: var(--fg-2);
}

.vn-step.is-current {
  color: var(--fg-1);
  font-weight: 800;
}

.vn-step.is-current .vn-step-dot {
  border-color: var(--fg-1);
  background: var(--fg-1);
}

.vn-step.is-current.is-neg { color: var(--vn-warn-fg); }
.vn-step.is-current.is-neg .vn-step-dot { border-color: var(--vn-warn-fg); background: var(--vn-warn-fg); }
.vn-step.is-current.is-won { color: var(--ok-fg); }
.vn-step.is-current.is-won .vn-step-dot { border-color: var(--ok-fg); background: var(--ok-fg); }
.vn-step.is-current.is-lost { color: var(--err-fg); }
.vn-step.is-current.is-lost .vn-step-dot { border-color: var(--err-fg); background: var(--err-fg); }

.vn-notes .vn-dl dt:first-child {
  margin-top: 12px;
}

.vn-modal .vn-meta {
  margin: 0;
  padding: 0 2px;
}

/* =========================
   Comments thread
   ========================= */
.vn-cm {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--vn-sec-bg);
}

.vn-cm-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.vn-cm-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 14px 16px;
  overflow: auto;
  overscroll-behavior: contain;
}

.vn-cm-day {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.vn-cm-day::before,
.vn-cm-day::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--line);
}

.vn-cm-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 90%;
}

.vn-cm-item.is-mine {
  align-self: flex-end;
}

.vn-cm-item.is-pending {
  opacity: .6;
}

.vn-cm-avatar {
  width: 30px;
  height: 30px;
  margin-top: 18px;
  border: 1px solid var(--vn-neutral-bd);
  background: var(--vn-neutral-bg);
  color: var(--fg-1);
  font-size: 11px;
}

.vn-cm-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.vn-cm-item.is-mine .vn-cm-body {
  align-items: flex-end;
}

.vn-cm-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 2px;
  color: var(--fg-2);
  font-size: 11.5px;
}

.vn-cm-meta strong {
  color: var(--fg-1);
  font-weight: 700;
}

.vn-cm-row {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}

.vn-cm-item.is-mine .vn-cm-row {
  flex-direction: row-reverse;
}

.vn-cm-bubble {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.vn-cm-item.is-mine .vn-cm-bubble {
  border-color: var(--vn-selected-bd);
  background: var(--vn-selected-bg);
}

:root[data-theme="light"] .vn-cm-bubble {
  background: #fff;
}

:root[data-theme="light"] .vn-cm-item.is-mine .vn-cm-bubble {
  background: #eef2f8;
  border-color: #cbd5e1;
}

.vn-cm-text {
  margin: 0;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.vn-cm-del {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  margin-top: 4px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-2);
  opacity: 0;
  cursor: pointer;
  transition: opacity .12s ease, background-color .12s ease, color .12s ease;
}

.vn-cm-item:hover .vn-cm-del,
.vn-cm-item:focus-within .vn-cm-del {
  opacity: 1;
}

.vn-cm-del:hover {
  border-color: var(--err-bd);
  background: var(--err-bg);
  color: var(--err-fg);
}

@media (hover: none) {
  .vn-cm-del {
    opacity: 1;
  }
}

.vn-cm-gallery {
  display: grid;
  grid-template-columns: repeat(2, 112px);
  gap: 6px;
}

.vn-cm-gallery.is-single {
  grid-template-columns: minmax(0, 240px);
}

.vn-cm-thumb {
  display: block;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-0);
  cursor: zoom-in;
}

.vn-cm-gallery.is-single .vn-cm-thumb {
  aspect-ratio: 4 / 3;
}

.vn-cm-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vn-cm-videos {
  display: grid;
  gap: 6px;
}

.vn-cm-videos .cg-video-thumb {
  width: 240px;
  max-width: 100%;
}

.vn-cm-files {
  display: grid;
  gap: 6px;
}

.vn-cm-file {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--vn-field-bg);
  color: var(--fg-1);
  text-decoration: none;
}

.vn-cm-file:hover {
  border-color: var(--vn-hover-bd);
}

.vn-cm-file-ext {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 26px;
  padding: 0 4px;
  border: 1px solid var(--vn-neutral-bd);
  border-radius: 6px;
  background: var(--vn-neutral-bg);
  color: var(--fg-2);
  font-size: 10px;
  font-weight: 800;
}

.vn-cm-file-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vn-cm-file-meta {
  color: var(--fg-2);
  font-size: 11.5px;
  white-space: nowrap;
}

.vn-cm-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin: auto;
  padding: 24px 12px;
  color: var(--fg-2);
  text-align: center;
}

.vn-cm-empty svg, .vn-cm-empty .ui-icon {
  width: 36px;
  height: 36px;
  opacity: .7;
}

.vn-cm-empty strong {
  color: var(--fg-1);
  font-size: 14px;
}

.vn-cm-empty p {
  max-width: 34ch;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
}

.vn-cm-sk {
  max-width: 100%;
  width: 100%;
}

.vn-cm-sk.is-mine {
  justify-content: flex-end;
}

.vn-cm-error {
  margin: 0;
}

.vn-cm-pending {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px 0;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.vn-cm-ptile {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--vn-field-bg);
}

.vn-cm-ptile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vn-cm-ptile.is-video .cg-video-thumb {
  width: 100%;
  height: 100%;
}

.vn-cm-ptile.is-file {
  align-content: center;
  gap: 4px;
  padding: 4px;
}

.vn-cm-ptile-name {
  max-width: 100%;
  overflow: hidden;
  color: var(--fg-2);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vn-cm-ptile-x {
  position: absolute;
  z-index: 2;
  top: 3px;
  right: 3px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 6px;
  background: rgba(15, 23, 42, .78);
  color: #fff;
  cursor: pointer;
}

.vn-cm-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--line);
  border-top-color: var(--fg-1);
  border-radius: 50%;
  animation: vn-spin .8s linear infinite;
}

@keyframes vn-spin {
  to { transform: rotate(360deg); }
}

.vn-cm-ro {
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--fg-2);
  font-size: 12.5px;
}

.vn-cm-compose {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.vn-cm-pending:not([hidden]) + .vn-cm-ro + .vn-cm-compose {
  border-top: 0;
}

.vn-cm-tools {
  display: flex;
  gap: 2px;
}

.vn-cm-tool {
  display: grid;
  place-items: center;
  width: 38px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--fg-2);
  cursor: pointer;
}

.vn-cm-tool:hover:not(:disabled) {
  border-color: var(--vn-hover-bd);
  background: var(--vn-hover);
  color: var(--fg-1);
}

.vn-cm-tool svg, .vn-cm-tool .ui-icon,
.vn-cm-send svg, .vn-cm-send .ui-icon {
  width: 20px;
  height: 20px;
}

.vn-cm-tool:disabled,
.vn-cm-send:disabled {
  opacity: .45;
  cursor: default;
}

.vn-cm-input {
  width: 100%;
  min-height: 40px;
  max-height: 160px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--vn-field-bg);
  color: var(--fg-1);
  line-height: 1.4;
  resize: none;
  outline: none;
}

.vn-cm-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}

.vn-cm-send {
  display: grid;
  place-items: center;
  width: 42px;
  height: 40px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 70%, #000);
  border-radius: 10px;
  background: var(--accent);
  color: #111;
  cursor: pointer;
}

.vn-cm-send:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 88%, #000);
}

.vn-cm-drop {
  position: absolute;
  z-index: 6;
  inset: 8px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  border: 2px dashed color-mix(in srgb, var(--accent) 70%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 88%, var(--accent));
  color: var(--fg-1);
  font-weight: 700;
  pointer-events: none;
}

.vn-cm-drop svg, .vn-cm-drop .ui-icon {
  width: 30px;
  height: 30px;
}

@media (prefers-reduced-motion: reduce) {
  .vn-cm-spinner { animation-duration: 2.4s; }
}

/* Modal: tablet and phone use one pane at a time */
@media (max-width: 900px) {
  .vn-modal-backdrop {
    padding: 0;
    place-items: stretch;
  }

  .vn-modal-backdrop.vj-modal-backdrop--vv {
    top: var(--vj-vvt, 0);
    bottom: auto;
    height: var(--vj-vvh, 100dvh);
  }

  .vn-modal {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
  }

  .vn-modal-backdrop:has(.vn-modal--form) {
    padding: 16px;
    place-items: center;
  }

  .vn-modal.vn-modal--form {
    width: min(680px, 100%);
    height: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
  }

  .vn-modal-head {
    padding: 8px 8px 8px 14px;
  }

  .vn-modal-body {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    overflow: auto;
    overscroll-behavior: contain;
    background: var(--vn-sec-bg);
  }

  .vn-modal-info {
    min-height: auto;
    padding: 14px;
    overflow: visible;
  }

  /* The new record modal has no .vn-modal-body, so its info pane is the one that scrolls. */
  .vn-modal--form .vn-modal-info {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .vn-cm {
    min-height: auto;
    overflow: clip;
    margin: 0 14px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  .vn-modal-body:has(#detailEditHost:not([hidden])) .vn-cm {
    display: none;
  }

  .vn-modal-info .vn-stat,
  .vn-progress-card,
  .vn-notes,
  .vn-history,
  .vn-cm {
    background: var(--panel);
  }

  .vn-form-host .vn-form-actions {
    bottom: -14px;
    margin: 0 -14px -14px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .vn-cm-list {
    flex: 0 1 auto;
    min-height: 120px;
    max-height: 360px;
    padding: 12px;
  }

  .vn-cm-item {
    max-width: 94%;
  }

  .vn-cm-compose {
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 480px) {
  .vn-modal-head-actions .vn-btn-sm span {
    display: none;
  }

  .vn-modal-head-actions .vn-btn-sm {
    width: 32px;
    padding: 0;
  }

  .vn-cm-gallery {
    grid-template-columns: repeat(2, minmax(0, 104px));
  }

  .vn-step-label {
    font-size: 11px;
  }

  .vn-cm-tool {
    width: 34px;
  }
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 1180px) {
  .vn-table .vn-col-next {
    display: none;
  }

  .vn-table {
    min-width: 680px;
  }
}

@media (max-width: 1100px) {
  .vn-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-row.vn-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .vn-searchbox {
    flex-basis: 100%;
  }

  .vn-seg {
    flex: 1 1 auto;
  }
}

@media (max-width: 980px) {
  .page-ventas header.app-header.hdr-controls.vn-toolbar {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
    padding-top: 8px;
  }

  .vn-toolbar-actions {
    justify-content: flex-start;
    margin-left: 0;
    padding-bottom: 0;
  }

  .page-ventas header.hdr-controls .vn-tabs {
    align-self: flex-start;
    margin-left: 0;
  }
}

@media (max-width: 720px) {
  .page-ventas header.app-header.hdr-controls.vn-toolbar {
    margin: 0 10px;
  }

  header.app-header.hdr-controls .vn-month {
    display: grid;
    flex: 1 1 100%;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 6px;
  }

  header.app-header.hdr-controls .vn-month[hidden] {
    display: none;
  }

  header.app-header.hdr-controls .vn-month .month-picker-trigger {
    width: 100%;
    min-width: 0;
  }

  header.app-header.hdr-controls .vn-month .month-picker-popover {
    right: 0;
    width: auto;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, .8fr) auto;
  }

  .page-ventas .vn-tabs {
    width: 100%;
  }

  .page-ventas header.hdr-controls .vn-tabs > .tab {
    flex: 1 1 0;
    min-width: 0;
    padding: 8px 10px;
    font-size: 13px;
  }

  .vn-modal-backdrop:has(.vn-modal--form) {
    padding: 0;
    place-items: stretch;
  }

  .vn-modal.vn-modal--form {
    width: 100%;
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .vn-card,
  .kpi-row.vn-kpi-row {
    margin-left: 10px;
    margin-right: 10px;
  }

  .vn-searchbar {
    padding: 12px;
  }

  .vn-seg,
  .vn-searchbar-actions {
    flex: 1 1 100%;
  }

  .vn-searchbar-actions .vn-btn {
    flex: 1 1 0;
  }

  .vn-filters,
  .vn-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .vn-detail-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .vn-form-head {
    flex-wrap: wrap;
    gap: 12px;
  }

  .vn-form-titles h2 {
    font-size: 17px;
  }

  .vn-edit-chip {
    max-width: 100%;
  }

  .vn-form-body {
    padding: 12px;
  }

  .vn-sec {
    padding: 14px;
  }

  .vn-form-actions {
    position: sticky;
    z-index: 20;
    bottom: 0;
    flex-direction: column-reverse;
    align-items: stretch;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    border-radius: 0 0 14px 14px;
    background: var(--panel);
  }

  .vn-req-note {
    text-align: center;
  }

  .vn-opts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .vn-opts .vn-opt {
    justify-content: flex-start;
  }

  .vn-form .vn-input,
  .vn-form .vn-area,
  .vn-cm-input {
    font-size: 16px;
  }

  .vn-form-buttons .vn-btn {
    flex: 1 1 0;
    min-width: 0;
  }

  .vn-board {
    grid-auto-columns: minmax(240px, 82vw);
    padding: 10px;
  }

}
