:root {
  --bg: #08111b;
  --bg2: #0f1f2f;
  --panel: rgba(12, 24, 36, 0.82);
  --ink: #ecf2f8;
  --muted: #93a7ba;
  --line: rgba(236, 242, 248, 0.12);
  --accent: #ffc86b;
  --up: #51d289;
  --warn: #ff9f43;
  --down: #ff6b6b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Segoe UI", "Arial", sans-serif;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 80% 10%, rgba(255, 200, 107, 0.2), transparent 35%),
    radial-gradient(circle at 10% 10%, rgba(81, 210, 137, 0.16), transparent 30%),
    linear-gradient(140deg, var(--bg), var(--bg2));
}

.pull-refresh-indicator {
  position: fixed;
  left: 50%;
  top: 8px;
  transform: translate(-50%, -56px);
  z-index: 60;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  color: #ffe3bb;
  background: rgba(8, 20, 32, 0.92);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.pull-refresh-indicator.visible {
  opacity: 1;
}

.pull-refresh-indicator.armed {
  color: #b8f0ce;
  border-color: rgba(81, 210, 137, 0.45);
}

.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 20px calc(42px + env(safe-area-inset-bottom));
  display: grid;
  gap: 18px;
}

.asset-context-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.asset-context-tabs button {
  border-radius: 999px;
  padding: 6px 12px;
}

.asset-context-status {
  margin-bottom: 10px;
}

.asset-context-actions {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.asset-context-actions-row {
  gap: 8px;
}

.asset-context-note {
  margin: 0;
}

.diagnostics-details {
  margin-top: 14px;
}

.asset-context-body {
  display: grid;
  gap: 12px;
}

.asset-context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.asset-context-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 20, 32, 0.62);
  padding: 12px;
}

.asset-context-card h3,
.asset-context-card h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.asset-context-card strong {
  display: block;
  font-size: 18px;
  margin-bottom: 6px;
}

.asset-context-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.asset-context-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.asset-context-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.asset-context-badge-up {
  color: var(--up);
  border-color: rgba(59, 201, 138, 0.35);
}

.asset-context-badge-warn {
  color: var(--warn);
  border-color: rgba(255, 182, 72, 0.35);
}

.asset-context-badge-neutral {
  color: var(--muted);
}

.asset-context-provenance {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.asset-context-card.is-up strong {
  color: var(--up);
}

.asset-context-card.is-down strong {
  color: var(--down);
}

.asset-context-card.is-neutral strong {
  color: var(--ink);
}

.asset-context-list,
.asset-context-sources,
.asset-alert-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.asset-context-warning {
  color: var(--warn);
  font-size: 13px;
}

.asset-alert-manager {
  display: grid;
  gap: 10px;
}

.asset-alert-storage {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
}

.asset-alert-storage.is-best-effort {
  border-color: rgba(255, 182, 72, 0.35);
}

.asset-alert-storage.is-stable {
  border-color: rgba(59, 201, 138, 0.35);
}

.asset-alert-storage strong {
  display: block;
  margin-bottom: 4px;
}

.asset-alert-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(120px, 0.8fr) minmax(140px, 0.9fr) auto;
  gap: 10px;
  align-items: end;
}

.asset-alert-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.asset-alert-form input,
.asset-alert-form select {
  width: 100%;
}

.asset-alert-backup-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.asset-alert-backup-meta {
  margin: -2px 0 2px;
  font-size: 12px;
}

.asset-alert-rule {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(8, 20, 32, 0.45);
}

.asset-alert-rule-main {
  display: grid;
  gap: 4px;
}

.asset-alert-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.asset-alert-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid var(--line);
}

.asset-alert-pill.is-triggered {
  border-color: rgba(255, 159, 67, 0.65);
  color: #ffd5a3;
}

.asset-alert-pill.is-idle {
  color: var(--muted);
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.kicker {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 44px);
}

.hero p { margin: 6px 0 0; color: var(--muted); }

.hero-subtitle-row {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.hero-subtitle-row #hero-subtitle {
  margin: 0;
  flex: 1 1 100%;
  min-width: 0;
}

.hero .hero-forecast-title {
  margin: 18px 0 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9db2c6;
  font-weight: 700;
}

.hero-forecast-row {
  margin-top: 0;
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: minmax(300px, 1.7fr) minmax(170px, 1fr) minmax(170px, 1fr) auto;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.hero-forecast-item {
  min-width: 0;
  border: 1px solid rgba(147, 167, 186, 0.3);
  background: rgba(8, 18, 30, 0.42);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  color: #deebf7;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  justify-self: stretch;
  gap: 4px;
}

.hero-h-label {
  color: #eaf2fa;
  font-weight: 700;
  margin-right: 8px;
}

#hero-ct-main,
#hero-mt-summary,
#hero-lt-summary {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
}

.hero-ct-mainline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
}

.hero-ct-change {
  font-weight: 700;
}

.hero-kicker {
  color: #eaf2fa;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.hero-main-value {
  font-size: 16px;
  line-height: 1.1;
  font-weight: 700;
}

.hero-forecast-item .trend-num-up {
  color: #4de08f !important;
  text-shadow: 0 0 8px rgba(77, 224, 143, 0.35);
}

.hero-forecast-item .trend-num-down {
  color: #ff7676 !important;
  text-shadow: 0 0 8px rgba(255, 118, 118, 0.3);
}

.hero-forecast-item .trend-num-up::before,
.hero-forecast-item .trend-num-down::before,
.hero-forecast-item .trend-num-flat::before {
  content: "" !important;
}

.hero-forecast-item + .hero-forecast-item {
  padding-left: 7px;
  border-left: 0;
}

.hero-ct-item {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.hero-ct-sub {
  font-size: 13px;
  color: #9fb2c6;
  font-weight: 500;
  line-height: 1.35;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-sub-row {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.hero-sub-key {
  color: #94a9be;
  font-size: 12px;
}

.hero-sub-val {
  color: #dbe8f4;
  font-size: 13px;
}

.hero-sub-sep {
  color: #5f7287;
}

.hero-mini-label {
  color: #9fb2c6;
  font-size: 12px;
  letter-spacing: 0.03em;
  font-weight: 600;
}

.hero-mini-value {
  font-size: 15px;
  line-height: 1.1;
  font-weight: 700;
}

.hero-mini-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.hero-mini-main {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.hero-mini-sub {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  color: #94a9be;
  font-size: 12px;
  line-height: 1.3;
}

.hero-mini-divider {
  color: #5f7287;
}

.hero-mini-context {
  color: #a9bdd0;
}

.hero-mini-compare {
  font-weight: 600;
}

#hero-source-btn {
  margin-left: 0;
  align-self: center;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 15px;
  letter-spacing: 0.04em;
  flex: 0 0 auto;
  line-height: 1.1;
  color: #ffe3bb;
  border-color: rgba(255, 200, 107, 0.7);
  background: rgba(255, 200, 107, 0.18);
}

.source-popover {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(3, 9, 14, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.source-popover[hidden] {
  display: none;
}

.source-popover-card {
  width: min(720px, 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 20, 32, 0.95);
  padding: 14px;
  display: grid;
  gap: 10px;
}

.source-popover-title {
  margin: 0;
  color: #f4fbff;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.source-popover-text {
  margin: 0;
  line-height: 1.45;
  color: #d7e5f3;
  word-break: break-word;
  white-space: pre-wrap;
}

.source-popover-card button {
  justify-self: start;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 8px;
  min-width: 220px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--panel);
}
.metric span { color: var(--muted); font-size: 12px; display: block; }
.metric strong { font-size: 20px; }
.metric small { color: var(--muted); font-size: 11px; display: block; margin-top: 4px; }
.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.metric-selector .metric-top {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}
.metric-selector .metric-top > span {
  display: block;
}
.metric-top .row {
  margin-left: auto;
  justify-content: flex-end;
}
.metric-selector .metric-top .row {
  margin-left: 0;
  justify-content: flex-start;
}
.metric-top button {
  margin-left: auto;
}
.metric-top .row button {
  margin-left: 0;
}
.metric-top #metal-buttons,
.metric-top #lang-buttons,
.metric-top #currency-buttons {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
}
.metric-top #metal-buttons button,
.metric-top #lang-buttons button,
.metric-top #currency-buttons button {
  flex: 0 0 auto;
  white-space: nowrap;
}
.metric-selector #metal-buttons,
.metric-selector #lang-buttons,
.metric-selector #currency-buttons {
  width: 100%;
}
.metric-top strong {
  margin-left: 8px;
  text-align: right;
  font-size: 16px;
}
.metric-actions { margin-top: 8px; }
.metric-actions button {
  width: auto;
  margin-left: auto;
  display: block;
  border-radius: 10px;
  padding: 7px 10px;
}

.metric-next-update .metric-actions {
  margin-top: 6px;
}

.metric-market {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 74px;
  background:
    radial-gradient(circle at top right, rgba(255, 200, 107, 0.08), transparent 48%),
    linear-gradient(180deg, rgba(11, 24, 38, 0.96), rgba(8, 18, 30, 0.92));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 24px rgba(0, 0, 0, 0.16);
}

.metric-market-top {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  gap: 10px;
}

.metric-market-top > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-market #market-session-status {
  display: block;
  width: 100%;
  padding: 0;
  margin-left: 0;
  font-size: 15px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-align: left;
  text-transform: uppercase;
}

.metric-market #market-session-status.market-status-open {
  color: var(--up);
}

.metric-market #market-session-status.market-status-closed {
  color: #ff6b6b;
}

.metric-market #market-session-status.market-status-limited {
  color: var(--accent);
}

.metric-mode {
  grid-column: 1 / -1;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: var(--panel);
  backdrop-filter: blur(4px);
  min-width: 0;
}

.mt-10 {
  margin-top: 10px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  gap: 10px;
  align-items: stretch;
  padding: 10px;
}
.controls .control-label {
  margin: 0 0 6px;
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.bb-tape {
  grid-column: 1 / -1;
  display: block;
  background: #0b0f14;
  border: 1px solid #1c2430;
  border-radius: 8px;
  padding: 6px 10px;
  position: sticky;
  top: 6px;
  z-index: 8;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}

#tech-intl-content .bb-tape {
  position: static;
  top: auto;
}

.bb-tape-track {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 100%;
}

.bb-tape-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  color: #8a93a2;
}

.bb-tape-key {
  color: #8a93a2;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 11px;
}

.bb-tape-value {
  color: #e6eaf0;
}

.bb-tape-move.up {
  color: #3fb950;
}

.bb-tape-move.down {
  color: #f85149;
}

.bb-tape-sep {
  color: #556275;
}

.bb-tape-driver {
  color: #f0b429;
}

.control-cell {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 10px 12px;
  min-height: 86px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.controls .control-cell {
  padding: 6px 10px;
  min-height: 48px;
  justify-content: center;
}

.controls .control-label {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.control-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}
.control-top .row {
  margin-left: auto;
  justify-content: flex-end;
}

.control-active-model {
  min-width: 0;
}

.tech-intl-priority-stack {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.tech-intl-active-model {
  min-height: 0;
}

.active-forecast-model {
  min-height: 40px;
  font-size: 13px;
  width: 100%;
}

.ae-card {
  width: 100%;
  border: 1px solid #1c2430;
  background: #11161d;
  border-radius: 4px;
  padding: 12px;
  color: #e6eaf0;
  font-family: "Arial Narrow", "Segoe UI", Arial, sans-serif;
}
.ae-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.ae-title {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #8a93a2;
}
.ae-regime {
  margin-top: 4px;
  font-size: 13px;
  color: #e6eaf0;
}
.ae-mode {
  font-size: 11px;
  color: #f0b429;
  letter-spacing: 0.08em;
}
.ae-divider {
  height: 1px;
  background: #1c2430;
  margin: 8px 0;
}
.ae-ct {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.ae-label {
  color: #8a93a2;
  margin-right: 8px;
  font-size: 12px;
}
.ae-value {
  font-size: 16px;
  font-weight: 600;
}
.ae-mtlt {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}
.ae-mtlt > div {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.ae-horizons-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.ae-horizon-card {
  border: 1px solid #1c2430;
  border-radius: 8px;
  background: rgba(10, 18, 28, 0.72);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ae-horizon-card .ae-label {
  margin-right: 0;
}
.ae-horizon-card .ae-value {
  font-size: 14px;
}
.ae-value-sub {
  font-size: 11px;
  color: #8a93a2;
  line-height: 1.2;
}
.ae-ct-noedge {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  color: #f0b429;
  border: 1px solid rgba(240, 180, 41, 0.4);
  border-radius: 999px;
  padding: 2px 8px;
}
.ae-health {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: #8a93a2;
}
.ae-confidence {
  font-weight: 600;
}
.ae-confidence.unstable {
  color: #cc6f6f;
}
.ae-confidence.fragile {
  color: #caa66a;
}
.ae-confidence.stable {
  color: #c8d2de;
}
.ae-confidence.robust {
  color: #82b6a6;
}
.ae-confidence.calibrated {
  color: #7eb59a;
}
.ae-status {
  margin-top: 6px;
  font-size: 12px;
}
.ae-status.stable {
  color: #3fb950;
}
.ae-status.warning {
  color: #f0b429;
}
.ae-status.alert {
  color: #f85149;
}
.ae-process {
  margin-top: 8px;
  border-top: 1px solid #1c2430;
  padding-top: 8px;
}
.ae-process p {
  margin: 0 0 4px;
  font-size: 12px;
  color: #9aa4b3;
  line-height: 1.3;
}
.ae-process p:last-child {
  margin-bottom: 0;
}

.ae-integrity {
  margin-top: 8px;
  border-top: 1px solid #1c2430;
  padding-top: 8px;
}

.ae-integrity > summary {
  cursor: pointer;
  color: #8a93a2;
  font-size: 11px;
  letter-spacing: 0.05em;
  list-style: none;
}

.ae-integrity > summary::-webkit-details-marker {
  display: none;
}

.ae-integrity > summary::before {
  content: "▸";
  margin-right: 6px;
}

.ae-integrity[open] > summary::before {
  content: "▾";
}

.ae-integrity-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #c8d2de;
  margin-top: 5px;
}
.ae-integrity-row.ae-debug {
  color: #8a93a2;
  font-size: 11px;
}
.ae-integrity-row.ae-debug span:last-child {
  max-width: 75%;
  text-align: right;
  overflow-wrap: anywhere;
}
.ae-metrics-headline {
  margin-top: 6px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #c8d2de;
}
.ae-metrics-delta.good {
  color: #82b6a6;
}
.ae-metrics-delta.neutral {
  color: #c8d2de;
}
.ae-metrics-delta.bad {
  color: #cc6f6f;
}
@media (max-width: 480px) {
  .ae-mtlt {
    flex-direction: column;
    gap: 4px;
  }
  .ae-horizons-3 {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .ae-value {
    font-size: 14px;
  }
}

.row { display: flex; flex-wrap: wrap; gap: 8px; }
button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
button.active, button:hover {
  border-color: rgba(255, 200, 107, 0.7);
  background: rgba(255, 200, 107, 0.18);
}

#lang-buttons button,
#metal-buttons button,
#currency-buttons button,
#refresh-btn {
  font-size: 12px;
  line-height: 1.1;
  padding: 5px 9px;
}

select {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.panel-head h2 { margin: 0; }

.section-title-uniform {
  margin: 0;
  font-size: clamp(18px, 2.1vw, 23px);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: rgba(255, 200, 107, 0.86);
  transition: color 0.18s ease;
}

.section-title-uniform.section-open {
  color: #ffe3bb;
}

#retail-buy-title.section-title-uniform {
  color: #eaf2fa;
}

#retail-buy-title.section-title-uniform.section-open {
  color: #f4fbff;
}

#advanced-analytics-title.section-title-uniform,
#advanced-analytics-title.section-title-uniform.section-open {
  color: #eaf2fa;
}

#retail-buy-title.section-title-uniform,
#advanced-analytics-title.section-title-uniform,
#news-title.section-title-uniform,
#retail-buy-title.section-title-uniform.section-open,
#advanced-analytics-title.section-title-uniform.section-open,
#news-title.section-title-uniform.section-open {
  font-size: clamp(18px, 2.1vw, 23px);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: 0;
  color: #eaf2fa;
}

.feature-disabled {
  display: none !important;
}

#chart-data-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 15px;
  line-height: 1.1;
  min-width: 124px;
  flex: 0 0 auto;
  color: #ffe3bb;
  border-color: rgba(255, 200, 107, 0.7);
  background: rgba(255, 200, 107, 0.18);
}

#price-structure-head {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
}

#price-structure-head h2 {
  margin: 0;
}

#chart-days-buttons {
  justify-self: center;
}

#market-meta {
  justify-self: end;
  margin: 0;
  white-space: nowrap;
}

.data-trust-strip {
  margin: 8px 0 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.trust-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(147, 167, 186, 0.32);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  line-height: 1.2;
  background: rgba(8, 18, 30, 0.56);
  color: #d9e7f4;
}

.trust-chip strong {
  margin-right: 4px;
}

.trust-chip-ok {
  border-color: rgba(81, 210, 137, 0.52);
}

.trust-chip-warn {
  border-color: rgba(255, 200, 107, 0.62);
}

.trust-chip-risk {
  border-color: rgba(237, 99, 99, 0.62);
}

#ppce-data-card {
  display: none;
}

.data-modal-content > #ppce-data-card {
  display: block;
  margin: 0;
}

.data-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: clamp(10px, 2vw, 20px);
  background: rgba(1, 7, 14, 0.78);
  backdrop-filter: blur(3px);
}

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

.data-modal-card {
  width: min(1220px, 100%);
  max-height: min(88vh, 980px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(155deg, rgba(8, 22, 36, 0.98), rgba(5, 14, 24, 0.98));
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.45);
  padding: 12px;
}

.data-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.data-modal-head button {
  border-radius: 999px;
  padding: 5px 12px;
}

.data-modal-content {
  min-height: 40px;
}

.card h3.section-title-uniform {
  margin: 0;
  font-size: clamp(18px, 2.1vw, 23px);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: none;
  color: rgba(255, 200, 107, 0.86);
}
.panel-head p { margin: 0; color: var(--muted); font-size: 13px; }

.btn-collapse {
  font-size: 18px;
  padding: 0;
  white-space: nowrap;
  border: 0;
  background: transparent;
  color: #f4fbff;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 0;
  line-height: 1;
}

.btn-collapse::before {
  content: "▸";
  color: #f4fbff;
  font-size: 14px;
}

.btn-collapse[aria-expanded="true"]::before {
  content: "▾";
}

#tech-intl-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

#tech-intl-content[hidden] {
  display: none !important;
}

#tech-intl-panel.is-collapsed {
  padding-bottom: 10px;
}

.chart { height: 420px; margin-top: 12px; }
.chart {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(5, 14, 24, 0.72);
  padding: 12px;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chart.loading::after {
  content: attr(data-loading-label);
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 12px;
  color: #ffe3bb;
  background: rgba(255, 159, 67, 0.2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  z-index: 2;
}

.chart-headline {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  flex: 0 0 auto;
  overflow-x: auto;
  white-space: nowrap;
}

.chart-pressure-badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.chart-indicators-wrap {
  margin-left: 10px;
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
}

.chart-indicator-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9db2c6;
  margin-right: 2px;
}

.chart-indicator-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-indicator-label {
  font-size: 11px;
  color: #b8c9d8;
}

.chart-indicator-meta {
  display: inline-flex;
  font-size: 11px;
  color: #95adc3;
  margin-left: 4px;
  white-space: nowrap;
}

.chart-live-meta {
  display: none !important;
}

.chart-pressure-strong-down {
  color: #ffd6d6;
  background: rgba(255, 80, 80, 0.24);
  border-color: rgba(255, 80, 80, 0.5);
}

.chart-pressure-down {
  color: #ffdcb9;
  background: rgba(255, 139, 61, 0.22);
  border-color: rgba(255, 139, 61, 0.45);
}

.chart-pressure-neutral {
  color: #dbe7f4;
  background: rgba(147, 167, 186, 0.2);
  border-color: rgba(147, 167, 186, 0.42);
}

.chart-pressure-up {
  color: #d8ffe8;
  background: rgba(81, 210, 137, 0.2);
  border-color: rgba(81, 210, 137, 0.45);
}

.chart-pressure-strong-up {
  color: #d6ffe2;
  background: rgba(35, 196, 112, 0.26);
  border-color: rgba(35, 196, 112, 0.56);
}

.chart-alertload-low {
  color: #dbe7f4;
  background: rgba(147, 167, 186, 0.2);
  border-color: rgba(147, 167, 186, 0.42);
}

.chart-alertload-moderate {
  color: #ffe3bb;
  background: rgba(255, 159, 67, 0.2);
  border-color: rgba(255, 159, 67, 0.45);
}

.chart-alertload-high {
  color: #ffd4b0;
  background: rgba(255, 120, 70, 0.24);
  border-color: rgba(255, 120, 70, 0.5);
}

.chart-alertload-critical {
  color: #ffd6d6;
  background: rgba(255, 80, 80, 0.24);
  border-color: rgba(255, 80, 80, 0.56);
}

.chart-headline strong {
  font-size: 16px;
}

.chart-market-ticker {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(5, 14, 24, 0.66);
  overflow: hidden;
}

.chart-market-ticker-track {
  display: flex;
  width: max-content;
  min-width: 100%;
  align-items: center;
  will-change: transform;
}

.chart-market-ticker-item {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  color: #d7e5f3;
  font-size: 12px;
  line-height: 1.35;
  padding: 6px 16px 7px;
}

.chart-market-ticker-sep {
  color: #90a8bd;
  padding: 0 10px;
}

.chart-market-ticker-market {
  color: #b9ccdd;
}

.chart-market-ticker-mini {
  color: #8ea5b8;
  font-size: 11px;
}

.chart-canvas {
  width: 100%;
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
}

.chart-svg {
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1 1 auto;
  display: block;
}

.grid { display: grid; gap: 10px; }
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-top: 10px; }
.decision-grid {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  align-items: start;
}

#advanced-api-health {
  margin-bottom: 14px;
}

.advanced-api-health-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.advanced-api-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(147, 167, 186, 0.32);
  border-radius: 999px;
  padding: 6px 11px;
  background: rgba(8, 18, 30, 0.56);
  color: #d9e7f4;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.advanced-api-pill-label {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.advanced-api-pill-state {
  font-size: 11px;
  letter-spacing: 0.08em;
  opacity: 0.82;
}

.advanced-api-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06) inset;
}

.advanced-api-pill.is-up {
  border-color: rgba(81, 210, 137, 0.46);
}

.advanced-api-pill.is-up .advanced-api-dot {
  background: #51d289;
}

.advanced-api-pill.is-warn {
  border-color: rgba(255, 200, 107, 0.56);
}

.advanced-api-pill.is-warn .advanced-api-dot {
  background: #ffc86b;
}

.advanced-api-pill.is-down {
  border-color: rgba(237, 99, 99, 0.62);
}

.advanced-api-pill.is-down .advanced-api-dot {
  background: #ed6363;
}

.advanced-api-health-meta {
  margin: -4px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.runtime-status-meta {
  margin: -4px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.runtime-status-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.advanced-api-pill.is-neutral {
  border-color: rgba(147, 167, 186, 0.32);
}

.advanced-api-pill.is-neutral .advanced-api-dot {
  background: rgba(147, 167, 186, 0.75);
}

.runtime-status-assets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.runtime-status-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 20, 32, 0.62);
  padding: 12px;
}

.runtime-status-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.runtime-status-card-head strong {
  color: var(--ink);
  font-size: 16px;
}

.runtime-status-card-state {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.runtime-status-card.is-up .runtime-status-card-state {
  color: var(--up);
}

.runtime-status-card.is-warn .runtime-status-card-state {
  color: var(--warn);
}

.runtime-status-card.is-down .runtime-status-card-state {
  color: var(--down);
}

.runtime-status-card.is-neutral .runtime-status-card-state {
  color: var(--muted);
}

.runtime-status-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.runtime-status-source {
  margin-top: -2px;
  font-size: 12px;
  color: var(--soft);
}

.runtime-status-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.runtime-status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.runtime-status-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.runtime-status-fact {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(147, 167, 186, 0.08);
  color: var(--soft);
  font-size: 11px;
  font-weight: 700;
}

#margin-cme-section {
  grid-template-columns: 1fr;
}

#margin-cme-section .table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#margin-cme-section .board-table {
  width: 100%;
  table-layout: fixed;
}

#margin-cme-section .board-table th,
#margin-cme-section .board-table td {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: rgba(6, 14, 24, 0.66);
  min-width: 0;
}
.card h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.card p { margin: 0; font-weight: 600; }

.ppce-card {
  margin-top: 10px;
}

.ppce-interpretation {
  margin-top: 8px;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.5;
}

.ppce-interpretation p {
  margin: 0 0 4px;
}

.ppce-credibility-line {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 700;
}

.ppce-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.ppce-head p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.ppce-grid {
  margin-top: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.ppce-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 10px;
  display: grid;
  gap: 5px;
}

.ppce-grid span {
  color: var(--muted);
  font-size: 12px;
}

.ppce-grid strong {
  font-size: 16px;
}

#ppce-paper-stress-temporal {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 24px;
}

#ppce-state {
  margin-top: 10px;
  font-size: 16px;
}

#ppce-note {
  margin-top: 4px;
  font-size: 13px;
}

.ppce-comex {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.ppce-comex-section {
  margin: 10px 0 6px;
  font-size: 14px;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.ppce-comex-table td,
.ppce-comex-table th {
  font-size: 13px;
}

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--line);
}

.status-pill-verified_primary {
  color: #9cf7cb;
  border-color: rgba(156, 247, 203, 0.45);
  background: rgba(25, 100, 67, 0.28);
}

.status-pill-partial {
  color: #ffe4a6;
  border-color: rgba(255, 228, 166, 0.45);
  background: rgba(122, 96, 20, 0.28);
}

.status-pill-hypothesis {
  color: #ffb7b7;
  border-color: rgba(255, 183, 183, 0.45);
  background: rgba(133, 39, 39, 0.28);
}

.decision {
  margin: 0 0 8px;
  font-size: 22px;
  color: var(--accent);
}

.muted { color: var(--muted); }

.list {
  margin: 10px 0 0;
  padding-left: 16px;
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.comex-alert-list {
  padding-left: 0;
  margin-top: 6px;
}

.comex-alerts-meta {
  margin: 2px 0 6px;
  font-size: 12px;
  display: none;
}

@media (max-width: 900px) {
  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-indicator-meta {
    white-space: normal;
    flex-basis: 100%;
    margin-left: 0;
  }
}

.comex-alert-list li {
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink);
}

.comex-alert-list li.alert-red {
  border-color: rgba(255, 107, 107, 0.45);
  background: rgba(255, 107, 107, 0.14);
}

.comex-alert-list li.alert-orange {
  border-color: rgba(255, 159, 67, 0.45);
  background: rgba(255, 159, 67, 0.14);
}

.comex-alert-list li.alert-info {
  border-color: rgba(147, 167, 186, 0.5);
  background: rgba(147, 167, 186, 0.12);
}

.comex-decision-rail {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px 12px;
  background: rgba(6, 14, 24, 0.72);
  display: block;
}

.comex-decision-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.comex-decision-meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.comex-decision-track {
  position: relative;
  height: 9px;
  margin-top: 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(255,107,107,0.5) 0%, rgba(255,159,67,0.5) 50%, rgba(81,210,137,0.5) 100%);
}

.comex-decision-track-wrap {
  margin-top: 10px;
}

.comex-decision-score-label {
  font-size: 12px;
  font-weight: 700;
  color: #eaf2fa;
  margin-bottom: 4px;
}

.comex-score-red {
  color: #ff8f8f;
  animation: comex-red-flash 1s step-end infinite;
}

.comex-score-orange {
  color: #ffc56c;
}

.comex-score-green {
  color: #9be7b6;
}

@keyframes comex-red-flash {
  0%,
  49% {
    color: #ff8f8f;
    text-shadow: 0 0 0 rgba(255, 96, 96, 0);
  }
  50%,
  100% {
    color: #ffd7d7;
    text-shadow: 0 0 12px rgba(255, 96, 96, 0.68);
  }
}

.comex-decision-range {
  width: 100%;
  margin: 0;
  height: 13px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
}

.comex-decision-range:disabled {
  opacity: 1;
}

.comex-decision-range::-webkit-slider-runnable-track {
  height: 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(
    90deg,
    rgba(255, 107, 107, 0.52) 0%,
    rgba(255, 159, 67, 0.52) 50%,
    rgba(81, 210, 137, 0.52) 100%
  );
}

.comex-decision-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #f4fbff;
  background: #0a1523;
  margin-top: -3px;
  box-shadow: 0 0 0 2px rgba(10, 21, 35, 0.75);
}

.comex-decision-range::-moz-range-track {
  height: 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(
    90deg,
    rgba(255, 107, 107, 0.52) 0%,
    rgba(255, 159, 67, 0.52) 50%,
    rgba(81, 210, 137, 0.52) 100%
  );
}

.comex-decision-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #f4fbff;
  background: #0a1523;
  box-shadow: 0 0 0 2px rgba(10, 21, 35, 0.75);
}

.comex-decision-pointer {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #f4fbff;
  background: #0a1523;
  box-shadow: 0 0 0 2px rgba(10, 21, 35, 0.75);
}

.comex-decision-pointer-label {
  position: absolute;
  top: -16px;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  color: #eaf2fa;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(5, 12, 20, 0.6);
}

.comex-decision-scale {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.retail-buy-details {
  margin-top: 6px;
}

.retail-buy-list {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.retail-last-known {
  margin: 6px 0 0;
  font-size: 12px;
  color: #b8c9d8;
}

.retail-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(6, 14, 24, 0.65);
  padding: 10px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
}

.retail-thumb {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(9, 18, 30, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.retail-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.retail-thumb-empty {
  color: var(--muted);
  font-size: 0.8rem;
}

.retail-main p {
  margin: 0;
}

.retail-brand {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.retail-name {
  margin-top: 2px !important;
  font-weight: 700;
}

.retail-meta {
  margin-top: 8px !important;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.retail-price {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--ink);
}

.retail-status {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
}

.retail-status-ok {
  color: #d4ffe2;
  border-color: rgba(81, 210, 137, 0.55);
  background: rgba(81, 210, 137, 0.18);
}

.retail-status-warn {
  color: #ffe3bb;
  border-color: rgba(255, 159, 67, 0.55);
  background: rgba(255, 159, 67, 0.2);
}

.retail-status-muted {
  color: #d7e5f3;
  border-color: rgba(147, 167, 186, 0.5);
  background: rgba(147, 167, 186, 0.15);
}

.retail-link {
  margin-top: 8px !important;
  font-size: 0.85rem;
}

.alert-pill {
  display: inline-block;
  margin-right: 8px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  border: 1px solid var(--line);
}

.alert-pill.alert-pill-red {
  color: #ffd0d0;
  border-color: rgba(255, 107, 107, 0.45);
  background: rgba(255, 107, 107, 0.2);
}

.alert-pill.alert-pill-orange {
  color: #ffe3bb;
  border-color: rgba(255, 159, 67, 0.45);
  background: rgba(255, 159, 67, 0.22);
}

.alert-pill.alert-pill-info {
  color: #d7e5f3;
  border-color: rgba(147, 167, 186, 0.5);
  background: rgba(147, 167, 186, 0.15);
}

.comex-impact-card {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(6, 14, 24, 0.66);
}

.comex-impact-card p {
  margin: 0 0 8px;
  color: var(--ink);
}

.comex-impact-card p:last-child {
  margin-bottom: 0;
}

.comex-impact-card .impact-title {
  font-weight: 700;
  color: #ffe3bb;
}

.ppce-summary {
  margin: 8px 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  background: rgba(6, 14, 24, 0.72);
}

.ppce-v2 {
  margin: 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: rgba(8, 18, 30, 0.72);
}

.ppce-v2-single {
  margin-top: 0;
}

.ppce-v2-tabs {
  margin-bottom: 10px;
  gap: 8px;
}

.ppce-v2-tabs button {
  border-radius: 999px;
  padding: 6px 12px;
}

.ppce-v2-panel {
  display: none;
  gap: 10px;
}

.ppce-v2-panel.is-active {
  display: grid;
  gap: 14px;
}

.ppce-v2-panel[hidden] {
  display: none !important;
}

.ppce-v2-kpi-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.ppce-v2-kpi {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 10px;
  display: grid;
  gap: 4px;
}

.ppce-v2-kpi span {
  font-size: 12px;
  color: var(--muted);
}

.ppce-v2-kpi strong {
  font-size: 16px;
}

#ppce-v2-simple-story {
  font-size: 16px;
  line-height: 1.6;
  margin: 0;
  color: #dbe7f4;
}

#ppce-v2-next-watch {
  display: grid;
  gap: 8px;
  margin-top: 0;
}

#ppce-v2-next-watch li {
  line-height: 1.55;
}

.ppce-deep-details {
  margin-top: 10px;
}

.ppce-details {
  margin-top: 8px;
}

.ppce-details > summary,
.impact-details > summary {
  cursor: pointer;
  color: #f4fbff;
  font-weight: 600;
  margin-bottom: 8px;
}

.ppce-details > summary {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 7px;
}

.ppce-details > summary::-webkit-details-marker {
  display: none;
}

.ppce-details > summary::before {
  content: "▸";
  color: #f4fbff;
  font-size: 14px;
  transform: translateY(-1px);
}

.btn-collapse:hover,
.btn-collapse.active {
  border: 0;
  background: transparent;
  color: #f4fbff;
}

.ppce-details[open] > summary::before {
  content: "▾";
}

.impact-details {
  margin-top: 8px;
}

.composite-score-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin: 2px 0 8px;
}

.composite-score-main {
  font-size: 22px;
  font-weight: 800;
  color: #f1f7ff;
}

.composite-score-state {
  font-size: 13px;
  color: var(--muted);
}

.composite-components {
  margin: 8px 0;
  display: grid;
  gap: 6px;
}

.composite-components div {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(70px, 90px) minmax(90px, 1fr);
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--ink);
}

.composite-components strong {
  text-align: right;
}

.composite-bar {
  height: 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.composite-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2f6f4d, #c2943d, #9f3f3f);
}

.composite-spark {
  width: 100%;
  height: 86px;
  margin: 8px 0 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 20, 32, 0.75);
}

.composite-spark-wrap {
  margin: 8px 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 20, 32, 0.46);
  padding: 8px;
}

.composite-mode-row {
  display: flex;
  justify-content: flex-end;
  margin: 2px 0 8px;
}

.composite-ultra-simple {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(10, 24, 38, 0.72);
  padding: 10px;
  margin: 8px 0;
}

.composite-ultra-simple-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.composite-ultra-simple-grid > div {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 20, 32, 0.75);
  padding: 8px 10px;
}

.composite-ultra-simple-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.composite-ultra-simple-grid strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
  margin-top: 2px;
}

.composite-ultra-simple-grid p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.composite-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin: 6px 0 10px;
}

.composite-guide-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(12, 28, 43, 0.7);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.composite-guide-card strong {
  color: var(--ink);
  font-size: 12px;
}

.composite-guide-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.composite-threshold-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px;
}

.composite-threshold-chip {
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}

.threshold-low {
  color: #85d7aa;
  border-color: rgba(133, 215, 170, 0.45);
  background: rgba(133, 215, 170, 0.12);
}

.threshold-mid {
  color: #f6cb7d;
  border-color: rgba(246, 203, 125, 0.45);
  background: rgba(246, 203, 125, 0.12);
}

.threshold-high {
  color: #ff8f8f;
  border-color: rgba(255, 143, 143, 0.45);
  background: rgba(255, 143, 143, 0.12);
}

.composite-spark-help {
  margin: 4px 0 6px;
  color: #dce7f2;
  font-size: 13px;
}

.composite-spark-help-inline {
  margin: 5px 0 2px;
  color: var(--muted);
  font-size: 12px;
}

.composite-spark-freshness {
  margin: 2px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.composite-spark-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--muted);
}

.composite-spark-head span {
  overflow-wrap: anywhere;
}

.composite-line-legend {
  margin: 6px 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.legend-swatch {
  width: 16px;
  height: 3px;
  border-radius: 999px;
  display: inline-block;
}

.legend-score {
  background: rgba(255, 200, 107, 0.95);
}

.legend-ratio {
  background: rgba(81, 210, 137, 0.92);
}

.composite-spark-mini {
  width: 100%;
  max-width: 100%;
  display: block;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 20, 32, 0.75);
}

.composite-spark-stats {
  margin: 4px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.composite-spark-stats strong {
  color: var(--ink);
  font-size: 13px;
}

.comex-crossmetal-help {
  margin: 4px 0 6px;
  font-size: 12px;
}

.stress-meter {
  margin-top: 8px;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: linear-gradient(90deg, #284968, #2a7053, #9f7332, #8f3535);
}
.stress-meter > div {
  height: 100%;
  width: 0%;
  background: rgba(255,255,255,0.35);
}

.markdown {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.foot {
  color: var(--muted);
  font-size: 12px;
}

.board-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 14px;
}

.market-board-panel {
  padding: 11px;
}

.market-board-panel .panel-head h2 {
  font-size: 18px;
}

.market-board-panel .panel-head p {
  font-size: 12px;
}

.market-board-panel .board-table {
  margin-top: 6px;
  font-size: 12px;
}

.market-board-panel .board-table th,
.market-board-panel .board-table td {
  padding: 6px 8px;
}

.table-scroll {
  width: 100%;
  overflow-x: visible;
}

.table-scroll .board-table {
  min-width: 0;
}

.board-table th,
.board-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.board-table th {
  color: var(--muted);
  font-weight: 600;
}

.chg-up {
  background: rgba(81, 210, 137, 0.25);
  color: #b8f0ce;
}

.chg-down {
  background: rgba(255, 107, 107, 0.25);
  color: #ffd0d0;
}

.chg-flat {
  background: rgba(236, 242, 248, 0.08);
  color: var(--ink);
}

.flash {
  animation: pulse 0.7s ease-in-out;
}

.tick-up {
  color: #b8f0ce;
  background: rgba(81, 210, 137, 0.12);
}

.tick-down {
  color: #ffd0d0;
  background: rgba(255, 107, 107, 0.12);
}

.tick-flat {
  color: var(--ink);
}

/* Trend-table inline number coloring (text-only, no cell background fill). */
.trend-num-up {
  color: #9ff0c2;
  font-weight: 700;
}

.trend-num-up::before {
  content: "▲ ";
  font-size: 0.8em;
}

.trend-num-down {
  color: #ffb2b2;
  font-weight: 700;
}

.trend-num-down::before {
  content: "▼ ";
  font-size: 0.8em;
}

.trend-num-flat {
  color: #d9e3ef;
  font-weight: 600;
}

.trend-num-flat::before {
  content: "■ ";
  font-size: 0.62em;
  vertical-align: middle;
}

.tech-row-emphasis {
  font-size: 17px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.03);
}

@keyframes pulse {
  from { filter: brightness(1.25); }
  to { filter: brightness(1); }
}

.news-stream {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.news-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: rgba(6, 14, 24, 0.66);
}

.news-item h4 {
  margin: 0 0 4px;
  font-size: 21px;
}

.news-item a {
  color: var(--ink);
  text-decoration: none;
}

.news-item a:hover {
  text-decoration: underline;
}

.board-table a,
.board-table a:visited {
  color: #9fd3ff;
  text-decoration: none;
}

.board-table a:hover,
.board-table a:focus {
  color: #d7ebff;
  text-decoration: underline;
}

.news-item p {
  margin: 0;
  color: var(--muted);
}

.status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-aligned {
  color: #b8f0ce;
  background: rgba(81, 210, 137, 0.25);
}

.status-partial,
.status-context {
  color: #ffe3bb;
  background: rgba(255, 159, 67, 0.22);
}

.status-unverifiable {
  color: #d9d4ef;
  background: rgba(154, 140, 255, 0.16);
}

.status-drifting,
.status-unknown {
  color: #ffd0d0;
  background: rgba(255, 107, 107, 0.2);
}

.status-demonstrated {
  color: #b8f0ce;
  background: rgba(81, 210, 137, 0.25);
}

.status-not_demonstrable,
.status-not-demonstrable {
  color: #ffd0d0;
  background: rgba(255, 107, 107, 0.2);
}

.price-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
}

.market-status-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--line);
  color: #d7e5f3;
  background: rgba(147, 167, 186, 0.15);
}

.market-status-live {
  color: #d4ffe2;
  border-color: rgba(81, 210, 137, 0.55);
  background: rgba(81, 210, 137, 0.18);
}

.market-status-stale {
  color: #ffe3bb;
  border-color: rgba(255, 159, 67, 0.55);
  background: rgba(255, 159, 67, 0.2);
}

.market-status-unavailable {
  color: #ffd0d0;
  border-color: rgba(255, 107, 107, 0.5);
  background: rgba(255, 107, 107, 0.15);
}

.price-green {
  color: #b8f0ce;
  background: rgba(81, 210, 137, 0.2);
}

.price-orange {
  color: #ffe3bb;
  background: rgba(255, 159, 67, 0.2);
}

.price-red {
  color: #ffd0d0;
  background: rgba(255, 107, 107, 0.2);
}

.api-loading,
.api-idle {
  color: #ffe3bb;
  background: rgba(255, 159, 67, 0.2);
}

.api-ok {
  color: #b8f0ce;
  background: rgba(81, 210, 137, 0.2);
}

.api-error {
  color: #ffd0d0;
  background: rgba(255, 107, 107, 0.2);
}

.diagnostic-row {
  display: none;
}

.ui-hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .shell {
    padding: 20px 14px calc(30px + env(safe-area-inset-bottom));
    gap: 14px;
  }

  .hero {
    flex-direction: column;
    align-items: stretch;
  }

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

  .hero-forecast-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #hero-source-btn {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .metric strong {
    font-size: 18px;
  }

  .panel {
    padding: 12px;
    border-radius: 12px;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-scroll .board-table {
    min-width: 0;
    table-layout: fixed;
    width: 100%;
  }

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

@media (max-width: 680px) {
  .asset-alert-form {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(28px, 9vw, 38px);
  }

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

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

  .control-cell {
    min-height: 0;
  }

  .metric-top,
  .control-top {
    flex-wrap: wrap;
  }

  .metric-top #metal-buttons {
    gap: 6px;
  }

  .metric-top #metal-buttons button {
    font-size: 11px;
    padding: 4px 7px;
  }

  .metric-top strong {
    margin-left: 0;
  }

  .pull-refresh-indicator {
    top: 6px;
  }

  .chart {
    height: 380px;
  }

  .chart-headline {
    font-size: 12px;
    gap: 8px;
  }

  .chart-market-ticker-item {
    font-size: 11px;
    padding: 6px 12px;
  }

  .chart-indicators-wrap {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }

  .chart-canvas {
    min-height: 220px;
  }

  .chart-svg {
    min-height: 220px;
  }

  .chart-headline strong {
    font-size: 14px;
  }

  .advanced-api-health-list {
    gap: 6px;
  }

  .advanced-api-pill {
    font-size: 11px;
    padding: 5px 9px;
    gap: 6px;
  }

  .runtime-status-assets {
    grid-template-columns: 1fr;
  }

  .advanced-api-dot {
    width: 8px;
    height: 8px;
  }

  .board-table th,
  .board-table td {
    padding: 7px 8px;
    font-size: 13px;
    white-space: normal;
    word-break: break-word;
  }

  .news-item h4 {
    font-size: 18px;
  }

  .hero-subtitle-row {
    gap: 8px;
  }

  #price-structure-head {
    grid-template-columns: 1fr auto;
    align-items: start;
  }

  #chart-days-buttons {
    grid-column: 1 / -1;
    justify-self: start;
  }

  #chart-data-btn {
    justify-self: end;
  }

  #market-meta {
    grid-column: 1 / -1;
    justify-self: start;
    white-space: normal;
  }

  .hero-forecast-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #hero-source-btn {
    justify-self: start;
  }

  .hero-forecast-item {
    font-size: 13px;
    padding: 9px 11px;
    border-left: 0;
  }

  .hero-main-value {
    font-size: 15px;
  }

  .hero-mini-value {
    font-size: 14px;
  }

  .hero-sub-key {
    font-size: 11px;
  }

  .hero-sub-val {
    font-size: 12px;
  }

  #hero-source-btn { padding: 4px 9px; font-size: 10px; }

  .source-popover {
    align-items: flex-end;
    padding: 10px;
  }

  .source-popover-card {
    width: 100%;
    border-radius: 12px;
    max-height: min(70vh, 520px);
    overflow-y: auto;
  }

  .section-title-uniform {
    font-size: clamp(16px, 5vw, 20px);
  }

  .table-scroll .board-table {
    min-width: 0;
    table-layout: fixed;
    width: 100%;
  }

  #margin-cme-section .board-table th,
  #margin-cme-section .board-table td {
    font-size: 12px;
    padding: 7px 6px;
  }

  .comex-impact-card {
    overflow-x: hidden;
  }

  .composite-spark-freshness,
  .composite-spark-help,
  .composite-spark-help-inline {
    overflow-wrap: anywhere;
  }

  .composite-spark-stats {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .comex-impact-card .impact-title {
    font-size: 16px;
  }

  .composite-score-main {
    font-size: 20px;
  }

  .composite-score-state {
    font-size: 12px;
  }

  .composite-spark-head {
    font-size: 11px;
  }

  .composite-spark-help,
  .composite-spark-help-inline,
  .composite-spark-freshness,
  .composite-spark-stats,
  .composite-components div {
    font-size: 12px;
  }

  .composite-components div {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "label value"
      "bar bar";
  }

  .composite-components div > span {
    grid-area: label;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .composite-components div > strong {
    grid-area: value;
    white-space: nowrap;
  }

  .composite-components .composite-bar {
    grid-area: bar;
    min-width: 0;
  }

  .retail-item {
    grid-template-columns: 1fr;
  }

  .retail-thumb {
    width: 100%;
    height: 140px;
  }
}

@media (max-width: 420px) {
  .shell {
    padding: 14px 10px calc(24px + env(safe-area-inset-bottom));
  }

  .chart {
    height: 340px;
    padding: 8px;
  }

  .chart-canvas {
    min-height: 190px;
  }

  .chart-svg {
    min-height: 190px;
  }

  .composite-spark-stats {
    grid-template-columns: 1fr;
  }

  .composite-score-main {
    font-size: 18px;
  }
}
