:root {
  color-scheme: light;
  --ink: #11211d;
  --muted: #67736f;
  --line: #dce3df;
  --surface: #ffffff;
  --surface-soft: #f4f7f5;
  --page: #edf2ef;
  --dark: #0b1714;
  --dark-soft: #122620;
  --teal: #087f6a;
  --teal-soft: #d9f1ea;
  --green: #23834f;
  --green-soft: #dff2e7;
  --blue: #3168a0;
  --blue-soft: #e2edf8;
  --amber: #a66614;
  --amber-soft: #f8ecd8;
  --red: #a94343;
  --red-soft: #f8e2e2;
  --shadow: 0 12px 34px rgba(24, 51, 43, 0.08);
  font-family: "DM Sans", Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  min-width: 320px;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.topbar {
  min-height: 78px;
  padding: 12px clamp(18px, 4vw, 54px);
  background: var(--dark);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #c7f36b;
  color: #14201d;
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: 20px;
  border-radius: 6px;
}

.brand h1,
.brand p,
.report-head h2,
.report-head p,
.ai-band h2,
.ai-band p,
.workspace h2,
.sector-section h2,
.sector-section p {
  margin: 0;
}

.brand h1 {
  font: 700 20px/1.15 "Manrope", sans-serif;
}

.brand p {
  color: #9fb0aa;
  font-size: 12px;
  margin-top: 3px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.report-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c4d0cc;
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e1b458;
  box-shadow: 0 0 0 4px rgba(225, 180, 88, 0.14);
}

.report-status.fresh .status-dot {
  background: #6ed69b;
  box-shadow: 0 0 0 4px rgba(110, 214, 155, 0.14);
}

.report-status.stale .status-dot {
  background: #e17a6f;
  box-shadow: 0 0 0 4px rgba(225, 122, 111, 0.14);
}

.icon-command {
  height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--dark-soft);
  color: white;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
}

.icon-command:hover {
  background: #19342c;
}

.icon-command svg {
  width: 16px;
  height: 16px;
}

.icon-command.loading svg {
  animation: spin 0.8s linear infinite;
}

main {
  width: min(1480px, 100%);
  margin: 0 auto;
}

.report-head {
  padding: 28px clamp(18px, 4vw, 54px) 24px;
  background: var(--surface);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 28px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  color: var(--teal);
  text-transform: uppercase;
  font-weight: 700;
  font-size: 11px;
  line-height: 1.4;
}

.report-head h2 {
  margin-top: 6px;
  font: 700 clamp(24px, 3vw, 36px)/1.15 "Manrope", sans-serif;
  letter-spacing: 0;
}

.report-note {
  color: var(--muted);
  font-size: 14px;
  margin-top: 8px !important;
}

.source-meta {
  color: var(--muted);
  font-size: 12px;
  display: grid;
  text-align: right;
  gap: 4px;
}

.ai-band {
  padding: 28px clamp(18px, 4vw, 54px);
  background: var(--dark);
  color: white;
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(0, 2.2fr);
  gap: 32px;
  align-items: center;
}

.section-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
}

.section-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: #c7f36b;
  background: rgba(199, 243, 107, 0.09);
  border: 1px solid rgba(199, 243, 107, 0.22);
  border-radius: 6px;
}

.section-icon svg {
  width: 19px;
}

.ai-band .eyebrow {
  color: #a6cdbf;
}

.ai-band h2 {
  font: 700 22px/1.2 "Manrope", sans-serif;
}

.ai-summary > p {
  color: #c8d4d0;
  line-height: 1.55;
  font-size: 14px;
  max-width: 48ch;
}

.ai-caution {
  border-left: 3px solid #e1b458;
  padding-left: 10px;
  margin-top: 12px !important;
  color: #e9d8b8 !important;
  font-size: 12px !important;
}

.favorites-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.favorite {
  min-height: 164px;
  padding: 17px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #10221d;
  border-radius: 6px;
}

.favorite-head,
.favorite-prices,
.candidate-name-row,
.action-row,
.card-head,
.card-grid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.ticker {
  font: 700 18px/1 "Manrope", sans-serif;
}

.favorite-name {
  color: #9fb0aa;
  font-size: 11px;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.favorite-action {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 7px;
  background: rgba(199, 243, 107, 0.1);
  color: #c7f36b;
  border: 1px solid rgba(199, 243, 107, 0.2);
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
}

.favorite-prices {
  margin-top: 18px;
  align-items: flex-start;
}

.favorite-prices div {
  display: grid;
  gap: 3px;
}

.favorite-prices span,
.mini-label {
  color: #8ca099;
  text-transform: uppercase;
  font-size: 9px;
  font-weight: 700;
}

.favorite-prices strong {
  font-size: 13px;
  white-space: nowrap;
}

.favorite-footer {
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #c6d3ce;
  font-size: 11px;
}

.stats-grid {
  padding: 22px clamp(18px, 4vw, 54px);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  min-height: 84px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.metric-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 5px;
}

.metric-icon svg {
  width: 18px;
}

.metric-icon.teal { color: var(--teal); background: var(--teal-soft); }
.metric-icon.blue { color: var(--blue); background: var(--blue-soft); }
.metric-icon.green { color: var(--green); background: var(--green-soft); }
.metric-icon.amber { color: var(--amber); background: var(--amber-soft); }
.metric-icon.red { color: var(--red); background: var(--red-soft); }

.metric div {
  min-width: 0;
  display: grid;
}

.metric strong {
  font: 700 23px/1.1 "Manrope", sans-serif;
}

.metric span:last-child {
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}

.workspace,
.sector-section {
  margin: 0 clamp(18px, 4vw, 54px) 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
}

.workspace-header {
  padding: 20px 20px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.workspace h2,
.sector-section h2 {
  margin-top: 4px;
  font: 700 20px/1.2 "Manrope", sans-serif;
}

.view-tabs {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  padding: 3px;
  display: flex;
  gap: 2px;
  border-radius: 6px;
}

.tab {
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
}

.tab span {
  margin-left: 3px;
  color: #8b9692;
}

.tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(20, 40, 34, 0.1);
}

.filters {
  padding: 13px 20px;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) 180px 190px;
  gap: 10px;
  background: #fafcfb;
  border-bottom: 1px solid var(--line);
}

.search-field,
.select-field {
  min-height: 40px;
  background: var(--surface);
  border: 1px solid #ccd6d1;
  border-radius: 5px;
}

.search-field {
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.search-field svg {
  width: 16px;
  color: #82908a;
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.search-field input::placeholder {
  color: #95a09c;
}

.select-field {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  padding-left: 11px;
}

.select-field span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.select-field select {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  padding: 0 8px;
  cursor: pointer;
}

.candidate-table-wrap {
  overflow-x: auto;
}

.candidate-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.candidate-table th {
  color: #74817c;
  background: #f7f9f8;
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.candidate-table th:nth-child(1) { width: 22%; }
.candidate-table th:nth-child(2) { width: 14%; }
.candidate-table th:nth-child(3) { width: 19%; }
.candidate-table th:nth-child(4) { width: 16%; }
.candidate-table th:nth-child(5) { width: 18%; }
.candidate-table th:nth-child(6) { width: 11%; }

.candidate-table td {
  padding: 14px;
  border-bottom: 1px solid #e8edea;
  vertical-align: middle;
  font-size: 12px;
}

.candidate-table tbody tr:hover {
  background: #fbfdfc;
}

.candidate-table tbody tr:last-child td {
  border-bottom: 0;
}

.candidate-name-row {
  justify-content: flex-start;
}

.ticker-box {
  width: 42px;
  height: 34px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  font: 700 11px/1 "Manrope", sans-serif;
  border-radius: 4px;
}

.company-copy {
  min-width: 0;
}

.company-copy strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}

.company-copy span {
  color: var(--muted);
  font-size: 10px;
}

.favorite-star {
  width: 17px;
  color: #b17b1e;
  fill: #f2c05d;
}

.action-badge {
  display: inline-flex;
  padding: 5px 7px;
  font-size: 9px;
  line-height: 1.2;
  font-weight: 700;
  border-radius: 4px;
  max-width: 130px;
}

.action-badge.buy {
  color: #16633d;
  background: var(--green-soft);
}

.action-badge.wait {
  color: #855510;
  background: var(--amber-soft);
}

.data-stack {
  display: grid;
  gap: 4px;
}

.data-stack strong {
  font-size: 12px;
}

.data-stack span {
  color: var(--muted);
  font-size: 10px;
}

.yield-value {
  color: var(--green);
}

.risk-bar {
  height: 5px;
  background: #e9eeeb;
  border-radius: 5px;
  overflow: hidden;
  margin-top: 7px;
}

.risk-bar span {
  display: block;
  height: 100%;
  background: var(--teal);
  border-radius: inherit;
}

.score-pair {
  display: flex;
  gap: 5px;
}

.score-pill {
  min-width: 34px;
  padding: 4px 6px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--ink);
  text-align: center;
  font-size: 10px;
  border-radius: 4px;
}

.notes-line {
  color: var(--muted);
  font-size: 9px;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.candidate-cards {
  display: none;
}

.empty-state {
  padding: 50px 20px;
  text-align: center;
  color: var(--muted);
  display: grid;
  justify-items: center;
  gap: 6px;
}

.empty-state svg {
  width: 28px;
}

.empty-state strong {
  color: var(--ink);
}

.sector-section {
  padding: 22px 20px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: center;
  box-shadow: none;
}

.sector-bars {
  display: grid;
  gap: 9px;
}

.sector-row {
  display: grid;
  grid-template-columns: minmax(110px, 180px) 1fr 24px;
  gap: 10px;
  align-items: center;
  font-size: 11px;
}

.sector-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sector-track {
  height: 8px;
  background: #e8eeeb;
  border-radius: 6px;
  overflow: hidden;
}

.sector-fill {
  height: 100%;
  background: var(--teal);
  border-radius: inherit;
}

.sector-count {
  color: var(--muted);
  text-align: right;
}

footer {
  padding: 4px clamp(18px, 4vw, 54px) 30px;
  color: var(--muted);
  font-size: 10px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.skeleton {
  background: linear-gradient(90deg, #152b24 20%, #1c372f 50%, #152b24 80%);
  background-size: 200% 100%;
  animation: pulse 1.3s infinite linear;
}

.favorite-skeleton {
  min-height: 164px;
  border-radius: 6px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  max-width: 320px;
  padding: 11px 14px;
  background: var(--dark);
  color: white;
  border-radius: 5px;
  box-shadow: var(--shadow);
  font-size: 12px;
  transform: translateY(120%);
  opacity: 0;
  transition: 180ms ease;
}

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  to { background-position: -200% 0; }
}

@media (max-width: 1080px) {
  .favorites-grid {
    grid-template-columns: 1fr;
  }

  .favorite {
    min-height: auto;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .candidate-table th:nth-child(1) { width: 25%; }
  .candidate-table th:nth-child(2) { width: 17%; }
  .candidate-table th:nth-child(3) { width: 22%; }
  .candidate-table th:nth-child(4) { width: 18%; }
  .candidate-table th:nth-child(5) { width: 18%; }
  .candidate-table th:nth-child(6),
  .candidate-table td:nth-child(6) { display: none; }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 68px;
    padding: 10px 16px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand p,
  .report-status {
    display: none;
  }

  .icon-command {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

  .icon-command span {
    display: none;
  }

  .report-head {
    padding: 22px 16px 19px;
    align-items: flex-start;
  }

  .source-meta {
    display: none;
  }

  .report-head h2 {
    font-size: 25px;
  }

  .ai-band {
    padding: 24px 16px;
    grid-template-columns: 1fr;
    gap: 20px;
  }

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

  .stats-grid {
    padding: 14px 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    min-height: 72px;
    padding: 11px;
  }

  .metric:last-child {
    grid-column: span 2;
  }

  .workspace,
  .sector-section {
    margin: 0 16px 16px;
  }

  .workspace-header {
    padding: 17px 14px 12px;
    display: grid;
  }

  .view-tabs {
    width: 100%;
    overflow-x: auto;
  }

  .tab {
    flex: 1 0 auto;
  }

  .filters {
    padding: 12px 14px;
    grid-template-columns: 1fr 1fr;
  }

  .search-field {
    grid-column: span 2;
  }

  .select-field {
    grid-template-columns: 1fr;
    padding: 5px 8px;
  }

  .select-field select {
    padding: 1px 0 0;
  }

  .candidate-table-wrap {
    display: none;
  }

  .candidate-cards {
    display: grid;
  }

  .candidate-card {
    padding: 15px 14px;
    border-bottom: 1px solid var(--line);
  }

  .candidate-card:last-child {
    border-bottom: 0;
  }

  .card-head {
    align-items: flex-start;
  }

  .card-title {
    min-width: 0;
  }

  .card-title strong {
    display: block;
    font: 700 16px/1.2 "Manrope", sans-serif;
  }

  .card-title span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 3px;
  }

  .card-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }

  .card-grid div {
    display: grid;
    gap: 3px;
    min-width: 0;
  }

  .card-grid strong {
    font-size: 12px;
    overflow-wrap: anywhere;
  }

  .card-levels {
    margin-top: 12px;
    padding-top: 11px;
    border-top: 1px solid #e6ebe8;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 10px;
  }

  .card-note {
    margin-top: 9px;
    color: var(--muted);
    font-size: 10px;
  }

  .sector-section {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .sector-row {
    grid-template-columns: 110px 1fr 20px;
  }

  footer {
    padding: 3px 16px 24px;
    display: grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
