/* Shared styles for the Biedeboer order processor UI */

:root {
  color-scheme: light;
  --primary-color: #AAC812;
  --primary-contrast: #233E13;
  --background: #f7f8fb;
  --card-bg: #ffffff;
  --card-shadow: rgba(15, 23, 42, 0.08);
  --text-main: #111222;
  --text-muted: #475467;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--background);
  color: var(--text-main);
}

form {
  margin: 0;
}

header {
  background: var(--primary-color);
  color: var(--primary-contrast);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: inline-flex;
  align-items: center;
  gap: 1.25rem;
}

.header-logo {
  width: 96px;
  height: auto;
  display: block;
}

.header-text {
  display: grid;
  gap: 0.2rem;
}

.header-context {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--primary-contrast);
}

header strong {
  font-size: 1.2rem;
}

.header-nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.header-nav a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.header-nav a.is-active {
  background: rgba(255, 255, 255, 0.22);
  color: var(--primary-contrast);
}

.btn-primary {
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: 10px;
  background: var(--primary-color);
  color: var(--primary-contrast);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(4, 85, 251, 0.25);
}

.btn-secondary {
  border: 1px solid #d0d5dd;
  padding: 0.65rem 1.4rem;
  border-radius: 10px;
  background: #ffffff;
  color: #111222;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.btn-secondary:disabled,
.btn-secondary[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.order-events-button {
  margin-top: 0.65rem;
  width: 100%;
}

.order-trackpod-button {
  margin-top: 0.65rem;
  width: 100%;
}

.order-actions button {
  width: 100%;
  margin-top: 0.65rem;
}

.order-delete-button {
  background: #fee4e2;
  color: #b42318;
  border-color: #fda29b;
}

.toast-container {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  display: grid;
  gap: 0.75rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  min-width: 260px;
  max-width: 360px;
  background: #111222;
  color: #f7f8fb;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.22);
  font-weight: 600;
  letter-spacing: 0.01em;
  animation: toast-in 160ms ease-out;
  pointer-events: auto;
}

.toast-success {
  background: #0f9d58;
}

.toast-error {
  background: #b42318;
}

.toast-hide {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.btn-primary:disabled,
.btn-primary[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  background: #c8d48d;
  color: rgba(35, 62, 19, 0.7);
}

main {
  padding: 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

main:not(.auth-card) > * + * {
  margin-top: 2.75rem;
}

.auth-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  background: radial-gradient(circle at top, rgba(170, 200, 18, 0.18), transparent 55%), var(--background);
  padding: 2rem;
}

.auth-card {
  max-width: 420px;
  width: 100%;
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
  padding: 2.5rem;
  display: grid;
  gap: 1.75rem;
}

.auth-header {
  display: grid;
  gap: 0.35rem;
  text-align: center;
}

.auth-header span {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.form-fields {
  display: grid;
  gap: 1rem;
}

.form-field {
  display: grid;
  gap: 0.45rem;
}

.form-field label {
  font-weight: 600;
  color: #344054;
}

.form-field input {
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-field input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(170, 200, 18, 0.25);
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.auth-actions .btn-primary {
  width: 100%;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 500;
}

.flash.error {
  background: rgba(244, 63, 94, 0.12);
  color: #b42318;
}

.flash.success {
  background: rgba(34, 197, 94, 0.12);
  color: #046c4e;
}

.flash.info {
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
}

.card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 10px 30px var(--card-shadow);
  padding: 1.5rem;
}

.db-actions {
  display: grid;
  gap: 1.25rem;
}

.db-actions .db-block {
  display: grid;
  gap: 0.5rem;
}

.section-panel {
  margin: 0;
}

.payload-panel {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px var(--card-shadow);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tab-panel {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px var(--card-shadow);
  display: grid;
  gap: 1.5rem;
}

.tab-header {
  align-items: flex-start;
  gap: 1.25rem;
}

.tab-controls {
  display: inline-flex;
  gap: 0.5rem;
  padding: 0.4rem;
  background: rgba(71, 84, 103, 0.08);
  border-radius: 999px;
}

.tab-button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.tab-button.is-active {
  background: var(--primary-color);
  color: var(--primary-contrast);
  box-shadow: 0 10px 25px rgba(4, 85, 251, 0.2);
}

.tab-panels {
  display: grid;
}

.tab-panel-content {
  display: none;
  gap: 1.5rem;
}

.tab-panel-content.is-active {
  display: grid;
}

.tab-panel-heading {
  display: grid;
  gap: 0.35rem;
}

.tab-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.finalize-status {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.tab-panel-title {
  margin: 0;
}

.tab-panel-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.section-header h2 {
  margin: 0;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.empty-state {
  margin-top: 1.5rem;
  background: var(--card-bg);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.06);
  color: var(--text-muted);
}

.filter-panel {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px var(--card-shadow);
}

.filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-end;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 200px;
}

.filter-label {
  font-weight: 600;
  color: #344054;
}

.filter-field input[type="date"],
.filter-field input[type="number"] {
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
}

.filter-field input[type="text"],
.filter-field input[type="email"],
.filter-field select {
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
  background: #fff;
}

.route-options {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  padding: 0.85rem 1rem;
}

.route-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  color: #1f2937;
}

.filter-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.link-reset {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.print-controls {
  display: flex;
  justify-content: flex-end;
}

main .print-controls {
  margin-top: 1.25rem;
}

.print-button {
  min-width: 180px;
}

.order-grid,
.orders-grid,
.vendor-grid,
.payload-list {
  display: grid;
  gap: 1.5rem;
}

.payload,
.order-card table,
.orders-grid .order-card {
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: 0 12px 35px var(--card-shadow);
}

.order-card,
.vendor-card {
  border-radius: 14px;
  box-shadow: 0 12px 35px var(--card-shadow);
  padding: 1.25rem;
}

.order-card,
.vendor-card {
  padding: 1.25rem;
}

.order-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.order-select {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.order-card-highlight {
  border: 2px solid var(--primary-color);
  box-shadow: 0 18px 38px rgba(35, 62, 19, 0.2);
}

.order-events-inline {
  border: 1px dashed rgba(35, 62, 19, 0.25);
  border-radius: 12px;
  padding: 1rem;
  margin-top: 0.75rem;
  background: rgba(170, 200, 18, 0.05);
}

.order-events-inline h4 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: #111222;
}

.order-events-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.order-events-list li {
  display: grid;
  gap: 0.15rem;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(35, 62, 19, 0.1);
}

.order-events-list time {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.order-events-list p {
  margin: 0;
  font-weight: 600;
  color: #111222;
}

.order-events-empty {
  margin: 0;
  color: var(--text-muted);
  font-style: italic;
}

.order-lookup-error {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: rgba(244, 63, 94, 0.12);
  color: #b42318;
  font-weight: 600;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 18, 34, 0.55);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 999;
}

.modal-overlay[hidden] {
  display: none !important;
}

.confirm-modal {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.3);
  max-width: 540px;
  width: 100%;
  padding: 1.5rem;
  display: grid;
  gap: 1rem;
}

.confirm-modal h3 {
  margin: 0;
}

.confirm-modal p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.modal-progress {
  display: grid;
  gap: 0.5rem;
  justify-items: center;
  text-align: center;
  color: var(--text-muted);
}

.modal-progress[hidden] {
  display: none;
}

.modal-spinner {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 3px solid rgba(35, 62, 19, 0.2);
  border-top-color: var(--primary-color);
  animation: modal-spin 0.9s linear infinite;
}

.modal-progress-text {
  margin: 0;
  font-size: 0.95rem;
}

@keyframes modal-spin {
  to {
    transform: rotate(360deg);
  }
}

body.has-modal {
  overflow: hidden;
}

.summary-modal {
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.3);
  max-width: 640px;
  width: min(640px, 95vw);
  padding: 1.5rem;
  display: grid;
  gap: 0.75rem;
}

.summary-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.summary-modal-header h3 {
  margin: 0;
}

.summary-close-button {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
}

.summary-context {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.summary-context-divider {
  margin: 0 0.5rem;
  color: rgba(17, 18, 34, 0.4);
}

.summary-modal-body {
  display: grid;
  gap: 1rem;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.summary-section {
  background: rgba(17, 18, 34, 0.04);
  border-radius: 14px;
  padding: 1rem;
  display: grid;
  gap: 0.5rem;
}

.summary-section[hidden] {
  display: none;
}

.summary-section-title {
  font-weight: 600;
  color: #1f2937;
}

.summary-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.summary-list[hidden] {
  display: none;
}

.summary-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(35, 62, 19, 0.08);
  font-weight: 600;
  color: #1f2937;
}

.summary-list-item-stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}

.summary-item-primary {
  font-weight: 600;
  color: #1f2937;
}

.summary-item-secondary {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.summary-empty {
  margin: 0;
  color: var(--text-muted);
  font-style: italic;
}

.summary-modal-actions {
  justify-content: flex-end;
}

.delivery-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.5rem;
}

.delivery-order {
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: 0 12px 35px var(--card-shadow);
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
}

.delivery-order-header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.delivery-order-title {
  display: grid;
  gap: 0.25rem;
}

.delivery-order-name {
  font-weight: 600;
  font-size: 1.05rem;
}

.delivery-order-id {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.delivery-order-date {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.delivery-order-meta {
  display: grid;
  gap: 0.45rem;
  color: var(--text-muted);
}

.delivery-order-meta strong {
  color: var(--text-main);
}

.delivery-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.delivery-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
}

.delivery-item-qty {
  font-weight: 600;
  color: var(--primary-color);
}

.delivery-empty {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: rgba(71, 84, 103, 0.08);
  color: var(--text-muted);
}

.order-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border: 1px solid #e4e7ec;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(170, 200, 18, 0.05));
  position: relative;
}

.vendor-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border: 1px solid #e4e7ec;
  background: linear-gradient(135deg, rgba(170, 200, 18, 0.08), rgba(255, 255, 255, 0.95));
  position: relative;
}

.order-card::after,
.vendor-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.vendor-card h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #1f2a37;
}

.order-card .order-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.order-card .order-meta {
  display: grid;
  gap: 0.5rem;
}

.order-card .order-item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.order-meta div,
.order-card .order-item,
.vendor-item,
.order-item-vendor {
  color: var(--text-muted);
}

.order-card .order-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  background: rgba(35, 62, 19, 0.05);
  border: 1px solid rgba(35, 62, 19, 0.08);
}

.order-card-compact {
  padding: 0;
}

.order-compact-summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.order-compact-summary::-webkit-details-marker {
  display: none;
}

.order-compact-main {
  display: grid;
  gap: 0.35rem;
  color: var(--text-muted);
  font-weight: 500;
}

.order-compact-number {
  font-weight: 700;
  color: var(--text-main);
}

.order-compact-status,
.order-compact-items {
  font-weight: 600;
  color: #1f2937;
}

.order-compact-actions {
  display: grid;
  gap: 0.5rem;
  justify-items: end;
}

.order-compact-toggle {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.order-compact-body {
  padding: 0 1.25rem 1.25rem;
  display: grid;
  gap: 1rem;
}

.vendor-item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.order-quantity,
.vendor-item strong {
  font-weight: 600;
  color: var(--primary-color);
}

.order-item-qty {
  font-weight: 600;
  color: var(--primary-color);
  margin-right: 0.5rem;
}

.vendor-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  background: rgba(35, 62, 19, 0.05);
  border: 1px solid rgba(35, 62, 19, 0.08);
}

.vendor-item span {
  color: #1f2937;
  font-weight: 500;
}

.vendor-item-edit {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
}

.vendor-item .vendor-item-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-weight: 600;
  color: #1f2937;
}

.vendor-item .vendor-item-sku {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.vendor-item-input {
  width: 4ch;
  min-width: 3ch;
  max-width: 4ch;
  text-align: right;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  padding: 0.35rem 0.4rem;
  font-weight: 600;
  color: var(--primary-color);
  background: #fff;
}

.vendor-item-suffix {
  font-weight: 600;
  color: var(--text-muted);
}

.order-status {
  text-align: right;
  font-size: 0.95rem;
  color: #1f2937;
}

.chip {
  display: inline-block;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #e0edff;
  color: var(--primary-color);
}

.chip-bezorging {
  margin-top: 0.4rem;
  background: #dbeafe;
  color: #1d4ed8;
}

.chip-bezorging-bezorgd {
  background: #e0edff;
  color: var(--primary-color);
}

.chip-bezorging-open {
  margin-top: 0.4rem;
  background: #fef3c7;
  color: #b45309;
}

.chip-finance-pending {
  background: #fef3c7;
  color: #b45309;
}

.meta-grid {
  display: grid;
  gap: 0.35rem;
  font-size: 0.95rem;
  color: #344054;
}

.meta-grid a {
  color: #4b5563;
  text-decoration: underline;
}

.meta-grid a:hover {
  color: #111827;
}

.vendor-note {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: #475467;
}

.vendor-note textarea {
  border: 1px solid #d0d5dd;
  border-left: 4px solid var(--primary-color);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  padding: 0.65rem 0.75rem;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.vendor-note textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(170, 200, 18, 0.15);
}

.items-table {
  width: 100%;
  border-collapse: collapse;
}

.items-table th,
.items-table td {
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  font-size: 0.95rem;
}

.items-table th {
  font-weight: 600;
  color: #475467;
}

.items-table tbody tr:last-child td {
  border-bottom: none;
}

.items-table .qty {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-input {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid #d0d5dd;
  font-size: 0.95rem;
  font-family: inherit;
  background: #ffffff;
  box-sizing: border-box;
}

.table-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(170, 200, 18, 0.15);
}

.items-table td.col-email {
  min-width: 220px;
}

.items-table td.col-house {
  min-width: 80px;
  width: 80px;
}

.items-table td.col-postal {
  min-width: 90px;
  width: 90px;
}

.vendor-actions {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: nowrap;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  font-size: 1rem;
}

.icon-button:hover {
  border-color: #cbd5e1;
}

.icon-button:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(170, 200, 18, 0.15);
}

.icon-button-danger {
  background: #fee4e2;
  color: #b42318;
  border-color: #fda29b;
}

.table-scroll {
  overflow-x: auto;
}

.vendor-email-card {
  display: grid;
  gap: 1rem;
}

.vendor-email-table tr.is-fallback td {
  background: rgba(251, 191, 36, 0.12);
}

.vendor-email-table tr.is-missing td {
  background: rgba(244, 63, 94, 0.12);
}

.vendor-cell {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.vendor-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.vendor-portal-link {
  display: inline-block;
  font-weight: 600;
  color: var(--primary-color);
  text-decoration: none;
}

.vendor-portal-link:hover {
  text-decoration: underline;
}

.vendor-token {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
}

body.vendor-portal {
  background: var(--background);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.vendor-portal-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.vendor-portal-card {
  width: min(960px, 100%);
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.18);
  padding: 2.5rem;
  display: grid;
  gap: 1.75rem;
}

.vendor-portal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  flex-wrap: wrap;
}

.vendor-portal-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.vendor-portal-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  text-align: right;
}

.vendor-portal-name {
  margin: 0;
  font-size: 2rem;
}

.vendor-portal-meta {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.vendor-portal-updated {
  margin: 0;
}

.vendor-portal-right .print-button {
  align-self: flex-end;
}

.vendor-portal-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.vendor-portal-stat {
  border: 1px solid #e4e7ec;
  border-radius: 14px;
  padding: 0.85rem 1rem;
  background: rgba(170, 200, 18, 0.05);
}

.vendor-portal-stat strong {
  display: block;
  font-size: 1.3rem;
}

.vendor-portal-table td,
.vendor-portal-table th {
  vertical-align: top;
}

.vendor-portal-product {
  font-weight: 600;
  color: #0f172a;
}

.vendor-portal-skus {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.vendor-portal-note {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.vendor-portal-empty {
  margin: 0;
}

.vendor-portal-logo {
  width: 110px;
}

@media (max-width: 640px) {
  .vendor-portal-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .vendor-portal-left,
  .vendor-portal-right {
    align-items: center;
    text-align: center;
  }

  .vendor-portal-right .print-button {
    align-self: center;
  }
}

@media print {
  @page {
    margin: 12mm;
  }

  body,
  html {
    background: #ffffff !important;
    color: #000000 !important;
  }

  body * {
    color: #000000 !important;
    box-shadow: none !important;
  }

  nav,
  .header-nav,
  header form,
  .filter-panel,
  .flash-stack,
  .print-controls,
  .vendor-portal-actions,
  .tab-panel-actions,
  .tab-controls,
  .route-options,
  .filter-hint,
  .order-card-actions,
  .finalize-status,
  .modal,
  .modal-overlay,
  .vendor-note,
  .site-footer,
  .order-actions,
  .btn-primary,
  .btn-secondary,
  .link-reset {
    display: none !important;
  }

  body > header {
    background: transparent !important;
    color: #000000 !important;
    padding: 0 0 0.35in 0;
    align-items: flex-start;
  }

  body > header .header-brand {
    gap: 0.25in;
  }

  body > header .header-logo {
    width: 1.35in;
  }

  body > header .header-text {
    display: block;
  }

  body > header .header-context {
    font-size: 1.1rem;
    font-weight: 600;
    color: #000000 !important;
  }

  .vendor-portal-card > header {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.5rem;
    align-items: start;
  }

  .vendor-portal-left,
  .vendor-portal-right {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .vendor-portal-left {
    align-items: flex-start;
  }

  .vendor-portal-right {
    align-items: flex-end;
    text-align: right;
  }

  main {
    max-width: none;
    padding: 0;
  }

  .vendor-portal-main {
    padding: 0;
  }

  .vendor-portal-card,
  .vendor-portal-stat,
  .vendor-portal-table,
  .vendor-portal-table td,
  .vendor-portal-table th {
    background: #ffffff !important;
    border: 1px solid #000000;
    box-shadow: none;
  }

  .vendor-portal-card {
    border-radius: 12px;
    padding: 0.5in;
  }

  .vendor-portal-stats {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
  }

  .vendor-portal-stat {
    border-radius: 0;
    background: transparent;
  }

  input,
  textarea {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  .section-panel.orders-grid {
    padding: 0;
    box-shadow: none;
    background: transparent;
  }

  .section-panel,
  .tab-panel,
  .card,
  .vendor-card,
  .order-card {
    margin-top: 0.4in;
  }

  .section-panel:first-of-type,
  .tab-panel:first-of-type,
  .card:first-of-type,
  .vendor-card:first-of-type,
  .order-card:first-of-type {
    margin-top: 0;
  }

  .orders-grid {
    display: block;
  }

  .order-card,
  .orders-grid .order-card,
  .order-card table,
  .items-table {
    background: #ffffff !important;
    border: 1px solid #000000;
    box-shadow: none;
  }

  .order-card {
    page-break-inside: avoid;
    padding: 1rem;
  }

  .order-card::after {
    display: none;
  }

  .order-header {
    align-items: flex-start;
    gap: 0.5rem;
  }

  .chip {
    background: transparent;
    border: 1px solid #000000;
    color: #000000 !important;
  }

  .meta-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.25rem;
  }

  .items-table th,
  .items-table td {
    border: 1px solid #000000;
    padding: 0.45rem;
    font-size: 0.9rem;
  }

  .items-table th {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.8rem;
    background: #f5f5f5 !important;
  }

  .order-status {
    text-align: left;
  }

  .order-card form {
    display: none;
  }

  .tab-panel {
    background: transparent;
    box-shadow: none;
    padding: 0;
  }

  .tab-panel-content[data-tab-panel="deliveries"] {
    display: none !important;
  }

  .vendor-grid {
    display: block;
    margin-top: 0.5rem;
  }

  .vendor-card {
    background: #ffffff !important;
    border: 1px solid #000000;
    box-shadow: none;
    page-break-inside: avoid;
    padding: 1rem;
    border-radius: 12px;
  }

  .vendor-card::after {
    display: none;
  }

  .vendor-item,
  .vendor-item-list {
    background: transparent;
  }

  .vendor-item {
    border: 1px solid #000000;
    border-radius: 6px;
    background: #ffffff !important;
    margin-bottom: 0.3rem;
  }

  .vendor-item-input {
    min-width: 0;
    width: auto;
    padding: 0;
    font-size: 1rem;
    text-align: right;
  }

  .vendor-item-suffix {
    font-weight: 600;
  }

  .vendor-item-title {
    font-weight: 600;
  }
}

.email-value {
  display: inline-block;
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid #e2e8f0;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.9rem;
}

.email-empty {
  color: #b42318;
  font-weight: 600;
}

.email-meta {
  margin-left: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.chip.chip-direct {
  background: rgba(16, 185, 129, 0.18);
  color: #065f46;
}

.chip.chip-fallback {
  background: rgba(250, 204, 21, 0.25);
  color: #854d0e;
}

.chip.chip-missing {
  background: rgba(244, 63, 94, 0.18);
  color: #b42318;
}

.payload {
  background: #101828;
  color: #e4e7ec;
  padding: 1rem;
  overflow: hidden;
}

.site-footer {
  max-width: 1100px;
  margin: 0 auto 2.5rem;
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(71, 84, 103, 0.6);
}

.site-footer .site-footer-link {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.site-footer .site-footer-link:hover,
.site-footer .site-footer-link:focus {
  text-decoration: underline;
}

.site-footer abbr {
  font-weight: 600;
  color: rgba(17, 18, 34, 0.65);
  text-decoration: none;
}

.site-footer-divider {
  margin: 0 0.75rem;
  color: rgba(71, 84, 103, 0.7);
}

.site-footer-auth {
  max-width: none;
  width: 100%;
  margin: 0 0 2rem;
  padding: 0.75rem;
}
.timestamp {
  font-size: 0.95rem;
  color: #98a2b3;
  margin-bottom: 0.75rem;
}

.webhook-list {
  display: grid;
  gap: 0.85rem;
}

.webhook-entry {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  padding: 0.65rem 0.9rem;
}

.webhook-entry summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.webhook-entry summary::marker,
.webhook-entry summary::-webkit-details-marker {
  color: var(--primary-color);
}

.webhook-summary {
  display: grid;
  gap: 0.15rem;
}

.webhook-topic {
  padding: 0.1rem 0.5rem;
  background: rgba(170, 200, 18, 0.12);
  color: #233e13;
  border-radius: 8px;
  display: inline-block;
  width: fit-content;
}

.webhook-meta {
  display: flex;
  gap: 0.75rem;
  color: #475467;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.webhook-time {
  color: #98a2b3;
  font-size: 0.9rem;
}

.webhook-body {
  border-top: 1px solid #e2e8f0;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  display: grid;
  gap: 0.65rem;
}

.webhook-meta-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
  color: #344054;
}

.webhook-payload summary {
  font-weight: 600;
  cursor: pointer;
  color: #111222;
}

.webhook-payload pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 0.85rem;
  border-radius: 10px;
  margin-top: 0.5rem;
}

pre {
  margin: 0;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1500;
}

.modal.is-open {
  display: flex;
}

.modal[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 18, 34, 0.45);
}

.modal-dialog {
  position: relative;
  width: min(92%, 520px);
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  padding: 1.75rem 1.75rem 1.5rem;
  z-index: 1;
  display: grid;
  gap: 1.25rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.modal-header h3 {
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: #475467;
  padding: 0.2rem;
}

.modal-body {
  max-height: 60vh;
  overflow-y: auto;
  display: grid;
  gap: 1rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

.modal-events-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.85rem;
}

.modal-event-item {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.modal-event-item time {
  display: block;
  font-weight: 600;
  color: #475467;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.modal-event-item p {
  margin: 0;
  color: #111222;
  font-size: 0.95rem;
  line-height: 1.4;
}

.modal-status {
  margin: 0;
  color: #475467;
  font-size: 0.95rem;
}

@media (max-width: 720px) {
  main {
    padding: 1.5rem;
  }
  .filter-grid {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-actions {
    justify-content: flex-start;
  }
  .order-card .order-header,
  .order-status {
    text-align: left;
  }
  header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
}

/* Configuration table */
.config-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.config-table th,
.config-table td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}

.config-table thead th {
  font-weight: 600;
  color: #475467;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.config-table tbody tr:last-child td {
  border-bottom: none;
}

.config-table code {
  background: rgba(170, 200, 18, 0.12);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  font-size: 0.88rem;
  color: #233e13;
}

.config-not-set {
  color: #98a2b3;
  font-style: italic;
}

.config-masked {
  font-family: monospace;
  color: #475467;
}

/* Debug banner */
.debug-banner {
  background: #ff8800;
  color: white;
  padding: 0.5rem 1rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: bold;
  border-bottom: 2px solid #cc6600;
}
