/* FF CM QA Tool — Dark Theme */

:root {
    --bg-dark: #0f0f1a;
    --bg-panel: #1a1a2e;
    --bg-card: #1e1e3a;
    --bg-hover: #2a2a4a;
    --bg-input: #16213e;
    --text-primary: #e0e0e0;
    --text-secondary: #888888;
    --text-dim: #666666;
    --accent-blue: #3b8ed0;
    --accent-green: #2fa572;
    --accent-red: #e05555;
    --accent-yellow: #e6a817;
    --accent-orange: #ffaa00;
    --border: #333355;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* ─── Layout ─── */

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.top-bar {
    display: flex;
    align-items: center;
    background: #16213e;
    padding: 8px 16px;
    min-height: 44px;
    gap: 16px;
    flex-shrink: 0;
}

.top-bar h1 {
    font-size: 15px;
    font-weight: bold;
    white-space: nowrap;
}

.board-label {
    color: var(--text-secondary);
    font-size: 13px;
    flex: 1;
}

.top-bar .btn {
    flex-shrink: 0;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ─── Sidebar ─── */

.sidebar {
    width: 200px;
    background: var(--bg-panel);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    font-size: 12px;
    font-weight: bold;
    color: var(--text-secondary);
    padding: 12px 12px 8px;
    letter-spacing: 1px;
}

.step-item {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 4px;
    margin: 1px 6px;
    transition: background 0.15s;
}

.step-item:hover {
    background: var(--bg-hover);
}

.step-item.active {
    background: var(--bg-hover);
}

.step-item.active .step-name {
    color: white;
    font-weight: bold;
}

.step-icon {
    width: 20px;
    font-size: 14px;
    text-align: center;
    flex-shrink: 0;
}

.step-name {
    font-size: 13px;
    color: #ccc;
    margin-left: 6px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 8px 12px 12px;
    font-size: 12px;
    color: var(--text-dim);
}

/* ─── Optional step styling ─── */
.step-optional {
    opacity: 0.5;
}
.step-optional .step-name {
    text-decoration: line-through;
    font-style: italic;
}
.step-req-cb {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--accent-green);
}

/* ─── Status colors for step icons ─── */
.status-pending { color: var(--text-secondary); }
.status-active { color: var(--accent-blue); }
.status-done { color: var(--accent-green); }
.status-error { color: var(--accent-red); }
.status-skipped { color: var(--text-dim); }

/* ─── Right content ─── */

.right-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Tab bar */
.tab-bar {
    display: flex;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.tab-btn {
    padding: 8px 20px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

/* ─── Step panel area ─── */

.panel-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.step-panel {
    display: none;
}

.step-panel.visible {
    display: block;
}

.panel-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
}

.panel-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

/* ─── Cards ─── */

.card {
    background: var(--bg-panel);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
}

.card-header {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ─── Buttons ─── */

.btn {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.15s;
    color: white;
    font-weight: 500;
}

.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-blue { background: var(--accent-blue); }
.btn-green { background: var(--accent-green); }
.btn-red { background: var(--accent-red); }
.btn-orange { background: #b35900; }
.btn-gray { background: #444; }
.btn-dark-green { background: #1a8f3c; }

.btn-lg {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: bold;
    width: 100%;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 11px;
}

/* ─── Inputs ─── */

input, select {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 13px;
    outline: none;
}

input:focus, select:focus {
    border-color: var(--accent-blue);
}

input::placeholder {
    color: var(--text-dim);
}

/* ─── Approved firmware row ─── */

.approved-row {
    display: flex;
    align-items: center;
    background: #1a2e1a;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 10px;
    gap: 12px;
}

.approved-label {
    color: var(--accent-green);
    font-size: 13px;
    flex: 1;
}

.no-approved {
    color: var(--text-dim);
}

/* ─── FF Slot toggle buttons ─── */

.ff-slot-btns {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.ff-slot-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 6px;
    border: 2px solid var(--border);
    background: var(--bg-panel);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.ff-slot-btn:hover:not(.unassigned) {
    border-color: var(--accent-green);
}

.ff-slot-btn.active {
    border-color: var(--accent-green);
    background: #1a2e1a;
}

.ff-slot-btn.unassigned {
    opacity: 0.5;
    cursor: default;
}

.ff-slot-letter {
    font-weight: bold;
    font-size: 14px;
    min-width: 18px;
}

.ff-slot-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Assign buttons in file list */
.ff-assign-btns {
    margin-left: auto;
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.ff-assign-btn {
    padding: 1px 6px;
    font-size: 10px;
    font-weight: bold;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1.4;
}

.ff-assign-btn:hover {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

/* ─── Firmware type toggle ─── */

.fw-type-toggle { display: flex; gap: 4px; margin-bottom: 12px; }
.fw-type-btn {
    flex: 1; padding: 8px; border-radius: 6px; border: 2px solid var(--border);
    background: var(--bg-panel); color: var(--text-secondary); cursor: pointer;
    font-size: 13px; font-weight: bold; text-align: center;
}
.fw-type-btn:hover { border-color: var(--accent-blue); color: var(--text-primary); }
.fw-type-btn.active { border-color: var(--accent-green); background: #1a2e1a; color: var(--accent-green); }

/* ─── File list ─── */

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    font-size: 12px;
    color: var(--accent-blue);
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.1s;
}

.file-item:hover {
    background: var(--bg-hover);
}

.file-item.selected {
    background: var(--bg-hover);
    font-weight: bold;
}

.file-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-download-btn {
    opacity: 0;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13px;
    padding: 0 4px;
    transition: opacity 0.15s, color 0.15s;
    flex-shrink: 0;
}

.file-item:hover .file-download-btn {
    opacity: 0.7;
}

.file-download-btn:hover {
    opacity: 1 !important;
    color: var(--accent-blue);
}

/* ─── Step status rows ─── */

.step-row {
    display: flex;
    align-items: center;
    padding: 2px 4px;
    gap: 6px;
    font-size: 12px;
}

.step-row-icon {
    width: 16px;
    font-size: 13px;
    flex-shrink: 0;
}

.step-row-label {
    color: #999;
    min-width: 160px;
}

.step-row-detail {
    font-size: 11px;
    color: var(--text-dim);
}

.step-row-progress {
    width: 120px;
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
    margin-left: 8px;
}

.step-row-progress-fill {
    height: 100%;
    background: var(--accent-blue);
    transition: width 0.3s;
}

.step-row-pct {
    font-size: 10px;
    color: var(--text-dim);
    width: 36px;
    text-align: right;
}

/* ─── Banner ─── */

.banner {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 12px;
}

.banner-yellow {
    background: var(--accent-yellow);
    color: #1a1a1a;
}

.banner-info {
    background: var(--bg-card);
    color: var(--text-secondary);
}

/* ─── Board Status ─── */

.board-status-area {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    padding: 8px;
}

.board-status-area.visible {
    display: flex;
}

.board-status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 8px 12px;
    flex-shrink: 0;
}

#board-status-content {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-panel);
    border-radius: 6px;
    padding: 12px 16px;
}

/* ─── Console ─── */

.console-area {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    padding: 8px;
}

.console-area.visible {
    display: flex;
}

.terminal-box {
    flex: 1;
    background: var(--bg-panel);
    border-radius: 6px;
    padding: 8px;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.4;
}

.terminal-line {
    margin-bottom: 1px;
}

.terminal-line .ts {
    color: #666;
}

.cmd-input-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-shrink: 0;
}

.cmd-input {
    flex: 1;
    font-family: 'Menlo', monospace;
    font-size: 12px;
}

/* Console main layout: terminal + optional sidebar */
.console-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 8px;
}

.console-terminal-wrap {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.console-terminal-wrap .terminal-box {
    flex: 1;
}

/* Command history sidebar — always visible */
.cmd-history-sidebar {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    border-radius: 6px;
    overflow: hidden;
}

.cmd-history-header {
    padding: 8px 10px;
    font-size: 11px;
    font-weight: bold;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.5px;
}

.cmd-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 3px 6px;
    font-size: 11px;
    font-family: 'Menlo', monospace;
    color: var(--accent-blue);
    cursor: pointer;
    border-radius: 3px;
    gap: 4px;
}

.history-item:hover {
    background: var(--bg-hover);
    color: #fff;
}

.history-item.history-active {
    background: rgba(59, 142, 208, 0.25);
    color: #fff;
    border-left: 2px solid var(--accent-blue);
}

.history-cmd-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-jump {
    flex-shrink: 0;
    font-size: 10px;
    color: #666;
    padding: 2px 4px;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}

.history-item:hover .history-jump {
    opacity: 1;
}

.history-jump:hover {
    background: var(--accent-blue);
    color: #fff;
}

.history-ts {
    color: #666;
    font-size: 10px;
    margin-right: 4px;
}

/* Highlighted command line in terminal */
.terminal-line.cmd-highlight {
    background: rgba(59, 142, 208, 0.2);
    border-left: 3px solid var(--accent-blue);
    padding-left: 5px;
}

/* Console tabs */
.console-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    flex-shrink: 0;
}

.console-tab {
    padding: 4px 12px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.3px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
}

.console-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.console-tab.active {
    color: var(--accent-blue);
    border-color: var(--accent-blue);
    background: rgba(59, 142, 208, 0.1);
}

.btn-sm {
    padding: 3px 8px !important;
    font-size: 11px !important;
}

/* Multi command area */
.multi-cmd-area {
    flex-shrink: 0;
    margin-top: 6px;
    display: flex;
    gap: 8px;
}

.multi-cmd-textarea {
    flex: 1;
    min-height: 60px;
    max-height: 100px;
    font-family: 'Menlo', monospace;
    font-size: 12px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px;
    resize: vertical;
}

.multi-cmd-controls {
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
    align-items: flex-start;
}

.multi-cmd-label {
    font-size: 10px;
    color: var(--text-secondary);
}

.multi-cmd-interval {
    width: 70px;
    font-size: 12px;
    font-family: 'Menlo', monospace;
    padding: 3px 6px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
}

/* Terminal colors */
.t-rx { color: #00ff00; }
.t-tx { color: #ffff00; }
.t-info { color: #00ffff; }
.t-success { color: #00ff00; }
.t-warning { color: #ffaa00; }
.t-error { color: #ff0000; }

/* ─── Workflow buttons ─── */

.wf-btn-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.wf-status {
    font-size: 11px;
    color: var(--text-dim);
}

/* ─── Config table ─── */

.config-table {
    font-size: 11px;
    font-family: 'Menlo', monospace;
    width: 100%;
    border-collapse: collapse;
}

.config-table th {
    text-align: left;
    color: var(--text-secondary);
    padding: 2px 6px;
    font-size: 10px;
}

.config-table td {
    padding: 2px 6px;
    color: #ccc;
}

.config-table tr.matched {
    background: #554400;
    color: #ffff00;
}

.config-table tr.matched td {
    color: #ffff00;
}

.config-table tr.verified td {
    color: #00ff00;
}

/* ─── Health / Function tests ─── */

.health-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 13px;
}

.health-icon {
    font-size: 14px;
    width: 20px;
    text-align: center;
}

.health-value {
    color: var(--text-secondary);
    font-size: 12px;
    margin-left: auto;
}

.func-test-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.func-test-row label {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.func-test-row.test-running {
    background: rgba(59, 142, 208, 0.15);
    border-radius: 4px;
    transition: background 0.3s;
}

.func-test-row.test-done {
    opacity: 0.45;
    transition: opacity 0.3s;
}

/* ─── Instructions card (power down) ─── */

.instructions {
    background: var(--bg-panel);
    border-radius: 8px;
    padding: 16px 20px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 16px;
    white-space: pre-line;
}

/* ─── Power down numbered steps ─── */

.power-steps {
    background: var(--bg-panel);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.power-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.power-step:last-child {
    border-bottom: none;
}

.step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.step-icon-anim {
    font-size: 20px;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

/* Plug animation: gentle slide-in from left */
.plug-anim {
    animation: plugSlideIn 2s ease-in-out infinite;
}

@keyframes plugSlideIn {
    0%, 100% { transform: translateX(-4px); opacity: 0.7; }
    50% { transform: translateX(0); opacity: 1; }
}

/* Unplug animation: gentle slide-out to right */
.unplug-anim {
    animation: unplugSlideOut 2s ease-in-out infinite;
}

@keyframes unplugSlideOut {
    0%, 100% { transform: translateX(0); opacity: 1; }
    50% { transform: translateX(4px); opacity: 0.7; }
}

/* Pulse animation for wait/verify steps */
.pulse-anim {
    animation: pulseGlow 1.5s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* Warning banner for IMPORTANT notices */
.warning-banner {
    background: rgba(230, 168, 23, 0.15);
    border: 1px solid var(--accent-yellow);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: bold;
    color: var(--accent-yellow);
    margin-bottom: 16px;
    line-height: 1.5;
}

/* ─── Form row ─── */

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

.form-label {
    font-size: 13px;
    min-width: 100px;
}

/* ─── Grid layout helpers ─── */

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

.flex-grow {
    flex: 1;
}

.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-blue { color: var(--accent-blue); }
.text-yellow { color: var(--accent-yellow); }
.text-dim { color: var(--text-dim); }
.text-secondary { color: var(--text-secondary); }

.mt-8 { margin-top: 8px; }
.mb-8 { margin-bottom: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

/* ─── Status bar ─── */

.status-bar {
    background: #16213e;
    padding: 4px 16px;
    font-size: 11px;
    color: var(--text-dim);
    display: flex;
    justify-content: space-between;
    flex-shrink: 0;
}

/* ─── Export summary ─── */

.summary-box {
    background: var(--bg-panel);
    border-radius: 6px;
    padding: 12px;
    font-family: 'Menlo', monospace;
    font-size: 11px;
    white-space: pre-wrap;
    overflow-y: auto;
    max-height: 400px;
    color: var(--text-primary);
}

/* ─── Scrollbar ─── */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ─── Board Status filters ─── */

.board-status-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    padding: 0 8px 8px;
    flex-shrink: 0;
}

.filter-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #ccc;
    cursor: pointer;
}

.filter-chip input[type="checkbox"] {
    width: 13px;
    height: 13px;
    cursor: pointer;
}

.filter-show-all {
    font-size: 11px;
    color: var(--accent-blue);
    cursor: pointer;
    background: none;
    border: none;
    padding: 2px 6px;
}

.filter-show-all:hover {
    text-decoration: underline;
}

/* ─── Health group headers ─── */

.health-group-header {
    font-size: 11px;
    font-weight: bold;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    padding: 8px 0 4px 0;
    margin-top: 4px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.health-group-header:first-child {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

/* ─── Step serial log (inline in workflow panels) ─── */

.step-serial-log {
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Menlo', monospace;
    font-size: 11px;
    line-height: 1.4;
    background: var(--bg-dark);
    border-radius: 4px;
    padding: 6px 8px;
}

/* ─── Agent Setup Banner ─── */

.agent-setup-banner {
    background: linear-gradient(135deg, #1a2e4a, #1e2a3e);
    border-bottom: 1px solid var(--accent-blue);
    padding: 8px 16px;
    flex-shrink: 0;
}

.agent-setup-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.agent-setup-banner-text {
    font-size: 13px;
    color: var(--text-primary);
}

.agent-setup-banner-text strong {
    color: var(--accent-yellow);
}

.agent-setup-banner-btns {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

/* ─── HF Test horizontal steps ─── */

.hf-test-steps {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

.hf-test-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 130px;
    gap: 4px;
}

.hf-test-step .btn {
    white-space: nowrap;
}

.hf-test-step.step-completed .btn {
    background: var(--accent-green);
    opacity: 0.85;
}

.hf-test-step.step-active .btn {
    box-shadow: 0 0 0 2px var(--accent-blue), 0 0 8px rgba(59,142,208,0.4);
}

.hf-test-arrow {
    color: var(--text-dim);
    font-size: 18px;
    padding-top: 6px;
    flex-shrink: 0;
}

.hf-test-cmd-sent {
    font-size: 11px;
    color: var(--accent-blue);
    font-family: 'Menlo', monospace;
    text-align: center;
    min-height: 16px;
    max-width: 180px;
    word-break: break-all;
}

/* ─── Work Log ─── */

.worklog-area {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    padding: 8px;
}

.worklog-area.visible {
    display: flex;
}

.worklog-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px 12px;
    flex-shrink: 0;
}

.worklog-title {
    font-size: 16px;
    font-weight: bold;
}

.worklog-count {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: auto;
}

.worklog-stats {
    display: flex;
    gap: 12px;
    font-size: 12px;
    font-weight: bold;
}

.worklog-stat { padding: 3px 10px; border-radius: 4px; }
.worklog-stat-total { background: rgba(59, 142, 208, 0.15); color: var(--accent-blue); }
.worklog-stat-pass { background: rgba(47, 165, 114, 0.15); color: var(--accent-green); }
.worklog-stat-fail { background: rgba(224, 85, 85, 0.15); color: var(--accent-red); }
.worklog-stat-prog { background: rgba(230, 168, 23, 0.15); color: var(--accent-yellow); }

.worklog-table-wrap {
    flex: 1;
    overflow: auto;
    background: var(--bg-panel);
    border-radius: 8px;
}

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

.worklog-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    padding: 8px 6px;
    text-align: left;
    font-size: 10px;
    font-weight: bold;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.worklog-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
}

.worklog-table tbody tr:hover {
    background: var(--bg-hover);
}

.worklog-table td {
    padding: 6px 6px;
    white-space: nowrap;
    color: var(--text-primary);
}

.worklog-table .td-imei {
    font-family: 'Menlo', monospace;
    font-size: 11px;
}

.worklog-table .td-id {
    font-size: 11px;
    color: var(--text-secondary);
}

.worklog-table .td-time {
    font-size: 11px;
    color: var(--text-dim);
}

.wl-step-icon { font-size: 13px; text-align: center; width: 28px; display: inline-block; }
.wl-si-done { color: var(--accent-green); }
.wl-si-error { color: var(--accent-red); }
.wl-si-skipped { color: var(--text-dim); }
.wl-si-pending { color: var(--text-dim); }
.wl-si-override { color: #f0ad4e !important; }

/* Work Log Step Override Modal */
.wl-override-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 9999; justify-content: center; align-items: center;
}
.wl-override-panel {
    background: var(--bg-card, #16213e); border: 1px solid var(--border, #333);
    border-radius: 10px; padding: 24px; max-width: 480px; width: 90%;
    position: relative; max-height: 80vh; overflow-y: auto;
}
.wl-override-close {
    position: absolute; top: 10px; right: 14px; background: none; border: none;
    color: var(--text-secondary, #999); font-size: 22px; cursor: pointer;
}
.wl-ovr-item {
    background: var(--bg-dark, #0f0f23); border: 1px solid var(--border, #333);
    border-radius: 6px; padding: 12px; margin-bottom: 10px;
}

.badge-pass {
    background: rgba(47, 165, 114, 0.2);
    color: var(--accent-green);
}

.badge-fail {
    background: rgba(224, 85, 85, 0.2);
    color: var(--accent-red);
}

.badge-progress {
    background: rgba(59, 142, 208, 0.2);
    color: var(--accent-blue);
}

.wl-badge {
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.cat-tag {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 3px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* ─── Responsive ─── */

@media (max-width: 768px) {
    .sidebar { width: 160px; }
    .step-name { font-size: 12px; }
    .tab-btn { padding: 8px 12px; font-size: 12px; }
}
