/* No external font dependencies - using system fonts for better performance */

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

/* CSS Variables */
:root {
    /* Light theme colors */
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-surface-hover: #f1f5f9;
    --color-text: #0b0f19;
    --color-text-secondary: #475569;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-success: #16a34a;
    --color-error: #dc2626;
    --color-warning: #d97706;
    --color-info: #2563eb;
    --color-running: #2563eb;
    --color-idle: #d6a93a;
    --color-idle-bg: #fef6da;
    --color-idle-border: #fdeeb8;
    --color-idle-text: #8a6d1f;

    /* Spacing - 4/8/12/16/24/32/48 scale */
    --spacing-1: 4px;
    --spacing-2: 8px;
    --spacing-3: 12px;
    --spacing-4: 16px;
    --spacing-6: 24px;
    --spacing-8: 32px;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    
    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;

    /* Typography scale */
    --text-xs: 0.75rem;   /* 12px */
    --text-sm: 0.875rem;  /* 14px */
    --text-base: 1rem;    /* 16px */
    --text-lg: 1.125rem;  /* 18px */
    --text-xl: 1.25rem;   /* 20px */
    --text-2xl: 1.5rem;   /* 24px */

    /* Font weights */
    --font-regular: 400;
    --font-medium: 500;
    --font-semibold: 600;

    /* Border radius */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 50%;

    /* Shadows */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Transitions */
    --transition: all 0.2s ease;
}

/* Dark theme */
[data-theme="dark"] {
    --color-bg: #1a1a1a;
    --color-surface: #2a2a2a;
    --color-surface-hover: #333333;
    --color-text: #e0e0e0;
    --color-text-secondary: #b0b0b0;
    --color-text-muted: #888888;
    --color-border: #404040;
    --color-primary: #70a0ff;
    --color-primary-hover: #5080ff;
    --color-success: #4ade80;
    --color-error: #f87171;
    --color-warning: #fbbf24;
    --color-info: #60a5fa;
    --color-running: #60a5fa;
    --color-idle: #d6b24a;
    --color-idle-bg: #4a4128;
    --color-idle-border: #5a5038;
    --color-idle-text: #d6bd78;
}

/* Auto theme - follows system */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --color-bg: #1a1a1a;
        --color-surface: #2a2a2a;
        --color-surface-hover: #333333;
        --color-text: #e0e0e0;
        --color-text-secondary: #b0b0b0;
        --color-text-muted: #888888;
        --color-border: #404040;
        --color-primary: #70a0ff;
        --color-primary-hover: #5080ff;
        --color-success: #4ade80;
        --color-error: #f87171;
        --color-warning: #fbbf24;
        --color-info: #60a5fa;
        --color-running: #60a5fa;
        --color-idle: #d6b24a;
        --color-idle-bg: #4a4128;
        --color-idle-border: #5a5038;
        --color-idle-text: #d6bd78;
    }
}

/* Base styles */
html {
    font-size: 16px;
    height: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--font-regular);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
}

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
}

/* App container */
.app {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Header */
.header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-sm) var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.logo-icon {
    color: var(--color-primary);
}

.logo-text {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
}

.hostname-badge {
    font-size: var(--text-sm);
    font-weight: var(--font-normal);
    color: var(--color-text-secondary);
    padding: 2px 8px;
    margin-left: var(--spacing-3);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}

/* Neighbors selector dropdown */
.neighbors-selector {
    position: relative;
    display: inline-block;
    margin-left: var(--spacing-3);
}

.hostname-badge-clickable {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    font-family: inherit;
    margin-left: 0;
}

.hostname-badge-clickable:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.dropdown-arrow {
    opacity: 0.6;
    transition: transform 0.2s ease;
}

.neighbors-selector[open] .dropdown-arrow {
    transform: rotate(180deg);
}

.neighbors-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 180px;
    max-width: 300px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    overflow: hidden;
}

.neighbors-loading,
.neighbors-error {
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    text-align: center;
}

.neighbors-error {
    color: var(--color-error);
}

.neighbors-list {
    max-height: 300px;
    overflow-y: auto;
}

.neighbor-item {
    display: block;
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--color-text);
    text-decoration: none;
    font-size: var(--text-sm);
    transition: background-color 0.15s ease;
    border-bottom: 1px solid var(--color-border);
}

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

.neighbor-item:hover {
    background: var(--color-surface-hover);
    color: var(--color-primary);
}

.neighbor-item.current {
    background: var(--color-surface-hover);
    font-weight: var(--font-medium);
    color: var(--color-primary);
}

.header-controls {
    display: flex;
    gap: var(--spacing-sm);
}

.control-btn {
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: var(--spacing-sm);
    cursor: pointer;
    color: var(--color-text);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Search input */
.search-container {
    position: relative;
    width: 200px;
    margin-right: var(--spacing-sm);
}

.search-input {
    width: 100%;
    padding: 7px 14px 7px 36px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--color-text);
    transition: all 0.2s ease;
    outline: none;
}

.search-input::placeholder {
    color: var(--color-text-muted);
    opacity: 0.6;
}

.search-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--color-text-muted);
    pointer-events: none;
    opacity: 0.6;
}

/* Sort button with text */
.sort-button {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 6px 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    margin-right: var(--spacing-sm);
}

.sort-button:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sort-button:active {
    transform: translateY(0);
}

.sort-icon {
    flex-shrink: 0;
    opacity: 0.6;
}

.sort-label {
    white-space: nowrap;
    letter-spacing: 0.01em;
}

/* Filter button */
.filter-button {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 6px 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    margin-right: var(--spacing-sm);
    position: relative;
}

.filter-button:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.filter-button:active {
    transform: translateY(0);
}

.filter-icon {
    flex-shrink: 0;
    opacity: 0.6;
}

.filter-label {
    white-space: nowrap;
    letter-spacing: 0.01em;
}

/* Filter status indicator */
.filter-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 4px;
    display: inline-block;
}

.filter-indicator.running {
    background: var(--color-running);
}

.filter-indicator.success {
    background: var(--color-success);
}

.filter-indicator.failed {
    background: var(--color-error);
}

.filter-indicator.idle {
    background: var(--color-warning);
}

/* Main content */
.main-content {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-lg);
    width: 100%;
}

/* Dashboard */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* Stats bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-md);
}

.stat {
    background: var(--color-surface);
    padding: var(--spacing-md);
    border-radius: 12px;
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.stat-total {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-1);
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: var(--radius-md);
    background: none;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}

.stat-total:hover {
    background: var(--color-surface-hover);
}

.stat-total:focus-visible {
    outline: 2px solid var(--color-info);
    outline-offset: 1px;
}

.stat-total.active {
    background: color-mix(in srgb, var(--color-info) 14%, transparent);
}

.stat-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-semibold);
    color: var(--color-primary);
}

.stat-label {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    margin-top: var(--spacing-1);
}

.stat-breakdown {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-border);
}

.breakdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    position: relative;
    padding: var(--spacing-sm) var(--spacing-sm);
    border: none;
    border-radius: var(--radius-sm);
    background: none;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}

.breakdown-item + .breakdown-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    border-left: 1px solid var(--color-border);
}

.breakdown-item:hover {
    background: var(--color-surface-hover);
}

.breakdown-item:focus-visible {
    outline: 2px solid var(--color-info);
    outline-offset: 1px;
}

.breakdown-item.active {
    background: var(--color-surface-hover);
}

.breakdown-count {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.breakdown-label {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-secondary);
}

.breakdown-ok .breakdown-count {
    color: var(--color-success);
}

.breakdown-failed .breakdown-count {
    color: var(--color-error);
}

.breakdown-idle .breakdown-count {
    color: var(--color-warning);
}

.breakdown-item.active .breakdown-label {
    color: var(--color-text);
}

.breakdown-ok.active {
    background: color-mix(in srgb, var(--color-success) 16%, transparent);
}

.breakdown-failed.active {
    background: color-mix(in srgb, var(--color-error) 16%, transparent);
}

.breakdown-idle.active {
    background: color-mix(in srgb, var(--color-warning) 16%, transparent);
}


/* Jobs container */
.jobs-container {
    min-height: 200px;
}

/* Card view */
.jobs-container.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: var(--spacing-md);
}

.job-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-border);
    border-radius: 8px;
    padding: var(--spacing-4);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: var(--shadow-sm);
    contain: layout;
}

.job-card.job-disabled,
.job-row.job-disabled {
    opacity: 0.5;
}

.job-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Status accent stripes for cards */
.job-card[data-job-status="success"] {
    border-left-color: var(--color-success);
}

.job-card[data-job-status="failed"] {
    border-left-color: var(--color-error);
}

.job-card[data-job-status="running"] {
    border-left-color: var(--color-info);
}

.job-card[data-job-status="idle"] {
    border-left-color: var(--color-idle);
}

.job-status {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    z-index: 10;
}

.status-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.status-indicator.idle {
    background: var(--color-idle);
}

.status-indicator.running {
    background: var(--color-info);
}

.status-indicator.success {
    background: var(--color-success);
    color: white;
}

.status-indicator.failed {
    background: var(--color-error);
    color: white;
}

/* Pulse animation for running jobs */
.pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--color-info);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.job-header {
    display: grid;
    grid-template-columns: auto 1fr 56px;
    align-items: center;
    margin-bottom: var(--spacing-md);
    position: relative;
    z-index: 1;
    padding-right: 40px; /* Space for status icon */
    gap: 12px;
}

.job-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    width: 56px;
}

.job-schedule {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}

.job-description {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    margin-top: var(--spacing-xs);
}

.job-command {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    background: var(--color-bg);
    padding: var(--spacing-3);
    border-radius: 6px;
    margin: var(--spacing-3) 0;
}

.job-command code {
    color: var(--color-text);
    font-weight: var(--font-semibold);
    font-size: var(--text-base);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-timing {
    display: flex;
    justify-content: space-between;
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-border);
}

.timing-item {
    display: flex;
    flex-direction: column;
}

.timing-label {
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timing-value {
    color: var(--color-text);
    font-weight: var(--font-medium);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

.timing-value small {
    color: var(--color-text-secondary);
    font-weight: normal;
    font-size: 0.75rem;
}

/* List view */
.jobs-container.list {
    background: var(--color-surface);
    border-radius: 12px;
    border: 1px solid var(--color-border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.jobs-table {
    width: 100%;
    border-collapse: collapse;
}

/* Minimum column widths for stable layout */
.th-status, .td-status {
    min-width: 80px;
}

.th-schedule, .td-schedule {
    min-width: 140px;
}

.th-command, .td-command {
    min-width: 200px;
}

.td-command {
    display: flex;
    align-items: center;
    gap: 6px;
}

.th-next, .td-next {
    min-width: 140px;
    white-space: nowrap;
}

.th-last, .td-last {
    min-width: 120px;
    white-space: nowrap;
}

.th-actions, .td-actions {
    min-width: 90px;
}

.jobs-table thead {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.jobs-table th {
    padding: var(--spacing-2) var(--spacing-4);
    text-align: left;
    font-weight: var(--font-semibold);
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.jobs-table th.numeric {
    text-align: right;
}

.jobs-table th.cron {
    font-family: var(--font-mono);
    text-transform: none;
    letter-spacing: normal;
}

.jobs-table tbody tr {
    border-bottom: 1px solid var(--color-border);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.jobs-table tbody tr:hover {
    background: var(--color-surface-hover);
}

.jobs-table td {
    padding: var(--spacing-2) var(--spacing-4);
    font-size: var(--text-sm);
    line-height: 1.5;
}

.jobs-table td.numeric {
    text-align: right;
    font-family: var(--font-mono);
    font-weight: var(--font-medium);
}

.jobs-table td.command {
    font-weight: var(--font-semibold);
    color: var(--color-text);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1);
    padding: var(--spacing-1) var(--spacing-2);
    border-radius: 12px;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

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

.status-badge.idle {
    background: var(--color-idle-bg);
    color: var(--color-idle-text);
    border: 1px solid var(--color-idle-border);
}

.status-badge.idle .status-dot {
    background: var(--color-idle);
}

.status-badge.running {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    position: relative;
}

.status-badge.running .status-dot {
    background: #2563eb;
}

[data-theme="dark"] .status-badge.running {
    background: #2a4a80;
    color: #80b0ff;
    border: 1px solid #3a5a90;
}

[data-theme="dark"] .status-badge.running .status-dot {
    background: #70a0ff;
}

.status-badge.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.status-badge.success .status-dot {
    background: #16a34a;
}

[data-theme="dark"] .status-badge.success {
    background: #2a5a3a;
    color: #80e080;
    border: 1px solid #3a6a4a;
}

[data-theme="dark"] .status-badge.success .status-dot {
    background: #4ade80;
}

.status-badge.failed {
    background: #fecaca;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.status-badge.failed .status-dot {
    background: #dc2626;
}

[data-theme="dark"] .status-badge.failed {
    background: #6a3030;
    color: #ff9090;
    border: 1px solid #7a4040;
}

[data-theme="dark"] .status-badge.failed .status-dot {
    background: #f87171;
}

.pulse-small {
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    animation: pulse-small 2s infinite;
}

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

.schedule-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.schedule-code {
    color: var(--color-text);
    font-weight: 500;
}

.schedule-desc {
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

.command-text {
    color: var(--color-text-secondary);
    display: inline-block;
    max-width: clamp(240px, 40vw, 480px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.time-value {
    color: var(--color-text);
    line-height: 1.3;
    font-size: var(--text-sm);
}

.time-value small {
    color: var(--color-text-secondary);
    font-size: 0.75rem;
}

/* Icons */
.icon {
    color: var(--color-text-secondary);
    vertical-align: middle;
    flex-shrink: 0;
}


/* Footer */
.footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    line-height: 1;
    user-select: none;
    cursor: default;
}

.footer-link {
    color: var(--color-primary);
    text-decoration: none;
}

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

.separator {
    margin: 0 var(--spacing-sm);
    color: var(--color-text-muted);
}

.footer span[title] {
    cursor: help;
}

/* Info button */
.info-btn {
    background: transparent;
    border: 1px solid var(--color-border);
    padding: 4px;
    cursor: pointer;
    color: var(--color-text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    margin-right: 8px;
    vertical-align: middle;
}

.info-btn:hover {
    color: var(--color-text);
    background: var(--color-surface-hover);
    border-color: var(--color-text-secondary);
    transform: scale(1.1);
}

/* History button */
.history-btn {
    background: transparent;
    border: 1px solid var(--color-border);
    padding: 4px;
    cursor: pointer;
    color: var(--color-info);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    margin-right: 8px;
    vertical-align: middle;
}

.history-btn:hover {
    color: var(--color-primary);
    background: var(--color-surface-hover);
    border-color: var(--color-primary);
    transform: scale(1.1);
}

.history-btn:disabled {
    color: var(--color-text-muted);
    border-color: var(--color-border);
    cursor: not-allowed;
    opacity: 0.4;
}

.history-btn:disabled:hover {
    color: var(--color-text-muted);
    background: transparent;
    border-color: var(--color-border);
    transform: none;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(2px);
}

.modal-content {
    max-width: 70%;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.job-modal {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--color-border);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    margin: 0;
}

.modal-back {
    background: transparent;
    border: none;
    padding: var(--spacing-xs);
    cursor: pointer;
    color: var(--color-text-secondary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-back:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.modal-close {
    background: transparent;
    border: none;
    padding: var(--spacing-xs);
    cursor: pointer;
    color: var(--color-text-secondary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.modal-body {
    padding: var(--spacing-lg);
}

.modal-row {
    display: grid;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.modal-row:first-child {
    grid-template-columns: auto 1fr auto;
}

.modal-row:nth-child(2) {
    grid-template-columns: 1fr 1fr;
}

.modal-section {
    display: flex;
    flex-direction: column;
}

.modal-section-full {
    margin-top: var(--spacing-sm);
}

.logs-info-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
}

.logs-info-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.modal-label {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--spacing-xs);
}

.modal-value {
    color: var(--color-text);
    font-size: var(--text-base);
}

.modal-value code {
    background: var(--color-bg);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 4px;
    font-size: var(--text-sm);
    display: inline-block;
}

.modal-command code {
    display: block;
    padding: var(--spacing-md);
    white-space: pre-wrap;
    overflow-wrap: break-word;
    line-height: 1.5;
}

/* Settings modal */
.settings-modal {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--color-border);
}

.settings-modal .modal-body {
    padding: var(--spacing-md);
}

.settings-modal .modal-row {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.settings-modal .modal-section {
    gap: 2px;
}

.settings-modal .modal-label {
    font-size: var(--text-xs);
    margin-bottom: 2px;
}

.settings-modal .modal-value {
    font-size: var(--text-sm);
}

#settings-modal .modal-content {
    max-width: 900px;
}

.modal-section-header {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-xs);
    border-bottom: 1px solid var(--color-border);
}

.modal-section-header:first-child {
    margin-top: 0;
}

/* History modal */
.history-modal {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--color-border);
}

.history-table-container {
    margin-top: var(--spacing-lg);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.history-table thead {
    background: var(--color-surface);
    border-bottom: 2px solid var(--color-border);
}

.history-table th {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    font-weight: var(--font-semibold);
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.history-table tbody tr {
    border-bottom: 1px solid var(--color-border);
}

.history-table tbody tr:hover {
    background: var(--color-surface-hover);
}

.history-table td {
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--color-text);
}

.history-date {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    white-space: nowrap;
}

.history-duration {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.history-exit-code {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    text-align: center;
    color: var(--color-text-secondary);
}

.history-empty {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--color-text-muted);
}

.history-empty p {
    margin: 0;
    font-size: var(--text-base);
}

/* History row toggle */
.history-row-clickable {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.history-row-clickable:hover {
    background: var(--color-surface-hover) !important;
}

.history-row-clickable.history-row-selected {
    background: rgba(37, 99, 235, 0.1) !important;
}

[data-theme="dark"] .history-row-clickable.history-row-selected,
[data-theme="auto"] .history-row-clickable.history-row-selected {
    background: rgba(112, 160, 255, 0.1) !important;
}

.history-icon-cell {
    text-align: center;
    padding: var(--spacing-sm) var(--spacing-xs) !important;
}

.history-custom-icon {
    color: var(--color-primary);
    opacity: 0.7;
    display: inline-block;
    vertical-align: middle;
}

.history-row-clickable:hover .history-custom-icon {
    opacity: 1;
}

.history-command {
    transition: color 0.2s ease;
}

.history-command.showing-executed {
    color: var(--color-primary);
    font-weight: var(--font-medium);
}

/* Confirmation dialog */
.confirm-modal {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--color-border);
    width: min(90vw, 760px);
    max-width: 760px;
}

.confirm-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
}

.confirm-header h3 {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    margin: 0;
}

.confirm-body {
    padding: var(--spacing-lg);
}

.confirm-body p {
    color: var(--color-text);
    font-size: var(--text-base);
    line-height: 1.5;
    margin: 0;
    font-family: var(--font-mono);
    background: var(--color-bg);
    padding: var(--spacing-md);
    border-radius: 6px;
    white-space: pre-wrap;
    word-break: break-word;
}

.confirm-field {
    margin-bottom: var(--spacing-lg);
}

.confirm-field label {
    display: block;
    color: var(--color-text);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    margin-bottom: var(--spacing-xs);
}

.confirm-field textarea {
    width: 100%;
    padding: var(--spacing-sm);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    resize: vertical;
    min-height: 70px;
}

.confirm-field textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.confirm-field textarea[readonly] {
    background: var(--color-surface);
    color: var(--color-text-muted);
    cursor: default;
}

.confirm-field input[type="text"] {
    width: 100%;
    padding: var(--spacing-sm);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.confirm-field input[type="text"]:focus {
    outline: none;
    border-color: var(--color-primary);
}

.confirm-field small {
    display: block;
    margin-top: var(--spacing-xs);
    color: var(--color-text-muted);
    font-size: var(--text-xs);
}

.confirm-actions {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
}

.btn-cancel,
.btn-confirm {
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

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

.btn-cancel:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-text-secondary);
}

.btn-confirm {
    background: var(--color-primary);
    color: white;
}

.btn-confirm:hover {
    background: var(--color-primary-hover);
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl);
    color: var(--color-text-secondary);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: var(--spacing-md);
}

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

/* HTMX indicator */
.htmx-indicator { display: none; }
/* Show only for the element making the request or its adjacent spinner */
.htmx-indicator.htmx-request { display: inline-block; }
.btn-compact.htmx-request + .htmx-indicator { display: inline-block; }

/* Responsive design */
@media (max-width: 768px) {
    /* Header mobile fixes */
    .header-content {
        padding: var(--spacing-sm) var(--spacing-md);
        flex-direction: column;
        gap: var(--spacing-sm);
        align-items: stretch;
    }
    
    .logo {
        justify-content: center;
    }
    
    .logo-text {
        font-size: var(--text-lg);
    }
    
    .header-controls {
        justify-content: center;
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    
    .sort-button {
        flex: 1;
        min-width: 120px;
        justify-content: center;
        padding-top: 12px;
        padding-bottom: 12px;
    }
    
    .filter-button {
        flex: 1;
        min-width: 120px;
        justify-content: center;
        padding-top: 12px;
        padding-bottom: 12px;
    }
    
    .control-btn {
        min-width: 44px;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .search-container {
        width: 100%;
        flex-basis: 100%;
        margin-right: 0;
        margin-bottom: var(--spacing-sm);
    }

    /* Main content */
    .main-content {
        padding: var(--spacing-md);
    }
    
    /* Stats grid mobile - ultra compact single row */
    .stats-bar {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
        margin-bottom: 0px;
    }
    
    .stat {
        padding: 12px 8px;
        min-height: 60px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    .stat-value {
        font-size: 1.125rem;
        line-height: 1;
        font-weight: 600;
    }
    
    .stat-label {
        font-size: 0.6rem;
        margin-top: 2px;
        text-align: center;
        line-height: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    
    /* Cards view mobile */
    .jobs-container.cards {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
        padding: 0;
    }
    
    .job-card {
        margin: 0;
        max-width: none;
    }
    
    .job-timing {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .timing-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    /* List view mobile */
    .jobs-container.list {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .jobs-table {
        font-size: 0.875rem;
        min-width: 600px;
        white-space: nowrap;
    }
    
    .jobs-table th,
    .jobs-table td {
        padding: var(--spacing-2) var(--spacing-sm);
    }
    
    .th-last, .td-last {
        display: none;
    }
    
    .command-text {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* Better mobile typography */
    .job-schedule code,
    .job-command code {
        font-size: var(--text-sm);
        word-break: break-all;
        white-space: pre-wrap;
        overflow: visible;
        text-overflow: unset;
    }
    
    /* Status badges mobile */
    .status-badge {
        font-size: var(--text-xs);
        padding: 4px 8px;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .header-content {
        padding: var(--spacing-xs) var(--spacing-sm);
    }
    
    .main-content {
        padding: var(--spacing-sm);
    }
    
    .stats-bar {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }
    
    .stat {
        padding: 6px 4px;
        min-height: 40px;
    }
    
    .stat-value {
        font-size: 1rem;
        line-height: 1;
    }
    
    .stat-label {
        font-size: 0.5rem;
    }
    
    .logo-text {
        font-size: var(--text-base);
    }
    
    .sort-button {
        min-width: 100px;
    }
    
    .sort-label {
        font-size: var(--text-xs);
    }
    
    .jobs-table {
        min-width: 500px;
    }
    
    .command-text {
        max-width: 120px;
    }
}

/* Run Now button styles */
.btn-run-now {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--color-success);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.btn-run-now:hover:not(:disabled) {
    background: #15803d; /* darker green */
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.25);
}

.btn-run-now:active:not(:disabled) {
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.25);
}

.btn-run-now:disabled {
    background: var(--color-border);
    color: var(--color-text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-run-now.btn-small {
    padding: 3px 8px;
    font-size: 11px;
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
}

.btn-run-now.btn-small:hover:not(:disabled) {
    background: var(--color-surface-hover);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-run-now.btn-small:active:not(:disabled) {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.btn-run-now.btn-small:disabled {
    background: transparent;
    border-color: var(--color-border);
    color: var(--color-text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-run-now.btn-small .icon {
    width: 10px;
    height: 10px;
}

.btn-compact {
    padding: 3px 8px;
    font-size: 11px;
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 56px;
    height: 20px;
    transition: none !important;
}

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

.btn-compact:active:not(:disabled) {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.btn-compact:disabled {
    background: transparent;
    border-color: var(--color-border);
    color: var(--color-text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-toggle {
    padding: 3px 8px;
    font-size: 11px;
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.btn-toggle:hover {
    background: var(--color-surface-hover);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-toggle.btn-disabled-state {
    color: var(--color-text-muted);
    opacity: 0.5;
}

.btn-toggle.btn-disabled-state:hover {
    color: var(--color-primary);
    opacity: 1;
}

.btn-compact .icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.btn-run-now .icon {
    flex-shrink: 0;
}


/* Job actions in table */
.td-actions {
    white-space: nowrap;
    text-align: left;
    padding-left: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.th-actions {
    text-align: center;
    width: 100px;
}

/* Spinner for loading state */
.spinner-small {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-small.inline {
    vertical-align: middle;
    margin-right: 4px;
}

.htmx-request.btn-run-now {
    opacity: 0.6;
    pointer-events: none;
}

/* Logs UI */
.history-logs-cell {
    text-align: center;
}

.btn-logs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logs:hover {
    background: var(--hover-bg);
    border-color: var(--accent-color);
}

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

.logs-empty {
    color: var(--text-secondary);
    font-size: 14px;
}

.logs-output {
    margin-top: 8px;
    max-height: 500px;
    overflow: auto;
    background: var(--code-bg, #f5f5f5);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.logs-output pre {
    margin: 0;
    padding: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.logs-output code {
    font-family: inherit;
    color: var(--text-color);
}

.logs-empty-message {
    padding: 12px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

/* Dark theme adjustments for logs */
[data-theme="dark"] .logs-output {
    background: #1a1a1a;
}

[data-theme="dark"] .logs-output code {
    color: #e0e0e0;
}
