:root {
  color-scheme: light;
  font-family: "Press Start 2P", monospace;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background-color: #f5f7fb;
  background-image: radial-gradient(#d5dce8 1px, transparent 1px);
  background-size: 16px 16px;
  color: #212529;
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  line-height: 2.2;
}

a {
  color: #1167b1;
}

.site-nav {
  padding: 18px 24px;
  background: #212529;
  color: #fff;
  box-shadow: 0 4px 0 #111820;
}

.site-nav-inner {
  display: flex;
  max-width: 1100px;
  margin: 0 auto;
  align-items: center;
  gap: 24px;
}

.brand {
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.site-links {
  display: flex;
  flex: 1;
  gap: 20px;
}

.site-links a {
  color: #fff;
  text-decoration: none;
}

.site-links a:hover,
.brand:hover {
  color: #f7d51d;
}

.status-badge {
  white-space: nowrap;
}

.page-shell {
  width: min(100% - 40px, 1000px);
  margin: 40px auto;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-heading h1 {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.8;
}

.page-heading p {
  margin: 0;
}

.page-heading-simple {
  justify-content: flex-start;
}

.muted {
  color: #59636e;
}

.nes-btn {
  font-family: inherit;
  font-size: 10px;
  line-height: 2;
}

.info-panel,
.warning-panel,
.panel {
  background: #fff;
}

.info-panel,
.warning-panel {
  margin-bottom: 24px;
}

.info-panel {
  border-color: #1167b1;
}

.warning-panel {
  border-color: #f7a800;
}

.panel .title {
  font-size: 12px;
}

.watchlist-table {
  width: 100%;
  font-size: 9px;
}

.keyword-edit-form,
.watchlist-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.keyword-edit-form .nes-input {
  min-width: 120px;
  width: 100%;
  min-height: 42px;
  font-family: inherit;
  font-size: 9px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(140px, 0.5fr) minmax(220px, 1fr) auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 24px;
}

.inline-form label {
  display: grid;
  gap: 8px;
}

.inline-form .nes-input {
  width: 100%;
  min-height: 42px;
  font-family: inherit;
  font-size: 9px;
}

.feed-panel {
  margin-top: 24px;
}

.feed-url {
  max-width: 320px;
  overflow-wrap: anywhere;
}

.signals-table {
  width: 100%;
  font-size: 9px;
}

.signals-table th,
.signals-table td {
  padding: 12px 10px;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.signal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.indicator-snapshot {
  color: #59636e;
  margin-bottom: 8px;
}

.llm-reasoning summary {
  cursor: pointer;
}

.watchlist-table th,
.watchlist-table td {
  padding: 12px 10px;
  vertical-align: middle;
}

.symbol-cell {
  font-weight: bold;
}

.settings-form {
  display: grid;
  gap: 28px;
}

.settings-section {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.settings-section legend {
  float: none;
  width: auto;
  margin-bottom: 16px;
  font-size: 11px;
}

.switch-list {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.switch-list label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.field {
  min-width: 0;
}

.field label {
  display: block;
  margin-bottom: 8px;
}

.field .nes-input {
  width: 100%;
  min-height: 48px;
  font-family: inherit;
  font-size: 10px;
}

.save-button {
  justify-self: end;
}

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

.metric-card {
  min-width: 0;
  margin: 0;
  background: #fff;
  text-align: center;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.chart-panel {
  margin-bottom: 24px;
  background: #fff;
}

.chart-heading,
.chart-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chart-heading {
  justify-content: space-between;
  margin-bottom: 12px;
}

.chart-heading .title {
  margin: 0;
}

.chart-controls label {
  margin: 0;
}

.chart-controls select {
  min-width: 90px;
  height: 42px;
  font-family: inherit;
  font-size: 9px;
}

#intraday-chart {
  max-height: 420px;
}

.chart-error {
  margin-top: 12px;
  color: #e76e55;
}

.indicator-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-top: 16px;
  color: #59636e;
}

.emergency-panel {
  margin-bottom: 24px;
  border-color: #e76e55;
  background: #fff;
}

.emergency-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.emergency-controls form {
  margin: 0;
}

.emergency-controls .is-error {
  color: #fff;
  background: #e76e55;
}

.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  background: #fff;
}

.flash-success {
  border-color: #92cc41;
}

.flash-danger,
.flash-error {
  border-color: #e76e55;
}

.flash-warning {
  border-color: #f7a800;
}

.flash-info {
  border-color: #209cee;
}

.flash-close {
  flex: 0 0 auto;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: #59636e;
  font: inherit;
  font-size: 18px;
  cursor: pointer;
}

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

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

  .chart-controls {
    width: 100%;
    flex-wrap: wrap;
  }

  .site-nav {
    padding: 16px 20px;
  }

  .site-nav-inner {
    flex-wrap: wrap;
    gap: 14px 20px;
  }

  .site-links {
    order: 3;
    flex-basis: 100%;
  }

  .status-badge {
    margin-left: auto;
  }

  .page-shell {
    width: calc(100% - 32px);
    margin: 28px auto;
  }

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

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