@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg:           #f0f5fb;
    --bg-2:         #e8f0f9;
    --surface:      #ffffff;
    --surface-2:    #f7fafd;
    --border:       #d0dcea;
    --border-dark:  #b8cde0;

    --text-1:       #0f1f35;
    --text-2:       #3a5472;
    --text-3:       #7a9ab8;

    --accent:       #2563eb;
    --accent-light: #dbeafe;
    --accent-dim:   rgba(37, 99, 235, 0.08);

    --success:      #059669;
    --success-bg:   #d1fae5;
    --success-border:#a7f3d0;

    --error:        #dc2626;
    --error-bg:     #fee2e2;
    --error-border: #fca5a5;

    --running:      #7c3aed;
    --running-bg:   #ede9fe;
    --running-border:#c4b5fd;

    --warning:      #d97706;

    --font-body:    'Inter', sans-serif;
    --font-mono:    'JetBrains Mono', monospace;

    --radius:       8px;
    --radius-sm:    5px;
    --shadow-sm:    0 1px 3px rgba(15, 31, 53, 0.08);
    --shadow:       0 2px 12px rgba(15, 31, 53, 0.10);
    --shadow-lg:    0 8px 32px rgba(15, 31, 53, 0.14);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text-1);
    line-height: 1.5;
    font-size: 14px;
    min-height: 100vh;
}

/* ── APP SHELL ───────────────────────────────────── */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── HEADER ──────────────────────────────────────── */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 52px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1rem;
}

.app-header-left {
    display: flex;
    align-items: center;
    gap: 0;
    height: 100%;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    padding-right: 1.25rem;
}

.logo-mark {
    width: 26px;
    height: 26px;
    background: var(--accent);
    color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0;
    flex-shrink: 0;
}

.logo-text {
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 2px;
    color: var(--text-1);
}

.header-divider {
    width: 1px;
    height: 22px;
    background: var(--border);
    margin-right: 0.25rem;
}

/* ── TABS ─────────────────────────────────────────── */
.app-tabs {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 0;
}

.app-tab {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0 1.1rem;
    height: 100%;
    color: var(--text-2);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.app-tab:hover { color: var(--accent); }

.app-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: var(--accent-dim);
}

/* ── HEADER RIGHT ─────────────────────────────────── */
.app-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-time {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-2);
    background: var(--bg-2);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.header-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: var(--success);
    background: var(--success-bg);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--success-border);
}

.status-dot-live {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 1.8s infinite;
    flex-shrink: 0;
}

.status-dot-live.small { width: 6px; height: 6px; }

.header-icon-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    color: var(--text-3);
    text-decoration: none;
    transition: all 0.15s;
    background: var(--surface);
}

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

/* ── MAIN ─────────────────────────────────────────── */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ── TOOLBAR ──────────────────────────────────────── */
.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    gap: 1rem;
    flex-wrap: wrap;
}

.toolbar-left { display: flex; align-items: center; gap: 0.75rem; }

.page-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-1);
}

.toolbar-date {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-3);
    background: var(--bg-2);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.overview-chips { display: flex; gap: 0.5rem; }

.overview-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    border: 1px solid;
}

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

.chip-failed {
    background: var(--error-bg);
    color: var(--error);
    border-color: var(--error-border);
}

.chip-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.chip-val {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 13px;
}

.refresh-info {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-3);
}

.btn-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    color: var(--text-2);
    background: var(--surface);
    cursor: pointer;
    transition: all 0.15s;
}

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

/* ── JOBS LAYOUT ──────────────────────────────────── */
.jobs-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    flex: 1;
    height: calc(100vh - 52px - 53px);
    overflow: hidden;
}

/* ── SIDEBAR ──────────────────────────────────────── */
.jobs-sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-section-label {
    padding: 0.75rem 1rem 0.4rem;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--text-3);
}

.job-list {
    list-style: none;
    flex: 1;
}

.job-list-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: background 0.1s, border-color 0.1s;
    border-bottom: 1px solid var(--bg-2);
}

.job-list-item:hover { background: var(--bg-2); }

.job-list-item.active {
    background: var(--accent-dim);
    border-left-color: var(--accent);
}

.job-list-item.skeleton {
    color: var(--text-3);
    font-size: 12px;
    cursor: default;
    animation: pulse 1.5s infinite;
}

.job-list-empty {
    padding: 1.5rem 1rem;
    color: var(--text-3);
    font-size: 12px;
    text-align: center;
}

.job-item-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.job-item-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-item-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 99px;
    flex-shrink: 0;
    letter-spacing: 0.3px;
}

.job-item-badge.success { background: var(--success-bg); color: var(--success); }
.job-item-badge.failed  { background: var(--error-bg);   color: var(--error);   }
.job-item-badge.running { background: var(--running-bg);  color: var(--running); }

.job-item-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-3);
}

.job-item-dur { color: var(--accent); }

/* ── DETAIL PANEL ─────────────────────────────────── */
.jobs-detail {
    overflow-y: auto;
    background: var(--bg);
    display: flex;
    flex-direction: column;
}

.detail-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--text-3);
    font-size: 13px;
}

.detail-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
}

.detail-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.detail-job-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-1);
}

.detail-meta-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.meta-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.6rem;
}

.meta-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-3);
}

.meta-val {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-1);
    font-weight: 500;
}

/* ── STATUS PILLS ─────────────────────────────────── */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    border: 1px solid;
}

.status-pill.success {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success-border);
}

.status-pill.failed {
    background: var(--error-bg);
    color: var(--error);
    border-color: var(--error-border);
    animation: errorPulse 2s infinite;
}

.status-pill.running {
    background: var(--running-bg);
    color: var(--running);
    border-color: var(--running-border);
}

.running-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 1s infinite;
    display: inline-block;
}

/* ── LOG TABLE ────────────────────────────────────── */
.log-table-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
}

.log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.log-table th {
    background: var(--bg-2);
    padding: 0.55rem 0.85rem;
    text-align: left;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-3);
    border-bottom: 1px solid var(--border);
}

.log-table td {
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid var(--bg-2);
    vertical-align: top;
}

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

.log-row { transition: background 0.1s; }
.log-row:hover { background: var(--bg-2); }
.log-row-error { background: #fff5f5; }
.log-row-error:hover { background: #fee2e2; }
.log-row-success { background: #f0fdf4; }
.log-row-success:hover { background: #dcfce7; }
.log-row-start { background: #f5f3ff; }
.log-row-start:hover { background: #ede9fe; }

.log-idx {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-3);
    width: 36px;
    text-align: right;
    padding-right: 1rem;
    user-select: none;
}

.log-msg {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-1);
    line-height: 1.6;
    word-break: break-all;
}

.log-empty {
    text-align: center;
    padding: 2.5rem;
    color: var(--text-3);
    font-style: italic;
}

/* ── DETAIL FOOTER ────────────────────────────────── */
.detail-footer {
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

.btn-secondary {
    background: var(--surface);
    border: 1px solid var(--border-dark);
    color: var(--text-2);
    padding: 0.45rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.15s;
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

/* ── MODAL ───────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 31, 53, 0.5);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 2rem;
}

.modal-content {
    background: var(--surface);
    width: 100%;
    max-width: 900px;
    max-height: 82vh;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn 0.18s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-header h3 { font-size: 14px; font-weight: 600; }

.modal-subtitle {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
    display: block;
    margin-top: 0.15rem;
}

pre {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-1);
    background: var(--bg-2);
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.8;
}

/* ── AUTH ─────────────────────────────────────────── */
.auth-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    animation: fadeUp 0.3s ease;
}

.auth-header { text-align: center; margin-bottom: 1.75rem; }

.auth-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-dim);
    border: 1px solid var(--accent-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    margin: 0 auto 1rem;
}

.auth-header h2 { font-size: 18px; font-weight: 600; margin-bottom: 0.25rem; }
.auth-header p  { font-size: 12px; color: var(--text-3); }

.auth-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error);
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 12px;
    margin-bottom: 1.25rem;
}

.auth-form { display: flex; flex-direction: column; gap: 1.1rem; }

.input-group { display: flex; flex-direction: column; gap: 0.4rem; }

.input-group label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-2);
}

.input-group input {
    background: var(--bg);
    border: 1px solid var(--border-dark);
    color: var(--text-1);
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}

.input-group input::placeholder { color: var(--text-3); }

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--accent);
    color: #fff;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.25);
    margin-top: 0.25rem;
    width: 100%;
}

.btn-primary:hover {
    background: #1d4ed8;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

/* ── HERO ─────────────────────────────────────────── */
.hero {
    padding: 5rem 2rem;
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.hero-tag {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--accent);
    opacity: 0;
    animation: fadeUp 0.4s 0.1s forwards;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -1px;
    opacity: 0;
    animation: fadeUp 0.4s 0.2s forwards;
}

.hero-accent { color: var(--accent); }

.hero-sub {
    font-size: 15px;
    color: var(--text-2);
    opacity: 0;
    animation: fadeUp 0.4s 0.3s forwards;
}

.hero .btn-primary {
    width: auto;
    align-self: flex-start;
    opacity: 0;
    animation: fadeUp 0.4s 0.4s forwards;
}

/* ── COMING SOON ──────────────────────────────────── */
.coming-soon-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.coming-soon-card {
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 3rem 4rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    animation: fadeUp 0.3s ease;
}

.coming-soon-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-dim);
    border: 1px solid var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.coming-soon-card h2 { font-size: 20px; font-weight: 600; }
.coming-soon-card p  { font-size: 13px; color: var(--text-2); max-width: 320px; }

.coming-soon-tag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--accent);
    background: var(--accent-dim);
    border: 1px solid var(--accent-light);
    padding: 0.3rem 0.85rem;
    border-radius: 99px;
    margin-top: 0.5rem;
}

/* ── ANIMATIONS ──────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes errorPulse {
    0%, 100% { box-shadow: none; }
    50%       { box-shadow: 0 0 8px rgba(220, 38, 38, 0.3); }
}

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

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.97) translateY(6px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}