/* ZTMS 2.0.0-M1 shared visual foundation.
   Sales, operator, market and admin surfaces consume the same semantic tokens. */
:root {
  --ztms-font-ui: "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  --ztms-font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --ztms-text-primary: #17191c;
  --ztms-text-secondary: #697386;
  --ztms-text-tertiary: #8b95a3;
  --ztms-text-disabled: #aab2bf;
  --ztms-brand: #1b4be5;
  --ztms-brand-hover: #1641c7;
  --ztms-brand-soft: #eef3ff;
  --ztms-success: #18865b;
  --ztms-warning: #b96800;
  --ztms-danger: #c4322a;
  --ztms-canvas: #fff;
  --ztms-surface: #f5f6f7;
  --ztms-surface-active: #eceff2;
  --ztms-line: #e5e7eb;
  --ztms-line-strong: #d3d7de;
  --ztms-primary: #15171a;
  --ztms-type-page: 24px;
  --ztms-type-section: 18px;
  --ztms-type-card: 16px;
  --ztms-type-reading: 15px;
  --ztms-type-body: 14px;
  --ztms-type-label: 13px;
  --ztms-type-caption: 12px;
  --ztms-leading-page: 1.34;
  --ztms-leading-section: 1.45;
  --ztms-leading-body: 1.58;
  --ztms-leading-reading: 1.72;

  /* Compatibility aliases while legacy selectors migrate to the shared layer. */
  --font-ui: var(--ztms-font-ui);
  --font-pingfang: var(--ztms-font-ui);
  --font: var(--ztms-font-ui);
  --ink: var(--ztms-text-primary);
  --text: #343a40;
  --muted: var(--ztms-text-secondary);
  --ink-900: var(--ztms-text-primary);
  --ink-700: #343a40;
  --ink-500: var(--ztms-text-secondary);
  --ink-300: var(--ztms-text-disabled);
  --blue: var(--ztms-brand);
  --brand: var(--ztms-brand);
  --blue-soft: var(--ztms-brand-soft);
  --brand-soft: var(--ztms-brand-soft);
  --line: var(--ztms-line);
  --line-strong: var(--ztms-line-strong);
  --surface: var(--ztms-surface);
  --panel: var(--ztms-surface);
  --primary: var(--ztms-primary);
  --success: var(--ztms-success);
  --warning: var(--ztms-warning);
  --danger: var(--ztms-danger);
  --ds-font-size-s: var(--ztms-type-caption);
  --ds-font-size-sp: var(--ztms-type-label);
  --ds-font-size-m: var(--ztms-type-body);
  --ds-font-size-l: var(--ztms-type-card);
  --ds-font-size-xl: var(--ztms-type-section);
  --ds-font-size-2xl: 28px;
  --fs-display: var(--ztms-type-page);
  --fs-title: var(--ztms-type-section);
  --fs-section: var(--ztms-type-card);
  --fs-body: var(--ztms-type-body);
  --fs-caption: var(--ztms-type-caption);
  --fs-micro: var(--ztms-type-caption);
}

html,
body,
button,
input,
select,
textarea,
table,
dialog {
  font-family: var(--ztms-font-ui);
}

body {
  color: var(--ztms-text-primary);
  font-size: var(--ztms-type-body) !important;
  line-height: var(--ztms-leading-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
select,
textarea {
  font-size: var(--ztms-type-body) !important;
  line-height: 1.45;
}

.hgi-stroke {
  font-family: "hugeicons-stroke-rounded" !important;
}

code,
.batch-id {
  font-family: var(--ztms-font-mono) !important;
}

h1,
.main h1,
.resource-heading h1,
.progress-page-head h1,
.campaign-heading h1 {
  color: var(--ztms-text-primary);
  font-size: var(--ztms-type-page) !important;
  font-weight: 600 !important;
  line-height: var(--ztms-leading-page) !important;
  letter-spacing: -.02em !important;
}

h2,
.modal-head h2,
.pack-drawer-head h2,
.market-assign-drawer > header h2,
.profile-head h2,
.evidence-head h2 {
  color: var(--ztms-text-primary);
  font-size: var(--ztms-type-section) !important;
  font-weight: 600 !important;
  line-height: var(--ztms-leading-section) !important;
  letter-spacing: -.01em !important;
}

h3,
.card h3,
.task h3,
.recommendation-header h3 {
  font-size: var(--ztms-type-card) !important;
  font-weight: 600 !important;
  line-height: 1.5 !important;
}

p,
li,
dd,
td {
  line-height: var(--ztms-leading-body);
}

.recommendation-section > p,
.profile-section p,
.profile-section dd,
.hunyuan-advice-item p,
.market-assign-body > p {
  color: #343a40;
  font-size: var(--ztms-type-reading) !important;
  line-height: var(--ztms-leading-reading) !important;
}

small,
.step-label,
.table-head,
th,
.privacy-note,
.pack-drawer-note,
.market-source-card span,
.market-source-card small {
  color: var(--ztms-text-secondary);
  font-size: var(--ztms-type-caption) !important;
  line-height: 1.5 !important;
}

.summary strong,
.metric strong,
.resource-kpis strong,
.overview-kpis strong,
.recommendation-probability strong {
  color: var(--ztms-text-primary);
  font-variant-numeric: tabular-nums;
  font-weight: 600 !important;
}

.primary,
.button-primary,
button.primary {
  border-color: var(--ztms-primary) !important;
  background: var(--ztms-primary) !important;
  color: #fff !important;
  font-weight: 600 !important;
}

.primary:hover,
.button-primary:hover,
button.primary:hover {
  border-color: #2b2e33 !important;
  background: #2b2e33 !important;
}

.secondary,
.button-secondary,
button.secondary {
  border-color: var(--ztms-line-strong) !important;
  background: #fff !important;
  color: #343a40 !important;
  font-weight: 500 !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--ztms-brand) !important;
  outline-offset: 2px;
}

dialog::backdrop {
  background: rgba(23, 25, 28, .42) !important;
}

.modal-card,
.pack-drawer,
.market-assign-drawer,
.profile-drawer,
.evidence-drawer,
.dispatch-card {
  color: var(--ztms-text-primary);
  background: var(--ztms-canvas) !important;
}

.modal-head,
.pack-drawer-head,
.market-assign-drawer > header,
.profile-head,
.evidence-head {
  border-bottom-color: var(--ztms-line) !important;
}

.modal-foot,
.market-assign-drawer > footer {
  border-top-color: var(--ztms-line) !important;
  background: var(--ztms-canvas) !important;
}

.toast {
  color: #fff !important;
  font-size: var(--ztms-type-label) !important;
  font-weight: 500;
  line-height: 1.5 !important;
}

body[data-route="market"] #resourcesView .resource-heading-actions > :not(#openImport):not(#exportQualityLeads) {
  display: none !important;
}

body[data-route="market"] #resourcesView .resource-heading-actions {
  gap: 8px;
}

body[data-route="market"] #openImport,
body[data-route="market"] #exportQualityLeads {
  width: auto !important;
  min-width: max-content;
  white-space: nowrap;
}

body[data-route="market"] .home-pack-state,
body[data-route="market"] .detail-empty {
  border-color: var(--ztms-line) !important;
  background: var(--ztms-surface) !important;
  color: var(--ztms-text-secondary) !important;
}

body[data-route="market"] .market-bootstrap-empty {
  min-height: 180px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
}

body[data-route="market"] .market-bootstrap-empty strong {
  color: var(--ztms-text-primary) !important;
  font-size: var(--ztms-type-card) !important;
  line-height: 1.5 !important;
}

body[data-route="market"] .market-bootstrap-empty span,
body[data-route="market"] .market-bootstrap-empty small,
body[data-route="market"] .market-crawl-expectation p {
  color: var(--ztms-text-secondary) !important;
  font-size: var(--ztms-type-body) !important;
  line-height: var(--ztms-leading-reading) !important;
}

body[data-route="market"] .market-progress-empty {
  min-height: 190px;
  display: flex;
  align-items: center;
}

body[data-route="market"] .market-crawl-expectation {
  width: 100%;
  padding: 24px;
}

body[data-route="market"] .market-crawl-expectation span {
  color: var(--ztms-text-tertiary);
  font-size: var(--ztms-type-caption);
}

body[data-route="market"] .market-crawl-expectation strong {
  display: block;
  margin: 8px 0;
  color: var(--ztms-text-primary);
  font-size: var(--ztms-type-card);
  line-height: 1.6;
}

body[data-route="market"] .recommendation-card,
body[data-route="market"] .detail-card {
  color: var(--ztms-text-primary);
}

body[data-route="market"] .recommendation-summary,
body[data-route="market"] .recommendation-reason > p,
body[data-route="market"] .recommendation-action > p {
  font-size: var(--ztms-type-reading) !important;
  line-height: var(--ztms-leading-reading) !important;
}

@media (max-width: 900px) {
  :root { --ztms-type-page: 22px; }
  .modal-card,
  .market-assign-drawer,
  .profile-drawer,
  .evidence-drawer { max-width: 100vw; }

  .mobile-menu-toggle .hgi-stroke,
  .notice > .hgi-stroke { display: none !important; }

  .mobile-menu-toggle::before {
    content: "";
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
  }
}
