/* PPF ERP v1.3.7 — dealer portal visual compatibility layer.
   dealer.css keeps layout and workflow structure; this file owns PPF presentation. */

:root {
  --ppf-purple: #7B63F0;
  --ppf-pink: #F58ABC;
  --ppf-orange: #E46238;
  --ppf-orange-dark: #C94F2D;
  --ppf-yellow: #F7EF48;
  --ppf-canvas: #FAF9F5;
  --ppf-surface: #FFFFFF;
  --ppf-surface-soft: #FFFDF7;
  --ppf-surface-muted: #F5F2EB;
  --ppf-ink: #222326;
  --ppf-muted: #696761;
  --ppf-line: #E8E3D9;
  --control-height: 32px;
  --control-font-size: 12.5px;
  --control-radius: 9px;
  --dealer-product-thumb-size: 56px;
  --blue: var(--ppf-orange);
  --blue-dark: var(--ppf-orange-dark);
  --navy: var(--ppf-ink);
  --yellow: var(--ppf-yellow);
  --bg: var(--ppf-canvas);
  --surface: var(--ppf-surface);
  --line: var(--ppf-line);
  --muted: var(--ppf-muted);
  --text: var(--ppf-ink);
  --shadow: 0 4px 10px rgba(55, 46, 31, 0.07);
  --doc-link-color: #315F78;
  --doc-link-visited: #6A566F;
  --doc-link-hover: #214A60;
  --doc-link-visited-hover: #524157;
  color-scheme: light;
}

html[data-theme="dark"] {
  --ppf-canvas: #171614;
  --ppf-surface: #211F1C;
  --ppf-surface-soft: #27241F;
  --ppf-surface-muted: #302C26;
  --ppf-ink: #F4F1EA;
  --ppf-muted: #B8B1A4;
  --ppf-line: #403C35;
  --ppf-orange-dark: #FF926B;
  --doc-link-color: #89B7CC;
  --doc-link-visited: #C0A6BD;
  --doc-link-hover: #B4D4E2;
  --doc-link-visited-hover: #D6BED2;
  color-scheme: dark;
}

body.dealer-portal-shell {
  position: relative;
  color: var(--text);
  background: var(--bg);
  background-image: none;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

body.dealer-portal-shell::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  z-index: 70;
  height: 5px;
  pointer-events: none;
  background: linear-gradient(90deg, #BE86E8 0 16%, var(--ppf-orange) 16% 18.3%, var(--ppf-yellow) 18.3% 63.2%, #BE86E8 63.2% 67.6%, var(--ppf-pink) 67.6% 82.3%, var(--ppf-orange) 82.3% 100%);
}

.dealer-portal-shell .global-watermark {
  opacity: 0.22;
}

.dealer-portal-shell .global-watermark span {
  color: color-mix(in srgb, var(--ppf-orange) 14%, transparent);
  font-size: 20px;
}

.dealer-portal-shell a {
  color: var(--ppf-orange-dark);
}

.dealer-portal-shell .doc-link {
  color: var(--doc-link-color);
  text-decoration: none;
}

.dealer-portal-shell .doc-link:visited {
  color: var(--doc-link-visited);
}

.dealer-portal-shell .doc-link:hover {
  color: var(--doc-link-hover);
  text-decoration: underline;
}

.dealer-portal-shell .doc-link:visited:hover {
  color: var(--doc-link-visited-hover);
}

.dealer-portal-shell .doc-link:focus-visible {
  color: var(--doc-link-hover);
  border-radius: 3px;
  outline-color: var(--doc-link-hover);
}

.dealer-portal-shell :where(input:not([type="file"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select) {
  height: var(--control-height);
  min-height: var(--control-height);
  border-color: var(--line);
  border-radius: var(--control-radius);
  padding: 6px 10px;
  background: var(--surface);
  color: var(--text);
  font-size: var(--control-font-size);
  box-shadow: none;
}

.dealer-portal-shell textarea {
  border-color: var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}

.dealer-portal-shell :where(input, select, textarea, button, .button, a):focus-visible {
  outline: 2px solid color-mix(in srgb, var(--ppf-orange) 72%, transparent);
  outline-offset: 2px;
  box-shadow: none;
}

.dealer-portal-shell :where(button, .button):not(.account-trigger):not(.erp-select-trigger):not(.dealer-search-trigger):not(.order-total-trigger):not(.dealer-order-review-close):not(.dealer-order-review-remove) {
  height: var(--control-height);
  min-height: var(--control-height);
  border: 1px solid var(--ppf-orange);
  border-radius: var(--control-radius);
  padding: 6px 12px;
  background: var(--ppf-orange);
  background-image: none;
  color: #FFFFFF;
  font-size: var(--control-font-size);
  box-shadow: none;
}

/* dealer.css keeps a 40px legacy filter rhythm; the PPF shell is 32px. */
.dealer-portal-shell .dealer-filter-grid input,
.dealer-portal-shell .dealer-search-input,
.dealer-portal-shell .dealer-filter-apply,
.dealer-portal-shell .dealer-toolbar-button,
.dealer-portal-shell .dealer-display-settings summary {
  height: var(--control-height);
  min-height: var(--control-height);
}

.dealer-portal-shell :where(button, .button):not(.account-trigger):not(.erp-select-trigger):not(.dealer-search-trigger):not(.order-total-trigger):not(.dealer-order-review-close):not(.dealer-order-review-remove):hover {
  border-color: var(--ppf-orange-dark);
  background: var(--ppf-orange-dark);
  color: #FFFFFF;
  transform: none;
  box-shadow: none;
}

.dealer-portal-shell .button.ghost,
.dealer-portal-shell .dealer-toolbar-button,
.dealer-portal-shell .proof-button,
.dealer-portal-shell .field-selection-actions button,
.dealer-portal-shell .dealer-pagination a,
.dealer-portal-shell .dealer-pagination em {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}

.dealer-portal-shell .button.ghost:hover,
.dealer-portal-shell .dealer-toolbar-button:hover,
.dealer-portal-shell .proof-button:hover {
  border-color: color-mix(in srgb, var(--ppf-orange) 48%, var(--line));
  background: color-mix(in srgb, var(--ppf-yellow) 14%, var(--surface));
  color: var(--text);
}

.dealer-portal-shell .login-shell {
  padding-top: max(52px, 5vw);
}

.dealer-portal-shell .login-visual h1 {
  color: var(--text);
  font-size: 48px;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.dealer-portal-shell .login-visual p,
.dealer-portal-shell .hint,
.dealer-portal-shell .hero p,
.dealer-portal-shell .board-head p {
  color: var(--muted);
}

.dealer-portal-shell .login-card,
.dealer-portal-shell .order-board,
.dealer-portal-shell .orders-panel,
.dealer-portal-shell .empty {
  border: 1px solid var(--line);
  border-top: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: inset 0 3px 0 var(--ppf-yellow);
}

.dealer-portal-shell .login-card {
  padding: 26px;
}

.dealer-portal-shell .login-card h2,
.dealer-portal-shell .hero h1,
.dealer-portal-shell .board-head h2,
.dealer-portal-shell .panel-title h2 {
  color: var(--text);
}

.portal-theme-toggle {
  height: var(--control-height);
  min-height: var(--control-height);
  border: 1px solid var(--line) !important;
  border-radius: var(--control-radius) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  box-shadow: none !important;
}

.portal-login-theme {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 72;
}

.dealer-portal-shell .topbar {
  top: 5px;
  padding: 10px clamp(14px, 3vw, 34px);
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: none;
}

.dealer-portal-shell .brand span {
  color: var(--text);
  font-size: 16px;
}

.portal-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dealer-portal-shell .account-trigger {
  min-height: 38px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}

.dealer-portal-shell .account-avatar {
  width: 30px;
  height: 30px;
  background: var(--ppf-yellow);
  color: #222326;
}

.dealer-portal-shell .account-trigger strong,
.dealer-portal-shell .account-dropdown a,
.dealer-portal-shell .account-dropdown button {
  color: var(--text);
}

.dealer-portal-shell .account-trigger em {
  color: var(--ppf-orange-dark);
}

.dealer-portal-shell .account-dropdown {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: 0 4px 10px rgba(55, 46, 31, 0.10);
}

.dealer-portal-shell .account-dropdown a:hover,
.dealer-portal-shell .account-dropdown button:hover {
  background: color-mix(in srgb, var(--ppf-yellow) 18%, var(--surface));
  color: var(--text);
}

.dealer-portal-shell .portal {
  gap: 16px;
  padding-top: 20px;
}

.dealer-portal-shell .hero h1 {
  font-size: 32px;
  letter-spacing: -0.02em;
}

.dealer-portal-shell .release-tabs a {
  border-color: var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.dealer-portal-shell .release-tabs a:hover {
  border-color: color-mix(in srgb, var(--ppf-orange) 48%, var(--line));
  background: color-mix(in srgb, var(--ppf-yellow) 12%, var(--surface));
}

.dealer-portal-shell .release-tabs a.active {
  border-color: var(--ppf-orange);
  background: color-mix(in srgb, var(--ppf-yellow) 23%, var(--surface));
  box-shadow: inset 0 -2px 0 var(--ppf-orange);
}

.dealer-portal-shell .release-tabs span {
  color: var(--muted);
}

.dealer-portal-shell .summary-pill {
  border-radius: var(--control-radius);
  background: #252426;
  color: var(--ppf-yellow);
}

.dealer-portal-shell .dealer-toolbar,
.dealer-portal-shell .portal-filter,
.dealer-portal-shell .payment-proof-panel,
.dealer-portal-shell .proof-upload-form,
.dealer-portal-shell .dealer-horizontal-scroll {
  border-color: var(--line);
  background: var(--ppf-surface-soft);
  background-image: none;
}

.dealer-portal-shell .portal-date-range {
  grid-column: span 2;
  min-width: 300px;
}

.dealer-portal-shell .portal-date-range-controls {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr);
  gap: 8px;
  align-items: center;
}

.dealer-portal-shell .portal-date-range-controls > span {
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.dealer-portal-shell .portal-filter > .filter-actions {
  align-self: end;
  justify-content: flex-end;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .dealer-portal-shell .portal-date-range {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .dealer-portal-shell .portal-date-range-controls {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }
}

.dealer-portal-shell .erp-select-trigger,
.dealer-portal-shell .dealer-search-trigger {
  height: var(--control-height);
  min-height: var(--control-height);
  border-color: var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--text);
  font-size: var(--control-font-size);
  box-shadow: none;
}

.dealer-portal-shell .erp-select-trigger:hover,
.dealer-portal-shell .erp-select-trigger:focus,
.dealer-portal-shell .dealer-search-trigger:hover,
.dealer-portal-shell .dealer-search-trigger:focus {
  border-color: var(--ppf-orange);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ppf-orange) 16%, transparent);
}

.dealer-portal-shell .erp-select-caret,
.dealer-portal-shell .select-caret {
  color: var(--ppf-orange-dark);
}

.dealer-portal-shell .erp-select-menu,
.dealer-portal-shell .dealer-search-menu,
.dealer-portal-shell .dealer-display-form {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: 0 4px 10px rgba(55, 46, 31, 0.10);
}

.dealer-portal-shell .erp-select-options button,
.dealer-portal-shell .dealer-search-options button {
  height: auto;
  min-height: 34px;
  border: 0;
  background: var(--surface);
  color: var(--text);
}

.dealer-portal-shell .erp-select-options button:hover,
.dealer-portal-shell .dealer-search-options button:hover {
  background: color-mix(in srgb, var(--ppf-yellow) 16%, var(--surface));
  color: var(--text);
}

.dealer-portal-shell .erp-select-options button.is-active,
.dealer-portal-shell .dealer-search-options button.is-active {
  background: var(--ppf-orange);
  color: #FFFFFF;
}

.dealer-portal-shell .thumb-button {
  width: var(--dealer-product-thumb-size) !important;
  height: var(--dealer-product-thumb-size) !important;
  min-height: var(--dealer-product-thumb-size) !important;
  margin-inline: auto;
  padding: 4px !important;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: color-mix(in srgb, var(--ppf-yellow) 8%, var(--surface));
  box-shadow: none;
}

.dealer-portal-shell .thumb-button:hover {
  border-color: color-mix(in srgb, var(--ppf-orange) 44%, var(--line));
  background: color-mix(in srgb, var(--ppf-yellow) 15%, var(--surface));
}

.dealer-portal-shell .thumb-button img {
  display: block;
  width: 100%;
  height: 100%;
  margin: auto;
  border-radius: 6px;
  object-fit: contain;
  object-position: center;
}

.dealer-portal-shell .dealer-product-table td[data-field-key="product_image"] {
  padding-inline: 10px;
  text-align: center;
  vertical-align: middle;
}

.dealer-portal-shell .dealer-order-review-stepper button {
  width: 38px;
  height: 38px;
  min-height: 38px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
}

.dealer-portal-shell .dealer-order-review-stepper button:hover {
  border: 0;
  background: color-mix(in srgb, var(--ppf-yellow) 18%, var(--surface));
  color: var(--text);
}

.dealer-portal-shell .dealer-product-table th,
.dealer-portal-shell th {
  background: color-mix(in srgb, var(--ppf-yellow) 14%, var(--surface));
  color: var(--text);
}

.dealer-portal-shell th,
.dealer-portal-shell td {
  border-bottom-color: var(--line);
}

.dealer-portal-shell tbody tr:hover td {
  background: color-mix(in srgb, var(--ppf-yellow) 8%, var(--surface));
}

.dealer-portal-shell .dealer-product-table .dealer-row-no,
.dealer-portal-shell .dealer-product-table td.is-frozen,
.dealer-portal-shell .dealer-product-table th.is-frozen {
  background: var(--surface);
  box-shadow: 9px 0 12px rgba(58, 48, 30, 0.07);
}

.dealer-portal-shell .dealer-product-table th.dealer-row-no,
.dealer-portal-shell .dealer-product-table th.is-frozen {
  background: color-mix(in srgb, var(--ppf-yellow) 14%, var(--surface));
}

.dealer-portal-shell .dealer-pagination a.active {
  border-color: var(--ppf-orange);
  background: var(--ppf-orange);
  color: #FFFFFF;
}

.dealer-portal-shell .sticky-submit,
.dealer-portal-shell .dealer-order-review-footer,
.dealer-portal-shell .dealer-order-review-drawer,
.dealer-portal-shell .dealer-order-review-item,
.dealer-portal-shell .dealer-order-review-stepper,
.dealer-portal-shell .image-preview figure {
  border-color: var(--line);
  background: var(--surface);
}

.dealer-portal-shell .order-total-bar,
.dealer-portal-shell .order-total-trigger {
  border-color: var(--line);
  background: var(--ppf-surface-soft);
  color: var(--text);
  box-shadow: none;
}

.dealer-portal-shell .payment-proof-panel .proof-actions > span,
.dealer-portal-shell .payment-proof-summary span,
.dealer-portal-shell .portal-order-summary span {
  border-color: var(--line);
  background: var(--ppf-surface-muted);
  color: var(--text);
}

.dealer-portal-shell .flash {
  border-color: #BFDABF;
  background: #EAF7E8;
  color: #287A35;
}

.dealer-portal-shell .flash.error {
  border-color: #E7B9B4;
  background: #FFF0EF;
  color: #B83B34;
}

html[data-theme="dark"] body.dealer-portal-shell {
  background: var(--bg);
}

html[data-theme="dark"] .dealer-portal-shell .global-watermark span {
  color: color-mix(in srgb, var(--ppf-yellow) 9%, transparent);
}

html[data-theme="dark"] .dealer-portal-shell .summary-pill {
  background: var(--ppf-yellow);
  color: #171614;
}

html[data-theme="dark"] .dealer-portal-shell .flash {
  border-color: #31543A;
  background: #203629;
  color: #9BDEA7;
}

html[data-theme="dark"] .dealer-portal-shell .flash.error {
  border-color: #6B3732;
  background: #402521;
  color: #FFAAA2;
}

@media (max-width: 860px) {
  .portal-tools {
    align-items: stretch;
  }

  .dealer-portal-shell .topbar {
    align-items: center;
    flex-direction: row;
  }

  .dealer-portal-shell .account-trigger {
    align-items: center;
    flex-direction: row;
  }
}

@media (max-width: 560px) {
  .dealer-portal-shell .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-tools {
    justify-content: space-between;
  }

  .dealer-portal-shell .login-visual h1 {
    font-size: 34px;
  }

  .dealer-portal-shell .hero h1 {
    font-size: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dealer-portal-shell *,
  .dealer-portal-shell *::before,
  .dealer-portal-shell *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  body.dealer-portal-shell {
    background: #FFFFFF !important;
    color: #111111 !important;
  }

  body.dealer-portal-shell::before,
  .global-watermark,
  .portal-theme-toggle,
  .topbar {
    display: none !important;
  }
}
