* {
  box-sizing: border-box;
}

:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9e0e8;
  --blue: #2457d6;
  --green: #087443;
  --red: #b42318;
  --amber: #b54708;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

a {
  color: var(--blue);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(18px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.ticker-tape {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #111827;
  color: #ffffff;
}

.ticker-label {
  height: 42px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.16);
  color: #f9fafb;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.ticker-window {
  overflow: hidden;
  min-width: 0;
}

.ticker-track {
  display: flex;
  width: max-content;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  animation: ticker-scroll 55s linear infinite;
}

.ticker-track:hover {
  animation-play-state: paused;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.ticker-item strong {
  font-size: 13px;
}

.ticker-item span,
.ticker-item em {
  font-size: 12px;
  font-style: normal;
}

.ticker-item.up em {
  color: #5ee3a1;
}

.ticker-item.down em {
  color: #ff8a80;
}

.ticker-placeholder {
  padding: 0 12px;
  color: #cbd5e1;
  font-size: 13px;
}

@keyframes ticker-scroll {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-50%);
  }
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.nav-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.user-chip {
  max-width: 180px;
  overflow: hidden;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.button.ghost {
  background: #ffffff;
}

.layout {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 48px;
}

.summary-grid,
.workbench,
.lower-grid {
  display: grid;
  gap: 16px;
}

.summary-grid article,
.panel,
.intro-panel,
.auth-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

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

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

.intro-panel {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 22px;
}

.intro-panel h2 {
  font-size: clamp(28px, 4vw, 42px);
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.summary-grid article {
  padding: 16px;
}

.summary-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.summary-grid strong {
  overflow-wrap: anywhere;
  font-size: 22px;
}

.search-panel {
  margin-bottom: 16px;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr;
}

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

.search-result {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.search-result strong,
.search-result span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result span {
  color: var(--muted);
  font-size: 13px;
}

.search-empty {
  margin: 0;
  padding: 10px 0;
  color: var(--muted);
  font-size: 14px;
}

.market-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.market-badge.market-open {
  border-color: #98d8b7;
  background: #ecfdf3;
  color: var(--green);
}

.market-badge.market-closed {
  border-color: #f1a7a1;
  background: #fff1f0;
  color: var(--red);
}

.workbench {
  grid-template-columns: minmax(0, 1fr) 320px;
  margin-bottom: 16px;
}

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

.panel {
  min-width: 0;
  padding: 18px;
}

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

.trade-form,
.stack {
  display: grid;
  gap: 10px;
}

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid #b8c2cc;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.stock-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.stock-heading-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

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

.stock-meta div {
  min-width: 0;
}

.stock-meta dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.stock-meta dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.chart-wrap {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.chart-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
}

.stock-news {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.stock-news-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

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

.news-list {
  display: grid;
  gap: 10px;
}

.news-item {
  display: grid;
  gap: 5px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.news-item:last-child {
  border-bottom: 0;
}

.news-item a {
  color: var(--ink);
  font-weight: 800;
  line-height: 1.25;
  text-decoration: none;
}

.news-item a:hover {
  color: var(--blue);
}

.news-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

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

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

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

td {
  font-size: 14px;
}

.message {
  padding: 11px 13px;
  border-radius: 6px;
  font-weight: 700;
}

.message.success {
  border: 1px solid #98d8b7;
  background: #ecfdf3;
  color: var(--green);
}

.message.error {
  border: 1px solid #f1a7a1;
  background: #fff1f0;
  color: var(--red);
}

.auth-shell {
  width: min(480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0;
}

.auth-panel {
  padding: 24px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 14px;
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 860px) {
  .topbar,
  .intro-panel,
  .workbench,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

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

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

@media (max-width: 560px) {
  .summary-grid,
  .stock-meta {
    grid-template-columns: 1fr;
  }
}
