:root {
  --bg: #070a12;
  --panel: rgba(255,255,255,0.075);
  --panel-2: rgba(255,255,255,0.11);
  --text: #f6f7fb;
  --muted: #9ca3af;
  --border: rgba(255,255,255,0.12);
  --green: #22c55e;
  --yellow: #facc15;
  --red: #ef4444;
  --blue: #60a5fa;
  --purple: #a78bfa;
  --shadow: 0 24px 80px rgba(0,0,0,.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(96,165,250,.13), transparent 32%),
    radial-gradient(circle at top right, rgba(167,139,250,.11), transparent 28%),
    linear-gradient(180deg, #040711 0%, #070a12 100%);
  color: var(--text);
  min-height: 100vh;
}

.app {
  width: min(1440px, calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 60px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 26px;
}

.eyebrow {
  color: var(--blue);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: 12px;
  margin-bottom: 8px;
}

h1 {
  font-size: clamp(34px, 5vw, 58px);
  line-height: .95;
  margin: 0;
  letter-spacing: -0.06em;
}

.subtitle {
  margin-top: 14px;
  color: var(--muted);
  font-size: 16px;
  max-width: 760px;
}

.status {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
  backdrop-filter: blur(16px);
  white-space: nowrap;
  box-shadow: var(--shadow);
  font-size: 14px;
}

.status span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--yellow);
  margin-right: 8px;
  box-shadow: 0 0 18px currentColor;
}

.status.ok span {
  background: var(--green);
}

.status.err span {
  background: var(--red);
}

.panel {
  background: rgba(7,10,18,.76);
  border: 1px solid var(--border);
  border-radius: 28px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.controls {
  padding: 18px;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr auto;
  gap: 12px;
  margin-bottom: 18px;
}

input,
select,
button {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(8,12,24,.72);
  color: var(--text);
  border-radius: 16px;
  padding: 13px 14px;
  outline: none;
  font: inherit;
}

input::placeholder {
  color: #6b7280;
}

button {
  cursor: pointer;
  background: linear-gradient(135deg, rgba(96,165,250,.95), rgba(167,139,250,.95));
  border: 0;
  font-weight: 800;
  color: white;
  transition: transform .15s ease, opacity .15s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
  opacity: .86;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  padding: 20px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.055));
  border: 1px solid var(--border);
}

.stat .label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.stat .value {
  font-size: 30px;
  font-weight: 850;
  letter-spacing: -.04em;
}

.table-wrap {
  overflow: auto;
  border-radius: 28px;
}

table {
  width: 100%;
  min-width: 1044px;
  table-layout: fixed;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  position: sticky;
  top: 0;
  background: rgba(7,10,18,.94);
  backdrop-filter: blur(20px);
  color: #cbd5e1;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  z-index: 2;
  cursor: pointer;
  user-select: none;
}

tbody tr {
  transition: background .15s ease;
}

tbody tr:hover {
  background: rgba(255,255,255,.055);
}

.col-symbol {
  width: 125px;
}

.col-sector {
  width: 130px;
}

.col-industry {
  width: 155px;
}

.col-price {
  width: 95px;
}

.col-market-cap {
  width: 120px;
}

.col-rating {
  width: 82px;
  text-align: center;
}

.col-score {
  width: 84px;
  text-align: center;
}

th.col-score,
td.col-score,
th.col-rating,
td.col-rating {
  text-align: center;
}

.symbol {
  font-weight: 850;
  letter-spacing: -.02em;
  font-size: 16px;
}

.company {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
  max-width: 105px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 800;
  font-size: 13px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.10);
}

.pill.good {
  color: var(--green);
  background: rgba(34,197,94,.10);
}

.pill.mid {
  color: var(--yellow);
  background: rgba(250,204,21,.10);
}

.pill.bad {
  color: var(--red);
  background: rgba(239,68,68,.10);
}

.score-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.score-btn {
  appearance: none;
  width: auto;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: default;
  border-radius: 999px;
  display: inline-flex;
}

.date-btn {
  appearance: none;
  width: auto;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 999px;
  font: inherit;
}

.date-btn .score-date {
  transition: color .15s ease, background .15s ease, box-shadow .15s ease;
}

.date-btn:hover .score-date {
  color: #bfdbfe;
  background: rgba(96,165,250,.12);
  box-shadow: 0 0 0 4px rgba(96,165,250,.08);
}

.date-btn:disabled {
  opacity: .55;
  cursor: wait;
}

.score-date {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .02em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 6px;
}

.rating {
  display: inline-block;
  max-width: 68px;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(96,165,250,.12);
  color: #bfdbfe;
  border: 1px solid rgba(96,165,250,.20);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.right {
  text-align: right;
}

.empty {
  padding: 42px;
  text-align: center;
  color: var(--muted);
}

.hint {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

code {
  color: #bfdbfe;
  background: rgba(96,165,250,.12);
  border: 1px solid rgba(96,165,250,.16);
  padding: 2px 6px;
  border-radius: 8px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 18px;
  color: var(--text);
  background: rgba(7,10,18,.92);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  font-size: 14px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.ok {
  border-color: rgba(34,197,94,.35);
}

.toast.err {
  border-color: rgba(239,68,68,.35);
}

@media (max-width: 980px) {
  header {
    flex-direction: column;
  }

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

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

@media (max-width: 640px) {
  .app {
    width: min(100% - 22px, 1440px);
    padding-top: 22px;
  }

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

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