/* ta.css — technical toolkit pages (/technical-screener, /market-breadth,
   /relative-strength, /candlestick-patterns, /divergences, /technical-setup,
   /portfolio-technicals, /strategy-library).
   Layers on market.css: every colour/radius/shadow comes from the ff-* tokens,
   and every class here is ta-* prefixed so nothing leaks into other pages. */

.ta-nav { margin: 0 0 14px; }
.ta-nav a { white-space: nowrap; }
.ta-crumbs { font-size: .82rem; color: var(--ff-text-soft); margin: 0 2px 10px;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ta-crumbs a { color: var(--ff-accent); text-decoration: none; }
.ta-crumbs a:hover { text-decoration: underline; }
.ta-crumbs span { color: var(--ff-text-faint); }

.ta-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ta-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
/* minmax(0,1fr), not 1fr: a bare 1fr has an `auto` minimum, so a wide table
   inside a card would stretch the column past the phone's edge. */
@media (max-width: 900px) { .ta-grid2, .ta-grid3 { grid-template-columns: minmax(0, 1fr); } }
.ta-grid2 > *, .ta-grid3 > * { min-width: 0; }
/* .ff-hero h1 is a flex row (emoji + title); a title with inline spans must flow as text */
.ff-hero h1.ta-h1 { display: block; }

.ta-card { background: var(--ff-card); border: 1px solid var(--ff-border);
  border-radius: var(--ff-radius); box-shadow: var(--ff-shadow); padding: 14px 16px;
  margin-bottom: 14px; min-width: 0; }
.ta-card h2, .ta-card h3 { margin: 0 0 8px; font-size: 1.02rem; color: var(--ff-primary); }
.ta-card p { margin: 6px 0; line-height: 1.55; color: var(--ff-text); font-size: .92rem; }
.ta-muted { color: var(--ff-text-soft); font-size: .85rem; }
.ta-small { font-size: .78rem; color: var(--ff-text-soft); }

/* score + badges */
.ta-score { display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; padding: 2px 8px; border-radius: 999px; font-weight: 700;
  font-size: .82rem; background: var(--ff-neutral-soft); color: var(--ff-neutral-deep); }
.ta-score.s-hi { background: var(--ff-success-soft); color: var(--ff-success-deep); }
.ta-score.s-mid { background: var(--ff-warning-soft); color: var(--ff-warning-deep); }
.ta-score.s-lo { background: var(--ff-danger-soft); color: var(--ff-danger-deep); }
.ta-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .74rem;
  font-weight: 600; background: var(--ff-neutral-soft); color: var(--ff-neutral-deep);
  white-space: nowrap; }
.ta-badge.b-pos { background: var(--ff-success-soft); color: var(--ff-success-deep); }
.ta-badge.b-neg { background: var(--ff-danger-soft); color: var(--ff-danger-deep); }
.ta-badge.b-warn { background: var(--ff-warning-soft); color: var(--ff-warning-deep); }
.ta-badge.b-acc { background: var(--ff-accent-soft); color: var(--ff-accent); }
.t-pos { color: var(--ff-success); }
.t-neg { color: var(--ff-danger); }

/* the big gauge on /technical-setup */
.ta-hero-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.ta-gauge { --pct: 50; width: 132px; height: 132px; border-radius: 50%; flex: 0 0 auto;
  background: conic-gradient(var(--g-col, var(--ff-accent)) calc(var(--pct) * 1%), #e8edf5 0);
  display: flex; align-items: center; justify-content: center; }
.ta-gauge-in { width: 104px; height: 104px; border-radius: 50%; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ta-gauge-in b { font-size: 1.9rem; color: var(--ff-primary); line-height: 1; }
.ta-gauge-in span { font-size: .7rem; color: var(--ff-text-soft); text-transform: uppercase;
  letter-spacing: .04em; margin-top: 3px; text-align: center; }
.ta-kvgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px; }
.ta-kv { background: var(--ff-bg); border: 1px solid var(--ff-border-soft);
  border-radius: var(--ff-radius-sm); padding: 8px 10px; min-width: 0; }
.ta-kv .k { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ff-text-soft); font-weight: 600; }
.ta-kv .v { font-size: .98rem; font-weight: 700; color: var(--ff-text); margin-top: 2px;
  overflow-wrap: anywhere; }

/* score breakdown */
.ta-comp { border-top: 1px solid var(--ff-border-soft); padding: 10px 0; }
.ta-comp:first-child { border-top: none; }
.ta-comp-head { display: flex; justify-content: space-between; align-items: center;
  gap: 10px; font-weight: 700; color: var(--ff-primary); }
.ta-bar { height: 8px; background: #e8edf5; border-radius: 99px; overflow: hidden;
  margin: 6px 0 4px; }
.ta-bar i { display: block; height: 100%; background: var(--ff-accent); border-radius: 99px; }
.ta-rules { list-style: none; margin: 4px 0 0; padding: 0; }
.ta-rules li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0;
  font-size: .86rem; border-bottom: 1px dashed var(--ff-border-soft); }
.ta-rules li:last-child { border-bottom: none; }
.ta-rules .ok::before { content: "✓ "; color: var(--ff-success); font-weight: 700; }
.ta-rules .no::before { content: "✗ "; color: var(--ff-danger); font-weight: 700; }
.ta-rules .pts { white-space: nowrap; font-weight: 600; color: var(--ff-text-soft); }

/* screener builder */
.ta-builder { background: var(--ff-card); border: 1px solid var(--ff-border);
  border-radius: var(--ff-radius); box-shadow: var(--ff-shadow); padding: 14px; margin-bottom: 14px; }
.ta-group { border: 1px dashed #c9d6ea; border-radius: 10px; padding: 10px; margin: 8px 0;
  background: #fbfcfe; }
.ta-group .ta-group { background: #fff; }
.ta-group-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 6px; font-size: .84rem; color: var(--ff-text-soft); }
.ta-cond { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 0;
  border-bottom: 1px solid var(--ff-border-soft); }
.ta-cond:last-child { border-bottom: none; }
.ta-builder select, .ta-builder input[type=number], .ta-builder input[type=text],
.ta-builder textarea, .ta-field {
  font: inherit; font-size: .86rem; padding: 6px 8px; border: 1px solid var(--ff-border);
  border-radius: 8px; background: #fff; color: var(--ff-text); max-width: 100%; }
.ta-builder select.ta-f { min-width: 190px; }
.ta-builder input[type=number] { width: 92px; }
.ta-builder textarea { width: 100%; min-height: 70px; font-family: ui-monospace, Consolas, monospace; }
.ta-mini { font-size: .78rem; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--ff-border);
  background: #fff; cursor: pointer; color: var(--ff-text-soft); }
.ta-mini:hover { border-color: var(--ff-accent); color: var(--ff-accent); }
.ta-mini.danger:hover { border-color: var(--ff-danger); color: var(--ff-danger); }
.ta-andor { display: inline-flex; border: 1px solid var(--ff-border); border-radius: 8px; overflow: hidden; }
.ta-andor button { border: 0; background: #fff; padding: 4px 10px; font-size: .78rem;
  cursor: pointer; color: var(--ff-text-soft); font-weight: 600; }
.ta-andor button.on { background: var(--ff-primary); color: #fff; }
.ta-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.ta-qtext { font-family: ui-monospace, Consolas, monospace; font-size: .82rem;
  background: var(--ff-bg); border: 1px solid var(--ff-border-soft); border-radius: 8px;
  padding: 8px 10px; overflow-wrap: anywhere; color: var(--ff-primary); }
.ta-err { color: var(--ff-danger); font-size: .86rem; margin-top: 6px; }

.ta-preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.ta-preset { display: block; padding: 10px 12px; background: var(--ff-card); border: 1px solid var(--ff-border);
  border-radius: var(--ff-radius-sm); text-decoration: none; color: inherit; box-shadow: var(--ff-shadow); }
.ta-preset:hover { box-shadow: var(--ff-shadow-hover); border-color: var(--ff-accent); }
.ta-preset b { display: block; color: var(--ff-primary); font-size: .9rem; }
.ta-preset span { display: block; font-size: .76rem; color: var(--ff-text-soft); margin-top: 2px; }

/* breadth */
.ta-meter { display: flex; align-items: center; gap: 8px; font-size: .84rem; }
.ta-meter .ta-bar { flex: 1 1 auto; margin: 0; min-width: 60px; }
.ta-chart { position: relative; height: 260px; }
.ta-chart.tall { height: 320px; }
.ta-heat td[data-heat] { font-weight: 600; }
.ta-alerts { list-style: none; margin: 0; padding: 0; }
.ta-alerts li { padding: 8px 10px; border-radius: 8px; margin-bottom: 6px; font-size: .88rem;
  border-left: 4px solid var(--ff-neutral); background: var(--ff-neutral-soft); }
.ta-alerts li.bad { border-left-color: var(--ff-danger); background: var(--ff-danger-soft); }
.ta-alerts li.warn { border-left-color: var(--ff-warning); background: var(--ff-warning-soft); }
.ta-alerts li.good { border-left-color: var(--ff-success); background: var(--ff-success-soft); }
.ta-alerts li small { display: block; color: var(--ff-text-soft); margin-top: 2px; }

/* portfolio editor */
.ta-hold { display: grid; grid-template-columns: 1fr 110px 34px; gap: 6px; margin-bottom: 6px; }
.ta-hold input { font: inherit; font-size: .86rem; padding: 6px 8px; border: 1px solid var(--ff-border);
  border-radius: 8px; min-width: 0; }
.ta-lists { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }

.ta-disclaimer { font-size: .78rem; color: var(--ff-text-soft); border-top: 1px solid var(--ff-border);
  margin-top: 18px; padding-top: 10px; line-height: 1.5; }
.ta-prose { max-width: 920px; }
.ta-prose p, .ta-prose li { line-height: 1.6; }

/* strategy cards */
.ta-strat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.ta-strat { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; background: var(--ff-card);
  border: 1px solid var(--ff-border); border-radius: var(--ff-radius-sm); box-shadow: var(--ff-shadow);
  text-decoration: none; color: inherit; }
.ta-strat:hover { box-shadow: var(--ff-shadow-hover); border-color: var(--ff-accent); }
.ta-strat b { color: var(--ff-primary); }
.ta-strat .ta-rule { font-size: .8rem; color: var(--ff-text); }
.ta-strat .ta-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }

@media (max-width: 600px) {
  .ta-gauge { width: 108px; height: 108px; }
  .ta-gauge-in { width: 84px; height: 84px; }
  .ta-gauge-in b { font-size: 1.5rem; }
  .ta-builder select.ta-f { min-width: 0; width: 100%; }
  .ta-cond > * { flex: 1 1 auto; }
  .ta-chart { height: 220px; }
  .ta-hold { grid-template-columns: 1fr 80px 34px; }
}

/* phones: the eight toolkit tabs become one swipeable row instead of four */
@media (max-width: 600px) {
  .ta-nav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; }
  .ta-nav::-webkit-scrollbar { display: none; }
  .ta-nav a { flex: 0 0 auto; }
}
