:root[data-theme="dark"] {
    --bg: #0f1115;
    --surface: #1a1d24;
    --surface-2: #232732;
    --text: #e8e9ed;
    --text-muted: #9aa0ac;
    --accent: #4f8cff;
    --green: #3ecf8e;
    --red: #ef5b5b;
    --yellow: #e0a939;
    --border: #2c3038;
}

:root[data-theme="light"] {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #eef0f3;
    --text: #1a1d24;
    --text-muted: #5c6270;
    --accent: #2563eb;
    --green: #1a9d63;
    --red: #d33b3b;
    --yellow: #b5790a;
    --border: #dde1e6;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    padding-bottom: 72px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand { font-weight: 700; font-size: 1.1rem; }

.icon-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 6px;
    color: var(--text);
}

.content { padding: 16px; max-width: 640px; margin: 0 auto; }

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 10;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 0 10px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.6rem;
    min-width: 0;
}

.nav-item span {
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
}

.card h2 { margin-top: 0; font-size: 1rem; color: var(--text-muted); font-weight: 600; }

.big-number { font-size: 1.8rem; font-weight: 700; }

.btn {
    display: block;
    width: 100%;
    padding: 16px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    background: var(--accent);
    color: white;
    cursor: pointer;
    margin-bottom: 10px;
}

.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--red); color: white; }
.btn:disabled { opacity: 0.5; }

.input, select {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    margin-bottom: 12px;
}

label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 6px; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.success { background: rgba(62,207,142,0.15); color: var(--green); }
.badge.failed { background: rgba(239,91,91,0.15); color: var(--red); }
.badge.running { background: rgba(224,169,57,0.15); color: var(--yellow); }

.list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    gap: 10px;
}

.list-row:last-child { border-bottom: none; }

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

.row-actions { display: flex; gap: 8px; }
.row-actions .btn { width: auto; padding: 8px 12px; margin: 0; font-size: 0.85rem; }

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card { width: 100%; max-width: 360px; }

.error-box {
    background: rgba(239,91,91,0.12);
    color: var(--red);
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 0.9rem;
}

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters select { width: auto; flex: 1; min-width: 120px; margin-bottom: 0; }

pre.raw-data {
    background: var(--surface-2);
    padding: 12px;
    border-radius: 10px;
    overflow-x: auto;
    font-size: 0.75rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.spinner {
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}

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