/* ============================================================
   NSE Breakout Screener — page styles.
   Builds on /shared.css tokens (var(--ink), --card, --brand, …).
   ============================================================ */

body {
  padding-top: 56px;
}

.app {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0 16px 40px;
}

.hero {
  padding: 26px 22px;
  border-radius: 16px;
  background: linear-gradient(110deg, #0a8f66, #1456d8);
  color: #fff;
  box-shadow: 0 14px 34px rgba(27, 41, 67, 0.14);
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.6rem, 2.8vw, 2.1rem);
}

.hero p {
  margin: 10px 0 0;
  opacity: 0.95;
  line-height: 1.5;
}

.disclaimer {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(179, 38, 30, 0.28);
  background: rgba(179, 38, 30, 0.06);
  color: #6d1a15;
  font-size: 0.9rem;
  line-height: 1.5;
}

.controls {
  margin-top: 16px;
  padding: 16px;
  border-radius: 14px;
  background: var(--card, #fff);
  border: 1px solid rgba(10, 143, 102, 0.16);
  box-shadow: 0 10px 24px rgba(27, 41, 67, 0.08);
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  align-items: flex-end;
}

.ctl {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted, #5b6577);
  font-weight: 600;
}

.ctl select,
.ctl input[type='range'] {
  font-family: inherit;
  font-size: 0.92rem;
}

.ctl select {
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid rgba(31, 36, 48, 0.2);
  background: #fff;
  color: var(--ink, #1f2430);
  min-width: 150px;
}

.ctl input[type='range'] {
  width: 160px;
  accent-color: #0a8f66;
}

.ctl-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  cursor: pointer;
}

.ctl-check input {
  accent-color: #0a8f66;
  width: 16px;
  height: 16px;
}

#score-value {
  color: #0a8f66;
}

.btn-refresh {
  margin-left: auto;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(120deg, #0a8f66, #1456d8);
  cursor: pointer;
  transition: transform 0.18s ease;
}

.btn-refresh:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-refresh:disabled {
  opacity: 0.6;
  cursor: progress;
}

.meta-line {
  margin: 14px 0 0;
  font-size: 0.85rem;
  color: var(--muted, #5b6577);
}

.message {
  margin: 6px 0 0;
  font-size: 0.88rem;
  color: #b3261e;
  min-height: 1.1em;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin: 14px 2px 0;
  font-size: 0.82rem;
  color: var(--muted, #5b6577);
}

.legend[hidden] {
  display: none;
}

.legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.dot.tight {
  background: #0a8f66;
}

.dot.high {
  background: #1456d8;
}

.table-wrap {
  margin-top: 14px;
  border-radius: 14px;
  overflow: auto;
  background: var(--card, #fff);
  border: 1px solid rgba(20, 86, 216, 0.12);
  box-shadow: 0 10px 24px rgba(27, 41, 67, 0.08);
}

table.results {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 900px;
}

table.results th,
table.results td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(31, 36, 48, 0.08);
  white-space: nowrap;
}

table.results th {
  position: sticky;
  top: 0;
  background: #f4f8f7;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #3b465c;
  z-index: 1;
}

table.results th.num,
table.results td.num {
  text-align: right;
}

table.results th.sortable {
  cursor: pointer;
  user-select: none;
}

table.results th.sortable::after {
  content: '';
  margin-left: 6px;
  opacity: 0.4;
}

table.results th.sort-asc::after {
  content: '▲';
  opacity: 0.9;
}

table.results th.sort-desc::after {
  content: '▼';
  opacity: 0.9;
}

table.results tbody tr:hover {
  background: rgba(10, 143, 102, 0.045);
}

.sym {
  font-weight: 700;
  color: #1a2352;
}

.sym small {
  display: block;
  font-weight: 500;
  font-size: 0.72rem;
  color: var(--muted, #5b6577);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-pill {
  display: inline-block;
  min-width: 34px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
  color: #fff;
  background: #6b7280;
  text-align: center;
}

.score-pill.high {
  background: linear-gradient(120deg, #0a8f66, #1590a8);
}

.score-pill.mid {
  background: #d97706;
}

.sig {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #fff;
}

.sig.tight_base {
  background: #0a8f66;
}

.sig.high_20d {
  background: #1456d8;
}

.sig.none {
  background: #d1d5db;
  color: #4b5563;
}

.pos {
  color: #0a8f66;
}

.neg {
  color: #b3261e;
}

.empty {
  padding: 22px;
  text-align: center;
  color: var(--muted, #5b6577);
}

.footnote {
  margin: 14px 2px 0;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--muted, #5b6577);
}

@media (max-width: 720px) {
  .btn-refresh {
    margin-left: 0;
    width: 100%;
  }

  .controls-row {
    gap: 12px;
  }

  .ctl select,
  .ctl input[type='range'] {
    width: 100%;
    min-width: 0;
  }
}

/* ---------- tabs ---------- */

.tabs {
  display: flex;
  gap: 6px;
  margin: 18px 0 12px;
  border-bottom: 1px solid rgba(31, 36, 48, 0.12);
}

.tab {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--muted, #5b6577);
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  border-radius: 0;
}

.tab.active {
  color: #0a8f66;
  border-bottom-color: #0a8f66;
}

.tab:hover {
  color: #1456d8;
}

/* ---------- plan trigger + modal ---------- */

.plan-btn {
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(10, 143, 102, 0.4);
  background: rgba(10, 143, 102, 0.08);
  color: #0a8f66;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.plan-btn:hover {
  background: rgba(10, 143, 102, 0.16);
}

.plan-btn[disabled] {
  opacity: 0.35;
  cursor: default;
  border-color: rgba(31, 36, 48, 0.2);
  background: transparent;
  color: var(--muted, #5b6577);
}

.plan-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 22, 36, 0.5);
  display: grid;
  place-items: center;
  padding: 20px;
}

/* `display: grid` above would otherwise override the `hidden`
   attribute, so the modal could never be closed. */
.plan-modal[hidden] {
  display: none;
}

.plan-box {
  position: relative;
  width: min(560px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: var(--card, #fff);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(15, 22, 36, 0.34);
}

.plan-box h2 {
  margin: 0 0 2px;
  font-size: 1.2rem;
  color: #1a2352;
}

.plan-sub {
  margin: 0 0 16px;
  font-size: 0.85rem;
  color: var(--muted, #5b6577);
}

.plan-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted, #5b6577);
  cursor: pointer;
}

.plan-levels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.plan-level {
  border: 1px solid rgba(20, 86, 216, 0.16);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f7fafc;
}

.plan-level .k {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted, #5b6577);
}

.plan-level .v {
  display: block;
  font-size: 1.06rem;
  font-weight: 700;
  margin-top: 2px;
  color: #1a2352;
}

.plan-level.stop .v {
  color: #b3261e;
}

.plan-level.target .v {
  color: #0a8f66;
}

.plan-rules {
  margin: 0 0 6px;
  padding-left: 18px;
  font-size: 0.87rem;
  line-height: 1.6;
  color: #33405a;
}

.plan-sizing {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin: 14px 0 8px;
  padding-top: 14px;
  border-top: 1px solid rgba(31, 36, 48, 0.1);
}

.plan-sizing input {
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid rgba(31, 36, 48, 0.2);
  font-family: inherit;
  font-size: 0.92rem;
  width: 150px;
}

.plan-size-out {
  font-size: 0.9rem;
  font-weight: 600;
  color: #0a8f66;
  padding-bottom: 8px;
}

/* ---------- backtest ---------- */

.bt-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.bt-summary[hidden] {
  display: none;
}

.bt-card {
  background: var(--card, #fff);
  border: 1px solid rgba(20, 86, 216, 0.14);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 6px 16px rgba(27, 41, 67, 0.06);
}

.bt-card .k {
  display: block;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted, #5b6577);
}

.bt-card .v {
  display: block;
  font-size: 1.22rem;
  font-weight: 800;
  margin-top: 4px;
  color: #1a2352;
}

.bt-card .v.small {
  font-size: 0.86rem;
  font-weight: 600;
}

.bt-limits {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(179, 38, 30, 0.28);
  background: rgba(179, 38, 30, 0.06);
}

.bt-limits h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
  color: #6d1a15;
}

.bt-limits ul {
  margin: 0;
  padding-left: 20px;
}

.bt-limits li {
  font-size: 0.85rem;
  line-height: 1.6;
  color: #6d1a15;
}
