/* ===== CSS Variables ===== */
:root {
    --bg: #0c0d12;
    --bg-surface: #14161e;
    --bg-card: #1a1c28;
    --bg-hover: #22253a;
    --bg-input: #12131a;
    --border: #262938;
    --border-light: #323650;
    --text: #e4e7f1;
    --text-secondary: #9096b0;
    --text-muted: #5e6380;
    --accent: #7c6bf0;
    --accent-hover: #8d7eff;
    --accent-subtle: rgba(124, 107, 240, 0.12);
    --accent-glow: rgba(124, 107, 240, 0.25);
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);
    --sidebar-width: 240px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-sm: 6px;
    --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.25);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.3);
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    letter-spacing: -0.011em;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
}

/* ===== Sidebar ===== */
#sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #161824 0%, #111320 100%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 20px 20px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.025em;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand svg {
    color: var(--accent);
    flex-shrink: 0;
    filter: drop-shadow(0 0 6px rgba(124, 107, 240, 0.3));
}

.org-switcher {
    padding: 8px 14px 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
}
.org-select {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 6px);
    color: var(--text);
    font-size: 0.82rem;
    padding: 6px 10px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
}
.org-select:focus {
    border-color: var(--accent);
}
.org-switcher-create {
    padding: 6px 14px 10px;
    border-bottom: 1px solid var(--border);
}
.org-switcher-create .form-input-sm {
    width: 100%;
    padding: 5px 8px;
    font-size: 0.8rem;
    margin-bottom: 4px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 6px);
    color: var(--text);
    font-family: inherit;
}
.org-switcher-create .form-input-sm:focus {
    border-color: var(--accent);
    outline: none;
}

/* Invitation banner */
.invitation-banner {
    margin-bottom: 16px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: var(--radius, 10px);
    border-left: 4px solid var(--accent);
}
.invitation-banner-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.invitation-banner-text {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    font-size: 0.9rem;
}
.invitation-banner-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
}

/* Suspension banner */
.suspended-banner {
    margin-bottom: 16px;
    padding: 16px 20px;
    background: color-mix(in srgb, var(--danger) 8%, var(--bg-card));
    border: 1px solid var(--danger);
    border-radius: var(--radius, 10px);
    border-left: 4px solid var(--danger);
}
.suspended-banner-content {
    color: var(--danger);
}
.suspended-banner-content strong {
    font-size: 1rem;
    display: block;
    margin-bottom: 4px;
}
.suspended-banner-content p {
    font-size: 0.9rem;
    margin: 0;
    opacity: 0.9;
}

/* Limits warning banner */
.limits-banner {
    margin-bottom: 16px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--warning);
    border-radius: var(--radius, 10px);
    border-left: 4px solid var(--warning);
}
.limits-banner-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--warning);
    font-size: 0.9rem;
}

/* Activity feed */
.activity-feed {
    max-height: 320px;
    overflow-y: auto;
}
.activity-feed-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
}
.activity-feed-item:last-child { border-bottom: none; }
.activity-feed-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}
.activity-feed-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.activity-feed-action {
    font-size: 0.85rem;
    color: var(--text);
}
.activity-feed-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.org-usage-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0 4px;
}
.usage-stat {
    font-size: 0.82rem;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 6px 12px;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border);
}
.usage-meter-bar {
    height: 8px;
    background: var(--bg-tertiary, #1a1a2e);
    border-radius: 4px;
    overflow: hidden;
}
.usage-meter-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.inline-form-card {
    padding: 12px 16px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

#sidebar nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    text-decoration: none;
    position: relative;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.nav-item.active {
    background: var(--accent-subtle);
    color: var(--accent);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.nav-item svg {
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.nav-item.active svg,
.nav-item:hover svg {
    opacity: 1;
}

/* ===== Collapsible Nav Group ===== */
.nav-group {
    display: flex;
    flex-direction: column;
}

.nav-group-toggle {
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 600;
}

.nav-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    opacity: 0.5;
    margin-left: auto;
}

.nav-group.expanded .nav-chevron {
    transform: rotate(180deg);
}

.nav-sub-items {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.nav-sub-item {
    padding-left: 38px !important;
    font-size: 0.85rem !important;
}

.sidebar-footer {
    padding: 8px;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.15);
}

/* ===== Main Content ===== */
#app {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 100%;
    overflow-x: hidden;
}

#topBar {
    background: transparent;
    padding: 16px 32px 0;
    border: none;
    box-shadow: none;
}

#breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
}

main {
    padding: 16px 32px 32px;
    max-width: 1200px;
    width: 100%;
}

/* ===== Section Headers ===== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header h2 {
    margin: 0;
    padding: 0;
    border: none;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.025em;
    line-height: 1.2;
}

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

/* ===== Headings ===== */
h2, h3 {
    color: var(--text);
    border: none;
    padding: 0;
    margin: 0 0 12px;
}

h3 {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-xs);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    margin: 0;
}

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

.stat-card {
    padding: 16px;
    margin-bottom: 0;
    overflow: hidden;
    min-width: 0;
    position: relative;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent) 0%, transparent 100%);
    opacity: 0.5;
}

.stat-card[data-accent="purple"]::before { background: linear-gradient(90deg, #7c6bf0, transparent); }
.stat-card[data-accent="blue"]::before { background: linear-gradient(90deg, #3b82f6, transparent); }
.stat-card[data-accent="green"]::before { background: linear-gradient(90deg, #22c55e, transparent); }
.stat-card[data-accent="red"]::before { background: linear-gradient(90deg, #ef4444, transparent); }
.stat-card[data-accent="amber"]::before { background: linear-gradient(90deg, #f59e0b, transparent); }

.stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-copyable {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-copyable span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.btn-copy {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.btn-copy:hover {
    background: var(--border);
    color: var(--text);
}

.btn-copy.copied {
    color: var(--success);
    border-color: var(--success);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: none;
    color: var(--text);
    margin: 0;
    line-height: 1.4;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #6356d4 100%);
    color: #fff;
    box-shadow: 0 1px 3px rgba(124, 107, 240, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover) 0%, #7468e0 100%);
    box-shadow: 0 2px 8px rgba(124, 107, 240, 0.4);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(124, 107, 240, 0.3);
}

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

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--border-light);
    transform: translateY(-1px);
}

.btn-ghost:active {
    transform: translateY(0);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: #fff;
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
}

.btn-back {
    margin-bottom: 16px;
    padding: 6px 12px;
}

.btn-full {
    width: 100%;
    justify-content: center;
    padding: 10px;
    margin-top: 8px;
}

/* Override default button styles */
button {
    font-family: inherit;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: inherit;
}

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.02em;
}

.badge-pending::before,
.badge-running::before,
.badge-success::before,
.badge-failed::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-pending {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-pending::before {
    background: var(--warning);
}

.badge-running {
    background: var(--info-bg);
    color: var(--info);
}

.badge-running::before {
    background: var(--info);
    animation: pulse-dot 1.5s ease-in-out infinite;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-success::before {
    background: var(--success);
}

.badge-failed {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-failed::before {
    background: var(--danger);
}

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

.badge-cancelled {
    background: rgba(156, 163, 175, 0.1);
    color: #9ca3af;
}

.badge-skipped {
    background: rgba(156, 163, 175, 0.08);
    color: #6b7280;
    font-style: italic;
}

.badge-awaiting_approval {
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
}

.approval-card {
    background: var(--bg-card);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
}

.approval-card h4 {
    margin: 0 0 12px 0;
    color: #a855f7;
    font-size: 0.9em;
}

.approval-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn-approve {
    background: var(--success);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.btn-reject {
    background: var(--danger);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.matrix-tag {
    display: inline-block;
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    margin-top: 4px;
}

.badge-idle, .badge-offline {
    background: rgba(156, 163, 175, 0.1);
    color: #9ca3af;
}

.badge-online {
    background: var(--success-bg);
    color: var(--success);
}

.badge-busy {
    background: var(--info-bg);
    color: var(--info);
}

/* Keep old status-* classes for compatibility */
.status-pending { color: var(--warning); }
.status-running { color: var(--info); }
.status-success { color: var(--success); }
.status-failed { color: var(--danger); }
.status-cancelled { color: #9ca3af; }

/* ===== Tables ===== */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: transparent;
}

td {
    padding: 12px;
    border-bottom: 1px solid rgba(38, 41, 56, 0.6);
    font-size: 0.875rem;
    color: var(--text-secondary);
    vertical-align: middle;
    transition: background var(--transition-fast);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(34, 37, 58, 0.5);
}

td:first-child {
    color: var(--text);
    font-weight: 500;
}

/* Action buttons in tables */
td .btn {
    padding: 4px 10px;
    font-size: 0.8rem;
}

td button:not(.btn) {
    padding: 4px 10px;
    font-size: 0.8rem;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

td button:not(.btn):hover {
    background: var(--border);
    color: var(--text);
}

/* ===== Forms ===== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.15s ease;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 0 12px rgba(124, 107, 240, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235c6078' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

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

.form-actions {
    margin-top: 16px;
    display: flex;
    gap: 8px;
}

.form-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 8px;
    min-height: 1.2em;
}

.inline-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.inline-form .form-group {
    min-width: 180px;
}

.inline-form .btn {
    margin-bottom: 0;
    height: 38px;
    align-self: flex-end;
}

/* ===== Auth Pages ===== */
.auth-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 44px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-header svg {
    margin-bottom: 16px;
}

.auth-header h2 {
    font-size: 1.25rem;
    margin-bottom: 6px;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ===== Pre / Code ===== */
pre {
    background: #0a0c12;
    color: #c9d1d9;
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.84rem;
    line-height: 1.7;
    border: 1px solid var(--border);
    margin: 0;
}

/* ===== Dashboard Widgets ===== */
.dashboard-widgets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}
@media (max-width: 900px) {
    .dashboard-widgets { grid-template-columns: 1fr; }
}

.all-clear {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    color: var(--success);
    font-size: 0.85rem;
    font-weight: 500;
}

.failure-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid rgba(38, 41, 56, 0.3);
}
.failure-item:last-child { border-bottom: none; }
.failure-item:hover { background: var(--bg-hover); }
.failure-item-main { display: flex; align-items: center; gap: 8px; }
.failure-item-job { font-weight: 500; font-size: 0.85rem; color: var(--text); }
.failure-item-run { font-size: 0.8rem; color: var(--text-muted); font-family: var(--font-mono); }
.failure-item-time { font-size: 0.75rem; color: var(--text-muted); }

.agent-summary-status {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(38, 41, 56, 0.3);
    font-size: 0.85rem;
}
.agent-summary-item { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.agent-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.agent-dot-online { background: var(--success); }
.agent-dot-busy { background: var(--warning); }
.agent-dot-offline { background: var(--text-muted); }
.agent-summary-list { padding: 8px 16px; }
.agent-summary-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ===== Dashboard Charts ===== */
.dashboard-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 900px) {
    .dashboard-charts { grid-template-columns: 1fr; }
}

/* ===== Run Detail Tabs ===== */
.tab-bar {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    gap: 0;
}
.tab {
    padding: 10px 20px;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}
.tab:hover { color: var(--text-secondary); background: var(--bg-hover); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Steps Overview (Overview tab) */
.steps-overview { padding: 4px 0; }
.step-overview-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid rgba(38, 41, 56, 0.3);
}
.step-overview-item:last-child { border-bottom: none; }
.step-overview-item:hover { background: var(--bg-hover); }
.step-overview-num {
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--bg-hover);
    color: var(--text-secondary);
    padding: 1px 7px;
    border-radius: 10px;
    flex-shrink: 0;
}
.step-overview-name { font-weight: 500; font-size: 0.85rem; color: var(--text); }
.step-overview-spacer { flex: 1; }
.step-overview-duration {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    flex-shrink: 0;
}

/* ===== Log Accordion ===== */
.log-accordion {
    max-height: 700px;
    overflow-y: auto;
    background: #080a10;
    border-top: 1px solid var(--border);
}

.log-step-group {
    border-bottom: 1px solid rgba(38, 41, 56, 0.5);
}
.log-step-group:last-child { border-bottom: none; }

.log-step-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    cursor: pointer;
    background: rgba(20, 22, 30, 0.8);
    transition: background var(--transition-fast);
    user-select: none;
    position: sticky;
    top: 0;
    z-index: 2;
}
.log-step-header:hover { background: var(--bg-hover); }

.log-step-chevron {
    transition: transform var(--transition-fast);
    flex-shrink: 0;
    color: var(--text-muted);
}
.log-step-group.expanded .log-step-chevron { transform: rotate(0deg); }
.log-step-group:not(.expanded) .log-step-chevron { transform: rotate(-90deg); }

.log-step-num {
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--bg-hover);
    color: var(--text-secondary);
    padding: 1px 7px;
    border-radius: 10px;
    flex-shrink: 0;
}

.log-step-name {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-step-spacer { flex: 1; }

.log-step-duration {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    flex-shrink: 0;
}

.log-step-body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    max-height: 0;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: #080a10;
    transition: max-height 0.2s ease-out, padding 0.2s ease-out;
}
.log-step-group.expanded .log-step-body {
    max-height: none;
    padding: 8px 0;
    overflow: visible;
}

.log-line {
    display: block;
    padding: 0 16px 0 70px;
    position: relative;
}
.log-line:hover { background: rgba(124, 107, 240, 0.04); }

.log-line-num {
    position: absolute;
    left: 0;
    width: 58px;
    text-align: right;
    padding-right: 12px;
    color: var(--text-muted);
    user-select: none;
    font-size: 0.75rem;
    opacity: 0.6;
}

.log-ts {
    display: none;
    color: var(--text-muted);
    font-size: 0.8em;
    opacity: 0.5;
    margin-right: 10px;
    user-select: none;
}
.show-timestamps .log-ts {
    display: inline;
}

#timestampToggleBtn.active {
    color: var(--accent);
    background: var(--accent-subtle);
}

/* ===== Fullscreen Logs ===== */
.fullscreen-logs {
    position: fixed !important;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 1000;
    border-radius: 0 !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
}
.fullscreen-logs .card-header {
    flex-shrink: 0;
    border-radius: 0;
}
.fullscreen-logs .step-timeline {
    flex-shrink: 0;
}
.fullscreen-logs .log-accordion {
    flex: 1;
    max-height: none;
}
.fullscreen-logs .scroll-to-bottom-btn {
    flex-shrink: 0;
}

.log-line.highlighted {
    background: rgba(124, 107, 240, 0.15) !important;
    border-left: 3px solid var(--accent);
}

/* ===== YAML Textarea ===== */
#jobFormYAML {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: #0d1117;
    color: #c9d1d9;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    tab-size: 2;
    width: 100%;
    resize: vertical;
    line-height: 1.6;
    box-sizing: border-box;
    min-height: 300px;
}

#jobFormYAML:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 0 12px rgba(124, 107, 240, 0.15);
    outline: none;
}

#jobFormYAML::placeholder {
    color: var(--text-muted);
}

/* ===== Error Summary ===== */
.error-card {
    border-color: rgba(239, 68, 68, 0.4);
    border-left: 3px solid var(--danger);
    box-shadow: inset 0 0 20px rgba(239, 68, 68, 0.05);
}

.error-card .card-header h3 {
    color: var(--danger);
}

.error-log {
    background: #0d1117;
    color: #fca5a5;
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    border: 1px solid rgba(239, 83, 80, 0.2);
    margin: 0;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.log-error {
    background: rgba(239, 83, 80, 0.1);
    display: inline-block;
    width: 100%;
    border-left: 2px solid var(--danger);
    padding-left: 6px;
    margin-left: -6px;
}

/* ===== Log Search ===== */
.log-search-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 3px 8px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.log-search-bar:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.log-search-bar input {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 0.85rem;
    width: 160px;
    outline: none;
    padding: 3px 4px;
}
.log-search-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.log-highlight {
    background: rgba(250, 204, 21, 0.3);
    border-radius: 2px;
}
.log-highlight-current {
    background: rgba(250, 204, 21, 0.7);
    outline: 1px solid rgba(250, 204, 21, 0.9);
}

/* ===== Auto-scroll Button ===== */
.scroll-to-bottom-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 6px 14px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: -1px;
}

/* ===== Job Form Section ===== */
#jobFormSection .card {
    max-width: 800px;
}

#jobFormSection form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ===== Artifacts ===== */
.artifact-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.artifact-item:last-child {
    border-bottom: none;
}

.artifact-item a {
    font-size: 0.82rem;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.artifact-item a:hover {
    background: var(--bg-hover);
    color: var(--text);
}

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

.artifact-install-btn {
    background: var(--accent);
    color: white !important;
    border-color: var(--accent) !important;
}

.artifact-install-btn:hover {
    background: var(--accent-hover);
    color: white !important;
}

/* ===== Utility Classes ===== */
.text-muted {
    color: var(--text-muted) !important;
}

.text-sm {
    font-size: 0.85rem;
}

/* ===== Sections (default hidden behavior) ===== */
section {
    background: transparent;
    padding: 0;
    margin: 0;
    box-shadow: none;
    border-radius: 0;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(50, 54, 80, 0.6);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(50, 54, 80, 0.9);
}

::selection {
    background: rgba(124, 107, 240, 0.3);
    color: var(--text);
}

/* ===== Loading Spinner ===== */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

.loading-row td {
    text-align: center;
    padding: 24px 12px;
}

.loading-row .spinner {
    width: 20px;
    height: 20px;
    margin-right: 8px;
}

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

/* ===== Section Transition ===== */
.section-enter {
    animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Skeleton Loading ===== */
.skeleton-row td {
    position: relative;
    overflow: hidden;
}

.skeleton-row td::after {
    content: '';
    display: block;
    height: 12px;
    width: 60%;
    background: linear-gradient(90deg, var(--bg-hover) 25%, var(--border) 50%, var(--bg-hover) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-row td:first-child::after { width: 40%; }
.skeleton-row td:nth-child(2)::after { width: 30%; }
.skeleton-row td:nth-child(3)::after { width: 50%; }
.skeleton-row td:last-child::after { width: 25%; }

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Step Timeline ===== */
.step-timeline {
    display: flex;
    height: 32px;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
    background: var(--bg-input);
    gap: 1px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.step-timeline:empty {
    display: none;
}

.step-timeline-segment {
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 6px;
    cursor: default;
    min-width: 2px;
    transition: opacity 0.15s;
}

.step-timeline-segment:hover {
    opacity: 0.9;
    filter: brightness(1.15);
}

.step-timeline-segment.status-success { background: var(--success); }
.step-timeline-segment.status-failed { background: var(--danger); }
.step-timeline-segment.status-running { background: var(--info); }
.step-timeline-segment.status-pending { background: var(--text-muted); }
.step-timeline-segment.status-cancelled { background: #6b7280; }

/* ===== ANSI Log Colors ===== */
.ansi-bold { font-weight: bold; }
.ansi-dim { opacity: 0.6; }
.ansi-italic { font-style: italic; }
.ansi-underline { text-decoration: underline; }
.ansi-black { color: #586e75; }
.ansi-red { color: #ef4444; }
.ansi-green { color: #22c55e; }
.ansi-yellow { color: #f59e0b; }
.ansi-blue { color: #3b82f6; }
.ansi-magenta { color: #ce93d8; }
.ansi-cyan { color: #26c6da; }
.ansi-white { color: #e1e4ed; }
.ansi-bright-black { color: #78909c; }
.ansi-bright-red { color: #ff7043; }
.ansi-bright-green { color: #69f0ae; }
.ansi-bright-yellow { color: #ffd54f; }
.ansi-bright-blue { color: #82b1ff; }
.ansi-bright-magenta { color: #ea80fc; }
.ansi-bright-cyan { color: #84ffff; }
.ansi-bright-white { color: #ffffff; }

/* ===== Toasts ===== */
#toastContainer {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text);
    min-width: 260px;
    max-width: 420px;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.toast-success {
    border-left: 3px solid var(--success);
}

.toast.toast-error {
    border-left: 3px solid var(--danger);
}

.toast.toast-info {
    border-left: 3px solid var(--info);
}

.toast.toast-out {
    animation: toastOut 0.2s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to { opacity: 0; transform: translateX(40px) scale(0.95); }
}

/* ===== Confirm Modal ===== */
.confirm-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: overlayFadeIn 0.2s ease;
}

.confirm-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 420px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.confirm-modal p {
    margin: 0 0 20px;
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.5;
    white-space: pre-line;
}

.confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ===== Step Builder ===== */
.spec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.spec-header label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-mode-toggle {
    display: flex;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.mode-btn {
    padding: 4px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.mode-btn.active {
    background: var(--accent);
    color: white;
}

.mode-btn:hover:not(.active) {
    color: var(--text);
}

.step-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.step-cards:empty::after {
    content: "No steps added yet. Click '+ Add Step' to begin.";
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 16px;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.step-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
}

.step-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.step-card-number {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent);
}

.step-card-actions {
    display: flex;
    gap: 4px;
}

.btn-icon {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s ease;
    padding: 0;
}

.btn-icon:hover {
    background: var(--border);
    color: var(--text);
}

.btn-icon-danger:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger);
}

.step-card .form-row {
    margin-bottom: 8px;
}

.step-command-textarea {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.secrets-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 8px 0;
}

.secret-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.secret-checkbox input[type="checkbox"] {
    accent-color: var(--accent);
}

/* ===== Badge Preview ===== */
.badge-preview {
    margin-bottom: 16px;
}

.badge-preview img {
    height: 20px;
}

.branch-tag { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-secondary); background: var(--bg-input); padding: 2px 8px; border-radius: var(--radius); border: 1px solid var(--border); }

/* ===== Health Indicators ===== */
.health-cell { white-space: nowrap; }
.health-dots { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; }
.health-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.health-dot-success { background: var(--success); }
.health-dot-failed { background: var(--danger); }
.health-pct { font-weight: 600; font-size: 0.8rem; margin-left: 6px; vertical-align: middle; }
.health-pct-good { color: var(--success); }
.health-pct-warn { color: var(--warning); }
.health-pct-bad { color: var(--danger); }

/* Weather Icons */
.weather-cell { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.weather-icon { vertical-align: middle; flex-shrink: 0; }
.weather-sunny { stroke: var(--success); }
.weather-partly-sunny { stroke: #a3e635; }
.weather-cloudy { stroke: var(--warning); }
.weather-rainy { stroke: #f97316; }
.weather-storm { stroke: var(--danger); }

/* YAML Editor */
.yaml-editor { position: relative; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.yaml-editor pre, .yaml-editor textarea {
    font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.5;
    padding: 12px; margin: 0; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: break-word;
}
.yaml-highlight {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-input); color: transparent; pointer-events: none; overflow: hidden;
}
.yaml-textarea {
    position: relative; z-index: 1; width: 100%; background: transparent; color: var(--text-primary);
    border: none; outline: none; resize: vertical; min-height: 300px;
    caret-color: var(--text-primary);
}
.yaml-highlight .yaml-key { color: #7ec8e3; }
.yaml-highlight .yaml-string { color: #ce9178; }
.yaml-highlight .yaml-comment { color: #6a9955; font-style: italic; }
.yaml-highlight .yaml-value { color: #dcdcaa; }
.yaml-highlight .yaml-dash { color: #c586c0; }
.yaml-validation { font-size: 0.8rem; margin-top: 4px; min-height: 1.2em; }
.yaml-validation.valid { color: var(--success); }
.yaml-validation.invalid { color: var(--danger); }

.webhook-info { display: flex; flex-direction: column; gap: 10px; }
.webhook-info .form-group { margin-bottom: 0; }
.webhook-info label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; display: block; }
.webhook-info code { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-secondary); }

.badge-snippets {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.badge-snippet label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    display: block;
}

.snippet-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
}

.snippet-row code {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* ===== Modal Overlay ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    animation: overlayFadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 520px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header h3 {
    margin: 0;
}

/* ===== Search Modal ===== */
.search-modal-content {
    padding: 0;
    overflow: hidden;
}

.search-modal-content input {
    width: 100%;
    padding: 16px 20px;
    background: var(--bg-card);
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 1rem;
    outline: none;
    font-family: inherit;
}

.search-modal-content input::placeholder {
    color: var(--text-muted);
}

.search-results {
    max-height: 300px;
    overflow-y: auto;
}

.search-result-item {
    padding: 10px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: background 0.1s;
}

.search-result-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* ===== Keyboard Shortcuts Table ===== */
.shortcuts-table {
    width: 100%;
}

.shortcuts-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.shortcuts-table td:first-child {
    white-space: nowrap;
    width: 140px;
}

kbd {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 5px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text);
    line-height: 1.5;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

/* ===== Hamburger Button ===== */
.hamburger-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
        top: calc(12px + env(safe-area-inset-top, 0px));
        left: calc(12px + env(safe-area-inset-left, 0px));
    }

    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    body.sidebar-open #sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-overlay {
        display: block;
    }

    #app {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    #topBar {
        padding: 12px 12px 0;
        padding-left: 52px;
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
    }

    main {
        padding: 12px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .card {
        border-radius: var(--radius);
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .section-actions {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    .inline-form {
        flex-direction: column;
    }

    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table td, table th {
        font-size: 0.85rem;
        padding: 10px 8px;
        white-space: nowrap;
    }

    .modal-content {
        max-width: 90vw;
    }

    .btn, .btn-sm {
        min-height: 40px;
        min-width: 40px;
    }

    .btn-copy {
        min-width: 32px;
        min-height: 32px;
        width: 32px;
        height: 32px;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    /* Tabs: tighter on mobile */
    .tab {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    /* Logs: smaller line numbers */
    .log-line {
        padding-left: 48px;
    }
    .log-line-num {
        width: 36px;
    }

    .log-step-body {
        font-size: 0.75rem;
    }

    .log-step-header {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .log-search-bar {
        flex-wrap: wrap;
    }

    .log-search-bar input {
        width: 100px;
    }

    .pipeline-job-card {
        padding: 10px 14px;
        min-width: 100px;
    }

    .pipeline-job-name {
        font-size: 0.8em;
    }

    .pipeline-graph-inner {
        gap: 16px;
        padding: 12px 8px;
    }

    /* Health dots smaller */
    .health-dots { gap: 1px; }
    .health-dot { width: 6px; height: 6px; }
}

/* ===== Small Phone (iPhone) ===== */
@media (max-width: 480px) {
    main {
        padding: 8px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }

    #topBar {
        padding: 8px 8px 0;
        padding-left: 48px;
        padding-top: calc(8px + env(safe-area-inset-top, 0px));
    }

    #breadcrumb {
        font-size: 0.8rem;
    }

    .card-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .stat-card {
        padding: 8px;
    }

    .stat-value {
        font-size: 0.95rem;
    }

    .stat-label {
        font-size: 0.68rem;
        margin-bottom: 4px;
    }

    .section-header h2 {
        font-size: 1.1rem;
    }

    .section-header {
        gap: 8px;
        margin-bottom: 12px;
    }

    .section-actions {
        width: 100%;
    }

    .section-actions .btn {
        flex: 1;
        font-size: 0.8rem;
        min-height: 36px;
        padding: 6px 10px;
    }

    .card {
        padding: 10px;
        border-radius: var(--radius-sm);
    }

    .card-header {
        margin-bottom: 10px;
        padding-bottom: 8px;
    }

    .card-header h3 {
        font-size: 0.9rem;
    }

    .auth-card {
        padding: 20px;
    }

    table td, table th {
        font-size: 0.8rem;
        padding: 8px 6px;
    }

    .badge {
        font-size: 0.7rem;
        padding: 2px 6px;
    }

    h2, h3 {
        margin: 0 0 8px;
    }

    .inline-form .btn {
        width: 100%;
    }

    .modal-content {
        max-width: 95vw;
        margin: 8px;
    }

    /* Tabs: compact on small phones */
    .tab-bar {
        gap: 0;
    }
    .tab {
        padding: 8px 10px;
        font-size: 0.8rem;
        flex: 1;
        text-align: center;
    }

    /* Logs: minimal line number gutter */
    .log-line {
        padding-left: 38px;
    }
    .log-line-num {
        width: 28px;
        font-size: 0.65rem;
    }
    .log-step-body {
        font-size: 0.7rem;
        line-height: 1.35;
    }
    .log-ts {
        font-size: 0.7em;
        margin-right: 6px;
    }
    .log-step-header {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    /* Dashboard widgets compact */
    .dashboard-widgets {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    /* Runs tables (dashboard + global) — hide Triggered By & Started */
    #dashboardRunsList th:nth-child(4), #dashboardRunsList td:nth-child(4),
    #dashboardRunsList th:nth-child(5), #dashboardRunsList td:nth-child(5),
    #allRunsList th:nth-child(4), #allRunsList td:nth-child(4),
    #allRunsList th:nth-child(5), #allRunsList td:nth-child(5) {
        display: none;
    }

    /* Jobs table — hide Duration & Health */
    #jobsList th:nth-child(4), #jobsList td:nth-child(4),
    #jobsList th:nth-child(3), #jobsList td:nth-child(3) {
        display: none;
    }

    /* Job detail runs — hide Triggered By & Started */
    #runsList th:nth-child(4), #runsList td:nth-child(4),
    #runsList th:nth-child(5), #runsList td:nth-child(5) {
        display: none;
    }

    /* Agents table — hide Tags & Last Seen */
    #agentsSection table th:nth-child(4), #agentsSection table td:nth-child(4),
    #agentsSection table th:nth-child(5), #agentsSection table td:nth-child(5) {
        display: none;
    }

    /* Agent detail runs — hide Started */
    #agentRunsList th:nth-child(4), #agentRunsList td:nth-child(4) {
        display: none;
    }

    /* Webhook deliveries — hide Detail */
    #webhookDeliveries th:nth-child(4), #webhookDeliveries td:nth-child(4) {
        display: none;
    }
}

/* Pipeline Graph */
.pipeline-graph {
    padding: 0;
    overflow-x: auto;
    min-height: 80px;
}

.pipeline-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}
.pipeline-summary-item { margin: 0 2px; }
.ps-success { color: var(--success); }
.ps-failed { color: var(--danger); }
.ps-running { color: var(--info); }
.ps-cancelled { color: var(--text-muted); }
.ps-pending { color: var(--text-muted); }
.pipeline-summary-duration { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); }

.pipeline-graph-inner {
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 20px 16px;
}

.pipeline-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.pipeline-job-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 22px;
    border-radius: 10px;
    border: 2px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
    min-width: 130px;
    text-align: center;
}

.pipeline-job-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(124, 107, 240, 0.2);
}

.pipeline-job-card.status-success { border-color: var(--success); box-shadow: 0 0 12px rgba(34, 197, 94, 0.15); }
.pipeline-job-card.status-failed { border-color: var(--danger); box-shadow: 0 0 12px rgba(239, 68, 68, 0.15); }
.pipeline-job-card.status-running { border-color: var(--info); border-style: solid; box-shadow: 0 0 12px rgba(59, 130, 246, 0.2); animation: pipeline-pulse 2s ease-in-out infinite; }
.pipeline-job-card.status-assigned { border-color: var(--warning); border-style: solid; box-shadow: 0 0 12px rgba(245, 158, 11, 0.15); }
.pipeline-job-card.status-pending { border-color: var(--text-muted); border-style: dashed; opacity: 0.8; }
.pipeline-job-card.status-blocked { border-color: var(--text-muted); opacity: 0.5; }
.pipeline-job-card.status-cancelled { border-color: var(--text-muted); opacity: 0.6; }

@keyframes pipeline-pulse {
    0%, 100% { box-shadow: 0 0 12px rgba(59, 130, 246, 0.2); }
    50% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.35); }
}

.pipeline-job-name {
    font-weight: 600;
    font-size: 0.85em;
    margin-bottom: 6px;
    color: var(--text);
    letter-spacing: -0.01em;
}

.pipeline-job-status {
    font-size: 0.8em;
}

.pipeline-job-duration {
    font-size: 0.75em;
    color: var(--text-muted);
    margin-top: 2px;
}

.pipeline-job-error-preview {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    line-height: 1.4;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.08);
    padding: 4px 6px;
    border-radius: 4px;
    margin-top: 6px;
    max-height: 48px;
    overflow: hidden;
    white-space: pre-wrap;
    word-break: break-all;
    text-align: left;
    width: 100%;
}

.pipeline-connector {
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.pipeline-svg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.pipeline-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.pipeline-children-count {
    font-size: 0.8em;
    color: var(--text-muted);
    margin-left: 4px;
}

/* Sidebar Build Queue & Executor Status (Jenkins-style) */
.sidebar-section {
    border-top: 1px solid var(--border);
}
.sidebar-section-header {
    padding: 8px 14px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid var(--border);
}
.sidebar-section-body {
    padding: 6px 8px;
    max-height: 220px;
    overflow-y: auto;
}
.sidebar-empty {
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 6px 6px;
}
.sb-queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 5px;
    cursor: pointer;
    transition: background var(--transition-fast);
}
.sb-queue-item:hover {
    background: var(--bg-hover);
}
.sb-queue-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sb-queue-wait {
    font-size: 0.7rem;
    color: var(--warning);
    white-space: nowrap;
    flex-shrink: 0;
}
/* Executor nodes */
.sb-exec-node {
    margin-bottom: 4px;
}
.sb-exec-node-offline {
    opacity: 0.5;
}
.sb-exec-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    border-radius: 4px;
}
.sb-exec-header:hover {
    background: var(--bg-hover);
}
.sb-exec-icon {
    flex-shrink: 0;
    opacity: 0.7;
}
.sb-exec-icon-offline {
    opacity: 0.4;
    color: var(--danger);
}
.sb-exec-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sb-exec-offline-tag {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: auto;
}
.sb-exec-slots {
    padding-left: 28px;
}
.sb-exec-slot {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.sb-exec-slot-num {
    font-size: 0.72rem;
    color: var(--text-muted);
    min-width: 10px;
}
.sb-exec-idle {
    color: var(--text-muted);
}
.sb-exec-job {
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sb-exec-job:hover {
    text-decoration: underline;
}

/* Stage View Table */
.stage-view-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.stage-view-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.stage-view-table th {
    text-transform: uppercase;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.stage-view-run-col {
    text-align: left !important;
    min-width: 90px;
}
.stage-view-avg-row td {
    border-bottom: 2px solid var(--border);
    text-align: center;
    padding: 8px 12px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}
.stage-view-run-row td {
    text-align: center;
    padding: 6px 12px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    border-bottom: 1px solid var(--border-light, rgba(0,0,0,0.05));
}
.stage-view-run-row:hover {
    background: var(--bg-hover);
}
.stage-view-run-link {
    color: var(--accent);
    font-weight: 600;
}
.stage-view-date {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-sans, system-ui);
}
.stage-view-cell-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}
.stage-view-cell-failed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}
.stage-view-cell-running {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}
.stage-view-cell-other {
    color: var(--text-muted);
}

/* ===== Test Results ===== */
.test-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--border);
}
.test-bar-pass { background: var(--success); }
.test-bar-fail { background: var(--danger); }
.test-bar-skip { background: var(--warning); }

.test-suite {
    border-bottom: 1px solid var(--border);
}
.test-suite:last-child { border-bottom: none; }
.test-suite-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
}
.test-suite-header:hover { background: var(--bg-hover); }
.test-suite-toggle {
    font-size: 0.7em;
    color: var(--text-muted);
    transition: transform 0.15s;
}
.test-suite.open .test-suite-toggle { transform: rotate(90deg); }
.test-suite-icon { font-weight: 600; }
.test-suite-name { font-weight: 500; }
.test-suite-body {
    display: none;
    padding: 0 16px 12px 40px;
}
.test-suite.open .test-suite-body { display: block; }

.test-case {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.9em;
}
.test-case-icon { width: 16px; text-align: center; }
.test-case-name { flex: 1; }
.test-case-class { font-size: 0.85em; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.test-case-dur { font-size: 0.85em; min-width: 60px; text-align: right; }
.test-failure {
    margin: 4px 0 8px 24px;
    padding: 8px 12px;
    background: rgba(244, 67, 54, 0.08);
    border-left: 3px solid var(--danger);
    border-radius: 4px;
    font-size: 0.85em;
}
.test-failure-msg { color: var(--danger); font-weight: 500; margin-bottom: 4px; }
.test-failure-detail {
    color: var(--text-muted);
    font-size: 0.9em;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
    margin: 0;
}

/* Step Outputs */
.step-outputs-table { width: 100%; border-collapse: collapse; }
.step-outputs-table th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--text-muted); padding: 8px 12px; border-bottom: 1px solid var(--border); }
.step-outputs-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.step-outputs-table .output-step { color: var(--accent); font-weight: 500; }
.step-outputs-table .output-key { font-family: var(--font-mono); font-size: 12px; }
.step-outputs-table .output-value { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Step Templates page */
.template-spec-preview { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Job Groups */
.job-group-header td { padding: 12px 16px 6px !important; border-bottom: none !important; }
.job-group-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }

/* Run Notes */
.run-note { padding: 8px 0; border-bottom: 1px solid var(--border); }
.run-note:last-of-type { border-bottom: none; }
.run-note-header { font-size: 0.8rem; margin-bottom: 4px; }
.run-note-body { font-size: 0.9rem; color: var(--text); white-space: pre-wrap; word-break: break-word; }

/* Build Annotations */
.annotation-item { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.annotation-item:last-child { border-bottom: none; }
.annotation-icon { flex-shrink: 0; margin-top: 1px; }
.annotation-message { flex: 1; word-break: break-word; }
.annotation-file { flex-shrink: 0; font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); }
.annotation-error { background: rgba(255, 80, 80, 0.08); }
.annotation-error .annotation-icon { color: var(--danger); }
.annotation-warning { background: rgba(255, 180, 50, 0.08); }
.annotation-warning .annotation-icon { color: var(--warning); }
.annotation-notice { background: rgba(100, 180, 255, 0.08); }
.annotation-notice .annotation-icon { color: var(--accent); }

/* Pin Button */
.btn-pinned { color: var(--warning) !important; border-color: var(--warning) !important; }
.pin-icon { font-size: 0.8em; }

/* Run Labels */
.run-label-tag { display: inline-flex; padding: 2px 8px; border-radius: 4px; font-size: 0.8rem; background: var(--bg-hover); color: var(--text-secondary); border: 1px solid var(--border); font-family: var(--font-mono); }

/* Log Search */
.log-search-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.log-search-highlight { background: rgba(255, 200, 50, 0.2) !important; border-left: 3px solid var(--warning) !important; }

/* Flaky Tests */
.flaky-bar-container { display: inline-block; width: 60px; height: 8px; background: var(--bg-surface); border-radius: 4px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.flaky-bar { height: 100%; background: var(--warning); border-radius: 4px; }

/* Run Comparison */
.cmp-faster { color: var(--success); font-weight: 600; }
.cmp-slower { color: var(--danger); font-weight: 600; }
.cmp-changed { background: rgba(255, 200, 50, 0.05); }

/* Retry Badge */
.badge-ghost { display: inline-flex; padding: 1px 5px; border-radius: 3px; font-size: 0.7rem; background: var(--bg-hover); color: var(--text-secondary); border: 1px solid var(--border); font-family: var(--font-mono); vertical-align: middle; margin-left: 4px; }

/* Job Favorites */
.favorite-star { cursor: pointer; font-size: 1.1em; color: var(--text-muted); transition: color 0.15s; margin-right: 4px; }
.favorite-star:hover { color: var(--warning); }
.favorite-star.active { color: var(--warning); }
.favorites-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.favorites-item:last-child { border-bottom: none; }
.favorites-item:hover { background: var(--bg-hover); }
.favorites-item-main { display: flex; align-items: center; gap: 6px; }
.favorites-item-name { font-weight: 500; }
.favorites-item-status { font-size: 0.85em; }

/* Gantt Timeline */
.gantt-timeline { padding: 12px; }
.gantt-row { display: flex; align-items: center; height: 32px; margin-bottom: 4px; }
.gantt-label { width: 150px; flex-shrink: 0; font-size: 0.85em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); padding-right: 8px; }
.gantt-track { flex: 1; position: relative; height: 24px; background: var(--bg-surface); border-radius: 4px; overflow: hidden; }
.gantt-bar { position: absolute; height: 100%; border-radius: 4px; display: flex; align-items: center; padding: 0 6px; font-size: 0.75em; color: #fff; min-width: 2px; }
.gantt-bar.status-success { background: var(--success); }
.gantt-bar.status-failed { background: var(--danger); }
.gantt-bar.status-running { background: var(--info); animation: pulse 2s infinite; }
.gantt-bar.status-pending { background: var(--text-muted); opacity: 0.4; }
.gantt-bar.status-skipped { background: #6b7280; opacity: 0.5; }
.gantt-bar.status-cancelled { background: #6b7280; }
.gantt-axis { display: flex; justify-content: space-between; padding: 4px 0 0 150px; font-size: 0.7em; color: var(--text-muted); }
@media (max-width: 600px) { .gantt-label { width: 80px; font-size: 0.75em; } .gantt-axis { padding-left: 80px; } }

/* Cross-Job Triggers */
.trigger-item { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.trigger-item:last-child { border-bottom: none; }
.trigger-arrow { color: var(--text-muted); font-size: 1.2em; }
.trigger-target { font-weight: 500; }

/* Step Metrics Table (Batch 18) */
#stepMetricsTable th { text-align: right; }
#stepMetricsTable th:first-child { text-align: left; }
#stepMetricsTable td { text-align: right; font-variant-numeric: tabular-nums; }
#stepMetricsTable td:first-child { text-align: left; }

/* Export Menu */
.export-menu-popup { position: absolute; top: 100%; right: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 100; min-width: 160px; overflow: hidden; }
.export-menu-popup a { display: block; padding: 10px 16px; color: var(--text-primary); text-decoration: none; font-size: 0.9em; }
.export-menu-popup a:hover { background: var(--bg-surface); }

/* Priority badge */
.badge-info { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.badge-accent { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }

/* Build Insights (Batch 19) */
.insights-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .insights-grid { grid-template-columns: 1fr; } }
.fail-rate-bar { position: relative; background: var(--bg-surface); border-radius: 4px; height: 22px; overflow: hidden; min-width: 80px; }
.fail-rate-fill { position: absolute; top: 0; left: 0; height: 100%; background: rgba(239, 68, 68, 0.3); border-radius: 4px; }
.fail-rate-bar span { position: relative; z-index: 1; padding: 0 6px; font-size: 0.8em; line-height: 22px; }

/* Heatmap */
.heatmap-grid { display: grid; grid-template-columns: 40px repeat(24, 1fr); gap: 2px; }
.heatmap-day { font-size: 0.75em; color: var(--text-secondary); display: flex; align-items: center; }
.heatmap-hour { font-size: 0.7em; color: var(--text-muted); text-align: center; }
.heatmap-label { }
.heatmap-cell { aspect-ratio: 1; background: var(--accent); border-radius: 2px; min-height: 12px; cursor: default; }

/* Maintenance banner */
.maintenance-banner { background: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.3); border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; color: var(--warning); font-size: 0.9em; }
.maintenance-banner strong { color: var(--text-primary); }

/* Duration Forecast (Batch 20) */
.forecast-bar-container { background: var(--bg-surface); border-radius: 6px; height: 24px; overflow: hidden; position: relative; }
.forecast-bar { height: 100%; background: var(--accent); border-radius: 6px; transition: width 0.5s ease; min-width: 0; }
.forecast-bar.over-estimate { background: var(--warning); }
.forecast-eta { font-size: 0.85em; color: var(--text-secondary); margin-top: 6px; }
.forecast-stats { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.forecast-stat { text-align: center; }
.forecast-stat .stat-label { font-size: 0.75em; text-transform: uppercase; color: var(--text-muted); }
.forecast-stat .stat-value { font-size: 1.1em; font-weight: 600; }

/* Cost Summary (Batch 20) */
.stat-card-inline { display: flex; flex-direction: column; align-items: center; padding: 12px 16px; background: var(--bg-surface); border-radius: 8px; }
.stat-card-inline .stat-label { font-size: 0.75em; text-transform: uppercase; color: var(--text-muted); }
.stat-card-inline .stat-value { font-size: 1.2em; font-weight: 600; margin-top: 4px; }
#costSummaryTable td:last-child { font-weight: 600; color: var(--accent); }
.cost-rate-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--bg-surface); border-radius: 6px; font-size: 0.85em; }
.cost-rate-chip .rate-type { text-transform: capitalize; font-weight: 500; }
.cost-rate-chip .rate-value { color: var(--accent); font-weight: 600; }

/* Rate Limit Dashboard (Batch 20) */
.rate-limit-gauge { background: var(--bg-surface); border-radius: 6px; height: 20px; overflow: hidden; position: relative; }
.rate-limit-gauge-fill { height: 100%; background: var(--success); border-radius: 6px; transition: width 0.3s ease; }
.rate-limit-gauge-fill.warning { background: var(--warning); }
.rate-limit-gauge-fill.danger { background: var(--danger); }

/* Agent Health Charts (Batch 21) */
#agentHealthCharts canvas { border-radius: 4px; }
.agent-health-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.agent-health-dot.good { background: var(--success); }
.agent-health-dot.warn { background: var(--warning); }
.agent-health-dot.critical { background: var(--danger); }

/* Log Search (Batch 21) */
.log-search-result { padding: 10px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.log-search-result:hover { background: var(--bg-surface); }
.log-search-meta { font-size: 0.8em; color: var(--text-muted); margin-bottom: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.log-search-line { font-family: var(--font-mono); font-size: 0.85em; white-space: pre-wrap; word-break: break-all; }
.log-search-highlight { background: rgba(99, 102, 241, 0.3); padding: 0 2px; border-radius: 2px; }

/* Approval Banner (Batch 21) */
.approval-banner { background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.3); border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.approval-request-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; }
.approval-request-item + .approval-request-item { border-top: 1px solid var(--border); }
.approval-request-info { font-size: 0.9em; }
.approval-request-actions { display: flex; gap: 6px; }

/* Notification Bell (Batch 22) */
.notif-bell { position: relative; cursor: pointer; padding: 6px; border-radius: 6px; transition: background 0.15s; }
.notif-bell:hover { background: var(--bg-surface); }
.notif-badge { position: absolute; top: 0; right: 0; background: var(--danger); color: #fff; font-size: 0.65em; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.notif-panel { position: absolute; top: 48px; right: 16px; width: 360px; max-height: 480px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 1000; display: flex; flex-direction: column; }
.notif-panel-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.notif-panel-list { flex: 1; overflow-y: auto; max-height: 360px; }
.notif-panel-footer { padding: 8px 16px; border-top: 1px solid var(--border); text-align: center; }
.notif-item { padding: 10px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; font-size: 0.85em; }
.notif-item:hover { background: var(--bg-surface); }
.notif-item.unread { border-left: 3px solid var(--accent); }
.notif-item-title { font-weight: 500; }
.notif-item-time { font-size: 0.8em; color: var(--text-muted); margin-top: 2px; }

/* Validate Result (Batch 22) */
.validate-success { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3); color: var(--success); }
.validate-error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: var(--danger); }
.validate-warning { color: var(--warning); }

/* Secret Rotation (Batch 23) */
.rotation-stale { color: var(--danger); font-weight: 500; }
.rotation-ok { color: var(--success); }
.rotation-no-policy { color: var(--text-muted); font-style: italic; }
.rotation-policy-input { width: 80px; padding: 4px 8px; background: var(--bg-surface); color: var(--text); border: 1px solid var(--border); border-radius: 4px; font-size: 0.85em; }

/* Changelog (Batch 23) */
.changelog-list { list-style: none; padding: 0; margin: 0; }
.changelog-item { padding: 10px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-start; }
.changelog-item:last-child { border-bottom: none; }
.changelog-sha { font-family: var(--font-mono); font-size: 0.8em; color: var(--accent); background: var(--bg-surface); padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.changelog-message { flex: 1; font-size: 0.9em; }
.changelog-author { font-size: 0.8em; color: var(--text-muted); white-space: nowrap; }
.changelog-empty { padding: 16px; color: var(--text-muted); font-size: 0.9em; }

/* API Usage Analytics (Batch 23) */
.api-usage-method { font-family: var(--font-mono); font-size: 0.8em; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.api-usage-method.get { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.api-usage-method.post { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.api-usage-method.put { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.api-usage-method.delete { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

/* IP Allowlist (Batch 24) */
.toggle-switch { position: relative; display: inline-flex; align-items: center; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { width: 36px; height: 20px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; position: relative; transition: background 0.2s; cursor: pointer; }
.toggle-slider::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-muted); transition: transform 0.2s, background 0.2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle-switch input:checked + .toggle-slider::after { transform: translateX(16px); background: #fff; }

/* Performance Regression (Batch 24) */
.perf-regression { color: var(--danger); font-weight: 500; }
.perf-ok { color: var(--success); }
.perf-delta-positive { color: var(--danger); }
.perf-delta-negative { color: var(--success); }

/* Custom Dashboards (Batch 24) */
.dashboard-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .dashboard-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .dashboard-grid { grid-template-columns: 1fr; } }
.dashboard-widget { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; min-height: 200px; position: relative; overflow: hidden; }
.dashboard-widget-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 0.85em; font-weight: 500; }
.dashboard-widget-body { padding: 12px; font-size: 0.85em; max-height: 280px; overflow-y: auto; }
.dashboard-widget-remove { cursor: pointer; color: var(--text-muted); font-size: 1.2em; padding: 0 4px; border: none; background: none; }
.dashboard-widget-remove:hover { color: var(--danger); }
.dashboard-card { padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card); cursor: pointer; transition: border-color 0.15s; }
.dashboard-card:hover { border-color: var(--accent); }
.dashboard-card-name { font-weight: 500; font-size: 1em; }
.dashboard-card-meta { font-size: 0.8em; color: var(--text-muted); margin-top: 4px; }
.dashboard-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }

/* Top bar layout fix for bell */
#topBar { display: flex; align-items: center; justify-content: space-between; position: relative; }

/* Queue Analytics */
.qa-stat { text-align: center; }
.bottleneck-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.bottleneck-item:last-child { border-bottom: none; }
.bottleneck-job { font-weight: 500; }
.bottleneck-wait { color: var(--warning); font-size: 0.9em; }
.bottleneck-count { font-size: 0.8em; color: var(--text-muted); }

/* Log Filters & Alerts */
.log-filter-item, .log-alert-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.log-filter-item:last-child, .log-alert-item:last-child { border-bottom: none; }
.log-filter-name { font-weight: 500; }
.log-filter-pattern { font-family: monospace; font-size: 0.85em; color: var(--text-muted); margin-left: 8px; }
.log-filter-badge { font-size: 0.75em; padding: 2px 6px; border-radius: 4px; background: var(--bg-input); color: var(--text-muted); margin-left: 6px; }
.log-alert-severity-info { color: var(--accent); }
.log-alert-severity-warning { color: var(--warning); }
.log-alert-severity-critical { color: var(--danger); }
.log-alert-channel { font-size: 0.85em; color: var(--text-muted); }
.log-alert-cooldown { font-size: 0.8em; color: var(--text-muted); }
.log-alert-count { font-size: 0.8em; color: var(--text-muted); margin-left: 8px; }

/* Status Page */
.status-page-job-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.status-page-job-item:last-child { border-bottom: none; }
.status-page-entry { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.status-page-entry:last-child { border-bottom: none; }
.status-page-indicator { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.status-page-indicator.success { background: var(--success); }
.status-page-indicator.failed { background: var(--danger); }
.status-page-indicator.running { background: var(--accent); }
.status-page-indicator.pending { background: var(--warning); }
.status-page-indicator.unknown { background: var(--text-muted); }
.status-page-job-name { font-weight: 500; flex: 1; }
.status-page-rate { font-size: 0.9em; color: var(--text-muted); min-width: 60px; text-align: right; }
.status-page-last-run { font-size: 0.8em; color: var(--text-muted); min-width: 100px; text-align: right; }

/* TOTP / 2FA (Batch 27) */
.totp-input { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 2em; text-align: center; letter-spacing: 0.3em; max-width: 200px; padding: 12px; }
.totp-secret-display { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-family: monospace; font-size: 0.95em; word-break: break-all; text-align: center; user-select: all; cursor: pointer; }
.recovery-codes-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-family: monospace; font-size: 0.95em; }
.recovery-codes-grid span { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 4px; padding: 6px 10px; text-align: center; }

/* Session Management (Batch 27) */
.session-current { color: var(--success); font-weight: 600; font-size: 0.8em; }
.session-device { font-weight: 500; }
.session-browser { font-size: 0.85em; color: var(--text-muted); }

/* Onboarding Wizard (Batch 28) */
.onboarding-container { max-width: 520px; margin: 0 auto; padding: 32px 16px; }
.onboarding-steps-indicator { display: flex; justify-content: center; gap: 12px; margin-bottom: 24px; }
.onboarding-dot { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.85em; font-weight: 600; background: var(--bg-surface); border: 2px solid var(--border); color: var(--text-muted); transition: all 0.2s; }
.onboarding-dot.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 12px var(--accent-glow); }
.onboarding-dot.done { background: var(--success); border-color: var(--success); color: #fff; }
.onboarding-step { animation: fadeIn 0.3s ease; }
.onboarding-code-block { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; font-family: var(--font-mono); font-size: 0.85em; overflow-x: auto; margin: 12px 0; word-break: break-all; }

/* Database Management (Batch 28) */
.db-info-path { font-size: 0.8em; color: var(--text-muted); word-break: break-all; }

/* Milestone Tags (Batch 34) */
.milestone-tag { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 10px; font-size: 0.7rem; font-weight: 600; color: #fff; vertical-align: middle; margin-left: 4px; }
.milestone-release { background: var(--success); }
.milestone-deploy { background: var(--primary, #3b82f6); }
.milestone-incident { background: var(--danger); }
.milestone-baseline { background: #8b5cf6; }
.milestone-custom { background: var(--text-secondary); }

/* Billing / Grace Period (Batch 36) */
.grace-period-banner { margin-bottom: 16px; }
.grace-period-banner .suspended-banner-content { background: rgba(255, 193, 7, 0.1); border: 1px solid var(--warning); border-radius: var(--radius); padding: 16px; }
.grace-period-banner .suspended-banner-content strong { color: var(--warning); }
.alert-warning { background: rgba(255, 193, 7, 0.1); border: 1px solid var(--warning); border-radius: var(--radius); padding: 12px 16px; }
.alert-danger { background: rgba(255, 71, 87, 0.1); border: 1px solid var(--danger); border-radius: var(--radius); padding: 12px 16px; }
