:root {
  color-scheme: light;
  --brand-primary: #16835b;
  --brand-accent: #2f6fb2;
  --brand-surface: #ffffff;
  --brand-background: #f4f6f9;
  --color-text: #1d2430;
  --color-text-muted: #667085;
  --color-text-subtle: #667085;
  --color-border: #d9dee8;
  --color-border-strong: #bcc9d8;
  --color-surface: var(--brand-surface);
  --color-surface-subtle: #f8fafc;
  --color-background: var(--brand-background);
  --color-navigation: #122034;
  --color-navigation-active: #223750;
  --color-primary: var(--brand-primary);
  --color-primary-hover: color-mix(in srgb, var(--brand-primary) 84%, #000000);
  --color-accent: var(--brand-accent);
  --color-success: #0f6b49;
  --color-success-surface: #e6f4ee;
  --color-success-border: #bfe5d4;
  --color-warning: #815600;
  --color-warning-surface: #fff8e8;
  --color-warning-border: #f0d18b;
  --color-danger: #ba3b46;
  --color-danger-surface: #fff1f3;
  --color-danger-border: #e7bdc2;
  --color-info: #17456f;
  --color-info-surface: #eef6ff;
  --color-info-border: #b9d7ff;
  --color-disabled-text: #5f6b7a;
  --color-disabled-surface: #f3f6fa;
  --color-disabled-border: #dce4ee;
  --font-family-sans: Inter, Segoe UI, Roboto, Arial, sans-serif;
  --font-size-xs: 12px;
  --font-size-sm: 12px;
  --font-size-md: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 20px;
  --font-size-display: 28px;
  --line-height-tight: 1.2;
  --line-height-body: 1.5;
  --font-weight-regular: 400;
  --font-weight-medium: 600;
  --font-weight-bold: 700;
  --font-weight-strong: 800;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-pill: 999px;
  --shadow-sm: 0 8px 18px rgba(18, 32, 52, 0.08);
  --shadow-md: 0 14px 34px rgba(21, 31, 48, 0.08);
  --shadow-lg: 0 22px 60px rgba(18, 32, 52, 0.16);
  --control-height: 40px;
  --touch-target: 44px;
  --content-max-width: 1680px;
  --form-max-width: 920px;
  --dialog-max-width: 760px;
  --breakpoint-phone: 600px;
  --breakpoint-tablet: 900px;
  --breakpoint-desktop: 1180px;
  --z-content: 1;
  --z-sticky: 20;
  --z-navigation: 50;
  --z-modal: 100;
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--brand-accent) 48%, transparent);
  --ink: var(--color-text);
  --text: var(--color-text);
  --muted: var(--color-text-muted);
  --line: var(--color-border);
  --panel: var(--color-surface);
  --bg: var(--color-background);
  --nav: var(--color-navigation);
  --nav-soft: var(--color-navigation-active);
  --green: var(--color-primary);
  --green-soft: var(--color-success-surface);
  --red: var(--color-danger);
  --yellow: #f4b942;
  --blue: var(--color-accent);
  --teal: #0f9488;
  --orange: #df7b2f;
  --shadow: var(--shadow-md);
  --shadow-strong: var(--shadow-lg);
  font-family: var(--font-family-sans);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  color: var(--ink);
  background: var(--color-background);
  display: grid;
  grid-template-columns: 260px 1fr;
}

.skip-link {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  left: max(8px, env(safe-area-inset-left));
  z-index: calc(var(--z-modal) + 2);
  padding: 10px 14px;
  border: 2px solid var(--color-accent);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: var(--font-weight-bold);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

[data-brand-image][hidden] {
  display: block !important;
  visibility: hidden;
  transition: none !important;
}

.auth-gate {
  display: none;
}

body.auth-locked {
  grid-template-columns: 1fr;
}

body.auth-locked .sidebar,
body.auth-locked .workspace > :not(.auth-gate):not(.app-feedback-region) {
  display: none !important;
}

body.auth-locked .app-feedback-region {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  left: max(16px, env(safe-area-inset-left));
  z-index: var(--z-modal);
  width: min(560px, calc(100vw - 32px));
  margin-inline: auto;
}

body.auth-locked .workspace {
  display: grid !important;
  place-items: center;
  width: 100%;
  height: 100vh;
  padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  overflow: auto;
}

body.auth-locked .auth-gate {
  display: grid;
  justify-items: center;
  width: min(100%, 440px);
  min-width: 0;
  max-width: 100%;
  gap: 12px;
  text-align: center;
}

.auth-gate > * {
  max-width: 100%;
}

.auth-gate img {
  width: 92px;
  height: 92px;
  object-fit: contain;
  background: #1f1f22;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.auth-gate span {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.auth-gate h1 {
  font-size: 30px;
}

.auth-gate p {
  color: var(--muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.auth-gate button {
  width: min(100%, 240px);
  min-height: 46px;
}

.authorization-notice {
  margin: 0 28px 18px;
  padding: 10px 12px;
  border: 1px solid #e6b75c;
  border-radius: 6px;
  color: #6c4400;
  background: #fff7e6;
  font-weight: 700;
}

button, input, select {
  font: inherit;
}

.sidebar {
  background: linear-gradient(180deg, #101c2d 0%, #14243a 58%, #0e1726 100%);
  color: white;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px;
}

.brand > div {
  min-width: 0;
}

.brand strong,
.brand span {
  overflow-wrap: anywhere;
}

.brand span, .side-note small {
  display: block;
  color: #b9c4d6;
  font-size: 12px;
  margin-top: 2px;
}

.brand-logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
  flex: 0 0 auto;
  background: #1f1f22;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.18);
}

.tabs {
  display: grid;
  gap: 6px;
}

.tabs[aria-busy="true"] {
  opacity: .72;
  pointer-events: none;
}

.nav-group {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.nav-group + .nav-group {
  padding-top: 5px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #aebbd0;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.nav-group-toggle > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-group-toggle:hover,
.nav-group-toggle:focus-visible,
.nav-group.has-active .nav-group-toggle {
  background: rgba(255,255,255,.07);
  color: #fff;
}

.nav-group-chevron {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .16s ease;
}

.nav-group.collapsed .nav-group-chevron {
  transform: rotate(-45deg);
}

.nav-group-items {
  display: grid;
  gap: 3px;
}

.tab {
  width: 100%;
  min-height: 38px;
  border: 0;
  color: #dfe6f3;
  background: transparent;
  justify-content: flex-start;
  text-align: left;
  padding: 8px 12px 8px 18px;
  border-radius: 6px;
  cursor: pointer;
}

.tab.active,
.tab:hover,
.tab:focus-visible {
  background: var(--nav-soft);
  color: white;
}

.tab:disabled,
.nav-group-toggle:disabled {
  color: #7f8ba0;
  cursor: not-allowed;
  opacity: .64;
}

.mobile-nav-backdrop {
  display: none;
}

.side-note {
  padding: 14px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
}

.side-note span {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  font-weight: 800;
}

.side-admin {
  margin-top: auto;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
}

.admin-toggle {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-radius: 7px;
  padding: 8px 10px;
  background: transparent;
  color: white;
  cursor: pointer;
  text-align: left;
}

.admin-toggle:hover {
  background: rgba(255,255,255,.08);
}

.admin-toggle span {
  font-weight: 800;
}

.admin-toggle strong {
  color: #b9c4d6;
  font-size: 12px;
}

.side-actions {
  display: grid;
  gap: 8px;
  padding: 8px 6px 6px;
}

.side-admin.collapsed .side-actions {
  display: none;
}

.side-button {
  width: 100%;
  min-height: 36px;
  border-color: rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: #edf4fb;
  justify-content: flex-start;
  text-align: left;
}

.side-button:hover {
  background: rgba(255,255,255,.14);
}

.danger-side {
  color: #ffd6da;
  border-color: rgba(255,120,135,.34);
  background: rgba(186,59,70,.18);
}

.workspace {
  min-width: 0;
  min-height: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 26px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.view-heading {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.topbar-brand {
  max-width: min(48vw, 520px);
  overflow: hidden;
  color: var(--green);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.view-breadcrumb {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.view-breadcrumb span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operational-context {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}

.operational-context span {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--color-surface-subtle);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

h1, h2, p { margin: 0; }
h1 { font-size: 28px; }
h2 { font-size: 16px; }
.topbar p, .panel-head p { color: var(--muted); margin-top: 5px; font-size: 14px; }

.workspace[data-active-view="pos"] {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  padding: 8px 14px 10px;
}

.workspace[data-active-view="pos"] > .topbar { grid-row: 1; }
.workspace[data-active-view="pos"] > #authorizationNotice { grid-row: 2; }
.workspace[data-active-view="pos"] > #appFeedbackRegion { grid-row: 3; }
.workspace[data-active-view="pos"] > #pos { grid-row: 4; }

body.auth-locked .workspace[data-active-view="pos"] {
  grid-template-rows: minmax(0, 1fr);
}

body.auth-locked .workspace[data-active-view="pos"] > .auth-gate { grid-row: 1; }

.workspace[data-active-view="pos"] .topbar {
  margin-bottom: 7px;
}

.workspace[data-active-view="pos"] h1 {
  font-size: 20px;
}

.workspace[data-active-view="pos"] .topbar p {
  margin-top: 2px;
  font-size: 13px;
}

.workspace[data-active-view="pos"] .storage-status,
.workspace[data-active-view="pos"] .auth-status,
.workspace[data-active-view="pos"] .period-control {
  padding: 6px 9px;
}

.actions, .panel-head, menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.storage-status {
  display: grid;
  gap: 2px;
  min-width: 170px;
  padding: 9px 12px;
  border: 1px solid #bfe5d4;
  border-radius: 8px;
  background: var(--green-soft);
  color: #0d5c40;
  box-shadow: var(--shadow);
}

.storage-status span,
.storage-status small,
.storage-status em {
  font-size: 12px;
  color: #3f695b;
}

.storage-status strong {
  font-size: 13px;
}

.storage-status em {
  font-style: normal;
  white-space: nowrap;
}

.storage-status.warning {
  border-color: #f0d18b;
  background: #fff8e8;
  color: #815600;
}

.storage-status.danger {
  border-color: #efb2ba;
  background: #fff1f3;
  color: #9b1c2a;
}

.auth-status {
  display: grid;
  gap: 4px;
  min-width: 190px;
  padding: 9px 12px;
  border: 1px solid #d8e4f0;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text);
  box-shadow: var(--shadow);
}

.auth-status span,
.auth-status small {
  font-size: 12px;
  color: var(--muted);
}

.auth-status strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.auth-status.loading {
  border-color: #d8e4f0;
  background: #f8fafc;
}

.auth-status.authenticated {
  border-color: #bfe5d4;
  background: var(--green-soft);
  color: #0d5c40;
}

.auth-status.warning {
  border-color: #f0d18b;
  background: #fff8e8;
  color: #815600;
}

.auth-status-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.auth-status-actions button {
  min-height: 30px;
  padding: 5px 8px;
}

body.database-locked .primary,
body.database-locked button[type="submit"] {
  opacity: .55;
}

.panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.period-control {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.period-control input {
  min-height: 34px;
  min-width: 168px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  padding-left: 12px;
  color: var(--ink);
  font-weight: 800;
}

.compact-control {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.compact-control input,
.compact-control select {
  min-width: 150px;
}

.backup-select {
  min-height: 38px;
  width: 100%;
  min-width: 0;
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.18);
  color: white;
}

.backup-control {
  display: grid;
  gap: 6px;
  color: #b9c4d6;
  font-size: 12px;
}

.external-backup-control {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px;
  background: rgba(255,255,255,.05);
}

.external-backup-control small {
  color: #b9c4d6;
}

.external-backup-control span {
  color: white;
  font-size: 12px;
  font-weight: 800;
}

.backup-select option {
  color: var(--ink);
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-head.stacked {
  align-items: flex-start;
}

button {
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  min-height: var(--control-height);
  padding: 8px 12px;
  cursor: pointer;
  background: white;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  text-align: center;
  white-space: nowrap;
  user-select: none;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease, color .16s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

button:disabled {
  border-color: var(--color-disabled-border);
  background: var(--color-disabled-surface);
  color: var(--color-disabled-text);
  cursor: not-allowed;
  opacity: 1;
  transform: none;
  box-shadow: none;
  filter: none;
}

.primary {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.secondary {
  border-color: #cfdbea;
  background: #f6f9fd;
  color: var(--ink);
}

.secondary:hover:not(:disabled) {
  background: #eef4fb;
  border-color: #9fb2cc;
}

.ghost {
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
}

.ghost:hover:not(:disabled) {
  border-color: var(--color-border-strong);
  background: var(--color-surface-subtle);
}

.danger {
  color: var(--red);
  border-color: var(--color-danger-border);
  background: var(--color-danger-surface);
}

.danger:hover:not(:disabled) {
  border-color: #d9909a;
  background: #fff1f3;
}

.warning {
  color: var(--color-warning);
  border-color: var(--color-warning-border);
  background: var(--color-warning-surface);
}

.warning:hover:not(:disabled) {
  border-color: #e5b95d;
  background: #fff3d6;
}

.info {
  color: var(--color-info);
  border-color: var(--color-info-border);
  background: var(--color-info-surface);
}

.info:hover:not(:disabled) {
  border-color: #8ebcff;
  background: #e4f0ff;
}

.small {
  min-height: 32px;
  padding: 6px 10px;
  gap: 5px;
  font-size: 13px;
}

.icon {
  width: 36px;
  min-width: 36px;
  padding: 0;
  font-size: 22px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.row-actions .small,
.accounts-payable-actions .small {
  min-height: 30px;
  padding-inline: 9px;
}

.view {
  display: none;
  min-width: 0;
  max-width: 100%;
}
.view.active { display: block; }

.dashboard-hero {
  position: relative;
  min-height: 150px;
  margin-bottom: 14px;
  padding: 22px;
  border-radius: 8px;
  color: white;
  background: linear-gradient(
    120deg,
    color-mix(in srgb, var(--color-navigation) 94%, transparent),
    color-mix(in srgb, var(--brand-primary) 88%, var(--color-navigation))
  );
  box-shadow: var(--shadow-strong);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  overflow: hidden;
}

.hero-copy {
  min-width: 0;
  max-width: 620px;
}

.dashboard-brand-mark {
  flex: 0 1 132px;
  width: clamp(84px, 10vw, 132px);
  max-height: 132px;
  object-fit: contain;
}

.dashboard-brand-mark.brand-asset-missing {
  display: none;
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 10px;
  color: #d5f3e6;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.hero-copy h2 {
  font-size: 30px;
  line-height: 1.1;
  margin-bottom: 7px;
  overflow-wrap: anywhere;
}

.hero-copy p {
  color: #d9e7ef;
  max-width: 520px;
}

.hero-status {
  min-width: 215px;
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(8px);
}

.hero-status span, .hero-status small {
  display: block;
  color: #d9e7ef;
  font-size: 12px;
}

.hero-status strong {
  display: block;
  margin: 5px 0;
  font-size: 20px;
}

.dashboard-technical-reference {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.18);
}

.dashboard-technical-reference summary {
  width: fit-content;
  color: #e7f5ef;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.dashboard-technical-reference summary:focus-visible {
  border-radius: 4px;
  outline: none;
  box-shadow: 0 0 0 3px rgba(255,255,255,.38);
}

.dashboard-technical-reference[open] summary {
  margin-bottom: 5px;
}

.dashboard-technical-reference:not([open]) > :not(summary) {
  display: none;
}

.dashboard-technical-reference small {
  max-width: 270px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  position: relative;
  overflow: hidden;
  padding: 17px;
  display: grid;
  gap: 8px;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--green);
}

.metric-sales::before { background: var(--green); }
.metric-out::before { background: var(--red); }
.metric-profit::before { background: var(--blue); }
.metric-avg::before { background: var(--orange); }

.metric span, .metric small {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  font-size: 25px;
  line-height: 1.05;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, .85fr);
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  padding: 18px;
  min-width: 0;
}

.chart-panel canvas {
  display: block;
  width: 100%;
  height: 315px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #eef2f7;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

.chart-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 12px;
}

.chart-stat {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #f8fafc;
}

.chart-stat span {
  color: var(--muted);
  font-size: 12px;
}

.chart-stat strong {
  font-size: 16px;
  color: var(--ink);
}

.chart-stat small {
  color: var(--muted);
  font-size: 12px;
}

.breakdown {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  gap: 7px;
  padding: 10px 0;
  border-bottom: 1px solid #edf1f6;
}

.bar-row div {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.bar {
  height: 9px;
  background: #edf1f6;
  border-radius: 999px;
  overflow: hidden;
}

.method-summary {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.method-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.method-row span {
  color: var(--muted);
  font-size: 12px;
}

.method-row strong {
  font-size: 13px;
}

.movement-note {
  display: inline-block;
  margin-top: 3px;
  color: var(--muted);
  white-space: normal;
  line-height: 1.25;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--blue);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-wrap.tall {
  max-height: calc(100vh - 235px);
}

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

.ui-listing-viewport {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

.ui-listing-viewport:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

.ui-listing-table {
  border-collapse: separate;
  border-spacing: 0;
}

.ui-listing-table th {
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-transform: none;
}

.ui-listing-table td {
  line-height: 1.35;
}

.ui-listing-table[data-listing-density="compact"] th,
.ui-listing-table[data-listing-density="compact"] td {
  padding-block: 8px;
}

.ui-listing-table[data-listing-density="comfortable"] th,
.ui-listing-table[data-listing-density="comfortable"] td {
  padding-block: 11px;
}

.ui-listing-table tbody tr {
  transition: background-color 120ms ease;
}

.ui-listing-table tbody tr:hover {
  background-color: #f8fafc;
}

.ui-listing-table .num,
.ui-listing-table td[data-label="Total"],
.ui-listing-table td[data-label="Abonado"],
.ui-listing-table td[data-label="Saldo"],
.ui-listing-table td[data-label="Precio"],
.ui-listing-table td[data-label="Subtotal"] {
  font-variant-numeric: tabular-nums;
}

.ui-listing-viewport[data-sticky-header="true"] thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: inset 0 -1px 0 var(--line);
}

.workspace[data-active-view="catalog"] {
  padding: 20px 26px 22px;
}

.workspace[data-active-view="catalog"] .topbar {
  margin-bottom: 14px;
}

.workspace[data-active-view="catalog"] h1 {
  font-size: 25px;
}

.workspace[data-active-view="catalog"] .storage-status,
.workspace[data-active-view="catalog"] .auth-status,
.workspace[data-active-view="catalog"] .period-control {
  padding: 8px 11px;
}

.catalog-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 16px 18px 18px;
}

.catalog-panel .panel-head {
  margin-bottom: 6px;
}

.catalog-summary {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.workspace[data-active-view="catalog"] .catalog-summary .metric {
  min-height: 78px;
  padding: 14px 16px;
}

.filters.catalog-filters {
  grid-template-columns:
    minmax(260px, 1fr)
    minmax(110px, 140px)
    minmax(130px, 165px)
    minmax(120px, 1fr)
    minmax(120px, 1fr)
    minmax(96px, 116px);
  align-items: end;
  gap: 10px;
  margin-bottom: 8px;
  padding: 10px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #fbfdff;
}

.catalog-filters > * {
  min-width: 0;
}

.catalog-filters input,
.catalog-filters select {
  min-height: 38px;
}

.catalog-refresh {
  width: 100%;
  min-height: 38px;
  padding-inline: 10px;
}

.catalog-status {
  min-height: 22px;
}

.catalog-note {
  display: block;
  padding: 8px 11px;
  border: 1px solid #d8e4f0;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12.5px;
}

.catalog-note.danger {
  border-color: #fecdd3;
  background: #fff1f2;
  color: var(--red);
}

.catalog-note.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: var(--green);
}

.catalog-table-wrap {
  max-height: calc(100vh - 328px);
  scrollbar-gutter: stable;
}

.catalog-table {
  min-width: 1380px;
  table-layout: fixed;
}

.catalog-table th,
.catalog-table td {
  vertical-align: middle;
  padding: 8px 10px;
  overflow: hidden;
}

.catalog-table th {
  background: #f8fafc;
  color: #22324a;
  font-size: 12px;
  line-height: 1.15;
}

.catalog-table td {
  font-size: 12.5px;
  line-height: 1.25;
}

.catalog-table th:nth-child(1) { width: 72px; }
.catalog-table th:nth-child(2) { width: 118px; }
.catalog-table th:nth-child(3) { width: 370px; }
.catalog-table th:nth-child(4) { width: 150px; }
.catalog-table th:nth-child(5) { width: 135px; }
.catalog-table th:nth-child(6) { width: 78px; }
.catalog-table th:nth-child(7),
.catalog-table th:nth-child(8) { width: 104px; }
.catalog-table th:nth-child(9) { width: 132px; }
.catalog-table th:nth-child(10) { width: 178px; }

.catalog-table td:nth-child(10) {
  overflow: visible;
}

.catalog-table td:nth-child(3),
.catalog-table td:nth-child(4),
.catalog-table td:nth-child(5) {
  white-space: normal;
  overflow-wrap: anywhere;
}

.catalog-table td:nth-child(3) strong {
  display: -webkit-box;
  max-height: 38px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.2;
  white-space: normal;
}

.catalog-table td:nth-child(3) small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  max-height: 28px;
  overflow: hidden;
  line-height: 1.2;
  white-space: normal;
}

.catalog-table td:nth-child(1),
.catalog-table th:nth-child(1),
.catalog-table td:nth-child(6),
.catalog-table th:nth-child(6),
.catalog-table td:nth-child(9),
.catalog-table th:nth-child(9),
.catalog-table td:nth-child(10),
.catalog-table th:nth-child(10) {
  text-align: center;
}

.catalog-table td:nth-child(7),
.catalog-table td:nth-child(8),
.catalog-table th:nth-child(7),
.catalog-table th:nth-child(8) {
  text-align: right;
}

.catalog-thumb {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-inline: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  object-fit: cover;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.15;
  text-align: center;
}

.catalog-thumb.empty {
  border-style: dashed;
  background: linear-gradient(180deg, #f8fafc 0%, #eef4f8 100%);
  color: #64748b;
  font-weight: 700;
}

.catalog-thumb.empty span {
  display: block;
  max-width: 44px;
}

.catalog-table .status-pill {
  justify-content: center;
  min-width: 74px;
  padding: 4px 7px;
  line-height: 1.1;
}

.catalog-table td:nth-child(9) small {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  line-height: 1.08;
  text-align: center;
}

.catalog-table .row-actions.compact {
  justify-content: flex-start;
  gap: 4px;
  min-width: 0;
  flex-wrap: nowrap;
}

.catalog-table .row-actions.compact .small {
  min-height: 28px;
  padding: 4px 7px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
}

.workspace[data-active-view="inventoryEntries"] {
  padding: 20px 26px 22px;
}

.workspace[data-active-view="inventoryEntries"] .topbar {
  margin-bottom: 14px;
}

.workspace[data-active-view="inventoryEntries"] h1 {
  font-size: 25px;
}

.workspace[data-active-view="inventoryEntries"] .storage-status,
.workspace[data-active-view="inventoryEntries"] .auth-status,
.workspace[data-active-view="inventoryEntries"] .period-control {
  padding: 8px 11px;
}

.workspace[data-active-view="inventoryEntries"] .inventory-entry-summary .metric {
  min-height: 76px;
  padding: 14px 16px;
}

.inventory-entry-panel,
.inventory-entry-history-panel {
  display: grid;
  gap: 10px;
  padding: 16px 18px 18px;
}

.inventory-entry-panel .panel-head,
.inventory-entry-history-panel .panel-head {
  margin-bottom: 8px;
}

.inventory-entry-summary {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.inventory-entry-form {
  display: grid;
  gap: 10px;
}

.inventory-entry-form > .form-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: end;
}

.inventory-entry-form > .form-grid .field-with-action {
  grid-column: span 5;
}

.inventory-entry-supplier-name-field {
  grid-column: span 5;
}

.inventory-entry-invoice-field {
  grid-column: span 6;
}

.inventory-entry-date-field {
  grid-column: span 3;
}

.inventory-entry-note-field {
  grid-column: 1 / -1;
}

.inventory-entry-form > .form-grid label {
  gap: 5px;
}

.inventory-entry-form input,
.inventory-entry-form select {
  min-height: 38px;
}

.field-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.field-with-action label {
  min-width: 0;
}

.field-with-action button {
  min-height: 38px;
  white-space: nowrap;
}

.inventory-entry-refresh {
  align-self: end;
  width: 100%;
  min-height: 38px;
  padding-inline: 10px;
}

.icon-text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.icon-text-button span[aria-hidden="true"] {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(20, 132, 88, .12);
  color: var(--green);
  font-weight: 900;
  line-height: 1;
}

.primary.icon-text-button span[aria-hidden="true"] {
  background: rgba(255, 255, 255, .18);
  color: #fff;
}

.entry-product-picker {
  display: grid;
  gap: 9px;
  padding: 11px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.entry-product-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 84px 126px 126px 116px 136px;
  gap: 9px 12px;
  row-gap: 9px;
  align-items: end;
}

.entry-product-grid label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.entry-product-grid input {
  width: 100%;
  min-width: 0;
}

.entry-product-main-field input {
  font-weight: 600;
}

.entry-product-main-field {
  position: relative;
}

.inventory-product-suggestions {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: grid;
  max-height: 292px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, .18);
}

.inventory-product-suggestions[hidden] {
  display: none;
}

.inventory-product-suggestion {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid #edf1f6;
  background: #fff;
  color: var(--ink);
  justify-content: stretch;
  justify-items: stretch;
  align-items: start;
  text-align: left;
  cursor: pointer;
}

.inventory-product-suggestion:hover,
.inventory-product-suggestion:focus-visible {
  background: #eefaf4;
}

.inventory-product-suggestion:focus-visible,
.inventory-product-suggestion.is-active {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

.inventory-product-suggestion strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.inventory-product-suggestion span,
.inventory-product-suggestion small,
.inventory-product-suggestion-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.inventory-product-suggestion-empty {
  padding: 12px;
  background: #fbfcfe;
}

#pos.view.active {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 432px);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "summary summary"
    "sale payment";
  gap: 7px 14px;
  align-items: stretch;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

#pos .panel-head {
  min-height: 22px;
  margin-bottom: 5px;
}

#pos .panel-head p,
#pos .mini-panel-head small {
  display: none;
}

.pos-summary {
  grid-area: summary;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 0;
}

.pos-summary .metric {
  min-height: 52px;
  padding: 6px 10px;
  gap: 2px;
}

.pos-summary .metric strong {
  font-size: 17px;
}

.pos-panel {
  grid-area: sale;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 10px;
}

.pos-layout {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 6px;
  align-items: stretch;
  min-height: 0;
}

.pos-product-panel,
.pos-cart-panel {
  min-width: 0;
}

.pos-product-panel,
.pos-cart-panel {
  display: grid;
  align-content: start;
  gap: 6px;
}

.pos-cart-panel {
  grid-template-rows: minmax(0, 1fr);
  align-content: stretch;
  min-height: 0;
  overflow: hidden;
}

.pos-product-panel {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

#pos .pos-product-panel .mini-panel-head,
#pos .pos-cart-panel .mini-panel-head {
  display: none;
}

#pos label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: #18283b;
  font-weight: 500;
}

#pos input,
#pos select {
  width: 100%;
  min-height: 34px;
}

.pos-product-search-grid,
.pos-actions-grid,
.pos-payment-form {
  display: grid;
  gap: 6px;
  align-items: end;
}

.pos-product-search-grid {
  grid-template-columns:
    minmax(0, 1fr)
    70px
    104px
    86px
    136px;
  column-gap: 8px;
  row-gap: 4px;
}

.pos-customer-field {
  display: grid;
  grid-template-columns: auto minmax(220px, 420px);
  align-items: center;
  justify-content: end;
  gap: 10px;
  margin-bottom: 8px;
}

#customerEditorDialog,
#customerDetailDialog {
  width: min(760px, calc(100vw - 32px));
}

#customerDetailBody,
#customerConsentSection {
  display: grid;
  gap: 12px;
}

#customerConsentSection {
  margin-top: 16px;
}

.pos-actions-grid {
  grid-template-columns: 1fr;
}

.pos-payment-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pos-actions-grid .wide,
.pos-payment-form .wide {
  grid-column: 1 / -1;
}

.pos-product-search-grid .pos-product-main-field,
.pos-product-search-grid #posAddItem {
  grid-column: auto;
}

.pos-product-main-field {
  position: relative;
  min-width: 0;
  z-index: 5;
}

.pos-product-search-control {
  position: relative;
  display: block;
}

.pos-product-search-control input {
  padding-right: 30px;
  overflow: hidden;
  text-overflow: ellipsis;
}

#posProductSearch {
  font-size: 14.5px;
  font-weight: 600;
}

.pos-search-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 22px;
  min-width: 22px;
  height: 22px;
  min-height: 0;
  padding: 0;
  border: 1px solid #cfdbea;
  border-radius: 999px;
  background: #f4f7fb;
  color: #526377;
  line-height: 1;
  transform: translateY(-50%);
  box-shadow: none;
  transition: border-color .16s ease, background .16s ease, color .16s ease;
}

button.pos-search-clear:hover:not(:disabled),
button.pos-search-clear:focus-visible {
  border-color: #9fb2c9;
  background: #eaf0f7;
  color: #0f172a;
  transform: translateY(-50%);
}

button.pos-search-clear:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

.pos-search-clear[hidden] {
  display: none !important;
}

.pos-product-search-grid #posAddItem {
  min-height: 36px;
  padding-inline: 10px;
  font-size: 13.5px;
  line-height: 1.1;
  white-space: nowrap;
}

.pos-product-search-grid > label {
  min-width: 0;
}

.pos-product-search-grid > label:not(.pos-product-main-field) {
  color: #0f172a;
  text-align: center;
}

.pos-product-search-grid > label:not(.pos-product-main-field) input {
  margin-top: 1px;
}

#posItemQuantity {
  text-align: center;
}

#posItemUnitPrice,
#posItemDiscount {
  text-align: right;
}

.pos-product-suggestions {
  position: static;
  z-index: auto;
  width: 100%;
  max-height: 264px;
  margin-top: 2px;
  padding: 4px 0;
  overflow-y: auto;
  scroll-padding-block: 8px;
  border-color: #cfdbea;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .10);
  scrollbar-gutter: stable;
}

.pos-product-suggestions .inventory-product-suggestion {
  grid-template-rows: auto auto auto;
  gap: 3px;
  height: 64px;
  min-height: 64px;
  max-height: 64px;
  padding: 9px 10px;
  overflow: hidden;
  background: #fff;
  justify-content: stretch;
  justify-items: stretch;
  align-content: center;
  align-items: start;
  text-align: left;
}

.pos-product-suggestions .inventory-product-suggestion > * {
  width: 100%;
  min-width: 0;
}

.pos-product-suggestions .inventory-product-suggestion:hover,
.pos-product-suggestions .inventory-product-suggestion.is-active {
  background: #eaf8f1;
}

.pos-product-suggestions .inventory-product-suggestion.is-out-of-stock {
  background: #fff;
}

.pos-product-suggestions .inventory-product-suggestion.is-out-of-stock.is-active,
.pos-product-suggestions .inventory-product-suggestion.is-out-of-stock:hover {
  background: #fff7ed;
}

.pos-product-suggestions .inventory-product-suggestion strong {
  display: -webkit-box;
  max-height: 18px;
  overflow: hidden;
  white-space: normal;
  line-height: 1.15;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.pos-suggestion-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  line-height: 1.25;
}

.pos-suggestion-details {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  font-size: 11.5px;
  line-height: 1.25;
}

.pos-product-suggestions .is-out-of-stock .pos-suggestion-details span:first-child {
  color: var(--red);
  font-weight: 700;
}

.pos-cart-wrap {
  height: 100%;
  max-height: none;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #eef2f7;
}

.pos-cart-wrap::-webkit-scrollbar {
  width: 8px;
}

.pos-cart-wrap::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #94a3b8;
}

.pos-cart-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 10.8px;
}

.pos-cart-table th,
.pos-cart-table td {
  padding: 2px 6px;
  border-bottom-color: #eef3f8;
  overflow-wrap: normal;
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1;
}

.pos-cart-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 4px 7px 5px;
  background: #f8fafc;
  box-shadow: inset 0 -1px 0 #dfe7f1;
  font-size: 12px;
  line-height: 1.15;
}

.pos-cart-table th:nth-child(1) { width: auto; }
.pos-cart-table th:nth-child(2) { width: 68px; }
.pos-cart-table th:nth-child(3) { width: 100px; }
.pos-cart-table th:nth-child(4) { width: 90px; }
.pos-cart-table th:nth-child(5) { width: 108px; }
.pos-cart-table th:nth-child(6) { width: 70px; }

.pos-cart-table th:nth-child(3),
.pos-cart-table th:nth-child(5),
.pos-cart-table td:nth-child(3),
.pos-cart-table td:nth-child(5) {
  text-align: right;
}

.pos-cart-table th:nth-child(2),
.pos-cart-table th:nth-child(4),
.pos-cart-table td:nth-child(2),
.pos-cart-table td:nth-child(4) {
  text-align: center;
}

.pos-cart-table td:first-child {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  vertical-align: middle;
}

.pos-cart-table td:first-child strong {
  display: block;
  overflow: hidden;
  min-height: 21px;
  line-height: 21px;
  letter-spacing: 0;
  color: #0f172a;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pos-cart-table td:first-child small {
  display: none;
  font-size: 12px;
  line-height: 1.1;
  color: #64748b;
  font-weight: 500;
}

.pos-cart-table th:last-child,
.pos-cart-table td:last-child {
  text-align: center;
}

.pos-cart-table tbody tr:hover td {
  background: #f8fbff;
}

.pos-cart-empty-row td {
  padding: 12px 10px;
  color: #64748b;
  background: #fbfdff;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

#pos .pos-cart-table [data-remove-pos-item] {
  min-height: 20px;
  height: 21px;
  padding: 0 6px;
  white-space: nowrap;
  font-size: 10.5px;
}

#pos .pos-cart-qty {
  min-width: 0;
  width: 50px;
  max-width: 100%;
  min-height: 20px;
  height: 21px;
  padding: 0 5px;
  text-align: center;
  font-size: 10.8px;
}

#pos .pos-cart-discount {
  min-width: 0;
  width: 58px;
  max-width: 100%;
  min-height: 20px;
  height: 21px;
  padding: 0 5px;
  text-align: right;
  font-size: 10.8px;
}

.pos-money-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 76px;
  max-width: 100%;
}

.pos-money-prefix {
  flex: 0 0 auto;
  color: #526377;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.pos-actions-panel {
  grid-area: payment;
  position: sticky;
  top: 18px;
  margin-top: 0;
  border-color: #cfdbea;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  scroll-padding-bottom: 56px;
  display: flex;
  flex-direction: column;
  padding: 10px;
}

.pos-actions-panel.is-paid {
  overflow-y: hidden;
  scrollbar-gutter: auto;
}

.pos-actions-panel > .panel-head,
.pos-actions-panel > .pos-payment-total,
.pos-actions-panel > #posSaleStatus,
.pos-actions-panel > .pos-actions-grid,
.pos-actions-panel > .pos-payment-form {
  flex-shrink: 0;
}

#pos .pos-actions-panel:not(.is-payment-ready) .pos-payment-form .wide,
.pos-actions-panel:not(.is-payment-ready) .pos-payment-submit {
  display: none;
}

.pos-payment-total {
  display: grid;
  gap: 2px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid #b7dbc8;
  border-radius: 8px;
  background: #eefaf4;
}

.pos-payment-total span {
  color: #145c3b;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.pos-payment-total strong {
  color: #083321;
  font-size: 22px;
  line-height: 1.05;
}

.pos-payment-total small {
  color: #35624c;
  font-size: 12px;
  line-height: 1.3;
}

#posConfirmSale {
  background: var(--blue);
}

#posRegisterPayment {
  min-height: 38px;
}

.pos-payment-submit {
  position: sticky;
  z-index: 2;
  bottom: 0;
  grid-column: 1 / -1;
  padding-top: 8px;
  background: linear-gradient(180deg, rgba(251, 253, 255, 0), #fbfdff 38%);
}

.pos-payment-submit button {
  width: 100%;
}

.pos-action-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  grid-column: 1 / -1;
}

.pos-action-buttons button {
  min-width: 0;
}

.pos-reset-action {
  grid-column: 1 / -1;
}

.pos-payment-form {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  align-items: start;
}

.pos-payment-form[hidden] {
  display: none;
}

.pos-payment-form button {
  grid-column: 1 / -1;
  min-height: 38px;
}

#pos .pos-action-buttons button {
  min-height: 34px;
}

.pos-sale-notes {
  margin-top: 2px;
}

#pos button:disabled {
  border-color: #dce4ee;
  background: #f3f6fa;
  color: var(--color-disabled-text);
  opacity: 1;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  filter: none;
}

#posProductStatus.catalog-status,
#posSaleStatus.catalog-status {
  min-height: 0;
  margin-top: 0;
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 11.5px;
  line-height: 1.25;
}

#posSaleStatus.catalog-status {
  margin-bottom: 8px;
}

.pos-actions-panel.is-paid #posSaleStatus.catalog-status {
  padding: 0;
}

.pos-actions-panel.is-paid #posSaleStatus .catalog-note {
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.35;
}

#posProductStatus.catalog-status {
  width: fit-content;
  max-width: 100%;
}

#posProductStatus.catalog-status:empty,
#posSaleStatus.catalog-status:empty {
  display: none;
}

.sales-report-summary {
  margin-bottom: 12px;
}

.sales-report-panel,
.sales-report-table-panel,
.sales-report-detail-panel {
  margin-bottom: 12px;
}

.workspace[data-active-view="salesReports"] {
  padding: 20px 26px 22px;
}

.workspace[data-active-view="salesReports"] .topbar {
  margin-bottom: 14px;
}

.workspace[data-active-view="salesReports"] h1 {
  font-size: 25px;
}

.workspace[data-active-view="salesReports"] .storage-status,
.workspace[data-active-view="salesReports"] .auth-status,
.workspace[data-active-view="salesReports"] .period-control {
  padding: 8px 11px;
}

.workspace[data-active-view="salesReports"] .sales-report-summary .metric {
  min-height: 76px;
  padding: 14px 16px;
}

.sales-report-panel {
  padding: 16px 18px 18px;
}

.sales-report-panel .panel-head {
  margin-bottom: 14px;
}

.filters.sales-report-filters {
  align-items: end;
  grid-template-columns:
    minmax(146px, 158px)
    minmax(146px, 158px)
    minmax(152px, 170px)
    minmax(152px, 170px)
    minmax(250px, 1fr)
    minmax(118px, 136px);
  column-gap: 16px;
  row-gap: 10px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #fbfdff;
}

.sales-report-filters label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #1f2d40;
  font-weight: 700;
}

.sales-report-filters input,
.sales-report-filters select,
.sales-report-filters button {
  min-height: 38px;
}

.sales-report-filter-search input {
  min-width: 0;
}

.sales-report-refresh {
  width: 100%;
}

.sales-report-layout {
  display: grid;
  grid-template-columns: minmax(270px, .42fr) minmax(720px, 1.58fr);
  gap: 12px;
  align-items: stretch;
}

.sales-report-payments-panel,
.sales-report-table-panel {
  height: 100%;
  min-height: 176px;
}

.sales-report-payments {
  display: grid;
  gap: 8px;
}

.sales-report-payment-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid #e7edf5;
  border-radius: 8px;
  background: #f8fafc;
}

.sales-report-payment-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sales-report-payment-card strong {
  font-size: 15px;
}

.sales-report-table-wrap {
  max-height: calc(100vh - 374px);
  border-radius: 8px;
  scrollbar-gutter: stable;
}

.sales-report-table,
.sales-report-detail-table {
  min-width: 1040px;
  table-layout: fixed;
}

.sales-report-table {
  width: 100%;
  min-width: 0;
}

.sales-report-table th,
.sales-report-table td {
  padding: 9px 11px;
  vertical-align: middle;
}

.sales-report-table th {
  background: #f8fafc;
  color: #22324a;
  font-size: 12px;
  line-height: 1.15;
}

.sales-report-table td {
  font-size: 12.5px;
  line-height: 1.25;
}

.sales-report-table td small {
  display: block;
  margin-top: 2px;
  color: #66758a;
  font-size: 12px;
  line-height: 1.15;
}

.sales-report-table th:nth-child(1) { width: 17%; }
.sales-report-table th:nth-child(2) { width: 10%; }
.sales-report-table th:nth-child(3),
.sales-report-table th:nth-child(4) { width: 8%; }
.sales-report-table th:nth-child(5),
.sales-report-table th:nth-child(7) { width: 7%; }
.sales-report-table th:nth-child(6) { width: 8%; }
.sales-report-table th:nth-child(8) { width: 13%; }
.sales-report-table th:nth-child(9) { width: 9%; }
.sales-report-table th:nth-child(10) { width: 10%; }

.sales-report-table th:nth-child(1),
.sales-report-table td:nth-child(1),
.sales-report-table th:nth-child(2),
.sales-report-table td:nth-child(2),
.sales-report-table th:nth-child(8),
.sales-report-table td:nth-child(8) {
  text-align: left;
}

.sales-report-table th:nth-child(3),
.sales-report-table td:nth-child(3),
.sales-report-table th:nth-child(4),
.sales-report-table td:nth-child(4),
.sales-report-table th:nth-child(9),
.sales-report-table td:nth-child(9),
.sales-report-table th:nth-child(10),
.sales-report-table td:nth-child(10) {
  text-align: center;
}

.sales-report-table th:nth-child(5),
.sales-report-table td:nth-child(5),
.sales-report-table th:nth-child(6),
.sales-report-table td:nth-child(6),
.sales-report-table th:nth-child(7),
.sales-report-table td:nth-child(7) {
  text-align: right;
}

.sales-report-sale-number,
.sales-report-sale-id,
.sales-report-date,
.sales-report-time,
.sales-report-user {
  display: block;
  min-width: 0;
}

.sales-report-sale-number {
  max-width: 100%;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
  font-size: 12px;
  line-height: 1.15;
}

.sales-report-sale-id,
.sales-report-time {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-report-user {
  max-width: 100%;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.sales-report-date {
  font-weight: 700;
}

.sales-report-table .status-pill {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.sales-report-table [data-sales-report-detail] {
  width: 100%;
  min-height: 31px;
  padding-inline: 10px;
  white-space: nowrap;
}

.sales-report-row.sale-voided {
  background: #fff7f8;
}

.sales-report-row.payment-partial {
  background: #fffbeb;
}

.sales-report-row.payment-paid:not(.sale-voided) {
  background: #f7fdf9;
}

.status-pill.pending {
  background: #fff7ed;
  color: #b45309;
}

.sales-report-detail-panel {
  padding: 14px 18px 16px;
}

.sales-report-detail-panel .panel-head {
  align-items: center;
  margin-bottom: 8px;
}

.sales-report-detail-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(148px, auto);
  gap: 10px;
  align-items: start;
}

.filter-summary.sales-report-detail-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 8px;
}

.filter-summary.sales-report-detail-summary div {
  min-height: 52px;
  padding: 9px 10px;
}

.filter-summary.sales-report-detail-summary span {
  font-size: 11.5px;
}

.filter-summary.sales-report-detail-summary strong {
  font-size: 14px;
  line-height: 1.15;
}

.sales-report-detail-actions {
  display: flex;
  justify-content: flex-end;
  margin: 8px 0 8px;
}

.sales-report-detail-actions .small {
  min-width: 148px;
}

.sales-report-detail-block {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.sales-report-detail-block h3 {
  margin: 0;
  font-size: 15px;
}

.sales-report-detail-table-wrap {
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.sales-report-detail-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.sales-report-detail-table th,
.sales-report-detail-table td {
  padding: 7px 10px;
  vertical-align: middle;
  font-size: 12.5px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.sales-report-detail-table th {
  background: #f8fafc;
  color: #22324a;
  font-size: 12px;
  line-height: 1.15;
}

.sales-report-detail-table td small {
  display: block;
  margin-top: 2px;
  color: #66758a;
  font-size: 12px;
  line-height: 1.15;
}

.sales-report-detail-table .status-pill {
  justify-content: center;
  max-width: 100%;
  text-align: center;
}

.sales-report-items-table th:nth-child(1) { width: 42%; }
.sales-report-items-table th:nth-child(2) { width: 8%; }
.sales-report-items-table th:nth-child(3),
.sales-report-items-table th:nth-child(4),
.sales-report-items-table th:nth-child(5),
.sales-report-items-table th:nth-child(6) { width: 12.5%; }

.sales-report-items-table th:nth-child(1),
.sales-report-items-table td:nth-child(1),
.sales-report-payments-table th:nth-child(1),
.sales-report-payments-table td:nth-child(1),
.sales-report-payments-table th:nth-child(6),
.sales-report-payments-table td:nth-child(6),
.sales-report-payments-table th:nth-child(7),
.sales-report-payments-table td:nth-child(7) {
  text-align: left;
}

.sales-report-items-table th:nth-child(2),
.sales-report-items-table td:nth-child(2),
.sales-report-payments-table th:nth-child(5),
.sales-report-payments-table td:nth-child(5) {
  text-align: center;
}

.sales-report-items-table th:nth-child(3),
.sales-report-items-table td:nth-child(3),
.sales-report-items-table th:nth-child(4),
.sales-report-items-table td:nth-child(4),
.sales-report-items-table th:nth-child(5),
.sales-report-items-table td:nth-child(5),
.sales-report-items-table th:nth-child(6),
.sales-report-items-table td:nth-child(6),
.sales-report-payments-table th:nth-child(2),
.sales-report-payments-table td:nth-child(2),
.sales-report-payments-table th:nth-child(3),
.sales-report-payments-table td:nth-child(3),
.sales-report-payments-table th:nth-child(4),
.sales-report-payments-table td:nth-child(4) {
  text-align: right;
}

.sales-report-payments-table th:nth-child(1) { width: 15%; }
.sales-report-payments-table th:nth-child(2),
.sales-report-payments-table th:nth-child(3),
.sales-report-payments-table th:nth-child(4) { width: 12%; }
.sales-report-payments-table th:nth-child(5) { width: 11%; }
.sales-report-payments-table th:nth-child(6) { width: 22%; }
.sales-report-payments-table th:nth-child(7) { width: 16%; }

.sale-receipt-dialog {
  width: min(860px, calc(100vw - 32px));
}

.sale-receipt-dialog #saleReceiptForm {
  display: flex;
  flex-direction: column;
}

.sale-receipt-dialog #saleReceiptStatus:not(:empty) {
  flex: 0 0 auto;
  margin-bottom: var(--space-3);
}

.sale-receipt-dialog #saleReceiptStatus:empty {
  min-height: 0;
  margin-bottom: 0;
}

.sale-receipt-print-area {
  display: grid;
  gap: 14px;
}

.sale-receipt {
  display: grid;
  gap: 16px;
  color: var(--text);
}

.sale-receipt-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.sale-receipt-head h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.sale-receipt-head strong {
  color: var(--ink);
}

.sale-receipt-brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-3);
}

.sale-receipt-brand > div {
  min-width: 0;
}

.sale-receipt-brand img {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.sale-receipt-brand img.brand-asset-missing {
  display: none;
}

.sale-receipt-brand h2,
.sale-receipt-brand small {
  display: block;
  overflow-wrap: anywhere;
}

.sale-receipt-legal-name {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--color-text-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.sale-receipt-brand small {
  margin-top: var(--space-1);
  color: var(--color-text-muted);
}

.sale-receipt-warning {
  display: grid;
  gap: 4px;
  color: #8a4b00;
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.sale-receipt-meta,
.sale-receipt-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.sale-receipt-meta div,
.sale-receipt-totals div {
  border: 1px solid #e7edf5;
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
  min-width: 0;
}

.sale-receipt-meta span,
.sale-receipt-totals span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.sale-receipt-meta strong,
.sale-receipt-totals strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

.sale-receipt-meta .sale-receipt-field-wide {
  grid-column: span 2;
}

.sale-receipt-section {
  display: grid;
  gap: 8px;
}

.sale-receipt-section h3 {
  margin: 0;
  font-size: 15px;
}

.sale-receipt-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.sale-receipt-table-wrap {
  overflow-x: hidden;
}

.sale-receipt-table th,
.sale-receipt-table td {
  padding: 9px 10px;
  vertical-align: middle;
  white-space: normal;
}

.sale-receipt-table th:first-child,
.sale-receipt-table td:first-child {
  text-align: left;
}

.sale-receipt-table td:first-child strong {
  display: block;
  line-height: 1.2;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

.sale-receipt-table td:first-child small {
  display: block;
  margin-top: 2px;
  line-height: 1.15;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

.sale-receipt-items-table th:nth-child(1) { width: 36%; }
.sale-receipt-items-table th:nth-child(2) { width: 11%; }
.sale-receipt-items-table th:nth-child(3) { width: 14%; }
.sale-receipt-items-table th:nth-child(4) { width: 13%; }
.sale-receipt-items-table th:nth-child(5) { width: 12%; }
.sale-receipt-items-table th:nth-child(6) { width: 14%; }

.sale-receipt-payments-table th:nth-child(1) { width: 34%; }
.sale-receipt-payments-table th:nth-child(2) { width: 22%; }
.sale-receipt-payments-table th:nth-child(3) { width: 22%; }
.sale-receipt-payments-table th:nth-child(4) { width: 22%; }

.sale-receipt-table th.num,
.sale-receipt-table td.num {
  text-align: right;
}

.sale-receipt-footer {
  display: grid;
  gap: var(--space-1);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  text-align: center;
}

.sale-receipt-footer strong {
  color: var(--color-text);
  overflow-wrap: anywhere;
}

.sale-receipt-footer span {
  overflow-wrap: anywhere;
}

.sale-receipt-actions {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 12px;
}

.entry-product-qty-field input {
  text-align: center;
}

.entry-product-money-field input,
.entry-product-date-field input,
.entry-product-lot-field input {
  font-size: 13px;
}

.inventory-entry-items-wrap {
  max-height: clamp(180px, calc(100vh - 552px), 248px);
  background: #fff;
  scrollbar-gutter: stable;
}

.inventory-entry-items-table {
  min-width: 1080px;
  table-layout: fixed;
}

.inventory-entry-items-table th,
.inventory-entry-items-table td {
  padding: 8px 10px;
  vertical-align: middle;
}

.inventory-entry-items-table th {
  background: #f8fafc;
  color: #22324a;
  font-size: 12px;
  line-height: 1.15;
}

.inventory-entry-items-table th:nth-child(1) { width: 430px; }
.inventory-entry-items-table th:nth-child(2) { width: 90px; }
.inventory-entry-items-table th:nth-child(3),
.inventory-entry-items-table th:nth-child(4) { width: 118px; }
.inventory-entry-items-table th:nth-child(5) { width: 230px; }
.inventory-entry-items-table th:nth-child(6) { width: 90px; }

.inventory-entry-items-table td:first-child strong {
  display: block;
  white-space: normal;
  line-height: 1.2;
}

.inventory-entry-items-table td:first-child small,
.inventory-entry-items-table td:nth-child(5) small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  line-height: 1.15;
  white-space: normal;
}

.entry-total-line {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
  color: var(--muted);
}

.entry-total-line strong {
  color: var(--ink);
  font-size: 20px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 2px;
}

.inventory-entry-history-wrap {
  max-height: clamp(220px, calc(100vh - 430px), 320px);
  scrollbar-gutter: stable;
}

.inventory-entry-history-table {
  min-width: 1040px;
  table-layout: fixed;
}

.inventory-entry-history-table th:nth-child(1) { width: 145px; }
.inventory-entry-history-table th:nth-child(2) { width: 260px; }
.inventory-entry-history-table th:nth-child(3) { width: 180px; }
.inventory-entry-history-table th:nth-child(4),
.inventory-entry-history-table th:nth-child(5),
.inventory-entry-history-table th:nth-child(6) { width: 130px; }
.inventory-entry-history-table th:nth-child(7) { width: 150px; }
.inventory-entry-history-table th:nth-child(8) { width: 150px; }

.inventory-purchase-detail-wrap {
  max-height: min(420px, calc(100vh - 390px));
  overflow: auto;
  background: #fff;
  scrollbar-gutter: stable;
}

.inventory-purchase-detail-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.inventory-purchase-detail-table th,
.inventory-purchase-detail-table td {
  white-space: normal;
  vertical-align: top;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.inventory-purchase-detail-table th {
  padding: 9px 10px;
  text-align: left;
}

.inventory-purchase-detail-table td {
  padding: 10px;
}

.inventory-purchase-detail-table th:nth-child(1),
.inventory-purchase-detail-table td:nth-child(1) { width: 34%; }

.inventory-purchase-detail-table th:nth-child(2),
.inventory-purchase-detail-table td:nth-child(2),
.inventory-purchase-detail-table th:nth-child(3),
.inventory-purchase-detail-table td:nth-child(3) { width: 9%; }

.inventory-purchase-detail-table th:nth-child(4),
.inventory-purchase-detail-table td:nth-child(4),
.inventory-purchase-detail-table th:nth-child(5),
.inventory-purchase-detail-table td:nth-child(5),
.inventory-purchase-detail-table th:nth-child(7),
.inventory-purchase-detail-table td:nth-child(7) { width: 11%; }

.inventory-purchase-detail-table th:nth-child(6),
.inventory-purchase-detail-table td:nth-child(6) { width: 15%; }

.inventory-purchase-detail-table .num {
  text-align: right;
  white-space: nowrap;
}

.inventory-purchase-detail-table td:first-child strong {
  display: block;
  font-size: 13px;
  line-height: 1.3;
}

.inventory-purchase-detail-table td small {
  color: var(--muted);
  font-size: 12px;
}

.inventory-purchase-dialog menu {
  display: flex;
  justify-content: flex-end;
  margin: 14px 0 0;
  padding: 0;
}

.inventory-kardex-panel {
  display: grid;
  gap: 14px;
}

.inventory-kardex-summary {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.inventory-kardex-filters {
  grid-template-columns: 132px 132px minmax(210px, 1.2fr) minmax(160px, .8fr) minmax(160px, .8fr) minmax(170px, .8fr) minmax(130px, .6fr);
}

.inventory-kardex-filters label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.inventory-kardex-filters input,
.inventory-kardex-filters select {
  width: 100%;
  min-width: 0;
}

.inventory-kardex-wrap {
  max-height: calc(100vh - 380px);
}

.inventory-kardex-table {
  min-width: 1320px;
  table-layout: fixed;
}

.inventory-kardex-table th,
.inventory-kardex-table td {
  vertical-align: middle;
  padding-top: 8px;
  padding-bottom: 8px;
  overflow: hidden;
}

.inventory-kardex-table th:nth-child(1) { width: 150px; }
.inventory-kardex-table th:nth-child(2) { width: 145px; }
.inventory-kardex-table th:nth-child(3) { width: 310px; }
.inventory-kardex-table th:nth-child(4) { width: 220px; }
.inventory-kardex-table th:nth-child(5),
.inventory-kardex-table th:nth-child(6),
.inventory-kardex-table th:nth-child(7) { width: 95px; }
.inventory-kardex-table th:nth-child(8) { width: 220px; }
.inventory-kardex-table th:nth-child(9) { width: 120px; }

.inventory-kardex-table td:nth-child(3),
.inventory-kardex-table td:nth-child(4),
.inventory-kardex-table td:nth-child(8) {
  white-space: normal;
  overflow-wrap: anywhere;
}

.inventory-kardex-table td:nth-child(3) strong {
  display: -webkit-box;
  max-height: 38px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.25;
  white-space: normal;
}

.inventory-kardex-table small {
  color: var(--muted);
  line-height: 1.3;
}

.inventory-kardex-table th:nth-child(5),
.inventory-kardex-table td:nth-child(5),
.inventory-kardex-table th:nth-child(6),
.inventory-kardex-table td:nth-child(6),
.inventory-kardex-table th:nth-child(7),
.inventory-kardex-table td:nth-child(7),
.inventory-kardex-table th:nth-child(9),
.inventory-kardex-table td:nth-child(9) {
  text-align: center;
}

.inventory-kardex-dialog {
  width: min(880px, 94vw);
}

.inventory-kardex-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-height: min(560px, calc(100vh - 240px));
  overflow: auto;
}

.inventory-kardex-detail-grid div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.inventory-kardex-detail-grid div.wide {
  grid-column: 1 / -1;
}

.inventory-kardex-detail-grid span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.inventory-kardex-detail-grid strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.accounts-payable-panel {
  display: grid;
  gap: 14px;
}

.accounts-payable-summary {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.accounts-payable-filters {
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 190px) minmax(130px, 170px) minmax(190px, 220px);
  align-items: end;
}

.accounts-payable-filters input,
.accounts-payable-filters select {
  width: 100%;
  min-width: 0;
}

.accounts-payable-pager {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.accounts-payable-pager button {
  min-width: 86px;
}

.accounts-payable-wrap {
  max-height: calc(100vh - 380px);
}

.accounts-payable-table {
  min-width: 1500px;
  table-layout: fixed;
}

.accounts-payable-table th,
.accounts-payable-table td {
  vertical-align: middle;
  padding-top: 8px;
  padding-bottom: 8px;
  overflow: hidden;
}

.accounts-payable-table th:nth-child(1) { width: 210px; }
.accounts-payable-table th:nth-child(2) { width: 150px; }
.accounts-payable-table th:nth-child(3) { width: 180px; }
.accounts-payable-table th:nth-child(4),
.accounts-payable-table th:nth-child(5),
.accounts-payable-table th:nth-child(6) { width: 120px; }
.accounts-payable-table th:nth-child(7),
.accounts-payable-table th:nth-child(8),
.accounts-payable-table th:nth-child(9) { width: 118px; }
.accounts-payable-table th:nth-child(10) { width: 120px; }
.accounts-payable-table th:nth-child(11) { width: 200px; }

.accounts-payable-table td:nth-child(1),
.accounts-payable-table td:nth-child(2),
.accounts-payable-table td:nth-child(3) {
  white-space: normal;
  overflow-wrap: anywhere;
}

.accounts-payable-table th:nth-child(7),
.accounts-payable-table td:nth-child(7),
.accounts-payable-table th:nth-child(8),
.accounts-payable-table td:nth-child(8),
.accounts-payable-table th:nth-child(9),
.accounts-payable-table td:nth-child(9),
.accounts-payable-table th:nth-child(11),
.accounts-payable-table td:nth-child(11) {
  text-align: center;
}

.accounts-payable-dialog {
  width: min(860px, 94vw);
}

.accounts-payable-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-height: min(560px, calc(100vh - 240px));
  overflow: auto;
}

.accounts-payable-detail-grid div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.accounts-payable-detail-grid div.wide {
  grid-column: 1 / -1;
}

.accounts-payable-detail-grid span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.accounts-payable-detail-grid strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.accounts-payable-payments-panel {
  margin-top: 14px;
}

.accounts-payable-payments-panel h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.accounts-payable-payments-wrap {
  max-height: 260px;
}

.accounts-payable-payments-table {
  min-width: 720px;
}

.accounts-payable-payments-table th,
.accounts-payable-payments-table td {
  padding: 8px;
  font-size: 12px;
}

.accounts-payable-payments-table th:nth-child(4),
.accounts-payable-payments-table td:nth-child(4),
.accounts-payable-payments-table th:nth-child(5),
.accounts-payable-payments-table td:nth-child(5),
.accounts-payable-payments-table th:nth-child(6),
.accounts-payable-payments-table td:nth-child(6) {
  text-align: center;
}

.accounts-payable-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.accounts-payable-actions button {
  min-width: 84px;
}

.accounts-payable-payment-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.accounts-payable-payment-fields .wide {
  grid-column: span 2;
}

.accounts-payable-payment-fields textarea {
  resize: vertical;
}

.accounts-payable-mixed-lines-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-title-row h3 {
  margin: 0;
  font-size: 14px;
}

.accounts-payable-mixed-lines {
  display: grid;
  gap: 10px;
  max-height: min(320px, calc(100vh - 360px));
  overflow: auto;
}

.mixed-payment-line {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(120px, 0.8fr) minmax(150px, 1fr) 1.4fr auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.mixed-payment-line .wide {
  grid-column: auto;
}

.mixed-payment-tag {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.muted-row {
  color: #667085;
  background: #fafafa;
}

.danger-text {
  color: var(--red);
}

.warn-text {
  color: #9a6700;
  font-weight: 800;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.movements-wrap.table-wrap.tall {
  max-height: none;
  overflow: visible;
}

.movements-table {
  min-width: 0;
  table-layout: fixed;
}

.movements-table th,
.movements-table td {
  white-space: normal;
  vertical-align: middle;
}

.movements-table th {
  padding-top: 8px;
  padding-bottom: 8px;
  text-align: left;
}

.movements-table th:nth-child(4),
.movements-table th.num { text-align: right; }
.movements-table th:nth-child(5) { text-align: center; }

.movements-table td {
  padding-top: 8px;
  padding-bottom: 8px;
  line-height: 1.25;
}

.movements-table th:nth-child(1) { width: 220px; }
.movements-table th:nth-child(2) { width: auto; }
.movements-table th:nth-child(3) { width: 155px; }
.movements-table th:nth-child(4) { width: 130px; }
.movements-table th:nth-child(5) { width: 170px; }

.movement-folio {
  display: block;
  line-height: 1.25;
}

.movement-primary-label,
.movement-document-label {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
}

.movement-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.movement-detail,
.movement-detail * {
  overflow-wrap: anywhere;
}

.movement-technical-reference {
  margin-top: 6px;
  color: var(--muted);
}

.movement-technical-reference summary {
  width: fit-content;
  color: #526173;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.movement-technical-reference summary:focus-visible {
  border-radius: 4px;
  outline: none;
  box-shadow: var(--focus-ring);
}

.movement-technical-reference[open] summary {
  margin-bottom: 4px;
}

.movement-technical-reference small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.movement-source strong,
.movement-source span {
  display: block;
  line-height: 1.35;
}

.movement-method-technical,
.movement-summary-technical {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.movement-summary-technical {
  display: block;
}

.movement-source span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.movement-value {
  font-weight: 800;
}

.movements-table .row-actions {
  justify-content: center;
  min-width: 0;
  white-space: normal;
}

.movements-table .row-actions.compact {
  min-width: 0;
  flex-wrap: nowrap;
}

th, td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  font-size: 13px;
}

th {
  background: #f7f9fc;
  color: #465264;
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr:hover {
  background: #fbfcfe;
}

td.num, th.num { text-align: right; }

.addi-table {
  min-width: 980px;
  table-layout: fixed;
}

.addi-table th,
.addi-table td {
  padding: 9px 10px;
  vertical-align: middle;
  text-align: center;
}

.addi-table th {
  position: sticky;
  top: 0;
  text-align: center;
}

.addi-table th:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 1px;
  height: 16px;
  transform: translateY(-50%);
  background: #d7dee8;
  pointer-events: none;
}

.addi-table th:nth-child(1),
.addi-table td:nth-child(1) { width: 14%; }
.addi-table th:nth-child(2),
.addi-table td:nth-child(2) { width: 10%; }
.addi-table th:nth-child(3),
.addi-table td:nth-child(3),
.addi-table th:nth-child(4),
.addi-table td:nth-child(4),
.addi-table th:nth-child(5),
.addi-table td:nth-child(5) { width: 11%; }
.addi-table th:nth-child(6),
.addi-table td:nth-child(6) { width: 12%; }
.addi-table th:nth-child(7),
.addi-table td:nth-child(7) { width: 10%; }
.addi-table th:nth-child(8),
.addi-table td:nth-child(8) { width: 20%; }

.addi-table td:nth-child(3),
.addi-table td:nth-child(4),
.addi-table td:nth-child(5) {
  text-align: right;
}

.addi-table th:nth-child(3),
.addi-table th:nth-child(4),
.addi-table th:nth-child(5),
.addi-table td:nth-child(7),
.addi-table td:nth-child(8) {
  text-align: center;
}

.addi-table .date-cell {
  font-weight: 700;
}

.addi-table small {
  display: block;
  color: var(--muted);
  font-weight: 500;
  text-align: center;
}

.addi-table .received-date {
  display: block;
  width: max-content;
  margin: 3px auto 0;
  text-align: center;
  line-height: 1.1;
}

.addi-table .row-actions {
  min-width: 0;
  gap: 6px;
  flex-wrap: nowrap;
  justify-content: center;
}

.addi-table .row-actions .small {
  padding: 8px 9px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px 165px;
  gap: 10px;
  margin-bottom: 12px;
}

.filter-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.payroll-person-summary {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.subtabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.embedded-tabs {
  margin-top: 14px;
}

.subtab {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px 13px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.subtab.active {
  border-color: #bfe5d4;
  background: white;
  color: var(--green);
  box-shadow: 0 8px 20px rgba(18, 32, 52, .06);
}

.close-date-bar {
  width: min(960px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid #bfe5d4;
  border-radius: 8px;
  background: #ecfdf5;
}

.close-date-bar div {
  display: grid;
  gap: 3px;
}

.close-date-bar strong {
  color: var(--green);
}

.close-date-bar span {
  color: var(--muted);
  font-size: 12px;
}

.close-date-bar input {
  width: 180px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  font-weight: 800;
  background: #fff;
}

.payroll-section,
.initial-section,
.close-section,
.month-close-tab-section,
.addi-tab-section {
  display: none;
}

.payroll-section.active,
.initial-section.active,
.close-section.active,
.month-close-tab-section.active,
.addi-tab-section.active {
  display: block;
}

.close-section[data-close-section="cash"].active {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  width: min(960px, 100%);
  max-width: none;
  overflow: visible;
  padding: 14px 16px;
}

.close-section[data-close-section="cash"].active .panel-head,
.close-section[data-close-section="cash"].active .cash-grid,
.close-section[data-close-section="cash"].active .cash-totals,
.close-section[data-close-section="cash"].active .cash-expected-summary,
.close-section[data-close-section="cash"].active .cash-actions {
  grid-column: 1 / -1;
}

.initial-layout,
.tabbed-single,
.addi-tabbed-layout {
  grid-template-columns: 1fr;
}

.close-layout.tabbed-single {
  display: block;
  width: 100%;
}

.close-layout.tabbed-single .close-section.active {
  width: min(960px, 100%);
  min-width: 0;
}

.addi-provider-panel[hidden] {
  display: none;
}

.payroll-section:not(.active),
.initial-section:not(.active),
.close-section:not(.active),
.month-close-tab-section:not(.active),
.addi-tab-section:not(.active) {
  display: none !important;
}

.filter-summary div {
  display: grid;
  gap: 4px;
  align-content: center;
  padding: 10px 11px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #f8fafc;
}

.filter-summary span {
  color: var(--muted);
  font-size: 12px;
}

.filter-summary strong {
  font-size: 15px;
}

.filter-summary.audit-initial-summary {
  grid-template-columns: minmax(0, 1fr);
}

.audit-empty-guidance {
  min-height: 96px;
  justify-items: center;
  padding: 18px;
  text-align: center;
}

.audit-empty-guidance small {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.45;
}

.legacy-history-table {
  width: 100%;
  min-width: 780px;
  table-layout: fixed;
}

.legacy-history-table th:nth-child(1),
.legacy-history-table td:nth-child(1) {
  width: 29%;
}

.legacy-history-table th:nth-child(2),
.legacy-history-table td:nth-child(2) {
  width: 21%;
}

.legacy-history-table th:nth-child(3),
.legacy-history-table td:nth-child(3) {
  width: 16%;
}

.legacy-history-table th:nth-child(4),
.legacy-history-table td:nth-child(4) {
  width: 34%;
  min-width: 0;
}

.legacy-primary-label,
.legacy-authority-label {
  display: block;
  color: var(--text);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.legacy-destination-label {
  width: fit-content;
  max-width: 100%;
  white-space: normal;
}

.legacy-technical-reference {
  margin-top: 6px;
  color: var(--muted);
}

.legacy-technical-reference summary {
  width: fit-content;
  color: #526173;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.legacy-technical-reference summary:focus-visible {
  border-radius: 4px;
  outline: none;
  box-shadow: var(--focus-ring);
}

.legacy-technical-reference[open] summary {
  margin-bottom: 4px;
}

.legacy-technical-reference small,
.legacy-technical-reference code {
  display: block;
  max-width: 100%;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: normal;
}

.filter-summary .filter-net {
  background: var(--green-soft);
  border-color: #bfe5d4;
}

.operational-report-summary {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.operational-report-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--brand-surface);
}

.operational-report-brand-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.operational-report-brand-identity img {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.operational-report-brand-identity img.brand-asset-missing {
  display: none;
}

.operational-report-brand-identity > div,
.operational-report-period {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.operational-report-brand-identity small,
.operational-report-brand-identity span,
.operational-report-period span,
.operational-report-footer span {
  color: var(--muted);
  font-size: 12px;
}

.operational-report-brand-identity strong,
.operational-report-brand-identity span,
.operational-report-footer {
  overflow-wrap: anywhere;
}

.operational-report-period {
  flex: 0 0 auto;
  text-align: right;
}

.operational-report-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.operational-report-metrics > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  align-content: center;
  padding: 10px 11px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #f8fafc;
}

.operational-report-metrics span,
.operational-report-metrics small {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.operational-report-metrics strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.operational-report-footer {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  text-align: center;
}

@media (max-width: 900px) {
  .operational-report-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .operational-report-brand {
    align-items: flex-start;
    flex-direction: column;
  }

  .operational-report-period {
    text-align: left;
  }

  .operational-report-metrics {
    grid-template-columns: 1fr;
  }
}

.audit-filters {
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 220px) minmax(170px, 210px) minmax(160px, 200px) 165px;
}

.authorization-audit-filters {
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) minmax(130px, 180px) minmax(140px, 1fr) minmax(140px, 180px) 100px auto;
}

.authorization-audit-primary-filters {
  grid-template-columns: minmax(130px, 1fr) minmax(130px, 1fr) minmax(130px, 170px) minmax(130px, 160px) minmax(130px, 160px) minmax(180px, 1.2fr) 100px auto;
}

.authorization-audit-more-filters {
  margin-top: -4px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.authorization-audit-more-filters summary {
  cursor: pointer;
  padding: 9px 12px;
  color: var(--ink);
  font-weight: 700;
}

.authorization-audit-secondary-filters {
  padding: 0 10px 10px;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) minmax(130px, 170px) minmax(130px, 160px) minmax(130px, 160px) minmax(90px, 120px);
}

.authorization-audit-date-field {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.authorization-audit-date-field span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.authorization-audit-date-field input {
  min-width: 0;
}

.authorization-audit-pager {
  margin-top: -2px;
}

.authorization-audit-table {
  min-width: 1280px;
}

.authorization-audit-table th:nth-child(1),
.authorization-audit-table td:nth-child(1) {
  width: 150px;
}

.authorization-audit-table th:nth-child(4),
.authorization-audit-table td:nth-child(4),
.authorization-audit-table th:nth-child(7),
.authorization-audit-table td:nth-child(7),
.authorization-audit-table th:nth-child(8),
.authorization-audit-table td:nth-child(8),
.authorization-audit-table th:nth-child(10),
.authorization-audit-table td:nth-child(10) {
  width: 130px;
}

.authorization-audit-dialog {
  width: min(920px, calc(100vw - 32px));
}

.authorization-audit-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.authorization-audit-detail-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfe;
  min-width: 0;
}

.authorization-audit-detail-grid div.wide {
  grid-column: 1 / -1;
}

.authorization-audit-detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.authorization-audit-detail-grid strong {
  display: block;
  overflow-wrap: anywhere;
}

.authorization-audit-json {
  margin: 0;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.45;
  color: #e2e8f0;
  background: #102033;
  border-radius: 6px;
  padding: 10px;
}

.pending-dashboard {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-top: 12px;
}

.pending-panel {
  padding: 0;
  margin-bottom: 14px;
}

.pending-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.pending-panel summary::-webkit-details-marker {
  display: none;
}

.pending-panel summary h2 {
  margin: 0 0 3px;
  font-size: 16px;
}

.pending-panel summary p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

#pendingDashboardBadge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
  background: var(--green-soft);
  color: #0f6b49;
}

#pendingDashboardBadge.warn {
  background: #fff4d6;
  color: #8a5b00;
}

#pendingDashboardBadge.danger {
  background: #fff5f5;
  color: var(--red);
}

.pending-panel #pendingDashboard {
  padding: 0 16px 16px;
}

.pending-dashboard .pending-card {
  min-height: 72px;
  border-left: 5px solid var(--green);
}

.pending-dashboard .pending-card.warn {
  border-left-color: var(--orange);
  background: #fffbeb;
  border-color: #fde7aa;
}

.pending-dashboard .pending-card.danger {
  border-left-color: var(--red);
  background: #fff5f5;
  border-color: #f6c7ce;
}

.pending-dashboard .pending-card.ok {
  border-left-color: var(--green);
  background: var(--green-soft);
  border-color: #bfe5d4;
}

.audit-table {
  min-width: 920px;
}

.traceability-panel {
  display: grid;
  gap: 12px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.trace-table {
  min-width: 980px;
}

.trace-table th:nth-child(1),
.trace-table td:nth-child(1) {
  width: 175px;
}

.trace-table th:nth-child(2),
.trace-table td:nth-child(2) {
  width: 190px;
}

.trace-table th:nth-child(3),
.trace-table td:nth-child(3) {
  width: 180px;
}

.trace-table th:nth-child(4),
.trace-table td:nth-child(4) {
  width: 150px;
}

.trace-table td:last-child {
  white-space: normal;
  min-width: 320px;
  line-height: 1.35;
}

.trace-table small {
  color: var(--muted);
  font-size: 12px;
}

.audit-table th:nth-child(1),
.audit-table td:nth-child(1) {
  width: 180px;
}

.audit-table th:nth-child(2),
.audit-table td:nth-child(2) {
  width: 110px;
}

.audit-table th:nth-child(3),
.audit-table td:nth-child(3) {
  width: 220px;
}

.audit-table td:last-child {
  white-space: normal;
  min-width: 360px;
  line-height: 1.35;
}

.audit-table small {
  color: var(--muted);
  font-size: 12px;
}

.diagnostic-panel {
  display: grid;
  gap: 12px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.manual-load-panel {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.audit-subtabs {
  margin: 12px 0;
}

.audit-section {
  display: grid;
  gap: 12px;
}

.audit-section[hidden] {
  display: none !important;
}

.manual-load-table th:nth-child(1),
.manual-load-table td:nth-child(1) {
  min-width: 220px;
}

.manual-load-table th:nth-child(2),
.manual-load-table td:nth-child(2) {
  width: 150px;
}

.manual-load-table th:nth-child(3),
.manual-load-table td:nth-child(3) {
  width: 150px;
}

.manual-load-table td:last-child {
  white-space: normal;
  min-width: 260px;
}

.manual-load-table small {
  color: var(--muted);
  font-size: 12px;
}

.reconciliation-live-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 12px;
}

.reconciliation-live-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.reconciliation-live-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.reconciliation-live-head h3 {
  margin: 0;
}

.reconciliation-live-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.reconciliation-live-values {
  display: grid;
  gap: 10px;
}

.reconciliation-live-values > div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.reconciliation-live-values span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.reconciliation-live-card textarea {
  min-height: 70px;
  resize: vertical;
}

.bank-import-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.bank-import-grid {
  display: grid;
  grid-template-columns: minmax(180px, .7fr) minmax(320px, 1.3fr);
  gap: 10px;
  align-items: start;
  margin-bottom: 12px;
}

.bank-import-grid label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.bank-import-file-field {
  padding: 10px 12px;
  border: 1px solid #dfe7ef;
  border-radius: 8px;
  background: #f8fafc;
}

.bank-import-grid input[type="file"] {
  width: 100%;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

.bank-import-grid input[type="file"]::file-selector-button {
  min-height: 36px;
  margin-right: 10px;
  padding: 7px 11px;
  border: 1px solid #b9c6d4;
  border-radius: 6px;
  background: #eef3f7;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.bank-import-grid input[type="file"]::file-selector-button:hover {
  background: #e3ebf2;
}

.bank-import-help,
.reconciliation-technical-reference {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.reconciliation-technical-reference {
  margin-top: 2px;
}

.bank-import-grid .wide {
  grid-column: 1 / -1;
}

.bank-import-grid textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
}

.bank-import-grid > button {
  width: min(100%, 220px);
}

.bank-reconciliation-table {
  min-width: 0;
  table-layout: fixed;
}

.bank-reconciliation-table th,
.bank-reconciliation-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}

.diagnostic-list {
  display: grid;
  gap: 8px;
}

.diagnostic-item {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid #f6d28b;
  border-radius: 8px;
  background: #fff8e8;
}

.diagnostic-item.alta {
  border-color: #f3a8a8;
  background: #fff1f1;
}

.diagnostic-item > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.diagnostic-item span {
  font-weight: 800;
  color: var(--muted);
}

.diagnostic-item p {
  margin: 0;
  font-weight: 800;
}

.diagnostic-item small {
  color: var(--muted);
}

input, select, textarea {
  min-height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 8px 10px;
  background: var(--color-surface);
  color: var(--ink);
  max-width: 100%;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--color-accent);
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
  box-shadow: var(--focus-ring);
}

input:disabled,
select:disabled,
textarea:disabled {
  border-color: var(--color-disabled-border);
  background: var(--color-disabled-surface);
  color: var(--color-disabled-text);
  cursor: not-allowed;
}

.close-layout, .records-layout {
  display: grid;
  grid-template-columns: minmax(320px, .75fr) minmax(420px, 1.25fr);
  gap: 14px;
}

.credit-summary {
  margin-bottom: 12px;
}

.client-filters {
  margin-bottom: 12px;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 260px);
}

.client-table small {
  display: block;
  font-size: 12px;
  line-height: 1.35;
  margin-top: 3px;
}

.client-table .customer-technical-reference {
  color: var(--muted);
  font-size: 12px;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.client-table .customer-identity-label,
.client-table .customer-history-primary {
  color: var(--ink);
  font-weight: 700;
}

.client-table th:nth-child(1),
.client-table td:nth-child(1) { width: 18%; }
.client-table th:nth-child(2),
.client-table td:nth-child(2) { width: 17%; }
.client-table th:nth-child(3),
.client-table td:nth-child(3) { width: 12%; }
.client-table th:nth-child(4),
.client-table td:nth-child(4) { width: 14%; }
.client-table th:nth-child(5),
.client-table td:nth-child(5) { width: 27%; }
.client-table th:nth-child(6),
.client-table td:nth-child(6) { width: 12%; }

.credit-metric {
  min-height: 100px;
}

.credit-layout {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.supplier-layout {
  margin-top: 14px;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.credit-panel {
  min-width: 0;
}

#credits .receivables-panel {
  overflow: hidden;
}

#credits .receivables-panel .panel-head {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

#credits .receivables-panel .panel-head h2 {
  margin-bottom: 4px;
}

#credits .receivables-authority-tag {
  align-self: flex-start;
  color: #526173;
  background: #f1f5f9;
}

.receivables-empty-state {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-height: 124px;
  padding: 26px 20px;
  border: 1px dashed #b9c6d6;
  border-radius: var(--radius-sm);
  color: #43536a;
  text-align: center;
  background: #f8fafc;
}

.receivables-empty-state[hidden] {
  display: none !important;
}

.receivables-empty-state::before {
  content: "";
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--brand-primary);
}

.receivables-empty-state strong {
  color: #172033;
  font-size: 15px;
}

.receivables-empty-state span {
  max-width: 560px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.credit-table-wrap {
  overflow-x: hidden;
}

.credit-table {
  min-width: 0;
  table-layout: fixed;
}

.credit-table th,
.credit-table td {
  white-space: normal;
  vertical-align: top;
}

#receivableCreateDialog,
#receivableDetailDialog {
  width: min(920px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.receivable-product-search {
  margin: 12px 0;
}

#receivableCreateDialog .credit-products-table th:nth-child(1),
#receivableCreateDialog .credit-products-table td:nth-child(1) { width: 42%; text-align: left; }
#receivableCreateDialog .credit-products-table th:nth-child(2),
#receivableCreateDialog .credit-products-table td:nth-child(2),
#receivableCreateDialog .credit-products-table th:nth-child(3),
#receivableCreateDialog .credit-products-table td:nth-child(3),
#receivableCreateDialog .credit-products-table th:nth-child(4),
#receivableCreateDialog .credit-products-table td:nth-child(4) { width: 17%; }
#receivableCreateDialog .credit-products-table th:nth-child(5),
#receivableCreateDialog .credit-products-table td:nth-child(5) { width: 90px; }

.receivable-action-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.receivable-action-form h4 {
  margin: 0;
}

.receivable-lifecycle-actions {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

#receivableCreateDialog menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 0 0;
  margin: 0;
}

.credit-products-editor {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  align-self: start;
}

.mini-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mini-panel-head div {
  display: grid;
  gap: 3px;
}

.mini-panel-head small {
  color: var(--muted);
  font-size: 12px;
}

.credit-products-wrap {
  overflow: auto;
  max-height: 168px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.credit-products-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  table-layout: fixed;
  border: 0;
  background: white;
}

.credit-products-table th,
.credit-products-table td {
  padding: 6px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.credit-products-table th {
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  background: #f1f5f9;
  position: sticky;
  top: 0;
  z-index: 1;
}

.credit-products-table th:nth-child(1),
.credit-products-table td:nth-child(1) { width: 44px; text-align: center; }
.credit-products-table th:nth-child(2),
.credit-products-table td:nth-child(2) { width: 38%; }
.credit-products-table th:nth-child(3),
.credit-products-table td:nth-child(3) { width: 12%; }
.credit-products-table th:nth-child(4),
.credit-products-table td:nth-child(4) { width: 17%; }
.credit-products-table th:nth-child(5),
.credit-products-table td:nth-child(5) { width: 17%; }
.credit-products-table th:nth-child(6),
.credit-products-table td:nth-child(6) { width: 78px; }

.credit-products-table input {
  width: 100%;
  min-height: 32px;
  padding: 7px 9px;
}

.credit-products-total {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 8px 2px 0;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

.credit-products-total span {
  color: var(--muted);
  font-size: 12px;
}

.credit-products-total strong {
  font-size: 18px;
}

#formFields input[name="amountDisplay"][readonly] {
  background: #eef6f1;
  font-weight: 800;
  color: #052e1b;
}

.initial-layaway-deposit {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #b7e4c7;
  border-radius: 8px;
  background: #ecfdf3;
}

.initial-layaway-deposit[hidden] {
  display: none !important;
}

.initial-deposit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.initial-deposit-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.credit-invoice-table th:nth-child(1),
.credit-invoice-table td:nth-child(1) { width: 18%; }
.credit-invoice-table th:nth-child(2),
.credit-invoice-table td:nth-child(2) { width: 10%; }
.credit-invoice-table th:nth-child(3),
.credit-invoice-table td:nth-child(3),
.credit-invoice-table th:nth-child(4),
.credit-invoice-table td:nth-child(4) { width: 10%; }
.credit-invoice-table th:nth-child(5),
.credit-invoice-table td:nth-child(5) { width: 10%; }
.credit-invoice-table th:nth-child(6),
.credit-invoice-table td:nth-child(6) {
  width: 15%;
  min-width: 122px;
}
.credit-invoice-table th:nth-child(7),
.credit-invoice-table td:nth-child(7) {
  width: 24%;
  min-width: 180px;
}
.credit-invoice-table th:nth-child(8),
.credit-invoice-table td:nth-child(8) { width: 13%; }

.credit-invoice-table th:nth-child(6),
.credit-invoice-table td:nth-child(6),
.credit-invoice-table th:nth-child(7),
.credit-invoice-table td:nth-child(7) {
  overflow-wrap: anywhere;
}

.supplier-invoice-table th:nth-child(1),
.supplier-invoice-table td:nth-child(1) { width: 13%; }
.supplier-invoice-table th:nth-child(2),
.supplier-invoice-table td:nth-child(2) { width: 9%; }
.supplier-invoice-table th:nth-child(3),
.supplier-invoice-table td:nth-child(3),
.supplier-invoice-table th:nth-child(4),
.supplier-invoice-table td:nth-child(4) { width: 8%; }
.supplier-invoice-table th:nth-child(5),
.supplier-invoice-table td:nth-child(5) { width: 12%; }
.supplier-invoice-table th:nth-child(6),
.supplier-invoice-table td:nth-child(6) {
  width: 8%;
}
.supplier-invoice-table th:nth-child(7),
.supplier-invoice-table td:nth-child(7) {
  width: 13%;
}
.supplier-invoice-table th:nth-child(8),
.supplier-invoice-table td:nth-child(8) { width: 18%; }
.supplier-invoice-table th:nth-child(9),
.supplier-invoice-table td:nth-child(9) { width: 11%; }

.supplier-payment-table th:nth-child(1),
.supplier-payment-table td:nth-child(1) { width: 12%; }
.supplier-payment-table th:nth-child(2),
.supplier-payment-table td:nth-child(2) { width: 19%; }
.supplier-payment-table th:nth-child(3),
.supplier-payment-table td:nth-child(3) { width: 16%; }
.supplier-payment-table th:nth-child(4),
.supplier-payment-table td:nth-child(4) { width: 15%; }
.supplier-payment-table th:nth-child(5),
.supplier-payment-table td:nth-child(5) { width: 12%; }
.supplier-payment-table th:nth-child(6),
.supplier-payment-table td:nth-child(6) { width: 10%; }
.supplier-payment-table th:nth-child(7),
.supplier-payment-table td:nth-child(7) { width: 10%; }
.supplier-payment-table th:nth-child(8),
.supplier-payment-table td:nth-child(8) { width: 9%; }

.supplier-invoice-table th:nth-child(6),
.supplier-invoice-table td:nth-child(6),
.supplier-invoice-table th:nth-child(7),
.supplier-invoice-table td:nth-child(7),
.supplier-invoice-table th:nth-child(8),
.supplier-invoice-table td:nth-child(8),
.supplier-payment-table th:nth-child(2),
.supplier-payment-table td:nth-child(2),
.supplier-payment-table th:nth-child(3),
.supplier-payment-table td:nth-child(3),
.supplier-payment-table th:nth-child(4),
.supplier-payment-table td:nth-child(4) {
  overflow-wrap: anywhere;
}

.deposit-table th:nth-child(1),
.deposit-table td:nth-child(1) { width: 12%; }
.deposit-table th:nth-child(2),
.deposit-table td:nth-child(2) { width: 18%; }
.deposit-table th:nth-child(3),
.deposit-table td:nth-child(3) { width: 20%; }
.deposit-table th:nth-child(4),
.deposit-table td:nth-child(4) { width: 12%; }
.deposit-table th:nth-child(5),
.deposit-table td:nth-child(5) { width: 11%; }
.deposit-table th:nth-child(6),
.deposit-table td:nth-child(6) { width: 13%; }
.deposit-table th:nth-child(7),
.deposit-table td:nth-child(7) { width: 14%; }

.empty-row td {
  padding: 24px 12px;
  text-align: center;
  color: var(--muted);
  white-space: normal;
}

.addi-tabbed-layout {
  display: block;
}

.addi-tabbed-layout .addi-tab-section.active {
  width: 100%;
}

.addi-register-panel {
  max-width: 920px;
  margin-right: auto;
}

.addi-register-panel .inline-form {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.addi-register-panel .calc-preview {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.addi-bold-list-column {
  display: grid;
  gap: 14px;
  align-content: start;
}

.addi-bold-list-column.active {
  display: grid;
}

.addi-filter-panel {
  padding-bottom: 6px;
}

.addi-provider-panel .panel-head {
  align-items: flex-start;
}

.panel-total {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.addi-provider-table {
  max-height: 560px;
}

.acquirer-empty-state {
  display: grid;
  min-height: 132px;
  place-content: center;
  gap: 6px;
  padding: 22px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  text-align: center;
}

.acquirer-empty-state strong {
  color: var(--ink);
  font-size: 16px;
}

.acquirer-empty-state[hidden] {
  display: none !important;
}

.provider-table {
  min-width: 0;
  table-layout: fixed;
}

.provider-table th,
.provider-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}

.collaborator-table {
  min-width: 0;
  table-layout: fixed;
}

.collaborator-table th,
.collaborator-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}

.collaborator-table th:nth-child(1),
.collaborator-table td:nth-child(1) { width: 16%; }
.collaborator-table th:nth-child(2),
.collaborator-table td:nth-child(2) { width: 9%; }
.collaborator-table th:nth-child(3),
.collaborator-table td:nth-child(3) { width: 12%; }
.collaborator-table th:nth-child(4),
.collaborator-table td:nth-child(4) { width: 10%; }
.collaborator-table th:nth-child(5),
.collaborator-table td:nth-child(5) { width: 11%; }
.collaborator-table th:nth-child(6),
.collaborator-table td:nth-child(6) { width: 15%; }
.collaborator-table th:nth-child(7),
.collaborator-table td:nth-child(7) { width: 8%; }
.collaborator-table th:nth-child(8),
.collaborator-table td:nth-child(8) { width: 19%; }

.collaborator-table .row-actions {
  min-width: 0;
  white-space: normal;
  flex-wrap: wrap;
}

.provider-table th:nth-child(1),
.provider-table td:nth-child(1) { width: 20%; }
.provider-table th:nth-child(2),
.provider-table td:nth-child(2) { width: 13%; }
.provider-table th:nth-child(3),
.provider-table td:nth-child(3) { width: 14%; }
.provider-table th:nth-child(4),
.provider-table td:nth-child(4) { width: 14%; }
.provider-table th:nth-child(5),
.provider-table td:nth-child(5) { width: 13%; }
.provider-table th:nth-child(6),
.provider-table td:nth-child(6) { width: 8%; }
.provider-table th:nth-child(7),
.provider-table td:nth-child(7) { width: 18%; }

.provider-table .row-actions {
  min-width: 0;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.provider-inline-form {
  display: none;
}

.initial-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  max-width: 980px;
}

.settings-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.settings-preview div {
  display: grid;
  gap: 4px;
}

.settings-preview span {
  color: var(--muted);
  font-size: 12px;
}

.settings-preview strong {
  font-size: 15px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.admin-card {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(21, 31, 48, 0.04);
}

.admin-card h3 {
  margin: 0 0 5px;
  font-size: 16px;
}

.admin-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-actions button,
.admin-card > button {
  min-width: 150px;
  justify-content: center;
}

.admin-card button {
  border-color: #c7d2e3;
  background: #f6f9fd;
  color: #172033;
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.04);
  font-weight: 700;
}

.admin-card button:hover {
  background: #eef4fb;
  border-color: #9fb2cc;
}

.admin-card button.primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.admin-card button.danger {
  color: var(--red);
  border-color: #e7aeb6;
  background: #fff5f6;
}

.secondary {
  background: #f6f9fd;
  color: var(--ink);
}

.muted-card {
  background: #f8fafc;
}

.admin-card .backup-select {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.admin-card .backup-control {
  color: var(--muted);
}

.admin-card .external-backup-control {
  border-color: var(--line);
  background: #f8fafc;
}

.admin-card .external-backup-control small {
  color: var(--muted);
}

.admin-card .external-backup-control span {
  color: var(--ink);
}

.profitability-panel {
  padding: 0;
  margin-top: 14px;
  margin-bottom: 14px;
}

.profitability-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.profitability-panel summary::-webkit-details-marker {
  display: none;
}

.profitability-panel summary h2 {
  margin: 0 0 3px;
  font-size: 16px;
}

.profitability-panel summary p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.profitability-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--green-soft);
  color: #0f6b49;
  font-size: 13px;
}

.profitability-summary {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, minmax(150px, 1fr));
  gap: 10px;
  padding: 0 16px 16px;
}

.profitability-disclaimer {
  grid-column: 1 / -1;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #f2d08a;
  border-radius: 8px;
  background: #fff7e6;
  color: #744b00;
  font-size: 13px;
}

.profitability-summary > div,
.profitability-main {
  display: grid;
  gap: 4px;
  align-content: center;
  min-height: 70px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.profitability-main {
  background: linear-gradient(135deg, #0c2c30, #15865f);
  color: white;
}

.profitability-main.negative {
  background: linear-gradient(135deg, #3b1220, #b4233c);
}

.profitability-summary span,
.profitability-summary small {
  color: var(--muted);
  font-size: 12px;
}

.profitability-main span,
.profitability-main small {
  color: rgba(255, 255, 255, .78);
}

.profitability-summary strong {
  font-size: 17px;
}

.profitability-main strong {
  font-size: 24px;
}

.profitability-break-even {
  border-color: #bdd7ff !important;
  background: #f5f9ff !important;
}

.profitability-break-even strong {
  color: var(--blue);
}

.form-grid.rules-form {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  align-items: start;
}

.rule-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.rule-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.rule-card-head strong {
  color: var(--green);
  font-size: 15px;
}

.rule-card-head span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.rule-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.rule-fields.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rule-fields label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.rule-fields textarea {
  resize: vertical;
}

.settings-table {
  margin-top: 14px;
}

.payroll-table {
  min-width: 980px;
}

.payroll-table th,
.payroll-table td {
  white-space: normal;
  vertical-align: middle;
}

.payroll-table th:first-child,
.payroll-table td:first-child {
  white-space: nowrap;
}

.attendance-select {
  min-width: 105px;
  width: 100%;
  padding-inline: 8px;
}

.payroll-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.payroll-operation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
  margin-bottom: 16px;
}

.payroll-canonical-form {
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.payroll-canonical-form h3 {
  margin: 0;
  font-size: 15px;
}

#payroll .table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

#payroll .settings-table {
  min-width: 760px;
}

#payrollCanonicalSummary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.payroll-advance-panel,
.payroll-history-panel,
.payroll-bonus-panel {
  margin-top: 14px;
}

.bonus-import-grid {
  display: grid;
  grid-template-columns: minmax(260px, .7fr) minmax(420px, 1.3fr) 190px;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 12px;
}

.bonus-import-grid > div,
.bonus-import-grid > label {
  min-width: 0;
}

.bonus-import-grid textarea {
  resize: vertical;
  min-height: 76px;
  height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font: inherit;
  width: 100%;
  box-sizing: border-box;
  display: block;
}

.field-help {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.35;
}

#importSalesReport {
  align-self: end;
  min-height: 60px;
  white-space: normal;
  line-height: 1.2;
}

.bonus-summary {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.bonus-list {
  display: grid;
  gap: 14px;
}

.bonus-section {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.bonus-section h3 {
  margin: 0;
  padding: 12px 14px;
  background: #eef4f1;
  color: #315645;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-size: 14px;
}

.bonus-grid-row {
  display: grid;
  align-items: center;
  gap: 14px;
  min-width: 980px;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
}

.bonus-grid-row.report-grid,
.bonus-vendor-row {
  grid-template-columns: minmax(290px, 1.5fr) 210px 130px 75px 75px 110px;
}

.bonus-grid-row.person-grid,
.bonus-person-row {
  grid-template-columns: minmax(260px, 1.35fr) 90px 130px 75px 75px 125px 170px 170px;
}

.bonus-grid-row.prior-grid,
.bonus-prior-row {
  grid-template-columns: minmax(260px, 1.4fr) 130px 80px 80px 125px 160px 150px;
}

.bonus-grid-row.total-grid,
.bonus-total-row {
  grid-template-columns: 1fr .8fr 1fr 1fr .9fr .9fr;
}

.bonus-grid-head {
  background: #f4f7fb;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
}

.bonus-vendor-row {
  background: #fbfcfe;
}

.bonus-person-row {
  background: #f6fbf8;
}

.bonus-prior-section h3 {
  background: #fff4d6;
  color: #7a4f00;
}

.bonus-prior-row {
  background: #fffcf2;
}

.bonus-grid-row strong,
.bonus-grid-row small {
  display: block;
}

.bonus-grid-row small {
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.25;
}

.bonus-grid-row select {
  width: 100%;
}

.bonus-empty {
  padding: 18px;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.month-close-card {
  grid-column: 1 / -1;
}

.month-close-summary {
  display: grid;
  gap: 16px;
}

.month-close-overview {
  display: grid;
  grid-template-columns: minmax(260px, .95fr) minmax(240px, .75fr) minmax(280px, 1fr);
  gap: 12px;
  align-items: stretch;
}

.month-close-hero {
  display: grid;
  gap: 8px;
  min-height: 150px;
  padding: 18px;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, var(--color-navigation), var(--brand-primary));
}

.month-close-hero span {
  opacity: .78;
  font-size: 12px;
}

.month-close-hero strong {
  font-size: 32px;
  line-height: 1;
}

.month-close-hero small {
  opacity: .82;
}

.month-close-continuity,
.method-balance-list {
  display: grid;
  gap: 8px;
}

.month-close-continuity div,
.method-balance-card {
  display: grid;
  gap: 5px;
  align-content: center;
  padding: 12px;
  border: 1px solid #dce7f1;
  border-radius: 8px;
  background: #ffffff;
}

.month-close-continuity span,
.method-balance-card span {
  color: var(--muted);
  font-size: 12px;
}

.month-close-continuity strong,
.method-balance-card strong {
  font-size: 15px;
}

.method-balance-card {
  background: #f8fafc;
}

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

.month-close-group {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.month-close-group.full {
  grid-column: 1 / -1;
}

.month-close-group h3 {
  margin: 0;
  color: #0e1726;
  font-size: 15px;
}

.month-close-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.month-close-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.month-close-item {
  display: grid;
  gap: 5px;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #f8fafc;
}

.month-close-item span {
  color: var(--muted);
  font-size: 12px;
}

.month-close-item strong {
  font-size: 15px;
}

.month-close-item.strong {
  background: var(--green-soft);
  border-color: #bfe5d4;
}

.month-close-item.wide {
  grid-column: 1 / -1;
}

.month-close-item.wide strong {
  line-height: 1.45;
}

.month-close-source-list {
  padding: 12px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #f8fafc;
  line-height: 1.55;
  font-weight: 800;
}

.month-close-context-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.month-close-context-grid > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #dfe7ef;
  border-radius: 8px;
  background: #f8fafc;
}

.month-close-context-grid span {
  color: var(--muted);
  font-size: 12px;
}

.month-close-context-grid strong {
  overflow-wrap: anywhere;
}

.month-close-technical-reference {
  padding: 9px 11px;
  border: 1px solid #dfe7ef;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
}

.month-close-technical-reference summary {
  width: fit-content;
  color: #526173;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.month-close-technical-reference summary:focus-visible {
  border-radius: 4px;
  outline: none;
  box-shadow: var(--focus-ring);
}

.month-close-technical-reference[open] summary {
  margin-bottom: 6px;
}

.month-close-technical-reference small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.method-breakdown {
  display: grid;
  gap: 10px;
}

.method-breakdown-head h4 {
  margin: 0;
  font-size: 15px;
}

.method-breakdown-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.method-summary-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.method-detail-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.method-detail-card summary {
  min-height: 58px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
  background: #f8fafc;
}

.method-detail-card summary::-webkit-details-marker {
  display: none;
}

.method-detail-card summary span:first-child {
  display: grid;
  gap: 3px;
}

.method-detail-card summary strong {
  font-size: 15px;
}

.method-detail-card summary small {
  color: var(--muted);
  font-weight: 800;
}

.single-method-breakdown {
  display: grid;
}

.single-method-breakdown > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-top: 1px solid #edf1f6;
  font-size: 13px;
}

.single-method-breakdown > div span {
  color: var(--muted);
}

.single-method-breakdown > div.strong {
  background: #f8fafc;
  font-weight: 900;
}

.single-method-breakdown > div.difference {
  background: var(--green-soft);
  font-weight: 900;
}

.single-method-breakdown > div.muted {
  color: var(--muted);
}

.month-reconciliation {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.reconciliation-head,
.reconciliation-row {
  display: grid;
  grid-template-columns: minmax(120px, .7fr) repeat(3, minmax(140px, 1fr)) minmax(120px, .7fr) minmax(120px, .7fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.reconciliation-head {
  background: #f6f8fb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.reconciliation-row {
  border-top: 1px solid #edf1f6;
  background: #fff;
}

.reconciliation-row span {
  text-align: right;
  font-weight: 800;
}

.reconciliation-row strong {
  font-size: 14px;
}

.reconciliation-row.total {
  background: var(--green-soft);
}

.reconciliation-actions {
  text-align: right;
}

.reconciliation-row .status-pill {
  justify-content: center;
}

.month-close-note {
  color: var(--muted);
  font-size: 13px;
}

.month-close-item.danger {
  border-color: #f0b9c0;
  background: #fff6f7;
}

.month-close-item.danger strong {
  color: var(--red);
}

.month-close-warning {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #ffd29a;
  border-radius: 8px;
  background: #fff7e8;
  color: #7a4b00;
}

.month-close-warning span,
.month-close-warning small {
  color: #7a4b00;
}

.month-close-info {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #b9d7ff;
  border-radius: 8px;
  background: #eef6ff;
  color: #17456f;
}

.month-close-info span,
.month-close-info small {
  color: #17456f;
}

.month-close-empty {
  margin-top: 10px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfe;
}

.reconciliation-cases {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.reconciliation-cases h3 {
  margin: 0;
  font-size: 15px;
}

.reconciliation-case {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.reconciliation-case > div:first-child,
.case-values {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.case-values {
  color: var(--muted);
  font-size: 13px;
}

.reconciliation-case p {
  margin: 0;
}

.reconciliation-case small {
  color: var(--muted);
}

.close-summary {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.cash-grid {
  display: grid;
  width: 100%;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: visible;
  min-height: 0;
}

.cash-row {
  display: grid;
  grid-template-columns: minmax(112px, 1fr) minmax(95px, .8fr) minmax(95px, .8fr) minmax(112px, .9fr) minmax(120px, 1fr);
  align-items: center;
  gap: 10px;
  padding: 2px 8px;
  border-bottom: 1px solid #edf1f6;
}

.cash-row:last-child {
  border-bottom: 0;
}

.cash-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f6f8fb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cash-row strong,
.cash-row [data-cash-subtotal] {
  color: var(--ink);
  font-size: 12px;
}

.cash-row input {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  padding: 3px 8px;
}

.cash-totals {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 0;
}

.cash-totals div {
  display: grid;
  gap: 5px;
  padding: 8px 12px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #f8fafc;
}

.cash-totals span {
  color: var(--muted);
  font-size: 12px;
}

.cash-totals strong {
  font-size: 16px;
}

.cash-grand-total {
  background: var(--green-soft) !important;
  border-color: #bfe5d4 !important;
}

.cash-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 2px;
}

.cash-actions .primary {
  min-height: 40px;
  white-space: normal;
}

.cash-transfer-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cash-transfer-form.standalone {
  max-width: 720px;
}

.cash-transfer-form h3 {
  margin: 0;
  font-size: 14px;
}

.cash-transfer-form p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.cash-transfer-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.cash-transfer-form .wide {
  grid-column: 1 / -1;
}

.cash-transfer-form button {
  justify-self: end;
  align-self: end;
  grid-column: 1 / -1;
}

.recent-cash-counts {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.recent-cash-counts h3 {
  font-size: 14px;
  margin-bottom: 8px;
}

.recent-cash-counts p {
  color: var(--muted);
  font-size: 13px;
}

.cash-count-card {
  display: grid;
  gap: 5px;
  padding: 10px 0;
  border-bottom: 1px solid #edf1f6;
}

.cash-count-card div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.cash-count-card span,
.cash-count-card small {
  color: var(--muted);
  font-size: 12px;
}

.cash-kardex-summary {
  margin-bottom: 12px;
}

.cash-kardex-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.cash-kardex-table th,
.cash-kardex-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}

.cash-kardex-table th:nth-child(1),
.cash-kardex-table td:nth-child(1) {
  width: 82px;
}

.cash-kardex-table th:nth-child(2),
.cash-kardex-table td:nth-child(2) {
  width: 112px;
}

.cash-kardex-table th:nth-child(3),
.cash-kardex-table td:nth-child(3) {
  width: 82px;
}

.cash-kardex-table th:nth-child(4),
.cash-kardex-table td:nth-child(4),
.cash-kardex-table th:nth-child(5),
.cash-kardex-table td:nth-child(5),
.cash-kardex-table th:nth-child(6),
.cash-kardex-table td:nth-child(6),
.cash-kardex-table th:nth-child(7),
.cash-kardex-table td:nth-child(7),
.cash-kardex-table th:nth-child(8),
.cash-kardex-table td:nth-child(8),
.cash-kardex-table th:nth-child(9),
.cash-kardex-table td:nth-child(9) {
  width: 86px;
}

.cash-expected-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.cash-expected-card {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #f8fafc;
}

.cash-expected-card span,
.cash-expected-card small {
  color: var(--muted);
  font-size: 12px;
}

.cash-expected-card strong {
  font-size: 16px;
}

.cash-expected-card strong.ok {
  color: var(--green);
}

.cash-expected-card strong.warn {
  color: var(--red);
}

.cash-expected-card.wide {
  background: var(--green-soft);
  border-color: #bfe5d4;
}

dialog {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0;
  width: min(var(--dialog-max-width), calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
}

dialog.credit-entry-dialog {
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 56px);
  overflow: hidden;
}

dialog::backdrop { background: rgba(18, 32, 52, .58); }

.ui-modal {
  width: min(var(--dialog-max-width), calc(100vw - 32px));
}

.ui-modal > form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 34px);
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.ui-modal .modal-head {
  flex: 0 0 auto;
}

.ui-modal .app-action-body,
.ui-modal .critical-authorization-fields,
.ui-modal .accounts-payable-payment-fields,
.ui-modal .form-grid,
.ui-modal .ui-modal-scroll {
  min-height: 0;
}

.ui-modal menu {
  position: sticky;
  bottom: 0;
  z-index: 1;
  flex: 0 0 auto;
  flex-wrap: wrap;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.ui-login-card {
  color: var(--color-text);
}

.ui-shell-sidebar,
.ui-toolbar {
  position: relative;
}

.ui-form {
  min-width: 0;
}

.ui-form label {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.uxui3-form {
  min-width: 0;
}

.ui-field-label {
  position: relative;
  min-width: 0;
}

.ui-field-requirement {
  display: block;
  margin-left: auto;
  color: var(--color-text-subtle);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  line-height: 1.3;
}

.ui-field-label:has(> input, > select, > textarea) .ui-field-requirement {
  margin: 0 0 var(--space-1);
}

.ui-field-error {
  display: block;
  margin-top: var(--space-1);
  color: var(--color-danger);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1.35;
}

.ui-form-summary,
.ui-form-state {
  width: 100%;
  margin: var(--space-2) 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-danger-border);
  border-radius: var(--radius-lg);
  background: var(--color-danger-surface);
  color: var(--color-danger);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-body);
}

.ui-form-state {
  border-color: var(--color-warning-border);
  background: var(--color-warning-surface);
  color: var(--color-warning);
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-danger) 18%, transparent);
}

.uxui3-form[aria-busy="true"] {
  cursor: progress;
}

button.is-loading {
  position: relative;
  padding-left: 34px;
}

button.is-loading::before {
  content: "";
  position: absolute;
  left: 12px;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: uxui3-spin .7s linear infinite;
}

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

.field-hint,
.field-message {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-body);
}

.field-message.error,
.validation-message {
  color: var(--color-danger);
}

.search-field,
input[type="search"] {
  padding-inline-start: var(--space-3);
}

.ui-card {
  border-color: var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}

.badge,
.status-chip,
.ui-badge,
.ui-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-subtle);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
}

.alert,
.ui-alert {
  padding: var(--space-3);
  border: 1px solid var(--color-info-border);
  border-radius: var(--radius-lg);
  background: var(--color-info-surface);
  color: var(--color-info);
  line-height: var(--line-height-body);
}

.alert.success,
.ui-alert.success {
  border-color: var(--color-success-border);
  background: var(--color-success-surface);
  color: var(--color-success);
}

.alert.warning,
.ui-alert.warning {
  border-color: var(--color-warning-border);
  background: var(--color-warning-surface);
  color: var(--color-warning);
}

.alert.danger,
.ui-alert.danger {
  border-color: var(--color-danger-border);
  background: var(--color-danger-surface);
  color: var(--color-danger);
}

.app-feedback-region {
  position: relative;
  z-index: var(--z-sticky);
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.app-feedback-banner,
.app-toast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-width: 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-info-border);
  border-radius: var(--radius-lg);
  background: var(--color-info-surface);
  color: var(--color-info);
  box-shadow: var(--shadow-sm);
}

.app-feedback-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.app-feedback-copy strong,
.app-feedback-copy span {
  overflow-wrap: anywhere;
}

.app-feedback-copy span {
  color: inherit;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-body);
}

.app-feedback-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.app-feedback-banner[data-tone="success"],
.app-toast[data-tone="success"] {
  border-color: var(--color-success-border);
  background: var(--color-success-surface);
  color: var(--color-success);
}

.app-feedback-banner[data-tone="warning"],
.app-toast[data-tone="warning"] {
  border-color: var(--color-warning-border);
  background: var(--color-warning-surface);
  color: var(--color-warning);
}

.app-feedback-banner[data-tone="danger"],
.app-toast[data-tone="danger"] {
  border-color: var(--color-danger-border);
  background: var(--color-danger-surface);
  color: var(--color-danger);
}

.app-toast-region {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: var(--z-modal);
  display: grid;
  width: min(420px, calc(100vw - (2 * var(--space-4))));
  max-height: min(60vh, 520px);
  gap: var(--space-2);
  overflow-y: auto;
  pointer-events: none;
}

.app-toast {
  pointer-events: auto;
  animation: uxui5-toast-in 160ms ease-out;
}

.ui-view-state {
  position: fixed;
  top: max(84px, calc(env(safe-area-inset-top) + 72px));
  right: max(var(--space-4), env(safe-area-inset-right));
  z-index: calc(var(--z-navigation) + 2);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  width: min(420px, calc(100vw - (2 * var(--space-4))));
  min-width: 0;
  margin: 0;
  padding: var(--space-3);
  border: 1px solid var(--color-info-border);
  border-radius: var(--radius-lg);
  background: var(--color-info-surface);
  color: var(--color-info);
  box-shadow: var(--shadow-lg);
}

.ui-view-state[hidden] {
  display: none;
}

.ui-view-state[data-tone="success"] {
  border-color: var(--color-success-border);
  background: var(--color-success-surface);
  color: var(--color-success);
}

.ui-view-state[data-tone="warning"] {
  border-color: var(--color-warning-border);
  background: var(--color-warning-surface);
  color: var(--color-warning);
}

.ui-view-state[data-tone="danger"] {
  border-color: var(--color-danger-border);
  background: var(--color-danger-surface);
  color: var(--color-danger);
}

.ui-state-loading::before,
.ui-state-saving::before,
.ui-state-pending::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: uxui3-spin .7s linear infinite;
}

@keyframes uxui5-toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.toolbar,
.ui-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.topbar.ui-toolbar {
  gap: var(--space-4);
}

.ui-table th {
  color: var(--color-text-muted);
  background: var(--color-surface-subtle);
}

.ui-table tbody tr:hover {
  background: var(--color-surface-subtle);
}

.skeleton {
  min-height: 16px;
  border-radius: var(--radius-sm);
  background: #e8edf3;
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

.loading-state,
.empty-state,
.error-state {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: var(--space-6);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text-muted);
  text-align: center;
}

.error-state {
  border-color: var(--color-danger-border);
  color: var(--color-danger);
  background: var(--color-danger-surface);
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .001s !important;
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
  }

  .app-toast,
  .skeleton,
  button.is-loading::before,
  .ui-state-loading::before,
  .ui-state-saving::before,
  .ui-state-pending::before {
    animation: none !important;
  }
}

@media (max-width: 600px) {
  .app-feedback-banner,
  .app-toast,
  .ui-view-state {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-feedback-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .app-toast-region {
    right: var(--space-2);
    bottom: var(--space-2);
    width: calc(100vw - (2 * var(--space-2)));
  }

  .ui-view-state {
    top: max(68px, calc(env(safe-area-inset-top) + 56px));
    right: var(--space-2);
    width: calc(100vw - (2 * var(--space-2)));
  }
}

#entryForm, #addiBoldEditForm, #addiBoldReceiveForm, #addiBoldConfirmForm, #cashCountConfirmForm, #payrollConfirmForm, #appActionForm, #verifiedClosingForm, #salesBonusPaymentForm, #collaboratorEditForm, #productExpirationForm, #productLotsForm, #inventoryPurchaseDetailForm, #providerEditorForm, #saleReceiptForm { padding: 18px; }
#authLoginForm { padding: 18px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { margin: 0; }
.modal-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.modal-head > div {
  min-width: 0;
}
.modal-head h1,
.modal-head h2,
.modal-head h3,
.modal-head p {
  overflow-wrap: anywhere;
}
.modal-brand-context {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
}
.modal-brand-context img {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.modal-brand-context img.brand-asset-missing {
  display: none;
}
.modal-brand-context span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.icon { width: 36px; padding: 0; font-size: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.form-grid label.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  line-height: 1.35;
}
.form-grid label.check-line input { width: auto; }
.form-grid .wide { grid-column: 1 / -1; }

.credit-entry-dialog .form-grid {
  gap: 10px 14px;
  overflow: auto;
  max-height: calc(100vh - 176px);
  padding-right: 8px;
}

.credit-entry-dialog .modal-head {
  margin-bottom: 12px;
  flex-shrink: 0;
}

.credit-entry-dialog menu {
  background: linear-gradient(180deg, rgba(255,255,255,.86), #fff 28%);
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 12px;
  flex-shrink: 0;
}

.credit-entry-dialog #entryForm {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 56px);
}

.credit-entry-dialog .money-readonly-field {
  display: none;
}

.credit-entry-dialog textarea[name="note"] {
  min-height: 54px;
  resize: vertical;
}
menu { justify-content: flex-end; padding: 14px 0 0; margin: 0; }

.compact-dialog {
  width: min(560px, calc(100vw - 32px));
}

.app-action-dialog {
  width: min(620px, calc(100vw - 32px));
}

.critical-authorization-dialog {
  width: min(720px, calc(100vw - 32px));
}

.auth-login-dialog {
  width: min(480px, calc(100vw - 32px));
}

.auth-login-status {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.auth-login-status.danger {
  color: var(--red);
}

.provider-editor-dialog {
  width: min(780px, calc(100vw - 32px));
}

.provider-editor-grid {
  align-items: start;
}

.provider-editor-dialog menu {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 14px;
}

.app-action-body {
  display: grid;
  gap: 12px;
}

.app-action-note {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-body);
}

.ui-backup-picker {
  display: grid;
  gap: var(--space-2);
}

.ui-backup-picker select {
  width: 100%;
}

.app-action-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.app-action-row {
  display: grid;
  grid-template-columns: minmax(120px, .42fr) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.app-action-row span {
  color: var(--muted);
  font-size: 12px;
}

.app-action-row strong {
  overflow-wrap: anywhere;
}

.app-action-warning {
  padding: 12px;
  border: 1px solid #f5c46c;
  border-radius: 8px;
  background: #fff8e6;
  color: #694400;
  line-height: 1.4;
}

.app-action-danger {
  border-color: #f2bdc6;
  background: #fff5f6;
  color: #8b1a2d;
}

.app-action-success {
  border-color: #bfe5d4;
  background: var(--green-soft);
  color: #075e42;
}

.app-action-reason textarea {
  width: 100%;
  min-height: 90px;
  resize: vertical;
}

.app-action-reason[hidden] {
  display: none !important;
}

.critical-authorization-context[hidden],
.critical-authorization-identity[hidden],
.critical-authorization-fields [hidden] {
  display: none !important;
}

.critical-authorization-identity {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text);
  line-height: 1.35;
}

.critical-authorization-identity span,
.critical-authorization-identity small {
  color: var(--muted);
  font-size: 12px;
}

.critical-authorization-identity strong {
  overflow-wrap: anywhere;
}

.critical-authorization-identity.authenticated {
  border-color: #bfe5d4;
  background: var(--green-soft);
  color: #075e42;
}

.critical-authorization-identity.no-session {
  border-color: #f5c46c;
  background: #fff8e6;
  color: #694400;
}

.critical-authorization-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.critical-authorization-fields .modal-field {
  margin-top: 0;
}

.critical-authorization-fields .wide {
  grid-column: 1 / -1;
}

.critical-authorization-fields textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
}

.critical-authorization-hint {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid #f5c46c;
  border-radius: 8px;
  background: #fff8e6;
  color: #694400;
  font-size: 13px;
  line-height: 1.4;
}

.inventory-purchase-dialog {
  width: min(1120px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: hidden;
}

#inventoryPurchaseDetailForm {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 36px);
  overflow: hidden;
}

#inventoryPurchaseDetailForm .modal-head {
  margin-bottom: 0;
  flex-shrink: 0;
}

#inventoryPurchaseDetailSummary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  background: linear-gradient(180deg, #f8fafc, #fff);
  flex-shrink: 0;
}

#inventoryPurchaseDetailSummary div {
  padding: 10px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #fff;
}

#inventoryPurchaseDetailSummary .wide {
  grid-column: span 2;
}

#inventoryPurchaseDetailSummary strong {
  font-size: 14px;
}

#inventoryPurchaseDetailForm menu {
  flex-shrink: 0;
}

@media (max-width: 1180px) {
  .workspace[data-active-view="pos"] {
    display: block;
    overflow-y: auto;
  }

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

  .catalog-summary,
  .inventory-entry-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #catalogSearch {
    grid-column: span 2;
  }

  #pos.view.active {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      "summary"
      "sale"
      "payment";
    height: auto;
    overflow: visible;
  }

  .pos-actions-panel {
    position: static;
    overflow: visible;
  }

  .pos-actions-panel.is-paid {
    overflow: visible;
  }

  .pos-payment-submit {
    position: static;
    padding-top: 0;
    background: none;
  }

  .inventory-entry-form > .form-grid,
  .entry-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-entry-form > .form-grid .field-with-action,
  .inventory-entry-supplier-name-field,
  .inventory-entry-invoice-field,
  .inventory-entry-note-field,
  .inventory-entry-refresh,
  .entry-product-grid .entry-product-main-field {
    grid-column: 1 / -1;
  }

  .entry-product-grid label {
    grid-column: auto !important;
  }

  .entry-product-grid .entry-product-main-field {
    grid-column: 1 / -1 !important;
  }

  .entry-product-picker .mini-panel-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 900px) {
  #pos.view.active {
    display: block;
  }

  .pos-summary {
    grid-template-columns: 1fr;
    margin-bottom: 14px;
  }

  .pos-layout,
  .pos-product-search-grid,
  .pos-actions-grid,
  .pos-payment-form {
    grid-template-columns: 1fr;
  }

  .pos-product-panel {
    padding-right: 0;
    border-right: 0;
    padding-bottom: 0;
    border-bottom: 0;
  }

  .pos-action-buttons {
    grid-template-columns: 1fr;
  }

  .pos-cart-wrap {
    overflow-x: auto;
  }

  .pos-cart-table {
    min-width: 560px;
  }

  .pos-panel,
  .pos-actions-panel {
    margin-bottom: 14px;
  }

  .critical-authorization-fields {
    grid-template-columns: 1fr;
  }

  #inventoryPurchaseDetailSummary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #inventoryPurchaseDetailSummary .wide {
    grid-column: 1 / -1;
  }

  .inventory-purchase-detail-table {
    min-width: 760px;
  }
}

.product-lots-dialog {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 36px);
  overflow: hidden;
}

#productLotsForm {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 36px);
  overflow: auto;
  scrollbar-gutter: stable;
}

#productLotsForm menu {
  position: sticky;
  bottom: -18px;
  z-index: 2;
  margin: 0 -18px -18px;
  padding: 12px 18px 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .88), #fff 34%);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.lot-product-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.product-lots-wrap {
  max-height: 240px;
}

.product-lots-table {
  min-width: 820px;
  table-layout: fixed;
}

.product-lots-table th,
.product-lots-table td {
  vertical-align: middle;
}

.product-lots-table th:nth-child(1) { width: 155px; }
.product-lots-table th:nth-child(2) { width: 120px; }
.product-lots-table th:nth-child(3) { width: 105px; }
.product-lots-table th:nth-child(4) { width: 120px; }
.product-lots-table th:nth-child(5) { width: 125px; }
.product-lots-table th:nth-child(6) { width: 130px; }
.product-lots-table th:nth-child(7) { width: 95px; }

.product-lots-table th:nth-child(3),
.product-lots-table th:nth-child(4),
.product-lots-table td:nth-child(3),
.product-lots-table td:nth-child(4) {
  text-align: right;
}

.product-lot-editor {
  background: #fff;
}

.confirm-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.confirm-summary div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.confirm-summary span {
  color: var(--muted);
  font-size: 12px;
}

.confirm-summary strong {
  overflow-wrap: anywhere;
}

.confirm-summary .wide {
  grid-column: 1 / -1;
}

.modal-warning {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #f5c46c;
  border-radius: 8px;
  background: #fff8e6;
  color: #694400;
}

.modal-warning span {
  font-size: 12px;
  line-height: 1.4;
}

.modal-field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.collaborator-edit-dialog {
  width: min(820px, calc(100vw - 32px));
}

.collaborator-edit-form {
  display: grid;
  gap: 16px;
}

.collaborator-edit-form .modal-head {
  padding-bottom: 12px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
}

.collaborator-edit-body {
  display: grid;
  gap: 12px;
}

.modal-group {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.modal-group h3 {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  letter-spacing: .02em;
}

.collaborator-edit-form .form-grid {
  gap: 12px 14px;
}

.collaborator-edit-form [hidden],
#collaboratorForm [hidden] {
  display: none;
}

.modal-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid #bfe5d4;
  border-radius: 8px;
  background: var(--green-soft);
  color: #0f5132;
}

.modal-note strong {
  flex: 0 0 auto;
  font-size: 13px;
}

.modal-note span {
  font-size: 12px;
  line-height: 1.45;
}

.collaborator-edit-form menu {
  padding-top: 2px;
}

.payroll-area-row td {
  padding: 9px 12px;
  background: #eef7f2;
  color: #0f5132;
  font-weight: 800;
  letter-spacing: .02em;
}

.not-applicable {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  width: 100%;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}

.closing-dialog {
  width: min(720px, calc(100vw - 32px));
}

.closing-form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

.inline-form {
  align-items: end;
}

.calc-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fc;
}

.calc-preview div {
  display: grid;
  gap: 4px;
}

.calc-preview span {
  color: var(--muted);
  font-size: 12px;
}

.calc-preview strong {
  font-size: 14px;
}

.status-pill {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: #fff4d6;
  color: #8a5b00;
}

.status-pill.received {
  background: var(--green-soft);
  color: var(--color-success);
}

.status-pill.danger {
  background: #fff1f2;
  color: #be123c;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 215px;
  white-space: nowrap;
}

.row-actions.compact {
  min-width: 155px;
  flex-wrap: wrap;
}

.row-actions small {
  color: var(--muted);
  flex-basis: 100%;
}

.tag {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: #0f6b49;
  font-weight: 700;
  font-size: 12px;
}

.amount-positive {
  color: var(--green);
  font-weight: 800;
}

.amount-negative {
  color: var(--red);
  font-weight: 800;
}

@media (max-width: 980px) {
  body { grid-template-columns: 1fr; height: auto; overflow: auto; }
  button { min-height: 40px; }
  .small { min-height: 34px; }
  .sidebar { min-height: auto; max-height: none; overflow: visible; }
  .workspace { height: auto; overflow: visible; }
  .tabs { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .tab { text-align: center; padding-inline: 8px; }
  .side-note { display: none; }
  .kpi-grid, .dashboard-layout, .initial-layout, .close-layout, .records-layout, .credit-layout, .month-close-summary, .month-close-overview, .month-close-sections, .reconciliation-live-grid, .profitability-summary, .inventory-entry-summary, .accounts-payable-summary, .sales-report-layout { grid-template-columns: 1fr; }
  .dashboard-hero { align-items: flex-start; flex-direction: column; }
  .dashboard-brand-mark { position: absolute; top: 18px; right: 18px; width: 92px; max-height: 92px; opacity: .22; }
  .dashboard-hero .hero-copy { max-width: calc(100% - 96px); }
  .topbar { align-items: flex-start; flex-direction: column; }
  .bonus-import-grid { grid-template-columns: 1fr; }
  #importSalesReport { width: 100%; }
  .addi-register-panel { max-width: none; }
  .addi-register-panel .inline-form,
  .addi-register-panel .calc-preview { grid-template-columns: 1fr; }
  .rules-form,
  .rule-fields.two-cols { grid-template-columns: 1fr; }
  .filters, .filter-summary, .accounts-payable-filters, .accounts-payable-payment-fields, .mixed-payment-line { grid-template-columns: 1fr; }
  .filters.catalog-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #catalogSearch { grid-column: 1 / -1; }
  .sales-report-detail-overview { grid-template-columns: 1fr; }
  .sales-report-detail-actions { justify-content: flex-start; }
  .inventory-entry-form > .form-grid {
    grid-template-columns: 1fr;
  }
  .inventory-entry-form > .form-grid .field-with-action,
  .inventory-entry-supplier-name-field,
  .inventory-entry-invoice-field,
  .inventory-entry-date-field,
  .inventory-entry-note-field {
    grid-column: 1 / -1;
  }
  .accounts-payable-payment-fields .wide { grid-column: auto; }
  .mixed-payment-line .wide { grid-column: auto; }
  .accounts-payable-pager { justify-content: flex-start; }
  .entry-product-grid { grid-template-columns: 1fr; }
  .entry-product-grid label { grid-column: 1 / -1 !important; }
  .panel-actions { justify-content: flex-start; }
  .panel-actions button,
  dialog menu button {
    min-width: 120px;
  }
  .cash-totals { grid-template-columns: 1fr; }
  .cash-expected-summary { grid-template-columns: 1fr; }
  .cash-transfer-form { grid-template-columns: 1fr; }
  .initial-deposit-grid { grid-template-columns: 1fr; }
  .bank-import-grid { grid-template-columns: 1fr; }
  .bank-import-grid > * {
    min-width: 0;
    max-width: 100%;
  }
  .bank-import-grid input[type="file"],
  .bank-import-grid textarea,
  .bank-import-grid button {
    width: 100%;
  }
  .reconciliation-live-card,
  .reconciliation-live-head,
  .reconciliation-live-values {
    min-width: 0;
  }
  .reconciliation-live-head {
    flex-direction: column;
  }
  .reconciliation-live-card textarea,
  .reconciliation-live-card input {
    width: 100%;
    min-width: 0;
  }
  .close-section[data-close-section="cash"].active { max-height: none; max-width: none; overflow: visible; }
  .cash-grid { max-height: 60vh; }
  .reconciliation-head { display: none; }
  .method-summary-cards { grid-template-columns: 1fr; }
  .reconciliation-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .reconciliation-row span {
    text-align: left;
  }
  .reconciliation-actions {
    text-align: left;
  }
}

@media (max-width: 1120px) {
  #clients .credit-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .collaborator-table,
  .provider-table,
  .credit-table,
  .addi-table,
  .movements-table,
  .recent-table,
  .client-table,
  .sales-report-table,
  .sales-report-detail-table {
    min-width: 0;
    width: 100%;
  }

  .collaborator-table thead,
  .provider-table thead,
  .credit-table thead,
  .addi-table thead,
  .movements-table thead,
  .recent-table thead,
  .client-table thead,
  .sales-report-table thead,
  .sales-report-detail-table thead {
    display: none;
  }

  .collaborator-table,
  .collaborator-table tbody,
  .collaborator-table tr,
  .collaborator-table td,
  .provider-table,
  .provider-table tbody,
  .provider-table tr,
  .provider-table td,
  .credit-table,
  .credit-table tbody,
  .credit-table tr,
  .credit-table td,
  .addi-table,
  .addi-table tbody,
  .addi-table tr,
  .addi-table td,
  .movements-table,
  .movements-table tbody,
  .movements-table tr,
  .movements-table td,
  .recent-table,
  .recent-table tbody,
  .recent-table tr,
  .recent-table td,
  .client-table,
  .client-table tbody,
  .client-table tr,
  .client-table td,
  .sales-report-table,
  .sales-report-table tbody,
  .sales-report-table tr,
  .sales-report-table td,
  .sales-report-detail-table,
  .sales-report-detail-table tbody,
  .sales-report-detail-table tr,
  .sales-report-detail-table td {
    display: block;
  }

  .collaborator-table tbody,
  .provider-table tbody,
  .credit-table tbody,
  .addi-table tbody,
  .movements-table tbody,
  .recent-table tbody,
  .client-table tbody,
  .sales-report-table tbody,
  .sales-report-detail-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
    background: #f8fafc;
  }

  .collaborator-table tr,
  .provider-table tr,
  .credit-table tr,
  .addi-table tr,
  .movements-table tr,
  .recent-table tr,
  .client-table tr,
  .sales-report-table tr,
  .sales-report-detail-table tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
  }

  .collaborator-table td,
  .provider-table td,
  .credit-table td,
  .addi-table td,
  .movements-table td,
  .recent-table td,
  .client-table td,
  .sales-report-table td,
  .sales-report-detail-table td {
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    width: 100% !important;
    min-height: 42px;
    padding: 9px 11px;
    border-bottom: 1px solid #edf1f6;
    white-space: normal;
    text-align: left !important;
  }

  .collaborator-table td:last-child,
  .provider-table td:last-child,
  .credit-table td:last-child,
  .addi-table td:last-child,
  .movements-table td:last-child,
  .recent-table td:last-child,
  .client-table td:last-child,
  .sales-report-table td:last-child,
  .sales-report-detail-table td:last-child {
    border-bottom: 0;
  }

  .collaborator-table td::before,
  .provider-table td::before,
  .credit-table td::before,
  .addi-table td::before,
  .movements-table td::before,
  .recent-table td::before,
  .client-table td::before,
  .sales-report-table td::before,
  .sales-report-detail-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .collaborator-table .row-actions,
  .provider-table .row-actions,
  .credit-table .row-actions,
  .addi-table .row-actions,
  .movements-table .row-actions,
  .client-table .row-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    min-width: 0;
  }

  .addi-provider-table {
    max-height: none;
  }
}

@media (max-width: 580px) {
  .workspace { padding: 14px; }
  .sidebar { padding: 14px; }
  .tabs { grid-template-columns: repeat(2, 1fr); }
  .actions { flex-wrap: wrap; }
  .actions button,
  .panel-actions button,
  dialog menu button {
    width: 100%;
  }
  .period-control { width: 100%; justify-content: space-between; }
  .form-grid { grid-template-columns: 1fr; }
  .closing-form-grid { grid-template-columns: 1fr; }
  .settings-preview { grid-template-columns: 1fr; }
  .row-actions { flex-wrap: wrap; min-width: 150px; }
  .row-actions .small {
    flex: 1 1 auto;
  }
  .movements-wrap.table-wrap.tall { max-height: none; }
  .movements-table td,
  .recent-table td {
    grid-template-columns: 92px minmax(0, 1fr);
  }
  .chart-stats { grid-template-columns: 1fr; }
  .month-close-grid,
  .month-close-context-grid { grid-template-columns: 1fr; }
  .month-close-overview, .month-close-sections { grid-template-columns: 1fr; }
  .month-close-hero { min-height: 130px; }
  .cash-row { grid-template-columns: minmax(82px, 1fr) 64px 64px 74px minmax(82px, 1fr); gap: 6px; padding-inline: 8px; }
  h1 { font-size: 24px; }
  .dashboard-hero { padding: 18px; }
  .hero-copy h2 { font-size: 25px; }
}

@media (max-width: 720px) {
  .sale-receipt-head,
  .sale-receipt-meta,
  .sale-receipt-totals {
    grid-template-columns: 1fr;
  }

  .sale-receipt-head {
    display: grid;
  }

  .sale-receipt-warning {
    text-align: left;
  }

  .sale-receipt-meta .sale-receipt-field-wide {
    grid-column: 1 / -1;
  }
}

.mobile-nav-toggle {
  display: none;
}

@media (max-width: 600px) {
  body {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    min-height: 100dvh;
    height: auto;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    overflow-x: hidden;
  }

  body.mobile-nav-open {
    overflow: hidden;
    overscroll-behavior: none;
  }

  button,
  input,
  select,
  textarea {
    min-height: var(--touch-target);
  }

  .ui-form button,
  .ui-form input,
  .ui-form select,
  .ui-form textarea {
    min-height: var(--touch-target);
  }

  .ui-modal {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .ui-modal > form {
    max-height: calc(100dvh - 18px);
  }

  .ui-modal menu {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2);
    padding: var(--space-3) 0 0;
  }

  .ui-modal menu button,
  .uxui3-form button[type="submit"] {
    width: 100%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .app-action-row {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }

  .dashboard-brand-mark {
    display: none;
  }

  .dashboard-hero .hero-copy {
    max-width: 100%;
  }

  .filters.catalog-filters input,
  .filters.catalog-filters select,
  .filters.catalog-filters button {
    min-height: var(--touch-target);
  }

  #pos button,
  #pos input,
  #pos select,
  #pos textarea {
    min-height: var(--touch-target);
  }

  .payroll-operation-grid,
  #payrollCanonicalSummary {
    grid-template-columns: 1fr;
  }

  .payroll-canonical-form {
    padding: 12px;
  }

  .small,
  .auth-status-actions button,
  .row-actions .small,
  .accounts-payable-actions .small,
  .catalog-table .row-actions.compact .small,
  .sales-report-table [data-sales-report-detail],
  #pos .pos-cart-table [data-remove-pos-item] {
    min-height: var(--touch-target);
  }

  .sidebar {
    width: 100%;
    min-width: 0;
    max-width: 100vw;
    position: sticky;
    top: env(safe-area-inset-top);
    z-index: var(--z-navigation);
    gap: 0;
    padding: 10px 12px;
    max-height: calc(100vh - env(safe-area-inset-top));
    max-height: calc(100dvh - env(safe-area-inset-top));
    overflow: visible;
    overflow-x: clip;
    box-shadow: 0 10px 24px rgba(12, 22, 38, .18);
  }

  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-navigation) - 1);
    display: block;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(11, 18, 30, .54);
  }

  .brand {
    width: 100%;
    min-width: 0;
    gap: 10px;
    padding: 0;
  }

  .brand-logo {
    width: 42px;
    height: 42px;
  }

  .brand div {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  .brand strong {
    display: -webkit-box;
    overflow: hidden;
    overflow-wrap: anywhere;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    position: relative;
    flex: 0 0 var(--touch-target);
    width: var(--touch-target);
    min-width: var(--touch-target);
    min-height: var(--touch-target);
    margin-left: auto;
    padding: 0;
    border-color: rgba(255,255,255,.18);
    background: rgba(255,255,255,.08);
    color: #fff;
  }

  .mobile-nav-toggle span,
  .mobile-nav-toggle span::before,
  .mobile-nav-toggle span::after {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transition: transform .16s ease, background .16s ease;
  }

  .mobile-nav-toggle span::before,
  .mobile-nav-toggle span::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  .mobile-nav-toggle span::before { top: 14px; }
  .mobile-nav-toggle span::after { bottom: 14px; }

  body.mobile-nav-open .mobile-nav-toggle span {
    background: transparent;
  }

  body.mobile-nav-open .mobile-nav-toggle span::before {
    transform: translateX(-50%) translateY(6px) rotate(45deg);
  }

  body.mobile-nav-open .mobile-nav-toggle span::after {
    transform: translateX(-50%) translateY(-6px) rotate(-45deg);
  }

  .tabs {
    display: none;
    grid-template-columns: 1fr;
    gap: 8px;
    max-height: min(60vh, 420px);
    max-height: min(60dvh, 420px);
    margin-top: 10px;
    padding-top: 10px;
    overflow-y: auto;
    border-top: 1px solid rgba(255,255,255,.12);
    scrollbar-gutter: stable;
  }

  body.mobile-nav-open .tabs {
    display: grid;
  }

  .nav-group {
    gap: 5px;
  }

  .nav-group-toggle {
    min-height: var(--touch-target);
    padding: 9px 10px;
    font-size: 12px;
  }

  .nav-group-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .tab {
    min-height: var(--touch-target);
    padding: 8px 9px;
    text-align: center;
    white-space: normal;
    line-height: 1.15;
    font-size: 13px;
  }

  .side-note {
    display: none;
  }

  .workspace,
  .workspace[data-active-view="pos"],
  .workspace[data-active-view="catalog"],
  .workspace[data-active-view="inventoryEntries"],
  .workspace[data-active-view="salesReports"] {
    width: 100%;
    max-width: 100%;
    min-height: auto;
    height: auto;
    overflow: visible;
    padding: 12px;
  }

  .workspace[data-active-view="pos"] {
    display: block;
  }

  .topbar,
  .workspace[data-active-view="pos"] .topbar,
  .workspace[data-active-view="catalog"] .topbar,
  .workspace[data-active-view="inventoryEntries"] .topbar,
  .workspace[data-active-view="salesReports"] .topbar {
    gap: 10px;
    margin-bottom: 12px;
  }

  .topbar-brand {
    max-width: 100%;
  }

  .view-breadcrumb {
    width: 100%;
  }

  h1,
  .workspace[data-active-view="pos"] h1,
  .workspace[data-active-view="catalog"] h1,
  .workspace[data-active-view="inventoryEntries"] h1,
  .workspace[data-active-view="salesReports"] h1 {
    font-size: 22px;
    line-height: 1.15;
  }

  .topbar p,
  .workspace[data-active-view="pos"] .topbar p {
    margin-top: 3px;
    font-size: 12.5px;
    line-height: 1.35;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 8px;
  }

  .storage-status,
  .auth-status,
  .period-control,
  .workspace[data-active-view="pos"] .storage-status,
  .workspace[data-active-view="pos"] .auth-status,
  .workspace[data-active-view="pos"] .period-control,
  .workspace[data-active-view="catalog"] .storage-status,
  .workspace[data-active-view="catalog"] .auth-status,
  .workspace[data-active-view="catalog"] .period-control,
  .workspace[data-active-view="inventoryEntries"] .storage-status,
  .workspace[data-active-view="inventoryEntries"] .auth-status,
  .workspace[data-active-view="inventoryEntries"] .period-control,
  .workspace[data-active-view="salesReports"] .storage-status,
  .workspace[data-active-view="salesReports"] .auth-status,
  .workspace[data-active-view="salesReports"] .period-control {
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    box-shadow: none;
  }

  .storage-status em,
  .auth-status small {
    white-space: normal;
  }

  .period-control input {
    min-width: 0;
    width: 100%;
  }

  .panel,
  .catalog-panel,
  .inventory-entry-panel,
  .inventory-entry-history-panel,
  .sales-report-panel,
  .sales-report-table-panel,
  .sales-report-detail-panel {
    padding: 12px;
  }

  .catalog-panel {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .panel-head {
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
  }

  .kpi-grid,
  .pos-summary,
  .sales-report-summary,
  .catalog-summary,
  .inventory-entry-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
  }

  .metric,
  .workspace[data-active-view="pos"] .pos-summary .metric,
  .workspace[data-active-view="catalog"] .catalog-summary .metric,
  .workspace[data-active-view="inventoryEntries"] .inventory-entry-summary .metric,
  .workspace[data-active-view="salesReports"] .sales-report-summary .metric {
    min-height: 64px;
    padding: 10px 11px;
    gap: 4px;
  }

  .metric strong,
  .pos-summary .metric strong {
    font-size: 17px;
    overflow-wrap: anywhere;
  }

  .metric span,
  .metric small {
    font-size: 12px;
    line-height: 1.25;
  }

  #pos.view.active {
    display: block;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .pos-panel,
  .pos-actions-panel {
    overflow: visible;
    margin-bottom: 10px;
  }

  .pos-layout {
    display: grid;
    gap: 10px;
  }

  .pos-product-panel {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
  }

  .pos-product-search-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
  }

  .pos-customer-field {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .pos-product-search-grid .pos-product-main-field,
  .pos-product-search-grid #posAddItem {
    grid-column: 1 / -1;
  }

  .pos-product-search-grid > label:not(.pos-product-main-field) {
    grid-column: span 2;
    text-align: left;
  }

  .pos-product-search-grid #posAddItem {
    width: 100%;
    min-height: var(--touch-target);
  }

  .pos-payment-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .pos-payment-form .wide,
  .pos-payment-form button {
    grid-column: 1 / -1;
  }

  .pos-action-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .pos-action-buttons button {
    width: 100%;
    white-space: normal;
  }

  #pos .pos-action-buttons button,
  #posRegisterPayment {
    min-height: var(--touch-target);
  }

  .pos-cart-wrap {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .filters.catalog-filters,
  .filters.sales-report-filters,
  .inventory-entry-form > .form-grid,
  .entry-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  #catalogSearch,
  .catalog-refresh,
  .sales-report-filter-search,
  .sales-report-refresh,
  .inventory-entry-form > .form-grid .field-with-action,
  .inventory-entry-supplier-name-field,
  .inventory-entry-invoice-field,
  .inventory-entry-note-field,
  .inventory-entry-refresh,
  .entry-product-grid .entry-product-main-field {
    grid-column: 1 / -1;
  }

  .entry-product-grid label {
    grid-column: auto !important;
  }

  .entry-product-grid .entry-product-main-field {
    grid-column: 1 / -1 !important;
  }

  .field-with-action {
    grid-template-columns: 1fr;
  }

  .form-actions,
  .entry-total-line {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .form-actions button {
    flex: 1 1 140px;
  }

  .catalog-table-wrap,
  .inventory-entry-items-wrap,
  .inventory-entry-history-wrap,
  .sale-receipt-table-wrap {
    width: 100%;
    max-width: 100%;
    max-height: none;
    overflow: visible;
  }

  .catalog-table-wrap {
    min-width: 0;
    scrollbar-gutter: auto;
  }

  .catalog-table thead,
  .inventory-entry-items-table thead,
  .inventory-entry-history-table thead,
  .pos-cart-table thead,
  .sale-receipt-table thead {
    display: none;
  }

  .catalog-table,
  .catalog-table tbody,
  .catalog-table tr,
  .catalog-table td,
  .inventory-entry-items-table,
  .inventory-entry-items-table tbody,
  .inventory-entry-items-table tr,
  .inventory-entry-items-table td,
  .inventory-entry-history-table,
  .inventory-entry-history-table tbody,
  .inventory-entry-history-table tr,
  .inventory-entry-history-table td,
  .pos-cart-table,
  .pos-cart-table tbody,
  .pos-cart-table tr,
  .pos-cart-table td,
  .sale-receipt-table,
  .sale-receipt-table tbody,
  .sale-receipt-table tr,
  .sale-receipt-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .catalog-table tbody,
  .inventory-entry-items-table tbody,
  .inventory-entry-history-table tbody,
  .pos-cart-table tbody,
  .sale-receipt-table tbody {
    display: grid;
    gap: 10px;
    padding: 8px;
    background: #f8fafc;
  }

  .catalog-table tr,
  .inventory-entry-items-table tr,
  .inventory-entry-history-table tr,
  .pos-cart-table tr,
  .sale-receipt-table tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
  }

  .catalog-table td,
  .inventory-entry-items-table td,
  .inventory-entry-history-table td,
  .pos-cart-table td,
  .sale-receipt-table td {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 9px 10px;
    border-bottom: 1px solid #edf1f6;
    text-align: left !important;
    white-space: normal !important;
    overflow: visible;
    overflow-wrap: anywhere;
  }

  .catalog-table td:last-child,
  .inventory-entry-items-table td:last-child,
  .inventory-entry-history-table td:last-child,
  .pos-cart-table td:last-child,
  .sale-receipt-table td:last-child {
    border-bottom: 0;
  }

  .catalog-table td::before,
  .inventory-entry-items-table td::before,
  .inventory-entry-history-table td::before,
  .pos-cart-table td::before,
  .sale-receipt-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .catalog-thumb {
    margin-inline: 0;
  }

  .row-actions,
  .catalog-table .row-actions.compact {
    min-width: 0;
    flex-wrap: wrap;
    gap: 6px;
  }

  .catalog-table .row-actions.compact .small,
  .inventory-entry-items-table .small,
  .inventory-entry-history-table .small,
  .pos-cart-table .small {
    flex: 1 1 118px;
  }

  .pos-cart-table td:first-child {
    white-space: normal;
    overflow: visible;
  }

  .pos-cart-table td:first-child strong {
    min-height: 0;
    line-height: 1.2;
    white-space: normal;
    text-overflow: clip;
  }

  .pos-cart-table td:first-child small {
    display: block;
  }

  #pos .pos-cart-qty,
  #pos .pos-cart-discount {
    justify-self: end;
    width: min(100%, 124px);
    min-height: 40px;
    height: 40px;
  }

  .pos-money-edit {
    justify-self: end;
    width: min(100%, 148px);
  }

  #pos .pos-cart-table [data-remove-pos-item] {
    width: 100%;
    height: auto;
  }

  .pos-cart-empty-row td {
    display: block;
  }

  .sales-report-layout,
  .sales-report-detail-overview {
    grid-template-columns: 1fr;
  }

  .filter-summary.sales-report-detail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sales-report-detail-actions,
  .sales-report-detail-actions .small {
    width: 100%;
  }

  .sale-receipt-dialog,
  .auth-login-dialog,
  .compact-dialog,
  dialog {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }

  #authLoginForm,
  #saleReceiptForm {
    padding: 14px;
  }

  .sale-receipt {
    gap: 12px;
  }

  .sale-receipt-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .subtabs,
  .audit-subtabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-gutter: stable;
  }

  .subtab {
    flex: 0 0 auto;
    min-height: 40px;
  }
}

@media print {
  @page {
    margin: 8mm;
  }

  html,
  body.sale-receipt-printing {
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }

  body.sale-receipt-printing {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.sale-receipt-printing > :not(.workspace),
  body.sale-receipt-printing > .workspace > :not(#saleReceiptDialog) {
    display: none !important;
  }

  body.sale-receipt-printing > .workspace {
    display: block !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }

  body.sale-receipt-printing #saleReceiptDialog {
    display: block !important;
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: visible !important;
    box-shadow: none !important;
    background: #fff !important;
  }

  body.sale-receipt-printing #saleReceiptDialog::backdrop {
    display: none !important;
  }

  body.sale-receipt-printing #saleReceiptForm {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.sale-receipt-printing #saleReceiptDialog .modal-head,
  body.sale-receipt-printing #saleReceiptStatus,
  body.sale-receipt-printing #saleReceiptDialog menu {
    display: none !important;
  }

  body.sale-receipt-printing .sale-receipt-print-area {
    display: block !important;
    break-after: avoid;
    page-break-after: avoid;
  }

  body.sale-receipt-printing .sale-receipt {
    color: #000;
    gap: 8px;
    font-size: 10.5px;
    line-height: 1.2;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.sale-receipt-printing .sale-receipt-head {
    gap: 8px;
    padding-bottom: 6px;
  }

  body.sale-receipt-printing .sale-receipt-head h2 {
    font-size: 18px;
  }

  body.sale-receipt-printing .sale-receipt-warning {
  font-size: 12px;
  }

  body.sale-receipt-printing .sale-receipt-meta,
  body.sale-receipt-printing .sale-receipt-totals {
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
  }

  body.sale-receipt-printing .sale-receipt-meta div,
  body.sale-receipt-printing .sale-receipt-totals div {
    padding: 5px 6px;
    background: #fff;
    border-color: #bbb;
  }

  body.sale-receipt-printing .sale-receipt-meta strong,
  body.sale-receipt-printing .sale-receipt-totals strong,
  body.sale-receipt-printing .sale-receipt-table td,
  body.sale-receipt-printing .sale-receipt-table strong,
  body.sale-receipt-printing .sale-receipt-table small {
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
  }

  body.sale-receipt-printing .sale-receipt-section {
    gap: 4px;
  }

  body.sale-receipt-printing .sale-receipt-section h3 {
    font-size: 12px;
  }

  body.sale-receipt-printing .sale-receipt-table {
    min-width: 0 !important;
    width: 100% !important;
  font-size: 12px;
    table-layout: fixed;
    border-collapse: collapse;
  }

  body.sale-receipt-printing .sale-receipt-table th,
  body.sale-receipt-printing .sale-receipt-table td {
    padding: 4px 5px;
    line-height: 1.15;
    border-color: #bbb;
  }

  body.sale-receipt-printing .table-wrap {
    max-height: none !important;
    overflow: visible !important;
    border: 0;
    box-shadow: none;
  }
}

@media screen and (max-width: 1120px) {
  .sales-report-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sales-report-table-panel {
    min-width: 0;
  }

  .filters.sales-report-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .sales-report-filter-search,
  .sales-report-refresh {
    grid-column: 1 / -1;
  }

  #audit .panel {
    min-width: 0;
  }

  #audit .audit-filters,
  #audit .authorization-audit-primary-filters,
  #audit .authorization-audit-secondary-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .collaborator-table.ui-listing-table thead,
  .provider-table.ui-listing-table thead,
  .credit-table.ui-listing-table thead,
  .addi-table.ui-listing-table thead,
  .movements-table.ui-listing-table thead,
  .recent-table.ui-listing-table thead,
  .client-table.ui-listing-table thead,
  .sales-report-table.ui-listing-table thead,
  .sales-report-detail-table.ui-listing-table thead {
    position: absolute !important;
    display: block !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

@media screen and (min-width: 761px) and (max-width: 1120px) {
  #credits .credit-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media screen and (max-width: 760px) {
  .ui-listing-viewport[data-mobile-strategy="cards"],
  .ui-listing-viewport[data-mobile-strategy="priority-detail"],
  .ui-listing-viewport[data-mobile-strategy="compact-list"] {
    width: 100%;
    max-width: 100%;
    max-height: none;
    overflow: visible;
    border: 0;
    border-radius: 0;
    scrollbar-gutter: auto;
  }

  .ui-listing-table[data-mobile-strategy="cards"],
  .ui-listing-table[data-mobile-strategy="cards"] tbody,
  .ui-listing-table[data-mobile-strategy="cards"] tr,
  .ui-listing-table[data-mobile-strategy="cards"] td,
  .ui-listing-table[data-mobile-strategy="priority-detail"],
  .ui-listing-table[data-mobile-strategy="priority-detail"] tbody,
  .ui-listing-table[data-mobile-strategy="priority-detail"] tr,
  .ui-listing-table[data-mobile-strategy="priority-detail"] td,
  .ui-listing-table[data-mobile-strategy="compact-list"],
  .ui-listing-table[data-mobile-strategy="compact-list"] tbody,
  .ui-listing-table[data-mobile-strategy="compact-list"] tr,
  .ui-listing-table[data-mobile-strategy="compact-list"] td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .ui-listing-table[data-mobile-strategy="cards"] thead,
  .ui-listing-table[data-mobile-strategy="priority-detail"] thead,
  .ui-listing-table[data-mobile-strategy="compact-list"] thead {
    position: absolute !important;
    display: block !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .ui-listing-table[data-mobile-strategy="cards"] tbody,
  .ui-listing-table[data-mobile-strategy="priority-detail"] tbody,
  .ui-listing-table[data-mobile-strategy="compact-list"] tbody {
    display: grid;
    gap: 10px;
    padding: 0;
    background: transparent;
  }

  .ui-listing-table[data-mobile-strategy="cards"] tr,
  .ui-listing-table[data-mobile-strategy="priority-detail"] tr,
  .ui-listing-table[data-mobile-strategy="compact-list"] tr {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .ui-listing-table[data-mobile-strategy="cards"] td,
  .ui-listing-table[data-mobile-strategy="priority-detail"] td,
  .ui-listing-table[data-mobile-strategy="compact-list"] td {
    display: grid;
    grid-template-columns: minmax(88px, 34%) minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 9px 10px;
    overflow: visible;
    border-bottom: 1px solid #edf1f6;
    text-align: left !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  .ui-listing-table[data-mobile-strategy="cards"] td::before,
  .ui-listing-table[data-mobile-strategy="priority-detail"] td::before,
  .ui-listing-table[data-mobile-strategy="compact-list"] td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .ui-listing-table[data-mobile-strategy="cards"] td:last-child,
  .ui-listing-table[data-mobile-strategy="priority-detail"] td:last-child,
  .ui-listing-table[data-mobile-strategy="compact-list"] td:last-child {
    border-bottom: 0;
  }

  .ui-listing-table[data-mobile-strategy="cards"] td[colspan],
  .ui-listing-table[data-mobile-strategy="priority-detail"] td[colspan],
  .ui-listing-table[data-mobile-strategy="compact-list"] td[colspan] {
    display: block;
    min-height: 54px;
    text-align: center !important;
  }

  .ui-listing-table[data-mobile-strategy="cards"] td[colspan]::before,
  .ui-listing-table[data-mobile-strategy="priority-detail"] td[colspan]::before,
  .ui-listing-table[data-mobile-strategy="compact-list"] td[colspan]::before {
    content: none;
  }

  .ui-listing-table[data-mobile-strategy="priority-detail"] [data-priority="secondary"] {
    display: none;
  }

  .ui-listing-table[data-mobile-strategy="compact-list"] td {
    grid-template-columns: minmax(82px, 28%) minmax(0, 1fr);
    min-height: 38px;
    padding-block: 7px;
  }

  .ui-listing-table[data-mobile-strategy] .row-actions,
  .ui-listing-table[data-mobile-strategy] td:last-child {
    min-width: 0;
  }

  .ui-listing-table[data-mobile-strategy] button,
  .ui-listing-table[data-mobile-strategy] .small {
    max-width: 100%;
  }
}

/* UXUI-7: jerarquía visual agrupada para módulos operativos y administrativos. */
@media screen {
  .uxui7-module-view {
    --uxui7-surface: #f7fafc;
    --uxui7-border: #dbe5ef;
  }

  .uxui7-module-view > .kpi-grid {
    margin-bottom: 14px;
  }

  .uxui7-module-view .panel-head:not(.compact) {
    padding-bottom: 12px;
    border-bottom: 1px solid #e7edf4;
  }

  .uxui7-module-view .panel-head h2 {
    line-height: 1.2;
  }

  .uxui7-module-view .panel-head p {
    max-width: 760px;
    line-height: 1.45;
  }

  .uxui7-module-view .ui-listing-table tbody tr:not(.ui-table-state-row):hover td {
    background: #f8fbfd;
  }

  .dashboard-brand-mark {
    display: none !important;
  }

  .dashboard-hero {
    min-height: 142px;
  }

  .dashboard-hero .hero-copy {
    flex: 1 1 0;
    max-width: 720px;
  }

  .dashboard-hero .hero-status {
    flex: 0 1 260px;
    min-width: 0;
    max-width: 280px;
  }

  .uxui7-dashboard .profitability-badge,
  .uxui7-dashboard #pendingDashboardBadge {
    color: #166b4c;
    background: #e5f5ed;
  }

  .uxui7-filter-surface {
    padding: 12px;
    border: 1px solid var(--uxui7-border);
    border-radius: 8px;
    background: var(--uxui7-surface);
  }

  .uxui7-filter-label,
  .inventory-kardex-filters .uxui7-filter-label {
    display: grid;
    gap: 6px;
    min-width: 0;
    color: #405168;
    font-size: 12px;
    font-weight: 800;
  }

  .uxui7-filter-label input,
  .uxui7-filter-label select {
    width: 100%;
    min-height: 42px;
    min-width: 0;
    background: #fff;
  }

  .uxui7-primary-search input {
    border-color: #aabbd0;
    box-shadow: inset 3px 0 0 var(--brand-primary);
  }

  .ui-table-state-row td {
    height: auto;
    padding: 0 !important;
    white-space: normal;
    background: #fff;
  }

  .ui-table-state-content {
    display: grid;
    justify-items: center;
    gap: 5px;
    min-height: 112px;
    padding: 24px 18px;
    color: #43536a;
    text-align: center;
    background: #fbfcfe;
  }

  .ui-table-state-content::before {
    content: "";
    width: 32px;
    height: 4px;
    border-radius: 2px;
    background: #9fb1c5;
  }

  .ui-table-state-content strong {
    color: #172033;
    font-size: 14px;
  }

  .ui-table-state-content span {
    max-width: 560px;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.45;
  }

  .ui-table-state-loading .ui-table-state-content::before {
    background: var(--brand-primary);
    animation: uxui7-state-pulse 1.2s ease-in-out infinite alternate;
  }

  .ui-table-state-error .ui-table-state-content {
    background: #fff7f7;
  }

  .ui-table-state-error .ui-table-state-content::before {
    background: var(--red);
  }

  @keyframes uxui7-state-pulse {
    from { transform: scaleX(.45); opacity: .55; }
    to { transform: scaleX(1); opacity: 1; }
  }

  .sales-report-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sales-report-payments {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }

  .sales-report-payments-panel {
    min-height: 0;
  }

  .sales-report-payment-card {
    min-height: 64px;
    border-left: 3px solid var(--brand-primary);
  }

  .sales-report-user {
    max-width: 100%;
    line-height: 1.3;
    overflow-wrap: normal;
    word-break: normal;
  }

  .uxui7-technical-panel > .panel-head,
  .uxui7-operational-panel > .panel-head {
    margin-bottom: 2px;
  }

  #movements .filters {
    grid-template-columns: minmax(300px, 1fr) minmax(180px, .5fr) minmax(160px, .4fr);
    margin-bottom: 12px;
  }

  .movement-folio,
  .movement-detail small {
    max-width: 100%;
    line-height: 1.35;
    word-break: normal;
    overflow-wrap: normal;
  }

  .movement-folio {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .movement-event-id {
    color: #64748b;
  }

  .uxui7-operation-step {
    position: relative;
    margin-top: 14px;
    padding: 0 14px 14px;
    overflow: hidden;
    border: 1px solid var(--uxui7-border);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(18, 32, 52, .05);
  }

  .uxui7-step-heading {
    grid-column: 1 / -1;
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin: 0 -14px 14px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--uxui7-border);
    background: #f2f8f5;
    box-shadow: inset 4px 0 0 var(--green);
  }

  .uxui7-step-number {
    display: inline-grid;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    place-items: center;
    border-radius: 6px;
    background: var(--green);
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
  }

  .uxui7-step-heading div {
    min-width: 0;
  }

  .uxui7-step-heading h3 {
    margin: 0;
    color: var(--ink);
    font-size: 15px;
    line-height: 1.3;
  }

  .uxui7-step-heading p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
  }

  .uxui7-operation-step-form {
    margin: 0;
  }

  #cashSqlOpenForm {
    grid-template-columns: minmax(220px, 1fr) minmax(160px, .45fr);
    align-items: end;
  }

  #cashSqlMovementForm,
  #cashSqlCloseForm {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  #cashSqlMovementForm .wide,
  #cashSqlCloseForm .wide {
    grid-column: 1 / -1;
  }

  #cashSqlMovementForm button,
  #cashSqlCloseForm button {
    justify-self: start;
  }

  .uxui7-operation-history {
    padding-bottom: 12px;
  }

  .uxui7-operation-history .table-wrap {
    margin: 0;
  }

  .uxui7-critical-panel > .panel-head {
    border-left: 4px solid #d6a32a;
    padding-left: 12px;
  }

  #reconciliation .bank-import-panel {
    padding: 16px;
    border: 1px solid var(--uxui7-border);
    border-radius: 8px;
    background: #f8fafc;
  }

  #reconciliation .bank-import-panel .bank-import-grid {
    padding: 12px;
    border: 1px solid #e4ebf2;
    border-radius: 8px;
    background: #fff;
  }

  .addi-register-panel {
    max-width: none;
  }

  .uxui7-form-surface {
    padding: 14px;
    border: 1px solid var(--uxui7-border);
    border-radius: 8px;
    background: #f8fafc;
  }

  .uxui7-form-surface .calc-preview {
    border-left: 4px solid var(--brand-primary);
    background: #fff;
  }

  .uxui7-secondary-form {
    margin-top: 12px;
    padding: 12px;
    border: 1px dashed #b8c5d4;
    border-radius: 8px;
    background: #fff;
  }

  .addi-filter-panel {
    border-left: 4px solid var(--brand-primary);
  }

  .catalog-filters .uxui7-primary-search {
    min-width: 260px;
  }

  .catalog-table {
    min-width: 1040px;
  }

  .catalog-table th:nth-child(1) { width: 60px; }
  .catalog-table th:nth-child(2) { width: 116px; }
  .catalog-table th:nth-child(3) { width: 180px; }
  .catalog-table th:nth-child(4) { width: 96px; }
  .catalog-table th:nth-child(5) { width: 96px; }
  .catalog-table th:nth-child(6) { width: 64px; }
  .catalog-table th:nth-child(7),
  .catalog-table th:nth-child(8) { width: 80px; }
  .catalog-table th:nth-child(9) { width: 88px; }
  .catalog-table th:nth-child(10) { width: 152px; }

  .catalog-table .row-actions.compact {
    justify-content: center;
    flex-wrap: wrap;
  }

  .catalog-table td:nth-child(2) {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .catalog-table td:nth-child(2) strong,
  .catalog-table td:nth-child(2) small {
    display: block;
    max-width: 100%;
  }

  .catalog-table .row-actions.compact .small {
    flex: 1 1 64px;
  }

  #inventoryEntryForm > .form-grid {
    padding: 14px;
    border: 1px solid var(--uxui7-border);
    border-radius: 8px;
    background: #f8fafc;
  }

  #inventoryEntryForm .entry-product-picker {
    border-top: 4px solid var(--brand-primary);
    background: #fff;
  }

  #inventoryEntryForm .entry-total-line {
    min-height: 64px;
    padding: 12px 16px;
    border: 1px solid #b9ddcd;
    border-radius: 8px;
    background: var(--green-soft);
  }

  #inventoryEntryForm .entry-total-line strong {
    font-size: 24px;
  }

  #inventoryEntryForm .entry-total-line span {
    color: #405168;
  }

  .inventory-kardex-filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .inventory-kardex-filters .uxui7-primary-search {
    grid-column: span 2;
  }

  .inventory-kardex-table {
    min-width: 1040px;
  }

  .inventory-kardex-table th:nth-child(1) { width: 125px; }
  .inventory-kardex-table th:nth-child(2) { width: 112px; }
  .inventory-kardex-table th:nth-child(3) { width: 196px; }
  .inventory-kardex-table th:nth-child(4) { width: 150px; }
  .inventory-kardex-table th:nth-child(5),
  .inventory-kardex-table th:nth-child(6),
  .inventory-kardex-table th:nth-child(7) { width: 65px; }
  .inventory-kardex-table th:nth-child(8) { width: 165px; }
  .inventory-kardex-table th:nth-child(9) { width: 90px; }

  .uxui7-readable-reference {
    display: -webkit-box;
    max-height: 38px;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    word-break: normal;
    overflow-wrap: normal;
  }

  .accounts-payable-table {
    min-width: 1045px;
  }

  .accounts-payable-table th:nth-child(1) { width: 135px; }
  .accounts-payable-table th:nth-child(2) { width: 100px; }
  .accounts-payable-table th:nth-child(3) { width: 110px; }
  .accounts-payable-table th:nth-child(4),
  .accounts-payable-table th:nth-child(5),
  .accounts-payable-table th:nth-child(6) { width: 78px; }
  .accounts-payable-table th:nth-child(7),
  .accounts-payable-table th:nth-child(8),
  .accounts-payable-table th:nth-child(9) { width: 78px; }
  .accounts-payable-table th:nth-child(10) { width: 80px; }
  .accounts-payable-table th:nth-child(11) { width: 150px; }

  .accounts-payable-actions {
    flex-wrap: wrap;
    justify-content: center;
  }

  .accounts-payable-pager[hidden] {
    display: none !important;
  }

  #credits .credit-panel,
  .uxui7-history-panel {
    border-top: 3px solid #b8c6d5;
  }

  #credits .credit-panel .panel-head,
  .uxui7-history-panel .panel-head {
    min-height: 68px;
  }

  .uxui7-history-grid {
    gap: 16px;
    margin-top: 14px;
  }

  #clients .client-filters {
    grid-template-columns: minmax(340px, 1fr) minmax(180px, 240px);
  }

  #clients .client-table td:first-child strong {
    font-size: 14px;
  }

  #clients .client-table .row-actions {
    justify-content: flex-start;
    gap: 6px;
  }

  #audit .audit-subtabs {
    margin-bottom: 14px;
  }

  #audit .audit-section {
    min-height: 220px;
    padding: 14px;
    border: 1px solid var(--uxui7-border);
    border-radius: 8px;
    background: #fbfcfe;
  }

  #audit #unifiedAuditTimelineForm {
    grid-template-columns: minmax(190px, .6fr) minmax(320px, 1.4fr) minmax(120px, auto);
    align-items: end;
    margin-top: 12px;
  }

  #audit #unifiedAuditTimelineResults:empty {
    min-height: 72px;
  }

  #initialData .initial-layout {
    max-width: none;
  }

  #initialData .admin-grid {
    grid-template-columns: repeat(2, minmax(280px, 1fr));
  }

  .uxui7-admin-card {
    position: relative;
    border-top: 4px solid #6c819a;
  }

  .uxui7-admin-card[data-admin-surface="diagnostic"] {
    border-top-color: #b48a2c;
  }

  .uxui7-admin-card .external-backup-control {
    min-height: 58px;
    padding: 10px 12px;
    border: 1px solid #e1e8f0;
    border-radius: 8px;
    background: #f8fafc;
  }

  .uxui7-admin-card .admin-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .uxui7-admin-card .admin-actions button {
    width: 100%;
    min-width: 0;
  }

  .uxui7-admin-card .admin-actions .danger {
    grid-column: 1 / -1;
    margin-top: 4px;
    border-width: 2px;
  }
}

@media screen and (min-width: 981px) and (max-width: 1100px) {
  .uxui7-dashboard > .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media screen and (min-width: 1180px) {
  .catalog-table-wrap,
  .inventory-kardex-wrap,
  .accounts-payable-wrap {
    overflow-x: auto;
  }

  .catalog-table-wrap:not(:focus-within),
  .inventory-kardex-wrap:not(:focus-within),
  .accounts-payable-wrap:not(:focus-within) {
    scrollbar-color: #b4c1cf transparent;
  }
}

@media screen and (max-width: 1179px) {
  .catalog-filters,
  .inventory-kardex-filters,
  .accounts-payable-filters,
  #movements .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .catalog-filters .uxui7-primary-search,
  .inventory-kardex-filters .uxui7-primary-search,
  .accounts-payable-filters .uxui7-primary-search,
  #movements .uxui7-primary-search {
    grid-column: 1 / -1;
  }

  .catalog-refresh,
  .accounts-payable-pager {
    grid-column: 1 / -1;
  }

  #audit #unifiedAuditTimelineForm {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #audit #unifiedAuditTimelineForm .uxui7-primary-search {
    grid-column: auto;
  }

  #audit #unifiedAuditTimelineForm button {
    grid-column: 1 / -1;
  }
}

@media screen and (max-width: 760px) {
  .dashboard-hero .hero-copy {
    max-width: 100%;
  }

  .dashboard-hero .hero-status {
    flex-basis: auto;
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .uxui7-filter-surface,
  .catalog-filters,
  .inventory-kardex-filters,
  .accounts-payable-filters,
  #movements .filters,
  #clients .client-filters,
  #audit #unifiedAuditTimelineForm {
    grid-template-columns: minmax(0, 1fr);
  }

  .catalog-filters .uxui7-primary-search,
  .inventory-kardex-filters .uxui7-primary-search,
  .accounts-payable-filters .uxui7-primary-search,
  #movements .uxui7-primary-search,
  #audit #unifiedAuditTimelineForm .uxui7-primary-search,
  .catalog-refresh,
  .accounts-payable-pager,
  #audit #unifiedAuditTimelineForm button {
    grid-column: 1 / -1;
  }

  .uxui7-operation-step,
  #cashSqlOpenForm,
  #cashSqlMovementForm,
  #cashSqlCloseForm {
    grid-template-columns: minmax(0, 1fr);
  }

  .uxui7-operation-step button {
    width: 100%;
  }

  .sales-report-payments,
  #initialData .admin-grid,
  .uxui7-admin-card .admin-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .ui-table-state-content {
    min-height: 96px;
    padding: 20px 14px;
  }

  .ui-listing-table[data-mobile-strategy] .ui-table-state-row {
    border-style: dashed;
  }

  .ui-listing-table[data-mobile-strategy] .ui-table-state-row td {
    display: block;
    min-height: 0;
    padding: 0 !important;
  }
}

@media screen and (prefers-reduced-motion: reduce) {
  .ui-table-state-loading .ui-table-state-content::before {
    animation: none;
  }
}

/* POS premium R3: reglas finales sobre la composicion completa del POS. */
@media screen and (min-width: 1181px) {
  #pos .pos-actions-panel {
    display: flex;
    flex-direction: column;
    align-content: normal;
    height: 100%;
    overflow: hidden;
  }

  #pos .pos-actions-panel > .panel-head,
  #pos .pos-actions-panel > .pos-flow-steps,
  #pos .pos-actions-panel > .pos-payment-total,
  #pos .pos-actions-panel > #posSaleStatus,
  #pos .pos-actions-panel > .pos-sale-options,
  #pos .pos-actions-panel > .pos-checkout-dock {
    flex: 0 0 auto;
  }

  #pos .pos-actions-panel > .pos-payment-form {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }

  #pos .pos-actions-panel:not(.is-payment-ready) > .pos-payment-form {
    display: none;
  }

  #pos .pos-actions-panel > .pos-checkout-dock {
    margin-top: auto;
  }
}

#pos input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

#pos input[type="number"]::-webkit-inner-spin-button,
#pos input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

#pos .pos-payment-line-grid {
  grid-template-columns: minmax(150px, 1.05fr) minmax(172px, 1fr) minmax(168px, 1fr);
}

#pos .pos-payment-input-action {
  grid-template-columns: minmax(92px, 1fr) 72px;
  gap: 5px;
}

#pos .pos-payment-input-action > input {
  min-width: 0;
  padding-inline: 9px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#pos .pos-payment-input-action > button {
  width: 72px;
  min-width: 72px;
  min-height: 38px;
  padding-inline: 5px;
}

#pos .pos-actions-panel.is-stage-products.is-cart-empty #posCreateSale,
#pos .pos-actions-panel.is-stage-payment #posRegisterPayment,
#pos .pos-actions-panel.is-stage-voided #posResetSale {
  grid-column: 1 / -1;
}

#pos #posConfirmSale {
  border-color: var(--green);
  background: var(--green);
}

@media screen and (max-width: 1280px) and (min-width: 1181px) {
  #pos .pos-payment-line-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media screen and (max-width: 900px) {
  #pos .pos-payment-line-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media screen and (max-width: 560px) {
  #pos .pos-payment-line-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* POS premium R2: jerarquia por etapa, geometria estable y comprobante completo. */
@media screen and (min-width: 1181px) {
  #pos .pos-actions-panel {
    display: flex;
    flex-direction: column;
    align-content: normal;
    height: 100%;
    overflow: hidden;
  }

  #pos .pos-actions-panel > .panel-head,
  #pos .pos-actions-panel > .pos-flow-steps,
  #pos .pos-actions-panel > .pos-payment-total,
  #pos .pos-actions-panel > #posSaleStatus,
  #pos .pos-actions-panel > .pos-sale-options,
  #pos .pos-actions-panel > .pos-checkout-dock {
    flex: 0 0 auto;
  }

  #pos .pos-actions-panel > .pos-payment-form {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }

  #pos .pos-actions-panel:not(.is-payment-ready) > .pos-payment-form {
    display: none;
  }

  #pos .pos-checkout-dock {
    margin-top: auto;
  }
}

#pos input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

#pos input[type="number"]::-webkit-inner-spin-button,
#pos input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

#pos .pos-cart-wrap.is-empty {
  display: grid;
  min-height: 190px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
}

#pos .pos-cart-wrap.is-empty .pos-cart-table,
#pos .pos-cart-wrap.is-empty .pos-cart-table tbody,
#pos .pos-cart-wrap.is-empty .pos-cart-empty-row {
  height: 100%;
}

#pos .pos-cart-wrap.is-empty .pos-cart-empty-row td {
  border-bottom: 0;
}

#pos .pos-payment-line-grid {
  grid-template-columns: minmax(150px, 1.05fr) minmax(172px, 1fr) minmax(168px, 1fr);
}

#pos .pos-payment-input-action {
  grid-template-columns: minmax(92px, 1fr) 72px;
  gap: 5px;
}

#pos .pos-payment-input-action > input {
  min-width: 0;
  padding-inline: 9px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#pos .pos-payment-input-action > button {
  width: 72px;
  min-width: 72px;
  padding-inline: 5px;
}

#pos .pos-payment-line-grid select,
#pos .pos-payment-line-grid input {
  font-variant-numeric: tabular-nums;
}

#pos #posConfirmSale {
  border-color: var(--green);
  background: var(--green);
}

#pos .pos-actions-panel.is-stage-products #posResetSale.ghost {
  border-color: #e3b8bd;
  background: #fffafa;
  color: #9f2632;
}

#pos .pos-discount-reason.has-error input,
#pos #posDiscountReason[aria-invalid="true"] {
  border-color: #cc3345;
  background: #fff7f8;
  box-shadow: 0 0 0 3px rgba(204, 51, 69, .12);
}

#pos .pos-sale-options[open] {
  padding: 9px 10px 10px;
  border: 1px solid #d6e0ea;
  border-radius: 6px;
  background: #f8fafc;
}

#pos .pos-sale-options[open] summary {
  color: #21364c;
}

.sale-receipt-dialog {
  overflow: hidden;
}

.sale-receipt-dialog #saleReceiptForm {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}

.sale-receipt-dialog .modal-head,
.sale-receipt-dialog #saleReceiptStatus,
.sale-receipt-dialog .sale-receipt-actions {
  flex: 0 0 auto;
}

.sale-receipt-dialog .sale-receipt-print-area {
  flex: 1 1 auto;
  min-height: 0;
  padding-right: 5px;
  padding-bottom: var(--space-3);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-padding-block-end: var(--space-3);
  scrollbar-gutter: stable;
}

.sale-receipt-dialog .sale-receipt-actions {
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 -8px 18px rgba(25, 43, 64, .07);
}

.sale-receipt-dialog .sale-receipt-table th,
.sale-receipt-dialog .sale-receipt-table td,
.sale-receipt-dialog .sale-receipt-meta strong {
  font-variant-numeric: tabular-nums;
}

@media screen and (max-width: 1280px) and (min-width: 1181px) {
  #pos .pos-payment-line-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media screen and (max-width: 760px) {
  #pos .pos-cart-wrap.is-empty {
    min-height: 150px;
  }

  .sale-receipt-dialog #saleReceiptForm {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }
}

/* VENTAS-UX-SIMPLE-03: composición operativa del POS. */
#pos.view.active {
  grid-template-columns: minmax(0, 1fr) minmax(350px, 40%);
  grid-template-rows: auto auto minmax(0, 1fr);
  grid-template-areas:
    "context context"
    "summary summary"
    "sale payment";
  gap: 10px 14px;
}

.pos-context-strip {
  grid-area: context;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 0;
  align-items: stretch;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #cbd7e4;
  border-left: 4px solid var(--brand-primary);
  border-radius: 8px;
  background: #f8fafc;
}

.pos-context-item {
  display: grid;
  min-width: 0;
  padding: 8px 12px;
  border-right: 1px solid #dbe4ee;
}

.pos-context-item span,
.pos-context-item small {
  overflow: hidden;
  color: #5b6b7f;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.25;
}

.pos-context-item strong {
  overflow: hidden;
  color: #142235;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.35;
}

#posOpenCashView {
  align-self: center;
  min-height: 36px;
  margin: 6px 8px;
  white-space: nowrap;
}

#pos .panel-head p,
#pos .mini-panel-head small {
  display: block;
}

#pos .mini-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

#pos .mini-panel-head h3 {
  margin: 0;
  color: #17263a;
  font-size: 15px;
  line-height: 1.25;
}

#pos .mini-panel-head small {
  margin-top: 2px;
  color: #617086;
  font-size: 12px;
  line-height: 1.3;
}

.pos-panel,
.pos-actions-panel {
  padding: 14px;
}

.pos-layout {
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.pos-product-panel,
.pos-cart-panel {
  gap: 8px;
}

.pos-product-panel {
  padding-bottom: 12px;
}

.pos-product-search-grid {
  grid-template-columns: minmax(260px, 1fr) 82px 116px minmax(132px, auto);
  gap: 8px;
}

.pos-customer-field {
  grid-template-columns: auto minmax(220px, 380px);
  margin-bottom: 2px;
}

.pos-search-hint {
  display: block;
  color: #64748b;
  font-size: 12px;
  line-height: 1.3;
}

.pos-line-options,
.pos-sale-options,
.pos-payment-options {
  min-width: 0;
  border-top: 1px solid #e1e8f0;
  color: #314257;
}

.pos-line-options {
  width: min(280px, 100%);
  padding-top: 6px;
}

.pos-line-options summary,
.pos-sale-options summary,
.pos-payment-options summary {
  width: fit-content;
  color: #405168;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.pos-line-options label,
.pos-payment-options label {
  margin-top: 8px;
}

.pos-line-options[hidden] {
  display: none !important;
}

.pos-sale-options {
  padding-top: 8px;
}

.pos-sale-options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.pos-action-buttons {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pos-action-buttons > .primary:not([hidden]) {
  grid-column: 1 / -1;
  min-height: 42px;
  font-size: 14px;
}

.pos-reset-action {
  grid-column: auto;
}

.pos-action-buttons [hidden],
.pos-payment-form [hidden] {
  display: none !important;
}

.pos-payment-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-top: 12px;
}

.pos-payment-options {
  padding-top: 7px;
}

.pos-payment-options label {
  display: grid;
}

.pos-payment-submit button {
  min-height: 44px;
  font-size: 15px;
}

.pos-actions-panel:not(.is-payment-ready) .pos-payment-form {
  display: none;
}

.pos-actions-panel.is-payment-ready .pos-payment-total {
  border-color: #79b99a;
  box-shadow: 0 0 0 2px rgba(31, 143, 96, .08);
}

@media screen and (max-width: 1180px) {
  #pos.view.active {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas:
      "context"
      "summary"
      "sale"
      "payment";
  }

  .pos-actions-panel {
    position: static;
  }
}

@media screen and (max-width: 760px) {
  .pos-context-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pos-context-item:nth-child(2) {
    border-right: 0;
  }

  .pos-context-item:nth-child(3) {
    grid-column: 1 / -1;
    border-top: 1px solid #dbe4ee;
    border-right: 0;
  }

  #posOpenCashView {
    grid-column: 1 / -1;
    width: calc(100% - 16px);
  }

  .pos-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pos-product-search-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pos-product-search-grid .pos-product-main-field,
  .pos-product-search-grid #posAddItem {
    grid-column: 1 / -1;
  }

  .pos-product-search-grid > label:not(.pos-product-main-field) {
    grid-column: auto;
  }

  .pos-sale-options-grid,
  .pos-payment-form,
  .pos-action-buttons {
    grid-template-columns: minmax(0, 1fr);
  }

  .pos-action-buttons > *,
  .pos-action-buttons > .primary:not([hidden]) {
    grid-column: 1 / -1;
  }
}

@media screen and (max-width: 420px) {
  .pos-context-strip {
    grid-template-columns: minmax(0, 1fr);
  }

  .pos-context-item,
  .pos-context-item:nth-child(2),
  .pos-context-item:nth-child(3) {
    grid-column: 1;
    border-top: 1px solid #dbe4ee;
    border-right: 0;
  }

  .pos-context-item:first-child {
    border-top: 0;
  }

  .pos-panel,
  .pos-actions-panel {
    padding: 12px;
  }

  .pos-customer-field {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* VENTAS-UX-SIMPLE-03: refinamiento de caja rápida y cobro seguro. */
#pos .pos-product-panel[hidden],
#pos .pos-sale-options[hidden],
#pos .pos-payment-preview [hidden] {
  display: none !important;
}

#pos .pos-cart-panel .mini-panel-head {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  padding: 2px 1px 7px;
  border-bottom: 1px solid #e2e8f0;
}

.pos-cart-panel {
  grid-template-rows: auto minmax(0, 1fr);
}

.pos-stage-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid #cbd7e4;
  border-radius: 999px;
  background: #f8fafc;
  color: #526377;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.pos-stage-badge[data-state="confirm"] {
  border-color: #bfd2ea;
  background: #edf5ff;
  color: #1e5b94;
}

.pos-stage-badge[data-state="payment"],
.pos-stage-badge[data-state="paid"] {
  border-color: #a9d7c0;
  background: #eaf8f1;
  color: #12623f;
}

.pos-stage-badge[data-state="voided"] {
  border-color: #efb8be;
  background: #fff1f2;
  color: #a11d2c;
}

.pos-line-state {
  display: inline-block;
  padding: 3px 6px;
  border-radius: 999px;
  background: #edf5ff;
  color: #245b90;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
}

.pos-sale-summary small {
  display: block;
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pos-flow-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.pos-flow-steps li {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 30px;
  padding: 5px 7px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.1;
  text-align: center;
}

.pos-flow-steps li span {
  display: grid;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 12px;
}

.pos-flow-steps li.is-active {
  border-color: #75bc98;
  background: #eefaf4;
  color: #0f5d3b;
}

.pos-flow-steps li.is-active span,
.pos-flow-steps li.is-complete span {
  background: var(--brand-primary);
  color: #fff;
}

.pos-flow-steps li.is-complete {
  border-color: #bddfce;
  color: #286147;
}

.pos-flow-steps li.is-stopped {
  border-color: #efb8be;
  background: #fff1f2;
  color: #9f2632;
}

.pos-sale-options-grid .pos-secondary-danger {
  grid-column: 1 / -1;
  justify-self: start;
  min-height: 34px;
  padding-inline: 12px;
}

.pos-payment-field {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: #18283b;
  font-weight: 500;
}

.pos-payment-field > label {
  display: block;
}

.pos-payment-field > small,
.pos-payment-amount-field > small {
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
}

.pos-payment-input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  min-width: 0;
}

#pos .pos-payment-input-action button {
  grid-column: auto;
  min-width: 78px;
  min-height: 34px;
  padding: 6px 9px;
  white-space: nowrap;
}

.pos-payment-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border: 1px solid #dbe5ef;
  border-radius: 7px;
  background: #f8fafc;
}

.pos-payment-preview > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.pos-payment-preview span {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.pos-payment-preview strong {
  overflow: hidden;
  color: #17263a;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.pos-payment-preview #posPaymentPreviewChangeRow strong {
  color: #0f6a43;
}

#posRegisterPayment {
  min-height: 44px;
  font-size: 15px;
}

@media screen and (max-width: 760px) {
  .pos-flow-steps li {
    min-height: 36px;
    padding-inline: 5px;
  }

  .pos-payment-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pos-payment-preview > div:last-child {
    grid-column: 1 / -1;
  }
}

@media screen and (max-width: 420px) {
  .pos-flow-steps li {
    display: grid;
    justify-items: center;
    gap: 3px;
    font-size: 12px;
  }

  .pos-payment-input-action {
    grid-template-columns: minmax(0, 1fr) 76px;
  }
}

/* VENTAS-UX-SIMPLE-04: varias formas de pago en una sola transaccion. */
.pos-payment-lines-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.pos-payment-lines-head > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.pos-payment-lines-head strong {
  color: #17263a;
  font-size: 14px;
}

.pos-payment-lines-head small {
  color: #64748b;
  font-size: 12px;
  line-height: 1.3;
}

#pos .pos-payment-lines-head #posAddPaymentLine {
  grid-column: auto;
  flex: 0 0 auto;
  min-height: 36px;
  white-space: nowrap;
}

.pos-payment-lines {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.pos-payment-line {
  min-width: 0;
  margin: 0;
  padding: 9px;
  border: 1px solid #d9e3ed;
  border-radius: 7px;
  background: #fbfcfe;
}

.pos-payment-line legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 100%;
  padding: 0 2px;
  color: #304158;
  font-size: 12px;
  font-weight: 800;
}

#pos .pos-payment-line legend .pos-remove-payment-line {
  grid-column: auto;
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 2px;
  color: #9f2632;
  font-size: 20px;
  line-height: 1;
}

.pos-payment-line-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 8px;
  min-width: 0;
}

.pos-payment-line-grid > * {
  min-width: 0;
}

.pos-payment-submit {
  grid-column: 1 / -1;
}

.pos-payment-submit #posRegisterPayment {
  width: 100%;
}

@media screen and (max-width: 760px) {
  .pos-payment-lines-head {
    align-items: stretch;
    flex-direction: column;
  }

  #pos .pos-payment-lines-head #posAddPaymentLine {
    width: 100%;
  }

  .pos-payment-line-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* VENTAS-UX-SIMPLE-04 R2: cobro compacto y acciones estables. */
#pos .pos-actions-panel {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
  align-content: stretch;
  height: 100%;
  overflow: hidden;
  scrollbar-gutter: auto;
}

#pos .pos-actions-panel > .pos-payment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  min-width: 0;
  min-height: 0;
  margin: 0 -2px;
  padding: 10px 2px 8px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
}

#pos .pos-actions-panel:not(.is-payment-ready) > .pos-payment-form {
  display: none;
}

#pos .pos-payment-form > .wide {
  grid-column: 1;
}

#pos .pos-payment-lines {
  gap: 6px;
}

#pos .pos-payment-line {
  padding: 7px 8px 8px;
}

#pos .pos-payment-line-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

#pos .pos-payment-line-grid label,
#pos .pos-payment-field {
  gap: 3px;
  font-size: 12px;
}

#pos .pos-payment-field > small,
#pos .pos-payment-amount-field > small {
  font-size: 12px;
  line-height: 1.2;
}

#pos .pos-checkout-dock {
  position: relative;
  z-index: 4;
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0 -14px -14px;
  padding: 9px 14px 14px;
  border-top: 1px solid #cfdbea;
  background: #ffffff;
  box-shadow: 0 -8px 18px rgba(29, 47, 70, .08);
}

#pos .pos-checkout-dock .pos-payment-preview[hidden] {
  display: none !important;
}

#pos .pos-checkout-dock .pos-payment-preview {
  margin: 0;
  padding: 7px 9px;
}

#pos .pos-checkout-dock .pos-actions-grid {
  display: block;
  min-width: 0;
}

#pos .pos-checkout-dock .pos-action-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

#pos .pos-checkout-dock .pos-action-buttons > button:not([hidden]) {
  grid-column: auto;
  width: 100%;
  min-height: 50px;
  padding: 10px 12px;
  font-size: 15px;
  white-space: normal;
}

#pos .pos-actions-panel.is-stage-products #posCreateSale,
#pos .pos-actions-panel.is-stage-products #posResetSale,
#pos .pos-actions-panel.is-stage-confirm #posEditDraft,
#pos .pos-actions-panel.is-stage-confirm #posConfirmSale,
#pos .pos-actions-panel.is-stage-paid #posSaleReceipt,
#pos .pos-actions-panel.is-stage-paid #posResetSale {
  grid-column: auto;
}

#pos .pos-actions-panel.is-stage-products #posResetSale,
#pos .pos-actions-panel.is-stage-confirm #posEditDraft,
#pos .pos-actions-panel.is-stage-paid #posSaleReceipt {
  order: 1;
}

#pos .pos-actions-panel.is-stage-products #posCreateSale,
#pos .pos-actions-panel.is-stage-confirm #posConfirmSale,
#pos .pos-actions-panel.is-stage-paid #posResetSale {
  order: 2;
}

#pos .pos-actions-panel.is-stage-payment #posRegisterPayment,
#pos .pos-actions-panel.is-stage-voided #posResetSale {
  grid-column: 1 / -1;
}

#pos #posEditDraft {
  border-color: #9cb8d5;
  color: #1f5f99;
  background: #f3f8fd;
}

@media screen and (max-width: 1180px) {
  #pos .pos-actions-panel {
    display: flex;
    height: auto;
    overflow: visible;
  }

  #pos .pos-actions-panel > .pos-payment-form {
    max-height: none;
    overflow: visible;
    scrollbar-gutter: auto;
  }

  #pos .pos-checkout-dock {
    position: sticky;
    bottom: 0;
    margin-inline: -14px;
    margin-bottom: -14px;
    padding-inline: 14px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

@media screen and (max-width: 980px) {
  .workspace[data-active-view="pos"] {
    min-height: 0;
    height: auto;
    overflow: visible;
  }
}

@media screen and (max-width: 900px) {
  #pos .pos-payment-line-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media screen and (max-width: 560px) {
  #pos .pos-payment-line-grid,
  #pos .pos-checkout-dock .pos-action-buttons {
    grid-template-columns: minmax(0, 1fr);
  }

  #pos .pos-actions-panel.is-stage-products #posCreateSale,
  #pos .pos-actions-panel.is-stage-products #posResetSale,
  #pos .pos-actions-panel.is-stage-confirm #posEditDraft,
  #pos .pos-actions-panel.is-stage-confirm #posConfirmSale,
  #pos .pos-actions-panel.is-stage-paid #posSaleReceipt,
  #pos .pos-actions-panel.is-stage-paid #posResetSale {
    grid-column: 1;
  }

  #pos .pos-checkout-dock {
    margin-inline: -12px;
    margin-bottom: -12px;
    padding-inline: 12px;
  }
}

/* POS vendedor: interfaz agil, segura y visualmente estable. */
#pos.view.active {
  grid-template-columns: minmax(0, 1fr) minmax(440px, min(42vw, 620px));
  gap: 10px 14px;
}

#pos[aria-busy="true"] {
  cursor: progress;
}

.pos-context-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto auto;
}

#posToggleFocusMode,
#posOpenCashView {
  align-self: center;
  min-height: 36px;
  margin: 6px 4px;
  padding-inline: 11px;
  white-space: nowrap;
}

#posOpenCashView {
  margin-right: 8px;
}

#posToggleFocusMode[aria-pressed="true"] {
  border-color: #78a98f;
  background: #edf8f2;
  color: #12623f;
}

#pos .pos-panel,
#pos .pos-actions-panel {
  border-color: #ccd8e5;
  box-shadow: 0 5px 16px rgba(25, 43, 64, .07);
}

#pos .pos-panel > .panel-head,
#pos .pos-actions-panel > .panel-head {
  margin-bottom: 8px;
}

#pos .pos-product-search-control {
  position: relative;
  display: block;
}

#pos .pos-product-search-control input {
  width: 100%;
  min-height: 44px;
  padding-right: 40px;
  border-color: #aebed0;
  background: #fff;
  font-size: 15px;
}

#pos .pos-product-search-control input:focus {
  border-color: #16885b;
  box-shadow: 0 0 0 3px rgba(22, 136, 91, .14);
}

#pos .pos-search-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  transform: translateY(-50%);
  background: transparent;
  color: #54657a;
  font-size: 20px;
  line-height: 1;
}

#pos .pos-search-clear:hover,
#pos .pos-search-clear:focus-visible {
  background: #edf2f7;
  color: #16283d;
}

#pos .pos-product-suggestions {
  max-height: min(350px, 46vh);
  padding: 4px;
  border-color: #aebed0;
  box-shadow: 0 16px 30px rgba(22, 39, 58, .16);
}

#pos .pos-product-suggestion {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr) !important;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 7px 9px;
  text-align: left;
}

#pos .pos-suggestion-thumb,
#pos .pos-cart-thumb {
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  border: 1px solid #d4dee9;
  border-radius: 6px;
  background: #f2f6f8;
  color: #176d4b;
  font-weight: 800;
}

#pos .pos-suggestion-thumb {
  width: 52px;
  height: 52px;
  font-size: 18px;
}

#pos .pos-suggestion-thumb img,
#pos .pos-cart-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#pos .pos-suggestion-copy,
#pos .pos-cart-product-copy {
  display: grid;
  min-width: 0;
}

#pos .pos-suggestion-name {
  overflow: hidden;
  color: #15263a;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.3;
}

#pos .pos-suggestion-meta {
  overflow: hidden;
  color: #607187;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

#pos .pos-suggestion-details {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 3px;
  color: #315169;
  font-size: 12px;
  font-weight: 700;
}

#pos .pos-suggestion-details span:last-child {
  color: #12623f;
  white-space: nowrap;
}

#pos .pos-product-suggestion.is-active {
  border-color: #7fb99c;
  background: #edf8f2;
  box-shadow: inset 3px 0 0 #16885b;
}

#pos .pos-product-suggestion.is-out-of-stock .pos-suggestion-details span:first-child {
  color: #a52a35;
}

#pos .pos-cart-wrap {
  border-color: #d5e0eb;
  background: #fff;
}

#pos .pos-cart-table {
  table-layout: fixed;
}

#pos .pos-cart-table th:first-child {
  width: 38%;
}

#pos .pos-cart-table th:nth-child(2) {
  width: 154px;
}

#pos .pos-cart-table th:last-child {
  width: 58px;
}

#pos .pos-cart-table td {
  vertical-align: middle;
}

#pos .pos-cart-product {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#pos .pos-cart-thumb {
  width: 38px;
  height: 38px;
  font-size: 14px;
}

#pos .pos-cart-product-copy strong {
  overflow: hidden;
  color: #142438;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

#pos .pos-cart-product-copy small {
  overflow: hidden;
  margin-top: 2px;
  color: #52647a;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

#pos .pos-qty-stepper {
  display: grid;
  grid-template-columns: 32px 54px 32px;
  justify-content: end;
  gap: 3px;
  min-width: 0;
}

#pos .pos-qty-button,
#pos .pos-remove-cart-item {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid #c7d3df;
  border-radius: 5px;
  background: #f7f9fb;
  color: #20364d;
  font-size: 18px;
  line-height: 1;
}

#pos .pos-qty-button:hover:not(:disabled),
#pos .pos-qty-button:focus-visible,
#pos .pos-remove-cart-item:hover:not(:disabled),
#pos .pos-remove-cart-item:focus-visible {
  border-color: #7594b3;
  background: #edf3f8;
}

#pos .pos-cart-qty {
  width: 54px;
  min-width: 0;
  min-height: 32px;
  padding: 4px;
  text-align: center;
}

#pos .pos-remove-cart-item {
  color: #a32633;
  font-size: 20px;
}

#pos .pos-cart-undo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  padding: 6px 8px 6px 11px;
  border: 1px solid #a9c8b7;
  border-left: 4px solid #16885b;
  border-radius: 6px;
  background: #eff8f3;
  color: #174d38;
  font-size: 12px;
}

#pos .pos-cart-undo[hidden] {
  display: none !important;
}

#pos .pos-cart-empty-row td {
  height: 126px;
  padding: 24px;
  text-align: center;
}

#pos .pos-cart-empty-row strong,
#pos .pos-cart-empty-row small {
  display: block;
}

#pos .pos-cart-empty-row strong {
  color: #2a3c50;
  font-size: 14px;
}

#pos .pos-cart-empty-row small {
  margin-top: 4px;
  color: #52647a;
}

#pos .pos-payment-lines-head {
  padding-bottom: 1px;
}

#pos .pos-payment-shortcuts {
  display: grid;
  gap: 5px;
  padding: 7px 8px;
  border: 1px solid #d8e2ec;
  border-radius: 6px;
  background: #f7f9fb;
}

#pos .pos-payment-shortcuts > span {
  color: #44586f;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

#pos .pos-payment-shortcuts > div {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
}

#pos .pos-payment-shortcut {
  min-width: 0;
  min-height: 34px;
  padding: 6px 5px;
  border: 1px solid #c8d4df;
  border-radius: 5px;
  background: #fff;
  color: #2b4056;
  font-size: 12px;
  font-weight: 750;
}

#pos .pos-payment-shortcut:hover:not(:disabled),
#pos .pos-payment-shortcut:focus-visible,
#pos .pos-payment-shortcut[aria-pressed="true"] {
  border-color: #6ead8b;
  background: #eaf7f0;
  color: #105f3d;
}

#pos .pos-payment-line {
  border-color: #cdd9e5;
  background: #fff;
}

#pos .pos-payment-line-grid {
  grid-template-columns: minmax(135px, 1.05fr) minmax(150px, .95fr) minmax(170px, 1fr);
}

#pos .pos-payment-line-grid input,
#pos .pos-payment-line-grid select {
  min-height: 38px;
}

#pos .pos-payment-field > small[hidden],
#pos .pos-payment-amount-field > small[hidden] {
  display: none !important;
}

#pos .pos-payment-input-action {
  grid-template-columns: minmax(0, 1fr) auto;
}

#pos .pos-payment-input-action > button {
  min-height: 38px;
  padding-inline: 8px;
  white-space: nowrap;
}

#pos .pos-checkout-dock {
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 -10px 24px rgba(22, 39, 58, .11);
}

#pos .pos-checkout-dock .pos-payment-preview {
  border-color: #cbd8e3;
  background: #f7f9fb;
}

#pos .pos-checkout-dock .pos-action-buttons > button:not([hidden]) {
  min-height: 52px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 800;
}

#pos .pos-checkout-dock .pos-action-buttons > .primary:not([hidden]) {
  box-shadow: 0 4px 10px rgba(15, 111, 72, .16);
}

#pos .pos-line-state {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #edf5fb;
  color: #1f5f99;
  font-size: 12px;
  font-weight: 800;
}

#pos .pos-receipt-payment-reference {
  display: block;
  margin-top: 2px;
  color: #52647a;
  font-size: 12px;
  font-weight: 500;
}

#pos small {
  color: #52647a;
}

body[data-active-view="pos"] .app-toast-region {
  bottom: 84px;
}

@media screen and (min-width: 981px) {
  body.pos-focus-mode {
    grid-template-columns: minmax(0, 1fr);
  }

  body.pos-focus-mode .sidebar {
    display: none;
  }

  body.pos-focus-mode .workspace {
    grid-column: 1;
    padding-inline: 16px;
  }

  body.pos-focus-mode #pos.view.active {
    grid-template-columns: minmax(0, 1fr) minmax(460px, min(40vw, 640px));
  }
}

@media screen and (max-width: 1280px) and (min-width: 1181px) {
  #pos.view.active {
    grid-template-columns: minmax(0, 1fr) minmax(430px, 44%);
  }

  #pos .pos-payment-shortcuts > div {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #pos .pos-payment-line-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media screen and (max-width: 1180px) {
  #pos.view.active {
    grid-template-columns: minmax(0, 1fr);
  }

  #pos .pos-actions-panel > .pos-payment-form {
    overflow: visible;
  }
}

@media screen and (max-width: 900px) {
  #pos .pos-payment-shortcuts > div {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media screen and (max-width: 760px) {
  .pos-context-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #posToggleFocusMode {
    display: none;
  }

  #posOpenCashView {
    grid-column: 1 / -1;
    width: calc(100% - 16px);
  }

  #pos .pos-cart-table {
    table-layout: auto;
  }

  #pos .pos-cart-table th:first-child,
  #pos .pos-cart-table th:nth-child(2),
  #pos .pos-cart-table th:last-child {
    width: auto;
  }

  #pos .pos-qty-stepper {
    grid-template-columns: 38px minmax(58px, 1fr) 38px;
    justify-content: stretch;
  }

  #pos .pos-qty-button,
  #pos .pos-remove-cart-item {
    min-height: 38px;
  }

  #pos .pos-payment-line-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-active-view="pos"] .app-toast-region {
    bottom: calc(96px + env(safe-area-inset-bottom));
  }
}

@media screen and (max-width: 560px) {
  #pos .pos-payment-shortcuts > div,
  #pos .pos-payment-line-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #pos .pos-payment-shortcut {
    min-height: 40px;
    font-size: 12px;
  }

  #pos .pos-product-suggestion {
    grid-template-columns: 44px minmax(0, 1fr) !important;
  }

  #pos .pos-suggestion-thumb {
    width: 44px;
    height: 44px;
  }

  #pos .pos-suggestion-details {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
}

@media screen and (max-width: 420px) {
  #pos .pos-payment-shortcuts > div,
  #pos .pos-payment-line-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  #pos .pos-cart-undo {
    align-items: stretch;
    flex-direction: column;
  }

  #pos .pos-cart-undo button {
    width: 100%;
  }
}

@media screen and (prefers-reduced-motion: reduce) {
  #pos .pos-product-suggestion,
  #pos .pos-payment-shortcut,
  #pos .pos-qty-button,
  #pos .pos-remove-cart-item,
  #pos .pos-checkout-dock .pos-action-buttons > button {
    transition: none;
  }
}

/* POS premium R4: precedencia final para la superficie completa de venta. */
@media screen and (max-width: 900px) {
  body #pos .pos-payment-line-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media screen and (max-width: 560px) {
  body #pos .pos-payment-line-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media screen and (min-width: 1181px) {
  #pos .pos-actions-panel {
    display: flex;
    flex-direction: column;
    align-content: normal;
    height: 100%;
    overflow: hidden;
  }

  #pos .pos-actions-panel > .panel-head,
  #pos .pos-actions-panel > .pos-flow-steps,
  #pos .pos-actions-panel > .pos-payment-total,
  #pos .pos-actions-panel > #posSaleStatus,
  #pos .pos-actions-panel > .pos-sale-options,
  #pos .pos-actions-panel > .pos-checkout-dock {
    flex: 0 0 auto;
  }

  #pos .pos-actions-panel > .pos-payment-form {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }

  #pos .pos-actions-panel:not(.is-payment-ready) > .pos-payment-form {
    display: none;
  }

  #pos .pos-actions-panel > .pos-checkout-dock {
    margin-top: auto;
  }
}

#pos .pos-payment-line-grid {
  grid-template-columns: minmax(150px, 1.05fr) minmax(172px, 1fr) minmax(168px, 1fr);
}

#pos .pos-payment-input-action {
  grid-template-columns: minmax(92px, 1fr) 72px;
  gap: 5px;
}

#pos .pos-payment-input-action > input {
  min-width: 0;
  padding-inline: 9px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#pos .pos-payment-input-action > button {
  width: 72px;
  min-width: 72px;
  min-height: 38px;
  padding-inline: 5px;
}

#pos .pos-actions-panel.is-stage-products.is-cart-empty #posCreateSale,
#pos .pos-actions-panel.is-stage-payment #posRegisterPayment,
#pos .pos-actions-panel.is-stage-voided #posResetSale {
  grid-column: 1 / -1;
}

#pos #posConfirmSale {
  border-color: var(--green);
  background: var(--green);
}

@media screen and (max-width: 1280px) and (min-width: 1181px) {
  #pos .pos-payment-line-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* La confirmación de pago no debe quedar debajo de la barra fija de acciones
   cuando la página la trae a la vista. */
#posSaleStatus {
  scroll-margin-block-end: 96px;
}
