/* Marcel Dashboard — Dark theme */

:root {
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-input: #252833;
    --text: #e1e4ed;
    --text-muted: #8b8fa3;
    --border: #2a2d3a;
    --blue: #4c9aff;
    --green: #36b37e;
    --yellow: #ffab00;
    --orange: #ff8b00;
    --red: #ff5630;
    --gray: #505566;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 64px;
    height: 64px;
}

header h1 {
    font-size: 20px;
    font-weight: 600;
}

.live-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: background 0.3s;
}

.live-dot.online {
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: pulse-green 2s infinite;
}

.live-dot.offline {
    background: var(--gray);
}

@keyframes pulse-green {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Header right */
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.guide-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    color: var(--text-muted);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.guide-btn i,
.guide-btn svg {
    width: 15px;
    height: 15px;
}

.guide-btn:hover {
    color: var(--text);
    border-color: var(--text-muted);
}

.guide-btn-active {
    color: var(--blue);
    border-color: var(--blue);
}

/* Hamburger menu */
.header-menu {
    position: relative;
}

.menu-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 8px;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 16px;
    height: 2px;
    background: var(--text-muted);
    border-radius: 1px;
    transition: background 0.2s;
}

.menu-toggle:hover span {
    background: var(--text);
}

.menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 100;
    padding: 6px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

.menu-link {
    width: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
    text-align: left;
    font-family: inherit;
    transition: background 0.15s;
}

.menu-link:hover {
    background: var(--bg-input);
    color: var(--text);
}

.menu-section-label {
    padding: 6px 16px 2px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.hidden {
    display: none !important;
}

/* Login */
#login-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 57px);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 360px;
}

.login-card h2 {
    font-size: 18px;
    margin-bottom: 20px;
    text-align: center;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#login-form input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text);
    font-size: 14px;
    outline: none;
}

#login-form input:focus {
    border-color: var(--blue);
}

#login-form button {
    background: var(--blue);
    border: none;
    border-radius: 8px;
    padding: 10px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

#login-form button:hover {
    opacity: 0.9;
}

.error-text {
    color: var(--red);
    font-size: 13px;
    text-align: center;
    min-height: 18px;
}

/* OAuth dot (in menu) */
.oauth-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray);
    flex-shrink: 0;
}

.oauth-dot.ok {
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
}

.oauth-dot.error {
    background: var(--red);
    box-shadow: 0 0 6px var(--red);
}

/* Stats bar */
.stats-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.stats-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-right: 8px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 70px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-error .stat-value { color: var(--red); }
.stat-done .stat-value { color: var(--green); }

/* Pool bar */
.pool-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 24px;
    border-bottom: 1px solid var(--border);
}

.pool-bar:empty {
    display: none;
}

.pool-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    white-space: nowrap;
}

.pool-indicators {
    display: flex;
    gap: 16px;
}

.pool-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.pool-label {
    font-weight: 500;
    min-width: 60px;
}

.pool-progress {
    width: 60px;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.pool-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.pool-progress-fill.pool-active {
    background: var(--blue);
}

.pool-progress-fill.pool-full {
    background: var(--orange);
}

.pool-count {
    font-variant-numeric: tabular-nums;
    font-size: 11px;
    color: var(--text-muted);
}

/* Activity banner */
.activity-banner {
    padding: 10px 24px;
    border-bottom: 1px solid var(--border);
}

.activity-idle {
    color: var(--text-muted);
    font-size: 12px;
}

.activity-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.activity-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text);
    padding: 4px 8px;
    background: var(--bg-input);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.activity-row:hover {
    background: var(--border);
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.activity-dot.active {
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
    animation: pulse-worker 2s infinite;
}

.activity-dot.stale {
    background: var(--orange);
    box-shadow: 0 0 6px var(--orange);
    animation: pulse-worker 1s infinite;
}

.activity-issue {
    font-weight: 600;
    color: var(--blue);
    flex-shrink: 0;
}

.activity-title {
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.activity-phase {
    color: var(--text-muted);
    flex-shrink: 0;
}

.activity-model {
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

.activity-duration {
    font-variant-numeric: tabular-nums;
    color: var(--text);
    flex-shrink: 0;
    margin-left: auto;
}

.activity-stale-tag {
    color: var(--orange);
    font-weight: 500;
    font-size: 11px;
}

/* Worker active indicator on task card */
.task-card.worker-active {
    border-left: 3px solid var(--blue);
}

.task-card.worker-stale {
    border-left: 3px solid var(--orange);
}

.worker-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.worker-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.worker-dot.active {
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
    animation: pulse-worker 2s infinite;
}

.worker-dot.stale {
    background: var(--orange);
    box-shadow: 0 0 6px var(--orange);
    animation: pulse-worker 1s infinite;
}

@keyframes pulse-worker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.worker-model {
    font-weight: 500;
    text-transform: capitalize;
}

.worker-stale-label {
    color: var(--orange);
    font-weight: 500;
}

/* Task list */
.task-list {
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Task card */
.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.task-card:hover {
    border-color: var(--blue);
}

.task-card.expanded {
    border-color: var(--blue);
}

.task-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.task-id {
    font-weight: 500;
    font-size: 12px;
    color: var(--blue);
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 4px;
}

a.task-id-link {
    text-decoration: none;
}

a.task-id-link:hover {
    text-decoration: underline;
}

.task-title {
    flex: 1;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-duration {
    font-size: 13px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 60px;
    text-align: right;
}

/* Status badges */
/* Lucide icons */
.icon {
    width: 14px;
    height: 14px;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.icon-phase {
    width: 16px;
    height: 16px;
}

.icon-wait {
    width: 20px;
    height: 20px;
}

.icon-sm {
    width: 10px;
    height: 10px;
}

.status-badge {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-blue { background: rgba(76, 154, 255, 0.15); color: var(--blue); }
.badge-green { background: rgba(54, 179, 126, 0.15); color: var(--green); }
.badge-yellow { background: rgba(255, 171, 0, 0.15); color: var(--yellow); }
.badge-orange { background: rgba(255, 139, 0, 0.15); color: var(--orange); }
.badge-red { background: rgba(255, 86, 48, 0.15); color: var(--red); }
.badge-gray { background: rgba(80, 85, 102, 0.15); color: var(--gray); }

/* Task meta (repo + branch) */
.task-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.repo-name {
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
    text-decoration: none;
    color: inherit;
}

a.repo-name:hover {
    color: var(--blue);
    text-decoration: underline;
}

.branch-link {
    font-family: monospace;
    color: var(--text-muted);
    text-decoration: none;
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 4px;
    transition: color 0.2s;
}

.branch-link:hover {
    color: var(--blue);
    text-decoration: underline;
}

.branch-tag {
    font-family: monospace;
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Mini pipeline */
.pipeline-mini {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 10px;
}

.pipeline-step {
    height: 4px;
    flex: 1;
    border-radius: 2px;
    background: var(--border);
    transition: background 0.3s;
}

.pipeline-step.completed {
    background: var(--green);
}

.pipeline-step.current {
    background: var(--blue);
    animation: pulse-bar 1.5s infinite;
}

.pipeline-step.waiting {
    background: var(--orange);
    animation: pulse-bar 1.5s infinite;
}

.pipeline-step.pending {
    background: var(--border);
}

@keyframes pulse-bar {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Full pipeline (detail view) */
.pipeline-full {
    display: flex;
    align-items: flex-start;
    gap: 0;
    padding: 20px 0;
    padding-bottom: 8px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.pipeline-step-full {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 72px;
    flex: 0 0 auto;
}

.step-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--border);
    margin-bottom: 6px;
    transition: all 0.3s;
}

.pipeline-step-full.completed .step-dot {
    background: var(--green);
}

.pipeline-step-full.current .step-dot {
    background: var(--blue);
    box-shadow: 0 0 10px var(--blue);
    animation: pulse-dot 1.5s infinite;
}

.pipeline-step-full.waiting .step-dot {
    background: var(--orange);
    box-shadow: 0 0 10px var(--orange);
    animation: pulse-dot-orange 1.5s infinite;
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 10px var(--blue); }
    50% { box-shadow: 0 0 3px var(--blue); }
}

@keyframes pulse-dot-orange {
    0%, 100% { box-shadow: 0 0 10px var(--orange); }
    50% { box-shadow: 0 0 3px var(--orange); }
}

.step-label {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
}

.pipeline-step-full.completed .step-label,
.pipeline-step-full.current .step-label {
    color: var(--text);
}

.step-time {
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 2px;
}

.pipeline-connector {
    height: 2px;
    flex: 0 0 12px;
    background: var(--border);
    margin-top: 6px;
}

.off-path-indicator {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    margin-left: 8px;
    white-space: nowrap;
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Task detail */
.task-detail {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.detail-section h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.detail-table {
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
}

.detail-table td {
    padding: 3px 0;
}

.detail-table td:first-child {
    color: var(--text-muted);
    padding-right: 12px;
}

.detail-table tr.total td {
    font-weight: 600;
    border-top: 1px solid var(--border);
    padding-top: 6px;
}

.detail-links {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    align-items: center;
    flex-wrap: wrap;
}

.link-btn {
    font-size: 13px;
    color: var(--blue);
    text-decoration: none;
    border: 1px solid var(--blue);
    padding: 4px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.link-btn:hover {
    background: rgba(76, 154, 255, 0.1);
}

.branch-name {
    font-size: 12px;
    font-family: monospace;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 4px 10px;
    border-radius: 4px;
    text-decoration: none;
}

a.branch-name:hover {
    color: var(--blue);
    text-decoration: underline;
}

.error-box {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(255, 86, 48, 0.1);
    border: 1px solid rgba(255, 86, 48, 0.3);
    border-radius: 8px;
    font-size: 13px;
    color: var(--red);
    white-space: pre-wrap;
    word-break: break-word;
}

/* === Logs Section (task detail) === */

.logs-section {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.logs-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    font-family: inherit;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.logs-toggle-btn:hover {
    border-color: var(--blue);
    color: var(--text);
    background: rgba(76, 154, 255, 0.05);
}

.logs-table-container {
    margin-top: 10px;
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    border: 1px solid var(--border);
    border-radius: 8px;
}

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

.logs-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.logs-table th {
    background: var(--bg-input);
    padding: 8px 10px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}

.logs-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.logs-table tbody tr:last-child td {
    border-bottom: none;
}

.log-time {
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    white-space: nowrap;
    width: 70px;
}

.log-source {
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    width: 90px;
}

.log-message {
    color: var(--text);
    word-break: break-word;
    white-space: pre-wrap;
}

.log-level-badge {
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.log-level-badge.log-level-info {
    background: rgba(76, 154, 255, 0.15);
    color: var(--blue);
}

.log-level-badge.log-level-warning {
    background: rgba(255, 171, 0, 0.15);
    color: var(--yellow);
}

.log-level-badge.log-level-error {
    background: rgba(255, 86, 48, 0.15);
    color: var(--red);
}

.log-row.log-level-warning {
    background: rgba(255, 171, 0, 0.03);
}

.log-row.log-level-error {
    background: rgba(255, 86, 48, 0.05);
}

.log-level-badge.log-level-debug {
    background: rgba(156, 136, 255, 0.15);
    color: #9c88ff;
}

.log-row.log-level-debug {
    background: rgba(156, 136, 255, 0.03);
}

.prompt-toggle-btn {
    display: inline-flex;
    align-items: center;
    padding: 2px 4px;
    margin-left: 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.prompt-toggle-btn:hover { opacity: 1; }
.prompt-toggle-btn .icon { width: 12px; height: 12px; }

.prompt-details-row td {
    padding: 0 8px 8px 8px !important;
}

.prompt-content {
    max-height: 400px;
    overflow-y: auto;
    font-size: 11px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--bg-input);
    padding: 12px;
    border-radius: 6px;
    margin: 4px 0;
    border: 1px solid var(--border);
}

.logs-loading, .logs-empty, .logs-error {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.logs-error {
    color: var(--red);
}

.icon-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* === Progress View (task detail) === */

.progress-phases {
    display: flex;
    flex-direction: row;
    gap: 8px;
    padding: 8px 0;
}

.progress-phase {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    background: var(--bg);
    flex: 1;
    min-width: 0;
}

.progress-phase.phase-completed {
    border-color: rgba(54, 179, 126, 0.3);
}

.progress-phase.phase-active {
    border-color: rgba(76, 154, 255, 0.5);
    background: rgba(76, 154, 255, 0.03);
}

.progress-phase.phase-pending {
    opacity: 0.4;
}

.phase-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.phase-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray);
    flex-shrink: 0;
}

.phase-completed .phase-indicator {
    background: transparent;
    width: auto;
    height: auto;
}
.phase-completed .phase-indicator::after {
    content: "✓";
    font-size: 14px;
    font-weight: 700;
    color: var(--green);
}
.phase-active .phase-indicator {
    background: var(--blue);
    box-shadow: 0 0 8px var(--blue);
    animation: pulse-dot 1.5s infinite;
}

.phase-title {
    font-weight: 600;
    font-size: 14px;
    flex: 1;
}

.phase-duration {
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.phase-steps {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 18px;
    border-left: 2px solid var(--border);
    margin-left: 4px;
}

.phase-completed .phase-steps { border-left-color: rgba(54, 179, 126, 0.3); }
.phase-active .phase-steps { border-left-color: rgba(76, 154, 255, 0.3); }

.phase-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
}

.step-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-left: -23px;
}

.step-indicator.dot-auto  { background: var(--blue); }
.step-indicator.dot-wait  { background: var(--yellow); }
.step-indicator.dot-ok    { background: var(--green); }
.step-indicator.dot-error { background: var(--red); }
.step-indicator.dot-inter { background: var(--gray); }

.phase-step.step-completed .step-indicator {
    background: transparent !important;
    width: auto;
    height: auto;
    opacity: 1;
}
.phase-step.step-completed .step-indicator::after {
    content: "✓";
    font-size: 12px;
    font-weight: 700;
    color: var(--green);
    margin-left: -2px;
}
.phase-step.step-pending .step-indicator { opacity: 0.3; }
.phase-step.step-active .step-indicator {
    box-shadow: 0 0 6px currentColor;
    animation: pulse-dot 1.5s infinite;
}

.step-info {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.step-name {
    font-size: 12px;
    color: var(--text-muted);
}

.phase-step.step-active .step-name {
    color: var(--text);
    font-weight: 600;
}

.phase-step.step-completed .step-name {
    color: var(--text-muted);
}

.phase-step.step-pending .step-name {
    opacity: 0.5;
}

.step-human {
    font-size: 10px;
}

.step-time {
    font-size: 10px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.phase-human-wait {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 10px;
    flex-shrink: 0;
    align-self: center;
    border: 1px dashed rgba(255, 171, 0, 0.3);
    border-radius: 10px;
    background: rgba(255, 171, 0, 0.04);
    min-width: 70px;
}

.phase-human-wait .human-wait-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--yellow);
}

.phase-human-wait .human-wait-label {
    font-size: 10px;
    color: var(--yellow);
    text-align: center;
    line-height: 1.3;
}

.phase-human-wait .human-wait-duration {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--yellow);
}

.progress-terminal {
    text-align: center;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 4px;
}

.progress-terminal.badge-red {
    background: rgba(255, 86, 48, 0.1);
    color: var(--red);
}

.progress-terminal.badge-gray {
    background: rgba(80, 85, 102, 0.2);
    color: var(--text-muted);
}

.progress-summary {
    display: flex;
    gap: 24px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.summary-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.summary-value {
    font-size: 14px;
    font-weight: 600;
}

.summary-breakdown {
    font-size: 11px;
    color: var(--text-muted);
}

/* === End Progress View === */

.error-preview {
    margin-top: 8px;
    padding: 6px 12px;
    background: rgba(255, 86, 48, 0.08);
    border-left: 3px solid var(--red);
    border-radius: 4px;
    font-size: 12px;
    color: var(--red);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tab navigation */
.tab-nav {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    padding: 0 24px;
}

.tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

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

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

/* Repos page */
.repos-container {
    padding: 16px 24px;
}

.repos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.repos-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.btn-add {
    background: var(--blue);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.btn-add:hover {
    opacity: 0.9;
}

.repos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
}

.repo-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
}

.repo-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.repo-card-name {
    font-weight: 600;
    font-size: 16px;
}

.badge-default {
    font-size: 11px;
    background: rgba(54, 179, 126, 0.15);
    color: var(--green);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.repo-card-details {
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
    margin-bottom: 12px;
}

.repo-card-details td {
    padding: 4px 0;
}

.repo-card-details td:first-child {
    color: var(--text-muted);
    padding-right: 12px;
    width: 100px;
}

.repo-card-details code {
    background: var(--bg-input);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.git-url-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary) !important;
    font-family: monospace;
    font-size: 12px;
    text-decoration: none !important;
    transition: border-color 0.15s, background 0.15s;
}
.git-url-chip:hover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.08);
}
.git-url-chip svg:first-child {
    flex-shrink: 0;
    opacity: 0.7;
}

.url-cell {
    font-family: monospace;
    font-size: 11px;
    word-break: break-all;
    color: var(--text-muted);
}

.label-tag {
    background: rgba(76, 154, 255, 0.15);
    color: var(--blue);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

.text-muted {
    color: var(--text-muted);
}

.repo-card-actions {
    display: flex;
    gap: 8px;
}

.btn-edit, .btn-delete {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

.btn-edit:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.btn-delete:hover {
    border-color: var(--red);
    color: var(--red);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 32px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 {
    font-size: 18px;
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
    flex: 1;
}

.form-row label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.form-row input[type="text"] {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    width: 100%;
}

.form-row input[type="text"]:focus {
    border-color: var(--blue);
}

.form-row input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-row-inline {
    display: flex;
    gap: 12px;
}

.form-checkbox {
    flex-direction: row;
    align-items: center;
}

.form-checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--blue);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}

.btn-cancel:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

.btn-save {
    background: var(--blue);
    border: none;
    color: white;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.btn-save:hover {
    opacity: 0.9;
}

/* Webhook logs */
.webhook-list {
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.webhook-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
    font-size: 14px;
}

.webhook-row {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.webhook-row:hover {
    border-color: var(--blue);
}

.webhook-row.expanded {
    border-color: var(--blue);
}

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

.webhook-time {
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-family: monospace;
    min-width: 70px;
}

.webhook-type-badge {
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--blue);
}

.webhook-action {
    font-size: 12px;
    color: var(--text-muted);
}

.webhook-result-action {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
}

.webhook-issue {
    font-size: 12px;
    font-weight: 500;
    color: var(--blue);
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 4px;
}

.webhook-summary {
    flex: 1;
    font-size: 13px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.webhook-duration {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 45px;
    text-align: right;
}

.webhook-detail {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.webhook-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 12px;
}

.webhook-detail-section h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.webhook-summary-full {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
}

.webhook-decision-result {
    margin-bottom: 10px;
}

.webhook-decision-result .status-badge {
    font-size: 13px;
    padding: 4px 12px;
}

.webhook-decision-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 8px;
}

.webhook-decision-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
}

.webhook-decision-value {
    font-size: 13px;
    color: var(--text);
    line-height: 1.4;
}

.webhook-decision-note {
    margin-top: 8px;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-input);
    border-radius: 4px;
    border-left: 3px solid var(--blue);
    font-style: italic;
}

.webhook-payload {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 12px;
    font-family: monospace;
    overflow-x: auto;
    white-space: pre;
    color: var(--text);
    max-height: 300px;
    overflow-y: auto;
}

/* ===== Workflow tab ===== */
.wf-page {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.wf-section {
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wf-section-header {
    text-align: center;
    margin-bottom: 24px;
    width: 100%;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.wf-section-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.wf-section-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

/* Source label */
.wf-source-label {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 600;
    color: var(--blue);
}

/* Arrows */
.wf-arrow-down {
    width: 2px;
    height: 24px;
    background: var(--border);
    position: relative;
    margin: 0 auto;
}

.wf-arrow-down::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--border);
}

.wf-arrow-down-sm {
    width: 2px;
    height: 12px;
    background: var(--border);
    margin: 0 auto;
    position: relative;
}

.wf-arrow-down-sm::after {
    content: "";
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--border);
}

/* Trigger cards */
.wf-triggers {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    width: 100%;
}

.wf-trigger {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wf-trigger-title {
    font-size: 14px;
    font-weight: 600;
}

.wf-trigger-assignation .wf-trigger-title { color: var(--blue); }
.wf-trigger-comment .wf-trigger-title { color: var(--green); }
.wf-trigger-status .wf-trigger-title { color: var(--yellow); }
.wf-trigger-session .wf-trigger-title { color: #a78bfa; }

.wf-trigger-events {
    font-size: 11px;
    font-family: monospace;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 4px 8px;
    border-radius: 4px;
}

.wf-trigger-details {
    list-style: none;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.wf-trigger-details li::before {
    content: "· ";
    color: var(--gray);
}

.wf-trigger-result {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    background: var(--bg-input);
    padding: 6px 10px;
    border-radius: 6px;
    text-align: center;
    border-left: 3px solid var(--blue);
}

/* PocketBase node */
.wf-db-node {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 2px solid var(--blue);
    border-radius: 10px;
    padding: 12px 24px;
}

.wf-db-icon {
    color: var(--blue);
    display: flex;
    align-items: center;
}

.wf-db-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--blue);
}

.wf-db-sub {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
}

/* Priority box */
.wf-priority-box {
    width: 100%;
    max-width: 520px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 20px;
}

.wf-priority-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.wf-priority-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.wf-priority-desc strong {
    color: var(--text);
    font-family: monospace;
}

.wf-priority-factors {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wf-priority-factor {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    padding: 8px 12px;
    background: var(--bg-input);
    border-radius: 6px;
}

.wf-priority-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.wf-priority-value {
    font-size: 13px;
    font-weight: 700;
    font-family: monospace;
    color: var(--blue);
    text-align: right;
}

.wf-priority-detail {
    grid-column: 1 / -1;
    font-size: 11px;
    color: var(--text-muted);
}

/* Worker pools */
.wf-pools {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    width: 100%;
}

.wf-pool {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wf-pool-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.wf-pool-name {
    font-size: 14px;
    font-weight: 600;
}

.wf-pool-slots {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 10px;
}

/* Status nodes */
.wf-status {
    width: 100%;
    border-radius: 8px;
    padding: 10px 12px;
    text-align: center;
}

.wf-status-name {
    font-size: 12px;
    font-weight: 700;
    font-family: monospace;
    letter-spacing: 0.3px;
}

.wf-status-desc {
    font-size: 11px;
    margin-top: 4px;
    line-height: 1.3;
}

.wf-status-auto {
    background: rgba(76, 154, 255, 0.1);
    border: 1px solid rgba(76, 154, 255, 0.3);
}
.wf-status-auto .wf-status-name { color: var(--blue); }
.wf-status-auto .wf-status-desc { color: rgba(76, 154, 255, 0.7); }

.wf-status-wait {
    background: rgba(255, 171, 0, 0.1);
    border: 1px solid rgba(255, 171, 0, 0.3);
}
.wf-status-wait .wf-status-name { color: var(--yellow); }
.wf-status-wait .wf-status-desc { color: rgba(255, 171, 0, 0.7); }

.wf-status-ok {
    background: rgba(54, 179, 126, 0.1);
    border: 1px solid rgba(54, 179, 126, 0.3);
}
.wf-status-ok .wf-status-name { color: var(--green); }
.wf-status-ok .wf-status-desc { color: rgba(54, 179, 126, 0.7); }

.wf-status-error {
    background: rgba(255, 86, 48, 0.1);
    border: 1px solid rgba(255, 86, 48, 0.3);
}
.wf-status-error .wf-status-name { color: var(--red); }
.wf-status-error .wf-status-desc { color: rgba(255, 86, 48, 0.7); }

.wf-status-inter {
    background: rgba(80, 85, 102, 0.15);
    border: 1px solid rgba(80, 85, 102, 0.3);
}
.wf-status-inter .wf-status-name { color: var(--text-muted); }
.wf-status-inter .wf-status-desc { color: var(--gray); }

/* Branches (OK / KO) */
.wf-branch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    margin-top: 8px;
}

.wf-branch-ok, .wf-branch-ko {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wf-branch-label {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
    margin-bottom: 4px;
}

.wf-label-ok {
    background: rgba(54, 179, 126, 0.15);
    color: var(--green);
}

.wf-label-ko {
    background: rgba(255, 86, 48, 0.15);
    color: var(--red);
}

/* Retry box */
.wf-retry-box {
    font-size: 11px;
    color: var(--orange);
    background: rgba(255, 139, 0, 0.1);
    border: 1px dashed rgba(255, 139, 0, 0.4);
    border-radius: 6px;
    padding: 6px 10px;
    text-align: center;
    width: 100%;
}

/* Action box */
.wf-action-box {
    font-size: 11px;
    color: var(--text);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    text-align: center;
    width: 100%;
}

/* Next pool pointer */
.wf-next-pool {
    font-size: 12px;
    font-weight: 600;
    color: var(--blue);
    padding: 6px 12px;
    border: 1px solid var(--blue);
    border-radius: 6px;
}

/* Human action callout */
.wf-human-action {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 10px 14px;
    background: rgba(255, 171, 0, 0.08);
    border: 1px solid rgba(255, 171, 0, 0.25);
    border-radius: 8px;
    font-size: 12px;
    color: var(--yellow);
    width: 100%;
}

.wf-human-icon {
    font-size: 16px;
    flex-shrink: 0;
}

/* Feedback box */
.wf-feedback-box {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 5px 10px;
    background: rgba(76, 154, 255, 0.08);
    border: 1px dashed rgba(76, 154, 255, 0.3);
    border-radius: 6px;
    font-size: 11px;
    color: var(--blue);
    width: 100%;
}

.wf-feedback-icon {
    font-size: 14px;
}

/* Deviation rules */
.wf-deviation-box {
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.wf-deviation-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.wf-deviation-rules {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.wf-rule {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.wf-rule-auto {
    background: rgba(54, 179, 126, 0.15);
    color: var(--green);
}

.wf-rule-stop {
    background: rgba(255, 86, 48, 0.15);
    color: var(--red);
}

/* Terminal statuses */
.wf-terminals {
    width: 100%;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.wf-terminal-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.wf-terminal-nodes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

/* Legend */
.wf-legend {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 24px;
    margin-top: 8px;
}

.wf-legend-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.wf-legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.wf-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.wf-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.wf-dot-auto { background: var(--blue); }
.wf-dot-wait { background: var(--yellow); }
.wf-dot-ok { background: var(--green); }
.wf-dot-error { background: var(--red); }
.wf-dot-inter { background: var(--gray); }

/* Responsive */
@media (max-width: 640px) {
    .stats-bar {
        padding: 12px 16px;
    }

    .task-list {
        padding: 12px 16px;
    }

    .task-header {
        gap: 8px;
    }

    .task-title {
        order: 3;
        flex-basis: 100%;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .pipeline-full {
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .repos-grid {
        grid-template-columns: 1fr;
    }

    .form-row-inline {
        flex-direction: column;
        gap: 0;
    }

    .modal-content {
        margin: 16px;
    }

    .wf-triggers {
        grid-template-columns: 1fr;
    }

    .wf-pools {
        grid-template-columns: 1fr;
    }

    .wf-terminal-nodes {
        grid-template-columns: repeat(2, 1fr);
    }

    .progress-phases {
        flex-direction: column;
    }

    .phase-human-wait {
        flex-direction: row;
        align-self: stretch;
    }
}

/* Session expired toast */
.session-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--red);
    border-radius: 10px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 9999;
    box-shadow: 0 4px 24px rgba(255, 86, 48, 0.25);
    animation: toast-slide-up 0.3s ease-out;
}

.session-toast.hidden {
    display: none;
}

.session-toast .toast-icon {
    width: 18px;
    height: 18px;
    color: var(--red);
}

.session-toast span {
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
}

.session-toast button {
    background: var(--red);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.session-toast button:hover {
    background: #e84a28;
}

@keyframes toast-slide-up {
    from { opacity: 0; transform: translateX(-50%) translateY(16px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Test API tab ── */

.pbtest-container {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    max-width: 960px;
}

.pbtest-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.pbtest-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.pbtest-section-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.pbtest-section-header h3 svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.pbtest-refresh-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.pbtest-refresh-btn:hover {
    color: var(--blue);
    border-color: var(--blue);
}

.pbtest-refresh-btn svg {
    width: 14px;
    height: 14px;
}

/* User info grid */

.pbtest-user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.pbtest-user-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--bg-input);
    border-radius: 8px;
    padding: 12px;
}

.pbtest-user-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.pbtest-user-value {
    font-size: 14px;
    color: var(--text);
}

.pbtest-mono {
    font-family: monospace;
    font-size: 12px;
}

.pbtest-no-user {
    color: var(--text-muted);
    font-size: 14px;
}

/* Collections grid */

.pbtest-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.pbtest-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pbtest-card-error {
    border-color: rgba(255, 86, 48, 0.3);
}

.pbtest-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pbtest-card-header svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.pbtest-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.pbtest-card-collection {
    font-size: 12px;
    font-family: monospace;
    color: var(--text-muted);
}

.pbtest-card-status {
    margin-top: 4px;
}

.pbtest-card-detail {
    font-size: 13px;
}

.pbtest-count {
    color: var(--text-muted);
}

.pbtest-error-msg {
    color: var(--red);
    font-size: 12px;
    word-break: break-word;
}

/* Badges */

.pbtest-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pbtest-badge.ok {
    background: rgba(54, 179, 126, 0.15);
    color: var(--green);
}

.pbtest-badge.error {
    background: rgba(255, 86, 48, 0.15);
    color: var(--red);
}

.pbtest-badge.loading {
    background: rgba(76, 154, 255, 0.15);
    color: var(--blue);
}

@media (max-width: 600px) {
    .pbtest-container {
        padding: 16px;
    }
    .pbtest-grid,
    .pbtest-user-grid {
        grid-template-columns: 1fr;
    }
}

/* Token config modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-card h2 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 16px;
}

.modal-card .help-text {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 16px;
}

.modal-card .help-text strong {
    color: var(--text);
}

.modal-card .help-steps {
    list-style: none;
    counter-reset: step;
    margin: 12px 0;
    padding: 0;
}

.modal-card .help-steps li {
    counter-increment: step;
    padding: 6px 0 6px 32px;
    position: relative;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.modal-card .help-steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-card .help-steps code {
    background: var(--bg-input);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--blue);
}

.modal-card .token-input-group {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.modal-card .token-input-group input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text);
    font-size: 13px;
    font-family: monospace;
}

.modal-card .token-input-group input:focus {
    outline: none;
    border-color: var(--blue);
}

.modal-card .btn-row {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    justify-content: flex-end;
}

.modal-card .btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background 0.15s, opacity 0.15s;
}

.modal-card .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-card .btn-primary {
    background: var(--blue);
    color: #fff;
}

.modal-card .btn-primary:hover:not(:disabled) {
    background: #3d8bef;
}

.modal-card .btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.modal-card .btn-ghost:hover {
    background: var(--bg-input);
    color: var(--text);
}

.modal-card .btn-danger {
    background: transparent;
    color: var(--red);
    border: 1px solid transparent;
}

.modal-card .btn-danger:hover {
    background: rgba(255, 86, 48, 0.1);
}

.modal-card .token-status {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
}

.modal-card .token-status.success {
    background: rgba(54, 179, 126, 0.1);
    color: var(--green);
    border: 1px solid rgba(54, 179, 126, 0.2);
}

.modal-card .token-status.error {
    background: rgba(255, 86, 48, 0.1);
    color: var(--red);
    border: 1px solid rgba(255, 86, 48, 0.2);
}

/* ── Chat Log View ──────────────────────────────────────── */

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

.chat-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    font-family: inherit;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.chat-toggle-btn:hover {
    border-color: var(--blue);
    color: var(--text);
    background: rgba(76, 154, 255, 0.05);
}

.chat-container {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.chat-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    font-family: inherit;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 12px;
    transition: all 0.15s;
}

.chat-back-btn:hover {
    border-color: var(--blue);
    color: var(--text);
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 600px;
    overflow-y: auto;
    padding: 4px;
}

.chat-phase-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-phase-header::before,
.chat-phase-header::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.chat-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.chat-bubble.user {
    align-self: flex-end;
    background: rgba(76, 154, 255, 0.12);
    border: 1px solid rgba(76, 154, 255, 0.2);
    border-bottom-right-radius: 4px;
}

.chat-bubble.assistant {
    align-self: flex-start;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.chat-bubble.assistant.no-data {
    opacity: 0.5;
    font-style: italic;
}

.chat-bubble.error {
    align-self: flex-start;
    background: rgba(255, 86, 48, 0.08);
    border: 1px solid rgba(255, 86, 48, 0.25);
    color: var(--red);
    border-bottom-left-radius: 4px;
}

.chat-timestamp {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-cost {
    background: rgba(76, 154, 255, 0.1);
    color: var(--blue);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
}

/* Markdown content inside chat bubbles */
.chat-bubble-content h1,
.chat-bubble-content h2,
.chat-bubble-content h3,
.chat-bubble-content h4 {
    margin: 8px 0 4px;
    font-size: 14px;
    color: var(--text);
}

.chat-bubble-content h1 { font-size: 16px; }
.chat-bubble-content h2 { font-size: 15px; }

.chat-bubble-content p {
    margin: 4px 0;
}

.chat-bubble-content pre {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    overflow-x: auto;
    font-size: 12px;
    margin: 6px 0;
}

.chat-bubble-content code {
    background: var(--bg);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 12px;
}

.chat-bubble-content pre code {
    background: none;
    padding: 0;
}

.chat-bubble-content ul,
.chat-bubble-content ol {
    padding-left: 20px;
    margin: 4px 0;
}

.chat-bubble-content blockquote {
    border-left: 3px solid var(--blue);
    padding-left: 10px;
    margin: 6px 0;
    color: var(--text-muted);
}

.chat-bubble-content table {
    border-collapse: collapse;
    margin: 6px 0;
    font-size: 12px;
}

.chat-bubble-content th,
.chat-bubble-content td {
    border: 1px solid var(--border);
    padding: 4px 8px;
}

.chat-bubble-content th {
    background: var(--bg);
}

/* Collapsible long content */
.chat-collapsed:not(.expanded) {
    max-height: 300px;
    overflow: hidden;
    position: relative;
}

.chat-collapsed:not(.expanded)::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(transparent, var(--bg-input));
    pointer-events: none;
}

.chat-bubble.user .chat-collapsed:not(.expanded)::after {
    background: linear-gradient(transparent, rgba(76, 154, 255, 0.12));
}

.chat-expand-btn {
    display: block;
    margin-top: 6px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--blue);
    font-size: 11px;
    font-family: inherit;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.chat-expand-btn:hover {
    background: rgba(76, 154, 255, 0.1);
}

.chat-collapsed.expanded .chat-expand-btn {
    display: none;
}

.chat-collapsed.expanded {
    max-height: none;
    overflow: visible;
}
