:root {
  --bg: #07100f;
  --panel: rgba(13, 25, 26, 0.86);
  --panel-strong: rgba(18, 34, 35, 0.94);
  --line: rgba(255, 255, 255, 0.1);
  --text: #edf9f6;
  --muted: #8aa09b;
  --green: #35f29a;
  --red: #ff5b6e;
  --amber: #ffbf47;
  --cyan: #36d8ff;
  --pink: #ff4fd8;
  --violet: #8d72ff;
  --orange: #ff7a45;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: "Inter", "Noto Sans Thai", system-ui, sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(53, 242, 154, 0.18), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(255, 79, 216, 0.16), transparent 28%),
    linear-gradient(135deg, #07100f 0%, #0d1717 45%, #130f1a 100%);
}

button {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  background: rgba(5, 12, 12, 0.72);
  backdrop-filter: blur(22px);
}

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

.brand-mark {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  background: #001329;
  box-shadow: 0 16px 35px rgba(54, 216, 255, 0.2), inset 0 0 0 1px rgba(255, 191, 71, 0.25);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.22);
}

.brand > div:not(.brand-mark) strong,
.brand > div:not(.brand-mark) span {
  display: block;
}

.brand > div:not(.brand-mark) span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
}

.nav-item.active,
.nav-item:hover {
  color: var(--text);
  border-color: rgba(53, 242, 154, 0.22);
  background: rgba(53, 242, 154, 0.08);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--green);
  background: rgba(53, 242, 154, 0.12);
}

.risk-box {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 24px;
  padding: 18px;
  border: 1px solid rgba(255, 191, 71, 0.24);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 191, 71, 0.12), rgba(255, 79, 216, 0.08));
}

.risk-box span,
.eyebrow {
  color: var(--amber);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.risk-box strong {
  display: block;
  margin: 8px 0;
}

.risk-box p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.dashboard {
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.topbar h1,
.panel-heading h2,
.signal-panel h2 {
  margin: 0;
  line-height: 1.16;
}

.topbar h1 {
  max-width: 780px;
  font-size: clamp(1.7rem, 4vw, 3.4rem);
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 8px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button,
.primary-button,
.ghost-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.icon-button {
  width: 44px;
  font-size: 1.25rem;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  color: #03110b;
  font-weight: 800;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  text-decoration: none;
}

.ghost-button {
  padding: 0 14px;
}

.ghost-button:hover {
  border-color: rgba(54, 216, 255, 0.35);
  background: rgba(54, 216, 255, 0.08);
}

.ghost-button.danger:hover {
  border-color: rgba(255, 91, 110, 0.38);
  background: rgba(255, 91, 110, 0.08);
}

.data-mode {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(255, 191, 71, 0.3);
  border-radius: 8px;
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 800;
  background: rgba(255, 191, 71, 0.08);
}

.version-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(54, 216, 255, 0.34);
  border-radius: 8px;
  color: #dffaff;
  font-size: 0.78rem;
  font-weight: 900;
  background: rgba(54, 216, 255, 0.1);
}

.market-strip,
.workspace-grid,
.insight-grid {
  display: grid;
  gap: 16px;
}

.market-strip {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 16px;
}

.market-strip article,
.watch-panel,
.signal-panel,
.news-panel,
.alert-panel,
.engine-panel,
.settings-panel,
.settings-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.market-strip article {
  min-height: 104px;
  padding: 18px;
  overflow: hidden;
}

.market-strip .gold-card {
  border-color: rgba(255, 191, 71, 0.28);
  background:
    linear-gradient(145deg, rgba(255, 191, 71, 0.14), rgba(255, 255, 255, 0.03)),
    var(--panel);
}

.market-strip span,
.stock-meta,
.setup-grid dt {
  color: var(--muted);
  font-size: 0.82rem;
}

.market-strip strong {
  display: block;
  margin: 9px 0 4px;
  font-size: 1.45rem;
}

.market-strip em {
  font-style: normal;
  font-weight: 800;
}

.up {
  color: var(--green);
}

.down {
  color: var(--red);
}

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

.workspace-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(330px, 0.7fr);
  margin-bottom: 16px;
}

.watch-panel,
.signal-panel,
.news-panel,
.alert-panel,
.engine-panel,
.settings-panel,
.settings-card {
  padding: 20px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.segmented button {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.segmented button.active {
  color: #04110c;
  font-weight: 800;
  background: var(--green);
}

.stock-table {
  display: grid;
  gap: 8px;
}

.stock-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 122px 90px 92px;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.025)),
    rgba(7, 18, 18, 0.78);
  cursor: pointer;
}

.stock-row.active,
.stock-row:hover {
  border-color: rgba(54, 216, 255, 0.55);
  background:
    linear-gradient(135deg, rgba(54, 216, 255, 0.14), rgba(53, 242, 154, 0.075)),
    rgba(7, 18, 18, 0.9);
}

.stock-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ticker-chip {
  display: grid;
  place-items: center;
  min-width: 58px;
  height: 46px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid rgba(54, 216, 255, 0.36);
  color: #eafffb;
  font-size: 0.78rem;
  font-weight: 900;
  background:
    linear-gradient(135deg, rgba(54, 216, 255, 0.22), rgba(53, 242, 154, 0.16)),
    rgba(4, 14, 15, 0.9);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 10px 24px rgba(0, 0, 0, 0.2);
  text-shadow: 0 1px 8px rgba(54, 216, 255, 0.36);
}

.stock-title strong,
.stock-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-title strong,
.price-cell strong,
.score-cell strong {
  color: #f6fffc;
}

.stock-title strong {
  font-weight: 850;
}

.price-cell strong,
.score-cell strong {
  display: block;
}

.signal-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 800;
}

.signal-buy {
  color: #05120c;
  background: var(--green);
}

.signal-watch {
  color: #130d03;
  background: var(--amber);
}

.signal-risk {
  color: #fff;
  background: var(--red);
}

.signal-panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(150deg, rgba(53, 242, 154, 0.12), transparent 38%),
    linear-gradient(330deg, rgba(255, 79, 216, 0.13), transparent 45%),
    var(--panel-strong);
}

.ticker-orb {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  margin-bottom: 16px;
  border-radius: 8px;
  color: #03110b;
  font-size: 1.3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--green), var(--cyan), var(--amber));
}

.score-ring {
  display: grid;
  place-items: center;
  width: 160px;
  height: 160px;
  margin: 22px auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #0f2020 0 56%, transparent 57%),
    conic-gradient(var(--green), var(--cyan), var(--pink), rgba(255, 255, 255, 0.08) 82%);
}

.score-ring span {
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1;
}

.score-ring small {
  color: var(--muted);
  font-size: 0.78rem;
}

.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
}

.setup-grid div {
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.setup-grid dd {
  margin: 7px 0 0;
  font-weight: 800;
}

.setup-reason {
  margin: 16px 0 0;
  color: #c5d7d3;
  line-height: 1.7;
}

.insight-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.75fr) minmax(280px, 0.65fr);
}

.live-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  color: #06110d;
  font-size: 0.78rem;
  font-weight: 900;
  background: var(--green);
}

.news-feed {
  display: grid;
  gap: 10px;
}

.news-item {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.news-item header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.news-item strong {
  color: var(--text);
}

.news-item p {
  margin: 0;
  color: #c9d9d6;
  line-height: 1.65;
}

.impact {
  white-space: nowrap;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
}

.phone-frame {
  min-height: 294px;
  padding: 16px;
  border: 1px solid rgba(54, 216, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(54, 216, 255, 0.12), transparent),
    #081416;
}

.telegram-bubble {
  padding: 14px;
  border-radius: 8px;
  color: #eaf9ff;
  line-height: 1.65;
  white-space: pre-line;
  background: linear-gradient(135deg, rgba(54, 216, 255, 0.28), rgba(141, 114, 255, 0.2));
}

.engine-bars {
  display: grid;
  gap: 18px;
}

.engine-bars label {
  display: grid;
  gap: 8px;
  color: #cfe0dd;
  font-weight: 700;
}

.engine-bars span {
  display: block;
  height: 12px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.engine-bars i {
  display: block;
  width: 60%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--cyan), var(--pink));
  transition: width 260ms ease;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 48px));
  padding: 14px 16px;
  border: 1px solid rgba(53, 242, 154, 0.32);
  border-radius: 8px;
  color: var(--text);
  background: rgba(10, 24, 22, 0.96);
  box-shadow: var(--shadow);
  transform: translateY(24px);
  opacity: 0;
  pointer-events: none;
  transition: 220ms ease;
}

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

.creator-credit {
  position: fixed;
  right: 16px;
  bottom: 14px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: #e9fffa;
  font-size: 0.74rem;
  font-weight: 800;
  background: rgba(5, 14, 15, 0.84);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(14px);
}

.creator-credit span + span {
  color: var(--cyan);
}

.settings-panel {
  margin-top: 16px;
}

.release-panel {
  margin-top: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1fr) minmax(280px, 0.8fr);
  gap: 16px;
}

.release-list {
  display: grid;
  gap: 12px;
}

.release-item {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(54, 216, 255, 0.08), rgba(53, 242, 154, 0.04)),
    rgba(255, 255, 255, 0.035);
}

.release-item header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.release-item header span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 8px;
  color: #03110b;
  font-size: 0.78rem;
  font-weight: 900;
  background: var(--green);
}

.release-item header strong {
  color: var(--text);
}

.release-item time {
  color: var(--muted);
  font-size: 0.82rem;
}

.release-item ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: #d7e8e4;
  line-height: 1.55;
}

.settings-card {
  display: grid;
  align-content: start;
  gap: 14px;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.035);
}

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

.settings-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 8px;
  color: #03110b;
  font-weight: 900;
  background: linear-gradient(135deg, var(--amber), var(--green), var(--cyan));
}

.settings-title h3 {
  margin: 0;
  font-size: 1.05rem;
}

.settings-title p,
.settings-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.settings-card label {
  display: grid;
  gap: 8px;
  color: #d5e4e1;
  font-size: 0.86rem;
  font-weight: 700;
}

.settings-card input,
.settings-card select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  background: rgba(3, 13, 13, 0.72);
  outline: none;
}

.settings-card input:focus,
.settings-card select:focus {
  border-color: rgba(53, 242, 154, 0.55);
  box-shadow: 0 0 0 3px rgba(53, 242, 154, 0.12);
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.status-list {
  display: grid;
  gap: 10px;
}

.status-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.status-list span {
  color: var(--muted);
  font-size: 0.84rem;
}

.status-list strong.ready {
  color: var(--green);
}

.status-list strong.warning {
  color: var(--amber);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .brand div:not(.brand-mark),
  .nav-item span:last-child,
  .risk-box {
    display: none;
  }

  .sidebar {
    padding: 22px;
  }

  .market-strip,
  .insight-grid,
  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .news-panel,
  .status-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    margin: 0;
  }

  .brand div:not(.brand-mark) {
    display: block;
  }

  .nav-list {
    display: flex;
  }

  .nav-item {
    width: 42px;
    min-height: 42px;
    padding: 0;
    justify-content: center;
  }

  .dashboard {
    padding: 18px;
  }

  .topbar,
  .panel-heading {
    display: grid;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .market-strip,
  .workspace-grid,
  .insight-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

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

  .stock-row .score-cell,
  .stock-row .signal-cell {
    display: none;
  }

  .creator-credit {
    right: 10px;
    bottom: 10px;
  }
}

@media (max-width: 520px) {
  .brand div:not(.brand-mark) {
    display: none;
  }

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

  .segmented {
    width: 100%;
  }

  .segmented button {
    flex: 1;
    padding: 0 8px;
  }

  .release-item header {
    grid-template-columns: 1fr;
    align-items: start;
  }
}
