:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel2: #1f2937;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: #334155;
  --card: #0b1220;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  opacity: 0;
  transition: opacity 0.4s ease-in;
}

h1 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: 0.2px;
  text-align: center;
}

.hidden {
  display: none !important;
}

.update-banner {
  background-color: #0d6efd;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  max-width: 360px;
  margin: 0 auto 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.update-btn {
  background: #fff;
  color: #0d6efd;
  border: none;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
}

.error-banner {
  background-color: #842029;
  color: #f8d7da;
  border: 1px solid #f5c2c7;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  max-width: 360px;
  margin: 0 auto 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.error-close-btn {
  background: none;
  border: none;
  color: inherit;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  padding: 0 0 0 10px;
  line-height: 1;
}

.card-container {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  max-width: 360px;
  margin: 8px auto 0;
}

.label {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.time {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  margin-top: 2px;
}

.links a {
  display: inline-block;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0d1526;
  color: var(--text);
  font-size: 12px;
  text-decoration: none;
  margin: 1px;
}

.links a:hover {
  border-color: #60a5fa;
}

.refresh-container {
  text-align: center;
  margin-bottom: 8px;
}

.refresh-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0d1526;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}

.refresh-btn:hover {
  border-color: #60a5fa;
}

.refresh-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

table.watchlist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  padding: 6px 4px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

thead th {
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
}

.th-link {
  font-size: 9px;
  font-weight: 400;
  text-decoration: none;
  color: var(--muted);
}

.th-link:hover {
  color: #60a5fa;
}

td.num,
th.num {
  text-align: right;
}

.price {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.chg {
  font-variant-numeric: tabular-nums;
  min-width: 50px;
  font-size: 11px;
}

.pos {
  color: #15803d !important;
}

.neg {
  color: #dc2626 !important;
}

.zero {
  color: #4b5563 !important;
}

.timestamp {
  font-size: 9px;
  color: var(--muted);
  margin-top: 2px;
}

.company-name,
.ticker-label {
  display: block;
}

.ticker-label {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.watchlist-table th:first-child {
  width: 1%;
  white-space: nowrap;
}

.watchlist-table th:nth-child(2) {
  width: 120px;
}

.watchlist-table th:nth-child(3),
.watchlist-table td:nth-child(3) {
  text-align: right;
}

#installInstructions {
  position: relative;
  background-color: #ffffe0;
  color: #333;
  padding-top: 30px;
}

#installInstructions ul {
  margin: 0;
  padding-left: 20px;
  font-size: 11px;
}

#installInstructions li {
  margin-bottom: 6px;
}

#installInstructions li:last-child {
  margin-bottom: 0;
}

.install-heading {
  margin: 0 0 8px;
  font-weight: bold;
}

.hide-btn {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 8px;
  font-size: 10px;
  border-radius: 6px;
  border: 1px solid #c0c0c0;
  background: #f0f0f0;
  color: #333;
  cursor: pointer;
}

.hide-btn:hover {
  background: #e0e0e0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: var(--panel2);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  text-align: center;
  max-width: 320px;
  width: 90%;
}

.modal-content p {
  margin: 0 0 12px;
  font-size: 14px;
}

.api-key-input {
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background-color: #e5e7eb;
  color: #111827;
  font-size: 14px;
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.pct-col {
  text-align: center !important;
  background-color: beige !important;
  color: black !important;
  font-weight: bold !important;
}

.pct-col .chg {
  text-align: center !important;
  font-weight: bold !important;
}

.spxl-row,
.spxl-row th,
.spxl-row td,
.spxl-row a {
  background-color: beige !important;
  color: black !important;
}

.features-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.features-label {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.feature-btn {
  min-width: 52px;
}

.market-clock-wrapper {
  display: inline-block;
  text-align: center;
  margin: 0 8px;
  vertical-align: middle;
}

.market-clock-label {
  font-size: 0.8em;
  color: gray;
  line-height: 1;
}

.market-clock-time {
  font-weight: bold;
  font-size: 1.1em;
  font-variant-numeric: tabular-nums;
}

.btn-medium {
  font-size: 1.1em;
  padding: 6px 12px;
  vertical-align: middle;
}

.btn-medium + .btn-medium {
  margin-left: 10px;
}

.finnhub-header-link {
  display: inline-block;
  font-size: 11px;
  text-decoration: none;
  vertical-align: middle;
}

.middle-align {
  vertical-align: middle;
}

.cursor-pointer {
  cursor: pointer;
}
