/* Shared visual shell for registration screens; field order and form behavior remain unchanged. */
:root {
  --erp-icon-document: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 3h7l4 4v14H7a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Z'/%3E%3Cpath d='M14 3v5h5M9 13h6M9 17h6'/%3E%3C/svg%3E");
  --erp-icon-user: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21v-2a8 8 0 0 1 16 0v2'/%3E%3C/svg%3E");
  --erp-icon-cart: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='20' r='1'/%3E%3Ccircle cx='19' cy='20' r='1'/%3E%3Cpath d='M2 3h2l2.2 11h13.1l2-8H5'/%3E%3C/svg%3E");
  --erp-icon-store: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9 5 3h14l2 6v2a3 3 0 0 1-5 2 3 3 0 0 1-4 0 3 3 0 0 1-4 0 3 3 0 0 1-5-2V9ZM5 14v7h14v-7M9 21v-6h6v6'/%3E%3C/svg%3E");
  --erp-icon-package: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12 2 9 5-9 5-9-5 9-5ZM3 7v10l9 5 9-5V7M12 12v10'/%3E%3C/svg%3E");
  --erp-icon-tools: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.7 6.3a5 5 0 0 0-6.4 6.4L3 18l3 3 5.3-5.3a5 5 0 0 0 6.4-6.4L14 13l-3-3 3.7-3.7Z'/%3E%3C/svg%3E");
  --erp-icon-transfer: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16l-4-4M20 17H4l4 4M20 7l-4 4M4 17l4-4'/%3E%3C/svg%3E");
  --erp-icon-wallet: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h16a2 2 0 0 1 2 2v12H5a2 2 0 0 1-2-2V6Zm0 0a2 2 0 0 1 2-2h13M16 13h5v4h-5a2 2 0 0 1 0-4Z'/%3E%3C/svg%3E");
}
.modal.erp-registration-modal {
  background: #f3f7fa;
  border-radius: 14px;
  width: min(960px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.erp-registration-modal > .modal-head {
  flex: none;
  min-height: 68px;
  padding: 12px 20px;
  background: linear-gradient(120deg, #082b4b, #123f67);
  color: #fff;
  gap: 12px;
}
.erp-registration-modal > .modal-head::before {
  content: '';
  display: block;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #078fa2 var(--erp-registration-icon, var(--erp-icon-document)) center / 23px 23px no-repeat;
}
.modal.erp-registration-modal > .modal-head h2 {
  color: #fff !important;
  font-size: 21px;
  line-height: 1.2;
  margin: 0;
}
.erp-registration-modal > .modal-head .eyebrow,
.erp-registration-modal > .modal-head small { color: #22d0d1 !important; }
.erp-registration-modal > .modal-head .modal-close { color: #fff !important; margin-left: auto; }
.erp-registration-modal.customer-modal,
.erp-registration-modal:has(#user-form),
.erp-registration-modal:has(#seller-form),
.erp-registration-modal:has(#deliverer-form),
.erp-registration-modal:has(#optics-doctor-form) { --erp-registration-icon: var(--erp-icon-user); }
.erp-registration-modal:has(#presale-form),
.erp-registration-modal:has(#sales-plan-form) { --erp-registration-icon: var(--erp-icon-cart); }
.erp-registration-modal:has(#store-form) { --erp-registration-icon: var(--erp-icon-store); }
.erp-registration-modal.entry-modal,
.erp-registration-modal:has(#supplier-form) { --erp-registration-icon: var(--erp-icon-package); }
.erp-registration-modal:has(#service-order-form),
.erp-registration-modal:has(#optics-form) { --erp-registration-icon: var(--erp-icon-tools); }
.erp-registration-modal:has(#transfer-form) { --erp-registration-icon: var(--erp-icon-transfer); }
.erp-registration-modal:has(#payable-create-form),
.erp-registration-modal:has(#cash-income-form),
.erp-registration-modal:has(#cash-expense-form),
.erp-registration-modal:has(#price-form) { --erp-registration-icon: var(--erp-icon-wallet); }
.erp-registration-modal > .modal-body {
  min-height: 0;
  overflow: auto;
  padding: 14px;
  background: #f3f7fa;
}
.erp-registration-modal > .modal-body > form {
  padding: 16px 18px;
  border: 1px solid #d9e6ef;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 14px #082b4b0a;
}
.erp-registration-modal .field { gap: 4px; }
.erp-registration-modal .field > span { color: #173b59; font-size: 11px; }
.erp-registration-modal .field > input:not([type=checkbox]),
.erp-registration-modal .field > select,
.erp-registration-modal .field > textarea { min-height: 34px; padding: 6px 9px; font-size: 12px; }
.erp-registration-modal .field.presale-customer-field > input { padding-left: 38px; }
.erp-registration-modal .field.presale-product-field > input { padding-left: 40px; }
.erp-registration-modal .form-actions { border-top-color: #d9e6ef; }
.erp-registration-modal .form-actions .primary { background: #078f99; }
.erp-registration-modal .form-actions .primary:hover { background: #06747c; }
.erp-registration-modal .form-actions button { min-height: 34px; padding: 7px 12px; font-size: 12px; }
/* Customer has a tabbed, internally scrollable form; keep its own scroll behavior. */
.modal.erp-registration-modal.customer-modal { width: min(680px, calc(100vw - 24px)); }
.erp-registration-modal.customer-modal > .customer-form {
  margin: 10px;
  padding: 0 14px 10px;
  border: 1px solid #d9e6ef;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 14px #082b4b0a;
}
.erp-registration-modal.customer-modal .required-fields-note { margin: 7px 0 2px; }
.erp-registration-modal.customer-modal .customer-tabs button { padding: 8px 9px; font-size: 11px; }
.erp-registration-modal.customer-modal .customer-content { padding: 10px 1px 4px; }
.erp-registration-modal.customer-modal .customer-grid { gap: 0 10px; }
.erp-registration-modal.customer-modal .customer-grid .field { margin-bottom: 7px; }
.erp-registration-modal.customer-modal .customer-lookup { gap: 7px; margin-bottom: 9px; }
.erp-registration-modal.customer-modal .customer-lookup button { min-height: 32px; padding: 5px 9px; font-size: 11px; }
.erp-registration-modal.customer-modal .customer-form .form-actions { padding-top: 8px; }
.erp-registration-modal.customer-modal .customer-grid .field > input,
.erp-registration-modal.customer-modal .customer-grid .field > select,
.erp-registration-modal.customer-modal .customer-grid .field > textarea { width: 100%; }
.erp-registration-modal.customer-modal .customer-grid .field:has([name="name"]) input,
.erp-registration-modal.customer-modal .customer-grid .field:has([name="address"]) input { max-width: 55ch; }
.erp-registration-modal.customer-modal .customer-grid .field:has([name="reference"]) input { max-width: 65ch; }
.erp-registration-modal.customer-modal .customer-grid .field:has([name="personType"]) select,
.erp-registration-modal.customer-modal .customer-grid .field:has([name="sex"]) select,
.erp-registration-modal.customer-modal .customer-grid .field:has([name="maritalStatus"]) select,
.erp-registration-modal.customer-modal .customer-grid .field:has([name="employed"]) select { max-width: 22ch; }
.erp-registration-modal.customer-modal .customer-grid .field:has([name="state"]) input { max-width: 10ch; }
.erp-registration-modal.customer-modal .customer-grid .field:has([name="addressNumber"]) input,
.erp-registration-modal.customer-modal .customer-grid .field:has([name="postalCode"]) input,
.erp-registration-modal.customer-modal .customer-grid .field:has([name="registrationAgency"]) input { max-width: 16ch; }
.erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0 8px;
}
.erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid > .field { min-width: 0; grid-column: span 4; }
.erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid > .field:has([name="name"]),
.erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid > .field:has([name="email"]),
.erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid > .field:has([name="address"]),
.erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid > .field:has([name="reference"]),
.erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid > .field:has([name="city"]) { grid-column: span 8; }
.erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid > .field:has([name="nickname"]) { grid-column: span 6; }
.erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid > .field:has([name="birthDate"]),
.erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid > .field:has([name="sex"]) { grid-column: span 3; }
.erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid > .field:has([name="state"]),
.erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid > .field:has([name="postalCode"]) { grid-column: span 2; }
.erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid .field > input,
.erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid .field > select { max-width: none; }
/* Store registration: compact field widths without changing field order or submission. */
.erp-registration-modal:has(#store-form) { width: min(760px, calc(100vw - 24px)); }
#store-form .customer-lookup { gap: 8px; margin-bottom: 10px; }
#store-form .customer-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0 8px; }
#store-form .customer-grid > .field { min-width: 0; grid-column: span 4; margin-bottom: 7px; }
#store-form .customer-grid > .field > input { width: 100%; }
#store-form .customer-grid > .field:has([readonly]),
#store-form .customer-grid > .field:has([name="type"]),
#store-form .customer-grid > .field:has([name="state"]),
#store-form .customer-grid > .field:has([name="addressNumber"]),
#store-form .customer-grid > .field:has([name="postalCode"]),
#store-form .customer-grid > .field:has([name="cityIbgeId"]) { grid-column: span 2; }
#store-form .customer-grid > .field:has([name="name"]),
#store-form .customer-grid > .field:has([name="legalName"]),
#store-form .customer-grid > .field:has([name="address"]),
#store-form .customer-grid > .field:has([name="email"]),
#store-form .customer-grid > .field:has([name="contact"]) { grid-column: span 6; }
/* Entry has its own operational sections and width; only share the outer shell. */
.erp-registration-modal.entry-modal { width: min(1260px, calc(100vw - 24px)); }
.erp-registration-modal.quick-create-modal { width: min(420px, calc(100vw - 24px)); }
.erp-registration-modal.quick-create-modal > .modal-body { background: #fff; padding: 18px; overflow: auto; }
.erp-registration-modal:has(#price-form) { width: min(1260px, calc(100vw - 24px)); }
.erp-registration-modal:has(#price-form) > .modal-body > form { padding: 0; border: 0; box-shadow: none; background: transparent; }
@media (max-width: 650px) {
  .modal.erp-registration-modal { width: 100vw; max-height: 100vh; border-radius: 0; }
  .erp-registration-modal > .modal-body { padding: 10px; }
  .erp-registration-modal > .modal-body > form { padding: 12px; }
  .erp-registration-modal.customer-modal > .customer-form { margin: 10px; padding: 0 12px 12px; }
  .erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid > .field { grid-column: span 1; }
  .erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid > .field:has([name="name"]),
  .erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid > .field:has([name="email"]),
  .erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid > .field:has([name="address"]),
  .erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid > .field:has([name="reference"]),
  .erp-registration-modal.customer-modal [data-panel="cadastro"] .customer-grid > .field:has([name="city"]) { grid-column: 1 / -1; }
  #store-form .customer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #store-form .customer-grid > .field { grid-column: span 1; }
  #store-form .customer-grid > .field:has([name="name"]),
  #store-form .customer-grid > .field:has([name="legalName"]),
  #store-form .customer-grid > .field:has([name="address"]),
  #store-form .customer-grid > .field:has([name="email"]),
  #store-form .customer-grid > .field:has([name="contact"]) { grid-column: 1 / -1; }
}
