:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: #0d1929;
  --panel-2: #111f34;
  --ink: #e8eef8;
  --muted: #8fa1bb;
  --line: #22324a;
  --brand: #d9a441;
  --red: #ff4d5e;
  --green: #18c37e;
  --yellow: #f5c84b;
  --bad: #c24135;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(19, 43, 78, 0.92), rgba(7, 17, 31, 0.98) 280px),
    var(--bg);
}

button,
input {
  font: inherit;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.25);
}

.brand-block h1,
.panel h2 {
  margin: 0 0 10px;
}

.brand-block p,
.hint,
.muted {
  color: var(--muted);
}

.field {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.field input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: #081422;
}

.btn {
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  background: linear-gradient(180deg, #e8bd64, #b98122);
  color: #111827;
  font-weight: 700;
  cursor: pointer;
}

.btn.secondary {
  background: #18263a;
  color: var(--ink);
  border: 1px solid #2c405d;
}

.btn.danger {
  background: var(--bad);
}

.message {
  min-height: 22px;
  color: var(--muted);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 14px 22px;
  background: rgba(7, 17, 31, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.app-header > div {
  min-width: 0;
}

.app-header h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.app-header nav {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.content {
  padding: 20px;
  display: grid;
  gap: 18px;
}

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

.personal-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(217, 164, 65, 0.42);
  border-radius: 8px;
  padding: 16px;
  background:
    linear-gradient(90deg, rgba(217, 164, 65, 0.15), rgba(255, 255, 255, 0.02)),
    var(--panel);
}

.personal-panel h2 {
  margin: 0;
  font-size: 24px;
}

.metric {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0)),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.metric strong {
  display: block;
  color: #fff;
  font-size: 24px;
  margin-top: 4px;
}

.vix-metric strong.hold {
  color: var(--green);
}

.vix-metric strong.growth {
  color: #378bff;
}

.vix-metric strong.caution {
  color: #ff8b2d;
}

.vix-metric strong.risk {
  color: var(--red);
}

.intraday-price {
  min-width: 84px;
}

.intraday-price strong {
  display: block;
  color: #fff;
}

.intraday-price small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1340px;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: top;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2),
td.reasons {
  text-align: left;
}

th {
  font-size: 13px;
  color: var(--muted);
  background: #13243a;
  position: sticky;
  top: 0;
  z-index: 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.badge.red {
  color: #ffd4d9;
  background: rgba(255, 77, 94, 0.18);
  border: 1px solid rgba(255, 77, 94, 0.5);
}

.badge.hold {
  color: #c8ffe8;
  background: rgba(24, 195, 126, 0.16);
  border: 1px solid rgba(24, 195, 126, 0.5);
}

.badge.growth {
  color: #cfe5ff;
  background: rgba(55, 139, 255, 0.18);
  border: 1px solid rgba(55, 139, 255, 0.5);
}

.badge.warn {
  color: #ffedb0;
  background: rgba(245, 200, 75, 0.16);
  border: 1px solid rgba(245, 200, 75, 0.48);
}

.badge.watch {
  color: #ffedb0;
  background: rgba(245, 200, 75, 0.16);
  border: 1px solid rgba(245, 200, 75, 0.48);
}

.badge.caution {
  color: #ffdfbf;
  background: rgba(255, 139, 45, 0.16);
  border: 1px solid rgba(255, 139, 45, 0.52);
}

.badge.risk {
  color: #ffd4d9;
  background: rgba(255, 77, 94, 0.18);
  border: 1px solid rgba(255, 77, 94, 0.5);
}

.badge.green {
  color: #c8ffe8;
  background: rgba(24, 195, 126, 0.16);
  border: 1px solid rgba(24, 195, 126, 0.48);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.list {
  margin: 0;
  padding-left: 18px;
}

.news-item {
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

.user-chip,
.market-tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  font-weight: 700;
}

.market-tag {
  margin-top: 5px;
  padding: 2px 6px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
}

.status-approved {
  color: var(--green);
  background: rgba(24, 195, 126, 0.1);
}

.status-pending {
  color: var(--yellow);
  background: rgba(245, 200, 75, 0.12);
}

.status-rejected {
  color: var(--red);
  background: rgba(255, 77, 94, 0.12);
}

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

.message.success {
  color: var(--green);
}

.message.error {
  color: var(--red);
}

.metric span {
  color: var(--muted);
  font-weight: 800;
}

.metric small {
  color: #6f839f;
  font-weight: 700;
}

.source-date-strip {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 10px;
}

.source-date-strip span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  font-weight: 800;
}

.source-date-strip strong {
  color: #fff;
  white-space: nowrap;
}

.vix-panel {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(320px, 1.1fr);
  gap: 16px;
  align-items: stretch;
  border: 1px solid rgba(217, 164, 65, 0.32);
  border-radius: 8px;
  padding: 16px;
  background:
    linear-gradient(90deg, rgba(55, 139, 255, 0.13), rgba(255, 255, 255, 0.02)),
    var(--panel);
}

.vix-panel h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.vix-panel p {
  margin: 0;
}

.vix-history {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  min-height: 118px;
}

.vix-bar-item {
  display: grid;
  grid-template-rows: 82px auto auto;
  gap: 4px;
  align-items: end;
  justify-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.vix-bar {
  width: 100%;
  max-width: 34px;
  border-radius: 999px 999px 6px 6px;
  background: linear-gradient(180deg, #f5c84b, #378bff);
  box-shadow: 0 0 18px rgba(55, 139, 255, 0.24);
}

.vix-bar-item strong {
  color: #fff;
}

.intraday-risk-panel {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 160px minmax(320px, 1.2fr);
  gap: 16px;
  align-items: stretch;
  border: 1px solid rgba(55, 139, 255, 0.34);
  border-radius: 8px;
  padding: 16px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035), rgba(55, 139, 255, 0.12)),
    var(--panel);
}

.intraday-risk-panel h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.intraday-risk-panel p {
  margin: 0;
}

.risk-score-card {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.risk-score-card strong {
  font-size: 26px;
}

.risk-score-card small {
  color: var(--muted);
  text-align: center;
}

.risk-label {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
}

.risk-label.stress {
  color: #ffd4d9;
  background: rgba(255, 77, 94, 0.18);
}

.risk-label.watch {
  color: #ffdfbf;
  background: rgba(255, 139, 45, 0.16);
}

.risk-label.neutral {
  color: #cfe5ff;
  background: rgba(55, 139, 255, 0.18);
}

.risk-label.calm {
  color: #c8ffe8;
  background: rgba(24, 195, 126, 0.16);
}

.intraday-inputs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.analyst-panel {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(420px, 1.3fr);
  gap: 16px;
  align-items: stretch;
  border: 1px solid rgba(24, 195, 126, 0.28);
  border-radius: 8px;
  padding: 16px;
  background:
    linear-gradient(90deg, rgba(24, 195, 126, 0.1), rgba(255, 255, 255, 0.02)),
    var(--panel);
}

.analyst-panel h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.analyst-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.analyst-card {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.analyst-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.analyst-card strong {
  color: #fff;
  font-size: 14px;
  line-height: 1.45;
}

.risk-input {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.risk-input span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.risk-input strong {
  color: #fff;
  font-size: 16px;
}

.risk-input small {
  font-weight: 900;
}

.signal-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.signal-strip button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font: inherit;
  cursor: pointer;
}

.signal-strip button:hover,
.signal-strip button.active {
  color: #fff;
  border-color: rgba(217, 164, 65, 0.58);
  background: rgba(217, 164, 65, 0.14);
}

.filter-status {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  color: #dce7f7;
  background: rgba(255, 255, 255, 0.05);
  font-size: 13px;
  font-weight: 800;
}

.text-button {
  border: 0;
  padding: 0;
  color: #f0bd54;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #0a1626;
}

.section-title h2 {
  margin: 0;
  font-size: 18px;
}

.section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

tbody tr {
  background: rgba(255, 255, 255, 0.015);
}

tbody tr:hover {
  background: rgba(217, 164, 65, 0.08);
}

.rating-row-red {
  box-shadow: inset 4px 0 0 rgba(255, 77, 94, 0.75);
}

.rating-row-hold {
  box-shadow: inset 4px 0 0 rgba(24, 195, 126, 0.72);
}

.rating-row-growth {
  box-shadow: inset 4px 0 0 rgba(55, 139, 255, 0.72);
}

.rating-row-watch {
  box-shadow: inset 4px 0 0 rgba(245, 200, 75, 0.78);
}

.rating-row-caution {
  box-shadow: inset 4px 0 0 rgba(255, 139, 45, 0.78);
}

.rating-row-risk {
  box-shadow: inset 4px 0 0 rgba(255, 77, 94, 0.75);
}

.rating-row-warn {
  box-shadow: inset 4px 0 0 rgba(245, 200, 75, 0.78);
}

.rating-row-green {
  box-shadow: inset 4px 0 0 rgba(24, 195, 126, 0.72);
}

.up {
  color: var(--red);
  font-weight: 900;
}

.down {
  color: var(--green);
  font-weight: 900;
}

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

.lamp {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 12px currentColor;
}

.lamp-red {
  color: var(--red);
  background: var(--red);
}

.lamp-yellow,
.lamp-warn {
  color: var(--yellow);
  background: var(--yellow);
}

.lamp-green {
  color: var(--green);
  background: var(--green);
}

.lamp-hold {
  color: var(--green);
  background: var(--green);
}

.lamp-growth {
  color: #378bff;
  background: #378bff;
}

.lamp-watch {
  color: var(--yellow);
  background: var(--yellow);
}

.lamp-caution {
  color: #ff8b2d;
  background: #ff8b2d;
}

.lamp-risk {
  color: var(--red);
  background: var(--red);
}

.scorebar {
  width: 86px;
  height: 6px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #243650;
}

.scorebar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--yellow);
}

.rating-row-hold .scorebar span {
  background: var(--green);
}

.rating-row-growth .scorebar span {
  background: #378bff;
}

.rating-row-watch .scorebar span {
  background: var(--yellow);
}

.rating-row-caution .scorebar span {
  background: #ff8b2d;
}

.rating-row-risk .scorebar span {
  background: var(--red);
}

.verdict-note {
  width: 180px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
}

.reasons div {
  margin: 0 0 4px;
  color: #cbd6e6;
}

.kpi-line {
  display: grid;
  grid-template-columns: 72px 34px minmax(180px, 1fr);
  gap: 8px;
  align-items: baseline;
}

.kpi-line span {
  color: var(--muted);
  font-weight: 800;
}

.kpi-line strong {
  color: #fff;
}

.kpi-line small {
  color: #cbd6e6;
}

.signal-link {
  border: 0;
  border-radius: 6px;
  margin: 0 2px;
  padding: 1px 5px;
  color: #f0bd54;
  background: rgba(240, 189, 84, 0.12);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.signal-link:hover {
  color: #fff;
  background: rgba(240, 189, 84, 0.28);
}

.add-stock-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.prefs-dialog {
  width: min(760px, calc(100vw - 28px));
  padding: 0;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

.prefs-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
}

.prefs-card {
  padding: 0 18px 18px;
}

.stock-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  margin: 12px 0;
}

.stock-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #0a1626;
  cursor: pointer;
}

.stock-choice input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.stock-choice strong {
  display: block;
}

.stock-choice small {
  color: var(--muted);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.news-item small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

@media (max-width: 820px) {
  .auth-shell,
  .summary-grid,
  .split,
  .vix-panel,
  .intraday-risk-panel,
  .analyst-panel {
    grid-template-columns: 1fr;
  }

  body {
    background:
      linear-gradient(180deg, rgba(19, 43, 78, 0.92), rgba(7, 17, 31, 0.98) 220px),
      var(--bg);
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }

  .app-header nav {
    margin-left: 0;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-header .btn {
    width: 100%;
    padding: 10px 8px;
  }

  .app-header h1 {
    font-size: 20px;
    line-height: 1.2;
  }

  .content {
    padding: 12px;
    gap: 14px;
  }

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

  .personal-panel h2 {
    font-size: 21px;
  }

  .source-date-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .analyst-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .signal-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .signal-strip button {
    justify-content: center;
  }

  .section-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  table {
    min-width: 1220px;
  }

  th,
  td {
    padding: 10px 8px;
  }

  .stock-choices {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .login-page {
    padding: 12px;
    place-items: start center;
  }

  .panel {
    padding: 16px;
  }

  .app-header nav {
    grid-template-columns: 1fr 1fr;
  }

  .user-chip {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .metric {
    padding: 12px;
  }

  .metric strong {
    font-size: 20px;
  }

  .source-date-strip {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .source-date-strip span {
    padding: 9px 10px;
  }

  .signal-strip {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .vix-panel {
    padding: 14px;
  }

  .vix-history {
    min-height: 110px;
  }

  .intraday-inputs {
    grid-template-columns: 1fr;
  }

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

  .filter-status {
    width: 100%;
    justify-content: space-between;
  }

  .table-wrap {
    border-radius: 0;
    margin-inline: -12px;
    border-left: 0;
    border-right: 0;
  }

  table {
    min-width: 1040px;
  }

  .split {
    gap: 12px;
  }

  .add-stock-row {
    grid-template-columns: 1fr;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
