:root {
  color-scheme: dark;
  --bg: #080b12;
  --panel: #10151f;
  --panel-2: #151b27;
  --line: #242c3a;
  --text: #f4f7fb;
  --muted: #8994a8;
  --accent: #6ee7b7;
  --accent-2: #46b98e;
  --green: #63e6ad;
  --red: #fb7185;
  --amber: #fbbf24;
  --radius: 18px;
  --shadow: 0 18px 55px rgba(0, 0, 0, .25);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 300px; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
.hidden { display: none !important; }
.skip-link { position: fixed; left: 12px; top: -50px; z-index: 100; padding: 10px 14px; background: var(--accent); color: #04120d; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.app-shell { width: min(1420px, calc(100% - 48px)); margin: 0 auto; min-height: 100vh; }

.topbar { height: 88px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--accent); color: #06130e; font-weight: 900; box-shadow: 0 0 24px rgba(110,231,183,.18); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: .01em; }
.brand small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .13em; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.market-pill, .refresh-control { height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 13px; border: 1px solid var(--line); background: var(--panel); border-radius: 11px; color: var(--muted); font-size: 12px; font-weight: 650; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px rgba(137,148,168,.08); }
.market-pill[data-status="open"] .status-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(99,230,173,.1); }
.market-pill[data-status="pre-market"] .status-dot, .market-pill[data-status="after-hours"] .status-dot { background: var(--amber); }
.refresh-control select { border: 0; color: var(--text); background: transparent; outline: none; }

main { padding: 56px 0 24px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(34px, 4vw, 54px); line-height: 1.05; letter-spacing: -.045em; }
.hero-copy { margin: 13px 0 0; color: var(--muted); font-size: 15px; }
.add-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 0 18px; border: 0; border-radius: 11px; background: var(--accent); color: #04120d; font-weight: 800; box-shadow: 0 8px 28px rgba(110,231,183,.13); transition: transform .18s, background .18s; }
.add-button:hover { background: #8aefc8; transform: translateY(-1px); }
.add-button:active { transform: translateY(0); }
.add-button:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.summary { display: grid; grid-template-columns: repeat(3, minmax(110px, 150px)) 1fr; align-items: end; gap: 12px; margin: 46px 0 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.summary div { display: flex; flex-direction: column; gap: 4px; }
.summary span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.summary strong { font-size: 19px; }
.summary .updated { align-items: flex-end; }
.summary .updated strong { color: var(--muted); font-size: 12px; font-weight: 600; }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }
.neutral { color: var(--muted) !important; }
.notice { margin: 0 0 18px; padding: 12px 15px; border: 1px solid rgba(251,191,36,.3); border-radius: 11px; background: rgba(251,191,36,.07); color: #fbd675; font-size: 13px; }

.watch-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.stock-card { position: relative; min-width: 0; padding: 21px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(255,255,255,.018), transparent 42%), var(--panel); box-shadow: var(--shadow); transition: transform .18s, border-color .18s; }
.stock-card:hover { transform: translateY(-2px); border-color: #344052; }
.card-head, .quote-row, .identity { display: flex; align-items: center; }
.card-head, .quote-row { justify-content: space-between; gap: 12px; }
.identity { min-width: 0; gap: 11px; }
.ticker-logo { flex: 0 0 auto; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: #c7f9e6; background: #1b2a29; font-size: 12px; font-weight: 850; }
.ticker { margin: 0; font-size: 14px; letter-spacing: .025em; }
.company { max-width: 190px; margin: 3px 0 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.remove-button, .icon-button { display: grid; place-items: center; border: 0; color: var(--muted); background: transparent; }
.remove-button { width: 30px; height: 30px; border-radius: 9px; font-size: 18px; opacity: .7; }
.remove-button:hover { color: var(--red); background: rgba(251,113,133,.08); opacity: 1; }
.quote-row { margin-top: 27px; }
.price { margin: 0; font-size: 30px; font-weight: 750; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.change { margin: 5px 0 0; font-size: 12px; font-weight: 750; }
.quote-state { padding: 5px 8px; border-radius: 7px; background: rgba(137,148,168,.08); color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.chart-wrap { height: 92px; margin: 12px -4px 5px; }
.sparkline { width: 100% !important; height: 100% !important; }
.metrics { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; margin: 8px 0 0; padding-top: 15px; border-top: 1px solid var(--line); }
.metrics div { min-width: 0; }
.metrics dt { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.metrics dd { margin: 5px 0 0; overflow: hidden; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.card-error { margin: 14px 0 0; color: var(--red); font-size: 11px; }
.stock-card.is-loading .price, .stock-card.is-loading .change, .stock-card.is-loading dd { border-radius: 5px; color: transparent; background: linear-gradient(90deg, #1b222e 25%, #26303e 50%, #1b222e 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.stock-card.is-loading .price { width: 110px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.empty-state { max-width: 440px; margin: 80px auto; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 18px; border: 1px solid var(--line); border-radius: 16px; color: var(--accent); background: var(--panel); font-size: 22px; }
.empty-state h2 { margin: 0; font-size: 22px; }
.empty-state p { margin: 10px 0 22px; color: var(--muted); line-height: 1.6; font-size: 14px; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 28px 0 36px; border-top: 1px solid var(--line); color: #626d80; font-size: 10px; }

.search-dialog { width: min(600px, calc(100% - 28px)); max-height: min(660px, calc(100vh - 40px)); padding: 24px; overflow: auto; border: 1px solid #2c3545; border-radius: 20px; color: var(--text); background: #0f141e; box-shadow: 0 30px 90px rgba(0,0,0,.6); }
.search-dialog::backdrop { background: rgba(3,5,9,.78); backdrop-filter: blur(6px); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; }
.dialog-head h2 { margin: 0 0 20px; font-size: 26px; letter-spacing: -.03em; }
.icon-button { width: 36px; height: 36px; border-radius: 10px; font-size: 25px; }
.icon-button:hover { color: var(--text); background: var(--panel-2); }
.search-box { display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 15px; border: 1px solid var(--line); border-radius: 12px; background: #090d14; }
.search-box:focus-within { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(110,231,183,.07); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; }
.search-box input::placeholder { color: #657085; }
.search-spinner { width: 15px; height: 15px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.search-hint { margin: 12px 3px 8px; color: var(--muted); font-size: 11px; }
.result { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 13px 10px; border: 0; border-bottom: 1px solid var(--line); color: var(--text); background: transparent; text-align: left; }
.result:hover, .result:focus-visible { background: var(--panel-2); }
.result div { min-width: 0; }
.result strong { font-size: 13px; }
.result span { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.result em { flex: 0 0 auto; color: var(--accent); font-size: 11px; font-style: normal; font-weight: 800; }

@media (max-width: 1050px) { .watch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) {
  .app-shell { width: min(100% - 28px, 600px); }
  .topbar { height: auto; min-height: 78px; gap: 12px; }
  .brand small, .refresh-control > span { display: none; }
  .topbar-actions { gap: 7px; }
  .market-pill, .refresh-control { padding: 0 10px; }
  main { padding-top: 38px; }
  .hero { align-items: flex-start; flex-direction: column; }
  .hero .add-button { width: 100%; }
  .summary { grid-template-columns: repeat(3, 1fr); margin-top: 34px; }
  .summary .updated { grid-column: 1 / -1; align-items: flex-start; margin-top: 7px; }
  .watch-grid { grid-template-columns: 1fr; }
  .stock-card { padding: 19px; }
  footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
