@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
  --bg: #f7f2e8;
  --bg-alt: #f1e8db;
  --panel: #fbf7f0;
  --card: #ffffff;
  --card-alt: #f6f1e6;
  --border: #e3d8c8;
  --text: #2b241b;
  --muted: #6f5e4b;

  --green: #3e8e6d;
  --red: #c0563d;
  --yellow: #c38b3a;
  --accent: #6b4f2a;
  --accent-strong: #4d3518;
  --accent-rgb: 107, 79, 42;
  --accent-soft: rgba(var(--accent-rgb), 0.12);
  --accent-alt: #9bc7a3;
  --accent-alt-rgb: 155, 199, 163;

  --shadow-soft: 0 12px 26px rgba(70, 55, 35, 0.12);
  --shadow-hard: 0 18px 36px rgba(70, 55, 35, 0.18);
}

:root.theme-royal,
body.theme-royal {
  --bg: #f7f2e8;
  --bg-alt: #f1e8db;
  --panel: #fbf7f0;
  --card: #ffffff;
  --card-alt: #f6f1e6;
  --border: #e3d8c8;
  --text: #2b241b;
  --muted: #6f5e4b;
  --accent: #6b4f2a;
  --accent-strong: #4d3518;
  --accent-rgb: 107, 79, 42;
  --accent-soft: rgba(var(--accent-rgb), 0.14);
  --accent-alt: #9bc7a3;
  --accent-alt-rgb: 155, 199, 163;
}

:root.theme-dark-royal,
body.theme-dark-royal {
  --bg: #14120f;
  --bg-alt: #1b1713;
  --panel: #221c16;
  --card: #2a231c;
  --card-alt: #241e17;
  --border: #3a2f25;
  --text: #f1e7d8;
  --muted: #c3b29a;
  --accent: #c09a5b;
  --accent-strong: #e1b56b;
  --accent-rgb: 192, 154, 91;
  --accent-soft: rgba(var(--accent-rgb), 0.18);
  --accent-alt: #5b7f6b;
  --accent-alt-rgb: 91, 127, 107;
  --topbar-bg: rgba(26, 22, 18, 0.94);
}

body.theme-dark-royal .status-dot.offline {
  background: #d6a760;
  box-shadow: 0 0 0 2px rgba(214, 167, 96, 0.3);
}

body.theme-dark-royal .chip-offline {
  color: #f3ddb6;
  background: rgba(214, 167, 96, 0.18);
  border: 1px solid rgba(214, 167, 96, 0.35);
}

:root.theme-sage,
body.theme-sage {
  --bg: #eef5ed;
  --bg-alt: #e4efe3;
  --panel: #f8fbf7;
  --card: #ffffff;
  --card-alt: #eff7ee;
  --border: #d6e5d4;
  --text: #203227;
  --muted: #5f7766;
  --accent: #5b8f6b;
  --accent-strong: #3c6a4b;
  --accent-rgb: 91, 143, 107;
  --accent-soft: rgba(var(--accent-rgb), 0.15);
  --accent-alt: #c3d8c3;
  --accent-alt-rgb: 195, 216, 195;
}

:root.theme-silver,
body.theme-silver {
  --bg: #f4f5f7;
  --bg-alt: #ebedf1;
  --panel: #ffffff;
  --card: #ffffff;
  --card-alt: #f2f4f7;
  --border: #d9dee7;
  --text: #1f2a37;
  --muted: #667085;
  --accent: #667085;
  --accent-strong: #3f4a5a;
  --accent-rgb: 102, 112, 133;
  --accent-soft: rgba(var(--accent-rgb), 0.16);
  --accent-alt: #d4d7dd;
  --accent-alt-rgb: 212, 215, 221;
}

body.theme-beige,
:root.theme-beige {
  --bg: #f7f1e6;
  --bg-alt: #efe5d6;
  --panel: #fdf9f2;
  --card: #ffffff;
  --card-alt: #f5ecdd;
  --border: #e2d4c2;
  --text: #2f2417;
  --muted: #7a6654;
  --accent: #8a6a3b;
  --accent-strong: #5b3f1d;
  --accent-rgb: 138, 106, 59;
  --accent-soft: rgba(var(--accent-rgb), 0.14);
  --accent-alt: #d7c3a1;
  --accent-alt-rgb: 215, 195, 161;
}

body.theme-sunrise,
:root.theme-sunrise {
  --bg: #fff4e6;
  --bg-alt: #ffe8d1;
  --panel: #fffaf2;
  --card: #ffffff;
  --card-alt: #fff1df;
  --border: #f2d2b7;
  --text: #3a2a1f;
  --muted: #8a6c5b;
  --accent: #c97b45;
  --accent-strong: #9a5a2f;
  --accent-rgb: 201, 123, 69;
  --accent-soft: rgba(var(--accent-rgb), 0.14);
  --accent-alt: #f3b37a;
  --accent-alt-rgb: 243, 179, 122;
}

body.theme-slate,
:root.theme-slate {
  --bg: #f2f4f7;
  --bg-alt: #e7ebf0;
  --panel: #f8f9fb;
  --card: #ffffff;
  --card-alt: #f1f3f6;
  --border: #d6dbe3;
  --text: #1f2a37;
  --muted: #6b7280;
  --accent: #6b7280;
  --accent-strong: #374151;
  --accent-rgb: 107, 114, 128;
  --accent-soft: rgba(var(--accent-rgb), 0.16);
  --accent-alt: #cbd5e1;
  --accent-alt-rgb: 203, 213, 225;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 8% -10%, rgba(255, 255, 255, 0.8), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
  min-height: 100vh;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 600;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 18px 32px;
  background: var(--topbar-bg, rgba(255, 255, 255, 0.85));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.4px;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.brand-link {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.4px;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text);
  text-decoration: none;
}

.brand-link:hover {
  text-decoration: none;
}

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

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

.topnav {
  display: flex;
  gap: 12px;
  padding: 6px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  justify-self: center;
}

.topnav a {
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  position: relative;
  transition: all 0.2s ease;
}

.topnav a.active {
  background: var(--accent-soft);
  border-color: rgba(var(--accent-rgb), 0.2);
  box-shadow: 0 8px 16px rgba(70, 55, 35, 0.08);
  font-weight: 600;
  color: var(--accent-strong);
}

.topnav a:hover {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(var(--accent-rgb), 0.25);
  color: var(--accent-strong);
}

.topnav a.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-strong);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.container {
  max-width: 1480px;
  margin: auto;
  padding: 36px 32px 72px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.full-width {
  width: 100%;
}

.card {
  background: linear-gradient(180deg, var(--card) 0%, var(--card-alt) 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: fadeUp 0.6s ease both;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hard);
}

.card h2 {
  margin-top: 0;
  font-size: 22px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.card h3 {
  font-size: 18px;
  margin-bottom: 8px;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.card h4 {
  font-size: 12px;
  margin-top: 18px;
  margin-bottom: 6px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
}

th,
td {
  padding: 11px;
  text-align: center;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
}

tr:hover {
  background: rgba(var(--accent-rgb), 0.05);
}

select {
  width: 100%;
  padding: 12px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 18px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

input[type="text"] {
  width: 100%;
  padding: 12px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 18px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

input[type="email"],
textarea {
  width: 100%;
  padding: 12px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
  font-family: inherit;
  font-size: 14px;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

button.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.16), rgba(var(--accent-alt-rgb), 0.2));
  color: var(--accent-strong);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 18px rgba(70, 55, 35, 0.15);
}

button.primary:active {
  transform: translateY(0);
}

.up {
  color: var(--green);
  font-weight: 700;
}

.down {
  color: var(--red);
  font-weight: 700;
}

.neutral {
  color: var(--yellow);
  font-weight: 700;
}

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

.metric-row {
  display: flex;
  gap: 16px;
  margin: 14px 0 18px;
  flex-wrap: wrap;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  min-width: 120px;
}

.metric label {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.metric span {
  font-size: 18px;
  font-weight: 700;
}

.section-divider {
  margin: 32px 0 12px;
  border-top: 1px dashed var(--border);
}

.glossary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.glossary p {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}

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

.list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.list li {
  margin: 6px 0;
  line-height: 1.4;
}

.event-item,
.news-item {
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
}

.event-item:last-child,
.news-item:last-child {
  border-bottom: none;
}

.event-title,
.news-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.trade-item {
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
}

.trade-item:last-child {
  border-bottom: none;
}

.trade-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.asset-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.asset-link:hover {
  text-decoration: underline;
}

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.status-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  justify-self: end;
}

.market-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.status-dot.live {
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
  animation: pulseGreen 1.4s ease-in-out infinite;
}

.status-dot.offline {
  background: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
  animation: pulseRed 1.4s ease-in-out infinite;
}

.clock-panel {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  min-width: 180px;
}

.clock-line {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.clock-panel:has(#clockSecondary:empty) #clockSecondary {
  display: none;
}

.chip-live,
.chip-offline {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.chip-live {
  color: #1f4d3b;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.chip-offline {
  color: #5c2b2b;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.chip-neutral {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
}

.rr-strong {
  box-shadow: 0 0 0 1px rgba(62, 142, 109, 0.25),
              0 0 18px rgba(62, 142, 109, 0.12);
}

.rr-weak {
  opacity: 0.75;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.theme-switch label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.theme-switch select {
  width: auto;
  margin: 0;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
}

@keyframes pulseGreen {
  0% { transform: scale(1); opacity: 0.9; }
  70% { transform: scale(1.25); opacity: 0.4; }
  100% { transform: scale(1); opacity: 0.9; }
}

@keyframes pulseRed {
  0% { transform: scale(1); opacity: 0.9; }
  70% { transform: scale(1.25); opacity: 0.4; }
  100% { transform: scale(1); opacity: 0.9; }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

main > *:nth-child(1) { animation-delay: 0.02s; }
main > *:nth-child(2) { animation-delay: 0.06s; }
main > *:nth-child(3) { animation-delay: 0.1s; }
main > *:nth-child(4) { animation-delay: 0.14s; }
main > *:nth-child(5) { animation-delay: 0.18s; }
main > *:nth-child(6) { animation-delay: 0.22s; }

@media (prefers-reduced-motion: reduce) {
  .card {
    animation: none;
  }
  main > * {
    animation: none;
  }
}

@media (max-width: 1100px) {
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .topbar {
    grid-template-columns: 1fr;
    align-items: flex-start;
    gap: 10px;
  }

  .topnav {
    justify-self: start;
  }

  .status-stack {
    align-items: flex-start;
    justify-self: start;
  }
}
