:root {
  --bg: #0f1720;
  --panel: #16212b;
  --border: #263341;
  --text: #e7ecf0;
  --text-muted: #8593a0;
  --buy: #4fae8a;
  --sell: #d97066;
  --hold: #c9a227;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans Thai", system-ui, sans-serif;
  margin: 0;
  padding: 32px 20px 80px;
}

main {
  max-width: 760px;
  margin: 0 auto;
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

.ticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.ticker-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  text-align: left;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s, background 0.15s;
}

.ticker-card:hover { border-color: #3a4c5e; }

.ticker-card:focus-visible {
  outline: 2px solid #5b8fd1;
  outline-offset: 2px;
}

.ticker-card[aria-pressed="true"] {
  border-color: #5b8fd1;
  background: #1b2836;
}

.ticker-card .name {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-weight: 500;
}

.ticker-card .price {
  font-family: "IBM Plex Mono", monospace;
  font-size: 18px;
  line-height: 1;
}

.ticker-card .change {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--text-muted);
}

.change.up { color: var(--buy); }
.change.down { color: var(--sell); }

/* The badge is a flex item here, so stop it stretching the card's width. */
.ticker-card .signal-badge { align-self: flex-start; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 20px;
}

.panel h2 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0 0 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 12px;
  padding: 0 8px 10px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }

td.date, td.stop-loss { font-family: "IBM Plex Mono", monospace; color: var(--text-muted); white-space: nowrap; }

.signal-badge {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 3px;
}

.signal-buy { color: var(--buy); background: rgba(79, 174, 138, 0.12); }
.signal-sell { color: var(--sell); background: rgba(217, 112, 102, 0.12); }
.signal-hold { color: var(--hold); background: rgba(201, 162, 39, 0.12); }

.empty {
  color: var(--text-muted);
  font-size: 14px;
  padding: 12px 0;
}

.disclaimer {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  margin-top: 32px;
}

/* --- auth ---------------------------------------------------------------- */

.login h2 {
  color: var(--text);
  font-size: 16px;
  margin-bottom: 8px;
}

.login-hint {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 16px;
}

.login-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

input[type="email"] {
  flex: 1 1 220px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 14px;
}

input[type="email"]:focus-visible,
button:focus-visible {
  outline: 2px solid #5b8fd1;
  outline-offset: 2px;
}

.login-form button {
  background: #2c4a6b;
  color: var(--text);
  border: 1px solid #3a5f88;
  border-radius: 4px;
  padding: 9px 20px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

.login-form button:disabled { opacity: 0.5; cursor: default; }

.auth-message {
  color: var(--text-muted);
  font-size: 13px;
  margin: 14px 0 0;
}

.auth-message.error { color: var(--sell); }

.ghost-button {
  background: none;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

.ghost-button:hover { color: var(--text); border-color: #3a4c5e; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- scorecard ----------------------------------------------------------- */

.scorecard {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  color: var(--text-muted);
  font-size: 14px;
}

.stat { display: flex; flex-direction: column; gap: 4px; }

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

.stat-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 18px;
  color: var(--text);
}

/* --- signal table extras ------------------------------------------------- */

.news-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.invalidation {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

td.outcome {
  font-family: "IBM Plex Mono", monospace;
  white-space: nowrap;
  color: var(--text-muted);
}

td.outcome.up { color: var(--buy); }
td.outcome.down { color: var(--sell); }
