/* === ZBS Test Tool — Dark Command Center Theme === */

/* --- Custom Properties --- */
:root {
    /* Surfaces */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-input: #0d1117;
    --bg-glass: rgba(22, 27, 34, 0.7);

    /* Borders */
    --border: #30363d;
    --border-hover: #484f58;
    --border-focus: #58a6ff;

    /* Text */
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-tertiary: #6e7681;
    --text-inverse: #0d1117;

    /* Accents */
    --accent: #58a6ff;
    --accent-subtle: rgba(56, 139, 253, 0.1);
    --accent-glow: 0 0 0 3px rgba(56, 139, 253, 0.15);
    --accent-2: #a371f7;
    --accent-3: #f778ba;
    --success: #3fb950;
    --success-subtle: rgba(63, 185, 80, 0.12);
    --danger: #f85149;
    --danger-subtle: rgba(248, 81, 73, 0.12);
    --warning: #d29922;
    --warning-subtle: rgba(210, 153, 34, 0.12);
    --warning-alt: #e3862b;
    --warning-alt-subtle: rgba(227, 134, 43, 0.12);
    --info: #58a6ff;
    --info-subtle: rgba(88, 166, 255, 0.12);

    /* Spacing */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;

    /* Radii */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;

    /* Typography */
    --font-ui: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --text-xs: 11px;
    --text-sm: 13px;
    --text-base: 14px;
    --text-md: 15px;
    --text-lg: 18px;
    --text-xl: 22px;

    /* Transitions */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration: 150ms;

    /* Shadows */
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.3), 0 0 1px rgba(255, 255, 255, 0.05);
    --shadow-card-hover: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    --shadow-glow-blue: 0 0 20px rgba(56, 139, 253, 0.15);
    --shadow-glow-green: 0 0 20px rgba(63, 185, 80, 0.15);
    --shadow-glow-red: 0 0 20px rgba(248, 81, 73, 0.15);
}

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

body {
    font-family: var(--font-ui);
    font-size: var(--text-base);
    line-height: 1.5;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: var(--sp-5);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-overflow-scrolling: touch;
}

/* --- Layout --- */
.container {
    max-width: 960px;
    margin: 0 auto;
}

#tab-reports {
    max-width: 1200px;
}

/* --- Header --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp-6);
    padding-bottom: var(--sp-4);
    border-bottom: 1px solid var(--border);
}
.logout-link {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    text-decoration: none;
}
.logout-link:hover {
    color: var(--text-primary);
}

.app-header h1 {
    font-size: var(--text-xl);
    font-weight: 600;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 50%, var(--accent-2) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-header .tagline {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-top: var(--sp-1);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 500;
}

/* --- Tabs --- */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: var(--sp-6);
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: var(--sp-3) var(--sp-6);
    border: none;
    background: none;
    font-family: var(--font-ui);
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--text-tertiary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

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

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* --- Utility --- */
.hidden {
    display: none !important;
}

/* --- Buttons --- */
.btn {
    padding: var(--sp-2) var(--sp-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease), transform 60ms var(--ease);
}

.btn:hover:not(:disabled) {
    background: var(--border);
    border-color: var(--border-hover);
}

.btn:active:not(:disabled) {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.btn-primary {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
    background: #4c94e6;
    border-color: #4c94e6;
}

.btn-danger {
    background: var(--danger-subtle);
    color: var(--danger);
    border-color: rgba(248, 81, 73, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(248, 81, 73, 0.2);
    border-color: var(--danger);
}

.btn-success {
    background: var(--success-subtle);
    color: var(--success);
    border-color: rgba(63, 185, 80, 0.3);
}

.btn-success:hover:not(:disabled) {
    background: rgba(63, 185, 80, 0.2);
    border-color: var(--success);
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    cursor: pointer;
    padding: 0;
    font-weight: 500;
}

.btn-link:hover {
    text-decoration: underline;
}

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 2px var(--sp-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
}

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

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

.badge.mixed {
    background: var(--warning-subtle);
    color: var(--warning);
}

.badge.warning {
    background: var(--warning-alt-subtle);
    color: var(--warning-alt);
}

/* --- Form Controls --- */
input[type="text"],
input[type="date"],
select,
textarea {
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--sp-2) var(--sp-3);
    transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
    outline: none;
}

input[type="text"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(56, 139, 253, 0.12), 0 0 16px rgba(56, 139, 253, 0.06);
}

input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.4;
    cursor: default;
}

select {
    cursor: pointer;
}

/* --- Run Progress Banner --- */

.run-progress-banner {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-md);
    padding: var(--sp-3) var(--sp-4);
    margin-bottom: var(--sp-4);
    animation: rp-slide-in 0.3s ease-out;
}

@keyframes rp-slide-in {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.run-progress-header {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-2);
    font-weight: 600;
    font-size: var(--text-sm);
}

.run-progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: rp-pulse 1.5s ease-in-out infinite;
}

@keyframes rp-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.rp-lane-row {
    margin-bottom: var(--sp-2);
}

.rp-lane-row:last-child {
    margin-bottom: 0;
}

.rp-lane-info {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-bottom: var(--sp-1);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--sp-1);
}

.rp-lane-name {
    font-weight: 600;
    color: var(--text-primary);
}

.rp-lane-detail {
    color: var(--text-secondary);
}

.rp-lane-bar-row {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.run-progress-bar-track {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    flex: 1;
}

.run-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #6366f1);
    border-radius: 3px;
    transition: width 0.4s ease;
    min-width: 2%;
}

.rp-cancel-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    width: 22px;
    height: 22px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
}

.rp-cancel-btn:hover {
    color: #ef4444;
    border-color: #ef4444;
}

/* --- Status Page (Reports Tab) --- */

.timeline-period-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: var(--sp-4);
}

.timeline-period-bar select {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--sp-2) var(--sp-3);
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    cursor: pointer;
}

.status-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp-5);
}

.status-chips {
    display: flex;
    gap: var(--sp-2);
}

.status-period {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
}

.status-hero {
    display: flex;
    align-items: center;
    gap: var(--sp-5);
    padding: var(--sp-8) var(--sp-6);
    border-radius: var(--radius-xl);
    margin-bottom: var(--sp-6);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    background:
        radial-gradient(circle at 20% 50%, rgba(63, 185, 80, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(88, 166, 255, 0.04) 0%, transparent 50%),
        var(--bg-secondary);
}

.status-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: 0.3;
    pointer-events: none;
}

.status-hero.operational {
    border-color: rgba(63, 185, 80, 0.25);
    background:
        radial-gradient(circle at 20% 50%, rgba(63, 185, 80, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(63, 185, 80, 0.03) 0%, transparent 50%),
        var(--bg-secondary);
}

.status-hero.degraded {
    border-color: rgba(210, 153, 34, 0.25);
    background:
        radial-gradient(circle at 20% 50%, rgba(210, 153, 34, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(210, 153, 34, 0.03) 0%, transparent 50%),
        var(--bg-secondary);
}

.status-hero.down {
    border-color: rgba(248, 81, 73, 0.25);
    background:
        radial-gradient(circle at 20% 50%, rgba(248, 81, 73, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(248, 81, 73, 0.03) 0%, transparent 50%),
        var(--bg-secondary);
}

.status-hero-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-tertiary);
    position: relative;
    z-index: 1;
}

.status-hero.operational .status-hero-dot {
    background: var(--success);
    box-shadow: 0 0 12px rgba(63, 185, 80, 0.4);
}

.status-hero.degraded .status-hero-dot {
    background: var(--warning);
    box-shadow: 0 0 12px rgba(210, 153, 34, 0.4);
}

.status-hero.down .status-hero-dot {
    background: var(--danger);
    box-shadow: 0 0 12px rgba(248, 81, 73, 0.4);
}

.status-hero-text {
    position: relative;
    z-index: 1;
}

.status-hero-title {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.05);
}

.status-hero-subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: var(--sp-1);
}

#suite-timeline-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: var(--sp-4);
}

.timeline-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--sp-6);
    transition: border-color 200ms var(--ease), box-shadow 300ms var(--ease), transform 200ms var(--ease);
    position: relative;
    overflow: hidden;
}

.timeline-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
}

.timeline-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-1px);
}

.timeline-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp-4);
}

.timeline-card-left {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

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

.timeline-card-dot.passing { background: var(--success); box-shadow: 0 0 8px rgba(63, 185, 80, 0.4); animation: dot-pulse-green 3s ease-in-out infinite; }
.timeline-card-dot.warning { background: var(--warning); box-shadow: 0 0 8px rgba(227, 179, 65, 0.4); animation: dot-pulse-amber 3s ease-in-out infinite; }
.timeline-card-dot.failing { background: var(--danger); box-shadow: 0 0 8px rgba(248, 81, 73, 0.4); animation: dot-pulse-red 2s ease-in-out infinite; }
.timeline-card-dot.nodata { background: var(--text-tertiary); opacity: 0.5; }

@keyframes dot-pulse-green {
    0%, 100% { box-shadow: 0 0 4px rgba(63, 185, 80, 0.3); }
    50% { box-shadow: 0 0 12px rgba(63, 185, 80, 0.6); }
}
@keyframes dot-pulse-amber {
    0%, 100% { box-shadow: 0 0 4px rgba(227, 179, 65, 0.3); }
    50% { box-shadow: 0 0 12px rgba(227, 179, 65, 0.6); }
}
@keyframes dot-pulse-red {
    0%, 100% { box-shadow: 0 0 4px rgba(248, 81, 73, 0.3); }
    50% { box-shadow: 0 0 12px rgba(248, 81, 73, 0.7); }
}

.timeline-card-name {
    font-size: var(--text-md);
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--text-primary);
}

.timeline-card-right {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

.timeline-card-type {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    padding: 2px var(--sp-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.timeline-card-rate {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.timeline-card-rate.high { color: var(--success); }
.timeline-card-rate.medium { color: var(--warning); }
.timeline-card-rate.low { color: var(--danger); }

.timeline-bar {
    display: flex;
    gap: 2px;
    margin-bottom: var(--sp-3);
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
}

.timeline-segment {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    transition: transform 100ms var(--ease), filter 100ms var(--ease);
    position: relative;
}

.timeline-segment:hover {
    transform: scaleY(1.6);
    filter: brightness(1.2);
    z-index: 1;
}

.timeline-segment.passed { background: var(--success); box-shadow: 0 0 4px rgba(63, 185, 80, 0.2); }
.timeline-segment.failed { background: var(--danger); box-shadow: 0 0 4px rgba(248, 81, 73, 0.2); }
.timeline-segment.mixed { background: var(--warning); box-shadow: 0 0 4px rgba(210, 153, 34, 0.2); }
.timeline-segment.nodata { background: var(--bg-tertiary); }

.timeline-tooltip {
    position: fixed;
    padding: var(--sp-2) var(--sp-3);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    color: var(--text-primary);
    pointer-events: none;
    z-index: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    display: none;
}

.timeline-tooltip.visible {
    display: block;
}

/* Mobile long-press magnifier */
.timeline-magnifier {
    position: fixed;
    z-index: 600;
    display: none;
    background: var(--bg-primary);
    border: 1px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: var(--sp-3);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(99, 102, 241, 0.3);
    width: 280px;
}

.timeline-magnifier.visible {
    display: block;
}

.magnifier-segments {
    display: flex;
    gap: 4px;
    height: 36px;
    margin-bottom: var(--sp-2);
}

.magnifier-seg {
    flex: 1;
    border-radius: 6px;
    transition: transform 0.1s ease;
}

.magnifier-seg.selected {
    transform: scaleY(1.2);
    outline: 2px solid #fff;
    outline-offset: 1px;
}

.magnifier-seg.passed { background: var(--success); box-shadow: 0 0 4px rgba(63, 185, 80, 0.2); }
.magnifier-seg.failed { background: var(--danger); box-shadow: 0 0 4px rgba(248, 81, 73, 0.2); }
.magnifier-seg.mixed { background: var(--warning); box-shadow: 0 0 4px rgba(210, 153, 34, 0.2); }
.magnifier-seg.nodata { background: var(--bg-tertiary); }

.magnifier-label {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    text-align: center;
}

.timeline-card-footer {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.day-run-section {
    margin-bottom: var(--sp-5);
    padding-bottom: var(--sp-4);
    border-bottom: 1px solid var(--border);
}

.day-run-section:last-child {
    border-bottom: none;
}

/* Report Detail */
#back-btn {
    margin-bottom: var(--sp-4);
}

.detail-header h2 {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--sp-1);
}

.detail-header .meta {
    color: var(--text-tertiary);
    font-size: var(--text-sm);
    margin-bottom: var(--sp-3);
}

.detail-brief {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-5);
    padding: var(--sp-3) var(--sp-4);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.detail-summary {
    display: flex;
    gap: var(--sp-2);
    margin-bottom: var(--sp-4);
    padding-bottom: var(--sp-4);
    border-bottom: 1px solid var(--border);
}

.result-row {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--success);
    border-radius: var(--radius-md);
    padding: var(--sp-3) var(--sp-4);
    margin-bottom: var(--sp-2);
    transition: border-color 150ms var(--ease), background 150ms var(--ease);
}

.result-row:hover {
    background: rgba(22, 27, 34, 0.9);
    border-color: var(--border-hover);
}

.result-row.failed {
    border-left-color: var(--danger);
}

.result-row.warning {
    border-left: 3px solid var(--warning-alt);
}

.result-row .test-id {
    font-weight: 600;
    font-size: var(--text-base);
}

.result-row .test-info {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-top: var(--sp-1);
}

.result-row .error {
    color: var(--danger);
    font-size: var(--text-sm);
    margin-top: var(--sp-1);
}

.result-row details {
    margin-top: var(--sp-2);
}

.result-row summary {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.result-row summary:hover {
    color: var(--accent);
}

.browser-steps {
    margin-top: 8px;
    padding-left: 12px;
    border-left: 2px solid var(--border);
}
.browser-step {
    padding: 4px 0;
}
.browser-step.skipped {
    opacity: 0.5;
}
.step-reasoning {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-top: 2px;
    padding-left: 8px;
}
.step-method {
    font-size: 0.65em;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.step-method-dom {
    background: var(--success-subtle);
    color: var(--success);
}
.step-method-vision {
    background: var(--accent-subtle);
    color: var(--accent);
}
.step-method-direct {
    background: rgba(139, 148, 158, 0.12);
    color: var(--text-secondary);
}
.step-method-replay {
    background: rgba(129, 104, 255, 0.12);
    color: #a78bfa;
}
.btn-accent {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border-color: #6366f1;
}
.btn-accent:hover {
    background: linear-gradient(135deg, #5558e6, #7c4feb);
}
.step-usage {
    font-size: 0.75em;
    color: var(--text-secondary);
    opacity: 0.7;
}
.browser-usage-total {
    margin-top: 8px;
    padding: 6px 10px;
    font-size: 0.85em;
    color: var(--accent);
    border-top: 1px solid var(--border);
}
.step-screenshot-details {
    margin-top: 4px;
    padding-left: 8px;
}
.step-screenshot-details summary {
    cursor: pointer;
    font-size: 0.85em;
    color: var(--text-secondary);
}
.step-screenshot {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin-top: 4px;
    border: 1px solid var(--border);
}

pre {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    padding: var(--sp-3);
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.6;
    color: var(--text-secondary);
    margin-top: var(--sp-2);
}

/* --- Test Cases Tab --- */
.suite-layout {
    display: flex;
    gap: var(--sp-5);
}

/* Sidebar */
.suite-sidebar {
    width: 260px;
    flex-shrink: 0;
}

.suite-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp-3);
}

.suite-sidebar-header h3 {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
}

/* Suite Tree */
.suite-tree-item {
    margin-bottom: var(--sp-1);
}

.suite-run-times {
    display: flex;
    gap: 12px;
    padding: 2px 12px 4px 28px;
    font-size: 0.7rem;
    opacity: 0.5;
}

.run-time-label {
    white-space: nowrap;
}

.suite-header {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-3);
    cursor: pointer;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    user-select: none;
    transition: border-color var(--duration) var(--ease), background var(--duration) var(--ease);
}

.suite-header:hover {
    border-color: var(--border-hover);
    background: var(--bg-tertiary);
}

.suite-header.active {
    border-left: 3px solid var(--accent);
    background: var(--accent-subtle);
    border-color: rgba(56, 139, 253, 0.25);
}

.suite-header .suite-toggle {
    font-size: 10px;
    color: var(--text-tertiary);
    flex-shrink: 0;
    width: 12px;
    transition: transform var(--duration) var(--ease);
}

.suite-header .suite-name {
    font-weight: 600;
    font-size: var(--text-sm);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.suite-meta-badge {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.suite-scheduled-icon {
    font-size: var(--text-xs);
    color: var(--accent);
    flex-shrink: 0;
}

/* Test Case Items */
.test-cases-list {
    padding-left: var(--sp-6);
    padding-top: var(--sp-1);
}

.test-cases-list.collapsed {
    display: none;
}

.test-case-item {
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
    border-left: 2px solid transparent;
}

.test-case-item:hover {
    background: var(--accent-subtle);
    color: var(--text-primary);
}

.test-case-item.active {
    background: var(--accent-subtle);
    color: var(--accent);
    font-weight: 600;
    border-left-color: var(--accent);
}

.test-case-desc {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

/* Editor Panel */
.suite-editor {
    flex: 1;
    min-width: 0;
}

#editor-header {
    margin-bottom: var(--sp-2);
    font-weight: 600;
    font-size: var(--text-md);
    color: var(--text-primary);
}

.editor-title-dirty::after {
    content: " (unsaved)";
    color: var(--warning);
    font-weight: 600;
    font-size: var(--text-sm);
}

.field-label {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-bottom: var(--sp-1);
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

#suite-name {
    display: block;
    width: 100%;
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--text-md);
    font-weight: 600;
    margin-bottom: var(--sp-2);
}

.schedule-controls {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-3);
}

.schedule-toggle {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
}

.schedule-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
}

#suite-json {
    display: block;
    width: 100%;
    height: 400px;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.6;
    padding: var(--sp-4);
    resize: vertical;
    tab-size: 2;
    overflow: auto;
}

/* --- Test Case Form --- */
.test-form {
    margin-bottom: var(--sp-3);
    padding-bottom: 60px;
}

.test-form.hidden {
    display: none;
}

.form-section-title {
    font-size: var(--text-xs);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin: var(--sp-4) 0 var(--sp-2) 0;
    padding-bottom: var(--sp-1);
    border-bottom: 1px solid var(--border);
}

.form-section-title:first-child {
    margin-top: 0;
}

.form-row {
    display: flex;
    gap: var(--sp-3);
    margin-bottom: var(--sp-2);
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: var(--sp-2);
}

.form-group.flex-1 { flex: 1; }
.form-group.flex-2 { flex: 2; }

.form-group input,
.form-group select {
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--text-sm);
}

.form-group .field-label {
    margin-bottom: var(--sp-1);
}

/* Key-Value Editor */
.kv-editor {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.kv-row {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
}

.kv-row input {
    flex: 1;
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--text-sm);
}

.kv-row .kv-key {
    flex: 0.8;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}

.kv-row .kv-value {
    flex: 1.2;
}

.phone-row {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
    margin-bottom: var(--sp-2);
}

.phone-row .phone-input {
    flex: 1;
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--text-sm);
    font-family: var(--font-mono);
}

.step-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    position: relative;
}
.step-row.batched {
    margin-bottom: 0;
    border-left: 2px solid var(--accent);
    padding-left: 6px;
    border-radius: 0;
}
.step-row.batch-end {
    border-left: 2px solid var(--accent);
    padding-left: 6px;
    margin-bottom: 10px;
}
.step-replay-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 2px 5px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    line-height: 1;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
}
.step-replay-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.step-replay-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}
.step-batch-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 2px 5px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    line-height: 1;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
}
.step-batch-toggle:hover {
    border-color: var(--border-hover);
    color: var(--text-secondary);
}
.step-batch-toggle.active {
    background: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--accent);
}
.batch-connector {
    height: 8px;
    margin-left: 18px;
    border-left: 2px solid var(--accent);
    margin-bottom: 0;
}
.add-step-group {
    display: flex;
    gap: 8px;
}
.step-handle {
    cursor: grab;
    opacity: 0.4;
    user-select: none;
    touch-action: none;
}
.step-handle:active {
    cursor: grabbing;
}
.step-row.step-dragging {
    opacity: 0.9;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 4px 8px;
}
.step-drag-placeholder {
    border: 2px dashed var(--accent);
    border-radius: var(--radius-md);
    opacity: 0.4;
    margin-bottom: 6px;
}
.step-action-input {
    flex: 1;
}
.step-wait-input {
    width: 52px;
    text-align: center;
}

.kv-remove {
    background: none;
    border: 1px solid var(--border);
    color: var(--danger);
    cursor: pointer;
    padding: var(--sp-1) var(--sp-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    line-height: 1;
    transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

.kv-remove:hover {
    background: var(--danger-subtle);
    border-color: var(--danger);
}

.btn-sm {
    padding: var(--sp-1) var(--sp-3);
    font-size: var(--text-xs);
    margin-top: var(--sp-2);
}

.editor-error {
    color: var(--danger);
    font-size: var(--text-sm);
    min-height: 0;
    margin: var(--sp-1) 0;
    border-radius: var(--radius-sm);
    transition: padding var(--duration) var(--ease);
}

.editor-error:not(:empty) {
    background: var(--danger-subtle);
    border: 1px solid rgba(248, 81, 73, 0.3);
    padding: var(--sp-2) var(--sp-3);
}

.editor-actions {
    display: flex;
    gap: var(--sp-2);
    margin-top: var(--sp-3);
}

/* --- Logs Tab --- */
.logs-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp-3);
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.logs-filters {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

.logs-refresh {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
}

.filter-chip {
    padding: var(--sp-1) var(--sp-3);
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.filter-chip:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.filter-chip.active {
    background: var(--accent-subtle);
    color: var(--accent);
    border-color: rgba(56, 139, 253, 0.3);
}

.log-list {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
}

.log-entry {
    display: flex;
    gap: var(--sp-3);
    align-items: baseline;
    padding: var(--sp-2) var(--sp-3);
    border-bottom: 1px solid var(--border);
    font-size: var(--text-sm);
    font-family: var(--font-mono);
    transition: background var(--duration) var(--ease);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry:hover {
    background: var(--bg-tertiary);
}

.log-ts {
    color: var(--text-tertiary);
    white-space: nowrap;
    flex-shrink: 0;
    font-size: var(--text-xs);
}

.log-level {
    font-weight: 600;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.03em;
}

.log-level.INFO {
    background: var(--info-subtle);
    color: var(--accent);
}

.log-level.WARNING {
    background: var(--warning-subtle);
    color: var(--warning);
}

.log-level.ERROR {
    background: var(--danger-subtle);
    color: var(--danger);
}

.log-component {
    color: var(--text-tertiary);
    white-space: nowrap;
    flex-shrink: 0;
    font-size: var(--text-xs);
}

.log-message {
    word-break: break-word;
    color: var(--text-secondary);
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: var(--sp-6);
    right: var(--sp-6);
    padding: var(--sp-3) var(--sp-5);
    border-radius: var(--radius-lg);
    font-family: var(--font-ui);
    font-size: var(--text-sm);
    font-weight: 500;
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    transition: opacity 250ms var(--ease), transform 250ms var(--ease-spring);
    pointer-events: none;
    z-index: 100;
    border: 1px solid;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast.success {
    background: rgba(63, 185, 80, 0.15);
    color: var(--success);
    border-color: rgba(63, 185, 80, 0.3);
    box-shadow: 0 4px 16px rgba(63, 185, 80, 0.1);
}

.toast.error {
    background: rgba(248, 81, 73, 0.15);
    color: var(--danger);
    border-color: rgba(248, 81, 73, 0.3);
    box-shadow: 0 4px 16px rgba(248, 81, 73, 0.1);
}

.toast.info {
    background: rgba(56, 139, 253, 0.15);
    color: var(--accent);
    border-color: rgba(56, 139, 253, 0.3);
    box-shadow: 0 4px 16px rgba(56, 139, 253, 0.1);
}

/* --- Empty State --- */
.empty-state {
    color: var(--text-tertiary);
    font-size: var(--text-sm);
    padding: var(--sp-8) var(--sp-4);
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: var(--radius-xl);
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 10px,
        rgba(48, 54, 61, 0.15) 10px,
        rgba(48, 54, 61, 0.15) 11px
    );
}

/* --- Scrollbar (Webkit) --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

/* --- Settings Tab --- */
.settings-section {
    max-width: 600px;
}

.settings-title {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--sp-4);
    color: var(--text-primary);
}

.settings-status {
    display: flex;
    gap: var(--sp-3);
    margin-bottom: var(--sp-5);
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

.settings-field {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
}

.token-input-row {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
}

.token-input {
    flex: 1;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--sp-2) var(--sp-3);
    outline: none;
    transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.token-input:focus {
    border-color: var(--border-focus);
    box-shadow: var(--accent-glow);
}

.btn-icon {
    padding: var(--sp-2) var(--sp-2);
    min-width: 36px;
    text-align: center;
    font-size: var(--text-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

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

.token-expiry {
    font-size: var(--text-xs);
    margin-top: var(--sp-1);
}

.token-expiry.valid {
    color: var(--success);
}

.token-expiry.expiring {
    color: var(--warning);
}

.token-expiry.expired {
    color: var(--danger);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: var(--sp-1) var(--sp-3);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.status-badge.valid {
    background: var(--success-subtle);
    color: var(--success);
}

.status-badge.expiring {
    background: var(--warning-subtle);
    color: var(--warning);
}

.status-badge.expired {
    background: var(--danger-subtle);
    color: var(--danger);
}

.status-badge.unknown {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
}

.settings-actions {
    margin-top: var(--sp-2);
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}
.toggle-switch input { display: none; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-tertiary);
    border-radius: 26px;
    transition: background 0.2s;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* Config badge */
.heartbeat-times {
    display: flex;
    gap: var(--sp-4);
    margin-top: var(--sp-2);
}

.config-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
}
.config-badge.configured {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
}
.config-badge.not-configured {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

/* === Visual Polish === */

/* Header gradient accent */
.header-accent {
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent), var(--accent-2));
    background-size: 300% 100%;
    border-radius: 2px;
    margin-bottom: var(--sp-6);
    animation: accent-shift 8s ease infinite;
    box-shadow: 0 0 12px rgba(88, 166, 255, 0.2), 0 0 4px rgba(163, 113, 247, 0.15);
}

@keyframes accent-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Animated tab indicator */
.tab {
    position: relative;
}

.tab.active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: var(--sp-2);
    right: var(--sp-2);
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-radius: 2px 2px 0 0;
    animation: tab-slide 250ms var(--ease-spring);
    box-shadow: 0 0 8px rgba(88, 166, 255, 0.3);
}

@keyframes tab-slide {
    from { transform: scaleX(0); opacity: 0; }
    to { transform: scaleX(1); opacity: 1; }
}

/* Badge dot indicators */
.badge::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

.badge.passed::before { background: var(--success); }
.badge.failed::before { background: var(--danger); }
.badge.mixed::before { background: var(--warning); }
.badge.warning::before { background: var(--warning-alt); }

/* Icon button SVG alignment */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon svg {
    flex-shrink: 0;
}

/* --- Bottom Nav (mobile only) --- */
.bottom-nav {
    display: none;
}

.more-menu {
    display: none;
}

.drawer-toggle {
    display: none;
}

.drawer-backdrop {
    display: none;
}

.mobile-empty-state {
    display: none;
}

/* Hide editor fields when no suite selected (all screen sizes) */
.suite-editor.no-selection .mobile-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary);
    gap: 16px;
}

.suite-editor.no-selection .mobile-empty-state p {
    font-size: var(--text-base);
    margin: 0;
}

.suite-editor.no-selection #editor-header,
.suite-editor.no-selection #name-label,
.suite-editor.no-selection #suite-name,
.suite-editor.no-selection .schedule-controls,
.suite-editor.no-selection .field-label,
.suite-editor.no-selection #suite-phones,
.suite-editor.no-selection #phones-group,
.suite-editor.no-selection #suite-json,
.suite-editor.no-selection .test-form,
.suite-editor.no-selection #editor-error,
.suite-editor.no-selection .editor-actions {
    display: none;
}

/* === Mobile Responsive (max-width: 768px) === */
@media (max-width: 768px) {
    body {
        padding: var(--sp-3);
        padding-bottom: 72px;
    }

    .container {
        max-width: 100%;
    }

    /* Hide top tabs on mobile */
    .tabs {
        display: none;
    }

    /* Disable infinite animation on mobile */
    .header-accent {
        animation: none;
        background-size: 100% 100%;
    }

    /* Disable input transitions on mobile — many inputs cause scroll jank */
    input, select, textarea {
        transition: none !important;
    }

    /* --- Bottom Nav --- */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        border-top: 1px solid var(--border);
        padding: var(--sp-1) 0;
        padding-bottom: calc(var(--sp-1) + env(safe-area-inset-bottom, 0px));
        z-index: 200;
        justify-content: space-around;
        align-items: center;
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        background: none;
        border: none;
        color: var(--text-tertiary);
        font-family: var(--font-ui);
        font-size: 10px;
        font-weight: 500;
        padding: var(--sp-1) var(--sp-2);
        cursor: pointer;
        min-width: 56px;
        min-height: 44px;
        justify-content: center;
        transition: color var(--duration) var(--ease);
        -webkit-tap-highlight-color: transparent;
    }

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

    .bottom-nav-item svg {
        flex-shrink: 0;
    }

    /* --- More Menu Popover --- */
    .more-menu {
        display: flex;
        flex-direction: column;
        position: fixed;
        bottom: calc(60px + env(safe-area-inset-bottom, 0px));
        right: var(--sp-3);
        background: var(--bg-secondary);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        padding: var(--sp-2);
        z-index: 210;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
        min-width: 140px;
    }

    .more-menu.hidden {
        display: none;
    }

    .more-menu-item {
        display: flex;
        align-items: center;
        gap: var(--sp-2);
        padding: var(--sp-3) var(--sp-3);
        border: none;
        background: none;
        color: var(--text-secondary);
        font-family: var(--font-ui);
        font-size: var(--text-sm);
        font-weight: 500;
        cursor: pointer;
        border-radius: var(--radius-md);
        min-height: 44px;
        transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
        -webkit-tap-highlight-color: transparent;
    }

    .more-menu-item:hover,
    .more-menu-item.active {
        background: var(--accent-subtle);
        color: var(--accent);
    }

    /* --- Header compact --- */
    .app-header {
        margin-bottom: var(--sp-3);
        padding-bottom: var(--sp-3);
    }

    .app-header h1 {
        font-size: var(--text-lg);
    }

    .header-accent {
        margin-bottom: var(--sp-4);
    }

    /* --- Toast above bottom nav --- */
    .toast {
        left: var(--sp-3);
        right: var(--sp-3);
        bottom: calc(68px + env(safe-area-inset-bottom, 0px));
        text-align: center;
    }

    /* Hide custom scrollbar on mobile */
    ::-webkit-scrollbar {
        width: 0;
        height: 0;
    }

    /* --- Status Page Mobile --- */
    #suite-timeline-list {
        grid-template-columns: 1fr;
    }

    .status-hero {
        padding: var(--sp-5) var(--sp-4);
    }

    .status-hero-title {
        font-size: var(--text-md);
    }

    .timeline-card {
        padding: var(--sp-4);
    }

    .timeline-bar {
        height: 32px;
        border-radius: 8px;
        gap: 3px;
    }

    .timeline-segment {
        border-radius: 4px;
    }

    .timeline-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--sp-2);
    }

    .timeline-card-right {
        width: 100%;
        justify-content: space-between;
    }

    .status-chips {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: var(--sp-1);
    }

    .status-chips .filter-chip {
        flex-shrink: 0;
    }

    .detail-summary {
        flex-wrap: wrap;
    }

    .result-row {
        padding: var(--sp-2) var(--sp-3);
    }

    .result-row pre {
        font-size: var(--text-xs);
    }

    /* --- Drawer Toggle Button --- */
    .drawer-toggle {
        display: flex;
        align-items: center;
        gap: var(--sp-2);
        background: var(--bg-secondary);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: var(--sp-2) var(--sp-3);
        margin-bottom: var(--sp-3);
        color: var(--text-primary);
        font-family: var(--font-ui);
        font-size: var(--text-sm);
        font-weight: 600;
        cursor: pointer;
        min-height: 44px;
        width: 100%;
        text-align: left;
        -webkit-tap-highlight-color: transparent;
    }

    .drawer-toggle svg {
        flex-shrink: 0;
        color: var(--text-secondary);
    }

    #drawer-breadcrumb {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* --- Drawer Backdrop --- */
    .drawer-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 300;
        opacity: 0;
        transition: opacity 200ms var(--ease);
        pointer-events: none;
    }

    .drawer-backdrop.visible {
        opacity: 1;
        pointer-events: auto;
    }

    .drawer-backdrop.hidden {
        display: none;
    }

    /* --- Suite Layout: Drawer Mode --- */
    .suite-layout {
        flex-direction: column;
        gap: 0;
    }

    .suite-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 85vw;
        max-width: 340px;
        max-height: none;
        background: var(--bg-primary);
        border-right: 1px solid var(--border);
        z-index: 310;
        transform: translateX(-100%);
        transition: transform 250ms var(--ease);
        padding: var(--sp-4);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .suite-sidebar.drawer-open {
        transform: translateX(0);
    }

    .suite-editor {
        width: 100%;
    }

    /* Mobile empty state for Test Cases — only visible when no suite selected */
    .suite-editor.no-selection .mobile-empty-state {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 48px 24px;
        text-align: center;
        color: var(--text-secondary);
        gap: 16px;
    }

    .suite-editor.no-selection .mobile-empty-state p {
        font-size: var(--text-base);
        margin: 0;
    }

    .suite-editor.no-selection #editor-header,
    .suite-editor.no-selection #name-label,
    .suite-editor.no-selection #suite-name,
    .suite-editor.no-selection .schedule-controls,
    .suite-editor.no-selection .field-label,
    .suite-editor.no-selection #suite-phones,
    .suite-editor.no-selection #suite-json,
    .suite-editor.no-selection .test-form,
    .suite-editor.no-selection #editor-error,
    .suite-editor.no-selection .editor-actions {
        display: none;
    }

    /* Touch-friendly suite tree items */
    .suite-header {
        padding: 14px 16px;
        min-height: 44px;
    }

    .test-case-item {
        padding: 12px 16px;
        min-height: 44px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .suite-run-times {
        font-size: 0.75rem;
        padding: 4px 16px 6px 28px;
    }

    #suite-name {
        font-size: var(--text-base);
        min-height: 44px;
    }

    #suite-json {
        height: calc(100vh - 360px);
        min-height: 200px;
        font-size: var(--text-xs);
    }

    .form-row {
        flex-direction: column;
        gap: var(--sp-2);
    }

    #suite-phones {
        font-size: var(--text-xs);
    }

    .schedule-controls {
        flex-wrap: wrap;
    }

    /* --- Sticky Editor Actions --- */

    .editor-actions {
        position: fixed;
        bottom: calc(56px + env(safe-area-inset-bottom, 0px));
        left: 0;
        right: 0;
        display: flex;
        gap: var(--sp-2);
        padding: var(--sp-2) var(--sp-3);
        background: var(--bg-secondary);
        border-top: 1px solid var(--border);
        z-index: 150;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .editor-actions .btn {
        flex: 1 1 auto;
        min-width: 0;
        min-height: 44px;
        text-align: center;
        white-space: nowrap;
        font-size: var(--text-xs);
    }

    .editor-actions .btn:disabled {
        display: none;
    }

    /* Larger touch target for KV remove button */
    .kv-remove {
        min-width: 44px;
        min-height: 44px;
        font-size: var(--text-base);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .kv-row {
        gap: var(--sp-1);
    }

    .kv-row input {
        font-size: var(--text-xs);
    }

    /* --- Logs --- */
    .logs-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .logs-filters {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: var(--sp-1);
    }

    .filter-chip {
        flex-shrink: 0;
        min-height: 36px;
        display: flex;
        align-items: center;
    }

    .logs-refresh {
        width: 100%;
        justify-content: flex-end;
    }

    .log-entry {
        flex-wrap: wrap;
        padding: var(--sp-2);
        gap: var(--sp-1);
    }

    .log-ts {
        order: 3;
        margin-left: auto;
    }

    .log-level {
        order: 1;
    }

    .log-component {
        order: 2;
    }

    .log-message {
        order: 4;
        width: 100%;
        flex-basis: 100%;
        padding-top: var(--sp-1);
        font-size: var(--text-xs);
    }

    .log-list {
        max-height: 70vh;
    }

    /* --- Settings --- */
    .settings-section {
        max-width: 100%;
    }

    .settings-title {
        font-size: var(--text-md);
    }

    .token-input-row {
        flex-wrap: wrap;
    }

    .token-input-row .token-input {
        width: 100%;
        flex: 1 1 100%;
    }

    .token-input-row .btn-icon {
        flex: 0 0 auto;
        min-height: 44px;
        min-width: 44px;
    }

    .settings-status {
        flex-wrap: wrap;
    }

    /* General touch target minimum */
    .btn {
        min-height: 44px;
    }

    select,
    input[type="text"],
    input[type="date"],
    input[type="number"],
    input[type="password"] {
        min-height: 44px;
    }
}

/* Run timeline bar in detail view */
.run-timeline-bar {
    margin: 16px 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.run-timeline-bar .timeline-segment {
    min-width: 4px;
    flex: 1 0 4px;
}

/* Flash highlight when clicking a run segment */
@keyframes highlightFlash {
    0% { box-shadow: 0 0 0 2px var(--accent), 0 0 12px rgba(88, 166, 255, 0.3); }
    100% { box-shadow: none; }
}

.day-run-section.highlight-flash {
    animation: highlightFlash 1.5s ease-out;
}

/* --- Recorder buttons --- */
.btn-record {
    background: #e53935;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
}
.btn-record:hover:not(:disabled) { background: #c62828; }
.btn-record:disabled, .step-rerecord-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-warning { background: #f57c00; color: #fff; border: none; border-radius: 6px; padding: 6px 14px; cursor: pointer; font-size: 13px; }
.btn-warning:hover { background: #e65100; }

.recorder-status {
    font-size: 12px;
    color: #e53935;
    font-weight: 600;
    margin-left: 8px;
    animation: blink-status 1s step-end infinite;
}
@keyframes blink-status {
    50% { opacity: 0.5; }
}

.step-rerecord-btn {
    background: none;
    border: 1px solid #555;
    border-radius: 4px;
    color: #e53935;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    margin-left: 4px;
    opacity: 0.6;
    flex-shrink: 0;
}
.step-rerecord-btn:hover {
    opacity: 1;
    border-color: #e53935;
}

/* --- Import Modal --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--sp-6);
    max-width: 500px;
    width: 90%;
    color: var(--text-primary);
}
.modal-content h3 {
    margin: 0 0 var(--sp-4);
    color: #fff;
}
.modal-actions {
    display: flex;
    gap: var(--sp-2);
    justify-content: flex-end;
    margin-top: var(--sp-4);
}
.import-warning {
    background: var(--warning-subtle);
    border-left: 3px solid var(--warning);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin: var(--sp-2) 0;
    font-size: var(--text-sm);
}
.import-info {
    background: var(--success-subtle);
    border-left: 3px solid var(--success);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin: var(--sp-2) 0;
    font-size: var(--text-sm);
}
