:root {
  --bg: #f5f3ef;
  --surface: #ffffff;
  --surface-2: #f0ede8;
  --border: #d9d4cc;
  --border-focus: #2c4a6e;
  --text: #1a1a1a;
  --text-muted: #6b6560;
  --accent: #2c4a6e;
  --accent-light: #e8edf4;
  --accent-hover: #1e3550;
  --danger: #c0392b;
  --danger-light: #fdf0ef;
  --success: #1e6b4a;
  --success-light: #e8f5ee;
  --contact-accent: #3a6b4a;
  --contact-light: #e8f5ee;
  --radius: 6px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.1), 0 12px 32px rgba(0, 0, 0, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "DM Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 40px 20px 80px;
}

/* ── Page Header ── */
.page-header {
  max-width: 680px;
  margin: 0 auto 20px;
}
.page-header .org-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.page-header h1 {
  font-family: "Libre Baskerville", serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.25;
}
.page-header p {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}
.page-header p.page-header-purpose {
  font-size: 15px;
  color: var(--text);
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  max-width: 680px;
  margin: 0 auto 20px;
  overflow: visible;
}
.card-header {
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-header .icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.card-header .icon i {
  font-size: 13px;
}
.card-header h2 {
  font-family: "Libre Baskerville", serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.card-header .badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: 20px;
  color: var(--text-muted);
  background: var(--surface-2);
}
.card-body {
  padding: 24px 28px;
  position: relative;
}

/* ── Completion view ── */
.completion-card .card-body {
  text-align: center;
  padding: 48px 32px;
}
.completion-icon {
  font-size: 48px;
  color: var(--success);
  margin-bottom: 18px;
}
.completion-card h2 {
  font-family: "Libre Baskerville", serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.completion-vendor-id {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.completion-message {
  margin-top: 18px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
}

/* ── Fields ── */
.field-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field-group.three-col {
  grid-template-columns: 1fr 1fr 1fr;
}
.field-group.four-col {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

.field label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.required-star {
  color: var(--danger);
  margin-left: 4px;
  font-size: 0.72em;
  font-weight: 600;
  font-style: italic;
  text-transform: lowercase;
  letter-spacing: normal;
}
.field input,
.field select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
  outline: none;
  appearance: none;
}
.field input:focus,
.field select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(44, 74, 110, 0.1);
}
.field input.invalid,
.field select.invalid {
  border-color: var(--danger);
}
.field-error-msg {
  margin-top: 5px;
  font-size: 12px;
  color: var(--danger);
}

/* ── Vendor info section ── */
.vendor-icon {
  background: var(--accent-light);
  color: var(--accent);
}
.special-orders-icon {
  background: var(--accent-light);
  color: var(--accent);
}
.special-orders-vendor-name {
  font-weight: 700;
  color: var(--accent);
  font-size: 13px;
}
.edi-icon {
  background: var(--accent-light);
  color: var(--accent);
}
.capabilities-icon {
  background: var(--accent-light);
  color: var(--accent);
}
.edi-vendor-name {
  font-weight: 700;
  color: var(--accent);
  font-size: 13px;
}

/* ── Contact entries ── */
.contact-entry {
  border: 1px solid #b8d4c0;
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  background: #f4faf6;
}
.contact-entry:last-child {
  margin-bottom: 0;
}
.contact-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.contact-entry-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--contact-accent);
}
.remove-contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 4px;
  transition:
    background 0.15s,
    color 0.15s;
  font-family: "DM Sans", sans-serif;
  font-weight: 500;
}
.remove-contact-btn:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.phone-row {
  display: grid;
  grid-template-columns: 1fr 1fr 80px;
  gap: 12px;
}

.add-contact-btn {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1.5px dashed var(--contact-accent);
  border-radius: var(--radius);
  padding: 9px 14px;
  color: var(--contact-accent);
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  justify-content: center;
  transition: background 0.15s;
}
.add-contact-btn:hover:not(:disabled) {
  background: var(--contact-light);
}
.add-contact-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Disabled-button hover tooltip ── */
.btn-tooltip-wrap {
  position: relative;
  display: block;
  width: 100%;
}
.btn-tooltip-wrap > button:disabled {
  pointer-events: none;
}
.btn-tooltip-wrap::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #2b3a47;
  color: #fff;
  font-family: "DM Sans", sans-serif;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  padding: 7px 11px;
  border-radius: 6px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.15s,
    transform 0.15s;
  z-index: 20;
}
.btn-tooltip-wrap::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  border: 5px solid transparent;
  border-top-color: #2b3a47;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.15s,
    transform 0.15s;
  z-index: 20;
}
.btn-tooltip-wrap:has(> button:disabled):hover::after,
.btn-tooltip-wrap:has(> button:disabled):hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* The advanced variant uses its own rich-content element, not the text pseudo. */
.btn-tooltip-wrap-advanced::after {
  content: none;
}
.btn-tooltip-advanced {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: max-content;
  max-width: 320px;
  background: #2b3a47;
  color: #fff;
  font-family: "DM Sans", sans-serif;
  font-size: 12.5px;
  line-height: 1.4;
  text-align: left;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.15s,
    transform 0.15s;
  z-index: 30;
}
.btn-tooltip-wrap-advanced:has(> button:disabled):hover .btn-tooltip-advanced {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.btn-tooltip-advanced-title {
  font-weight: 600;
  margin-bottom: 8px;
  color: #fff;
}
.btn-tooltip-advanced-contact {
  margin-bottom: 8px;
}
.btn-tooltip-advanced-contact:last-child {
  margin-bottom: 0;
}
.btn-tooltip-advanced-contact-name {
  font-weight: 600;
  color: #ffd9a8;
  margin-bottom: 3px;
}
.btn-tooltip-advanced-fields {
  margin: 0;
  padding-left: 16px;
  list-style: disc;
  color: #d6dee5;
}
.btn-tooltip-advanced-fields li {
  margin: 1px 0;
}

/* ── Contacts card header accent ── */
.contacts-icon {
  background: var(--contact-light);
  color: var(--contact-accent);
}

/* ── Submit ── */
.submit-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s,
    transform 0.1s,
    box-shadow 0.15s;
  box-shadow: var(--shadow);
  letter-spacing: 0.02em;
}
.submit-btn:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-lg);
}
.submit-btn:active {
  transform: scale(0.99);
}
.submit-btn:disabled {
  background: #9aabba;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.result-msg {
  display: none;
  max-width: 680px;
  margin: 20px auto 0;
  padding: 18px 22px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}
.result-msg.success {
  background: var(--success-light);
  border: 1px solid #a8d5bd;
  color: var(--success);
}
.result-msg.error {
  background: var(--danger-light);
  border: 1px solid #e8b4af;
  color: var(--danger);
}
.result-msg.visible {
  display: block;
}
.result-msg i {
  margin-right: 6px;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Save bar ── */
.save-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 8px;
  background: var(--surface);
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  font-weight: 600;
  padding: 11px 28px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
@media (hover: hover) {
  .save-btn:hover {
    background: var(--accent);
    color: #fff;
  }
}
.save-btn:focus {
  outline: none;
}
.save-status {
  display: none;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  color: var(--success);
}
.save-status.visible {
  display: block;
}
.save-status.error {
  color: var(--danger);
}

/* ── Contacts loading state ── */
.contacts-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}
.contacts-card.loading .contacts-loading {
  display: flex;
}
.contacts-card.loading #contactsList,
.contacts-card.loading #addContactBtn {
  display: none;
}
.contacts-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Name row ── */
.name-role-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}
.name-role-row .name-field {
  flex: 1;
  min-width: 0;
}

.add-contact-btn i {
  font-size: 12px;
}

/* ── Helper hint text ── */
.field-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}

/* ── Function dropdown ── */
.function-field {
  position: relative;
  margin-top: 12px;
}

.function-box {
  position: relative;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.function-box.open {
  z-index: 500;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(44, 74, 110, 0.1);
}
.function-box.invalid {
  border-color: var(--danger);
}

.function-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px 0;
}
.function-tags-row:empty {
  padding: 0;
}

.function-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-light);
  border: 1px solid #c4d3e6;
  color: var(--accent);
  border-radius: 20px;
  padding: 3px 6px 3px 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}
.function-tag.required-tag {
  background: #fdf0d0;
  border-color: #c49a20;
  color: #7a5800;
}

.function-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  padding: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  opacity: 0.6;
  transition:
    opacity 0.1s,
    background 0.1s;
}
.function-tag-remove:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

.function-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: "DM Sans", sans-serif;
  font-size: 13.5px;
  color: var(--text-muted);
  text-align: left;
  gap: 8px;
}
.function-trigger .chevron {
  flex-shrink: 0;
  font-size: 12px;
  transition: transform 0.15s;
}
.function-tag-remove i {
  font-size: 12px;
  line-height: 1;
}
.function-box.open .function-trigger .chevron {
  transform: rotate(180deg);
}

.function-panel {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  z-index: 501;
  background: var(--surface);
  border: 1.5px solid var(--border-focus);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 240px;
  overflow-y: auto;
  margin-top: 3px;
}
.function-panel.open {
  display: block;
}
.function-panel.open-up {
  top: auto;
  bottom: 100%;
  margin-top: 0;
  margin-bottom: 3px;
}

.function-option {
  padding: 9px 14px;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: background 0.1s;
}
.function-option:hover {
  background: var(--accent-light);
}
.function-option .req-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 10px;
  background: #fdf0d0;
  color: #7a5800;
  border: 1px solid #c49a20;
}
.function-empty-msg {
  padding: 11px 14px;
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Required functions tracker (sits outside contacts card to the right) ── */
.contacts-card {
  position: relative;
}

.contacts-card .tracker-sidebar {
  display: none;
  position: fixed;
  right: auto;
  width: 260px;
  max-width: 280px;
  z-index: 500;
  flex-direction: column;
  gap: 14px;
}
.contacts-card .required-tracker {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid #e8d98a;
  border-radius: var(--radius);
  background: #fdf8ec;
  transition:
    border-color 0.2s,
    background 0.2s;
}
.sidebar-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.required-tracker.all-done {
  border-color: #a8d5bd;
  background: var(--success-light);
}
.required-tracker-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #7a6010;
  margin-bottom: 10px;
}
.required-tracker.all-done .required-tracker-title {
  color: var(--success);
}
.required-tracker-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.req-tracker-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}
.req-tracker-tag i {
  font-size: 8px;
}
.req-tracker-tag.missing {
  background: var(--danger-light);
  border: 1px solid #e8b4af;
  color: var(--danger);
}
.req-tracker-tag.done {
  background: var(--success-light);
  border: 1px solid #a8d5bd;
  color: var(--success);
}

/* ── Vendor Code Error Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(26, 26, 26, 0.75);
  backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.visible {
  display: flex;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 440px;
  width: 100%;
  padding: 36px 32px;
  text-align: center;
  border-top: 5px solid var(--accent);
}
.modal-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 26px;
}
.modal-box h2 {
  font-family: "Libre Baskerville", serif;
  font-size: 22px;
  color: var(--text);
  margin-bottom: 12px;
}
.modal-box p {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}
.modal-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 22px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.modal-checkbox input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  font-weight: 600;
  padding: 11px 24px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.modal-btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1.5px solid var(--accent);
}
.modal-btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.modal-btn-secondary {
  background: var(--surface);
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.modal-btn-secondary:hover {
  background: var(--surface-2);
  color: var(--text);
}

.vendor-error-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(26, 26, 26, 0.75);
  backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.vendor-error-overlay.visible {
  display: flex;
}
.vendor-error-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 440px;
  width: 100%;
  padding: 36px 32px;
  text-align: center;
  border-top: 5px solid var(--danger);
}
.vendor-error-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--danger-light);
  color: var(--danger);
  font-size: 28px;
}
.vendor-error-box h2 {
  font-family: "Libre Baskerville", serif;
  font-size: 22px;
  color: var(--text);
  margin-bottom: 12px;
}
.vendor-error-box p {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 8px;
}
.vendor-error-sub {
  font-weight: 600;
  color: var(--text) !important;
  margin-bottom: 24px !important;
}
.vendor-error-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 24px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.vendor-error-refresh:hover {
  background: var(--accent-hover);
}

/* ── Password gate ── */
.auth-gate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #ffffff;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-gate.visible {
  display: flex;
}
.auth-gate-box {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  text-align: center;
  border-top: 5px solid var(--accent);
}
.auth-gate-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 26px;
}
.auth-gate-box h2 {
  font-family: "Libre Baskerville", serif;
  font-size: 22px;
  color: var(--text);
  margin-bottom: 12px;
}
.auth-gate-box p {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}
.auth-gate-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-gate-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.auth-gate-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(44, 74, 110, 0.1);
}
.auth-gate-input.invalid {
  border-color: var(--danger);
}
.auth-gate-error {
  display: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--danger);
  text-align: left;
  line-height: 1.4;
  margin-top: -4px;
}
.auth-gate-error.visible {
  display: block;
}
.auth-gate-btn {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow);
  letter-spacing: 0.02em;
}
.auth-gate-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: var(--shadow-lg);
}
.auth-gate-btn:disabled {
  background: #9aabba;
  cursor: not-allowed;
  box-shadow: none;
}

@media (max-width: 560px) {
  .field-group,
  .field-group.three-col,
  .field-group.four-col,
  .phone-row {
    grid-template-columns: 1fr;
  }
  .card-body {
    padding-inline: 16px;
  }
  .card-header {
    padding-inline: 16px;
  }
  .contact-entry {
    padding: 12px;
  }
}

@media (max-width: 768px) {
  body {
    padding-bottom: 220px;
  }
  .contacts-card .tracker-sidebar {
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: none !important;
    gap: 10px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.12);
  }
  .contacts-card .required-tracker {
    padding: 10px 13px;
    max-height: 32vh;
    overflow-y: auto;
  }
  .required-tracker-title {
    margin-bottom: 8px;
  }
  .sidebar-actions {
    flex-direction: row;
    align-items: stretch;
    gap: 10px;
  }
  .sidebar-actions .submit-btn,
  .sidebar-actions .save-btn {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
  }
  .tracker-sidebar .save-status.visible {
    padding-bottom: 2px;
  }
}
