/* Metal Price Hub — Chinese nonferrous metals market theme (红涨绿跌, #1958FF primary). */

:root {
  --primary: #1958FF;
  --primary-dark: #0943DD;
  --bg-page: #F5F7FA;
  --surface: #F0F2F6;
  --zebra: #F3F6FF;
  --card: #FFFFFF;
  --fg: #1E293B;
  --fg-soft: #475569;
  --fg-muted: #64748B;
  --border: #E2E8F0;
  --up: #C22439;
  --up-soft: #FEF2F2;
  --down: #16A34A;
  --down-soft: #F0FDF4;
  --flat: #64748B;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-page);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.55;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: #CC1B1B; text-decoration: underline; }

.mph-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Topbar & Navbar ---------- */
.mph-topbar {
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
}
.mph-topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
  gap: 16px;
}
.mph-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--fg);
}
.mph-brand:hover { text-decoration: none; color: var(--fg); }
.mph-brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--primary);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.5px;
}
.mph-brand__text { display: flex; flex-direction: column; }
.mph-brand__text strong { font-size: 18px; line-height: 1.2; color: #0F172A; }
.mph-brand__text small { font-size: 11px; color: var(--fg-muted); }
.mph-topbar__meta {
  display: flex;
  gap: 20px;
  font-size: 12px;
  color: var(--fg-muted);
}

.mph-navbar {
  background: var(--primary);
  box-shadow: 0 2px 6px rgba(25, 88, 255, 0.18);
}
.mph-navlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
}
.mph-navlist__link {
  display: block;
  padding: 0 18px;
  height: 48px;
  line-height: 48px;
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 500;
  transition: background 120ms ease;
}
.mph-navlist__link:hover {
  background: var(--primary-dark);
  color: #FFFFFF;
  text-decoration: none;
}
.mph-navlist__link.is-active {
  background: var(--primary-dark);
  color: #FDE047;
  font-weight: 700;
}

/* ---------- Main & Panels ---------- */
.mph-main {
  padding: 22px 0 48px;
}
.mph-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.mph-panel__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.mph-h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
  color: #0F172A;
}
.mph-sub {
  margin: 0;
  font-size: 13px;
  color: var(--fg-muted);
}
.mph-section {
  margin-bottom: 24px;
}
.mph-section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  border-left: 5px solid var(--primary);
  padding-left: 10px;
  margin: 0 0 14px;
  line-height: 1.2;
}
.mph-unit-tag {
  font-size: 13px;
  font-weight: 400;
  color: var(--fg-muted);
}
.mph-breadcrumb {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 14px;
}

/* ---------- Inputs & Buttons ---------- */
.mph-input, .mph-select {
  height: 36px;
  padding: 0 12px;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  background: #FFFFFF;
  color: var(--fg);
  font-size: 14px;
}
.mph-search-box .mph-input {
  width: 260px;
}
.mph-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 120ms ease;
}
.mph-btn--primary {
  background: var(--primary);
  color: #FFFFFF;
}
.mph-btn--primary:hover {
  background: var(--primary-dark);
  color: #FFFFFF;
  text-decoration: none;
}
.mph-btn--outline {
  background: #FFFFFF;
  color: var(--primary);
  border-color: var(--primary);
}
.mph-btn--outline:hover {
  background: var(--zebra);
  text-decoration: none;
}

/* ---------- Tables ---------- */
.mph-table-wrap {
  overflow-x: auto;
}
.mph-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  background: #FFFFFF;
}
.mph-table th {
  background: var(--surface);
  color: #0F172A;
  font-weight: 600;
  font-size: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.mph-table td {
  padding: 11px 14px;
  font-size: 14px;
  color: #334155;
  border-bottom: 1px solid #EEF2F6;
  white-space: nowrap;
}
.mph-table tbody tr:nth-child(even) {
  background: var(--zebra);
}
.mph-table tbody tr:hover {
  background: #E8EEFF;
}
.mph-table th.mph-table__num,
.mph-table__num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.mph-price-strong {
  font-weight: 700;
  color: #0F172A;
}
.mph-name-cell a {
  font-weight: 600;
  color: #0F172A;
}
.mph-name-cell a:hover {
  color: #CC1B1B;
}
.mph-code-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 11px;
  color: var(--fg-muted);
  background: var(--surface);
  border-radius: 4px;
  font-family: ui-monospace, monospace;
}
.mph-table td.is-up, .mph-summary-col__val.is-up, .is-up { color: var(--up); font-weight: 600; }
.mph-table td.is-down, .mph-summary-col__val.is-down, .is-down { color: var(--down); font-weight: 600; }
.mph-table td.is-flat, .mph-summary-col__val.is-flat, .is-flat { color: var(--flat); }

/* ---------- History Query Bar (.price_history) ---------- */
.mph-history-bar {
  background: #F7F8FA;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 20px;
  margin-bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mph-history-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.mph-history-form__label {
  font-size: 15px;
  font-weight: 700;
  color: #0F172A;
}
.mph-history-form__sep { color: var(--fg-muted); }
.mph-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mph-chip {
  font-size: 12px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg-soft);
  background: #FFFFFF;
}
.mph-chip:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
  text-decoration: none;
}

/* ---------- Today Price + Chart (.price_today) ---------- */
.mph-today-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.mph-table--compact th, .mph-table--compact td {
  padding: 9px 10px;
  font-size: 13px;
}
.mph-switcher-row { cursor: pointer; }
.mph-switcher-row.is-active {
  background: #DBEAFE !important;
  outline: 1px solid #93C5FD;
}
.mph-switcher-row.is-active td:first-child a {
  color: var(--primary);
  font-weight: 700;
}
.mph-today-chart {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.mph-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.mph-chart-title {
  font-size: 15px;
  font-weight: 700;
  color: #0F172A;
}
.mph-link-more {
  font-size: 13px;
  color: var(--fg-muted);
}
.mph-link-more:hover { color: var(--primary); }
.mph-chart-wrap {
  position: relative;
  background: #FAFBFD;
  border: 1px solid #EEF2F6;
  border-radius: 6px;
  padding: 6px;
}
#mph-home-chart-svg, #mph-chart-svg {
  width: 100%;
  height: 310px;
  display: block;
}
.mph-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.92);
  color: #FFFFFF;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  z-index: 20;
  white-space: nowrap;
}

/* ---------- 18-Metal Card Wall (.price_list) ---------- */
.mph-card-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(276px, 1fr));
  gap: 14px;
}
.mph-metal-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mph-metal-card__top {
  background: #FAFBFD;
  border-bottom: 1px solid #EEF2F6;
  padding: 12px 14px;
}
.mph-metal-card__title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.mph-metal-card__title-row h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.mph-metal-card__title-row h3 a { color: #0F172A; }
.mph-metal-card__title-row h3 a:hover { color: #CC1B1B; }
.mph-avg-badge {
  background: var(--primary);
  color: #FFFFFF;
  border-radius: 6px;
  padding: 4px 10px;
  text-align: center;
  min-width: 82px;
  line-height: 1.25;
}
.mph-avg-badge__date { display: block; font-size: 11px; opacity: 0.9; }
.mph-avg-badge__val { display: block; font-size: 15px; color: #FEF08A; }
.mph-metal-card__meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--fg-soft);
}
.mph-metal-card__links {
  list-style: none;
  margin: 0;
  padding: 10px 14px 4px;
  flex: 1;
}
.mph-metal-card__links li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px dashed #F1F5F9;
}
.mph-metal-card__links li:last-child { border-bottom: none; }
.mph-metal-card__links a { color: #334155; }
.mph-metal-card__links a:hover { color: #CC1B1B; }
.mph-metal-card__mini { color: var(--fg-muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.mph-metal-card__foot {
  padding: 6px 14px 10px;
  text-align: right;
}

/* ---------- Category Detail Summary Banner (.infor_top_title) ---------- */
.mph-infor-top { margin-bottom: 18px; }
.mph-summary-banner {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr 1.8fr 1.6fr;
  background: #EBEFFA;
  border: 1px solid #D6E0FA;
  border-radius: 8px;
  padding: 16px 20px;
  margin-top: 12px;
  align-items: center;
  gap: 12px;
}
.mph-summary-col { text-align: center; }
.mph-summary-col__label {
  display: block;
  font-size: 14px;
  color: var(--fg-soft);
  margin-bottom: 6px;
}
.mph-summary-col__val {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: #1E293B;
}
.mph-summary-col__val--primary { color: var(--primary); }
.mph-summary-col--avgs {
  text-align: left;
  border-left: 1px solid #CBD5E1;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mph-summary-col--avgs div {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--fg-soft);
}
.mph-summary-col--avgs strong { color: #0F172A; font-variant-numeric: tabular-nums; }

/* ---------- Quote Detail Page ---------- */
.mph-quote-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}
.mph-quote-title {
  font-size: 24px;
  text-align: center;
  margin: 6px 0 10px;
  color: #0F172A;
}
.mph-quote-meta {
  text-align: center;
  color: var(--fg-muted);
  font-size: 13px;
  margin: 0 0 20px;
}
.mph-quote-prose {
  font-size: 16px;
  line-height: 1.8;
  color: #1E293B;
  text-indent: 2em;
  margin: 22px 0;
}
.mph-quote-tags {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.mph-quote-tags a {
  padding: 6px 16px;
  background: var(--surface);
  border-radius: 999px;
  font-size: 13px;
  color: var(--fg-soft);
}
.mph-recommend-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mph-recommend-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}
.mph-recommend-list li:last-child { border-bottom: none; }
.mph-recommend-list span { color: var(--fg-muted); font-size: 13px; }
.mph-tag-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.mph-tag-grid a {
  display: block;
  padding: 9px 8px;
  text-align: center;
  background: #FAFBFD;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--fg-soft);
}
.mph-tag-grid a:hover, .mph-tag-grid a.is-current {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

/* ---------- Status Pills & Empty ---------- */
.mph-status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface);
  color: var(--fg-soft);
}
.mph-status-pill--ok { background: var(--down-soft); color: var(--down); }
.mph-status-pill--failed, .mph-status-pill--aborted, .mph-status-pill--audit_failed {
  background: var(--up-soft);
  color: var(--up);
}
.mph-empty {
  text-align: center;
  padding: 28px;
  color: var(--fg-muted);
}
.mph-muted { color: var(--fg-muted); }

/* ---------- Footer ---------- */
.mph-footer {
  background: #EEEEEE;
  border-top: 1px solid var(--border);
  padding: 20px 0;
  font-size: 12px;
  color: var(--fg-muted);
}
.mph-footer__inner p { margin: 4px 0; }
.mph-footer__links a {
  color: var(--primary);
  text-decoration: none;
}
.mph-footer__links a:hover { text-decoration: underline; }
.mph-footer__links span { color: var(--fg-muted); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .mph-today-grid { grid-template-columns: 1fr; }
  .mph-summary-banner { grid-template-columns: repeat(2, 1fr); }
  .mph-summary-col--avgs { border-left: none; padding-left: 0; grid-column: 1 / -1; }
  .mph-quote-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .mph-topbar__inner { flex-direction: column; align-items: flex-start; }
  .mph-search-box .mph-input { width: 100%; }
  .mph-navlist__link { padding: 0 12px; height: 42px; line-height: 42px; font-size: 14px; }
}

/* ---------- Notice Bar, Ad Slots, Alerts & Admin ---------- */
.mph-notice-bar {
  background: #FFF7ED;
  border-bottom: 1px solid #FED7AA;
  color: #9A3412;
  font-size: 13px;
  padding: 6px 0;
  text-align: center;
}
.mph-ad-slot {
  background: #FFFFFF;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.mph-ad-slot--footer {
  border-top: 1px solid var(--border);
  border-bottom: none;
  margin-top: 12px;
}
.mph-ad-box {
  text-align: center;
  overflow: hidden;
  border-radius: 6px;
}
.mph-ad-box img {
  max-width: 100%;
  height: auto;
  display: inline-block;
}
.mph-span-hint {
  font-size: 12px;
  color: var(--fg-muted);
  align-self: center;
}
.mph-alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 14px;
}
.mph-alert--warn,
.mph-alert--warning {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: #92400E;
}
.mph-alert--error {
  background: var(--up-soft);
  border: 1px solid #FECACA;
  color: var(--up);
}
.mph-alert--success {
  background: var(--down-soft);
  border: 1px solid #BBF7D0;
  color: #166534;
}
.mph-field__hint {
  color: var(--fg-muted);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 4px;
}
.mph-field__hint--block {
  display: block;
  margin: 12px 0 0;
}
.mph-btn--ghost {
  background: transparent;
  color: var(--fg-soft);
  border: 1px solid var(--border);
}
.mph-btn--ghost:hover {
  background: var(--surface);
  text-decoration: none;
}
.mph-btn--block {
  width: 100%;
}
.mph-admin-login-wrap {
  display: flex;
  justify-content: center;
  padding: 36px 0;
}
.mph-admin-login-card {
  width: 100%;
  max-width: 420px;
}
.mph-admin-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}
.mph-admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.mph-admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.mph-stat-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.mph-stat-card__label {
  display: block;
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 6px;
}
.mph-stat-card__val {
  font-size: 24px;
  color: #0F172A;
}
.mph-stat-card__val--sm {
  font-size: 16px;
}
.mph-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.mph-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--fg-soft);
}
.mph-field--full {
  grid-column: 1 / -1;
}
.mph-field--checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #0F172A;
}
.mph-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}
.mph-admin-savebar {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
@media (max-width: 720px) {
  .mph-form-grid { grid-template-columns: 1fr; }
}
