:root {
  --bg: #f3f6f4;
  --surface: #ffffff;
  --surface-soft: #f8faf7;
  --sidebar: #17352c;
  --sidebar-strong: #0f251f;
  --accent: #2f7d4f;
  --accent-strong: #25663f;
  --accent-soft: #e7f2eb;
  --info: #226f87;
  --warning: #b7791f;
  --line: #d8e1dc;
  --line-strong: #bdcbc4;
  --text: #17231f;
  --muted: #66756e;
  --danger: #b42318;
  --shadow: 0 12px 30px rgba(23, 35, 31, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(47, 125, 79, 0.08), rgba(47, 125, 79, 0) 220px),
    var(--bg);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
}

a {
  color: var(--accent-strong);
}

a:hover {
  color: var(--sidebar);
}

.app-shell {
  display: grid;
  grid-template-rows: 62px minmax(0, 1fr);
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.18s ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.app-header {
  grid-column: 1 / -1;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 0 18px;
  color: #dbe5e1;
  background: #213e45;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 20px rgba(15, 37, 31, 0.12);
}

.header-left,
.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.menu-toggle,
.header-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  color: #f4fbf7;
  background: transparent;
  cursor: pointer;
}

.menu-toggle:hover,
.header-icon:hover {
  background: rgba(255, 255, 255, 0.1);
}

.menu-toggle svg,
.header-icon svg,
.user-menu svg,
.header-brand svg,
.dashboard-link svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: #fff;
  text-decoration: none;
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.header-brand:hover {
  color: #fff;
}

.header-logo-frame {
  position: relative;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
}

.header-logo-frame img {
  position: absolute;
  top: 0;
  left: -28px;
  width: auto;
  max-width: none;
  height: 48px;
}

.user-menu {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #d4ddd9;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.user-menu span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions form {
  margin: 0;
}

.notification-center {
  position: relative;
}

.notification-center > summary {
  list-style: none;
}

.notification-center > summary::-webkit-details-marker {
  display: none;
}

.notification-trigger {
  position: relative;
}

.notification-center[open] .notification-trigger {
  background: rgba(255, 255, 255, 0.12);
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid #213e45;
  border-radius: 999px;
  color: #fff;
  background: #e53935;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 1000;
  width: min(390px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 18px 45px rgba(17, 37, 31, 0.24);
}

.notification-panel::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 12px;
  width: 14px;
  height: 14px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--surface);
  transform: rotate(45deg);
}

.notification-panel > header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.notification-panel > header div {
  display: grid;
  gap: 2px;
}

.notification-panel > header strong {
  font-size: 14px;
}

.notification-panel > header span,
.notification-panel > header a,
.notification-empty span {
  color: var(--muted);
  font-size: 11px;
}

.notification-panel > header a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.notification-list {
  max-height: 380px;
  overflow-y: auto;
}

.notification-item {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #edf1ef;
  color: var(--text);
  text-decoration: none;
}

.notification-item:last-child {
  border-bottom: 0;
}

.notification-item:hover {
  color: var(--text);
  background: #f4faf6;
}

.notification-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: #e53935;
  box-shadow: 0 0 0 4px rgba(229, 57, 53, 0.1);
}

.notification-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.notification-copy strong,
.notification-copy span,
.notification-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-copy strong {
  font-size: 12px;
}

.notification-copy span {
  color: #41534c;
  font-size: 11px;
}

.notification-copy small {
  color: var(--muted);
  font-size: 10px;
}

.notification-empty {
  display: grid;
  gap: 3px;
  padding: 26px 16px;
  text-align: center;
}

.header-logout {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  color: #f4fbf7;
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.header-logout:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar {
  grid-row: 2;
  position: sticky;
  top: 62px;
  height: calc(100vh - 62px);
  overflow-y: auto;
  overflow-x: hidden;
  color: #6f7b77;
  background: #ffffff;
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  box-shadow: 8px 0 24px rgba(15, 37, 31, 0.08);
  transition: padding 0.18s ease, opacity 0.18s ease;
}

.app-shell.sidebar-collapsed .sidebar {
  padding-left: 0;
  padding-right: 0;
  opacity: 0;
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin-bottom: 18px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: var(--radius);
  color: #17352c;
  background: #f4d35e;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.15;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  margin-top: 3px;
  color: #cfe5da;
  font-size: 12px;
  font-weight: 500;
}

.sidebar nav {
  display: grid;
  gap: 4px;
}

.side-nav {
  min-width: 228px;
}

.dashboard-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 9px 11px;
  border-radius: var(--radius);
  color: #14a747;
  text-decoration: none;
  font-size: 14px;
  font-weight: 750;
}

.dashboard-link:hover {
  color: #0f8d39;
  background: #eef8f1;
}

.nav-group {
  display: grid;
  gap: 2px;
}

.nav-group summary {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 11px;
  color: #74807c;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
  list-style: none;
  text-transform: none;
  border-radius: var(--radius);
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

.nav-group summary::after {
  content: "âŒ„";
  margin-left: auto;
  color: #8b9792;
  font-size: 15px;
}

.nav-group[open] summary::after {
  content: "âŒƒ";
}

.nav-group summary:hover,
.nav-group[open] summary {
  color: #31423b;
  background: #f3f7f5;
}

.nav-group summary::after {
  content: "+";
}

.nav-group[open] summary::after {
  content: "-";
}

.sidebar a {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 9px 11px;
  border-radius: var(--radius);
  color: #76847f;
  text-decoration: none;
  font-weight: 650;
}

.nav-group a {
  min-height: 32px;
  margin-left: 18px;
  padding: 7px 10px;
  border-left: 2px solid #edf2ef;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 12px;
  font-weight: 600;
}

.sidebar a:hover {
  color: #1f332b;
  background: #f4f8f6;
}

.sidebar a.active {
  color: var(--accent-strong);
  background: var(--accent-soft);
  box-shadow: none;
}

.content {
  grid-row: 2;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 62px;
  z-index: 5;
  min-height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  font-size: 16px;
  font-weight: 750;
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
}

.context-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #31423b;
  background: var(--surface-soft);
  white-space: nowrap;
}

.top-actions form {
  margin: 0;
}

.page {
  width: min(1480px, 100%);
  padding: 22px 24px 36px;
}

.alert {
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.alert-success {
  color: #174d31;
  background: #e3f3e8;
}

.text-danger,
.field-validation-error {
  color: var(--danger) !important;
  font-weight: 650;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.toolbar h1 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
}

.search-form {
  display: flex;
  gap: 8px;
  width: min(680px, 100%);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.pager-actions {
  display: flex;
  gap: 8px;
}

.pager .disabled {
  pointer-events: none;
  opacity: 0.45;
}

.data-grid {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 11px;
  line-height: 1.15;
}

.table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: #f7faf8;
  --bs-table-hover-bg: #eef7f1;
  margin-bottom: 0;
}

.data-grid th {
  padding: 8px 9px;
  color: #35463f;
  background: #eef4f0;
  border-bottom: 1px solid var(--line-strong);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.data-grid td {
  padding: 7px 9px;
  vertical-align: middle;
  border-color: var(--line);
}

.data-grid .form-control,
.data-grid .form-select {
  min-height: 28px;
  padding: 4px 7px;
  font-size: 11px;
}

.notas-pedido-grid .estado-documento-col {
  width: 92px;
  max-width: 92px;
  text-align: center;
}

.notas-pedido-grid .estado-pago-col {
  width: 96px;
  max-width: 96px;
  text-align: center;
}

.notas-pedido-grid th.estado-documento-col,
.notas-pedido-grid th.estado-pago-col,
.notas-pedido-grid td.estado-documento-col,
.notas-pedido-grid td.estado-pago-col {
  padding-left: 5px;
  padding-right: 5px;
}

.comprobantes-grid {
  table-layout: fixed;
}

.cotizaciones-grid {
  overflow: visible;
}

.comprobantes-grid th:nth-child(1),
.comprobantes-grid td:nth-child(1) {
  width: 10%;
}

.comprobantes-grid th:nth-child(2),
.comprobantes-grid td:nth-child(2) {
  width: 8%;
}

.comprobantes-grid th:nth-child(3),
.comprobantes-grid td:nth-child(3) {
  width: 7%;
}

.comprobantes-grid th:nth-child(4),
.comprobantes-grid td:nth-child(4) {
  width: 15%;
}

.comprobantes-grid th:nth-child(5),
.comprobantes-grid td:nth-child(5) {
  width: 9%;
}

.comprobantes-grid th:nth-child(6),
.comprobantes-grid td:nth-child(6),
.comprobantes-grid th:nth-child(7),
.comprobantes-grid td:nth-child(7),
.comprobantes-grid th:nth-child(8),
.comprobantes-grid td:nth-child(8) {
  width: 7%;
}

.comprobantes-grid th:nth-child(9),
.comprobantes-grid td:nth-child(9),
.comprobantes-grid th:nth-child(10),
.comprobantes-grid td:nth-child(10) {
  width: 8%;
}

.comprobantes-grid th:nth-child(11),
.comprobantes-grid td:nth-child(11) {
  width: 8%;
}

.dense-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  font-size: 12px;
}

.form-grid {
  display: grid;
  gap: 14px 16px;
}

.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.span-2 {
  grid-column: span 2;
}

label {
  display: grid;
  gap: 4px;
  color: #2d3d36;
  font-size: 10px;
  font-weight: 750;
}

.form-control,
.form-select {
  min-height: 40px;
  border-color: #cfdad4;
  border-radius: var(--radius);
  color: var(--text);
  background-color: #fff;
  font-size: 12px;
}

.form-control-sm,
.form-select-sm {
  min-height: 38px;
  padding: 7px 10px;
  font-size: 12px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 125, 79, 0.16);
}

.form-control::placeholder {
  color: #9aa7a1;
}

.checkline {
  display: flex;
  gap: 9px;
  align-items: center;
  min-height: 38px;
  padding: 24px 0 0;
}

.checkline input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.btn {
  min-height: 38px;
  border-radius: var(--radius);
  font-weight: 750;
}

.btn-sm {
  min-height: 36px;
  padding: 7px 13px;
  font-size: 11px;
}

.btn-primary {
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-bg: var(--accent-strong);
  --bs-btn-hover-border-color: var(--accent-strong);
  --bs-btn-active-bg: #1f5635;
  --bs-btn-active-border-color: #1f5635;
}

.btn-success {
  --bs-btn-bg: var(--info);
  --bs-btn-border-color: var(--info);
  --bs-btn-hover-bg: #18586b;
  --bs-btn-hover-border-color: #18586b;
}

.btn-outline-primary {
  --bs-btn-color: var(--accent-strong);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-bg: var(--accent);
  --bs-btn-hover-border-color: var(--accent);
}

.btn-outline-secondary {
  --bs-btn-color: #4b5d55;
  --bs-btn-border-color: #b7c5be;
  --bs-btn-hover-bg: #eef4f0;
  --bs-btn-hover-border-color: #9eb0a7;
  --bs-btn-hover-color: #23322d;
}

.logo-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.logo-preview img {
  max-width: 140px;
  max-height: 54px;
  object-fit: contain;
}

.logo-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
}

.kpi:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-1px);
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 21px;
  line-height: 1.2;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 14px;
}

.dashboard-header h1 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 850;
}

.dashboard-periodo {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.dashboard-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  display: grid;
  gap: 7px;
  min-height: 128px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.metric-card:hover {
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.metric-card.primary {
  border-color: rgba(47, 125, 79, 0.36);
  background: linear-gradient(180deg, #f4fbf6, #fff);
}

.metric-card span,
.balance-main span,
.balance-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  font-size: 26px;
  line-height: 1.1;
}

.metric-card small,
.balance-main small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.dashboard-balance {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
  margin-top: 14px;
}

.balance-main,
.balance-strip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.balance-main {
  display: grid;
  gap: 8px;
  padding: 18px;
  border-left: 5px solid var(--accent);
}

.balance-main.negative {
  border-left-color: var(--danger);
}

.balance-main strong {
  color: var(--accent-strong);
  font-size: 30px;
  line-height: 1.1;
}

.balance-main.negative strong {
  color: var(--danger);
}

.balance-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.balance-strip div {
  display: grid;
  gap: 8px;
  padding: 18px 16px;
  border-right: 1px solid var(--line);
}

.balance-strip div:last-child {
  border-right: 0;
}

.balance-strip strong {
  font-size: 24px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 14px;
  margin-top: 14px;
}

.dashboard-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sales-panel {
  grid-row: span 2;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-heading h2 {
  margin: 0;
  color: #24342e;
  font-size: 16px;
  font-weight: 850;
}

.panel-heading span,
.panel-heading a {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.bar-list,
.alert-list,
.ranking-list,
.category-list {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 112px;
  align-items: center;
  gap: 10px;
  min-height: 32px;
}

.bar-row span,
.category-row span,
.ranking-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.bar-row div,
.category-row div {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf3f0;
}

.bar-row i,
.category-row i,
.ranking-row i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.bar-row strong {
  text-align: right;
  font-size: 12px;
}

.alert-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--info);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-soft);
  text-decoration: none;
}

.alert-item:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.alert-item span {
  color: var(--muted);
  font-size: 12px;
}

.alert-item.warning {
  border-left-color: var(--warning);
}

.alert-item.danger {
  border-left-color: var(--danger);
}

.alert-item.success {
  border-left-color: var(--accent);
}

.ranking-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  overflow: hidden;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--line);
}

.ranking-row:last-child {
  border-bottom: 0;
}

.ranking-row div {
  min-width: 0;
}

.ranking-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-row em {
  font-style: normal;
  font-weight: 800;
}

.ranking-row i {
  position: absolute;
  left: 0;
  bottom: 4px;
  height: 4px;
  background: var(--info);
}

.category-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 10px;
}

.category-row div {
  grid-column: 1 / -1;
}

.category-row strong {
  font-size: 12px;
}

.dashboard-table {
  box-shadow: none;
}

.text-end {
  text-align: right;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.quick-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #31423b;
  background: var(--surface);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.quick-action:hover {
  color: var(--accent-strong);
  border-color: var(--accent);
  background: #f5fbf7;
}

.finance-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.finance-summary div {
  display: grid;
  gap: 4px;
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.finance-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.finance-summary strong {
  color: var(--text);
  font-size: 20px;
  line-height: 1.15;
}

.report-filter {
  margin-bottom: 14px;
}

.report-filter-action {
  display: flex;
  align-items: end;
}

.report-filter-action .btn {
  width: 100%;
}

.report-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.report-kpi {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-top: 4px solid #64748b;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.report-kpi.sales { border-top-color: #1677a5; }
.report-kpi.income { border-top-color: #2f7d4f; }
.report-kpi.expense { border-top-color: #d97706; }
.report-kpi.purchases { border-top-color: #7c3aed; }
.report-kpi.result { border-top-color: var(--accent); background: #f4fbf6; }
.report-kpi.result.negative { border-top-color: var(--danger); background: #fff7f7; }

.report-kpi span,
.report-latest span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.report-kpi strong {
  overflow: hidden;
  font-size: clamp(17px, 1.7vw, 23px);
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-kpi small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.report-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 6px 0 10px;
}

.report-heading h2 {
  margin: 2px 0 3px;
  font-size: 20px;
}

.report-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.report-latest {
  display: grid;
  gap: 3px;
  text-align: right;
}

.report-latest strong {
  font-size: 20px;
}

.report-matrix-wrap,
.report-annual-wrap {
  overflow-x: auto;
}

.report-matrix {
  min-width: 820px;
  table-layout: auto !important;
}

.report-matrix th,
.report-matrix td {
  padding: 10px 12px;
  white-space: nowrap;
}

.report-matrix thead th {
  background: #f8faf9;
}

.report-matrix .report-month-column {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 145px;
  background: #f8faf9;
}

.report-matrix tbody th,
.report-matrix tfoot th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
}

.report-year-column {
  min-width: 145px;
  border-top: 4px solid var(--year-color) !important;
  font-size: 15px;
}

.report-matrix tfoot th {
  border-top: 2px solid var(--line);
  background: #f4f8f5;
}

.report-annual {
  min-width: 820px;
  table-layout: auto !important;
}

.report-positive { color: #17633a !important; }
.report-negative { color: #b42318 !important; }

.report-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.error-message-cell {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.error-cell-code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px;
}

.error-detail {
  display: grid;
  gap: 14px;
}

.error-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.error-detail-header div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.error-detail-header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.error-metadata {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.error-metadata div,
.error-block,
.error-technical {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.error-metadata div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.error-metadata span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.error-metadata strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.error-block h2 {
  margin: 0 0 7px;
  font-size: 14px;
}

.error-block p {
  margin: 0;
  white-space: pre-wrap;
}

.error-block.reviewed {
  border-left: 4px solid var(--accent);
}

.error-technical summary {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.error-technical pre {
  max-height: 440px;
  margin: 12px 0 0;
  padding: 12px;
  overflow: auto;
  border-radius: 6px;
  color: #e6edf3;
  background: #17232a;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.section-title {
  margin: 18px 0 8px;
  color: #24342e;
  font-size: 15px;
  font-weight: 800;
}

.nota-detail {
  display: grid;
  gap: 12px;
}

.nota-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nota-detail-header h1 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  line-height: 1.2;
}

.nota-detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.nota-back-link {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.nota-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.nota-summary-card,
.nota-convert-card,
.nota-info-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.nota-summary-card {
  display: grid;
  gap: 4px;
  min-height: 72px;
  padding: 10px 10px;
}

.nota-summary-card span,
.nota-convert-card > span,
.nota-info-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.nota-summary-card strong {
  color: var(--text);
  font-size: 19px;
  line-height: 1.15;
}

.nota-convert-card {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 72px;
  padding: 10px 10px;
  grid-column: span 2;
}

.cotizacion-convert-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.cotizacion-convert-form {
  margin: 0;
}

.cotizacion-convert-form .form-select {
  max-width: 220px;
}

.nota-info-card {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.25fr;
  gap: 18px;
  padding: 14px;
}

.nota-info-card div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.nota-info-card strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.nota-detail-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.95fr);
  gap: 14px;
  align-items: start;
}

.nota-detail-columns .section-title {
  margin-top: 4px;
}

.nota-products-grid,
.nota-cobros-grid {
  font-size: 11px;
}

.nota-products-grid th,
.nota-products-grid td,
.nota-cobros-grid th,
.nota-cobros-grid td {
  padding: 7px 8px;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 12px;
}

.permission-tree {
  display: grid;
  gap: 12px;
}

.permission-module {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.permission-title,
.permission-subtitle {
  display: flex;
  grid-auto-flow: column;
  grid-template-columns: auto 1fr;
  align-items: center;
  width: fit-content;
}

.permission-title {
  margin-bottom: 10px;
  color: #24342e;
  font-size: 12px;
  font-weight: 850;
}

.permission-forms {
  display: grid;
  gap: 10px;
}

.permission-form {
  padding: 10px 12px;
  border: 1px solid #dfe8e3;
  border-radius: var(--radius);
  background: #fff;
}

.permission-subtitle {
  margin-bottom: 8px;
  color: #365047;
  font-size: 12px;
  font-weight: 800;
}

.compact {
  min-height: 30px;
  padding-top: 0;
  font-weight: 600;
}

.inline-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
}

.inline-actions .form-select {
  width: 150px;
}

fieldset.form-grid,
.form-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.detalle-grid {
  width: 100%;
  table-layout: fixed;
}

.detalle-grid th,
.detalle-grid td {
  padding: 6px 6px;
}

.detalle-grid .detalle-producto {
  width: 46%;
}

.detalle-grid .detalle-unidad {
  width: 10%;
}

.detalle-grid .detalle-cantidad,
.detalle-grid .detalle-precio,
.detalle-grid .detalle-total {
  width: 12%;
}

.detalle-grid .detalle-accion {
  width: 6%;
}

.detalle-grid .form-control,
.detalle-grid .form-select {
  width: 100%;
  min-height: 28px;
  padding: 4px 7px;
}

.detalle-grid .producto-search {
  min-width: 0;
  text-overflow: ellipsis;
  padding-right: 28px;
}

.producto-search-wrap {
  position: relative;
}

.producto-search-toggle {
  position: absolute;
  top: 3px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: 0;
  border-left: 1px solid rgba(31, 46, 42, 0.15);
  background: transparent;
  color: #263c37;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.producto-search-results {
  position: fixed;
  z-index: 3000;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid rgba(31, 46, 42, 0.18);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(22, 37, 33, 0.16);
  padding: 6px;
}

.producto-search-option {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 8px 10px;
  color: #071b1a;
  font-size: 0.9rem;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}

.producto-search-option:hover,
.producto-search-option:focus {
  background: #eaf4ef;
}

.producto-search-empty {
  padding: 8px 10px;
  color: #6f7c78;
  font-size: 0.88rem;
}

.detalle-grid .icon-btn {
  width: 26px;
  height: 26px;
  min-height: 26px;
}

.detalle-grid td:last-child {
  padding-left: 4px;
  padding-right: 4px;
}

.actions-heading,
.actions-cell {
  width: 104px;
  min-width: 104px;
  text-align: left !important;
}

.quote-actions {
  position: relative;
  display: inline-flex;
  justify-content: flex-start;
  align-items: center;
  gap: 3px;
  width: 100%;
}

.icon-form {
  margin: 0;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 1px solid #9eb0a7;
  border-radius: var(--radius);
  color: #23322d;
  background: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.icon-btn svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn:hover {
  color: #17352c;
  background: #eef4f0;
}

.icon-btn.primary {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.icon-btn.danger {
  color: var(--danger);
}

.convert-menu {
  position: relative;
}

.convert-menu summary {
  list-style: none;
}

.convert-menu summary::-webkit-details-marker {
  display: none;
}

.convert-panel {
  position: absolute;
  left: 0;
  top: 34px;
  z-index: 8;
  display: flex;
  gap: 4px;
  width: 220px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.convert-panel .form-select {
  min-width: 160px;
}

.empty-state {
  display: grid;
  gap: 4px;
  padding: 18px;
  color: var(--muted);
}

.empty-state strong {
  color: var(--text);
}

.json-log {
  max-height: 320px;
  margin: 8px 0 12px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7faf8;
  color: #1f2f29;
  font-size: 12px;
  white-space: pre-wrap;
}

.log-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.log-grid strong {
  display: block;
  color: var(--text);
  font-size: 12px;
  margin-bottom: 4px;
}

  .form-totals {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 180px));
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}

.form-totals div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.form-totals span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.form-totals strong {
  color: var(--text);
  font-size: 16px;
  text-align: right;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 20px;
  padding: 2px 7px;
  color: #fff;
  background: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
}

.status-badge.compact {
  min-width: 0;
  padding-left: 8px;
  padding-right: 8px;
  white-space: nowrap;
}

.status-badge.active {
  background: #71c43a;
}

.status-badge.danger {
  background: var(--danger);
}

.totals-strip {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  font-weight: 750;
}

.login-form {
  max-width: 760px;
}

.login-page,
.login-page * {
  box-sizing: border-box;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(520px, 1fr);
  background: #f7faf7;
  color: #10231c;
  overflow: hidden;
}

.sigevi-login {
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
}

.login-visual {
  position: relative;
  min-height: 100vh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  padding: 36px;
  color: #fff;
  background:
    radial-gradient(circle at 72% 38%, rgba(119, 196, 41, 0.18), transparent 28%),
    linear-gradient(135deg, #003f28 0%, #006033 48%, #012a1e 100%);
  overflow: hidden;
}

.login-visual::before,
.login-visual::after {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  border: 1px solid rgba(132, 205, 36, 0.38);
  border-radius: 50%;
  pointer-events: none;
}

.login-visual::before {
  top: -250px;
  left: -190px;
  box-shadow: 22px 26px 0 rgba(132, 205, 36, 0.12), 46px 52px 0 rgba(132, 205, 36, 0.08);
}

.login-visual::after {
  right: -210px;
  bottom: -250px;
  box-shadow: -24px -28px 0 rgba(132, 205, 36, 0.12), -48px -56px 0 rgba(132, 205, 36, 0.08);
}

.login-line-art {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, transparent 0 24%, rgba(134, 205, 35, 0.18) 24.2% 24.5%, transparent 24.7% 100%),
    linear-gradient(300deg, transparent 0 70%, rgba(134, 205, 35, 0.13) 70.2% 70.5%, transparent 70.7% 100%);
  opacity: 0.7;
}

.login-visual-brand,
.login-module-grid {
  position: relative;
  z-index: 1;
}

.login-visual-brand {
  width: min(560px, 86%);
  text-align: center;
}

.login-visual-brand img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 320px;
  margin: 0 auto;
  filter: drop-shadow(0 22px 28px rgba(0, 0, 0, 0.28));
}

.login-module-grid {
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: repeat(5, minmax(104px, 1fr));
  gap: 14px;
}

.login-module-tile {
  min-height: 92px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 14px 6px;
  border: 1px solid rgba(128, 204, 35, 0.34);
  border-radius: 12px;
  background: rgba(0, 75, 43, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 12px 26px rgba(0, 28, 18, 0.16);
  text-align: center;
}

.login-module-tile svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: #8fd329;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-module-tile span {
  width: 100%;
  max-width: 100%;
  color: #fff;
  font-size: 12px;
  line-height: 1.12;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.login-panel {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 24px 42px;
  background:
    radial-gradient(circle at 90% 18%, rgba(148, 204, 114, 0.12), transparent 26%),
    linear-gradient(140deg, #fbfdfb 0%, #f7faf4 55%, #eef5eb 100%);
  overflow: hidden;
}

.login-panel::before,
.login-panel::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.login-panel::before {
  width: 520px;
  height: 520px;
  right: -250px;
  bottom: -120px;
  background: rgba(32, 117, 71, 0.06);
}

.login-panel::after {
  width: 380px;
  height: 380px;
  right: -190px;
  top: 110px;
  background: rgba(119, 196, 41, 0.08);
}

.login-panel-pattern {
  position: absolute;
  inset: 38px 36px auto auto;
  width: 92px;
  height: 92px;
  background-image: radial-gradient(#b8d2bd 2px, transparent 2px);
  background-size: 17px 17px;
  opacity: 0.85;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  display: grid;
  gap: 9px;
  padding: 20px 34px 18px;
  border: 1px solid rgba(223, 230, 224, 0.94);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 30px 70px rgba(33, 51, 42, 0.14);
}

.login-brand {
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}

.login-brand img {
  display: block;
  width: auto;
  max-width: 84%;
  height: 138px;
  object-fit: contain;
}

.login-error {
  color: var(--danger);
  font-weight: 800;
  text-align: center;
}

.login-field {
  display: grid;
  gap: 8px;
  color: #13251d;
  font-size: 12px;
  font-weight: 850;
}

.login-input-wrap {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  min-height: 52px;
  border: 1px solid #d6dfd9;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.login-input-wrap:focus-within {
  border-color: #2f8a56;
  box-shadow: 0 0 0 4px rgba(47, 138, 86, 0.14);
}

.login-input-wrap svg {
  width: 22px;
  height: 22px;
  justify-self: center;
  fill: none;
  stroke: #738179;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-input-wrap input,
.login-input-wrap select {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  color: #15261f;
  background: transparent;
  font-size: 16px;
  font-weight: 650;
}

.login-input-wrap input::placeholder {
  color: #8a948f;
  font-weight: 600;
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 2px;
}

.login-options a {
  color: #006b2f;
  font-size: 12px;
  font-weight: 800;
  text-decoration: underline;
}

.login-remember {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #24382f;
  font-size: 12px;
  font-weight: 800;
}

.login-remember input {
  width: 18px;
  height: 18px;
  accent-color: #087235;
}

.login-submit {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  min-height: 54px;
  margin-top: 8px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(180deg, #0b8b3a 0%, #005d2d 100%);
  box-shadow: 0 16px 30px rgba(0, 93, 45, 0.23);
  font-size: 24px;
  font-weight: 900;
  cursor: pointer;
}

.login-submit:hover {
  background: linear-gradient(180deg, #0a7f36 0%, #004f27 100%);
}

.login-submit svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-secure {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid #e3e8e4;
  color: #66746d;
  font-size: 14px;
  font-weight: 700;
}

.login-secure svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #0b8b3a;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-copyright {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #7a8780;
  font-size: 12px;
  font-weight: 650;
}

@media (max-width: 1100px) {
  .cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-grid,
  .dashboard-kpis,
  .quick-actions,
  .permission-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-balance,
  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .sales-panel {
    grid-row: auto;
  }

  .balance-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .error-metadata {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nota-summary-grid,
  .nota-detail-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nota-convert-card {
    grid-column: span 1;
  }

  .balance-strip div:nth-child(2) {
    border-right: 0;
  }

  .balance-strip div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 900px) {
  .report-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-page {
    grid-template-columns: 1fr;
    min-height: 100dvh;
    overflow: auto;
  }

  .login-visual {
    display: none;
  }

  .login-panel {
    min-height: 100dvh;
    padding: 24px 18px;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 62px auto minmax(0, 1fr);
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    grid-row: 2;
    position: static;
    height: auto;
    max-height: 70vh;
    padding: 12px;
  }

  .app-shell.sidebar-collapsed .sidebar {
    display: none;
  }

  .brand {
    margin-bottom: 10px;
  }

  .sidebar nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .nav-group {
    min-width: 190px;
  }

  .sidebar a {
    white-space: nowrap;
  }

  .topbar {
    min-height: 54px;
    padding: 0 14px;
    font-size: 16px;
  }

  .content {
    grid-row: 3;
  }

  .page {
    padding: 16px 12px 26px;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .nota-detail-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .nota-detail-actions {
    justify-content: flex-start;
  }

  .dashboard-header {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-actions {
    justify-content: flex-start;
  }

  .search-form {
    width: 100%;
  }

  .cols-3,
  .cols-4,
  .cols-2,
    .span-2,
    .permission-grid,
    .dashboard-kpis,
    .quick-actions,
    .kpi-grid,
    .nota-summary-grid,
    .nota-info-card,
    .nota-detail-columns {
    grid-template-columns: 1fr;
    grid-column: auto;
  }

  .dense-form {
    padding: 14px;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions .btn {
    flex: 1;
  }
}

@media (max-width: 560px) {
  .error-metadata {
    grid-template-columns: 1fr;
  }

  .notification-panel {
    position: fixed;
    top: 66px;
    right: 8px;
    left: 8px;
    width: auto;
  }

  .notification-panel::before {
    display: none;
  }

  .report-kpis {
    grid-template-columns: 1fr;
  }

  .report-heading {
    align-items: start;
    flex-direction: column;
  }

  .report-latest {
    text-align: left;
  }

  body {
    font-size: 12px;
  }

  .top-actions .text-muted {
    display: none;
  }

  .context-pill {
    display: none;
  }

  .search-form {
    flex-direction: column;
  }

  .data-grid {
    display: block;
    overflow-x: auto;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
  }

  .totals-strip {
    align-items: flex-end;
    flex-direction: column;
  }

  .form-totals,
  .log-grid,
  .balance-strip,
  .finance-summary {
    grid-template-columns: 1fr;
  }

  .balance-strip div,
  .balance-strip div:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .balance-strip div:last-child {
    border-bottom: 0;
  }

  .bar-row {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .bar-row strong {
    grid-column: 2;
    text-align: left;
  }

  .login-card {
    width: min(100%, 440px);
    padding: 18px 16px 16px;
    border-radius: 18px;
    gap: 8px;
  }

  .login-brand img {
    height: 112px;
    max-width: 88%;
  }

  .login-input-wrap {
    min-height: 50px;
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .login-options {
    gap: 10px;
    align-items: flex-start;
  }

  .login-submit {
    min-height: 52px;
    font-size: 22px;
  }

  .login-heading h2 {
    font-size: 28px;
  }
}

/* Cotizacion compacta */
.quote-form {
  display: grid;
  gap: 8px;
  max-width: 100%;
}

.quote-panel {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.quote-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
}

.quote-header-panel {
  position: relative;
  padding-right: 170px;
}

.quote-number {
  position: absolute;
  top: 10px;
  right: 12px;
  color: var(--accent-strong);
  font-size: 16px;
  line-height: 1.1;
}

.quote-general-grid,
.quote-client-summary,
.quote-product-picker,
.quote-notes-grid {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.quote-general-grid {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  margin: 0;
  padding: 0;
  border: 0;
}

.quote-general-grid label,
.quote-notes-grid label {
  min-width: 0;
}

.quote-general-grid span,
.quote-client-summary span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.quote-form .form-control,
.quote-form .form-select {
  min-height: 32px;
  padding-top: 5px;
  padding-bottom: 5px;
  font-size: 12px;
}

.quote-client-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  margin-bottom: 8px;
}

.quote-client-summary {
  grid-template-columns: minmax(160px, 1fr) minmax(110px, 0.45fr) minmax(220px, 1.4fr);
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.quote-client-summary div {
  min-width: 0;
}

.quote-client-summary strong,
.quote-inline-input {
  display: block;
  width: 100%;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-product-picker {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  margin-bottom: 8px;
}

.quote-product-search {
  min-width: 0;
}

.quote-product-search .producto-search-toggle {
  top: 5px;
}

.producto-search-option strong,
.producto-search-option span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.producto-search-option span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.quote-detail-fieldset,
.quote-detail-table-wrap {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  overflow-x: visible;
}

.quote-detail-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  margin-bottom: 0;
}

.quote-detail-table th,
.quote-detail-table td {
  padding: 5px;
  vertical-align: middle;
}

.quote-detail-table .detalle-item { width: 34px; }
.quote-detail-table .detalle-producto { width: auto; }
.quote-detail-table .detalle-unidad { width: 62px; }
.quote-detail-table .detalle-stock { width: 82px; }
.quote-detail-table .detalle-cantidad { width: 78px; }
.quote-detail-table .detalle-precio { width: 92px; }
.quote-detail-table .detalle-descuento { width: 82px; }
.quote-detail-table .detalle-total { width: 88px; }
.quote-detail-table .detalle-accion { width: 52px; }

.quote-detail-table .form-control,
.quote-detail-table .form-select {
  min-height: 28px;
  padding: 4px 6px;
  font-size: 12px;
}

.quote-row-number {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.quote-notes-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.quote-notes-grid textarea {
  resize: vertical;
  min-height: 70px;
}

.quote-total-strip {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 0;
}

.quote-bottom-actions {
  margin-top: 0;
}

@media (max-width: 1100px) {
  .quote-general-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quote-client-summary,
  .quote-notes-grid,
  .quote-total-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quote-total-strip .grand-total {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .quote-header-panel {
    padding-right: 12px;
  }

  .quote-number {
    position: static;
    display: block;
    margin-bottom: 8px;
  }

  .quote-general-grid,
  .quote-client-summary,
  .quote-product-picker,
  .quote-notes-grid,
  .quote-total-strip {
    grid-template-columns: minmax(0, 1fr);
  }

  .quote-total-strip .grand-total {
    grid-column: auto;
  }

  .quote-detail-table th,
  .quote-detail-table td {
    padding: 4px 3px;
  }

  .quote-detail-table .detalle-item,
  .quote-detail-table .detalle-unidad,
  .quote-detail-table .detalle-stock {
    display: none;
  }
}

.producto-search-option.active,
.producto-search-option.active:hover,
.producto-search-option.active:focus {
  background: #dcefe5;
  outline: 2px solid rgba(22, 99, 58, 0.18);
}

.producto-search-option em {
  display: block;
  margin-top: 2px;
  color: var(--accent-strong);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

.quote-detail-table tr.stock-warning td {
  background: #fff8e5;
}

.quote-detail-table tr.stock-warning .cantidad-input {
  border-color: #d49500;
  color: #8a5a00;
}

.quote-detail-table tr.quantity-warning .cantidad-input {
  border-color: var(--danger);
  color: var(--danger);
}

.quote-detail-table tr.product-merged td {
  animation: productMergedPulse 0.55s ease-out;
}

@keyframes productMergedPulse {
  0% { background: #dff4e8; }
  100% { background: transparent; }
}



/* Estilo uniforme para texto y fechas en documentos */
.quote-form .quote-general-grid label,
.quote-form .quote-notes-grid label {
  display: grid;
  gap: 4px;
}

.quote-form .quote-general-grid span,
.quote-form .quote-notes-grid span,
.quote-form .quote-client-search span {
  margin-bottom: 0;
  color: var(--text);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.15;
}

.quote-form label b {
  color: var(--danger);
  font-weight: 900;
}

.quote-form .quote-general-grid .form-control,
.quote-form .quote-general-grid .form-select,
.quote-form .quote-client-search .form-control,
.quote-form .quote-observations-input {
  min-height: 34px;
  padding: 4px 10px;
  border: 1px solid #d6e3dc;
  border-radius: 10px;
  background-color: #fff;
  color: var(--text);
  font-size: 11px;
  font-weight: 850;
}

.quote-form .quote-general-grid input[type="date"] {
  font-variant-numeric: tabular-nums;
}

.quote-client-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
/* Mejoras visuales para captura rapida de productos */
.quote-form .form-control,
.quote-form .form-select,
.quote-inline-input {
  width: 100%;
  border: 1px solid #d6e3dc;
  border-radius: 10px;
  background-color: #fbfdfc;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 1px 2px rgba(17, 34, 28, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.quote-form .form-control:hover,
.quote-form .form-select:hover {
  border-color: #b7cdc3;
  background-color: #fff;
}

.quote-form .form-control:focus,
.quote-form .form-select:focus {
  border-color: var(--accent);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(28, 125, 73, 0.14);
}

.quote-form .form-control[readonly],
.quote-form .form-control:read-only:not(.producto-grid-search) {
  background-color: #f8fbf9;
  color: var(--text);
}

.quote-product-picker {
  grid-template-columns: minmax(520px, 1fr) 170px;
  gap: 10px;
}

.quote-product-search {
  position: relative;
  display: grid;
  min-width: 0;
  width: 100%;
}

.quote-product-search .producto-grid-search {
  width: 100%;
  height: 42px;
  padding: 8px 42px 8px 14px;
  border-radius: 12px;
  font-size: 14px;
}

.quote-product-search .producto-search-toggle {
  top: 7px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-left: 0;
  border-radius: 8px;
  color: var(--accent-strong);
  background: #eef8f2;
}

.quote-product-search .producto-search-toggle:hover {
  background: #dff2e7;
}

.quote-product-picker .product-grid-add {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  white-space: nowrap;
}

.quote-detail-table {
  border-collapse: separate;
  border-spacing: 0;
}

.quote-detail-table .detalle-item { width: 34px; }
.quote-detail-table .detalle-producto { width: 42%; }
.quote-detail-table .detalle-unidad { width: 62px; }
.quote-detail-table .detalle-stock { width: 78px; }
.quote-detail-table .detalle-cantidad { width: 74px; }
.quote-detail-table .detalle-precio { width: 90px; }
.quote-detail-table .detalle-descuento { width: 78px; }
.quote-detail-table .detalle-total { width: 86px; }
.quote-detail-table .detalle-accion { width: 50px; }

.quote-detail-table td {
  background: #fff;
}

.quote-detail-table tbody tr:first-child td:first-child {
  border-top-left-radius: 12px;
}

.quote-detail-table tbody tr:first-child td:last-child {
  border-top-right-radius: 12px;
}

.quote-detail-table .producto-search {
  min-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-detail-table .unidad-input,
.quote-detail-table .stock-input,
.quote-detail-table .line-total {
  background-color: #f8fbf9;
  font-weight: 800;
}

.quote-detail-table .cantidad-input,
.quote-detail-table .precio-input,
.quote-detail-table .descuento-input {
  background-color: #fff;
  font-weight: 750;
}

@media (max-width: 1100px) {
  .quote-product-picker {
    grid-template-columns: minmax(0, 1fr) 150px;
  }

  .quote-detail-table .detalle-producto {
    width: 36%;
  }
}

@media (max-width: 760px) {
  .quote-product-picker {
    grid-template-columns: minmax(0, 1fr);
  }

  .quote-detail-table .producto-search {
    min-width: 124px;
  }
}

/* Totales de cotizacion en una sola linea */
.quote-total-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.quote-total-strip > div {
  min-width: 0;
  min-height: 88px;
  padding: 16px 18px;
}

.quote-total-strip > div span,
.quote-total-strip > div strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-total-strip > div strong {
  font-size: 24px;
  text-align: right;
}

.quote-total-strip .grand-total {
  grid-column: auto;
}

@media (max-width: 1100px) {
  .quote-total-strip {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
  }

  .quote-total-strip > div {
    min-height: 76px;
    padding: 12px 10px;
  }

  .quote-total-strip > div span {
    font-size: 10px;
  }

  .quote-total-strip > div strong {
    font-size: 18px;
  }

  .quote-total-strip .grand-total {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .quote-total-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quote-total-strip .grand-total {
    grid-column: span 2;
  }
}

/* Barra compacta de totales estilo cotizacion */
.quote-total-strip {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) minmax(140px, 1fr) minmax(120px, 0.9fr) minmax(190px, 1.15fr);
  gap: 0;
  align-items: stretch;
  overflow: hidden;
  margin-top: 0;
  padding: 8px;
  border: 1px solid #dfeae4;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(16, 33, 27, 0.06);
}

.quote-total-strip > div {
  display: grid;
  align-content: center;
  gap: 7px;
  min-width: 0;
  min-height: 66px;
  padding: 8px 22px;
  border: 0;
  border-right: 1px solid #e1ebe6;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.quote-total-strip > div span {
  color: #31423d;
  font-size: 11px;
  font-weight: 850;
  text-align: center;
  text-transform: none;
}

.quote-total-strip > div strong {
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}

.quote-total-strip .grand-total {
  grid-column: auto;
  gap: 4px;
  min-height: 66px;
  border-right: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #0f9852, #10673f);
  color: #fff;
}

.quote-total-strip .grand-total span,
.quote-total-strip .grand-total strong {
  color: #fff;
  text-align: center;
}

.quote-total-strip .grand-total span {
  font-size: 12px;
  text-transform: uppercase;
}

.quote-total-strip .grand-total strong {
  font-size: 26px;
}

@media (max-width: 1100px) {
  .quote-total-strip {
    grid-template-columns: minmax(95px, 1fr) minmax(95px, 1fr) minmax(110px, 1fr) minmax(95px, 0.9fr) minmax(150px, 1.1fr);
    padding: 6px;
  }

  .quote-total-strip > div {
    min-height: 38px;
    padding: 7px 10px;
  }

  .quote-total-strip > div span {
    font-size: 10px;
  }

  .quote-total-strip > div strong {
    font-size: 14px;
  }

  .quote-total-strip .grand-total {
    grid-column: auto;
  }

  .quote-total-strip .grand-total strong {
    font-size: 21px;
  }
}

@media (max-width: 760px) {
  .quote-total-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quote-total-strip > div:nth-child(2n) {
    border-right: 0;
  }

  .quote-total-strip .grand-total {
    grid-column: span 2;
  }
}

/* Resumen informativo de cliente en una sola fila */
.quote-client-summary-line {
  grid-template-columns: minmax(170px, 1.25fr) minmax(110px, 0.7fr) minmax(115px, 0.75fr) minmax(160px, 1fr) minmax(260px, 1.7fr);
  gap: 18px;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid #edf3ef;
  border-radius: 10px;
  background: #f8fbf9;
}

.quote-client-summary-line div {
  min-width: 0;
}

.quote-client-summary-line span {
  margin-bottom: 4px;
  color: #475d55;
  font-size: 11px;
  font-weight: 850;
}

.quote-client-summary-line strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-client-summary-line .client-name-block strong {
  font-size: 14px;
  font-weight: 900;
}

#clienteResumenDireccion {
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .quote-client-summary-line {
    grid-template-columns: minmax(160px, 1.2fr) minmax(100px, 0.7fr) minmax(110px, 0.75fr) minmax(140px, 1fr) minmax(210px, 1.4fr);
    gap: 10px;
    padding: 10px 12px;
  }
}

@media (max-width: 760px) {
  .quote-client-summary-line {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Ajuste final: totales compactos en una sola linea */
.quote-total-strip {
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 8px !important;
  padding: 8px !important;
  align-items: stretch;
}

.quote-total-strip > div {
  min-height: 54px !important;
  padding: 8px 10px !important;
  gap: 3px !important;
  border-right: 0 !important;
  border-radius: 8px !important;
}

.quote-total-strip > div span {
  font-size: 10px !important;
  line-height: 1.1 !important;
}

.quote-total-strip > div strong {
  font-size: 18px !important;
  line-height: 1.05 !important;
}

.quote-total-strip .grand-total {
  grid-column: auto !important;
  min-height: 54px !important;
}

.quote-total-strip .grand-total strong {
  font-size: 22px !important;
}

@media (max-width: 760px) {
  .quote-total-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .quote-total-strip .grand-total {
    grid-column: span 2 !important;
  }
}

/* Observaciones compactas de cotizacion */
.quote-observations-panel {
  display: grid;
  padding-block: 10px;
}

.quote-observations-input {
  display: block;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  min-height: 38px;
  resize: vertical;
}

/* Motor configurable de documentos */
.document-config-shell {
  display: grid;
  gap: 16px;
  padding: 2px 0 22px;
}

.document-config-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.document-config-hero-copy {
  display: flex;
  align-items: center;
  gap: 14px;
}

.document-config-hero-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #e9f8ef;
  color: #0f8b55;
}

.document-config-hero-icon svg,
.document-config-block-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.document-config-hero h1 {
  margin: 0;
  font-size: 24px;
  color: #12233f;
}

.document-config-hero p,
.document-config-card-head p {
  margin: 3px 0 0;
  color: #52627a;
  font-size: 12px;
  font-weight: 600;
}

.document-config-help {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #b8dfc9;
  border-radius: 8px;
  color: #0b6840;
  background: #fbfffd;
  padding: 0 14px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 1px 2px rgba(15, 34, 57, .05);
}

.document-config-help span {
  width: 16px;
  height: 16px;
  border: 1px solid currentColor;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 11px;
}

.document-config-type-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
}

.document-config-type {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  color: #172843;
  font-weight: 800;
  padding: 0 22px;
  text-decoration: none;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 34, 57, .04);
}

.document-config-type.active {
  background: #078646;
  border-color: #078646;
  color: #fff;
  box-shadow: 0 8px 18px rgba(7, 134, 70, .18);
}

.document-config-type.disabled {
  color: #52627a;
  background: #fff;
  opacity: .72;
}

.document-config-namebar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.2fr);
  gap: 12px;
  margin-bottom: 14px;
}

.document-config-namebar label {
  display: grid;
  gap: 5px;
  margin: 0;
  color: #152941;
  font-size: 11px;
  font-weight: 800;
}

.document-config-layout {
  display: grid;
  grid-template-columns: minmax(260px, 310px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 14px;
}

.document-config-card {
  background: #fff;
  border: 1px solid #dbe5ee;
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(15, 34, 57, .06);
}

.document-config-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 12px;
}

.document-config-card-head h2 {
  margin: 0;
  color: #12233f;
  font-size: 16px;
}

.document-config-block-list {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px;
}

.document-config-block {
  min-height: 56px;
  display: grid;
  grid-template-columns: 12px 18px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 7px;
  border: 1px solid #dfe7ef;
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 34, 57, .04);
}

.document-config-block.active {
  border-color: #078646;
  box-shadow: 0 0 0 1px rgba(7, 134, 70, .16), 0 8px 18px rgba(15, 34, 57, .06);
}

.document-config-drag {
  color: #93a1b4;
  font-size: 15px;
  letter-spacing: -2px;
  transform: rotate(90deg);
}

.document-config-block-visible {
  margin: 0;
  display: grid;
  place-items: center;
}

.document-config-block-visible input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.document-config-block-visible span,
.document-config-check-cell .form-check-input {
  width: 15px;
  height: 15px;
  border: 1px solid #c7d1dc;
  border-radius: 4px;
  display: inline-grid;
  place-items: center;
  background: #fff;
}

.document-config-block-visible input:checked + span {
  background: #078646;
  border-color: #078646;
}

.document-config-block-visible input:checked + span::after {
  content: "";
  width: 7px;
  height: 4px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

.document-config-block-select {
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0;
  color: inherit;
}

.document-config-block-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.document-config-block-copy strong {
  color: #142941;
  font-size: 11px;
  line-height: 1.15;
}

.document-config-block-copy small,
.document-config-field-table small {
  color: #60718a;
  font-size: 9px;
  font-weight: 700;
}

.document-config-order {
  min-height: 30px !important;
  border-radius: 7px !important;
  font-size: 10px !important;
  font-weight: 800 !important;
}

.document-config-add-section {
  min-height: 42px;
  margin: 0 14px 16px;
  border: 1px dashed #078646;
  border-radius: 8px;
  background: #fbfffd;
  color: #078646;
  font-weight: 800;
}

.document-config-field-panel {
  display: block;
}

.document-config-form.js-document-config-ready .document-config-field-panel {
  display: none;
}

.document-config-form.js-document-config-ready .document-config-field-panel.active {
  display: block;
}

.document-config-fields-head {
  padding-bottom: 14px;
}

.document-config-reset {
  min-height: 36px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
  color: #31435f;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 800;
}

.document-config-field-table {
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.document-config-field-table thead th {
  background: #f4f7fb;
  border-top: 1px solid #e5ebf2;
  border-bottom: 1px solid #e5ebf2;
  color: #172843;
  font-size: 9px;
  text-transform: uppercase;
  padding: 10px 10px;
  white-space: nowrap;
}

.document-config-field-table tbody td {
  border-bottom: 1px solid #e9eef4;
  padding: 9px 10px;
  vertical-align: middle;
}

.document-config-field-table tbody tr:last-child td {
  border-bottom: 0;
}

.document-config-field-name {
  min-width: 124px;
}

.document-config-field-name strong {
  display: block;
  color: #1d3048;
  font-size: 11px;
}

.document-config-field-table .form-control,
.document-config-field-table .form-select,
.document-config-namebar .form-control {
  min-height: 32px;
  border-color: #dbe3ec;
  border-radius: 7px;
  color: #1c2d45;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(15, 34, 57, .03);
}

.document-config-width-select {
  min-width: 124px;
}

.document-config-check-cell .form-check-input {
  float: none;
  margin: 0;
  border-radius: 4px;
}

.document-config-check-cell .form-check-input:checked {
  background-color: #078646;
  border-color: #078646;
}

.document-config-check-cell .form-check-input:disabled {
  background-color: #e5eaf0;
  opacity: 1;
}

.compact-switch {
  min-height: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 11px;
  font-weight: 700;
}

.compact-field {
  display: grid;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
}

.document-config-product-behavior {
  border-top: 1px solid #e5ebf2;
  margin: 0;
  padding: 14px 18px 18px;
  display: grid;
  gap: 10px;
}

.document-config-conditions {
  margin-top: 14px;
}

.document-config-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

@media (max-width: 980px) {
  .document-config-layout,
  .document-config-namebar {
    grid-template-columns: 1fr;
  }

  .document-config-hero {
    align-items: flex-start;
    flex-direction: column;
  }
}
/* Correccion motor configurable: anchos reales en cotizacion */
.quote-general-row {
  display: grid !important;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
  margin: 0 !important;
}

.quote-general-row > label {
  width: auto !important;
  max-width: none !important;
  min-width: 0;
  padding: 0 !important;
  grid-column: span 3;
}

.quote-general-row > .col-md-1 { grid-column: span 1; }
.quote-general-row > .col-md-2 { grid-column: span 2; }
.quote-general-row > .col-md-3 { grid-column: span 3; }
.quote-general-row > .col-md-4 { grid-column: span 4; }
.quote-general-row > .col-md-5 { grid-column: span 5; }
.quote-general-row > .col-md-6 { grid-column: span 6; }
.quote-general-row > .col-md-7 { grid-column: span 7; }
.quote-general-row > .col-md-8 { grid-column: span 8; }
.quote-general-row > .col-md-9 { grid-column: span 9; }
.quote-general-row > .col-md-10 { grid-column: span 10; }
.quote-general-row > .col-md-11 { grid-column: span 11; }
.quote-general-row > .col-md-12 { grid-column: span 12; }

.quote-detail-table {
  table-layout: fixed !important;
}

.quote-detail-table th,
.quote-detail-table td {
  min-width: 0;
  overflow: hidden;
}

.quote-detail-table .form-control,
.quote-detail-table .form-select,
.quote-detail-table .producto-search {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

.quote-detail-table [data-field="Producto"] .producto-search {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .quote-general-row > label,
  .quote-general-row > [class*="col-md-"] {
    grid-column: span 12;
  }
}



.document-config-type-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 0.75rem;
}

.document-config-type {
    border: 1px solid var(--border, #d8e4dd);
    border-radius: 999px;
    color: #19332b;
    font-weight: 700;
    padding: 0.4rem 0.85rem;
    text-decoration: none;
    background: #fff;
}

.document-config-type.active {
    background: #11643f;
    border-color: #11643f;
    color: #fff;
}



.document-config-field-table td:nth-child(2) .form-control {
  min-width: 120px;
  max-width: 150px;
}

.document-config-field-table td:nth-last-child(2) .document-config-order {
  width: 56px;
  min-width: 56px;
}

.document-config-field-table td:last-child .document-config-width-select {
  width: 132px;
  min-width: 132px;
}

.document-config-fields .table-responsive {
  overflow-x: auto;
}


.document-config-block > .document-config-order {
  width: 38px !important;
  min-width: 38px !important;
  max-width: 38px !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 !important;
  text-align: center !important;
  font-size: 10px !important;
  border-color: #cfd9d3 !important;
  color: #19332b !important;
  background: #fff !important;
  box-shadow: none !important;
}

.document-config-block > .document-config-order::-webkit-outer-spin-button,
.document-config-block > .document-config-order::-webkit-inner-spin-button {
  margin: 0;
}
.provider-payment-form {
  display: grid;
  gap: 8px;
  max-width: 100%;
}

.payment-block {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.payment-block h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
}

.payment-info-grid,
.payment-data-grid {
  display: grid;
  gap: 14px 18px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.payment-data-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.payment-info-grid label,
.payment-data-grid label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.payment-info-grid label span,
.payment-data-grid label span {
  color: var(--text);
  font-size: .82rem;
  font-weight: 800;
}

.payment-info-grid .form-control,
.payment-data-grid .form-control,
.payment-data-grid .form-select {
  min-height: 42px;
}
.provider-payment-form .payment-info-grid label span,
.provider-payment-form .payment-data-grid label span {
  margin-bottom: 0;
  color: var(--text);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.15;
}

.provider-payment-form .form-control,
.provider-payment-form .form-select {
  width: 100%;
  min-height: 34px;
  padding: 4px 10px;
  border: 1px solid #d6e3dc;
  border-radius: 10px;
  background-color: #fff;
  color: var(--text);
  font-size: 11px;
  font-weight: 850;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 1px 2px rgba(17, 34, 28, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.provider-payment-form textarea.form-control {
  min-height: 58px;
  resize: vertical;
}

.provider-payment-form .form-control:hover,
.provider-payment-form .form-select:hover {
  border-color: #b7cdc3;
  background-color: #fff;
}

.provider-payment-form .form-control:focus,
.provider-payment-form .form-select:focus {
  border-color: var(--accent);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(28, 125, 73, 0.14);
}

.provider-payment-form .form-control[readonly],
.provider-payment-form .form-control:read-only {
  background-color: #f8fbf9;
  color: var(--text);
}

.provider-payment-form small {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 400;
}

.payment-observation {
  grid-column: span 2;
}

.payment-summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.payment-kpi {
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 2px;
  min-height: 54px;
  padding: 9px 14px;
}

.payment-kpi small {
  font-size: .7rem;
  font-weight: 800;
}

.payment-kpi strong {
  color: var(--text);
  font-size: 1.08rem;
  line-height: 1.05;
}

.payment-kpi em {
  color: var(--muted);
  font-size: .75rem;
  font-style: normal;
}

.payment-kpi.success { background: #effaf4; border-color: #c8ead6; }
.payment-kpi.info { background: #eef7ff; border-color: #c9dff8; }
.payment-kpi.warning { background: #fff8e8; border-color: #f0d896; }
.payment-kpi.purple { background: #f8f2ff; border-color: #decdf7; }
.payment-kpi.success small { color: #08763f; }
.payment-kpi.info small { color: #1d5fa7; }
.payment-kpi.warning small { color: #9a5b00; }
.payment-kpi.purple small { color: #673ab7; }
.provider-payment-form .payment-kpi small {
  font-size: 10px;
  font-weight: 900;
  line-height: 1.15;
}

.provider-payment-form .payment-kpi strong {
  font-weight: 850;
}

.payment-footer-actions {
  border-top: 1px solid var(--line);
  justify-content: flex-end;
  margin-top: 8px;
  padding-top: 14px;
}
.payment-toggle-row {
  display: flex;
  justify-content: flex-end;
}

.payment-application-toggle {
  min-height: 36px;
}
.payment-note {
  background: #eef7ff;
  border: 1px solid #b9dcff;
  border-radius: 6px;
  color: #1d5fa7;
  font-size: .82rem;
  font-weight: 700;
  margin: 0 0 14px;
  padding: 10px 12px;
}

.payment-application-table {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
}

.payment-application-head,
.payment-application-row {
  display: grid;
  gap: 12px;
  grid-template-columns: 1.1fr .8fr .9fr .9fr 1fr 1fr;
  padding: 12px 14px;
}

.payment-application-head {
  background: var(--surface-soft);
  color: var(--text);
  font-size: .7rem;
  font-weight: 800;
}

.payment-application-row {
  align-items: center;
  font-size: .88rem;
}

.payment-total-apply {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  margin-top: 14px;
}

.payment-total-apply span {
  font-weight: 800;
}

.payment-total-apply strong {
  color: var(--green);
  font-size: 1.2rem;
}


@media (max-width: 1100px) {
  .payment-info-grid,
  .payment-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .payment-data-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .payment-block {
    padding: 14px;
  }

  .payment-info-grid,
  .payment-data-grid,
  .payment-summary-grid,

  .payment-observation {
    grid-column: auto;
  }

  .payment-application-head {
    display: none;
  }

  .payment-application-row {
    grid-template-columns: 1fr;
  }
}

.purchase-detail-shell {
  display: grid;
  gap: 14px;
}

.purchase-detail-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffffff 0%, #f4faf6 100%);
  box-shadow: var(--shadow);
}

.purchase-detail-eyebrow {
  display: inline-flex;
  margin-bottom: 4px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.purchase-detail-hero h2 {
  margin: 0;
  color: var(--text);
  font-size: 25px;
  line-height: 1.1;
}

.purchase-detail-hero p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.purchase-detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.purchase-detail-actions .document-save-btn,
.purchase-detail-actions .document-more-btn {
  min-height: 38px;
  padding: 9px 15px;
}

.purchase-detail-actions .document-more-btn.danger {
  color: #d8212f;
}

.purchase-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.purchase-kpi {
  display: grid;
  gap: 5px;
  min-height: 92px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.purchase-kpi span,
.purchase-info-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.purchase-kpi strong {
  color: var(--text);
  font-size: 24px;
  line-height: 1.05;
}

.purchase-kpi small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.purchase-kpi.primary { background: #eef7ff; }
.purchase-kpi.success { background: #edf9f1; }
.purchase-kpi.warning { background: #fff8e8; }
.purchase-kpi.neutral { background: #f4f8f5; }

.purchase-detail-panel {
  padding: 14px 16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.purchase-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
}

.purchase-info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.purchase-info-grid div {
  display: grid;
  gap: 4px;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid #dbe8df;
  border-radius: 8px;
  background: #fbfdfb;
}

.purchase-info-grid strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1.2;
}

.purchase-info-wide {
  grid-column: span 2;
}

.purchase-table-wrap {
  overflow-x: auto;
}

.purchase-detail-table {
  min-width: 860px;
}

.purchase-detail-table td strong {
  color: var(--text);
}

@media (max-width: 1100px) {
  .purchase-kpi-grid,
  .purchase-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .purchase-detail-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .purchase-detail-actions {
    justify-content: stretch;
  }

  .purchase-detail-actions .document-save-btn,
  .purchase-detail-actions .document-more-btn,
  .purchase-detail-actions form {
    width: 100%;
  }

  .purchase-detail-actions form button {
    width: 100%;
  }

  .purchase-kpi-grid,
  .purchase-info-grid {
    grid-template-columns: 1fr;
  }

  .purchase-info-wide {
    grid-column: auto;
  }
}
/* Design System - document detail surfaces */
.ds-document-shell {
  display: grid;
  gap: 14px;
}

.ds-document-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 2px 4px;
}

.ds-document-title {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.ds-document-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.1;
}

.ds-document-eyebrow .document-section-icon {
  width: 34px;
  height: 34px;
  background: #e6f5eb;
}

.ds-document-number {
  margin: 0;
  color: #15231f;
  font-size: clamp(24px, 2.2vw, 31px);
  line-height: 1.05;
  letter-spacing: 0;
}

.ds-document-subtitle {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.ds-document-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.ds-action,
.ds-document-actions .btn,
.ds-document-actions .document-save-btn,
.ds-document-actions .document-more-btn,
.ds-document-actions .nota-back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  box-shadow: none;
  font-size: 13px;
  font-weight: 850;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.ds-action svg,
.ds-document-actions svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ds-action.primary,
.ds-document-actions .document-save-btn,
.ds-document-actions .btn-primary {
  border-color: #0f7a42;
  color: #fff;
  background: linear-gradient(180deg, #168b4a, #0f6d39);
}

.ds-action.outline,
.ds-document-actions .btn-outline-secondary,
.ds-document-actions .document-more-btn {
  color: var(--accent-strong);
  border-color: #b8d9c5;
  background: #fff;
}

.ds-action.ghost,
.ds-document-actions .nota-back-link {
  color: var(--text);
  background: #fff;
}

.ds-action.danger,
.ds-document-actions .danger {
  color: #d8212f;
  border-color: #ffd2d7;
  background: #fff8f9;
}

.ds-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.ds-kpi {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 88px;
  padding: 18px 18px 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.ds-kpi::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent);
}

.ds-kpi.blue::before { background: #2878d8; }
.ds-kpi.orange::before { background: #f59e0b; }
.ds-kpi.red::before { background: #d8212f; }
.ds-kpi.purple::before { background: #7c3aed; }
.ds-kpi.neutral::before { background: #7b8580; }

.ds-kpi-copy {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.ds-kpi small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.ds-kpi strong {
  color: var(--text);
  font-size: clamp(20px, 1.8vw, 28px);
  line-height: 1.05;
}

.ds-kpi em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
}

.ds-kpi-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  align-self: center;
  border-radius: 8px;
  color: var(--accent-strong);
  background: #e4f4ea;
}

.ds-kpi.blue .ds-kpi-icon { color: #2563eb; background: #eaf2ff; }
.ds-kpi.orange .ds-kpi-icon { color: #d97706; background: #fff4df; }
.ds-kpi.red .ds-kpi-icon { color: #d8212f; background: #fff0f2; }
.ds-kpi.purple .ds-kpi-icon { color: #6d3cc5; background: #f3ecff; }
.ds-kpi.neutral .ds-kpi-icon { color: #596861; background: #f1f5f2; }

.ds-kpi-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ds-panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.34fr);
  gap: 14px;
  align-items: start;
}

.ds-side-stack {
  display: grid;
  gap: 14px;
}

.ds-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.ds-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--text);
  font-size: 16px;
  font-weight: 850;
}

.ds-panel-title .document-section-icon {
  width: 30px;
  height: 30px;
}

.ds-info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 18px;
}

.ds-info-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ds-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.ds-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.ds-field strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.ds-field.wide { grid-column: span 2; }
.ds-field.full { grid-column: 1 / -1; }

.ds-table-wrap {
  overflow-x: auto;
  border: 1px solid #e2ece6;
  border-radius: 8px;
}

.ds-table {
  width: 100%;
  min-width: 760px;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.ds-table th {
  padding: 10px 12px;
  color: #20332c;
  background: #eef6f1;
  border-bottom: 1px solid #dbe8df;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.ds-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #edf2ef;
  vertical-align: middle;
}

.ds-table tbody tr:last-child td {
  border-bottom: 0;
}

.ds-table tbody tr:hover td {
  background: #fbfdfb;
}

.ds-table .ds-total-row td {
  color: var(--accent-strong);
  background: #f4fbf6;
  font-weight: 900;
  text-transform: uppercase;
}

.ds-note-card {
  min-height: 76px;
  padding: 14px;
  border: 1px solid #dbe8df;
  border-radius: 8px;
  color: var(--muted);
  background: linear-gradient(180deg, #f9fdfb, #eef6f1);
  font-size: 13px;
  line-height: 1.35;
}

.ds-timeline {
  position: relative;
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 2px 0 2px 18px;
  list-style: none;
}

.ds-timeline::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 5px;
  width: 2px;
  background: #dce9e2;
}

.ds-timeline-item {
  position: relative;
  display: grid;
  gap: 4px;
}

.ds-timeline-item::before {
  content: "";
  position: absolute;
  top: 5px;
  left: -17px;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px #b9dcc8;
}

.ds-timeline-item strong {
  color: var(--text);
  font-size: 13px;
}

.ds-timeline-item span,
.ds-timeline-item small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.ds-status,
.ds-status.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  min-height: 24px;
  padding: 5px 11px;
  border-radius: 8px;
  color: #08763f;
  background: #dff4e7;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.ds-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.ds-status.warning { color: #b76a00; background: #fff0d3; }
.ds-status.danger { color: #d8212f; background: #ffe1e6; }
.ds-status.info { color: #1565a8; background: #e2f2ff; }
.ds-status.neutral { color: #596861; background: #eef3f0; }

@media (max-width: 1180px) {
  .ds-kpi-grid,
  .ds-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ds-panel-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .ds-document-header {
    flex-direction: column;
  }

  .ds-document-actions,
  .ds-document-actions form,
  .ds-action,
  .ds-document-actions .btn,
  .ds-document-actions .document-save-btn,
  .ds-document-actions .document-more-btn,
  .ds-document-actions .nota-back-link {
    width: 100%;
  }

  .ds-kpi-grid,
  .ds-info-grid,
  .ds-info-grid.compact {
    grid-template-columns: 1fr;
  }

  .ds-field.wide,
  .ds-field.full {
    grid-column: auto;
  }

  .ds-panel {
    padding: 14px;
  }
}
/* Design System refinado para detalles/documentos */
.ds-document-shell {
  gap: 12px;
  padding: 2px 0 18px;
}

.ds-document-header {
  align-items: center;
  gap: 16px;
  padding: 6px 2px 8px;
}

.ds-document-title {
  gap: 5px;
}

.ds-document-eyebrow {
  gap: 8px;
  font-size: 16px;
  font-weight: 900;
}

.ds-document-eyebrow .document-section-icon,
.ds-panel-title .document-section-icon {
  border-radius: 8px;
}

.ds-document-number-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.ds-document-number {
  font-size: clamp(25px, 2.1vw, 32px);
  font-weight: 950;
}

.ds-document-subtitle {
  color: #3c4d47;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.ds-document-actions {
  gap: 12px;
}

.ds-action,
.ds-document-actions .btn,
.ds-document-actions .document-save-btn,
.ds-document-actions .document-more-btn,
.ds-document-actions .nota-back-link {
  min-height: 38px;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 1px 2px rgba(15, 34, 57, .04);
}

.ds-action.primary,
.ds-document-actions .document-save-btn,
.ds-document-actions .btn-primary {
  background: #08763f;
  border-color: #08763f;
}

.ds-action.outline,
.ds-document-actions .btn-outline-secondary,
.ds-document-actions .document-more-btn {
  border-color: #a8d8bc;
  color: #08763f;
}

.ds-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid #dce9e2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 34, 57, .05);
}

.ds-kpi {
  min-height: 70px;
  padding: 13px 18px;
  border: 0;
  border-radius: 0;
  border-right: 1px solid #e3ece7;
  background: #fff;
  box-shadow: none;
}

.ds-kpi:last-child,
.ds-kpi:nth-child(4n) {
  border-right: 0;
}

.ds-kpi::before {
  display: none;
}

.ds-kpi-copy {
  gap: 5px;
}

.ds-kpi small {
  color: #566a63;
  font-size: 11px;
  letter-spacing: 0;
}

.ds-kpi strong {
  font-size: clamp(18px, 1.45vw, 24px);
  font-weight: 950;
}

.ds-kpi.orange strong { color: #ef7d00; }
.ds-kpi.blue strong { color: #155fc5; }

.ds-kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 7px;
}

.ds-panel,
.ds-tabs-panel {
  border: 1px solid #dce9e2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 34, 57, .045);
}

.ds-panel {
  padding: 14px;
}

.ds-panel-title {
  gap: 9px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 950;
}

.ds-panel-title .document-section-icon {
  width: 28px;
  height: 28px;
}

.ds-info-grid {
  gap: 12px 22px;
}

.ds-field {
  padding-right: 18px;
  border-right: 1px solid #e7eee9;
}

.ds-field:nth-child(4n),
.ds-field.full,
.ds-field:last-child {
  border-right: 0;
}

.ds-field span {
  color: #566a63;
  font-size: 10px;
  letter-spacing: 0;
}

.ds-field strong {
  font-size: 13px;
  font-weight: 900;
}

.ds-document-content {
  display: grid;
  gap: 12px;
}

.ds-products-panel {
  padding-bottom: 12px;
}

.ds-table-wrap {
  border-color: #e0ece5;
  border-radius: 7px;
}

.ds-table {
  font-size: 11px;
}

.ds-table th {
  padding: 10px 12px;
  background: #f3f7f5;
  border-color: #e3ece7;
  color: #20332c;
  font-size: 10px;
  letter-spacing: 0;
}

.ds-table td {
  padding: 10px 12px;
  border-color: #edf3ef;
}

.ds-table .ds-total-row td {
  color: #08763f;
  background: #f5fbf7;
}

.ds-tabs-panel {
  padding: 0;
}

.ds-tabs {
  display: grid;
  grid-template-columns: max-content max-content minmax(0, 1fr);
  align-items: stretch;
}

.ds-tabs > input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ds-tabs > label {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 20px;
  border-right: 1px solid #e1ebe6;
  border-bottom: 1px solid #e1ebe6;
  color: #334941;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.ds-tabs > input:checked + label {
  color: #08763f;
  background: #f6fbf8;
  border-bottom-color: #08763f;
  box-shadow: inset 0 -2px 0 #08763f;
}

.ds-tab-content {
  display: none;
  grid-column: 1 / -1;
  padding: 12px;
}

#notaPedidoTabCobros:checked ~ .ds-tab-cobros,
#notaPedidoTabComprobantes:checked ~ .ds-tab-comprobantes {
  display: block;
}

.ds-note-card {
  min-height: 58px;
  border-color: #e0ece5;
  background: #f8fbf9;
  font-size: 12px;
}

.ds-status,
.ds-status.status-badge {
  min-height: 22px;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 11px;
}

@media (max-width: 1180px) {
  .ds-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ds-kpi:nth-child(2n) {
    border-right: 0;
  }

  .ds-field {
    border-right: 0;
  }
}

@media (max-width: 720px) {
  .ds-document-header {
    align-items: stretch;
  }

  .ds-kpi-grid,
  .ds-info-grid,
  .ds-info-grid.compact {
    grid-template-columns: 1fr;
  }

  .ds-kpi {
    border-right: 0;
    border-bottom: 1px solid #e3ece7;
  }

  .ds-kpi:last-child {
    border-bottom: 0;
  }

  .ds-tabs {
    grid-template-columns: 1fr;
  }

  .ds-tabs > label {
    border-right: 0;
  }
}
#cotizacionTabObservaciones:checked ~ .ds-tab-observaciones,
#cotizacionTabDocumentos:checked ~ .ds-tab-documentos,
#comprobanteTabCobros:checked ~ .ds-tab-cobros,
#comprobanteTabObservaciones:checked ~ .ds-tab-observaciones,
#comprobanteTabDocumentos:checked ~ .ds-tab-documentos {
  display: block;
}

#cobroTabAplicaciones:checked ~ .ds-tab-aplicaciones,
#notaCreditoTabSustento:checked ~ .ds-tab-sustento,
#notaCreditoTabRelacionados:checked ~ .ds-tab-relacionados {
  display: block;
}
.row-actions-panel a {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  text-decoration: none;
  font-size: 13px;
  font-weight: 850;
}

.row-actions-panel a svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.row-actions-panel a:hover {
  color: var(--accent-strong);
  background: #f3fbf6;
}
.document-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.document-modal [hidden] {
  display: none !important;
}

.document-modal.open { display: flex; }

.document-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 31, 26, 0.42);
}

.document-modal__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 680px);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--surface, #fff);
  color: var(--text, #17231f);
  border: 1px solid var(--line, #d8e1dc);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(15, 31, 26, 0.22);
}

.document-modal__panel--result { width: min(100%, 600px); }

.document-modal__header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 36px;
  gap: 10px;
  align-items: start;
  padding: 16px 16px 10px;
  border-bottom: 1px solid var(--line, #d8e1dc);
}

.document-modal__header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.document-modal__header p {
  margin: 3px 0 0;
  color: var(--muted, #66756e);
  font-size: 13px;
}

.document-modal__icon {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.document-modal__icon svg,
.document-modal__close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.document-modal__icon--warning { color: #a15c00; background: #fff0db; }
.document-modal__icon--success { color: var(--accent-strong, #25663f); background: var(--accent-soft, #e7f2eb); }

.document-modal__close {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line, #d8e1dc);
  border-radius: 8px;
  color: var(--muted, #66756e);
  background: #fff;
}

.document-modal__close:hover,
.document-modal__close:focus-visible {
  color: var(--text, #17231f);
  border-color: var(--line-strong, #bdcbc4);
  outline: none;
}

.document-modal__body {
  padding: 12px 16px 16px;
}

.document-modal__message {
  margin: 0 0 10px;
  color: var(--text, #17231f);
  font-size: 14px;
}

.document-modal__summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.document-modal__summary div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line, #d8e1dc);
  border-radius: 8px;
  background: var(--surface-soft, #f8faf7);
}

.document-modal__summary dt {
  margin: 0 0 3px;
  color: var(--muted, #66756e);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.document-modal__summary dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 800;
}

.document-modal__options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}

.document-modal__options[hidden] { display: none; }

.document-modal__options legend {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted, #66756e);
  font-size: 12px;
  font-weight: 800;
}

.document-modal__option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  min-height: 82px;
  padding: 11px;
  border: 1px solid var(--line, #d8e1dc);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.document-modal__option input {
  margin-top: 2px;
  accent-color: var(--accent, #2f7d4f);
}

.document-modal__option strong {
  display: block;
  font-size: 13px;
  line-height: 1.2;
}

.document-modal__option small {
  display: block;
  margin-top: 4px;
  color: var(--muted, #66756e);
  font-size: 12px;
  line-height: 1.35;
}

.document-modal__option--selected {
  border-color: var(--accent, #2f7d4f);
  background: var(--accent-soft, #e7f2eb);
}

.document-modal__option:focus-within {
  outline: 2px solid rgba(47, 125, 79, .25);
  outline-offset: 2px;
}

.document-modal__field {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
}

.document-modal__field span {
  font-size: 12px;
  font-weight: 800;
}

.document-modal__field textarea {
  width: 100%;
  resize: vertical;
  min-height: 74px;
  border: 1px solid var(--line, #d8e1dc);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--text, #17231f);
  background: #fff;
}

.document-modal__field textarea:focus-visible {
  border-color: var(--accent, #2f7d4f);
  outline: 2px solid rgba(47, 125, 79, .18);
}

.document-modal__field small {
  justify-self: end;
  color: var(--muted, #66756e);
  font-size: 11px;
}

.document-modal__validation {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid #ffd0d0;
  border-radius: 8px;
  color: var(--danger, #b42318);
  background: #fff7f7;
  font-size: 13px;
  font-weight: 700;
}

.document-modal__warning {
  margin: 0;
  padding: 9px 10px;
  border-left: 4px solid #b7791f;
  border-radius: 8px;
  color: var(--text, #17231f);
  background: #fff8ea;
  font-size: 12px;
}

.document-modal__result {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line, #d8e1dc);
  border-left: 4px solid var(--accent, #2f7d4f);
  border-radius: 8px;
  background: var(--accent-soft, #e7f2eb);
}

.document-modal__result strong { color: var(--accent-strong, #25663f); font-size: 15px; }
.document-modal__result span { color: var(--text, #17231f); font-size: 13px; }
.document-modal__status { color: var(--danger, #b42318); font-weight: 800; }

.document-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 14px;
}

.document-modal__button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.document-modal__button:disabled {
  cursor: not-allowed;
  opacity: .58;
}

.document-modal__button--primary,
.document-modal__button--danger {
  color: #fff;
  background: var(--accent, #2f7d4f);
  border-color: var(--accent, #2f7d4f);
}

.document-modal__button--danger {
  background: var(--danger, #b42318);
  border-color: var(--danger, #b42318);
}

.document-modal__button--ghost {
  color: var(--text, #17231f);
  background: #fff;
  border-color: var(--line, #d8e1dc);
}

.document-modal__button:focus-visible {
  outline: 2px solid rgba(47, 125, 79, .28);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .document-modal__summary,
  .document-modal__options { grid-template-columns: 1fr; }
  .document-modal__footer { flex-direction: column-reverse; }
  .document-modal__button { width: 100%; }
}

/* Compact document cancellation modal */
.document-modal__panel--cancel {
  width: min(100%, 690px);
  max-height: none;
  overflow: visible;
  border-radius: 12px;
  border-color: #e4e8eb;
  box-shadow: 0 28px 80px rgba(18, 29, 36, .22);
}

.document-modal__header--compact {
  grid-template-columns: 38px minmax(0, 1fr) 32px;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom-color: #eef1f3;
}

.document-modal__header--compact h2 {
  font-size: 17px;
  line-height: 1.15;
}

.document-modal__header--compact p {
  margin-top: 4px;
  font-size: 12px;
}

.document-modal__header--compact .document-modal__icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.document-modal__body--compact {
  padding: 14px 20px 16px;
}

.document-modal__summary--cancel {
  gap: 8px;
  margin-bottom: 12px;
}

.document-modal__summary--cancel div {
  padding: 12px 12px 11px;
  border-color: #e1e7ea;
  border-radius: 9px;
  background: #fbfcfd;
}

.document-modal__summary--cancel dt {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: #64716b;
  font-size: 10px;
}

.document-modal__summary--cancel dt svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.document-modal__summary--cancel dd {
  font-size: 12px;
}

.document-modal__summary-paid dd {
  color: #2563eb;
}

.document-modal__message--question {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 800;
}

.document-modal__options-title {
  margin: 0 0 18px;
  color: #17231f;
  font-size: 12px;
  font-weight: 800;
}

.document-modal__legend-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.document-modal__options--cards {
  gap: 12px;
  margin-bottom: 14px;
}

.document-modal__options--cards .document-modal__option {
  grid-template-columns: 18px 34px minmax(0, 1fr);
  min-height: 64px;
  padding: 12px;
  border-radius: 9px;
  border-color: #e1e7ea;
}

.document-modal__options--cards .document-modal__option--selected {
  border-color: #38b87c;
  background: #f7fffb;
  box-shadow: 0 0 0 1px rgba(56, 184, 124, .18);
}

.document-modal__option-icon {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #13945e;
  background: #e4f7ed;
}

.document-modal__option-icon--blue {
  color: #2563eb;
  background: #e8f0ff;
}

.document-modal__option-icon svg,
.document-modal__button svg,
.document-modal__warning--compact svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.document-modal__options--cards .document-modal__option strong {
  font-size: 12px;
}

.document-modal__options--cards .document-modal__option small {
  font-size: 11px;
}

.document-modal__field--compact {
  gap: 7px;
  margin-bottom: 14px;
}

.document-modal__field--compact span {
  font-size: 12px;
}

.document-modal__field--compact b {
  color: #dc2626;
}

.document-modal__field--compact textarea {
  min-height: 78px;
  height: 78px;
  border-radius: 9px;
  border-color: #dfe5e8;
  padding: 10px 12px;
  font-size: 12px;
}

.document-modal__warning--compact {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid #ffdca8;
  border-radius: 9px;
  color: #533a13;
  background: #fff6e8;
  font-size: 12px;
}

.document-modal__warning--compact svg {
  color: #f59e0b;
}

.document-modal__footer--compact {
  margin-top: 12px;
}

.document-modal__footer--compact .document-modal__button {
  gap: 7px;
  min-height: 40px;
  border-radius: 8px;
  padding-inline: 16px;
  font-size: 12px;
}

.financial-account-form {
  padding: 0 2px 20px;
}

.financial-account-form__header {
  margin-bottom: 16px;
}

.financial-account-form__header h1 {
  margin: 0;
  color: #102a35;
  font-size: 1.45rem;
  font-weight: 900;
}

.financial-account-form__header p {
  margin: 26px 0 0;
  color: #52636d;
  font-weight: 700;
  font-size: 1.08rem;
}

.financial-account-card {
  background: #fff;
  border: 1px solid #dce7e2;
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(16, 42, 53, .06);
  padding: 32px 36px;
}

.financial-account-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 30px 40px;
}

.financial-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.financial-field span {
  color: #102a35;
  font-size: 1.05rem;
  font-weight: 900;
}

.financial-field b {
  color: #c9251b;
}

.financial-field input,
.financial-field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #d7e3de;
  border-radius: 8px;
  background: #fff;
  color: #102a35;
  font: inherit;
  font-weight: 700;
  padding: 0 14px;
  outline: none;
  box-shadow: 0 2px 8px rgba(16, 42, 53, .04);
}

.financial-field input:focus,
.financial-field select:focus {
  border-color: #2f8b5b;
  box-shadow: 0 0 0 3px rgba(47, 139, 91, .16);
}

.financial-field input:disabled,
.financial-field select:disabled {
  background: #f3f6f5;
  color: #7b8a86;
}

.financial-field small {
  color: #5f6f69;
  font-size: .82rem;
  font-weight: 700;
}

.financial-money-input {
  display: flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid #d7e3de;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(16, 42, 53, .04);
}

.financial-money-input span {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border-right: 1px solid #d7e3de;
  background: #f7faf9;
  color: #102a35;
}

.financial-money-input input {
  min-height: 40px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.financial-money-input:focus-within {
  border-color: #2f8b5b;
  box-shadow: 0 0 0 3px rgba(47, 139, 91, .16);
}

.financial-account-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 54px;
}

.comprobante-row.document-row-highlight {
  position: relative;
  border-color: #38b87c;
  background: #f0fbf5;
  box-shadow: 0 0 0 2px rgba(56, 184, 124, .22), 0 12px 30px rgba(31, 108, 70, .12);
  transition: background .35s ease, box-shadow .35s ease, border-color .35s ease;
}

.comprobante-row.document-row-highlight::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  border-radius: 8px 0 0 8px;
  background: #24a66a;
}

@media (max-width: 720px) {
  .document-modal__header--compact,
  .document-modal__body--compact { padding-inline: 14px; }
  .document-modal__options--cards .document-modal__option { grid-template-columns: 18px 32px minmax(0, 1fr); }
}
.document-modal__message:empty {
  display: none;
}
/* Client payment form */
.client-payment-form {
  display: grid;
  gap: 18px;
  max-width: 1180px;
  color: #182a3a;
}

.client-payment-header h1 {
  margin: 0 0 4px;
  color: #172536;
  font-size: 22px;
  font-weight: 900;
}

.client-payment-header p {
  margin: 0;
  color: #617085;
  font-size: 13px;
  font-weight: 600;
}

.client-payment-kpis {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.client-payment-kpi {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 86px;
  padding: 16px;
  border: 1px solid #dce7e2;
  border-radius: 8px;
  background: #fff;
}

.client-payment-kpi-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
}

.client-payment-kpi-icon.success { color: #087a45; background: #e9f7ef; }
.client-payment-kpi-icon.warning { color: #f08313; background: #fff0dc; }

.client-payment-kpi svg,
.client-payment-primary svg,
.client-payment-note svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.client-payment-kpi small,
.client-payment-balance small,
.client-payment-fields label > span {
  display: block;
  color: #516172;
  font-size: 11px;
  font-weight: 900;
}

.client-payment-kpi small { text-transform: uppercase; }

.client-payment-kpi strong {
  display: block;
  margin-top: 5px;
  color: #172536;
  font-size: 17px;
  font-weight: 900;
}

.text-green { color: #087a45 !important; }
.text-orange { color: #ef6c00 !important; }
.text-red { color: #d71920 !important; }

.client-payment-balance {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #a8d9c3;
  border-radius: 8px;
  background: #fbfffd;
}

.client-payment-balance-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.client-payment-switch {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.client-payment-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.client-payment-switch span {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #cbd5cf;
  transition: background .15s ease;
}

.client-payment-switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 35, 25, .24);
  transition: transform .15s ease;
}

.client-payment-switch input:checked + span { background: #0c8b55; }
.client-payment-switch input:checked + span::after { transform: translateX(16px); }

.client-payment-balance-copy strong {
  display: block;
  color: #172536;
  font-size: 13px;
  font-weight: 900;
}

.client-payment-balance-copy small {
  margin-top: 4px;
  font-weight: 600;
  text-transform: none;
}

.client-payment-balance-available { text-align: right; }
.client-payment-balance-available strong { color: #087a45; font-size: 16px; font-weight: 900; }

.client-payment-balance-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #dce7e2;
  border-radius: 8px;
  background: #fff;
}

.client-payment-balance-summary > div {
  min-height: 70px;
  display: grid;
  place-items: center;
  gap: 5px;
  padding: 10px;
  text-align: center;
}

.client-payment-balance-summary > div + div { border-left: 1px solid #dce7e2; }
.client-payment-balance-summary strong { font-size: 18px; font-weight: 900; }
.client-payment-total { background: linear-gradient(90deg, #f5faf7, #eef6f1); }
.client-payment-total strong { color: #087a45; }
.client-payment-fields.client-payment-fields--balance {
  margin-top: 12px;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  align-items: end;
}
.client-payment-balance-hint {
  min-height: 48px;
  display: flex;
  align-items: center;
  color: #60716a;
  font-weight: 700;
}

.client-payment-fields {
  display: grid;
  gap: 14px 18px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.client-payment-fields label {
  display: grid;
  gap: 7px;
  margin: 0;
  min-width: 0;
}

.client-payment-fields label > span b { color: #dc2626; }

.client-payment-fields .form-control,
.client-payment-fields .form-select,
.client-payment-money-input {
  min-height: 48px;
  width: 100%;
  border: 1px solid #d8e3df;
  border-radius: 8px;
  background: #fff;
  color: #172536;
  font-size: 13px;
  font-weight: 750;
  box-shadow: 0 1px 2px rgba(17, 34, 28, .03);
}

.client-payment-fields .form-control,
.client-payment-fields .form-select { padding: 10px 12px; }

.client-payment-fields .form-control:focus,
.client-payment-fields .form-select:focus,
.client-payment-money-input:focus-within {
  border-color: #2aa46d;
  box-shadow: 0 0 0 3px rgba(42, 164, 109, .13);
  outline: none;
}

.client-payment-fields .form-control:disabled,
.client-payment-fields .form-select:disabled,
.client-payment-money-input:has(input:disabled) {
  background: #f4f7f5;
  color: #8a9992;
  border-color: #e1e9e5;
  box-shadow: none;
}

.client-payment-money-input {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  overflow: hidden;
}

.client-payment-money-input em {
  display: grid;
  place-items: center;
  border-right: 1px solid #d8e3df;
  background: #f7faf8;
  color: #172536;
  font-style: normal;
  font-weight: 800;
}

.client-payment-money-input input {
  min-width: 0;
  border: 0;
  padding: 10px 12px;
  text-align: right;
  color: #172536;
  font: inherit;
  outline: none;
}

.client-payment-observation { grid-column: 1 / -1; position: relative; }
.client-payment-observation textarea.form-control { min-height: 84px; resize: none; padding-bottom: 26px; }
.client-payment-observation small {
  position: absolute;
  right: 14px;
  bottom: 10px;
  color: #6b7785;
  font-size: 12px;
  font-weight: 700;
}

.client-payment-actions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 2px;
}

.client-payment-secondary,
.client-payment-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 160px;
  min-height: 48px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.client-payment-secondary {
  border: 1px solid #d8e3df;
  background: #fff;
  color: #172536;
}

.client-payment-primary {
  border: 1px solid #007a45;
  background: #007a45;
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 122, 69, .18);
}

.client-payment-note {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 12px 16px;
  border: 1px solid #b9dcff;
  border-radius: 8px;
  background: #f2f8ff;
  color: #1c3f64;
  font-size: 12px;
}

.client-payment-note svg { width: 18px; height: 18px; color: #1470bd; }
.client-payment-note strong { color: #0d5c9d; }

@media (max-width: 980px) {
  .client-payment-kpis,
  .client-payment-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .client-payment-kpis,
  .client-payment-fields,
  .client-payment-balance-summary { grid-template-columns: 1fr; }
  .client-payment-balance-top { grid-template-columns: auto minmax(0, 1fr); }
  .client-payment-balance-available { grid-column: 1 / -1; text-align: left; }
  .client-payment-balance-summary > div + div { border-left: 0; border-top: 1px solid #dce7e2; }
  .client-payment-actions { flex-direction: column-reverse; }
  .client-payment-secondary,
  .client-payment-primary { width: 100%; }
}

/* Compact density for client payment form */
.client-payment-form {
  gap: 12px;
  max-width: none;
}

.client-payment-header h1 {
  margin-bottom: 2px;
  font-size: 20px;
  line-height: 1.15;
}

.client-payment-header p {
  font-size: 12px;
  line-height: 1.25;
}

.client-payment-kpis {
  gap: 14px;
}

.client-payment-kpi {
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  min-height: 64px;
  padding: 10px 14px;
}

.client-payment-kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 7px;
}

.client-payment-kpi svg {
  width: 18px;
  height: 18px;
}

.client-payment-kpi small,
.client-payment-balance small,
.client-payment-fields label > span {
  font-size: 10px;
  line-height: 1.15;
}

.client-payment-kpi strong {
  margin-top: 3px;
  font-size: 14px;
  line-height: 1.15;
}

.client-payment-balance {
  gap: 10px;
  padding: 12px 14px;
}

.client-payment-balance-top {
  gap: 12px;
}

.client-payment-balance-copy strong {
  font-size: 12px;
  line-height: 1.15;
}

.client-payment-balance-copy small {
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.2;
}

.client-payment-balance-available strong {
  font-size: 14px;
  line-height: 1.15;
}

.client-payment-balance-summary > div {
  min-height: 52px;
  gap: 3px;
  padding: 7px 10px;
}

.client-payment-balance-summary strong {
  font-size: 14px;
  line-height: 1.15;
}

.client-payment-fields {
  gap: 10px 16px;
}

.client-payment-fields label {
  gap: 5px;
}

.client-payment-fields .form-control,
.client-payment-fields .form-select,
.client-payment-money-input {
  min-height: 34px;
  height: 34px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
}

.client-payment-fields .form-control,
.client-payment-fields .form-select {
  padding: 6px 10px;
}

.client-payment-money-input {
  grid-template-columns: 42px minmax(0, 1fr);
}

.client-payment-money-input input {
  padding: 6px 10px;
  font-size: 11px;
  line-height: 1.1;
}

.client-payment-money-input em {
  font-size: 11px;
}

.client-payment-observation textarea.form-control {
  min-height: 58px;
  height: 58px;
  padding-top: 8px;
  padding-bottom: 22px;
}

.client-payment-observation small {
  right: 12px;
  bottom: 7px;
  font-size: 10px;
}

.client-payment-actions {
  gap: 12px;
  margin-top: 0;
}

.client-payment-secondary,
.client-payment-primary {
  min-width: 130px;
  min-height: 36px;
  border-radius: 7px;
  font-size: 12px;
}

.client-payment-primary svg {
  width: 16px;
  height: 16px;
}

.client-payment-note {
  min-height: 34px;
  padding: 8px 12px;
  font-size: 11px;
}

.client-payment-note svg {
  width: 15px;
  height: 15px;
}

.client-payment-header--compact {
  margin-top: -4px;
  margin-bottom: -2px;
}

.client-payment-header--compact p {
  font-size: 12px;
  line-height: 1.2;
}

.provider-payment-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1100px) {
  .provider-payment-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .provider-payment-kpis {
    grid-template-columns: 1fr;
  }
}
.cobro-applications-toggle {
  width: 100%;
  min-height: 34px;
  margin: 0 0 10px;
  font-size: 12px;
}

.cobro-applications-table {
  overflow: hidden;
  margin: 0 0 12px;
  border: 1px solid #dfe7e3;
  border-radius: 8px;
  background: #fff;
}

.cobro-applications-head,
.cobro-applications-row {
  display: grid;
  grid-template-columns: 1.2fr .9fr .8fr .9fr .9fr;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
}

.cobro-applications-head {
  color: #64716b;
  background: #f7faf8;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.cobro-applications-row {
  border-top: 1px solid #edf1ef;
  color: #17231f;
  font-size: 12px;
  font-weight: 700;
}

.cobro-applications-row strong {
  color: #0f241c;
  font-weight: 900;
}

.cobro-applications-row span:nth-child(4),
.cobro-applications-row span:nth-child(5) {
  text-align: right;
  font-weight: 900;
}

.cobro-applications-loading {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #dfe7e3;
  border-radius: 8px;
  color: #64716b;
  background: #fbfcfd;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 720px) {
  .cobro-applications-table { overflow-x: auto; }
  .cobro-applications-head,
  .cobro-applications-row { min-width: 620px; }
}
