/* ═══════════════════════════════════════════════════════════
   Dashboard Video — Stats CSS
   ═══════════════════════════════════════════════════════════ */

.stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-soft);
}

.stats-header h2 {
    font-family: var(--font-sans);
    font-size: var(--fs-lg);
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 1px;
}

.stats-summary {
    display: flex;
    gap: 6px;
    font-family: var(--font-sans);
    font-size: var(--fs-sm);
    align-items: center;
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 3px;
    background: var(--bg-panel);
    border: 1px solid var(--border-soft);
    padding: 2px 6px;
    border-radius: var(--r-md);
    color: var(--text-secondary);
    font-size: var(--fs-xs);
}

.stat-chip.fail {
    border-color: var(--red-border);
    color: var(--red);
}

.stat-chip .stat-val {
    color: var(--accent);
    font-weight: 600;
    font-family: var(--font-mono);
}

/* Toolbar */
.stats-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.stats-search {
    flex: 1;
    min-width: 150px;
    background: var(--bg-input);
    border: 1px solid var(--border-soft);
    color: var(--text-primary);
    padding: 4px 8px;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    border-radius: var(--r-sm);
    outline: none;
}

.stats-search:focus {
    border-color: var(--border-focus);
}

.stats-filters {
    display: flex;
    gap: 3px;
}

.sf-btn {
    background: var(--bg-panel);
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
    padding: 3px 6px;
    font-family: var(--font-sans);
    font-size: var(--fs-xs);
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--r-sm);
    transition: all .15s;
}

.sf-btn:hover {
    border-color: var(--accent-dim);
    color: var(--text-secondary);
}

.sf-btn.active {
    background: var(--accent-dim);
    color: #fff;
    border-color: var(--accent);
}

/* Table Wrapper — horizontal scroll */
.table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    flex: 1;
}

/* Table */
.stats-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-xs);
}

.stats-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    font-family: var(--font-sans);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-label);
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 4px 5px;
    text-align: left;
    border-bottom: 2px solid var(--border-mid);
    white-space: nowrap;
    z-index: 1;
    cursor: pointer;
    user-select: none;
}

.stats-table thead th.sortable:hover {
    color: var(--accent);
}

.stats-table tbody tr {
    border-bottom: 1px solid var(--border-soft);
    transition: background .12s;
}

.stats-table tbody tr:hover {
    background: var(--bg-active);
}

.stats-table td {
    padding: 3px 5px;
    font-size: var(--fs-xs);
    color: var(--text-primary);
    white-space: nowrap;
}

.stats-table td.stt {
    color: var(--accent);
    font-weight: 600;
    font-family: var(--font-mono);
    text-align: center;
    width: 28px;
}

.stats-table td.title {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-sans);
}

.stats-table td.title.clickable {
    cursor: pointer;
    color: var(--green-text);
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: all .15s;
}

.stats-table td.title.clickable:hover {
    color: var(--green);
    text-decoration-color: var(--green-text);
}

/* Topic — expandable */
.stats-table td.topic-cell {
    max-width: 100px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.topic-cell .topic-short {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topic-cell .topic-full {
    display: none;
}

.topic-cell.expanded {
    max-width: none;
    white-space: normal;
    background: var(--bg-panel);
    border-radius: var(--r-sm);
    padding: 4px 6px;
}

.topic-cell.expanded .topic-short {
    display: none;
}

.topic-cell.expanded .topic-full {
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.3;
    color: var(--text-secondary);
    max-height: 150px;
    overflow-y: auto;
}

/* Cost */
.stats-table td.cost-cell {
    font-family: var(--font-mono);
    color: var(--yellow);
    cursor: help;
    font-size: var(--fs-xs);
}

.stats-table td.cost-cell.est {
    color: var(--text-dim);
    font-style: italic;
}

/* Preset */
.stats-table td.preset-cell {
    font-family: var(--font-sans);
    font-size: var(--fs-xs);
    color: var(--text-muted);
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: help;
}

.stats-table td.num {
    text-align: right;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    font-size: var(--fs-xs);
}

.stats-table td.status-done {
    color: var(--green-text);
}

.stats-table td.status-fail {
    color: var(--red);
}

/* Step timing */
.stats-table td.step-time {
    text-align: center;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--text-muted);
    min-width: 32px;
}

.stats-table td.step-time.slow {
    color: var(--orange);
}

.stats-table td.step-time.fast {
    color: var(--green-text);
}

.stats-empty {
    text-align: center;
    padding: 30px;
    color: var(--text-dim);
    font-size: var(--fs-md);
}

/* ── Video Player Controls ── */
.vid-controls {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.speed-bar,
.reexport-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-panel);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
}

.speed-label {
    font-family: var(--font-sans);
    font-size: var(--fs-xs);
    color: var(--text-label);
    white-space: nowrap;
    min-width: 80px;
}

.speed-btn {
    background: var(--bg-input);
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
    padding: 4px 10px;
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    cursor: pointer;
    border-radius: var(--r-sm);
    transition: all .15s;
    flex: none;
}

.speed-btn:hover {
    border-color: var(--accent-dim);
    color: var(--text-secondary);
}

.speed-btn.active {
    background: var(--accent-dim);
    color: #fff;
    border-color: var(--accent);
    font-weight: 600;
}

.reexport-bar select {
    background: var(--bg-input);
    border: 1px solid var(--border-soft);
    color: var(--text-primary);
    padding: 4px 8px;
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    border-radius: var(--r-sm);
    outline: none;
}

.reexport-btn {
    background: linear-gradient(135deg, #1a1a0a, #2a2a0a);
    border: 1px solid #5a5a1a;
    color: var(--yellow);
    padding: 5px 12px;
    font-family: var(--font-sans);
    font-size: var(--fs-sm);
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--r-sm);
    transition: all .15s;
    flex: none;
}

.reexport-btn:hover {
    background: #2a2a0a;
    border-color: var(--yellow);
}

#reexport-status {
    font-family: var(--font-sans);
    font-size: var(--fs-xs);
    white-space: nowrap;
}

/* ── Link, Note, Actions columns ── */
.link-cell,
.note-cell {
    font-size: var(--fs-xs);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pub-link {
    color: var(--accent);
    text-decoration: none;
    font-size: var(--fs-xs);
}

.pub-link:hover {
    text-decoration: underline;
}

.add-link {
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
    opacity: 0.4;
}

.add-link:hover {
    opacity: 1;
    color: var(--accent);
}

.note-text {
    color: var(--text-secondary);
    cursor: pointer;
    font-size: var(--fs-xs);
}

.note-text:hover {
    color: var(--accent);
}

.actions-cell {
    white-space: nowrap;
}

.retry-btn,
.edit-btn {
    background: none;
    border: 1px solid var(--border-soft);
    color: var(--text-dim);
    padding: 2px 5px;
    cursor: pointer;
    border-radius: var(--r-sm);
    font-size: var(--fs-xs);
    margin-right: 2px;
    transition: all .15s;
}

.retry-btn:hover {
    border-color: var(--yellow);
    color: var(--yellow);
    background: rgba(200, 180, 0, 0.05);
}

.edit-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(100, 140, 255, 0.05);
}

/* ── Meta Editor ── */
.meta-editor {
    font-family: var(--font-sans);
    padding: 4px 0;
}

.me-section {
    margin-bottom: 16px;
}

.me-section h3 {
    font-size: var(--fs-md);
    color: var(--accent);
    margin-bottom: 10px;
    font-weight: 600;
}

.me-field {
    margin-bottom: 10px;
}

.me-field label {
    display: block;
    font-size: var(--fs-xs);
    color: var(--text-label);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 4px;
}

.me-field input,
.me-field textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-soft);
    color: var(--text-primary);
    padding: 8px 10px;
    border-radius: var(--r-sm);
    font-family: var(--font-sans);
    font-size: var(--fs-sm);
    outline: none;
    box-sizing: border-box;
}

.me-field input:focus,
.me-field textarea:focus {
    border-color: var(--accent);
}

.me-field textarea {
    resize: vertical;
    min-height: 60px;
}

.me-readonly {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.me-ro-item {
    background: var(--bg-panel);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-sm);
    padding: 6px 8px;
}

.me-ro-label {
    font-size: var(--fs-xs);
    color: var(--text-label);
    text-transform: uppercase;
    letter-spacing: .5px;
    display: block;
}

.me-ro-val {
    font-size: var(--fs-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    word-break: break-all;
}

.me-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 10px;
    border-top: 1px solid var(--border-soft);
}

.me-save {
    background: linear-gradient(135deg, #0a2a0a, #0a3a0a);
    border: 1px solid #1a5a1a;
    color: #4ae44a;
    padding: 8px 20px;
    font-family: var(--font-sans);
    font-size: var(--fs-sm);
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--r-sm);
    transition: all .15s;
}

.me-save:hover {
    border-color: #4ae44a;
}

.me-cancel {
    background: var(--bg-panel);
    border: 1px solid var(--border-soft);
    color: var(--text-dim);
    padding: 8px 16px;
    font-family: var(--font-sans);
    font-size: var(--fs-sm);
    cursor: pointer;
    border-radius: var(--r-sm);
}