/* v2 mock: the four rebuilt tool pages (KPI report, SPSS viewer, EA chart + code, sheet-to-phone). */

/* shared: free-tier note, segmented control */
.limit { margin-top: 14px; font-size: 14px; color: var(--mute); }
.limit a { color: var(--ink); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--wash); border-radius: 10px; flex-wrap: wrap; }
.seg button { border: 0; background: none; border-radius: 7px; padding: 6px 12px; font-size: 13px; font-weight: 500; color: var(--mute); cursor: pointer; }
.seg [aria-pressed="true"] { background: #fff; color: var(--ink); outline: 1px solid var(--line); }

/* KPI: report page */
.report { padding: 20px; }
.report-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.report-bar h2 { font-size: 18px; font-weight: 600; }
.slicer { display: flex; flex-wrap: wrap; gap: 6px; }
.slicer button { border: 1px solid var(--line-2); background: #fff; border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.slicer [aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.card-kpi { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; min-width: 0; }
.card-kpi small { display: block; font-size: 13px; color: var(--mute); }
.card-kpi b { display: block; font-size: 24px; letter-spacing: -.02em; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-kpi span { font-size: 13px; }
.card-kpi .flat { color: var(--mute); }
.visuals { display: grid; grid-template-columns: 1.5fr 1fr; gap: 12px; margin-top: 12px; }
.visual { margin: 0; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; min-width: 0; }
.visual figcaption { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; min-height: 32px; }
.hint { font-size: 12.5px; font-weight: 400; color: var(--mute); }
.chart { width: 100%; height: auto; display: block; margin-top: 6px; cursor: crosshair; touch-action: none; user-select: none; }
.chart text { font-size: 11px; fill: var(--mute); }
.chart .grid { stroke: #ececef; }
.chart .area { fill: var(--blue); opacity: .1; }
.chart .line { fill: none; stroke: var(--blue); stroke-width: 2; stroke-linejoin: round; }
.chart .brush { fill: var(--blue); opacity: .12; }
.bars { display: grid; gap: 4px; margin-top: 8px; }
.bar { display: grid; grid-template-columns: minmax(70px, 110px) 1fr 48px; gap: 10px; align-items: center; border: 0; background: none; padding: 6px; border-radius: 6px; font-size: 13px; text-align: left; cursor: pointer; }
.bar:hover { background: var(--subtle); }
.bar.on { background: var(--blue-bg); }
.bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar i { height: 8px; border-radius: 4px; background: #eef0f3; display: block; overflow: hidden; }
.bar em { display: block; height: 100%; background: var(--blue); border-radius: 4px; transition: width .3s cubic-bezier(.2,.8,.2,1); }
.bar b { text-align: right; font-weight: 500; }

/* Survey: SPSS output viewer */
.toggle.item > span { display: flex; flex-direction: column; }
.toggle.item small { font-size: 12.5px; color: var(--mute); }
.toggle.item.weak > span { color: var(--red); }
.viewer { padding: 20px; }
.gauge-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; font-weight: 500; }
.gauge-head b { font-size: 32px; letter-spacing: -.03em; }
.gauge-track { position: relative; height: 10px; border-radius: 5px; background: #eef0f3; margin-top: 10px; }
.gauge-track i { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: var(--green); transition: width .35s cubic-bezier(.2,.8,.2,1), background-color .2s; }
.gauge-track i.low { background: var(--red); }
.gauge-track .mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }
.gauge-track .mark em { position: absolute; top: 18px; left: -14px; font-size: 12px; font-style: normal; color: var(--mute); }
.spss { margin-top: 32px; overflow-x: auto; }
.spss h3, .thesis h3 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.spss table { border-collapse: collapse; font: 13px/1.4 Arial, "Anuphan", sans-serif; min-width: 100%; }
.spss th, .spss td { border-top: 1px solid #b9b9b9; border-bottom: 1px solid #b9b9b9; padding: 5px 10px; text-align: left; white-space: nowrap; font-variant-numeric: tabular-nums; }
.spss thead th { font-weight: 400; color: #333; background: #fff; vertical-align: bottom; white-space: normal; max-width: 130px; }
.spss .n { text-align: right; }
.spss tbody td:first-child { color: #264a60; background: #f3f6f8; }
.spss tr.weak td { color: var(--red); }
.thesis { margin-top: 28px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--subtle); }
.thesis p { font-size: 15px; }
.thesis .locked { margin-top: 6px; filter: blur(5px); user-select: none; }

/* EA: chart + partial code */
.slider { display: grid; gap: 4px; padding: 8px 0; font-size: 14px; }
.slider > span { display: flex; justify-content: space-between; }
.slider output { font-weight: 600; }
.slider input { width: 100%; accent-color: var(--ink); }
.side .seg { display: flex; }
.side .seg button { flex: 1; }
.ea-out { padding: 20px; display: grid; gap: 16px; }
.chart-box, .code-box { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--subtle); font-size: 13px; font-weight: 500; }
.sig-count { color: var(--mute); font-weight: 400; }
.candles { display: block; width: 100%; height: auto; background: #fff; }
.candles text { font-size: 10.5px; fill: var(--mute); }
.candles .grid { stroke: #f0f0f2; }
.candles .wick { stroke-width: 1; }
.candles .up { stroke: #16a34a; fill: #16a34a; }
.candles .dn { stroke: #dc2626; fill: #dc2626; }
.candles .ind { fill: none; stroke-width: 1.6; }
.candles .ind.f { stroke: #2563eb; }
.candles .ind.s { stroke: #f59e0b; }
.candles .ind.m { stroke: #6b7280; stroke-dasharray: 4 3; }
.candles .ind.b { stroke: #2563eb; }
.candles .sig.buy { fill: #16a34a; }
.candles .sig.sell { fill: #dc2626; }
.candles .lvl { stroke-dasharray: 5 4; stroke-width: 1.2; }
.candles .lvl.tp { stroke: #16a34a; fill: #16a34a; }
.candles .lvl.sl { stroke: #dc2626; fill: #dc2626; }
.empty { padding: 56px 24px; text-align: center; background: var(--subtle); }
.empty p { margin-top: 6px; font-size: 14px; color: var(--mute); max-width: 52ch; margin-inline: auto; }
.code { position: relative; margin: 0; padding: 10px 0; font: 13px/1.7 var(--mono); color: #27272a; overflow: auto; max-height: 440px; background: #fff; scroll-behavior: smooth; }
.code .ln i { display: inline-block; width: 44px; padding-right: 14px; text-align: right; color: #a1a1aa; font-style: normal; user-select: none; }
.code .ln.chg { animation: flash 1.2s ease-out; }
.code-actions { display: flex; gap: 6px; }
.code .ln { display: block; white-space: pre; min-height: 1.7em; padding-right: 16px; }
.code mark { background: none; color: #2563eb; font-weight: 500; border-radius: 3px; padding: 0 2px; }
.code mark.flash { animation: flash 1s ease-out; }
@keyframes flash { from { background: #dbeafe; } to { background: transparent; } }
.risk { font-size: 13px; color: var(--mute); }

/* Automation: sheet + phone */
.flow { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; margin-top: 32px; }
.sheet-bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.sheet-wrap { overflow-x: auto; }
.sheet { border-collapse: collapse; width: 100%; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.sheet th, .sheet td { border: 1px solid #e3e3e6; height: 34px; padding: 0; }
.sheet thead th, .sheet tbody th { background: #f6f6f7; color: var(--mute); font-weight: 500; font-size: 12px; text-align: center; min-width: 34px; }
.sheet tr.head td { padding: 0 10px; font-weight: 600; background: #fafafa; }
.sheet input { width: 100%; min-width: 90px; height: 33px; border: 0; padding: 0 10px; background: transparent; font-size: 13.5px; }
.sheet input:focus { outline: 2px solid var(--green); outline-offset: -2px; background: #fff; }
.sheet tr.hit td { background: #fff7e6; }
.rule { padding: 16px; border-top: 1px solid var(--line); font-size: 14px; line-height: 2.4; }
.rule select, .rule input { height: 32px; border: 1px solid var(--line-2); border-radius: 6px; padding: 0 8px; background: #fff; margin: 0 4px; }
.rule input { width: 90px; }
.phone { position: sticky; top: 84px; border: 10px solid #111113; border-radius: 40px; background: #dfe8ef; min-height: 520px; overflow: hidden; display: flex; flex-direction: column; }
.phone-top { display: flex; flex-direction: column; align-items: center; padding: 14px 0 10px; background: #fff; border-bottom: 1px solid #e6e6e6; font-size: 14px; }
.phone-top span { font-size: 12px; color: var(--mute); }
.chat { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; padding: 16px 14px 20px; }
.chat .time { align-self: center; font-size: 12px; color: #4f5d6a; background: rgba(255,255,255,.6); border-radius: 999px; padding: 2px 10px; }
.chat .msg { align-self: flex-start; max-width: 92%; background: #fff; border-radius: 16px 16px 16px 4px; padding: 10px 12px; font-size: 14px; line-height: 1.5; white-space: pre-line; animation: pop .3s cubic-bezier(.2,.9,.3,1.2); }
.chat .msg.err { color: var(--red); }
.chat .none { align-self: center; font-size: 13px; color: #4f5d6a; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .code mark.flash, .code .ln.chg, .chat .msg { animation: none; } .code { scroll-behavior: auto; } }

@media (max-width: 960px) {
  .flow { grid-template-columns: 1fr; }
  .phone { position: static; min-height: 420px; max-width: 360px; margin: 0 auto; width: 100%; }
  .visuals { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .cards { grid-template-columns: 1fr 1fr; }
}

/* EA rebalanced: controls beside the chart (same height), full code underneath at full width */
.tool.ea-top { align-items: stretch; }
.ea-chart { padding: 20px; display: flex; flex-direction: column; gap: 12px; height: 100%; }
.ea-chart .chart-box { flex: 1; display: flex; flex-direction: column; }
.ea-chart .candles { flex: 1; }
.ea-code { margin-top: 24px; overflow: hidden; }
.ea-code .code-box { border: 0; border-radius: 0; }
.ea-code .code { max-height: 480px; }
.code-toggle .ico { transition: transform .2s; }
.code-toggle[aria-expanded="true"] .ico { transform: rotate(180deg); }
.ea-code .chart-head { border-bottom: 0; }
.ea-code .code { border-top: 1px solid var(--line); }

/* Telegram: bot settings + bot that types, then sends */
.flow-left { display: grid; gap: 16px; min-width: 0; }
.bot-settings { padding: 16px; display: grid; gap: 14px; }
.bot-settings .rule { padding: 0; border: 0; }
.checks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 14px; }
.checks > span { color: var(--mute); }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); margin: 0; }
.bot-settings .toggle { border-top: 1px solid var(--line); padding-top: 12px; }
.phone-top { flex-direction: row; justify-content: center; gap: 10px; text-align: left; }
.phone-top > div { display: flex; flex-direction: column; line-height: 1.3; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #2aa3df; color: #fff; font: 600 15px var(--sans); font-style: normal; display: grid; place-items: center; }
.chat .msg { display: flex; flex-direction: column; gap: 1px; white-space: normal; }
.chat .msg .sub { color: #5d6b78; font-size: 12.5px; margin-bottom: 4px; }
.chat .msg .list-head { margin-top: 6px; }
.chat .msg .li { font-size: 13.5px; }
.chat .msg small { align-self: flex-end; font-size: 11.5px; color: #5f6b78; margin-top: 2px; }
/* phone runs the full height of the sheet + settings column, so both sides end on one line */
.flow { align-items: stretch; }
/* height comes from the left column only (height 0 + min-height 100%), so new messages scroll inside the phone instead of stretching it */
.flow .phone { position: static; height: 0; min-height: 100%; }
@media (max-width: 960px) { .flow .phone { height: 560px; min-height: 0; } }
.flow .chat { flex: 1; min-height: 0; overflow-y: auto; justify-content: flex-start; scrollbar-width: thin; }
.flow .chat > :first-child { margin-top: auto; }
.chat .old { opacity: .55; }
.chat .note { align-self: center; font-size: 13px; color: var(--red); background: #fff; border-radius: 10px; padding: 6px 10px; }
.sheet input.bad, .rule input.bad { background: var(--red-bg); color: var(--red); box-shadow: inset 0 0 0 1.5px var(--red); }
.sheet .del { width: 34px; text-align: center; }
.sheet .del button { width: 26px; height: 26px; border: 0; border-radius: 6px; background: none; color: var(--mute); font-size: 16px; cursor: pointer; }
.sheet .del button:hover { background: var(--red-bg); color: var(--red); }
.add-row { display: block; width: 100%; border: 0; border-top: 1px solid var(--line); background: none; padding: 10px; font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.add-row:hover { background: var(--subtle); }
.chat .msg .skip { margin-top: 6px; font-size: 12.5px; color: #8a5a00; }
.typing { align-self: flex-start; display: flex; gap: 4px; background: #fff; border-radius: 16px 16px 16px 4px; padding: 12px 14px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: #9aa6b2; animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: .3; } }

/* hire box with a bold question and a detail line */
.cta-text b { display: block; font-size: 17px; font-weight: 600; color: var(--ink); }
.cta-text p { margin-top: 6px; }
.cta.long { align-items: flex-end; }
.cta.long .cta-text { flex: 1 1 520px; }
.cta.long .cta-text p { max-width: 64ch; line-height: 1.7; }
