.tmBtn { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; min-height: 32px; padding: 4px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel2); color: var(--text); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.tmBtn:hover, .tmBtn:focus-visible { border-color: var(--orange); color: var(--orangeText, var(--orange)); outline: none; }
.tmBtn[hidden] { display: none; }
#tmDlg { width: min(760px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); padding: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); font: 13px/1.4 -apple-system, "Segoe UI", Roboto, sans-serif; }
#tmDlg::backdrop { background: rgba(0, 0, 0, .6); }
#tmDlg .tmHead { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--panel); }
#tmDlg .tmHead h3 { margin: 0; font-size: 15px; }
#tmDlg .tmHead small { color: var(--muted); }
#tmDlg .tmHead button { margin-left: auto; min-width: 36px; min-height: 36px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel2); color: var(--text); cursor: pointer; }
#tmDlg[open] { display: flex; flex-direction: column; }
#tmDlg .tmBody { flex: 1 1 auto; min-height: 0; padding: 12px 14px 16px; overflow: auto; }
#tmDlg .tmGrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 10px; }
#tmDlg .tmF { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 11px; color: var(--muted); }
#tmDlg .tmF.wide { grid-column: span 2; }
#tmDlg .tmF input, #tmDlg .tmF select { width: 100%; min-width: 0; height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; font-size: 13px; }
#tmDlg .tmF input:focus, #tmDlg .tmF select:focus { outline: none; border-color: var(--orange); }
#tmDlg .tmF label { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 12px; height: 32px; white-space: nowrap; }
#tmDlg .tmF label input[type=checkbox] { flex: none; width: 18px; height: 18px; margin: 0; padding: 0; accent-color: var(--orange); }
#tmDlg .tmSeg { display: flex; gap: 0; }
#tmDlg .tmSeg button { flex: 1; height: 32px; border: 1px solid var(--border); background: var(--panel2); color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
#tmDlg .tmSeg button:first-child { border-radius: 6px 0 0 6px; }
#tmDlg .tmSeg button:last-child { border-radius: 0 6px 6px 0; border-left: 0; }
#tmDlg .tmSeg button.on { background: var(--orange); border-color: var(--orange); color: var(--onOrange); }
#tmDlg .tmOpt { grid-column: 1 / -1; display: grid; grid-template-columns: inherit; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 10px; padding: 8px; border: 1px dashed var(--border); border-radius: 8px; }
#tmDlg .tmOpt[hidden] { display: none; }
#tmDlg .tmGo { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
#tmDlg #tmRun { min-height: 36px; padding: 0 18px; border: 1px solid var(--orange); border-radius: 6px; background: var(--orange); color: var(--onOrange); font: inherit; font-weight: 700; cursor: pointer; }
#tmDlg #tmRun:disabled { opacity: .6; cursor: progress; }
#tmDlg #tmMsg { color: var(--muted); font-size: 12px; }
#tmDlg #tmMsg.neg { color: var(--bear); }
#tmDlg .tmKpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
#tmDlg .tmKpi { padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel2); min-width: 0; }
#tmDlg .tmKpi b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#tmDlg .tmKpi b.sm { font-size: 13px; line-height: 1.5; }
#tmDlg .tmKpi span { color: var(--muted); font-size: 11px; }
#tmDlg .pos { color: var(--bull); }
#tmDlg .neg { color: var(--bear); }
#tmDlg table.tmTab { width: 100%; margin-top: 12px; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
#tmDlg table.tmTab th, #tmDlg table.tmTab td { padding: 5px 6px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
#tmDlg table.tmTab th:first-child, #tmDlg table.tmTab td:first-child { text-align: left; color: var(--muted); }
#tmDlg table.tmTab thead th { color: var(--orangeText, var(--orange)); font-size: 10px; letter-spacing: .6px; text-transform: uppercase; }
#tmDlg .tmTabWrap { overflow-x: auto; }
#tmDlg .tmCharts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
#tmDlg .tmChart { padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel2); }
#tmDlg .tmChart h5 { margin: 0 0 4px; font-size: 10px; letter-spacing: .6px; text-transform: uppercase; color: var(--orangeText, var(--orange)); }
#tmDlg .tmChart svg { display: block; width: 100%; height: 120px; }
#tmDlg .tmVerdict { margin-top: 12px; padding: 8px 10px; border-left: 3px solid var(--orange); background: rgba(255, 107, 0, .08); border-radius: 4px; }
#tmDlg .tmNotes { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; }
#tmDlg .tmWin, #tmDlg .tmDisc { margin-top: 8px; color: var(--muted); font-size: 11px; }
@media (max-width: 640px) {
  #tmDlg { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
  #tmDlg .tmGrid, #tmDlg .tmOpt { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #tmDlg .tmKpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #tmDlg .tmKpi:first-child { grid-column: 1 / -1; }
  #tmDlg .tmCharts { grid-template-columns: 1fr; }
  #tmDlg .tmF input, #tmDlg .tmF select { height: 40px; font-size: 16px; }
  #tmDlg .tmSeg button { height: 40px; }
}
