:root {
  --ink: #172033;
  --muted: #667085;
  --line: #dfe5ec;
  --surface: #ffffff;
  --surface-soft: #f5f7fa;
  --navy: #101828;
  --copper: #b76334;
  --copper-soft: #fbf1eb;
  --aluminum: #64748b;
  --aluminum-soft: #f0f4f8;
  --silver: #7c8798;
  --fresh: #067647;
  --fresh-soft: #ecfdf3;
  --stale: #b54708;
  --stale-soft: #fffaeb;
  --failed: #b42318;
  --failed-soft: #fef3f2;
  --shadow: 0 18px 50px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--surface-soft);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

body {
  margin: 0;
  min-width: 320px;
}

.login-body {
  background: #edf1f5;
  min-height: 100vh;
}

.login-shell {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 420px;
  padding: 34px;
  width: 100%;
}

.login-panel .eyebrow {
  color: var(--copper);
}

.login-panel h1 {
  color: var(--navy);
  font-size: 28px;
  letter-spacing: 0;
  margin-bottom: 28px;
}

.login-panel form {
  display: grid;
  gap: 10px;
}

.login-panel label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.login-panel input {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font: inherit;
  margin-bottom: 8px;
  min-height: 44px;
  padding: 9px 11px;
  width: 100%;
}

.login-panel input:focus {
  border-color: var(--copper);
  box-shadow: 0 0 0 3px rgba(183, 99, 52, 0.14);
  outline: 0;
}

.login-panel button {
  background: var(--navy);
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 44px;
}

.login-panel button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.login-error {
  color: var(--failed);
  font-size: 13px;
  margin: 0;
  min-height: 20px;
}

button,
table {
  font: inherit;
}

.site-header {
  background:
    radial-gradient(circle at 82% 20%, rgba(183, 99, 52, 0.22), transparent 28%),
    linear-gradient(135deg, #101828 0%, #1d2939 100%);
  color: white;
  padding: 38px 24px 82px;
}

.header-inner,
.page-shell,
footer p {
  margin: 0 auto;
  max-width: 1280px;
}

.header-inner {
  align-items: flex-end;
  display: flex;
  gap: 28px;
  justify-content: space-between;
}

.eyebrow,
.section-kicker,
.market-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin: 0 0 9px;
  text-transform: uppercase;
}

.eyebrow {
  color: #d6a287;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 48px);
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.subtitle {
  color: #cbd5e1;
  font-size: 16px;
  margin: 0;
}

.refresh-panel {
  text-align: right;
}

.header-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.refresh-panel button {
  background: #ffffff;
  border: 0;
  border-radius: 10px;
  color: var(--navy);
  cursor: pointer;
  font-weight: 700;
  min-width: 112px;
  padding: 11px 18px;
  transition: transform 160ms ease, opacity 160ms ease;
}

.refresh-panel button:hover {
  transform: translateY(-1px);
}

.refresh-panel .secondary-button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.42);
  color: #ffffff;
  min-width: 96px;
}

.refresh-panel button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.refresh-panel p {
  color: #cbd5e1;
  font-size: 12px;
  margin: 10px 0 0;
}

.refresh-panel .logout-error {
  color: #fecaca;
  font-weight: 700;
  min-height: 18px;
}

.page-shell {
  margin-top: -46px;
  padding: 0 24px 58px;
}

.notice {
  align-items: flex-start;
  background: #fffaf5;
  border: 1px solid #fedfbd;
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
  padding: 18px 20px;
}

.notice-mark {
  align-items: center;
  background: var(--copper);
  border-radius: 50%;
  color: white;
  display: flex;
  flex: 0 0 26px;
  font-size: 15px;
  font-weight: 800;
  height: 26px;
  justify-content: center;
}

.notice h2 {
  font-size: 15px;
  margin-bottom: 4px;
}

.notice p {
  color: #6b3d25;
  font-size: 13px;
  line-height: 1.7;
  margin: 0;
}

.load-status {
  color: var(--muted);
  font-size: 13px;
  margin: 18px 2px 28px;
  min-height: 20px;
}

.load-status.error {
  color: var(--failed);
}

.monitor-section {
  border-top: 1px solid var(--line);
  margin: 26px 0 36px;
  padding-top: 24px;
}

.monitor-heading {
  align-items: flex-start;
  display: flex;
  gap: 20px;
  justify-content: space-between;
}

.monitor-heading h2 {
  font-size: 24px;
  margin: 0 0 6px;
}

.monitor-subtitle,
.monitor-chart-heading > span,
.monitor-load-status,
.monitor-boundary {
  color: var(--muted);
  font-size: 12px;
}

.monitor-subtitle {
  margin: 0;
}

.monitor-load-status {
  min-height: 18px;
  margin: 16px 0;
}

.monitor-load-status.error {
  color: var(--failed);
}

.monitor-metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.monitor-metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 122px;
  padding: 16px;
}

.monitor-metric p,
.monitor-metric span {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.monitor-metric strong {
  display: block;
  font-size: 26px;
  line-height: 1.2;
  margin: 17px 0 4px;
  overflow-wrap: anywhere;
}

.monitor-metric-shfe {
  border-top: 3px solid var(--copper);
}

.monitor-metric-lme {
  border-top: 3px solid var(--aluminum);
}

.monitor-metric-fx,
.monitor-metric-ratio {
  border-top: 3px solid var(--silver);
}

.monitor-metric-spread {
  border-top: 3px solid var(--fresh);
}

.monitor-details {
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px 22px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
  padding: 13px 0;
}

.monitor-details div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.monitor-details span:first-child {
  color: var(--muted);
  font-size: 11px;
}

.monitor-details time,
.monitor-details span:last-child {
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.monitor-decision {
  border-left: 3px solid var(--copper);
  margin-top: 18px;
  padding: 2px 0 2px 14px;
}

.monitor-decision > div {
  align-items: baseline;
  display: flex;
  gap: 12px;
}

.monitor-label {
  color: var(--muted);
  font-size: 11px;
  margin: 0;
}

.monitor-decision strong {
  font-size: 15px;
}

.monitor-decision > p {
  font-size: 13px;
  line-height: 1.65;
  margin: 7px 0 0;
}

.monitor-alert,
.monitor-ai {
  color: var(--muted);
}

.monitor-trend-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 24px;
}

.monitor-chart-area {
  border-top: 1px solid var(--line);
  min-width: 0;
  padding-top: 16px;
}

.monitor-chart-heading {
  align-items: flex-end;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.monitor-chart-heading h3 {
  font-size: 16px;
  margin: 0;
}

.monitor-chart-heading > span {
  white-space: nowrap;
}

.monitor-chart-frame {
  min-height: 245px;
  position: relative;
}

.monitor-chart-frame svg {
  display: block;
  height: 245px;
  overflow: visible;
  width: 100%;
}

.monitor-boundary {
  border-top: 1px solid var(--line);
  line-height: 1.7;
  margin: 20px 0 0;
  padding-top: 13px;
}

.section-heading,
.panel-heading {
  align-items: flex-end;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-heading h2,
.panel-heading h2 {
  font-size: 22px;
  letter-spacing: -0.02em;
  margin: 0;
}

.section-heading > p,
.panel-heading > p {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
  text-align: right;
}

.section-kicker {
  color: var(--copper);
  margin-bottom: 5px;
}

.price-groups {
  display: grid;
  gap: 18px;
}

.price-grid {
  display: grid;
  gap: 18px;
}

.price-grid-domestic {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.price-grid-international {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.price-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(16, 24, 40, 0.05);
}

.price-card {
  border-top: 4px solid var(--copper);
  min-height: 272px;
  padding: 20px;
}

.price-card.aluminum-card {
  border-top-color: var(--aluminum);
}

.price-card.silver-card {
  border-top-color: var(--silver);
}

.card-heading {
  align-items: flex-start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.market-label {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  margin-bottom: 7px;
}

.card-heading h3 {
  font-size: 17px;
  margin: 0;
}

.status-badge {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
  white-space: nowrap;
}

.status-fresh {
  background: var(--fresh-soft);
  color: var(--fresh);
}

.status-stale {
  background: var(--stale-soft);
  color: var(--stale);
}

.status-failed {
  background: var(--failed-soft);
  color: var(--failed);
}

.status-pending {
  background: #f2f4f7;
  color: var(--muted);
}

.price-line {
  align-items: baseline;
  display: flex;
  gap: 8px;
  margin: 28px 0 24px;
}

.price-line strong {
  font-size: clamp(30px, 3.1vw, 42px);
  letter-spacing: -0.05em;
  line-height: 1;
}

.price-line span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.card-details {
  display: grid;
  gap: 10px;
  margin: 0;
}

.card-details div {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.card-details dt,
.card-details dd {
  font-size: 12px;
  margin: 0;
}

.card-details dt {
  color: var(--muted);
}

.card-details dd {
  font-weight: 600;
  max-width: 62%;
  overflow-wrap: anywhere;
  text-align: right;
}

.change-up {
  color: var(--failed);
}

.change-down {
  color: var(--fresh);
}

.trend-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 34px;
}

.panel {
  padding: 22px;
}

.legend {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 11px;
  gap: 12px;
}

.legend span {
  align-items: center;
  display: inline-flex;
  gap: 5px;
}

.legend i {
  border-radius: 50%;
  display: inline-block;
  height: 8px;
  width: 8px;
}

.legend-copper {
  background: var(--copper);
}

.legend-aluminum {
  background: var(--aluminum);
}

.legend-silver {
  background: var(--silver);
}

.chart-frame {
  min-height: 285px;
  position: relative;
}

.chart-frame svg {
  display: block;
  height: 285px;
  overflow: visible;
  width: 100%;
}

.chart-empty {
  color: var(--muted);
  font-size: 13px;
  left: 50%;
  margin: 0;
  position: absolute;
  text-align: center;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
}

.chart-gridline {
  stroke: #e9edf2;
  stroke-width: 1;
}

.chart-label {
  fill: #7a8494;
  font-size: 10px;
}

.chart-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.chart-dot {
  stroke: white;
  stroke-width: 2;
}

.health-panel {
  margin-top: 18px;
}

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

table {
  border-collapse: collapse;
  min-width: 850px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid #edf0f4;
  font-size: 12px;
  padding: 13px 12px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.table-empty {
  color: var(--muted);
  padding: 30px;
  text-align: center;
}

footer {
  background: var(--navy);
  color: #aeb8c8;
  font-size: 12px;
  padding: 22px 24px;
}

footer p {
  margin-bottom: 0;
}

@media (max-width: 1050px) {
  .price-grid-domestic,
  .price-grid-international {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trend-grid {
    grid-template-columns: 1fr;
  }

  .monitor-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .monitor-details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .site-header {
    padding: 30px 18px 76px;
  }

  .header-inner,
  .section-heading,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .refresh-panel,
  .section-heading > p,
  .panel-heading > p {
    text-align: left;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .page-shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  .notice {
    border-radius: 12px;
  }

  .price-grid-domestic,
  .price-grid-international {
    grid-template-columns: 1fr;
  }

  .price-card {
    min-height: auto;
  }

  .monitor-heading {
    flex-direction: column;
  }

  .monitor-metrics,
  .monitor-details,
  .monitor-trend-grid {
    grid-template-columns: 1fr;
  }

  .monitor-metric {
    min-height: 110px;
  }

  .monitor-chart-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel {
    padding: 18px 14px;
  }

  .chart-frame,
  .chart-frame svg {
    min-height: 245px;
  }
}
