:root {
  --bg-a: #06142e;
  --bg-b: #0c2f43;
  --panel: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.18);
  --text: #f4f8fc;
  --muted: #a9bbb2;
  --cta: #ffffff;
  --cta-text: #1b2734;
}

* {
  box-sizing: border-box;
}

html {
  background: #0d1a16;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background: #0d1a16;
  background-image: none;
}

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

.panel {
  width: 100%;
  max-width: 650px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(16px);
  border-radius: 18px;
  padding: 36px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.eyebrow {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 6px;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.3rem);
}

.subtext {
  color: var(--muted);
  margin: 12px 0 28px;
}

.subtext-nowrap {
  white-space: nowrap;
}

.text-center {
  text-align: center;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  text-decoration: none;
  padding: 13px 16px;
  border-radius: 10px;
  background: var(--cta);
  color: var(--cta-text);
  font-weight: 650;
  border: 0;
  cursor: pointer;
  margin-bottom: 10px;
}

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

.google-icon {
  height: 22px;
  width: 22px;
  border-radius: 50%;
  background: #1a73e8;
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: 700;
}

.logout-link {
  color: #c6d8cf;
}

@media (max-width: 700px) {
  .subtext-nowrap {
    white-space: normal;
  }
}

.dashboard-page {
  min-height: 100vh;
  padding: 28px;
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.dashboard-hero {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  background: rgba(8, 18, 14, 0.78);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.dashboard-hero h1 {
  margin-top: 4px;
}

.hero-meta {
  text-align: right;
}

.hero-links {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.stock-search-form {
  margin-top: 10px;
  max-width: 420px;
}

.stock-search-label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stock-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stock-search-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
}

.stock-search-input::placeholder {
  color: rgba(244, 248, 252, 0.68);
}

.stock-search-input:focus {
  outline: none;
  border-color: rgba(154, 180, 227, 0.85);
  box-shadow: 0 0 0 2px rgba(154, 180, 227, 0.2);
}

.stock-search-btn {
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

.stock-search-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.stock-search-error {
  min-height: 1.1em;
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: #ffcbc2;
}

.warning-strip {
  border: 1px solid rgba(255, 120, 120, 0.45);
  background: rgba(130, 20, 20, 0.35);
  color: #ffd6d6;
  border-radius: 12px;
  padding: 12px 16px;
}

.warning-strip p {
  margin: 4px 0;
}

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

.index-move-grid {
  display: grid;
  gap: 10px;
  align-items: stretch;
}

.index-move-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.08);
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: 1fr 1fr 1fr 1fr;
  align-items: center;
}

.index-name {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.index-close {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.index-chg {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.index-date {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.index-move-card.up .index-chg {
  color: #6fe7b9;
}

.index-move-card.down .index-chg {
  color: #ff9ca6;
}

.index-move-card.flat .index-chg {
  color: #dbe8ff;
}

.summary-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 14px;
}

.clickable-summary {
  cursor: pointer;
}

.clickable-summary:hover {
  border-color: rgba(130, 205, 255, 0.55);
  background: rgba(255, 255, 255, 0.11);
}

.clickable-summary:focus {
  outline: 2px solid rgba(130, 205, 255, 0.6);
  outline-offset: 2px;
}

.summary-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-value {
  margin: 8px 0 4px;
  font-size: 1.45rem;
  font-weight: 700;
}

.summary-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.data-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.block-head {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.block-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.block-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.86rem;
}

th {
  color: #d2e2d9;
  background: rgba(8, 20, 16, 0.9);
  position: sticky;
  top: 0;
}

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

.profit-detail-block td:nth-child(4) {
  min-width: 420px;
  white-space: normal;
}

.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.activity-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 14px 4px;
}

.activity-metric {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
}

.activity-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 4px 14px 14px;
}

.activity-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.activity-tag {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  color: #c6d8cf;
}

.activity-list {
  margin: 0;
  padding-left: 18px;
  color: #c6d8cf;
  font-size: 0.86rem;
}

.th-with-info {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.th-label {
  white-space: nowrap;
}

.info-trigger {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.1);
  color: #cfddd6;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.info-pop {
  position: absolute;
  top: 26px;
  left: 0;
  z-index: 50;
  min-width: 180px;
  max-width: 230px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #0e1f19;
  color: #ccdcd3;
  font-size: 0.74rem;
  line-height: 1.3;
  text-transform: none;
  font-weight: 500;
  white-space: normal;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.28);
}

.info-pop[hidden] {
  display: none !important;
}

.ticker-link {
  color: #a8c7b8;
  text-decoration: none;
  font-weight: 650;
}

.ticker-link:hover {
  text-decoration: underline;
}

.stock-detail-page .summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.chart-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px 16px 0;
}

.range-btn {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.range-btn.active {
  background: rgba(130, 205, 255, 0.2);
  border-color: rgba(130, 205, 255, 0.55);
}

.chart-wrap {
  height: 360px;
  padding: 12px 16px 18px;
}

.terms-panel {
  max-width: 900px;
}

.terms-panel h3 {
  margin: 8px 0;
}

.billing-panel {
  max-width: 980px;
}

.billing-plans {
  margin: 8px 0 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.billing-plan-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  align-content: start;
  gap: 8px;
}

.billing-plan-featured {
  border-color: rgba(130, 205, 255, 0.65);
  background: rgba(130, 205, 255, 0.13);
}

.billing-plan-badge {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b8e0ff;
}

.billing-plan-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.billing-plan-price {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 800;
}

.billing-plan-price span {
  font-size: 0.88rem;
  color: var(--muted);
  margin-left: 4px;
}

.billing-plan-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.billing-plan-card .google-btn {
  margin: 2px 0 0;
}

.billing-plan-list {
  margin: 0;
  padding-left: 18px;
  color: #d9e7f6;
  font-size: 0.84rem;
  line-height: 1.45;
}

.billing-plan-list li {
  margin: 0 0 4px;
}

.floating-chat-button {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1200;
  border: none;
  border-radius: 999px;
  padding: 12px 16px;
  min-width: 76px;
  background: #2245d5;
  color: #f7fbff;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(17, 49, 140, 0.45);
}

.floating-chat-button:hover {
  filter: brightness(1.06);
}

.floating-chat-popup {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1201;
  width: min(360px, calc(100vw - 24px));
  height: min(500px, calc(100vh - 36px));
  min-width: 320px;
  min-height: 320px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  display: none;
  grid-template-rows: auto 1fr auto;
  background: #f5f7fb;
  border: 1px solid #dbe2ee;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(5, 22, 53, 0.28);
  overflow: hidden;
  resize: none;
}

.floating-chat-header {
  padding: 12px 14px;
  border-bottom: 1px solid #e5eaf3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: #1e3048;
  background: #f8fbff;
}

.floating-chat-title {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.chat-powered-by {
  font-size: 0.72rem;
  color: #6a7b92;
}

.floating-chat-close {
  border: none;
  background: transparent;
  color: #6d7c92;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}

.floating-chat-messages {
  overflow: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f5f7fb;
}

.floating-chat-message {
  max-width: 84%;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
  line-height: 1.45;
  word-wrap: break-word;
}

.floating-chat-message.user {
  margin-left: auto;
  background: #dfe7fb;
  color: #22344f;
}

.floating-chat-message.assistant {
  margin-right: auto;
  background: #f5ecd1;
  color: #5c4d2f;
}

.floating-chat-message.pending {
  opacity: 0.78;
  font-style: italic;
}

.floating-chat-form {
  border-top: 1px solid #e5eaf3;
  padding: 10px 10px 12px;
  background: #f8fbff;
}

.floating-chat-note {
  margin: 0 0 8px;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #6a7b92;
}

.floating-chat-form textarea {
  width: 100%;
  resize: none;
  border: 1px solid #d5deeb;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  color: #1e3048;
  background: #fff;
}

.floating-chat-form textarea:focus {
  outline: none;
  border-color: #8eb3ff;
  box-shadow: 0 0 0 2px rgba(53, 111, 255, 0.15);
}

.floating-chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.floating-chat-input-row textarea {
  min-height: 40px;
  max-height: 120px;
}

.floating-chat-actions {
  margin-top: 6px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.floating-chat-actions .range-btn {
  border: 1px solid #c8d5ea;
  background: #ffffff;
  color: #1e3048;
  font-weight: 600;
}

.floating-chat-actions .range-btn:hover {
  background: #eef4ff;
  border-color: #9ab4e3;
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border: none;
  border-radius: 999px;
  background: #143b9f;
  color: #ffffff;
  padding: 0;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(14, 45, 122, 0.35);
}

.chat-send-btn:hover {
  background: #0f3186;
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.chat-resize-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  z-index: 1202;
  background: transparent;
  border: none;
  border-radius: 0;
}

.chat-resize-handle.nw {
  top: 3px;
  left: 3px;
  cursor: nwse-resize;
}

.chat-resize-handle.ne {
  top: 3px;
  right: 3px;
  cursor: nesw-resize;
}

.chat-resize-handle.sw {
  bottom: 3px;
  left: 3px;
  cursor: nesw-resize;
}

.chat-resize-handle.se {
  bottom: 3px;
  right: 3px;
  cursor: nwse-resize;
}

@media (max-width: 1050px) {
  .two-col-grid {
    grid-template-columns: 1fr;
  }

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

  .activity-lists {
    grid-template-columns: 1fr;
  }

  .dashboard-hero {
    flex-direction: column;
  }

  .hero-meta {
    text-align: left;
  }

  .hero-links {
    justify-content: flex-start;
  }
}

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

  .floating-chat-popup {
    right: 12px;
    bottom: 12px;
  }

  .floating-chat-button {
    right: 14px;
    bottom: 14px;
  }

  .chat-resize-handle {
    display: none;
  }
}
