:root {
  color-scheme: light;
  --background: #f6f7f9;
  --surface: #ffffff;
  --surface-muted: #eef2f6;
  --text: #17202a;
  --muted: #687384;
  --line: #d9e0e8;
  --accent: #1368d8;
  --accent-strong: #0d4fa8;
  --gain: #b3261e;
  --gain-bg: #fce8e6;
  --loss: #137333;
  --loss-bg: #e6f4ea;
  --danger: #b3261e;
  --shadow: 0 14px 36px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

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

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.15;
}

.symbol-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.symbol-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.symbol-field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #ffffff;
  text-transform: uppercase;
  outline: none;
}

.symbol-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(19, 104, 216, 0.14);
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: #ffffff;
  background: var(--accent);
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.ghost-button {
  color: var(--accent);
  border: 1px solid var(--line);
  background: var(--surface);
}

.ghost-button:hover {
  color: var(--accent-strong);
  background: var(--surface-muted);
}

.status {
  min-height: 22px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.credits {
  margin: -8px 0 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.query-result {
  display: grid;
  grid-template-columns: minmax(0, 340px);
  gap: 12px;
  margin-bottom: 14px;
}

.query-result:empty {
  display: none;
}

.query-result h2 {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.watchlist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.price-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.price-card {
  display: grid;
  gap: 20px;
  min-height: 210px;
  padding: 18px;
  border-left: 5px solid var(--line);
}

.card-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-topline h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.card-topline p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.card-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.add-button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 700;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  color: var(--danger);
  border: 1px solid var(--line);
  background: #ffffff;
  font-size: 24px;
  line-height: 1;
}

.icon-button:hover {
  color: #ffffff;
  border-color: var(--danger);
  background: var(--danger);
}

.price-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.price-row strong {
  font-size: 36px;
  line-height: 1;
}

.price-row span {
  color: var(--muted);
  font-weight: 700;
}

.change-pill {
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--surface-muted);
  font-size: 14px;
}

.is-up {
  border-left-color: var(--gain);
}

.is-up .price-row strong,
.is-up .change-pill {
  color: var(--gain);
}

.is-up .change-pill {
  background: var(--gain-bg);
}

.is-down {
  border-left-color: var(--loss);
}

.is-down .price-row strong,
.is-down .change-pill {
  color: var(--loss);
}

.is-down .change-pill {
  background: var(--loss-bg);
}

.details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
}

.details div {
  min-width: 0;
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-muted);
}

.details dt {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.details dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.cache-line {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.is-error {
  border-color: rgba(179, 38, 30, 0.35);
}

.is-error .price-row strong {
  color: var(--danger);
  font-size: 18px;
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 24px, 1040px);
    padding: 20px 0;
  }

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

  .symbol-form {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 28px;
  }
}
