/* Cabeçalhos de modal: padrão verde esmeralda idêntico ao Flutter. */
.stock-modal-header,
.sale-detail-web > header,
.category-manager-header,
.customer-form-head {
  border-bottom: 1px solid rgba(15, 41, 24, .12);
  background: linear-gradient(135deg, #1b632c 0%, #299140 100%);
  color: #ffffff;
}

.modal-box:has(#product-editor) #modal-body > h2 {
  border-bottom-color: rgba(15, 41, 24, .12);
  background: linear-gradient(135deg, #1b632c 0%, #299140 100%);
  color: #ffffff;
}

.modal-box:has(#product-editor) #modal-body > h2::before {
  background: rgba(255, 255, 255, .25);
}

.modal-box:has(#product-editor) > .modal-close {
  border-color: rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .2);
  color: #ffffff;
}

.modal-box:has(#product-editor) > .modal-close:hover {
  background: rgba(255, 255, 255, .35);
  color: #ffffff;
}

.product-modal-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 72px 14px 18px;
  border-bottom: 1px solid rgba(15, 41, 24, .14);
  border-radius: 17px 17px 0 0;
  background: linear-gradient(135deg, #1b632c 0%, #299140 100%);
  color: #ffffff;
}

.product-modal-header > span {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(255, 255, 255, .2);
  color: #ffffff;
  font-size: 22px;
  font-weight: 950;
}

.product-modal-header small {
  display: block;
  color: rgba(255, 255, 255, .82);
  font-size: 9px;
  font-weight: 950;
  letter-spacing: .13em;
}

.product-modal-header h2 {
  margin: 2px 0 1px;
  color: #ffffff;
  font-size: 20px;
  line-height: 1.15;
}

.product-modal-header p {
  margin: 0;
  color: rgba(255, 255, 255, .82);
  font-size: 11px;
  font-weight: 650;
}

.category-editor-layer { position:absolute; inset:0; z-index:12; display:grid; place-items:center; padding:22px; border-radius:inherit; background:rgba(15,23,42,.58); backdrop-filter:blur(2px); }
.category-editor-dialog { width:min(570px,100%); overflow:hidden; border:1px solid rgba(15,41,24,.14); border-radius:18px; background:#fff; box-shadow:0 24px 70px rgba(0,0,0,.3); }
.category-editor-dialog > header { position:relative; padding:16px 62px 14px 22px; border-bottom:1px solid rgba(15,41,24,.14); background:linear-gradient(135deg, #1b632c 0%, #299140 100%); color:#ffffff; }
.category-editor-dialog header small { font-size:9px; font-weight:950; letter-spacing:.13em; color:rgba(255,255,255,.82); }
.category-editor-dialog header h2 { margin:2px 0; color:#ffffff; font-size:21px; }
.category-editor-dialog header p { margin:0; color:rgba(255,255,255,.82); font-size:11px; font-weight:650; }
.category-editor-dialog form { padding:18px 22px 22px; }
.category-editor-dialog input { width:100%; }
.category-editor-close { position:absolute; top:14px; right:16px; width:34px; height:34px; display:grid; place-items:center; padding:0; border:1px solid rgba(255,255,255,.28); border-radius:50%; background:rgba(255,255,255,.2); color:#ffffff; font-size:23px; cursor:pointer; }

.modal-box:has(.pending-sales-web) { width:min(680px,100%); padding:0; overflow:hidden; }
.pending-sales-web { display:block; }
.pending-sales-web > small { display:block; margin:0; padding:17px 64px 0 26px; background:linear-gradient(135deg, #1b632c 0%, #299140 100%); color:rgba(255,255,255,.82); font-size:9px; font-weight:950; letter-spacing:.13em; }
.pending-sales-web > h2 { margin:0; padding:3px 64px 16px 26px; border-bottom:1px solid rgba(15,41,24,.14); background:linear-gradient(135deg, #1b632c 0%, #299140 100%); color:#ffffff; font-size:22px; }
.pending-sales-web > p { margin:0; padding:20px 26px 16px; color:#526078; font-size:14px; }
.pending-sales-web > div { margin:0; padding:0 26px 18px; background:#fff; }
.pending-sales-web > div:empty { display:none; }
.pending-sales-web > footer { display:flex; grid-template-columns:none; align-items:center; justify-content:flex-end; gap:9px; margin:0; padding:14px 26px 20px; border-top:1px solid var(--line); background:#fff; color:#0F172A; }
.pending-sales-web > footer .button { min-height:40px; padding:0 18px; }

/* Finalização do PDV: cabeçalho verde esmeralda no padrão do Painel com altura estável. */
.modal-box:has(.checkout-form) {
  display: flex;
  flex-direction: column;
  width: min(880px, calc(100vw - 36px)); 36px));
  height: min(640px, calc(100dvh - 36px));
  min-height: min(640px, calc(100dvh - 36px));
  max-height: calc(100dvh - 36px);
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 18px;
  background: #fff;
}

.modal-box:has(.checkout-form) > .modal-close {
  top: 15px;
  right: 17px;
  z-index: 4;
  border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .2);
  color: #ffffff;
}

.modal-box:has(.checkout-form) .checkout-head {
  flex: 0 0 auto;
  min-height: 84px;
  margin: 0;
  padding: 17px 76px 15px 26px;
  border-bottom: 1px solid rgba(15, 41, 24, .14);
  background: linear-gradient(135deg, #1b632c 0%, #299140 100%);
  color: #ffffff;
}

.modal-box:has(.checkout-form) .checkout-head span,
.modal-box:has(.checkout-form) .checkout-head h2,
.modal-box:has(.checkout-form) .checkout-head > strong {
  color: #ffffff;
}

.modal-box:has(.checkout-form) .checkout-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 26px 24px;
  background: #fff;
  overflow: visible;
}

.modal-box:has(.checkout-form) .optional-customer {
  position: relative;
  z-index: 50;
}

.modal-box:has(.checkout-form) .customer-combobox {
  position: relative;
  z-index: 60;
}

.modal-box:has(.checkout-form) .customer-options {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: 280px;
  z-index: 9999;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 18px 50px rgba(15, 41, 24, .18);
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.modal-box:has(.checkout-form) .checkout-form > .form-actions {
  position: static;
  z-index: 1;
  margin-top: auto;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
  background: transparent;
  box-shadow: none;
}

/* Confirmação da venda no padrão verde esmeralda. */
.modal-box:has(.sale-success) {
  width: min(640px, calc(100vw - 36px));
  padding: 0;
  overflow: hidden;
}

.modal-box:has(.sale-success) > .modal-close {
  top: 15px;
  right: 17px;
  z-index: 4;
  border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .2);
  color: #ffffff;
}

.modal-box:has(.sale-success) .sale-success {
  position: relative;
  isolation: isolate;
  padding: 16px 0 0;
  background: #fff;
}

.modal-box:has(.sale-success) .sale-success::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0 0 auto;
  height: 188px;
  border-bottom: 1px solid rgba(15, 41, 24, .12);
  background: linear-gradient(135deg, #1b632c 0%, #299140 100%);
}

.modal-box:has(.sale-success) .sale-success > * {
  position: relative;
  z-index: 1;
}

.modal-box:has(.sale-success) .sale-success-icon {
  width: 52px;
  height: 52px;
  margin-bottom: 6px;
  background: #ffffff;
  color: #299140;
  font-size: 28px;
  box-shadow: 0 8px 22px rgba(15, 41, 24, .18);
}

.modal-box:has(.sale-success) .sale-success > small,
.modal-box:has(.sale-success) .sale-success h2,
.modal-box:has(.sale-success) .sale-success > strong {
  color: #ffffff;
}

.modal-box:has(.sale-success) .sale-success h2 {
  margin-top: 3px !important;
  font-size: 22px;
}

.modal-box:has(.sale-success) .sale-success > strong {
  margin: 3px 0 10px;
  font-size: 28px;
}

.modal-box:has(.sale-success) .sale-success-details {
  margin: 14px 26px 0;
  border: 1px solid #e6eaf0;
  background: #f4f6f9;
}

.modal-box:has(.sale-success) .sale-success > p {
  margin: 0;
  padding: 14px 26px 10px;
  background: #fff;
}

.modal-box:has(.sale-success) .sale-success-actions {
  margin: 0;
  padding: 8px 26px 24px;
  background: #fff;
}

/* Detalhes da venda: cabeçalho e rodapé fixos; somente os itens rolam. */
.modal-box:has(.sale-detail-web) {
  height: min(760px, calc(100dvh - 40px));
  max-height: none;
  overflow: hidden;
}

.modal-box:has(.sale-detail-web) #modal-body {
  height: 100%;
  min-height: 0;
}

.sale-detail-web {
  height: 100%;
  min-height: 0;
  max-height: none;
  overflow: hidden;
}

.sale-detail-items {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.sale-detail-items.is-loading {
  display: grid;
  place-items: center;
}

.sale-items-loading {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 18px 21px;
  border: 1px solid #dce3ed;
  border-radius: 13px;
  background: #f7f9fc;
  color: var(--navy);
  box-shadow: 0 5px 16px rgba(8, 38, 95, .045);
}

.sale-items-loading .spinner {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  margin: 0;
  border-width: 3px;
}

.sale-items-loading b,
.sale-items-loading small,
.sale-items-error b,
.sale-items-error small { display: block; }
.sale-items-loading small,
.sale-items-error small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.sale-items-error { margin: auto; padding: 18px; color: var(--navy); text-align: center; }

.sale-origin-tag { display:inline-flex; align-items:center; width:max-content; margin-top:5px; padding:3px 7px; border:1px solid #ccd8ea; border-radius:99px; background:#edf3fb; color:#245997; font-size:8px; font-weight:900; line-height:1.2; white-space:nowrap; }
.sale-origin-tag.mobile { border-color:#c8e8d8; background:#e8f7ef; color:#087847; }
.sale-origin-tag.web { border-color:#cbd9ee; background:#edf3fb; color:#245997; }
.sale-origin-tag.unknown { border-color:#dde1e7; background:#f3f5f8; color:#68758c; }
.sale-detail-badges { display:grid; justify-items:end; gap:5px; flex:0 0 auto; }
.sale-detail-badges .sale-origin-tag { margin-top:0; }

.sale-detail-web > footer {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  margin: 0;
  box-shadow: 0 -7px 18px rgba(8, 38, 95, .06);
}

@media (max-height: 680px) {
  .modal-box:has(.sale-detail-web) { height: calc(100dvh - 20px); }
  .sale-detail-web > header { padding-top: 15px; padding-bottom: 14px; }
  .sale-detail-summary { padding-top: 11px; padding-bottom: 11px; }
}

.modal-box:has(#business-settings-form) {
  padding: 0;
  overflow: auto;
}

.business-settings-head {
  padding: 18px 68px 16px 24px;
  border-bottom: 1px solid rgba(15, 41, 24, .12);
  background: linear-gradient(135deg, #1b632c 0%, #299140 100%);
  color: #ffffff;
}

.business-settings-head h2 {
  color: #ffffff;
}

.business-settings-head p {
  margin-bottom: 0;
  color: rgba(255, 255, 255, .82);
  font-weight: 650;
}

.modal-box:has(#business-settings-form) .business-settings-form {
  padding: 16px 24px 24px;
}

.modal-box:has(#storefront-settings-form) {
  padding: 0;
}

.modal-box:has(#storefront-settings-form) > #modal-body > h2 {
  margin: 0;
  padding: 17px 64px 3px 22px;
  background: linear-gradient(135deg, #1b632c 0%, #299140 100%);
  color: #ffffff;
}

.modal-box:has(#storefront-settings-form) > #modal-body > p {
  margin: 0;
  padding: 0 64px 15px 22px;
  border-bottom: 1px solid rgba(15, 41, 24, .12);
  background: linear-gradient(135deg, #1b632c 0%, #299140 100%);
  color: rgba(255, 255, 255, .82);
  font-weight: 650;
}

.modal-box:has(#storefront-settings-form) #storefront-settings-form {
  padding: 14px 22px 20px;
}

.modal-box:has(#profile-settings-form) {
  padding: 0;
}

.modal-box:has(#profile-settings-form) > #modal-body > h2 {
  margin: 0;
  padding: 18px 64px 16px 22px;
  border-bottom: 1px solid rgba(15, 41, 24, .12);
  border-radius: 18px 18px 0 0;
  background: linear-gradient(135deg, #1b632c 0%, #299140 100%);
  color: #ffffff;
}

.modal-box:has(#profile-settings-form) #profile-settings-form {
  padding: 14px 22px 20px;
}

.modal-box:has(#printer-settings-form) {
  padding: 0;
}

.modal-box:has(#printer-settings-form) > #modal-body > h2 {
  margin: 0;
  padding: 18px 64px 3px 26px;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(135deg, #1b632c 0%, #299140 100%);
  color: #ffffff;
}

.modal-box:has(#printer-settings-form) > #modal-body > p {
  margin: 0;
  padding: 0 64px 16px 26px;
  border-bottom: 1px solid rgba(15, 41, 24, .12);
  background: linear-gradient(135deg, #1b632c 0%, #299140 100%);
  color: rgba(255, 255, 255, .82);
  font-weight: 650;
}

.modal-box:has(#printer-settings-form) #printer-settings-form {
  padding: 14px 26px 26px;
}

.stock-modal-header small,
.sale-detail-web > header small,
.category-manager-header small,
.customer-form-head small {
  color: rgba(255, 255, 255, .82);
}

.stock-modal-header h2,
.sale-detail-web > header h2,
.category-manager-header h2,
.customer-form-head h2 {
  color: #ffffff;
}

.stock-modal-header p,
.sale-detail-web > header p,
.category-manager-header p,
.customer-form-head p {
  color: rgba(255, 255, 255, .82);
  font-weight: 650;
}

.stock-modal-header .stock-modal-icon,
.category-manager-header > span {
  border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .2);
  color: #fff;
  box-shadow: 0 6px 14px rgba(15, 41, 24, .16);
}

.category-manager-header .button {
  background: rgba(255, 255, 255, .2);
  border: 1px solid rgba(255, 255, 255, .3);
  color: #fff;
}
.category-manager-header .button:hover {
  background: rgba(255, 255, 255, .3);
}

.sale-detail-web > header .badge {
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .2);
  color: #fff;
}

.sale-detail-web > header .badge.red {
  border-color: #e9aaa5;
  background: #fff0ef;
  color: #b3261e;
}

.customer-form-head .customer-deactivate {
  border-color: rgba(255, 255, 255, .24);
  color: #fff;
}

/* Diálogos de confirmação e exclusão (appConfirm / app-dialog) */
.app-dialog-layer {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .48);
  backdrop-filter: blur(4px);
}

.app-dialog {
  width: min(450px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  background: #ffffff !important;
  color: #0F172A;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .22);
  animation: appDialogIn .2s ease;
}

.app-dialog.danger {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  column-gap: 16px;
  border: 1px solid #fecaca;
  background: #ffffff !important;
}

.app-dialog-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 14px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #b45309;
  font-size: 22px;
  font-weight: 950;
}

.app-dialog-icon.danger {
  margin: 0;
  width: 48px;
  height: 48px;
  border: 1px solid #fecaca !important;
  border-radius: 14px;
  background: #fef2f2 !important;
  color: #dc2626 !important;
  font-size: 24px;
}

.app-dialog small {
  display: block;
  color: #299140;
  font-size: 9px;
  font-weight: 950;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.app-dialog.danger small {
  color: #dc2626;
}

.app-dialog h2 {
  margin: 2px 0 8px;
  color: #0F172A;
  font-size: 21px;
  font-weight: 850;
  line-height: 1.25;
}

.app-dialog p {
  margin: 0;
  color: #59677e;
  font-size: 14px;
  line-height: 1.5;
}

.app-dialog.danger p {
  padding: 11px 14px;
  border: 1px solid #fee2e2;
  border-radius: 11px;
  background: #fff8f8;
  color: #475569;
  font-size: 13px;
  line-height: 1.45;
}

.app-dialog footer,
.app-dialog.danger footer {
  grid-column: 1 / -1;
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  margin: 20px 0 0 !important;
  padding: 16px 0 0 !important;
  border: 0 !important;
  border-top: 1px solid #f1f5f9 !important;
  background: transparent !important;
  color: inherit !important;
  box-shadow: none !important;
}

.app-dialog.danger footer {
  border-top: 1px solid #fee2e2 !important;
}

.app-dialog footer button {
  min-height: 42px;
  min-width: 105px;
  padding: 0 18px;
  border: 1px solid #d1d5db;
  border-radius: 11px;
  background: #ffffff;
  color: #374151;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all .15s ease;
}

.app-dialog footer button:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.app-dialog footer button.primary {
  border-color: #299140;
  background: #299140;
  color: #ffffff;
  font-weight: 900;
}

.app-dialog footer button.primary:hover {
  background: #237b36;
  border-color: #237b36;
}

.app-dialog footer button.primary.danger {
  border-color: #dc2626 !important;
  background: #dc2626 !important;
  color: #ffffff !important;
  font-weight: 900;
  box-shadow: 0 4px 14px rgba(220, 38, 38, .28) !important;
}

.app-dialog footer button.primary.danger:hover {
  background: #b91c1c !important;
  border-color: #b91c1c !important;
}

@media (max-width: 520px) {
  .app-dialog, .app-dialog.danger {
    padding: 18px;
    border-radius: 18px;
  }
  .app-dialog.danger {
    grid-template-columns: 44px minmax(0, 1fr);
    column-gap: 12px;
  }
  .app-dialog.danger .app-dialog-icon {
    width: 44px;
    height: 44px;
  }
  .app-dialog footer,
  .app-dialog.danger footer {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  .app-dialog footer button {
    min-width: 0;
    width: 100%;
  }
}

.app-dialog-icon.cash,
.app-dialog-icon.success {
  background: #e9f8f1 !important;
  border: 1px solid #c2e7b8 !important;
  color: #1b632c !important;
}

/* Reset universal para evitar vazamento do footer institucional (#101d39) em modais */
.modal-box footer,
.modal footer,
.financial-offline-block footer {
  background: transparent !important;
  color: inherit !important;
  padding: 16px 0 0 !important;
  margin: 18px 0 0 !important;
  border: 0 !important;
  border-top: 1px solid var(--line, #e5e9f0) !important;
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  box-shadow: none !important;
}

.modal-box footer .button,
.modal footer .button,
.financial-offline-block footer .button {
  min-height: 42px !important;
  padding: 0 18px !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  border-radius: 11px !important;
}

.modal-box footer .button.outline,
.modal footer .button.outline,
.financial-offline-block footer .button.outline {
  background: #ffffff !important;
  border: 1px solid #d1d5db !important;
  color: #374151 !important;
}

.modal-box footer .button.outline:hover,
.modal footer .button.outline:hover,
.financial-offline-block footer .button.outline:hover {
  background: #f9fafb !important;
  border-color: #9ca3af !important;
}

.modal-box footer .button.dark,
.modal footer .button.dark,
.financial-offline-block footer .button.dark {
  background: #299140 !important;
  border: 1px solid #299140 !important;
  color: #ffffff !important;
  font-weight: 900 !important;
  box-shadow: 0 3px 10px rgba(41, 145, 64, .25) !important;
}

.modal-box footer .button.dark:hover,
.modal footer .button.dark:hover,
.financial-offline-block footer .button.dark:hover {
  background: #237b36 !important;
  border-color: #237b36 !important;
}

/* Padronização visual do bloco de aviso / offline com a paleta do app */
.financial-offline-block {
  text-align: center;
  padding: 8px 4px;
}

.financial-offline-block > span {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: #e9f8f1 !important;
  border: 1px solid #c2e7b8 !important;
  color: #1b632c !important;
  font-size: 26px;
  font-weight: 950;
}

.financial-offline-block > small {
  display: block;
  color: #299140 !important;
  font-size: 10px !important;
  font-weight: 950 !important;
  letter-spacing: .14em !important;
  text-transform: uppercase;
}

.financial-offline-block > h2 {
  margin: 6px 0 10px !important;
  color: #0f172a !important;
  font-size: 22px !important;
  font-weight: 850 !important;
}

.financial-offline-block > p {
  max-width: 440px;
  margin: 0 auto 16px;
  color: #59677e !important;
  font-size: 14px;
  line-height: 1.55;
}

.financial-offline-block > div {
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid #c2e7b8 !important;
  border-radius: 12px;
  background: #f6fbf7 !important;
  text-align: left;
}

.financial-offline-block > div b {
  color: #1b632c;
  font-size: 13px;
}

.financial-offline-block > div small {
  margin-top: 4px;
  color: #59677e;
  font-size: 12px;
}


