/* app.css — agent.777.ee. Mobile-first, тема через CSS-переменные. */
:root {
    --bg: #0f1020;
    --surface: #1a1a2e;
    --surface-2: #232544;
    --text: #e8e8f0;
    --muted: #9a9ab5;
    --primary: #8b5cf6;
    --primary-d: #6d28d9;
    --ok: #34d399;
    --warn: #fbbf24;
    --err: #f87171;
    --border: #2c2e50;
    --radius: 14px;
    --tabbar-h: 60px;
}
html[data-theme="light"] {
    --bg: #f5f5fb; --surface: #ffffff; --surface-2: #f0f0fa;
    --text: #1a1a2e; --muted: #6b6b85; --border: #e3e3f0;
}
@media (prefers-color-scheme: light) {
    html:not([data-theme="dark"]) {
        --bg: #f5f5fb; --surface: #ffffff; --surface-2: #f0f0fa;
        --text: #1a1a2e; --muted: #6b6b85; --border: #e3e3f0;
    }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg); color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ── Топбар ── */
.topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding-top: max(12px, env(safe-area-inset-top));
}
.topbar-title { font-weight: 700; color: var(--primary); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user { color: var(--muted); font-size: 14px; }
.topbar-logout { color: var(--muted); text-decoration: none; font-size: 20px; }

/* ── Контент ── */
#app { padding: 16px; padding-bottom: calc(var(--tabbar-h) + 24px); max-width: 980px; margin: 0 auto; }
.loading { color: var(--muted); text-align: center; padding: 40px 0; }
h1, h2 { margin: 0 0 12px; }
h1 { font-size: 24px; }
h2 { font-size: 16px; }
.muted { color: var(--muted); }

.card, .panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; padding: 16px; margin-bottom: 14px;
}
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.kv:last-child { border-bottom: 0; }
.kv b { color: var(--muted); font-weight: 500; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; background: var(--surface-2); }
.badge.ok { color: var(--ok); } .badge.warn { color: var(--warn); } .badge.err { color: var(--err); }
.phase-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 8px; }
.phase-strip span {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface-2); color: var(--muted); font-size: 12px; text-align: center;
}
.task-row {
    display: flex; justify-content: space-between; gap: 16px; align-items: center;
    padding: 12px 14px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); color: var(--text); text-decoration: none;
}
.task-row div { min-width: 0; }
.task-row b, .task-row span { display: block; overflow-wrap: anywhere; }
.task-row span { margin-top: 4px; color: var(--muted); font-size: 13px; }
.task-title { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.task-title h2 { margin-bottom: 4px; overflow-wrap: anywhere; }
.timeline { display: grid; gap: 10px; }
.timeline-item {
    border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: var(--surface-2);
}
.timeline-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 6px; }
.event { margin-top: 6px; padding: 6px 8px; border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 12px; }
.artifact {
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2);
    padding: 0; margin-bottom: 10px; overflow: hidden;
}
.artifact summary {
    cursor: pointer; display: flex; justify-content: space-between; gap: 12px;
    padding: 10px 12px; color: var(--text);
}
.artifact summary span { color: var(--muted); font-size: 12px; }
pre, .code {
    margin: 0; padding: 12px; overflow: auto; max-height: 420px;
    background: #111426; color: var(--text); border-top: 1px solid var(--border);
    font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre-wrap; overflow-wrap: anywhere;
}

/* ── Таббар ── */
.tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
    display: flex; background: var(--surface); border-top: 1px solid var(--border);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; text-decoration: none; color: var(--muted); font-size: 20px;
}
.tabbar a span { font-size: 10px; }
.tabbar a.active { color: var(--primary); }

/* ── Кнопки/формы ── */
button, .btn {
    display: inline-block; width: 100%; padding: 12px 16px; border: 0; border-radius: 8px;
    background: var(--primary-d); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
    text-align: center; text-decoration: none;
}
button:active { background: var(--primary); }
button.danger { background: #b91c1c; margin-top: 12px; }
button:disabled { opacity: .6; cursor: wait; }
label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 14px; }
input, select, textarea {
    width: 100%; margin-top: 6px; padding: 11px 12px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 15px;
}
.checkline {
    display: flex; align-items: center; gap: 10px; padding: 8px 0;
}
.checkline input { width: auto; margin: 0; }
.checkline span { color: var(--text); }

/* ── Экраны входа/установки ── */
.auth-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
    width: 100%; max-width: 380px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 18px; padding: 28px;
}
.auth-logo { color: var(--primary); font-weight: 700; margin-bottom: 8px; }
.auth-card h1 { font-size: 20px; }
.auth-error { background: rgba(248,113,113,.12); color: var(--err); padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
