/*
 * training.css — KAAI Training System Panel Styles
 * Designed by: Johnny Black | KAAI v1.0
 * Matches the CEO Panel dark theme (var() tokens from main.css)
 */

/* ── Panel shell ────────────────────────────────────────────────────────────── */
/*
 * FIX: display:flex MUST NOT be set here — ID specificity (100) beats
 * .panel-container { display:none } (specificity 10), keeping the panel
 * permanently visible even when another tab is active.
 * Apply flex layout only via .panel-container.active#panel-training below.
 */
#panel-training {
    height: 100%;
    overflow: hidden;
}

/* Flex column layout applied only when the Training tab is active */
.panel-container.active#panel-training {
    display: flex;
    flex-direction: column;
}

.training-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.training-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #2a2a2a);
    background: var(--bg-secondary, #161616);
    flex-shrink: 0;
}

.training-header-left { display: flex; align-items: baseline; gap: 10px; }
.training-header h2   { margin: 0; font-size: 18px; font-weight: 700; color: var(--text-primary, #e0e0e0); }
.training-subtitle    { font-size: 12px; color: var(--text-muted, #555); }

/* ── Stats bar ──────────────────────────────────────────────────────────────── */
.training-stats-bar {
    display: flex;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg-tertiary, #111);
    border-bottom: 1px solid var(--border-color, #2a2a2a);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.tr-stat-card {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 8px;
    padding: 6px 14px;
    min-width: 110px;
    cursor: default;
    transition: border-color 0.2s;
}

.tr-stat-card:hover { border-color: var(--accent, #7c6fcd); }

.tr-stat-icon { font-size: 16px; }

.tr-stat-body {
    display: flex;
    flex-direction: column;
}

.tr-stat-val {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary, #e0e0e0);
    line-height: 1.1;
}

.tr-stat-lbl {
    font-size: 10px;
    color: var(--text-muted, #666);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Tab bar ────────────────────────────────────────────────────────────────── */
.training-tabs {
    display: flex;
    gap: 2px;
    padding: 8px 16px 0;
    border-bottom: 1px solid var(--border-color, #2a2a2a);
    background: var(--bg-secondary, #161616);
    flex-shrink: 0;
}

.tr-tab {
    padding: 6px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary, #aaa);
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    border-radius: 4px 4px 0 0;
}

.tr-tab:hover  { color: var(--text-primary, #e0e0e0); }
.tr-tab.active {
    color: var(--accent, #7c6fcd);
    border-bottom-color: var(--accent, #7c6fcd);
    background: rgba(124, 111, 205, 0.07);
}

/* ── Tab pane ───────────────────────────────────────────────────────────────── */
.training-tab-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.tr-tab-pane { width: 100%; }

/* ── ZTH Queue Banner — shown when Practice Mode generates exercises ─────────── */
.tr-zth-banner {
    grid-column: 1 / -1;          /* spans all grid columns */
    background: linear-gradient(135deg, #0c1a0c 0%, #0d1f10 100%);
    border: 1px solid #15803d;
    border-left: 4px solid #4ade80;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 4px;
}
.tr-zth-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}
.tr-zth-icon {
    font-size: 22px;
    flex-shrink: 0;
    line-height: 1;
}
.tr-zth-title-main {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #4ade80;
}
.tr-zth-sub {
    display: block;
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
}
.tr-zth-run-btn {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 6px;
    border: 1px solid #15803d;
    background: linear-gradient(135deg, #052e16 0%, #14532d 100%);
    color: #86efac;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
    white-space: nowrap;
}
.tr-zth-run-btn:hover {
    background: linear-gradient(135deg, #14532d 0%, #166534 100%);
    box-shadow: 0 0 8px #4ade8040;
}
.tr-zth-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tr-zth-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    padding: 4px 6px;
    background: #0a1a0a;
    border-radius: 5px;
    border: 1px solid #1a3a1a;
}
.tr-zth-area {
    color: #86efac;
    font-weight: 600;
    min-width: 100px;
    flex-shrink: 0;
}
.tr-zth-title {
    color: #c5d4e0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tr-zth-type {
    color: #fcd34d;
    font-size: 10px;
    background: #1a1a0a;
    border: 1px solid #78350f;
    border-radius: 4px;
    padding: 1px 5px;
    flex-shrink: 0;
}
.tr-zth-more {
    font-size: 11px;
    color: #6b7280;
    padding: 3px 6px;
    text-align: center;
}

/* ── Topics grid ────────────────────────────────────────────────────────────── */
.tr-topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.tr-topic-card {
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
}

.tr-topic-card:hover {
    border-color: var(--accent, #7c6fcd);
    transform: translateY(-2px);
}

.tr-topic-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.tr-topic-icon { font-size: 22px; flex-shrink: 0; }

.tr-topic-title-wrap { flex: 1; min-width: 0; }
.tr-topic-name { display: block; font-weight: 600; color: var(--text-primary, #e0e0e0); font-size: 14px; }
.tr-topic-desc { display: block; font-size: 11px; color: var(--text-muted, #666); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tr-topic-score { font-size: 18px; font-weight: 700; flex-shrink: 0; }

.tr-level-bar-wrap { margin-bottom: 8px; }

.tr-level-bar {
    height: 6px;
    background: var(--bg-tertiary, #111);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.tr-level-fill {
    height: 100%;
    background: var(--accent, #7c6fcd);
    border-radius: 3px;
    transition: width 0.4s;
}

.tr-level-label { font-size: 10px; color: var(--text-muted, #666); }

.tr-topic-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-secondary, #888);
}

/* ── Attempts table ─────────────────────────────────────────────────────────── */
.tr-attempts-list, .tr-patterns-wrap { overflow-x: auto; }

.tr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.tr-table th {
    text-align: left;
    padding: 6px 10px;
    background: var(--bg-tertiary, #111);
    color: var(--text-secondary, #888);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-color, #2a2a2a);
    white-space: nowrap;
}

.tr-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-color, #1e1e1e);
    color: var(--text-primary, #ddd);
    vertical-align: middle;
}

.tr-table tr:last-child td { border-bottom: none; }
.tr-table tr:hover td { background: rgba(255,255,255,0.03); }

.tr-pass td:first-child { border-left: 2px solid #4ade80; }
.tr-fail td:first-child { border-left: 2px solid #f87171; }

.tr-td-num   { color: var(--text-muted, #555); font-size: 11px; }
.tr-td-title { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-td-score { font-weight: 700; }
.tr-td-time  { color: var(--text-muted, #666); font-size: 10px; white-space: nowrap; }

/* ── Confidence bar ─────────────────────────────────────────────────────────── */
.tr-conf-bar {
    width: 80px;
    height: 5px;
    background: var(--bg-tertiary, #111);
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
}

.tr-conf-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s;
}

/* ── Empty state ────────────────────────────────────────────────────────────── */
.tr-empty {
    color: var(--text-muted, #555);
    font-style: italic;
    font-size: 13px;
    padding: 24px;
    text-align: center;
}

.training-spinner {
    color: var(--text-muted, #666);
    font-size: 13px;
    padding: 32px;
    text-align: center;
}

/* ── Modal overlay ──────────────────────────────────────────────────────────── */
.tr-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.tr-modal-box {
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 12px;
    padding: 20px;
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

.tr-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.tr-modal-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary, #e0e0e0);
    flex: 1;
    text-transform: capitalize;
}

.tr-modal-close {
    background: none;
    border: none;
    color: var(--text-muted, #666);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.2s;
}

.tr-modal-close:hover { color: var(--text-primary, #ddd); }

.tr-modal-desc { font-size: 12px; color: var(--text-muted, #666); margin: 0 0 12px; }

/* ── Levels grid (inside modal) ─────────────────────────────────────────────── */
.tr-levels-grid { display: flex; flex-direction: column; gap: 8px; }

.tr-level-row {
    background: var(--bg-tertiary, #111);
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 8px;
    padding: 10px 12px;
    transition: border-color 0.2s;
}

.tr-level-row.tr-locked { opacity: 0.45; }
.tr-level-row.tr-done   { border-color: rgba(74, 222, 128, 0.35); }

.tr-level-row-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.tr-level-badge { font-size: 14px; }
.tr-level-num   { font-weight: 700; font-size: 13px; color: var(--text-primary, #ddd); }
.tr-level-name  { flex: 1; font-size: 12px; color: var(--text-secondary, #aaa); }
.tr-level-avg   { font-weight: 700; font-size: 13px; }

.tr-reset-btn {
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(220, 38, 38, 0.4);
    color: #f87171;
    border-radius: 5px;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.2s;
}

.tr-reset-btn:hover { background: rgba(220, 38, 38, 0.3); }

.tr-level-detail { display: flex; flex-direction: column; gap: 5px; }

.tr-mini-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tr-mini-lbl { width: 68px; font-size: 10px; color: var(--text-muted, #666); text-align: right; }

.tr-mini-bar {
    flex: 1;
    height: 5px;
    background: var(--bg-secondary, #1a1a1a);
    border-radius: 3px;
    overflow: hidden;
}

.tr-mini-bar > div {
    height: 100%;
    background: var(--accent, #7c6fcd);
    border-radius: 3px;
    transition: width 0.4s;
}

.tr-streak-bar > div { background: #7c6fcd; }

.tr-mini-val { width: 42px; font-size: 10px; color: var(--text-secondary, #999); text-align: right; }

.tr-level-meta {
    display: flex;
    gap: 14px;
    font-size: 10px;
    color: var(--text-muted, #666);
    margin-top: 2px;
    padding-left: 76px;
}

/* ── Modal recent attempts ──────────────────────────────────────────────────── */
.tr-modal-attempts { display: flex; flex-direction: column; gap: 4px; }

.tr-mini-attempt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 8px;
    border-radius: 6px;
    background: var(--bg-tertiary, #111);
    font-size: 11px;
}

.tr-mini-attempt.tr-pass { border-left: 2px solid #4ade80; }
.tr-mini-attempt.tr-fail { border-left: 2px solid #f87171; }

.tr-mini-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary, #bbb); }

/* ── Exercises tab ──────────────────────────────────────────────────────────── */
.tr-ex-toolbar {
    padding: 12px 16px 0;
    flex-shrink: 0;
}

.tr-ex-filters { display: flex; flex-direction: column; gap: 10px; }

.tr-ex-filter-group { display: flex; align-items: flex-start; gap: 10px; }

.tr-ex-filter-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #666);
    width: 44px;
    flex-shrink: 0;
    padding-top: 5px;
}

.tr-ex-filter-btns { display: flex; flex-wrap: wrap; gap: 5px; }

.tr-ex-flt-btn {
    padding: 3px 10px;
    background: var(--bg-tertiary, #111);
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 20px;
    color: var(--text-secondary, #aaa);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.tr-ex-flt-btn:hover { border-color: var(--accent, #7c6fcd); color: var(--text-primary, #e0e0e0); }

.tr-ex-flt-btn.active {
    background: rgba(124, 111, 205, 0.15);
    border-color: var(--accent, #7c6fcd);
    color: var(--accent, #7c6fcd);
    font-weight: 600;
}

.tr-ex-count {
    font-size: 11px;
    color: var(--text-muted, #555);
    padding: 4px 0 8px;
}

.tr-ex-toolbar-row2 {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 8px;
}

.tr-ex-hidden-note {
    font-size: 10px;
    color: var(--text-muted, #555);
    font-style: italic;
    margin-left: 4px;
}

/* Exercise cards list */
.tr-ex-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px 24px;
}

.tr-ex-card {
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 10px;
    padding: 14px 16px;
    transition: border-color 0.2s;
}

.tr-ex-card:hover { border-color: rgba(124, 111, 205, 0.4); }

.tr-ex-disabled { opacity: 0.5; }

/* Passed card gets a subtle green left border */
.tr-ex-card-passed {
    border-left: 3px solid #166534;
}
.tr-ex-card-passed:hover { border-color: #16a34a; }

/* Score column — right-side of card header */
.tr-ex-score-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
    min-width: 140px;
}

.tr-ex-score-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 8px;
    border: 1px solid;
    white-space: nowrap;
}

.tr-ex-score-new {
    border-color: #374151;
    color: #6b7280;
    background: rgba(55, 65, 81, 0.2);
}

.tr-ex-score-pass {
    border-color: #166534;
    color: #4ade80;
    background: rgba(22, 101, 52, 0.2);
}

.tr-ex-score-fail {
    background: rgba(127, 29, 29, 0.15);
}

.tr-ex-last-ts {
    font-size: 10px;
    color: var(--text-muted, #555);
    white-space: nowrap;
}

/* Wave generation button — appears in live monitor footer */
.tr-lm-btn-wave {
    display: inline-block;
    margin-left: 12px;
    padding: 4px 14px;
    background: linear-gradient(135deg, #1d4ed8, #7c3aed);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}
.tr-lm-btn-wave:hover  { opacity: 0.85; }
.tr-lm-btn-wave:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Auto-Run toolbar toggle ─────────────────────────────────────────────── */
.tr-auto-run-toggle {
    font-weight: 700;
    letter-spacing: 0.02em;
    border: 1px solid rgba(100, 220, 160, 0.35) !important;
    color: #aaa !important;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.tr-auto-run-toggle.tr-auto-run-on {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.25), rgba(124, 111, 205, 0.25)) !important;
    border-color: #4ade80 !important;
    color: #4ade80 !important;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.25);
    animation: tr-auto-run-glow 2s ease-in-out infinite;
}
@keyframes tr-auto-run-glow {
    0%, 100% { box-shadow: 0 0 6px rgba(74, 222, 128, 0.2); }
    50%       { box-shadow: 0 0 14px rgba(74, 222, 128, 0.45); }
}
.tr-skip-passed-toggle {
    font-size: 11px;
}

/* ── Auto-Run: live monitor badge, countdown, inline buttons ─────────────── */
.tr-lm-auto-badge {
    display: inline-block;
    background: linear-gradient(135deg, #166534, #3730a3);
    color: #a7f3d0;
    border-radius: 6px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 700;
    margin-right: 6px;
    letter-spacing: 0.04em;
}
.tr-lm-next-title {
    color: #e0e0e0;
    font-weight: 600;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: bottom;
}
.tr-lm-countdown {
    display: inline-block;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.4);
    color: #fbbf24;
    border-radius: 6px;
    padding: 1px 8px;
    font-size: 12px;
    font-weight: 700;
    margin: 0 6px;
    min-width: 28px;
    text-align: center;
}
.tr-lm-btn-skip-wait {
    padding: 2px 10px;
    background: rgba(74, 222, 128, 0.15);
    border: 1px solid rgba(74, 222, 128, 0.4);
    color: #4ade80;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    margin-right: 4px;
    transition: background 0.15s;
}
.tr-lm-btn-skip-wait:hover { background: rgba(74, 222, 128, 0.28); }

.tr-lm-btn-stop-auto {
    padding: 2px 10px;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #f87171;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.tr-lm-btn-stop-auto:hover { background: rgba(248, 113, 113, 0.22); }

/* ── Auto-Run: "next up" exercise card highlight ─────────────────────────── */
.tr-ex-card-next-auto {
    border-color: rgba(74, 222, 128, 0.55) !important;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.18), 0 2px 12px rgba(0,0,0,0.35) !important;
    position: relative;
}
.tr-ex-card-next-auto::before {
    content: '⏭ NEXT';
    position: absolute;
    top: 8px;
    right: 10px;
    background: linear-gradient(135deg, #166534, #3730a3);
    color: #a7f3d0;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    border-radius: 5px;
    padding: 2px 7px;
    z-index: 1;
}

/* Card header */
.tr-ex-card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }

.tr-ex-topic-icon { font-size: 20px; flex-shrink: 0; }

.tr-ex-title-wrap { flex: 1; min-width: 0; }

.tr-ex-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.tr-ex-disabled-badge {
    font-size: 9px;
    background: rgba(248, 113, 113, 0.15);
    border: 1px solid rgba(248, 113, 113, 0.4);
    color: #f87171;
    border-radius: 4px;
    padding: 1px 5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.tr-ex-meta { display: flex; flex-wrap: wrap; gap: 6px; }

.tr-ex-topic-tag,
.tr-ex-level-tag,
.tr-ex-type-tag {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    border: 1px solid var(--border-color, #333);
    color: var(--text-secondary, #999);
    background: var(--bg-tertiary, #111);
}

.tr-ex-diff { font-size: 11px; font-weight: 600; }

/* Sections inside card */
.tr-ex-section { margin-bottom: 12px; }
.tr-ex-section:last-child { margin-bottom: 0; }

.tr-ex-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #666);
    margin-bottom: 6px;
}

.tr-ex-instructions {
    font-size: 13px;
    color: var(--text-secondary, #ccc);
    line-height: 1.55;
    margin: 0;
    white-space: pre-wrap;   /* preserve quiz line breaks; wrap long lines */
    word-break: break-word;
    font-family: inherit;    /* pre element overrides font — keep UI font */
    background: transparent;
}

/* ── Bond's Answer block ─────────────────────────────────────── */
.tr-ex-answer-section {
    border-left: 3px solid rgba(74, 222, 128, 0.4);
    background: rgba(74, 222, 128, 0.04);
    border-radius: 0 6px 6px 0;
    padding: 10px 12px !important;
}

.tr-ex-answer-section.tr-ex-answer-error {
    border-left-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.04);
}

.tr-ex-answer-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 8px;
    margin-left: 8px;
    vertical-align: middle;
    letter-spacing: 0.3px;
}

.tr-ex-answer-badge-pass {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.tr-ex-answer-badge-pending {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.tr-ex-answer-badge-err {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.tr-ex-answer-text {
    font-size: 12.5px;
    color: #d4ffd4;
    line-height: 1.6;
    margin: 6px 0 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    background: transparent;
}

.tr-ex-answer-err-text {
    color: #fca5a5;
}

/* Input → Expected table */
.tr-ex-pairs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.tr-ex-pairs-table th {
    text-align: left;
    padding: 5px 10px;
    background: var(--bg-tertiary, #111);
    color: var(--text-secondary, #888);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-color, #2a2a2a);
}

.tr-ex-pairs-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-color, #1a1a1a);
    vertical-align: top;
}

.tr-ex-pairs-table tr:last-child td { border-bottom: none; }

.tr-ex-input code {
    background: rgba(124, 111, 205, 0.12);
    color: #a5b4fc;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
}

.tr-ex-expected { color: var(--text-secondary, #bbb); line-height: 1.6; }

.tr-ex-key {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #666);
    margin-right: 2px;
}

.tr-ex-expected code {
    background: rgba(74, 222, 128, 0.1);
    color: #86efac;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
}

.tr-ex-note {
    font-size: 10px;
    color: var(--text-muted, #666);
    margin-top: 3px;
    font-style: italic;
}

/* Hints list */
.tr-ex-hints {
    margin: 0;
    padding-left: 18px;
    color: var(--text-secondary, #aaa);
    font-size: 12px;
    line-height: 1.7;
}

.tr-ex-hints li { margin-bottom: 2px; }

/* Solution block */
.tr-ex-solution {
    background: var(--bg-tertiary, #111);
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 12px;
    color: #86efac;
    font-family: monospace;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

/* ── Run Exercise footer ──────────────────────────────────────────────────── */
.tr-ex-run-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0 2px;
    border-top: 1px solid var(--border-color, #2a2a2a);
    margin-top: 10px;
}

/* Push delete button to the far right of the footer */
.tr-ex-delete-btn {
    margin-left: auto;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    border-radius: 5px;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.15s, background 0.15s, border-color 0.15s;
}
.tr-ex-delete-btn:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.7);
}

.btn-run-ex {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    letter-spacing: 0.3px;
}

.btn-run-ex:hover:not(:disabled) {
    background: linear-gradient(135deg, #1e40af, #1d4ed8);
}

.btn-run-ex:disabled,
.btn-run-ex.btn-run-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #374151;
}

.tr-ex-run-hint {
    font-size: 11px;
    color: var(--text-muted, #555);
    font-style: italic;
}

/* ══════════════════════════════════════════════════════════════════════════
   LIVE TRAINING MONITOR OVERLAY  (tr-lm-*)
   Opens full-screen when CEO clicks "▶ Run via KAAI" on any exercise.
   Polls /api/training/run/{run_id}/poll every 400 ms until score = 100.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Floating monitor panel — NON-BLOCKING ───────────────────────────────── */
/* No backdrop, no inset:0 — training runs in the corner; CEO keeps all panels */
.tr-lm-overlay {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9000;
    /* No background dim — other panels stay fully interactive */
    animation: tr-lm-fade-in 0.18s ease;
    /* Pointer-events only on the box itself, not the surrounding space */
    pointer-events: none;
}

@keyframes tr-lm-fade-in {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Monitor box ─────────────────────────────────────────────────────────── */
.tr-lm-box {
    width: min(680px, 96vw);
    max-height: 72vh;
    background: #0d1117;
    border: 1px solid #30363d;
    border-top: 2px solid #238636;   /* green accent — visually distinct from dimmed panels */
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: all;             /* box is fully interactive */
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255,255,255,0.05);
    resize: both;
    cursor: default;
}

/* Minimised state — only header + progress bar visible */
.tr-lm-box.tr-lm-minimised .tr-lm-terminal,
.tr-lm-box.tr-lm-minimised .tr-lm-history,
.tr-lm-box.tr-lm-minimised .tr-lm-footer {
    display: none;
}
.tr-lm-box.tr-lm-minimised {
    max-height: none;
    resize: none;
}

/* ── Header bar ──────────────────────────────────────────────────────────── */
.tr-lm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 11px;
    background: #161b22;
    border-bottom: 1px solid #21262d;
    gap: 12px;
    flex-shrink: 0;
}

.tr-lm-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

/* Pulsing live indicator */
.tr-lm-pulse {
    font-size: 14px;
    color: #3fb950;
    animation: tr-lm-pulse-anim 1.1s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes tr-lm-pulse-anim {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.25; }
}

.tr-lm-pulse-done {
    font-size: 14px;
    color: #3fb950;
    animation: none;
    flex-shrink: 0;
}

.tr-lm-pulse-fail {
    font-size: 14px;
    color: #f85149;
    animation: none;
    flex-shrink: 0;
}

#tr-lm-headline {
    font-size: 14px;
    font-weight: 600;
    color: #e6edf3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tr-lm-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.tr-lm-run-id {
    font-size: 11px;
    color: #484f58;
    font-family: monospace;
    background: #0d1117;
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid #21262d;
}

.tr-lm-close {
    background: none;
    border: 1px solid #30363d;
    color: #8b949e;
    border-radius: 6px;
    padding: 3px 9px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.5;
}

.tr-lm-close:hover {
    background: #21262d;
    border-color: #484f58;
    color: #e6edf3;
}

/* ── Meta bar (attempt / agent / score / status) ─────────────────────────── */
.tr-lm-meta-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 16px;
    background: #0d1117;
    border-bottom: 1px solid #21262d;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.tr-lm-meta-bar span {
    font-size: 12px;
    color: #8b949e;
}

.tr-lm-score-badge {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #e6edf3 !important;
    background: #7f1d1d;
    border-radius: 5px;
    padding: 2px 9px;
    font-family: monospace;
    transition: background 0.3s;
}

/* Status tags */
.tr-lm-tag {
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    padding: 2px 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.tr-lm-tag-running {
    background: rgba(31, 111, 235, 0.2);
    color: #58a6ff;
    border: 1px solid rgba(31, 111, 235, 0.3);
    animation: tr-lm-tag-blink 1.8s ease-in-out infinite;
}

@keyframes tr-lm-tag-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.55; }
}

.tr-lm-tag-perfect {
    background: rgba(46, 160, 67, 0.2);
    color: #3fb950;
    border: 1px solid rgba(46, 160, 67, 0.3);
}

.tr-lm-tag-plateau {
    background: rgba(210, 153, 34, 0.2);
    color: #d29922;
    border: 1px solid rgba(210, 153, 34, 0.3);
}

.tr-lm-tag-fail {
    background: rgba(248, 81, 73, 0.15);
    color: #f85149;
    border: 1px solid rgba(248, 81, 73, 0.25);
}

/* ── Progress bar ────────────────────────────────────────────────────────── */
.tr-lm-progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 16px;
    border-bottom: 1px solid #21262d;
    flex-shrink: 0;
}

.tr-lm-progress-track {
    flex: 1;
    height: 8px;
    background: #21262d;
    border-radius: 4px;
    overflow: hidden;
}

.tr-lm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1d4ed8, #3b82f6);
    border-radius: 4px;
    transition: width 0.4s ease, background 0.4s ease;
    min-width: 2px;
}

/* Green when 100% */
.tr-lm-progress-fill[style*="width: 100%"],
.tr-lm-progress-fill[style*="width:100%"] {
    background: linear-gradient(90deg, #166534, #3fb950);
}

.tr-lm-progress-label {
    font-size: 12px;
    color: #8b949e;
    font-family: monospace;
    white-space: nowrap;
    min-width: 52px;
    text-align: right;
}

/* ── Terminal / log window ───────────────────────────────────────────────── */
.tr-lm-terminal {
    flex: 1;
    min-height: 220px;
    max-height: 360px;
    overflow-y: auto;
    background: #010409;
    padding: 10px 14px;
    font-family: 'Cascadia Code', 'Fira Mono', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.65;
    border-bottom: 1px solid #21262d;
}

.tr-lm-terminal::-webkit-scrollbar { width: 6px; }
.tr-lm-terminal::-webkit-scrollbar-track { background: transparent; }
.tr-lm-terminal::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }

/* Log line base */
.tr-lm-log-line        { color: #c9d1d9; display: block; }
.tr-lm-dim             { color: #484f58; }

/* Coloured log variants */
.tr-lm-perfect  { color: #3fb950; font-weight: 700; }
.tr-lm-ok       { color: #3fb950; }
.tr-lm-err      { color: #f85149; }
.tr-lm-bond     { color: #58a6ff; }       /* ⚡ Bond */
.tr-lm-king     { color: #a371f7; }       /* 🔄 Kingsley */
.tr-lm-warn     { color: #d29922; }       /* ⚠️ LLM fallback */
.tr-lm-section  { color: #8b949e; font-weight: 600; }
.tr-lm-step     { color: #ffa657; }       /* STEP N: */

/* ── Attempt history pills ───────────────────────────────────────────────── */
.tr-lm-history {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 14px;
    border-bottom: 1px solid #21262d;
    min-height: 36px;
    align-items: center;
    flex-shrink: 0;
}

.tr-lm-pill {
    font-size: 11px;
    font-family: monospace;
    border-radius: 99px;
    padding: 2px 10px;
    cursor: default;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: transform 0.1s;
}

.tr-lm-pill:hover { transform: scale(1.06); }

.tr-lm-pill-perfect {
    background: rgba(46, 160, 67, 0.15);
    color: #3fb950;
    border-color: rgba(46, 160, 67, 0.3);
}

.tr-lm-pill-pass {
    background: rgba(31, 111, 235, 0.12);
    color: #58a6ff;
    border-color: rgba(31, 111, 235, 0.25);
}

.tr-lm-pill-fail {
    background: rgba(248, 81, 73, 0.1);
    color: #f85149;
    border-color: rgba(248, 81, 73, 0.2);
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.tr-lm-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #161b22;
    border-top: 1px solid #21262d;
    flex-shrink: 0;
    gap: 12px;
}

.tr-lm-btn-stop {
    background: #21262d;
    border: 1px solid #30363d;
    color: #e6edf3;
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.tr-lm-btn-stop:hover {
    background: #30363d;
    border-color: #484f58;
}

.tr-lm-footer-note {
    font-size: 11px;
    color: #484f58;
    font-style: italic;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Generate Tab ────────────────────────────────────────────────────────────── */

.tr-gen-wrap {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    overflow-y: auto;
    max-height: 100%;
}

.tr-gen-card {
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 10px;
    padding: 18px 20px;
    transition: border-color 0.2s;
}

.tr-gen-card:hover { border-color: #7c6fcd55; }

.tr-gen-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary, #e0e0e0);
    margin-bottom: 8px;
    letter-spacing: 0.03em;
}

.tr-gen-desc {
    font-size: 12px;
    color: var(--text-muted, #666);
    margin: 0 0 14px;
    line-height: 1.55;
}

/* ── Config detail pills ─────────────────────────────────────────────── */

.tr-gen-config-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.tr-gen-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: #1e2533;
    border: 1px solid #2d3748;
    color: #a0aec0;
    white-space: nowrap;
}

.tr-gen-pill-warn {
    background: #2d1f0a;
    border-color: #c97000;
    color: #f59e0b;
}

/* ── Config select inside the exercises toolbar ──────────────────────── */

.tr-ex-config-select {
    background: var(--bg-tertiary, #111);
    border: 1px solid var(--border-color, #2a2a2a);
    color: var(--text-primary, #e0e0e0);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    min-width: 160px;
    max-width: 280px;
}

.tr-ex-config-select:focus {
    outline: none;
    border-color: #7c6fcd;
}

.tr-ex-filter-config {
    align-items: center;
    padding: 6px 0 0;
    border-top: 1px solid var(--border-color, #2a2a3a);
    margin-top: 6px;
}

/* ── Mode tabs ───────────────────────────────────────────────────────── */

.tr-gen-mode-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.tr-gen-mode-btn {
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: var(--bg-tertiary, #111);
    border: 1px solid var(--border-color, #2a2a2a);
    color: var(--text-muted, #666);
    transition: all 0.15s;
}

.tr-gen-mode-btn:hover {
    border-color: #7c6fcd;
    color: var(--text-primary, #e0e0e0);
}

.tr-gen-mode-btn.active {
    background: #2a235c;
    border-color: #7c6fcd;
    color: #c4b5fd;
}

/* ── Mode description ────────────────────────────────────────────────── */

.tr-gen-mode-desc {
    font-size: 12px;
    color: var(--text-muted, #666);
    background: var(--bg-tertiary, #111);
    border-left: 3px solid #7c6fcd55;
    padding: 8px 12px;
    border-radius: 0 6px 6px 0;
    margin-bottom: 14px;
    line-height: 1.55;
}

/* ── Parameter rows ──────────────────────────────────────────────────── */

.tr-gen-params {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 4px;
}

.tr-gen-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tr-gen-lbl {
    font-size: 12px;
    color: var(--text-secondary, #aaa);
    font-weight: 600;
    min-width: 120px;
    white-space: nowrap;
}

.tr-gen-input {
    background: var(--bg-tertiary, #111);
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 6px;
    color: var(--text-primary, #e0e0e0);
    padding: 4px 8px;
    font-size: 12px;
    width: 80px;
    transition: border-color 0.15s;
}

.tr-gen-input:focus {
    outline: none;
    border-color: #7c6fcd;
}

.tr-gen-hint {
    font-size: 11px;
    color: var(--text-muted, #555);
    font-style: italic;
}

/* ── Action buttons ──────────────────────────────────────────────────── */

.tr-gen-btn-primary {
    padding: 6px 20px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    background: #4c1d95;
    border: 1px solid #7c6fcd;
    color: #e9d5ff;
    transition: all 0.15s;
    letter-spacing: 0.02em;
}

.tr-gen-btn-primary:hover { background: #5b21b6; border-color: #a78bfa; }
.tr-gen-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.tr-gen-btn-secondary {
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: var(--bg-tertiary, #111);
    border: 1px solid var(--border-color, #2a2a2a);
    color: var(--text-secondary, #aaa);
    transition: all 0.15s;
}

.tr-gen-btn-secondary:hover {
    border-color: #7c6fcd;
    color: var(--text-primary, #e0e0e0);
}

/* ── Result display ──────────────────────────────────────────────────── */

.tr-gen-result {
    margin-top: 14px;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 12px;
}

.tr-gen-result-ok {
    background: #0d1f17;
    border: 1px solid #16a34a55;
    color: #86efac;
}

.tr-gen-result-err {
    background: #1f0d0d;
    border: 1px solid #dc262655;
    color: #fca5a5;
}

.tr-gen-result-headline {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 4px;
}

.tr-gen-result-msg {
    color: #6ee7b7;
    margin: 0 0 10px;
    font-style: italic;
}

.tr-gen-result-table-wrap {
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
}

.tr-gen-result-table {
    font-size: 11px;
    width: 100%;
    border-collapse: collapse;
}

.tr-gen-result-table th,
.tr-gen-result-table td {
    padding: 4px 10px;
    border-bottom: 1px solid #1a3327;
    text-align: left;
    color: #d1fae5;
}

.tr-gen-result-table th { color: #6ee7b7; font-weight: 700; }

.tr-gen-ktype {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 10px;
    background: #1e3a5f;
    color: #93c5fd;
    font-size: 10px;
    font-weight: 600;
}

/* ── Config create form ──────────────────────────────────────────────── */

.tr-gen-form {
    background: var(--bg-tertiary, #111);
    border: 1px solid var(--border-color, #2a2a3a);
    border-radius: 8px;
    padding: 14px 16px;
    margin-top: 12px;
}

.tr-gen-form-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary, #e0e0e0);
    margin-bottom: 12px;
}

.tr-gen-config-detail { margin-top: 4px; }

.tr-gen-input[style*="flex"] { width: auto; }


/* ── ⏰ Training Schedule Tab ─────────────────────────────────────────────── */

.tr-sched-container {
    padding: 16px 0;
    max-width: 800px;
}

.tr-sched-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px;
}

.tr-sched-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary, #e0e0e0);
    margin-bottom: 4px;
}

.tr-sched-subtitle {
    font-size: 12px;
    color: var(--text-muted, #888);
    line-height: 1.5;
    max-width: 600px;
}

.tr-sched-next {
    margin-top: 8px;
    font-size: 12px;
    color: #6ee7b7;
}

.tr-sched-refresh-btn {
    background: none;
    border: 1px solid var(--border-color, #2a2a3a);
    border-radius: 6px;
    color: var(--text-muted, #888);
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tr-sched-refresh-btn:hover { color: #e0e0e0; border-color: #555; }

/* ── Schedule list ─────────────────────────────────────────────────────────── */

.tr-sched-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.tr-sched-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg, #1a1a2e);
    border: 1px solid var(--border-color, #2a2a3a);
    border-radius: 8px;
    padding: 12px 14px;
    transition: border-color 0.15s;
}
.tr-sched-row:hover { border-color: #444; }
.tr-sched-disabled { opacity: 0.5; }

.tr-sched-info { flex: 1; min-width: 0; }

.tr-sched-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
    margin-bottom: 3px;
}

.tr-sched-meta {
    font-size: 11px;
    color: var(--text-muted, #888);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tr-sched-del {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 15px;
    padding: 4px 6px;
    border-radius: 4px;
}
.tr-sched-del:hover { color: #f87171; background: rgba(248,113,113,0.1); }

/* Toggle switch */
.tr-sched-switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.tr-sched-switch input { opacity: 0; width: 0; height: 0; }
.tr-sched-slider {
    position: absolute; cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #374151;
    border-radius: 20px;
    transition: 0.2s;
}
.tr-sched-slider:before {
    position: absolute; content: '';
    height: 14px; width: 14px;
    left: 3px; bottom: 3px;
    background: #9ca3af;
    border-radius: 50%;
    transition: 0.2s;
}
.tr-sched-switch input:checked + .tr-sched-slider { background: rgba(52,211,153,0.3); }
.tr-sched-switch input:checked + .tr-sched-slider:before { transform: translateX(16px); background: #34d399; }

/* ── Add schedule form ─────────────────────────────────────────────────────── */

.tr-sched-form {
    background: var(--card-bg, #1a1a2e);
    border: 1px solid var(--border-color, #2a2a3a);
    border-radius: 10px;
    padding: 16px 18px;
}

.tr-sched-form-title {
    font-size: 13px;
    font-weight: 600;
    color: #6ee7b7;
    margin-bottom: 14px;
}

.tr-sched-form-row { margin-bottom: 12px; }

.tr-sched-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #888);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tr-sched-input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color, #2a2a3a);
    border-radius: 6px;
    color: var(--text-primary, #e0e0e0);
    font-size: 13px;
    padding: 7px 10px;
    outline: none;
}
.tr-sched-input:focus { border-color: #6ee7b7; }

.tr-sched-days {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tr-sched-day-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color, #2a2a3a);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    color: var(--text-muted, #888);
    cursor: pointer;
    user-select: none;
}
.tr-sched-day-btn:has(input:checked) {
    border-color: #6ee7b7;
    color: #6ee7b7;
    background: rgba(110,231,183,0.08);
}
.tr-sched-day-btn input { width: 13px; height: 13px; accent-color: #34d399; }

.tr-sched-form-footer {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}

.tr-sched-save-btn {
    background: rgba(52,211,153,0.15);
    border: 1px solid #34d399;
    border-radius: 7px;
    color: #6ee7b7;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 20px;
    cursor: pointer;
    transition: background 0.15s;
}
.tr-sched-save-btn:hover { background: rgba(52,211,153,0.25); }

/* ══════════════════════════════════════════════════════════════════════════════
   L7 CEO Final Test Styles — KAAI Training System
   Designed by: Johnny Black | KAAI v1.0
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── L7 tab button ─────────────────────────────────────────────────────────── */
.tr-tab-l7 {
    position: relative;
    background: linear-gradient(135deg, rgba(124,111,205,0.12) 0%, rgba(212,175,55,0.12) 100%);
    border-color: rgba(212,175,55,0.3) !important;
}
.tr-tab-l7.active,
.tr-tab-l7:hover {
    background: linear-gradient(135deg, rgba(124,111,205,0.35) 0%, rgba(212,175,55,0.25) 100%);
}
.tr-tab-l7-alert {
    background: linear-gradient(135deg, rgba(212,175,55,0.25) 0%, rgba(245,158,11,0.2) 100%) !important;
    border-color: rgba(245,158,11,0.6) !important;
    animation: tr-l7-pulse-tab 2s ease-in-out infinite;
}
@keyframes tr-l7-pulse-tab {
    0%, 100% { box-shadow: none; }
    50%       { box-shadow: 0 0 8px rgba(212,175,55,0.5); }
}

/* Badge on the L7 tab button */
.tr-l7-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #d97706;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    margin-left: 6px;
    vertical-align: middle;
}

/* ── L7 Tab Panel ───────────────────────────────────────────────────────────── */
.tr-l7-wrap {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    max-height: 100%;
}

.tr-l7-header h3 {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 700;
    color: #d4af37;
}
.tr-l7-desc {
    font-size: 13px;
    color: var(--text-secondary, #aaa);
    margin: 0 0 10px;
    line-height: 1.5;
}

.tr-l7-section {
    background: var(--bg-secondary, #161616);
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 10px;
    overflow: hidden;
}

.tr-l7-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-tertiary, #111);
    border-bottom: 1px solid var(--border-color, #2a2a2a);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #aaa);
}

.tr-l7-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #d97706;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.tr-l7-pending-list,
.tr-l7-history {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── L7 Empty state ─────────────────────────────────────────────────────────── */
.tr-l7-empty {
    padding: 32px;
    text-align: center;
    color: var(--text-muted, #555);
}
.tr-l7-empty-icon { font-size: 36px; display: block; margin-bottom: 8px; }
.tr-l7-empty p    { margin: 4px 0; font-size: 14px; }
.tr-l7-empty-sub  { font-size: 12px; color: var(--text-muted, #555); }

/* ── L7 Exercise Card ────────────────────────────────────────────────────────── */
.tr-l7-card {
    border: 2px solid #d4af37;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(212,175,55,0.04) 0%, rgba(124,111,205,0.04) 100%);
    overflow: hidden;
    transition: border-color 0.2s;
}
.tr-l7-card:hover { border-color: #f59e0b; }

.tr-l7-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: rgba(212,175,55,0.07);
    border-bottom: 1px solid rgba(212,175,55,0.2);
}

.tr-l7-card-info  { display: flex; align-items: flex-start; gap: 12px; }
.tr-l7-crown      { font-size: 28px; line-height: 1; }
.tr-l7-card-title { font-size: 15px; font-weight: 700; color: var(--text-primary, #e0e0e0); margin-bottom: 4px; }
.tr-l7-card-meta  { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; color: var(--text-muted, #666); align-items: center; }
.tr-l7-card-meta code { font-size: 10px; background: rgba(255,255,255,0.05); padding: 1px 5px; border-radius: 3px; }

/* ── Log terminal inside L7 card ───────────────────────────────────────────── */
.tr-l7-log-wrap {
    padding: 0;
}
.tr-l7-log-title {
    padding: 6px 14px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #555);
    background: var(--bg-tertiary, #111);
    border-bottom: 1px solid var(--border-color, #222);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.tr-l7-terminal {
    max-height: 200px !important;
    border-radius: 0 !important;
    border: none !important;
    border-top: none !important;
}

/* ── L7 Actions / Approval Gate ────────────────────────────────────────────── */
.tr-l7-actions {
    padding: 14px 16px;
    border-top: 1px solid rgba(212,175,55,0.2);
    background: rgba(212,175,55,0.04);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tr-l7-notes-input {
    width: 100%;
    background: var(--bg-primary, #0d0d0d);
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 6px;
    color: var(--text-primary, #e0e0e0);
    font-size: 12px;
    padding: 8px 10px;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.tr-l7-notes-input:focus { outline: none; border-color: #d4af37; }

.tr-l7-action-btns {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tr-l7-btn-approve {
    flex: 1;
    min-width: 180px;
    padding: 10px 18px;
    background: rgba(52,211,153,0.12);
    border: 1px solid rgba(52,211,153,0.5);
    border-radius: 7px;
    color: #34d399;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.tr-l7-btn-approve:hover  { background: rgba(52,211,153,0.25); border-color: #34d399; transform: translateY(-1px); }
.tr-l7-btn-approve:active { transform: translateY(0); }
.tr-l7-btn-approve:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.tr-l7-btn-reject {
    flex: 1;
    min-width: 180px;
    padding: 10px 18px;
    background: rgba(248,113,113,0.1);
    border: 1px solid rgba(248,113,113,0.4);
    border-radius: 7px;
    color: #f87171;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.tr-l7-btn-reject:hover  { background: rgba(248,113,113,0.22); border-color: #f87171; transform: translateY(-1px); }
.tr-l7-btn-reject:active { transform: translateY(0); }
.tr-l7-btn-reject:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── L7 Live Monitor CEO Gate (inside live monitor footer) ──────────────────── */
.tr-l7-gate {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 0 0;
    width: 100%;
}
.tr-l7-gate-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.tr-l7-gate-crown  { font-size: 28px; line-height: 1; }
.tr-l7-gate-title  { font-size: 14px; font-weight: 700; color: #d4af37; margin-bottom: 3px; }
.tr-l7-gate-sub    { font-size: 12px; color: var(--text-secondary, #aaa); }
.tr-l7-gate-btns   { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }

/* Pulse dot for L7 awaiting */
.tr-lm-pulse-l7 {
    display: inline-block;
    color: #d4af37;
    font-size: 20px;
    animation: tr-l7-crown-pulse 1.5s ease-in-out infinite;
}
@keyframes tr-l7-crown-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(1.15); }
}

/* L7 status tag */
.tr-lm-tag-l7 {
    background: rgba(212,175,55,0.15);
    border-color: rgba(212,175,55,0.5);
    color: #d4af37;
    animation: tr-l7-pulse-tab 2s ease-in-out infinite;
}

/* Decision result banners */
.tr-l7-decided {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    width: 100%;
}
.tr-l7-decided-approved {
    background: rgba(52,211,153,0.15);
    border: 1px solid rgba(52,211,153,0.5);
    color: #34d399;
}
.tr-l7-decided-rejected {
    background: rgba(248,113,113,0.12);
    border: 1px solid rgba(248,113,113,0.4);
    color: #f87171;
}

/* ── History table decisions ─────────────────────────────────────────────────── */
.tr-l7-hist-table { width: 100%; }
.tr-l7-notes      { font-size: 11px; color: var(--text-muted, #666); max-width: 200px; }
.tr-l7-dec-approved { color: #34d399; font-weight: 600; }
.tr-l7-dec-rejected { color: #f87171; font-weight: 600; }
.tr-l7-dec-awaiting { color: #d4af37; font-weight: 600; }

/* ── Phase 6: Flow Health tab ─────────────────────────────────────────────────── */
.tr-fh-wrap         { padding: 12px; }
.tr-fh-summary      { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.tr-fh-avg-badge    { font-size: 12px; font-weight: 700; color: #fff; padding: 4px 12px;
                       border-radius: 6px; letter-spacing: 0.3px; }
.tr-fh-table-wrap   { overflow-x: auto; }
.tr-fh-table        { width: 100%; border-collapse: collapse; font-size: 12px; }
.tr-fh-table th     { background: rgba(255,255,255,0.06); color: #9ca3af; font-weight: 600;
                       padding: 7px 10px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.08); white-space: nowrap; }
.tr-fh-table td     { padding: 6px 10px; border-bottom: 1px solid rgba(255,255,255,0.05);
                       color: #e2e8f0; vertical-align: middle; }
.tr-fh-table tr:hover td { background: rgba(255,255,255,0.04); }
.tr-fh-health-pill  { display: inline-block; color: #fff; font-weight: 700; font-size: 11px;
                       padding: 2px 8px; border-radius: 4px; }
.tr-fh-runid        { font-family: monospace; font-size: 11px; color: #9ca3af; }
.tr-fh-signs        { font-family: monospace; letter-spacing: 1px; }
.tr-fh-ts           { font-size: 11px; color: #9ca3af; white-space: nowrap; }
.tr-fh-legend       { margin-top: 10px; font-size: 11px; color: #9ca3af; }
.tr-fh-legend-dot   { font-size: 14px; vertical-align: middle; }
.tr-fh-empty        { text-align: center; padding: 48px 20px; color: #9ca3af; }
.tr-fh-empty-icon   { font-size: 36px; margin-bottom: 10px; }
.tr-fh-empty-title  { font-size: 16px; font-weight: 600; color: #e2e8f0; margin-bottom: 6px; }
.tr-fh-empty-sub    { font-size: 13px; max-width: 440px; margin: 0 auto; line-height: 1.6; }
.tr-fh-error        { color: #f87171; padding: 20px; font-size: 13px; }

/* Flow Health badge in live monitor meta bar */
.tr-lm-flow-badge   { font-size: 11px; font-weight: 700; color: #fff; padding: 2px 8px;
                       border-radius: 4px; cursor: default; }

