:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #10b981;
  --success-dark: #059669;
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: #7c3aed;
  --purple-dark: #6d28d9;
  --purple-soft: #f3e8ff;
  --purple-line: #ddd6fe;
  --text: #0f172a;
  --muted: #64748b;
  --soft-text: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --surface: #ffffff;
  --canvas: #f8fafc;
}

* { box-sizing: border-box; }

html { background: #e9eef5; }

body {
  min-width: 320px;
  margin: 0;
  background: #e9eef5;
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

a { color: inherit; }

.app-shell {
  width: 100%;
  max-width: 447px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--canvas);
}

.container,
.container-fluid {
  max-width: 430px;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  min-height: 60px;
  padding: 8px 0;
  background: rgba(248, 250, 252, .96);
  border-bottom: 1px solid rgba(226, 232, 240, .9);
  backdrop-filter: blur(14px);
}

.app-topbar .container-fluid {
  padding-right: 16px !important;
  padding-left: 16px !important;
}

.app-topbar .brand,
.app-topbar .vr,
.status-pill {
  display: none !important;
}

.app-topbar .brand {
  display: inline-flex !important;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
}

.brand-logo {
  display: block;
  width: 132px;
  height: auto;
  max-width: 100%;
  object-fit: contain;
}

.brand-mark {
  width: 9px;
  height: 9px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.eyebrow {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-main {
  padding-top: 16px;
  padding-bottom: 92px;
}

.app-main.container {
  padding-right: 16px !important;
  padding-left: 16px !important;
}

.btn,
.form-control,
.form-select {
  min-height: 42px;
  border-radius: 9px;
  font-size: 14px;
}

.btn {
  font-weight: 750;
}

.btn-icon {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

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

.btn-primary:hover,
.btn-primary:focus {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-outline-secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--muted);
}

.btn-outline-danger {
  border-color: #fecaca;
  color: var(--danger);
}

.btn-outline-danger:hover,
.btn-outline-danger:focus-visible {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fca5a5;
}

.btn-detail {
  color: var(--purple);
  background: var(--purple-soft);
  border-color: var(--purple-line);
}

.btn-detail:hover,
.btn-detail:focus-visible {
  color: var(--purple-dark);
  background: #ede9fe;
  border-color: #c4b5fd;
}

.form-control,
.form-select,
.input-group-text {
  border-color: var(--line);
  background-color: var(--surface);
}

.form-control:focus,
.form-select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .12);
}

.form-label {
  margin-bottom: 5px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.login-page {
  display: flex;
  width: 100%;
  max-width: 430px;
  min-height: 100svh;
  align-items: flex-start;
  justify-content: center;
  margin: 0 auto;
  padding: 30px 23px 18px;
  background: #fff;
  box-shadow: 0 18px 60px rgba(15, 23, 42, .16);
}

.login-panel {
  width: 100%;
  max-width: 400px;
  padding: 0;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 0 28px;
}

.login-logo {
  display: block;
  width: 228px;
  height: 122px;
  max-width: 100%;
  object-fit: contain;
}

.login-tagline {
  margin: 5px 0 0;
  color: #111827;
  font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  font-size: 22px;
  font-style: italic;
  font-weight: 600;
  line-height: 1.05;
}

.login-tagline span {
  color: #111827;
  font-family: "Segoe UI Symbol", "Arial Unicode MS", sans-serif;
  font-size: 24px;
  font-style: normal;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form[hidden],
.login-cnpj-selection[hidden] {
  display: none !important;
}

.login-cnpj-selection {
  display: grid;
  gap: 16px;
}

.login-selection-back {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 7px;
  padding: 7px 0;
  color: #475569;
  background: transparent;
  border: 0;
  font-size: 13px;
  font-weight: 750;
}

.login-selection-back:hover,
.login-selection-back:focus-visible {
  color: var(--primary);
}

.login-selection-eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.login-cnpj-selection h2 {
  margin: 0;
  color: #111827;
  font-size: 25px;
  font-weight: 850;
}

.login-selection-user {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12px;
}

.login-cnpj-options {
  display: grid;
  gap: 10px;
}

.login-cnpj-option {
  display: flex;
  min-height: 64px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: #172033;
  background: #eaf2ff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  text-align: left;
}

.login-cnpj-option > i:first-child {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  color: var(--primary);
  background: #dbeafe;
  border-radius: 50%;
  font-size: 18px;
}

.login-cnpj-option > span {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 2px;
}

.login-cnpj-option strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.login-cnpj-option small {
  color: #64748b;
  font-size: 11px;
}

.login-cnpj-option > i:last-child {
  color: #64748b;
  font-size: 15px;
}

.login-cnpj-option:hover,
.login-cnpj-option:focus-visible {
  background: #dbeafe;
  border-color: #60a5fa;
}

.login-cnpj-option:disabled {
  cursor: wait;
  opacity: .65;
}

.login-field {
  position: relative;
}

.login-field .form-control {
  width: 100%;
  min-height: 45px;
  padding: 10px 13px;
  color: #111827;
  background: #eaf2ff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 13px;
}

.login-field .form-control::placeholder {
  color: #111827;
  opacity: 1;
}

.login-field .form-control:focus {
  background: #f3f7ff;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.login-password-field .form-control {
  padding-right: 45px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  color: #64748b;
  background: transparent;
  border: 0;
  border-radius: 50%;
  transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--primary);
  background: rgba(37, 99, 235, .08);
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 20px;
  margin-top: -4px;
}

.login-options .form-check {
  min-width: 0;
  margin: 0;
}

.login-options .form-check-input {
  margin-top: .18em;
  border-color: #94a3b8;
}

.login-options .form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

.login-options .form-check-label,
.login-text-button {
  color: #64748b;
  font-size: 11px;
}

.login-text-button {
  padding: 0;
  color: var(--primary);
  background: transparent;
  border: 0;
  white-space: nowrap;
}

.login-text-button:hover,
.login-text-button:focus-visible {
  color: var(--primary-dark);
  text-decoration: underline;
}

.login-forgot {
  display: block;
  width: fit-content;
  margin: -4px auto 0;
  font-size: 13px;
  text-decoration: none;
}

.login-feedback {
  min-height: 0;
  margin: -2px 0 0;
  color: var(--danger);
  font-size: 12px;
  text-align: center;
}

.login-feedback:not(:empty) {
  min-height: 18px;
}

.login-submit,
.login-trial,
.login-install {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 800;
}

.login-submit {
  margin-top: -1px;
  color: #fff;
  background: #0d7ff5;
}

.login-submit:hover,
.login-submit:focus-visible {
  color: #fff;
  background: #0969d1;
}

.login-trial {
  color: #fff;
  background: #27a844;
}

.login-trial:hover,
.login-trial:focus-visible {
  color: #fff;
  background: #218838;
}

.login-install {
  color: #fff;
  background: #1f2937;
}

.login-install:hover,
.login-install:focus-visible {
  color: #fff;
  background: #111827;
}

.login-install i {
  margin-right: 5px;
  font-size: 13px;
}

.login-footer {
  margin-top: 20px;
  padding-top: 10px;
  color: #334155;
  border-top: 1px solid #cbd5e1;
  font-size: 12px;
  text-align: center;
}

.dashboard-head,
.screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.dashboard-head h2,
.screen-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 21px;
  font-weight: 850;
}

.dashboard-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

#metrics,
#quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-right: 0;
  margin-left: 0;
}

.metric-column,
.quick-column {
  width: auto;
  padding: 0;
}

.metric-card,
.quick-card {
  position: relative;
  display: block;
  width: 100%;
  min-height: 86px;
  padding: 13px;
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
}

.metric-card span,
.quick-card small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 20px;
  font-weight: 850;
  line-height: 1.05;
}

.metric-card i {
  position: absolute;
  right: 12px;
  bottom: 11px;
  color: rgba(15, 23, 42, .18);
  font-size: 21px;
}

.metric-today { border-left: 4px solid var(--success); }
.metric-stock { border-left: 4px solid var(--primary); }
.metric-people { border-left: 4px solid var(--warning); }
.metric-month { border-left: 4px solid var(--purple); }

.section-block { margin-top: 20px; }

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-heading h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 850;
}

.quick-card {
  min-height: 92px;
}

.quick-card i {
  display: grid;
  width: 34px;
  height: 34px;
  margin-bottom: 10px;
  place-items: center;
  color: #fff;
  font-size: 18px;
  border-radius: 10px;
}

.quick-card strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.quick-green i { background: var(--success); }
.quick-blue i { background: var(--primary); }
.quick-purple i { background: var(--purple); }
.quick-orange i { background: var(--warning); }

.dashboard-analytics-section {
  margin-top: 24px;
}

.dashboard-analytics-section .section-heading small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.dashboard-chart-grid,
.dashboard-ranking-grid {
  display: grid;
  gap: 10px;
}

.dashboard-ranking-grid {
  margin-top: 10px;
}

.dashboard-chart-card {
  min-width: 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
}

.dashboard-chart-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.dashboard-chart-heading h3 {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 850;
}

.dashboard-chart-heading > i {
  color: var(--primary);
  font-size: 19px;
}

.dashboard-chart-kicker {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.dashboard-bar-chart {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  height: 174px;
  margin-top: 14px;
  padding: 10px 4px 0;
  border-bottom: 1px solid var(--line);
}

.dashboard-bar-column {
  display: grid;
  min-width: 0;
  height: 100%;
  grid-template-rows: 25px 1fr 19px;
  align-items: end;
  justify-items: center;
}

.dashboard-bar-value,
.dashboard-bar-label {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-bar-track {
  display: flex;
  width: min(34px, 70%);
  height: 120px;
  align-items: flex-end;
  overflow: hidden;
  background: #f1f5f9;
  border-radius: 8px 8px 3px 3px;
}

.dashboard-bar-fill {
  width: 100%;
  min-height: 4px;
  border-radius: 8px 8px 3px 3px;
  transition: height .2s ease;
}

.dashboard-bar-fill-sales { background: var(--primary); }
.dashboard-bar-fill-receipts { background: var(--success); }

.dashboard-chart-summary {
  min-height: 14px;
  margin-top: 10px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-ranking-list {
  display: grid;
  min-height: 145px;
  align-content: center;
  gap: 12px;
  margin-top: 15px;
}

.dashboard-ranking-row {
  min-width: 0;
}

.dashboard-ranking-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dashboard-ranking-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-ranking-total {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 11px;
}

.dashboard-ranking-track {
  height: 6px;
  margin-top: 5px;
  overflow: hidden;
  background: #f1f5f9;
  border-radius: 6px;
}

.dashboard-ranking-fill {
  height: 100%;
  min-width: 4px;
  border-radius: 6px;
}

.dashboard-ranking-fill-product { background: var(--purple); }
.dashboard-ranking-fill-client { background: var(--warning); }

.dashboard-ranking-meta,
.dashboard-empty-state {
  color: var(--muted);
  font-size: 10px;
}

.dashboard-empty-state {
  margin: 0;
  text-align: center;
}

.search-toolbar {
  position: sticky;
  top: 60px;
  z-index: 1010;
  display: flex;
  gap: 8px;
  margin: 0 -16px 12px;
  padding: 10px 16px;
  background: rgba(248, 250, 252, .96);
  border-bottom: 1px solid rgba(226, 232, 240, .72);
  backdrop-filter: blur(12px);
}

.search-toolbar .input-group {
  min-width: 0;
}

.search-toolbar .input-group-text {
  color: var(--muted);
}

.pessoas-toolbar {
  flex-wrap: wrap;
}

.pessoas-toolbar .input-group {
  flex: 1 1 100%;
}

.pessoas-filter {
  flex: 1 1 calc(50% - 4px);
  min-width: 0;
}

#list-feedback {
  margin-top: 2px;
  margin-bottom: 8px !important;
  color: var(--muted) !important;
}

.filter-pills {
  display: flex;
  gap: 8px;
  margin: -2px 0 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-pills::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 13px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  background: #eef2f7;
  border: 1px solid transparent;
  border-radius: 999px;
}

.filter-pill.active {
  color: #fff;
  background: var(--primary);
}

.record-list {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.record-card {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 74px;
  overflow: visible;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, .04);
}

.record-card-open {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: inherit;
  align-items: center;
  gap: 11px;
  overflow: hidden;
  padding: 11px 48px 11px 10px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: inherit;
}

.record-card-open:focus {
  outline: 0;
}

.record-card-open:active {
  background: #f1f5f9;
}

.record-avatar {
  flex: 0 0 42px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #475569;
  background: #edf2f7;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
}

.record-avatar-produtos { color: var(--primary); background: var(--primary-soft); }
.record-avatar-vendas { color: var(--success); background: #ecfdf5; }
.record-avatar-caixa { color: var(--warning); background: #fffbeb; }
.record-avatar-ordens-servico { color: var(--purple); background: #f5f3ff; }
.record-avatar-contas-pagar { color: #b45309; background: #fff7ed; }
.record-avatar-contas-receber { color: var(--success); background: #ecfdf5; }

.record-content {
  width: 0;
  min-width: 0;
  max-width: 100%;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  overflow: hidden;
}

.record-body {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.record-card h3 {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 0 4px;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-meta {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 1px;
  margin: 0;
  overflow: hidden;
}

.record-meta div {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  display: flex;
  gap: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.record-meta dt {
  flex: 0 0 auto;
  color: var(--soft-text);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
}

.record-meta dt::after { content: ":"; }

.record-meta dd {
  min-width: 0;
  flex: 1 1 auto;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-side {
  flex: 0 0 auto;
  min-width: 0;
  max-width: min(112px, 34%);
  overflow: hidden;
  text-align: right;
}

.record-side small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--soft-text);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-side strong {
  display: block;
  max-width: 100%;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-chevron {
  flex: 0 0 auto;
  color: var(--soft-text);
  font-size: 16px;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1030;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .98);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, .06);
}

.nav-action {
  display: grid;
  min-height: 48px;
  place-items: center;
  align-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
  border-radius: 11px;
}

.nav-action i {
  font-size: 18px;
  line-height: 1;
}

.nav-action.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-action[type="button"] {
  width: 100%;
  padding: 0;
  font: inherit;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.nav-action[type="button"].active {
  background: var(--primary-soft);
}

.more-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1060;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, .34);
}

.more-menu {
  width: 100%;
  max-width: 430px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 52px rgba(15, 23, 42, .24);
}

.more-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.more-menu-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
}

.more-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.account-editor-main { padding-bottom: 108px; }
.account-form-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.account-form-panel .editor-section {
  margin: 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, .04);
}
.account-form-panel .editor-section h3 {
  margin-bottom: 12px;
  color: var(--text);
  font-size: 15px;
  font-weight: 850;
}
.account-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.account-status-row > div { min-width: 0; }
.account-status-label {
  display: block;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}
.account-status-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}
.account-status-switch {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text);
  font-weight: 750;
  white-space: nowrap;
}
.account-status-switch .form-check-input { margin: 0; }
.account-settlement-section[hidden] { display: none !important; }
.account-readonly-note {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 12px;
}
.account-collection-section .form-control[readonly],
.account-collection-section .form-select:disabled {
  color: var(--muted);
  background-color: var(--canvas);
  opacity: 1;
}
.account-form-panel textarea { resize: vertical; }
.account-save-button {
  width: 100%;
  min-height: 48px;
  margin-bottom: 4px;
  font-size: 15px;
}
.account-form-feedback {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}
.account-form-feedback-danger { color: var(--danger); }
.account-form-feedback-success { color: #047857; }
.account-heading { align-items: flex-start; }

.more-menu-item {
  display: grid;
  min-width: 0;
  min-height: 92px;
  align-content: center;
  justify-items: start;
  gap: 5px;
  padding: 13px;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color .15s ease, background-color .15s ease, transform .15s ease;
}

.more-menu-item:hover,
.more-menu-item:focus-visible {
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.more-menu-item i {
  color: var(--primary);
  font-size: 21px;
}

.more-menu-item span {
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

.more-menu-item small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.more-menu-item.disabled,
.more-menu-item.disabled:hover,
.more-menu-item.disabled:focus-visible {
  color: var(--muted);
  background: #f8fafc;
  border-color: #e7eaf0;
  cursor: not-allowed;
  opacity: .78;
  transform: none;
}

.more-menu-item.disabled i {
  color: var(--soft-text);
}

@media (min-width: 700px) {
  .more-menu-backdrop {
    align-items: center;
  }
}

.modal-dialog {
  max-width: 430px;
}

body.app-view-open {
  overflow: hidden;
}

.app-screen-view {
  position: fixed;
  inset: 0;
  z-index: 1040;
  display: none;
  width: 100%;
  max-width: 430px;
  height: 100%;
  margin: 0 auto;
  overflow: hidden;
  background: var(--canvas);
  opacity: 1 !important;
}

.app-screen-view.app-view-active {
  display: block;
}

.app-screen-view.fade {
  transition: none;
}

.app-screen-view .modal-dialog {
  width: 100%;
  max-width: 430px;
  height: 100%;
  margin: 0 auto;
  transform: none !important;
}

.app-screen-view .modal-content {
  display: flex;
  min-height: 100%;
  height: 100%;
  max-height: 100%;
  border: 0;
  border-radius: 0;
  background: var(--canvas);
  box-shadow: none;
}

.app-screen-view .modal-header {
  position: sticky;
  top: 0;
  z-index: 3;
  flex: 0 0 auto;
  gap: 10px;
  background: rgba(248, 250, 252, .96);
  backdrop-filter: blur(14px);
}

.app-screen-view .modal-header > div {
  min-width: 0;
  flex: 1 1 auto;
}

.app-screen-view .app-back-button {
  order: -1;
  flex: 0 0 40px;
  border-radius: 12px;
}

.app-screen-view .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-content {
  border: 0;
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(15, 23, 42, .20);
}

.modal-header {
  min-height: 58px;
  border-bottom-color: var(--line);
}

.modal-title {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 850;
  line-height: 1.25;
}

.modal-body {
  background: var(--canvas);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.detail-grid div,
.detail-row {
  min-width: 0;
}

.detail-grid dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.detail-grid dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
}

.detail-section {
  margin-top: 18px;
}

.detail-section h3 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 850;
}

.detail-row {
  padding: 11px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.detail-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px -16px -16px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(248, 250, 252, .97);
  border-top: 1px solid var(--line);
}

.empty-state {
  padding: 34px 18px;
  color: var(--muted);
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
}

.inline-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.editor-body {
  display: grid;
  gap: 12px;
  padding-bottom: 88px;
  background: var(--canvas);
}

.editor-section {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.editor-section h3 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
}

.form-switch-field {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 9px 10px 9px 40px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.form-switch-field .form-check-input {
  margin-left: -30px;
}

.contact-editor {
  margin-top: 14px;
}

.person-photo-editor {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 4px 0 16px;
  text-align: center;
}

.person-photo-stage {
  position: relative;
  width: 104px;
  height: 104px;
}

.person-photo-preview-wrap {
  display: grid;
  width: 104px;
  min-width: 104px;
  height: 104px;
  place-items: center;
  overflow: hidden;
  background: #f3efff;
  border: 1px solid #ddd6fe;
  border-radius: 50%;
}

.person-photo-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.person-photo-preview[hidden],
.person-photo-placeholder[hidden] {
  display: none;
}

.person-photo-placeholder {
  color: var(--primary);
  font-size: 30px;
}

.person-photo-actions {
  position: absolute;
  right: -8px;
  bottom: -5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.person-photo-action {
  display: grid;
  width: 32px !important;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50% !important;
  box-shadow: 0 4px 10px rgba(15, 23, 42, .18);
  font-size: 13px;
}

.person-photo-hint {
  color: var(--muted);
  font-size: 11px;
}

.person-city-picker {
  position: relative;
}

.person-city-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 20;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, .14);
}

.person-city-suggestions[hidden] {
  display: none;
}

.person-city-option {
  display: block;
  width: 100%;
  padding: 10px 12px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.person-city-option:hover,
.person-city-option:focus-visible {
  background: var(--primary-soft);
  outline: 0;
}

.person-attachment-upload {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #fafaff;
  border: 1px solid #edf0f5;
  border-radius: 8px;
}

.person-attachment-upload .form-label {
  margin: 0;
}

.person-attachment-upload .btn {
  width: max-content;
  border-radius: 8px;
}

.person-attachment-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.person-attachment-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  background: #fff;
  border: 1px solid #edf0f5;
  border-radius: 8px;
}

.person-attachment-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-attachment-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
}

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

.contact-row {
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

#pessoa-editor-modal .modal-content {
  max-height: 100vh;
}

#pessoa-editor-modal #pessoa-form {
  display: flex;
  flex-direction: column;
  max-height: 100vh;
  min-height: 0;
}

#pessoa-editor-modal .modal-header,
#pessoa-editor-modal .modal-footer {
  flex: 0 0 auto;
}

#pessoa-editor-modal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#pessoa-editor-modal .modal-footer {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .98);
  border-top-color: var(--line);
}

@media (max-width: 430px) {
  html,
  body {
    background: var(--canvas);
  }

  .app-shell,
  .login-page {
    max-width: none;
    box-shadow: none;
  }

  .modal-dialog {
    width: 100%;
    max-width: none;
    height: 100%;
    margin: 0;
  }

  .modal-content {
    min-height: 100%;
    border-radius: 0;
  }

  .modal-body {
    padding-right: 16px;
    padding-left: 16px;
  }
}

@media (min-width: 768px) {
  .app-shell {
    max-width: 920px;
  }

  .container,
  .container-fluid {
    max-width: 920px;
  }

  .app-topbar .container-fluid,
  .app-main.container {
    padding-right: 24px !important;
    padding-left: 24px !important;
  }

  .app-topbar .brand,
  .app-topbar .vr,
  .status-pill {
    display: inline-flex !important;
  }

  .app-topbar .vr {
    display: block !important;
  }

  .search-toolbar {
    top: 60px;
    margin-right: -24px;
    margin-left: -24px;
    padding-right: 24px;
    padding-left: 24px;
  }

  .pessoas-toolbar {
    flex-wrap: nowrap;
  }

  .pessoas-toolbar .input-group {
    flex: 1 1 auto;
  }

  .pessoas-filter {
    flex: 0 0 170px;
  }

  .dashboard-chart-grid,
  .dashboard-ranking-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #metrics,
  #quick-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .record-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .bottom-nav {
    max-width: 920px;
    padding-right: 24px;
    padding-left: 24px;
  }

  .modal-dialog,
  .app-screen-view,
  .app-screen-view .modal-dialog {
    max-width: 920px;
  }

  .app-screen-view .modal-body {
    padding: 20px 24px;
  }

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

  .detail-actions {
    margin-right: -24px;
    margin-left: -24px;
    padding-right: 24px;
    padding-left: 24px;
  }

  #pessoa-editor-modal .modal-footer {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1120px) {
  .app-shell,
  .container,
  .container-fluid,
  .bottom-nav,
  .modal-dialog,
  .app-screen-view,
  .app-screen-view .modal-dialog {
    max-width: 1120px;
  }

  .app-topbar .container-fluid,
  .app-main.container,
  .app-screen-view .modal-body {
    padding-right: 32px !important;
    padding-left: 32px !important;
  }

  .search-toolbar {
    margin-right: -32px;
    margin-left: -32px;
    padding-right: 32px;
    padding-left: 32px;
  }

  .record-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .detail-actions {
    margin-right: -32px;
    margin-left: -32px;
    padding-right: 32px;
    padding-left: 32px;
  }

  .bottom-nav {
    padding-right: 32px;
    padding-left: 32px;
  }
}

/* Module screens follow the mobile application layout without changing the dashboard. */
.module-page {
  --primary: #6d28d9;
  --primary-dark: #5b21b6;
  --primary-soft: #f3e8ff;
  --canvas: #f6f7fb;
}

.module-page .app-shell {
  background: var(--canvas);
}

.module-page .module-topbar {
  position: relative;
  min-height: 68px;
  padding: 12px 0 4px;
  background: transparent;
  border-bottom: 0;
  backdrop-filter: none;
}

.module-page .module-topbar .module-brand {
  display: inline-flex !important;
  gap: 9px;
  font-size: 18px;
}

.module-brand i {
  color: var(--primary);
  font-size: 27px;
  line-height: 1;
}

.module-brand strong {
  color: var(--text);
  font-weight: 850;
}

.module-page .module-topbar .flex-grow-1,
.module-page .module-topbar .vr,
.module-page .module-topbar .status-pill {
  display: none !important;
}

.module-page .module-topbar #logout-button {
  margin-left: auto;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

.module-page .app-main {
  padding-top: 10px;
}

.module-page .screen-head {
  align-items: flex-start;
  margin-bottom: 18px;
}

.module-page .screen-head h2 {
  font-size: 32px;
  line-height: 1.1;
}

.module-page .screen-head p {
  max-width: 290px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.module-page .module-add-button,
.module-page .inline-actions .module-add-button {
  display: inline-flex;
  width: auto;
  min-width: 92px;
  height: 48px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 16px;
  overflow: hidden;
  color: #fff;
  font-size: 14px;
  background: var(--success);
  border-color: var(--success);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(16, 185, 129, .2);
}

.module-page .module-add-button i,
.module-page .inline-actions .module-add-button i {
  color: #fff;
  font-size: 17px;
}

.module-page .module-add-button:hover,
.module-page .module-add-button:focus-visible {
  color: #fff;
  background: var(--success-dark);
  border-color: var(--success-dark);
}

.module-page .module-add-button:disabled {
  color: #fff;
  background: #6ee7b7;
  border-color: #6ee7b7;
  box-shadow: none;
  opacity: .55;
}

.module-page .module-search {
  position: relative;
  top: auto;
  z-index: 10;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 0;
  background: transparent;
  border: 0;
  backdrop-filter: none;
}

.module-page .module-search .input-group {
  flex: 1 1 0;
  min-width: 0;
  min-height: 52px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  box-shadow: 0 7px 20px rgba(15, 23, 42, .07);
}

.module-page .module-search .input-group-text,
.module-page .module-search .form-control {
  min-height: 50px;
  background: #fff;
  border: 0;
  box-shadow: none;
}

.module-page .module-search .input-group-text {
  padding-left: 15px;
  color: #475569;
  font-size: 21px;
}

.module-page .module-search .form-control {
  min-width: 0;
  padding-left: 8px;
  color: var(--text);
  text-overflow: ellipsis;
}

.module-page .module-search .form-control::placeholder {
  color: #8b95a7;
  opacity: 1;
}

.module-filter-toggle {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  color: #475569;
  background: #fff;
  border: 1px solid #edf0f5;
  box-shadow: 0 7px 20px rgba(15, 23, 42, .07);
}

.module-filter-toggle[aria-expanded="true"] {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #ddd6fe;
}

.module-filter-panel {
  flex: 1 1 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
}

.module-filter-panel[hidden] {
  display: none;
}

.module-filter-panel .form-label {
  margin-bottom: 5px;
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

.module-page .module-filter-pills {
  margin: 0 0 14px;
  padding-bottom: 2px;
}

.module-page .filter-pill {
  min-height: 38px;
  padding: 0 12px;
  color: #475569;
  font-size: 11px;
  background: #fff;
  border-color: #edf0f5;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .04);
}

.module-page .filter-pill.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 7px 16px rgba(109, 40, 217, .20);
}

.module-page #list-feedback:empty {
  display: none;
}

.person-cnpj-feedback {
  min-height: 18px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.person-cnpj-feedback.is-loading {
  color: var(--primary);
}

.person-cnpj-feedback.is-success {
  color: #047857;
}

.person-cnpj-feedback.is-error {
  color: var(--danger);
}

.person-relation-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.person-relation-option {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.person-relation-option input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}

.module-page .record-list {
  gap: 10px;
}

.module-page .record-card {
  min-height: 98px;
  padding: 0;
  background: #fff;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  box-shadow: 0 7px 20px rgba(15, 23, 42, .07);
}

.module-page .record-card:hover,
.module-page .record-card:focus-within {
  border-color: #d8ccfb;
  outline: 0;
  box-shadow: 0 8px 22px rgba(109, 40, 217, .12);
}

.module-page .record-card-open {
  min-height: inherit;
  gap: 11px;
  padding: 12px 48px 12px 12px;
}

.module-page .record-card-open:active {
  background: #faf8ff;
}

.module-record-main {
  display: block;
  min-width: 0;
  flex: 1 1 0;
  overflow: hidden;
}

.module-record-main h3 {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 0 3px;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-record-line,
.sale-client {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-record-line i {
  flex: 0 0 auto;
  color: #7c8799;
}

.module-line-text {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-record-side {
  display: flex;
  min-width: 0;
  max-width: 34%;
  flex: 0 0 auto;
  align-items: flex-end;
  flex-direction: column;
  overflow: hidden;
  text-align: right;
}

.record-menu-icon {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 17px;
}

.record-menu-open {
  z-index: 40;
}

.record-action-menu {
  position: absolute;
  top: 50%;
  right: 7px;
  z-index: 45;
  width: 36px;
  height: 36px;
  transform: translateY(-50%);
}

.record-menu-trigger {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  color: #64748b;
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 18px;
}

.record-menu-trigger:hover,
.record-menu-trigger:focus-visible,
.record-menu-trigger[aria-expanded="true"] {
  color: var(--primary);
  background: var(--primary-soft);
  outline: 0;
}

.record-action-panel {
  position: absolute;
  top: 40px;
  right: 0;
  display: grid;
  width: 184px;
  overflow: hidden;
  padding: 5px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, .18);
}

.record-action-panel[hidden] {
  display: none;
}

.record-action-panel-up {
  top: auto;
  bottom: 40px;
}

.record-action-item {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.record-action-item i {
  width: 18px;
  flex: 0 0 18px;
  color: #64748b;
  text-align: center;
  font-size: 15px;
}

.record-action-item:hover:not(:disabled),
.record-action-item:focus-visible:not(:disabled) {
  color: var(--primary-dark);
  background: var(--primary-soft);
  outline: 0;
}

.record-action-danger,
.record-action-danger i {
  color: #dc2626;
}

.record-action-detail,
.record-action-detail i {
  color: var(--purple);
}

.record-action-item.record-action-detail:hover:not(:disabled),
.record-action-item.record-action-detail:focus-visible:not(:disabled) {
  color: var(--purple-dark);
  background: var(--purple-soft);
}

.record-action-success,
.record-action-success i {
  color: #15803d;
}

.record-action-item.record-action-success:hover:not(:disabled),
.record-action-item.record-action-success:focus-visible:not(:disabled) {
  color: #166534;
  background: #dcfce7;
}

.record-action-item:disabled {
  cursor: not-allowed;
  opacity: .42;
}

.record-badge {
  display: block;
  max-width: 100%;
  padding: 5px 9px;
  overflow: hidden;
  font-size: 10px;
  font-weight: 750;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 6px;
}

.record-badge-cliente,
.record-badge-payment {
  color: #6d28d9;
  background: #f3e8ff;
}

.record-badge-fornecedor {
  color: #1d4ed8;
  background: #dbeafe;
}

.record-badge-outro,
.record-badge-neutral {
  color: #475569;
  background: #eef2f7;
}

.record-badge-success {
  color: #087443;
  background: #dcfce7;
}

.record-badge-warning {
  color: #b45309;
  background: #fef3c7;
}

.record-badge-danger {
  color: #b91c1c;
  background: #fee2e2;
}

.module-page .person-avatar,
.module-page .sale-avatar {
  width: 52px;
  height: 52px;
  flex-basis: 52px;
  color: #6d28d9;
  background: #f3e8ff;
  font-size: 15px;
}

.person-avatar-1 { color: #166534 !important; background: #dcfce7 !important; }
.person-avatar-2 { color: #1d4ed8 !important; background: #dbeafe !important; }
.person-avatar-3 { color: #9a3412 !important; background: #ffedd5 !important; }

.person-side {
  align-self: flex-start;
  padding-top: 2px;
}

.product-thumbnail {
  display: grid;
  width: 58px;
  height: 64px;
  flex: 0 0 58px;
  place-items: center;
  color: var(--primary);
  background: #f8f5ff;
  border-radius: 8px;
  font-size: 25px;
}

.product-price {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 16px;
  font-weight: 850;
}

.product-stock {
  gap: 3px;
}

.product-stock .stock-amount {
  margin-top: 2px;
  font-size: 17px;
  font-weight: 850;
}

.product-stock .text-success { color: #15803d !important; }
.product-stock .text-warning { color: #ea580c !important; }
.product-stock .text-danger { color: #dc2626 !important; }

.product-stock small {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-avatar {
  color: #9d174d !important;
  background: #fce7f3 !important;
}

.sale-client {
  color: #475569;
  font-size: 13px;
}

.module-page .module-record-line.sale-date-line {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.module-page .sale-date-line .module-line-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-side {
  gap: 4px;
}

.sale-total {
  margin-top: 2px;
  color: var(--text);
  font-size: 15px;
  font-weight: 850;
  white-space: nowrap;
}

.module-page .bottom-nav {
  min-height: 60px;
  padding-top: 7px;
  background: rgba(255, 255, 255, .98);
}

.module-page .nav-action {
  border-radius: 8px;
}

.module-page .nav-action.active {
  color: var(--primary);
  background: transparent;
}

.module-page .nav-action.active::after {
  width: 5px;
  height: 5px;
  margin-top: 1px;
  content: "";
  background: var(--primary);
  border-radius: 50%;
}

.module-page .app-screen-view .modal-header {
  padding: 13px 16px;
  background: rgba(246, 247, 251, .97);
}

.module-page .app-screen-view .modal-title {
  font-size: 22px !important;
}

.module-page .app-screen-view .app-back-button {
  color: #475569;
  background: #fff;
  border-color: #edf0f5;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .05);
}

/* People editor follows the same app-like form pattern as products and sales. */
.module-page #pessoa-editor-modal.app-screen-view,
.module-page #pessoa-editor-modal.app-screen-view .modal-dialog {
  max-width: 720px;
}

.module-page #pessoa-editor-modal.app-screen-view {
  z-index: 1050;
}

.module-page .person-editor-header {
  align-items: flex-start;
  padding-top: 16px;
  padding-bottom: 14px;
}

.module-page .person-editor-header .eyebrow {
  margin-bottom: 3px;
}

.module-page .person-editor-header .modal-title {
  overflow-wrap: anywhere;
  font-size: 30px !important;
  font-weight: 900;
  line-height: 1.1;
}

.module-page .person-editor-header p {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.module-page .person-editor-header #pessoa-id-label {
  margin-top: 5px;
}

.module-page .person-editor-body {
  display: grid;
  gap: 0;
  padding: 12px 12px 32px;
  margin: 0;
  background: var(--canvas);
}

.module-page .person-form-panel {
  display: flex;
  min-height: 100%;
  flex-direction: column;
}

.module-page .editor-section.person-form-section {
  padding: 4px 0 14px;
  margin: 0 0 14px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #edf0f5;
  border-radius: 0;
  box-shadow: none;
}

.module-page .editor-section.person-form-section:last-of-type {
  padding-bottom: 4px;
  margin-bottom: 0;
  border-bottom: 0;
}

.module-page .editor-section.person-form-section h3 {
  margin: 2px 0 14px;
  font-size: 16px;
  font-weight: 900;
}

.module-page .person-form-section .form-label {
  margin-bottom: 6px;
  font-size: 13px;
}

.module-page .person-form-section .form-control,
.module-page .person-form-section .form-select {
  min-height: 46px;
  border-radius: 8px;
}

.module-page .editor-section.person-primary-section {
  padding: 16px 14px 18px;
  margin-bottom: 12px;
  background: #fff;
  border: 1px solid #edf0f5;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .055);
}

.module-page .editor-section.person-primary-section h3 {
  margin-bottom: 16px;
  font-size: 17px;
}

.module-page .person-photo-card {
  padding: 14px 10px 16px;
  margin-bottom: 16px;
  background: #fbfaff;
  border: 1px solid #ede9fe;
  border-radius: 12px;
}

.module-page .person-document-row {
  margin-bottom: 12px !important;
}

.module-page .person-main-fields {
  row-gap: 12px;
}

.module-page .person-primary-section .form-label {
  font-size: 12px;
  letter-spacing: 0;
}

.module-page .person-primary-section .form-control,
.module-page .person-primary-section .form-select {
  min-height: 48px;
  padding-right: 12px;
  padding-left: 12px;
  background: #fff;
  border-color: #d8dee9;
  font-size: 14px;
}

.module-page .person-primary-section .form-control:focus,
.module-page .person-primary-section .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .11);
}

.module-page .person-primary-section .form-switch-field {
  min-height: 48px;
  background: #f8fafc;
  border-color: #e5e7eb;
  border-radius: 8px;
}

.module-page .person-primary-section .person-relation-options {
  gap: 7px;
}

.module-page .person-primary-section .person-relation-option {
  min-height: 44px;
  padding: 8px 9px;
  font-size: 12px;
  background: #f8fafc;
}

.module-page .person-info-menu-section::before {
  display: block;
  margin: 2px 2px 8px;
  color: var(--text);
  content: "Mais informações";
  font-size: 15px;
  font-weight: 900;
}

.module-page .person-info-menu-section {
  padding-bottom: 18px;
}

.module-page .person-form-footer {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}

.module-page .person-save-button {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .2);
}

.module-page .person-editor-body > .person-save-button {
  margin: 4px 0 8px;
}

.module-page .person-save-button:hover,
.module-page .person-save-button:focus-visible {
  color: #fff;
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.module-page .person-info-menu {
  display: grid;
  gap: 8px;
  padding: 2px 0 14px;
}

.module-page .person-info-launch {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: 40px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  color: var(--text);
  text-align: left;
  background: #fff;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  box-shadow: 0 5px 16px rgba(15, 23, 42, .04);
}

.module-page .person-info-launch:hover,
.module-page .person-info-launch:focus-visible {
  border-color: #c4b5fd;
  box-shadow: 0 0 0 3px rgba(109, 40, 217, .1);
}

.module-page .person-info-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 50%;
  font-size: 17px;
}

.module-page .person-info-launch > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.module-page .person-info-launch strong,
.module-page .person-info-launch small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-page .person-info-launch strong {
  font-size: 13px;
  font-weight: 850;
}

.module-page .person-info-launch small {
  color: var(--muted);
  font-size: 11px;
}

.module-page .person-info-launch > i:last-child {
  color: var(--muted);
  font-size: 14px;
}

.module-page .person-group-modal {
  z-index: 1060;
  background: transparent;
  backdrop-filter: none;
}

.module-page .person-group-modal .modal-header {
  backdrop-filter: none;
}

.module-page .person-group-back-button {
  order: -1;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 7px 10px;
  color: #475569;
  background: #fff;
  border-color: #d9dee8;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.module-page .person-group-back-button i {
  margin-right: 3px;
}

.module-page .person-group-modal .modal-dialog {
  max-width: 620px;
}

.module-page .person-group-modal .modal-content {
  display: flex;
  flex-direction: column;
  max-height: min(100vh, 760px);
  border-radius: 12px;
}

.module-page .person-group-modal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 24px;
  background: var(--canvas);
}

.module-page .person-group-modal-footer {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .98);
  border-top: 1px solid var(--line);
}

.module-page .person-group-modal-footer .btn {
  min-height: 46px;
  border-radius: 8px;
  font-weight: 800;
}

.module-page .person-group-modal-footer .person-save-button {
  min-height: 52px;
  font-size: 15px;
  font-weight: 850;
}

.module-page .person-group-modal-footer .btn-primary {
  color: #fff;
  background: #2563eb;
  border-color: #2563eb;
}

.module-page .person-group-modal-footer .btn-primary:hover,
.module-page .person-group-modal-footer .btn-primary:focus-visible {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.module-page .person-group-modal .person-form-section {
  padding: 4px 0 0;
  margin: 0;
  border-bottom: 0;
}

@media (max-width: 575.98px) {
  .module-page .person-editor-header {
    gap: 8px;
    padding: 12px;
  }

  .module-page .person-editor-header .modal-title {
    font-size: 25px !important;
  }

  .module-page .person-editor-header p {
    margin-top: 3px;
    font-size: 12px;
  }

}

@media (max-width: 575.98px) {
  .module-page .person-group-modal .modal-dialog {
    height: 100%;
    margin: 0;
  }

  .module-page .person-group-modal .modal-content {
    height: 100%;
    max-height: none;
    border-radius: 0;
  }

  .module-page .person-group-modal .modal-body {
    padding-bottom: 88px;
  }

  .module-page .person-group-modal-footer {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 4;
  }
}

.module-page .editor-section {
  border-color: #edf0f5;
  border-radius: 8px;
  box-shadow: 0 5px 16px rgba(15, 23, 42, .04);
}

.module-page .editor-section h3,
.module-page .form-label {
  color: var(--text);
  font-weight: 800;
}

.module-page .editor-section .form-control,
.module-page .editor-section .form-select {
  min-width: 0;
  border-color: #d9dee8;
}

.module-page #pessoa-editor-modal .modal-footer .btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}

@media (max-width: 374px) {
  .module-page .app-topbar .container-fluid,
  .module-page .app-main.container {
    padding-right: 12px !important;
    padding-left: 12px !important;
  }

  .module-page .screen-head h2 {
    font-size: 28px;
  }

  .module-page .record-card {
    padding: 0;
  }

  .module-page .record-card-open {
    gap: 8px;
    padding: 10px 44px 10px 8px;
  }

  .module-page .person-avatar,
  .module-page .sale-avatar {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .product-thumbnail {
    width: 48px;
    flex-basis: 48px;
  }

  .module-page .person-editor-header .modal-title {
    font-size: 26px !important;
  }

  .module-page .person-editor-header p {
    font-size: 12px;
  }

  .module-page .person-editor-body {
    padding-right: 11px;
    padding-left: 11px;
    padding-bottom: 32px;
    margin-right: 0;
    margin-left: 0;
  }

  .module-record-side {
    max-width: 31%;
  }

  .record-badge {
    padding-right: 6px;
    padding-left: 6px;
  }
}

@media (min-width: 768px) {
  .module-filter-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    align-items: end;
  }

  .module-page .screen-head p {
    max-width: none;
  }

  .module-page .record-card {
    min-height: 108px;
  }
}

/* New sale draft. Final persistence remains owned by the Delphi API. */
.sale-main {
  max-width: 720px !important;
}

.sale-head-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.sale-clear-button {
  width: 48px;
  min-width: 48px;
  height: 48px;
  color: #581c87;
  background: #f3e8ff;
  border: 1px solid #eadcff;
}

.sale-clear-button:hover,
.sale-clear-button:focus {
  color: #581c87;
  background: #eadcff;
}

.sale-product-search {
  margin-bottom: 10px !important;
}

.sale-product-search .input-group .btn {
  min-width: 50px;
  min-height: 50px;
  color: #475569;
  background: #fff;
  border: 0;
  border-radius: 0;
}

.sale-search-results {
  position: relative;
  z-index: 20;
  display: grid;
  max-height: 310px;
  gap: 6px;
  padding: 8px;
  margin: -4px 0 12px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, .12);
}

.sale-search-results[hidden] {
  display: none;
}

.sale-search-result {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 9px;
  color: var(--text);
  text-align: left;
  background: #fff;
  border: 1px solid #edf0f5;
  border-radius: 8px;
}

.sale-search-result:disabled {
  opacity: .55;
}

.sale-search-thumbnail,
.sale-item-thumbnail {
  display: grid;
  width: 48px;
  height: 52px;
  flex: 0 0 48px;
  place-items: center;
  color: var(--primary);
  background: #f8f5ff;
  border-radius: 8px;
  font-size: 21px;
}

.sale-search-copy {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.sale-search-copy strong,
.sale-search-copy small,
.sale-search-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-search-copy strong {
  font-size: 13px;
  font-weight: 800;
}

.sale-search-copy small {
  color: var(--muted);
  font-size: 11px;
}

.sale-search-copy span {
  margin-top: 2px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 750;
}

.sale-search-empty {
  padding: 16px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.sale-feedback {
  min-height: 0;
  margin-bottom: 8px;
  color: var(--muted);
}

.sale-feedback:empty {
  display: none;
}

.sale-feedback-warning { color: #b45309; }
.sale-feedback-danger { color: #b91c1c; }

.sale-cart {
  display: grid;
  gap: 9px;
  margin-bottom: 12px;
}

.sale-cart-item {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-columns: 48px minmax(0, 1fr) 104px;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: #fff;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  box-shadow: 0 7px 20px rgba(15, 23, 42, .06);
}

.sale-item-copy {
  min-width: 0;
  overflow: hidden;
}

.sale-item-copy h3,
.sale-item-copy small,
.sale-item-copy strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-item-copy h3 {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.sale-item-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.sale-item-price {
  margin-top: 4px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 850;
}

.sale-item-controls {
  display: grid;
  width: 104px;
  grid-template-columns: 32px 36px 32px;
  align-items: center;
  gap: 2px;
  padding-top: 19px;
}

.quantity-button {
  display: grid;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  place-items: center;
  color: var(--primary);
  background: #f3e8ff;
  border: 1px solid transparent;
  border-radius: 8px;
}

.sale-item-quantity {
  display: grid;
  width: 36px;
  height: 34px;
  place-items: center;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 750;
}

.sale-item-total {
  grid-column: 1 / -1;
  margin-top: 4px;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  text-align: center;
  white-space: nowrap;
}

.sale-item-controls .quantity-button:last-child {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  color: #64748b;
  background: transparent;
}

.sale-empty-state {
  display: grid;
  min-height: 110px;
  place-items: center;
  align-content: center;
  gap: 4px;
}

.sale-empty-state i {
  margin-bottom: 4px;
  color: var(--primary);
  font-size: 24px;
}

.sale-empty-state strong,
.sale-empty-state span {
  display: block;
}

.sale-empty-state strong {
  color: var(--text);
  font-size: 13px;
}

.sale-empty-state span {
  font-size: 11px;
}

.sale-summary {
  padding: 13px;
  margin-bottom: 10px;
  background: #fff;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  box-shadow: 0 7px 20px rgba(15, 23, 42, .05);
}

.sale-summary > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #475569;
  font-size: 13px;
}

.sale-summary > div + div {
  margin-top: 7px;
}

.sale-summary strong {
  color: var(--text);
  white-space: nowrap;
}

.sale-summary .sale-total-row {
  padding: 11px;
  margin: 10px -2px -2px;
  color: #581c87;
  background: #f3e8ff;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 850;
}

.sale-summary .sale-total-row strong {
  color: var(--primary);
}

.sale-selector {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  margin-bottom: 5px;
  color: var(--text);
  text-align: left;
  background: #fff;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  box-shadow: 0 7px 20px rgba(15, 23, 42, .05);
}

.sale-selector-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  color: var(--primary);
  background: #f3e8ff;
  border-radius: 50%;
  font-size: 20px;
}

.sale-selector-copy {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
}

.sale-selector-copy strong,
.sale-selector-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-selector-copy strong {
  font-size: 13px;
  font-weight: 850;
}

.sale-selector-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.sale-payment-selector {
  cursor: pointer;
}

.sale-payment-selector .form-select {
  min-height: 26px;
  padding: 1px 28px 1px 0;
  color: var(--muted);
  background-color: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 12px;
}

.sale-payment-methods {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding: 1px 2px 7px;
  scrollbar-width: thin;
}

.sale-payment-method {
  display: flex;
  width: 142px;
  min-width: 142px;
  min-height: 54px;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 9px 10px;
  color: var(--text);
  text-align: left;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 5px 14px rgba(15, 23, 42, .04);
  font-size: 12px;
  font-weight: 800;
}

.sale-payment-method i {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 50%;
  font-size: 15px;
}

.sale-payment-method span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-payment-method:hover,
.sale-payment-method:focus-visible,
.sale-payment-method.active {
  color: var(--primary);
  background: #f5f0ff;
  border-color: #c4b5fd;
  outline: 0;
}

.sale-payment-method.active i {
  color: #fff;
  background: var(--primary);
}

.sale-finish-button {
  width: 100%;
  min-height: 54px;
  margin-top: 2px;
  color: #fff;
  background: #16a765;
  border-color: #16a765;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 850;
}

.sale-finish-button:disabled {
  color: #fff;
  background: #16a765;
  border-color: #16a765;
  cursor: not-allowed;
  opacity: 1;
}

.sale-finish-button i {
  margin-right: 8px;
}

.client-results {
  display: grid;
  gap: 8px;
}

.client-result {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-bottom: 8px;
  color: var(--text);
  text-align: left;
  background: #fff;
  border: 1px solid #edf0f5;
  border-radius: 8px;
}

.client-result > span:nth-child(2) {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
}

.client-result strong,
.client-result small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-result strong {
  font-size: 13px;
  font-weight: 800;
}

.client-result small {
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 374px) {
  .sale-page .sale-head h2 {
    font-size: 26px;
  }

  .sale-page .sale-head p {
    max-width: 205px;
  }

  .sale-head-actions {
    gap: 5px;
  }

  .sale-clear-button,
  .sale-page .module-add-button {
    width: 43px;
    min-width: 43px;
    height: 43px;
    min-height: 43px;
  }

  .sale-cart-item {
    grid-template-columns: 42px minmax(0, 1fr) 88px;
    gap: 7px;
    padding: 9px 7px;
  }

  .sale-item-thumbnail {
    width: 42px;
    height: 48px;
    flex-basis: 42px;
  }

  .sale-item-controls {
    width: 88px;
    grid-template-columns: 27px 30px 27px;
  }

  .quantity-button {
    width: 27px;
    min-width: 27px;
    height: 30px;
    min-height: 30px;
  }

  .sale-item-quantity {
    width: 30px;
    height: 32px;
  }
}

/* Complete mobile-first sale editor, matching the three legacy registration stages. */
.sale-editor-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.sale-editor-heading > div { min-width: 0; }

.sale-editor-heading h2 {
  margin: 0;
  overflow: hidden;
  font-size: 27px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-editor-heading p {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-back-button {
  flex: 0 0 42px;
  color: #475569;
  background: #f1f5f9;
  border: 0;
}

.sale-stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 14px;
  padding: 4px;
  background: #eef2f7;
  border-radius: 8px;
}

.sale-step {
  display: flex;
  min-width: 0;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 750;
}

.sale-step span {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  background: #fff;
  border-radius: 50%;
  font-size: 10px;
}

.sale-step.active {
  color: #fff;
  background: var(--primary);
}

.sale-step.active span { color: var(--primary); }

.sale-step-panel[hidden] { display: none; }

.sale-form-panel {
  padding: 14px;
  background: #fff;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  box-shadow: 0 7px 20px rgba(15, 23, 42, .05);
}

.sale-field { min-width: 0; }
.sale-field + .sale-field { margin-top: 12px; }

.sale-field .form-label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 800;
}

.sale-field-hint {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-input,
.sale-money-input {
  display: flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sale-input:focus-within,
.sale-money-input:focus-within {
  border-color: #a78bfa;
  box-shadow: 0 0 0 .2rem rgba(124, 58, 237, .1);
}

.sale-input > i,
.sale-money-input > span {
  width: 42px;
  flex: 0 0 42px;
  color: #64748b;
  text-align: center;
  font-size: 17px;
  font-weight: 800;
}

.sale-input .form-control,
.sale-input .form-select,
.sale-money-input .form-control {
  min-width: 0;
  min-height: 42px;
  padding-left: 0;
  background-color: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.sale-input-action .btn {
  width: 42px;
  flex: 0 0 42px;
  min-height: 42px;
  color: var(--primary);
  background: transparent;
  border: 0;
}

.sale-textarea-input { align-items: flex-start; }
.sale-textarea-input > i { padding-top: 12px; }
.sale-textarea-input textarea { resize: vertical; }

.sale-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.sale-form-grid .sale-field + .sale-field { margin-top: 0; }

.sale-advanced,
.sale-payment-details {
  margin-top: 14px;
  border-top: 1px solid #edf0f5;
}

.sale-advanced summary,
.sale-payment-details summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 800;
}

.sale-advanced summary::-webkit-details-marker,
.sale-payment-details summary::-webkit-details-marker { display: none; }
.sale-advanced summary span i { margin-right: 8px; color: var(--primary); }
.sale-advanced[open] summary > i,
.sale-payment-details[open] summary > i { transform: rotate(180deg); }
.sale-advanced-body { padding-top: 2px; }

.sale-primary-action {
  width: 100%;
  min-height: 50px;
  margin-top: 12px;
  border-radius: 8px;
  font-weight: 850;
}

.sale-step-actions {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 9px;
  margin-top: 12px;
}

.sale-step-actions .btn {
  min-width: 0;
  min-height: 50px;
  border-radius: 8px;
  white-space: nowrap;
}

.sale-step-actions .sale-finish-button { width: auto; margin: 0; }

.sale-cart-item {
  grid-template-columns: 48px minmax(0, 1fr) 112px;
  cursor: pointer;
}

.sale-item-controls {
  width: 112px;
  grid-template-columns: 32px 40px 32px;
}

.sale-item-quantity { width: 40px; }

.sale-item-controls .quantity-button:nth-of-type(3),
.sale-item-controls .quantity-button:nth-of-type(4),
.sale-item-controls .quantity-button:last-child {
  position: absolute;
  top: 6px;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  background: transparent;
}

.sale-item-controls .quantity-button:nth-of-type(3) { right: 35px; color: var(--primary); }
.sale-item-controls .quantity-button:nth-of-type(4),
.sale-item-controls .quantity-button:last-child { right: 7px; color: #64748b; }

.sale-payment-balance {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  margin-bottom: 10px;
  color: #581c87;
  background: #f3e8ff;
  border: 1px solid #e9d5ff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.sale-payment-balance strong { font-size: 18px; white-space: nowrap; }
.sale-payment-balance .sale-balance-ok { color: #15803d; }

.sale-installments {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.sale-installment-card {
  display: grid;
  min-width: 0;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 10px;
  background: #fff;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .05);
}

.sale-installment-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--primary);
  background: #f3e8ff;
  border-radius: 50%;
}

.sale-installment-copy { min-width: 0; }
.sale-installment-copy strong,
.sale-installment-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sale-installment-copy strong { font-size: 12px; }
.sale-installment-copy small { color: var(--muted); font-size: 10px; }
.sale-installment-value { font-size: 13px; white-space: nowrap; }

.sale-installment-actions {
  display: flex;
  grid-column: 2 / -1;
  justify-content: flex-end;
  gap: 4px;
}

.sale-installment-actions .quantity-button {
  width: 32px;
  min-width: 32px;
  height: 30px;
  min-height: 30px;
}

.sale-installment-form { margin-bottom: 10px; }
.sale-add-installment { width: 100%; margin-top: 12px; border-radius: 8px; }
.sale-final-summary { margin-top: 10px; }

.sale-item-calculation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  margin-top: 14px;
  color: #581c87;
  background: #f3e8ff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.sale-item-calculation strong { font-size: 18px; white-space: nowrap; }
.sale-feedback-success { color: #15803d; }

.sale-invoice-action {
  display: flex;
  justify-content: flex-end;
  margin: -2px 0 14px;
}

.sale-invoice-action .btn {
  display: inline-flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  font-weight: 750;
}

.sale-invoice-main {
  max-width: 680px;
}

.sale-invoice-summary {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 14px;
  margin-bottom: 18px;
  background: #fff;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  box-shadow: 0 7px 20px rgba(15, 23, 42, .07);
}

.sale-receipt-details {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.sale-receipt-block {
  padding: 14px;
  background: #fff;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .05);
}

.sale-receipt-block h3 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
}

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

.sale-receipt-meta div,
.sale-receipt-row-copy {
  min-width: 0;
}

.sale-receipt-meta small,
.sale-receipt-meta strong,
.sale-receipt-row-copy strong,
.sale-receipt-row-copy small {
  display: block;
}

.sale-receipt-meta small,
.sale-receipt-row-copy small {
  color: var(--muted);
  font-size: 11px;
}

.sale-receipt-meta strong {
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

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

.sale-receipt-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #f1f5f9;
}

.sale-receipt-row:last-child { border-bottom: 0; }
.sale-receipt-row-copy { flex: 1 1 auto; }
.sale-receipt-row-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.sale-receipt-row > strong { flex: 0 0 auto; font-size: 12px; white-space: nowrap; }

.service-order-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.service-order-totals strong {
  color: var(--primary);
}

.sale-invoice-summary-icon,
.sale-invoice-option-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 12px;
  font-size: 20px;
}

.sale-invoice-summary div,
.sale-invoice-option > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.sale-invoice-summary strong,
.sale-invoice-option strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
}

.sale-invoice-summary span,
.sale-invoice-option small {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.sale-invoice-summary > strong {
  color: var(--primary);
  font-size: 16px;
  white-space: nowrap;
}

.sale-invoice-section-heading {
  margin-bottom: 10px;
}

.sale-invoice-section-heading h3 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 850;
}

.sale-invoice-section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.sale-invoice-options {
  display: grid;
  gap: 10px;
}

.sale-invoice-option {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 72px;
  padding: 12px;
  text-align: left;
  background: #fff;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  box-shadow: 0 7px 20px rgba(15, 23, 42, .06);
}

.sale-invoice-option:hover,
.sale-invoice-option:focus-visible {
  border-color: #d8ccfb;
  outline: 0;
  box-shadow: 0 8px 22px rgba(109, 40, 217, .12);
}

.sale-invoice-option:disabled {
  cursor: wait;
  opacity: .62;
}

.sale-invoice-option.is-loading .sale-invoice-option-status {
  color: #1d4ed8;
  background: #dbeafe;
}

.sale-invoice-option-status {
  padding: 5px 7px;
  color: #b45309;
  background: #fef3c7;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.sale-invoice-option.has-document .sale-invoice-option-status {
  color: #166534;
  background: #dcfce7;
}

.sale-invoice-option > i {
  color: #64748b;
  font-size: 14px;
}

.sale-invoice-back {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  margin-top: 18px;
  border-radius: 8px;
}

.sale-error-modal-content {
  border: 0;
  border-radius: 10px;
}

.sale-error-modal-content .modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sale-error-intro {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.sale-error-message {
  max-height: 220px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sale-receipt-export-button {
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
  border-radius: 8px;
  font-weight: 800;
}

.sale-coupon-main {
  width: 100%;
  max-width: 580px !important;
}

.sale-receipt-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.sale-receipt-toolbar .btn {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 8px;
  font-weight: 800;
}

.sale-receipt-toolbar .btn-success {
  color: #fff;
  background: #16a34a;
  border-color: #16a34a;
}

.sale-coupon-paper {
  padding: 20px 16px;
  color: #172033;
  background: #fff;
  border: 1px solid #dfe4ec;
  border-radius: 4px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .09);
}

.sale-coupon-header {
  display: grid;
  justify-items: center;
  gap: 5px;
  text-align: center;
}

.sale-coupon-header img {
  width: min(210px, 70%);
  max-height: 52px;
  object-fit: contain;
  object-position: center;
}

.sale-coupon-header strong {
  margin-top: 6px;
  font-size: 13px;
  letter-spacing: .08em;
}

.sale-coupon-header span {
  color: #64748b;
  font-size: 11px;
}

.sale-coupon-rule {
  margin: 16px 0;
  border-top: 1px dashed #cbd5e1;
}

.sale-coupon-section {
  display: grid;
  gap: 5px;
}

.sale-coupon-label {
  color: #64748b;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .08em;
}

.sale-coupon-section > strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.sale-coupon-section > span:last-child:not(.sale-coupon-label) {
  color: #64748b;
  font-size: 11px;
}

.sale-coupon-lines {
  display: grid;
  gap: 8px;
}

.sale-coupon-line {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.sale-coupon-line:last-child { padding-bottom: 0; border-bottom: 0; }
.sale-coupon-line-copy { display: grid; min-width: 0; gap: 2px; }
.sale-coupon-line-copy strong { overflow-wrap: anywhere; font-size: 12px; }
.sale-coupon-line-copy small { color: #64748b; font-size: 11px; }
.sale-coupon-line > strong { flex: 0 0 auto; font-size: 12px; white-space: nowrap; }

.sale-coupon-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #581c87;
  font-size: 16px;
  font-weight: 900;
}

.sale-coupon-total strong { font-size: 20px; white-space: nowrap; }

.sale-coupon-paper footer {
  margin-top: 20px;
  color: #64748b;
  font-size: 11px;
  text-align: center;
}

@media (max-width: 374px) {
  .sale-receipt-toolbar { grid-template-columns: minmax(0, 1fr); }
}

@media print {
  body.sale-receipt-page { background: #fff !important; }
  .sale-receipt-page .app-topbar,
  .sale-receipt-page .bottom-nav,
  .sale-receipt-page .sale-editor-heading,
  .sale-receipt-page #receipt-feedback,
  .sale-receipt-page .sale-receipt-toolbar { display: none !important; }
  .sale-receipt-page .app-shell,
  .sale-receipt-page .app-main,
  .sale-receipt-page .sale-coupon-main { max-width: none !important; }
  .sale-receipt-page .app-main { padding: 0 !important; }
  .sale-receipt-page .sale-coupon-paper {
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (max-width: 374px) {
  .sale-form-panel { padding: 12px; }
  .sale-form-grid { grid-template-columns: minmax(0, 1fr); }
  .sale-form-grid .sale-field + .sale-field { margin-top: 0; }
  .sale-cart-item { grid-template-columns: 42px minmax(0, 1fr) 96px; }
  .sale-item-controls { width: 96px; grid-template-columns: 28px 36px 28px; }
  .sale-item-quantity { width: 36px; }
  .sale-step { font-size: 11px; }
}

@media (min-width: 768px) {
  .sale-page .app-shell,
  .sale-page .container,
  .sale-page .container-fluid { max-width: 760px; }
  .sale-main { max-width: 760px !important; }
  .sale-form-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Product editor follows the mobile form used by the stock application. */
.product-editor-main {
  width: 100%;
  max-width: 720px !important;
}

.product-editor-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.product-editor-heading > div {
  min-width: 0;
}

.product-editor-heading h2 {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 32px;
  font-weight: 900;
  line-height: 1.1;
}

.product-editor-heading p {
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.product-back-button {
  display: grid;
  width: 48px;
  min-width: 48px;
  height: 48px;
  place-items: center;
  color: #475569;
  background: #f0f2f7;
  border: 0;
  border-radius: 8px;
  font-size: 22px;
}

.product-form-panel {
  padding: 14px;
  margin-bottom: 18px;
  background: #fff;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  box-shadow: 0 9px 26px rgba(15, 23, 42, .06);
}

.product-form-section {
  padding: 4px 0 8px;
  margin-bottom: 18px;
  border-bottom: 1px solid #edf0f5;
}

.product-form-section:last-of-type {
  border-bottom: 0;
}

.product-form-section h3 {
  margin: 2px 0 14px;
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
}

.product-switch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.product-switch-grid .form-check {
  min-width: 0;
  padding: 10px 8px 10px 42px;
  margin: 0;
  background: #fafaff;
  border: 1px solid #edf0f5;
  border-radius: 8px;
}

.product-switch-grid .form-check-input {
  margin-left: -25px;
}

.product-switch-grid .form-check-label {
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

.product-single-switch {
  grid-template-columns: minmax(0, 1fr);
}

.product-single-switch .form-check-label {
  white-space: nowrap;
}

.product-inline-switch {
  display: flex;
  min-height: 28px;
  align-items: center;
  gap: 8px;
  padding: 5px 0 0;
  margin: 0;
}

.product-inline-switch .form-check-input {
  float: none;
  flex: 0 0 auto;
  margin: 0;
}

.product-inline-switch .form-check-label {
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

.required-label::after {
  content: ' *';
  color: #ef4444;
}

.product-field {
  min-width: 0;
  margin-bottom: 13px;
}

.product-field .form-label {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.product-field .form-label span {
  color: #ef4444;
}

.product-image-picker {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 150px;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
  background: #fbfaff;
  border: 1px dashed #c4b5fd;
  border-radius: 8px;
}

.product-image-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.product-image-picker:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(109, 40, 217, .12);
}

.product-image-picker img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: #fff;
}

.product-image-placeholder {
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.product-image-placeholder[hidden] {
  display: none;
}

.product-image-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 4px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 50%;
  font-size: 23px;
}

.product-image-placeholder strong {
  color: var(--primary);
  font-size: 14px;
  font-weight: 850;
}

.product-image-placeholder small {
  font-size: 11px;
}

.product-photo-remove {
  width: 100%;
  margin-top: 8px;
  border-radius: 8px;
}

.product-input {
  display: flex;
  min-width: 0;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid #dce1ea;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .035);
}

.product-input:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(109, 40, 217, .1);
}

.product-input > i {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 19px;
}

.product-input .form-control,
.product-input .form-select {
  min-width: 0;
  min-height: 46px;
  padding: 8px 0;
  color: var(--text);
  background-color: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 13px;
}

.product-input .form-control::placeholder {
  color: #94a3b8;
}

.product-input .form-select {
  padding-right: 28px;
}

.product-input-action {
  padding-right: 4px;
}

.product-input-action .btn {
  display: grid;
  width: 40px;
  min-width: 40px;
  height: 40px;
  place-items: center;
  color: #64748b;
  border: 0;
}

.product-money-input > span {
  flex: 0 0 auto;
  color: #475569;
  font-size: 14px;
  font-weight: 850;
}

.product-form-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.product-thumbnail-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.product-textarea-input {
  position: relative;
  align-items: flex-start;
  padding-top: 5px;
  padding-bottom: 19px;
}

.product-textarea-input > i {
  margin-top: 9px;
}

.product-textarea-input textarea.form-control {
  min-height: 76px;
  resize: vertical;
}

.product-textarea-input small {
  position: absolute;
  right: 10px;
  bottom: 5px;
  color: var(--muted);
  font-size: 10px;
}

.product-form-feedback {
  display: none;
  padding: 10px 12px;
  margin: 2px 0 10px;
  color: #854d0e;
  background: #fef9c3;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
}

.product-form-feedback:not(:empty) {
  display: block;
}

.product-form-feedback-danger {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.product-save-button {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: var(--primary);
  border-color: var(--primary);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .2);
}

@media (max-width: 374px) {
  .product-editor-heading {
    gap: 10px;
  }

  .product-editor-heading h2 {
    font-size: 26px;
  }

  .product-editor-heading p {
    font-size: 12px;
  }

  .product-back-button {
    width: 43px;
    min-width: 43px;
    height: 43px;
  }

  .product-form-panel {
    padding: 11px;
  }

  .product-image-picker {
    min-height: 128px;
  }

  .product-form-grid {
    gap: 7px;
  }

  .product-switch-grid {
    grid-template-columns: 1fr;
  }

  .product-form-grid .product-field .form-label {
    min-height: 32px;
    margin-bottom: 4px;
    line-height: 1.25;
  }
}

/* Responsive guardrails shared by every frontend screen. */
html,
body {
  overflow-x: hidden;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

.app-shell,
.app-topbar .container-fluid,
.app-main,
.screen-head,
.dashboard-head,
.record-card-open,
.sale-editor-heading,
.product-editor-heading,
.account-status-row {
  min-width: 0;
}

.screen-head > div,
.dashboard-head > div,
.app-topbar .flex-grow-1,
.record-content,
.record-body,
.module-record-main,
.sale-editor-heading > div,
.product-editor-heading > div,
.account-heading > div {
  min-width: 0;
}

.record-action-panel {
  max-width: calc(100vw - 24px);
}

@media screen and (max-width: 575.98px) {
  .app-topbar {
    min-height: 56px;
    padding-top: calc(8px + env(safe-area-inset-top));
  }

  .app-topbar .container-fluid {
    gap: 8px !important;
  }

  .app-main {
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }

  .module-page .module-topbar {
    min-height: 62px;
    padding-top: calc(8px + env(safe-area-inset-top));
  }

  .module-page .app-main {
    padding-top: 8px;
  }

  .module-page .screen-head {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
  }

  .module-page .screen-head > div {
    flex: 1 1 0;
  }

  .module-page .screen-head h2 {
    font-size: 28px;
    line-height: 1.12;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .module-page .screen-head p {
    max-width: 100%;
    font-size: 13px;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .module-page .module-add-button {
    min-width: 78px;
    height: 44px;
    min-height: 44px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .module-page .module-search {
    gap: 7px;
  }

  .module-page .module-search .input-group {
    flex: 1 1 0;
  }

  .module-page .module-search .form-control,
  .module-page .module-filter-panel .form-control,
  .module-page .module-filter-panel .form-select,
  .module-page .editor-section .form-control,
  .module-page .editor-section .form-select {
    font-size: 16px;
  }

  .module-page .record-card-open {
    align-items: flex-start;
    padding: 10px 44px 10px 10px;
  }

  .module-page .record-card h3,
  .module-page .module-record-main h3 {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .module-page .module-record-line,
  .module-page .sale-client {
    display: -webkit-box;
    line-height: 1.35;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .module-page .record-card-pessoas .module-record-line {
    display: flex;
    align-items: center;
    white-space: nowrap;
  }

  .module-page .record-card-pessoas .module-record-line .module-line-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .module-page .module-record-side {
    max-width: 32%;
  }

  .module-page .record-badge {
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .module-page .person-relation-options {
    gap: 7px;
  }

  .module-page .person-info-launch {
    grid-template-columns: 36px minmax(0, 1fr) 18px;
    gap: 8px;
    padding-right: 9px;
    padding-left: 9px;
  }

  .module-page .person-info-icon {
    width: 34px;
    height: 34px;
  }

  .account-editor-main {
    padding-bottom: calc(108px + env(safe-area-inset-bottom));
  }

  .account-form-panel > .col-6,
  .account-form-panel .row > .col-6 {
    width: 100%;
  }

  .account-status-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .account-status-switch {
    margin-left: auto;
  }

  .product-editor-heading,
  .sale-editor-heading {
    align-items: flex-start;
    gap: 10px;
  }

  .product-editor-heading h2,
  .sale-editor-heading h2 {
    font-size: 28px;
    line-height: 1.12;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .product-editor-heading p,
  .sale-editor-heading p {
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .product-form-panel,
  .sale-form-panel {
    padding: 12px;
  }

  .product-image-picker {
    min-height: 142px;
  }

  .product-switch-grid {
    grid-template-columns: 1fr;
  }

  .sale-stepper {
    gap: 3px;
  }

  .sale-step {
    gap: 4px;
    padding-right: 3px;
    padding-left: 3px;
    font-size: 11px;
  }

  .sale-invoice-summary {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .sale-invoice-summary > strong:last-child {
    grid-column: 2;
    justify-self: end;
  }

  .sale-receipt-meta {
    grid-template-columns: minmax(0, 1fr);
  }

  .sale-receipt-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sale-coupon-paper {
    padding: 16px 12px;
  }

  .more-menu-backdrop {
    padding: 10px;
  }

  .more-menu {
    max-width: none;
    border-radius: 14px;
  }
}

@media screen and (max-width: 399.98px) {
  .module-page .app-topbar .container-fluid,
  .module-page .app-main.container {
    padding-right: 12px !important;
    padding-left: 12px !important;
  }

  .module-page .screen-head h2 {
    font-size: 26px;
  }

  .module-page .module-add-button {
    min-width: 72px;
    padding-right: 9px;
    padding-left: 9px;
  }

  .module-page .record-card-open {
    gap: 8px;
    padding-right: 42px;
    padding-left: 8px;
  }

  .module-page .person-avatar,
  .module-page .sale-avatar {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .product-thumbnail,
  .sale-item-thumbnail {
    width: 46px;
    flex-basis: 46px;
  }

  .product-form-grid,
  .sale-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sale-form-grid .sale-field + .sale-field {
    margin-top: 0;
  }

  .sale-step-actions,
  .sale-receipt-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .sale-cart-item {
    grid-template-columns: 42px minmax(0, 1fr) 88px;
    gap: 7px;
    padding: 9px 7px;
  }

  .sale-item-controls {
    width: 88px;
    grid-template-columns: 27px 30px 27px;
  }

  .sale-item-quantity {
    width: 30px;
  }

  .account-form-panel .row > .col-6 {
    width: 100%;
  }

  .account-status-switch {
    width: 100%;
    margin-left: 0;
  }
}

@media screen and (min-width: 576px) {
  .module-page .record-card-open {
    padding-right: 48px;
  }

  .module-page .record-card h3,
  .module-page .module-record-main h3 {
    white-space: nowrap;
  }

  .sale-receipt-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.offline-banner {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  color: #9a3412;
  background: #fff7ed;
  border-bottom: 1px solid #fed7aa;
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.offline-banner i {
  flex: 0 0 auto;
  font-size: 17px;
}

.offline-notice-backdrop {
  position: fixed;
  z-index: 2000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .46);
  backdrop-filter: blur(2px);
}

.offline-notice {
  width: min(100%, 360px);
  padding: 28px 24px 22px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .24);
  text-align: center;
}

.offline-notice-icon {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  place-items: center;
  border-radius: 50%;
  color: #b45309;
  background: #ffedd5;
  font-size: 30px;
}

.offline-notice h2 {
  margin: 0 0 8px;
  color: #172033;
  font-size: 22px;
  font-weight: 850;
}

.offline-notice p {
  margin: 0 0 20px;
  color: #64748b;
  font-size: 14px;
  line-height: 1.5;
}

.offline-notice-close {
  width: 100%;
  min-height: 46px;
  border-radius: 8px;
  font-weight: 800;
}
