:root {
  color-scheme: light;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background: #f5f7f8;
  color: #17202a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #dce3e7;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  font-weight: 750;
}

.topbar p {
  color: #63717a;
  margin-top: 4px;
}

button {
  background: #126c57;
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  min-height: 40px;
  padding: 0 16px;
}

a.link-button {
  align-items: center;
  background: #e8edf0;
  border-radius: 6px;
  color: #42515a;
  display: inline-flex;
  font-weight: 700;
  min-height: 40px;
  padding: 0 14px;
  text-decoration: none;
}

.header-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.secondary-button {
  background: #e8edf0;
  color: #42515a;
}

input {
  border: 1px solid #cfd9dd;
  border-radius: 6px;
  color: #17202a;
  font: inherit;
  min-height: 40px;
  min-width: 180px;
  padding: 0 12px;
}

main {
  display: grid;
  gap: 18px;
  margin: 0 auto;
  max-width: 1440px;
  padding: 22px;
}

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

.history-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab {
  background: #e8edf0;
  color: #42515a;
}

.tab.active {
  background: #126c57;
  color: #ffffff;
}

.summary div,
.scanner,
.history,
.signal-panel,
.details {
  background: #ffffff;
  border: 1px solid #dce3e7;
  border-radius: 8px;
}

.summary div {
  display: grid;
  gap: 6px;
  padding: 18px;
}

.status-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 18px;
}

.status-grid div {
  border: 1px solid #edf1f3;
  border-radius: 8px;
  display: grid;
  gap: 6px;
  padding: 12px;
}

.status-grid span {
  color: #63717a;
  font-size: 13px;
}

.status-grid strong {
  font-size: 15px;
}

.error-line {
  color: #9c2424;
  font-size: 13px;
  padding: 0 18px 18px;
}

.summary span,
.section-title span {
  color: #63717a;
  font-size: 13px;
}

.summary strong {
  font-size: 28px;
}

.section-title {
  align-items: center;
  border-bottom: 1px solid #dce3e7;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 16px 18px;
}

.section-title h2 {
  font-size: 17px;
}

.watchlist-tools,
.watchlist-form {
  align-items: center;
  display: flex;
  gap: 10px;
}

.symbol-search {
  position: relative;
}

.suggestions {
  background: #ffffff;
  border: 1px solid #cfd9dd;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(23, 32, 42, 0.14);
  left: 0;
  max-height: 280px;
  overflow-y: auto;
  position: absolute;
  right: 0;
  top: 44px;
  z-index: 10;
}

.suggestion {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #edf1f3;
  border-radius: 0;
  color: #17202a;
  display: flex;
  justify-content: space-between;
  min-height: 44px;
  padding: 8px 12px;
  width: 100%;
}

.suggestion:hover {
  background: #f4f8f6;
}

.suggestion span {
  color: #63717a;
  font-size: 12px;
}

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

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

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

th,
td {
  border-bottom: 1px solid #edf1f3;
  padding: 12px 14px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: #63717a;
  font-size: 12px;
  text-transform: uppercase;
}

tr {
  cursor: pointer;
}

tr:hover td {
  background: #f8fafb;
}

.badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  min-width: 78px;
  padding: 5px 9px;
  text-align: center;
}

.BUY {
  background: #dff6ec;
  color: #10603f;
}

.SELL {
  background: #fde7e7;
  color: #9c2424;
}

.NO_TRADE {
  background: #eef1f3;
  color: #53616a;
}

.ACTIVE_TRADE {
  background: #fff4cf;
  color: #8a5a00;
}

.status-pill {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  min-width: 78px;
  padding: 5px 9px;
  text-align: center;
}

.status-open,
.open {
  background: #fff3c4;
  color: #8a5a00;
}

.status-closed {
  background: #dbeafe;
  color: #1d4ed8;
}

.target-1-hit {
  background: #dcfce7;
  color: #166534;
}

.target-2-hit {
  background: #86efac;
  color: #14532d;
}

.target-3-hit {
  background: #15803d;
  color: #ffffff;
}

.sl-hit {
  background: #fee2e2;
  color: #991b1b;
}

.icon-button {
  align-items: center;
  background: #eef1f3;
  border-radius: 50%;
  color: #53616a;
  display: inline-flex;
  font-size: 18px;
  height: 30px;
  justify-content: center;
  min-height: 30px;
  padding: 0;
  width: 30px;
}

.icon-button.danger:hover {
  background: #fde7e7;
  color: #9c2424;
}

.votes {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  padding: 18px;
}

.vote {
  border: 1px solid #e3e9ec;
  border-radius: 8px;
  padding: 12px;
}

.vote.rejection {
  background: #fff5f5;
  border-color: #fecaca;
}

.vote.active-trade {
  background: #fffbeb;
  border-color: #facc15;
}

.vote strong {
  display: block;
  margin-bottom: 8px;
}

.vote p {
  color: #63717a;
  font-size: 13px;
  margin-top: 8px;
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .header-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  main {
    padding: 14px;
  }

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

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

  .signal-board {
    grid-template-columns: 1fr;
  }

  .section-title,
  .watchlist-tools,
  .watchlist-form {
    align-items: stretch;
    flex-direction: column;
  }

  input,
  .watchlist-form button {
    width: 100%;
  }
}

.history-page {
  background: #f7fafc;
  overflow-x: hidden;
}

.history-hero {
  align-items: center;
  background: #ffffff;
  box-shadow: 0 4px 18px rgba(31, 41, 55, 0.08);
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 30px;
}

.hero-title {
  align-items: center;
  display: flex;
  gap: 18px;
}

.hero-title h1 {
  font-size: 34px;
}

.hero-title p {
  color: #53627a;
  font-size: 16px;
  margin-top: 6px;
}

.hero-icon {
  align-items: center;
  background: #eef5ff;
  border-radius: 16px;
  color: #2563eb;
  display: flex;
  font-size: 34px;
  font-weight: 900;
  height: 68px;
  justify-content: center;
  width: 68px;
}

.history-main {
  max-width: calc(100vw - 32px);
  overflow-x: hidden;
  padding: 18px 16px 28px;
  width: calc(100vw - 32px);
}

.history-main > * {
  max-width: 100%;
  min-width: 0;
}

.history-filter-bar {
  align-items: end;
  background: #ffffff;
  border: 1px solid #dce3e7;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(31, 41, 55, 0.06);
  display: grid;
  gap: 16px;
  grid-template-columns: 190px 300px 160px 160px minmax(170px, 1fr) 170px;
  padding: 20px 26px;
}

.filter-field {
  display: grid;
  gap: 8px;
}

.filter-field label {
  color: #344054;
  font-size: 14px;
  font-weight: 800;
}

.filter-field input,
.filter-field select {
  border: 1px solid #cfd9dd;
  border-radius: 8px;
  color: #17202a;
  font: inherit;
  min-height: 48px;
  padding: 0 14px;
  width: 100%;
}

.quick-filters {
  border: 1px solid #cfd9dd;
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

.quick-filter {
  background: #ffffff;
  border-radius: 0;
  border-right: 1px solid #dce3e7;
  color: #344054;
  min-height: 48px;
}

.quick-filter:last-child {
  border-right: 0;
}

.quick-filter.active {
  background: #dff6ec;
  color: #10603f;
}

.download-report-button {
  min-height: 48px;
  width: 100%;
}

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

.metric-card {
  align-items: center;
  background: #f8fbff;
  border: 1px solid #e1e8ee;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(31, 41, 55, 0.06);
  display: grid;
  gap: 14px;
  grid-template-columns: 58px 1fr;
  min-height: 116px;
  padding: 14px 16px;
}

.metric-card.wide {
  grid-column: span 1;
  min-height: 116px;
}

.target-card {
  background: #f6fffa;
  border-color: #a7dbc0;
  grid-template-columns: 58px 0.9fr 1.2fr;
  min-height: 116px;
}

.metric-card:nth-child(1),
.metric-card:nth-child(4) {
  background: #f5f8ff;
}

.metric-card:nth-child(3),
.metric-card:nth-child(6) {
  background: #fff7f7;
}

.metric-card:nth-child(5) {
  background: #fbf7ff;
}

.metric-icon {
  align-items: center;
  border-radius: 14px;
  display: flex;
  font-size: 17px;
  font-weight: 900;
  height: 50px;
  justify-content: center;
  width: 50px;
}

.metric-icon.blue {
  background: #e8f0ff;
  color: #2563eb;
}

.metric-icon.green {
  background: #dff6ec;
  color: #087b42;
}

.metric-icon.red {
  background: #fee8e8;
  color: #dc2626;
}

.metric-icon.purple {
  background: #f1e8ff;
  color: #7e22ce;
}

.metric-card span,
.metric-card small {
  color: #53627a;
}

.metric-card strong {
  color: #0f172a;
  display: block;
  font-size: 26px;
  line-height: 1.1;
  margin: 4px 0;
}

.target-card .metric-center {
  text-align: center;
}

.target-card .metric-center strong {
  color: #087b42;
}

.metric-icon.red + div strong {
  color: #dc2626;
}

.metric-icon.blue + div strong {
  color: #2563eb;
}

.metric-icon.purple + div strong {
  color: #7e22ce;
}

.target-split {
  border-left: 1px solid #dce3e7;
  border-top: 0;
  display: grid;
  grid-column: auto;
  grid-template-columns: repeat(3, 1fr);
  padding-left: 10px;
  padding-top: 0;
  text-align: center;
}

.target-split div {
  border-right: 1px solid #dce3e7;
}

.target-split div:last-child {
  border-right: 0;
}

.target-split strong {
  color: #087b42;
  font-size: 16px;
}

.closed-table-card {
  background: #ffffff;
  border: 1px solid #dce3e7;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(31, 41, 55, 0.06);
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
  width: 100%;
}

.closed-table-head {
  align-items: center;
  border-bottom: 1px solid #dce3e7;
  display: flex;
  justify-content: space-between;
  padding: 14px 28px;
}

.closed-table-head h2 {
  font-size: 18px;
}

.closed-table-head span {
  color: #53627a;
}

.closed-table-wrap {
  max-width: 100%;
  overflow-x: hidden;
  width: 100%;
}

.closed-table {
  min-width: 0;
  table-layout: fixed;
  width: 100%;
}

.closed-table th,
.closed-table td {
  font-size: 11px;
  padding: 8px 4px;
}

.closed-table th:nth-child(1),
.closed-table td:nth-child(1) {
  width: 12%;
}

.closed-table th:nth-child(2),
.closed-table td:nth-child(2) {
  width: 8%;
}

.closed-table th:nth-child(3),
.closed-table td:nth-child(3),
.closed-table th:nth-child(4),
.closed-table td:nth-child(4),
.closed-table th:nth-child(5),
.closed-table td:nth-child(5) {
  width: 7%;
}

.closed-table th:nth-child(6),
.closed-table td:nth-child(6),
.closed-table th:nth-child(7),
.closed-table td:nth-child(7),
.closed-table th:nth-child(8),
.closed-table td:nth-child(8),
.closed-table th:nth-child(9),
.closed-table td:nth-child(9),
.closed-table th:nth-child(10),
.closed-table td:nth-child(10) {
  width: 7.5%;
}

.closed-table th:nth-child(11),
.closed-table td:nth-child(11) {
  width: 10%;
}

.closed-table .badge,
.closed-table .status-pill {
  font-size: 11px;
  min-width: 60px;
  padding: 4px 6px;
}

.confidence-cell {
  color: #2563eb;
  font-weight: 800;
}

.sl-cell {
  color: #dc2626;
}

.target-cell {
  color: #087b42;
}

@media (max-width: 1200px) {
  .history-filter-bar,
  .history-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .history-hero,
  .hero-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .history-filter-bar,
  .history-card-grid {
    grid-template-columns: 1fr;
  }

  .metric-card.wide {
    grid-column: span 1;
  }
}

.fo-page {
  background: #f7fafc;
  overflow-x: hidden;
}

.fo-hero {
  align-items: center;
  background: #ffffff;
  border: 1px solid #e1e8ee;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(31, 41, 55, 0.08);
  display: flex;
  justify-content: space-between;
  margin: 2px 8px 0;
  padding: 24px;
}

.fo-icon {
  background: #eafaf3;
  color: #0f9f6e;
}

.fo-main {
  max-width: calc(100vw - 28px);
  overflow-x: hidden;
  padding: 18px 14px 26px;
  width: calc(100vw - 28px);
}

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

.fo-summary-card {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dce3e7;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(31, 41, 55, 0.06);
  display: flex;
  justify-content: space-between;
  min-height: 130px;
  padding: 24px;
}

.fo-summary-card span,
.fo-summary-card small,
.control-title p,
.control-grid span {
  color: #53627a;
}

.fo-summary-card strong {
  color: #2563eb;
  display: block;
  font-size: 40px;
  line-height: 1.1;
  margin: 8px 0;
}

.status-card strong {
  color: #07804f;
  font-size: 32px;
}

.live-pill {
  background: #dff6ec;
  border-radius: 999px;
  color: #07804f;
  font-weight: 900;
  padding: 8px 16px;
}

.summary-icon,
.mini-icon {
  align-items: center;
  border-radius: 50%;
  display: flex;
  font-weight: 900;
  justify-content: center;
}

.summary-icon {
  font-size: 26px;
  height: 72px;
  width: 72px;
}

.mini-icon {
  height: 42px;
  width: 42px;
}

.summary-icon.green,
.mini-icon.green {
  background: #dff6ec;
  color: #07804f;
}

.summary-icon.blue {
  background: #e8f0ff;
  color: #2563eb;
}

.summary-icon.purple {
  background: #f1e8ff;
  color: #7e22ce;
}

.fo-control {
  background: #ffffff;
  border: 1px solid #dce3e7;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(31, 41, 55, 0.06);
  overflow: hidden;
}

.fo-control-head {
  align-items: center;
  border-bottom: 1px solid #dce3e7;
  display: flex;
  justify-content: space-between;
  padding: 20px 24px;
}

.control-title,
.control-actions {
  align-items: center;
  display: flex;
  gap: 12px;
}

.control-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 16px 24px;
}

.control-grid div {
  background: #ffffff;
  border: 1px solid #e1e8ee;
  border-radius: 9px;
  display: grid;
  gap: 6px;
  padding: 14px;
}

.control-grid strong {
  font-size: 16px;
}

.fo-error {
  background: #fff1f1;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
  font-weight: 700;
  margin: 0 24px 16px;
  padding: 12px 16px;
}

.fo-signal-board {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fo-signal-card {
  background: #ffffff;
  border: 1px solid #dce3e7;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(31, 41, 55, 0.06);
  overflow: hidden;
  min-width: 0;
}

.fo-signal-head {
  align-items: center;
  border-bottom: 1px solid #dce3e7;
  display: flex;
  justify-content: space-between;
  padding: 16px 20px;
}

.fo-signal-head h2 {
  font-size: 20px;
}

.fo-signal-head span {
  border-radius: 999px;
  font-weight: 900;
  padding: 7px 14px;
}

.buy-head span {
  background: #dff6ec;
  color: #07804f;
}

.sell-head span {
  background: #fee2e2;
  color: #dc2626;
}

.fo-signal-table {
  min-width: 0;
  table-layout: fixed;
  width: 100%;
}

.fo-signal-table th,
.fo-signal-table td {
  font-size: 13px;
  padding: 11px 10px;
}

.fo-signal-table th:nth-child(1),
.fo-signal-table td:nth-child(1) {
  width: 22%;
}

.fo-signal-table th:nth-child(2),
.fo-signal-table td:nth-child(2),
.fo-signal-table th:nth-child(3),
.fo-signal-table td:nth-child(3) {
  width: 12%;
}

.fo-signal-table th:nth-child(n+4),
.fo-signal-table td:nth-child(n+4) {
  width: 10.8%;
}

.table-footer {
  background: #ffffff;
  border-top: 1px solid #edf1f3;
  color: #07804f;
  display: block;
  font-weight: 900;
  min-height: 48px;
  padding: 14px;
  text-align: center;
  width: 100%;
}

.signal-modal {
  align-items: center;
  background: rgba(15, 23, 42, 0.38);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  padding: 24px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 100;
}

.signal-modal[hidden] {
  display: none;
}

.signal-modal-panel {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: 82vh;
  max-width: 1180px;
  overflow: hidden;
  width: min(1180px, 96vw);
}

.signal-modal-head {
  align-items: center;
  border-bottom: 1px solid #dce3e7;
  display: flex;
  justify-content: space-between;
  padding: 16px 20px;
}

.signal-modal-body {
  overflow-y: auto;
}

.modal-table {
  min-width: 0;
}

.modal-open {
  overflow: hidden;
}

@media (max-width: 980px) {
  .fo-hero,
  .fo-control-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .fo-summary,
  .fo-signal-board,
  .control-grid {
    grid-template-columns: 1fr;
  }
}

.algo-page {
  background: #f7fafc;
  overflow-x: hidden;
}

.algo-hero {
  margin: 0;
}

.algo-icon {
  background: #ecfdf3;
  color: #087b42;
}

.algo-main {
  max-width: calc(100vw - 28px);
  padding: 18px 14px 28px;
  width: calc(100vw - 28px);
}

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

.algo-metric {
  background: #ffffff;
  border: 1px solid #dce3e7;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(31, 41, 55, 0.06);
  display: grid;
  gap: 6px;
  min-height: 118px;
  padding: 18px;
}

.algo-metric span,
.algo-metric small,
.algo-control p,
.algo-mini-grid span,
.algo-status {
  color: #53627a;
}

.algo-metric strong {
  color: #0f172a;
  font-size: 30px;
  line-height: 1.1;
}

.algo-metric.profit strong,
.profit-text,
.positive {
  color: #087b42;
  font-weight: 900;
}

.algo-metric.loss strong,
.loss-text,
.negative {
  color: #dc2626;
  font-weight: 900;
}

.algo-control,
.algo-table-card {
  background: #ffffff;
  border: 1px solid #dce3e7;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(31, 41, 55, 0.06);
  overflow: hidden;
}

.algo-control-head {
  align-items: center;
  border-bottom: 1px solid #dce3e7;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 18px 22px;
}

.fund-form {
  align-items: center;
  display: flex;
  gap: 10px;
}

.algo-mini-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 16px 22px;
}

.algo-mini-grid div {
  border: 1px solid #e1e8ee;
  border-radius: 8px;
  display: grid;
  gap: 6px;
  padding: 12px;
}

.algo-mini-grid strong {
  font-size: 18px;
}

.algo-status {
  border-top: 1px solid #edf1f3;
  font-weight: 700;
  padding: 12px 22px;
}

.algo-table {
  min-width: 1540px;
}

.algo-table th,
.algo-table td {
  font-size: 12px;
  padding: 10px 9px;
}

.basis-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exit-price {
  min-width: 110px;
  width: 110px;
}

@media (max-width: 980px) {
  .algo-card-grid,
  .algo-mini-grid {
    grid-template-columns: 1fr;
  }

  .algo-control-head,
  .fund-form {
    align-items: stretch;
    flex-direction: column;
  }
}
