:root {
    --bg: #0f172a;
    --panel: #111827;
    --panel2: #1f2937;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --line: #334155;
    --accent: #38bdf8;
    --ok: #10b981;
    --err: #ef4444;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar { background: #020617; border-right: 1px solid var(--line); padding: 24px 18px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 28px; }
.logo { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(135deg, #0ea5e9, #6366f1); font-weight: 800; }
.brand span { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
nav a { display: block; color: var(--muted); padding: 11px 12px; border-radius: 10px; margin: 4px 0; }
nav a.active, nav a:hover { background: var(--panel2); color: var(--text); }
.content { padding: 28px; max-width: 1280px; width: 100%; }
h1 { margin: 0 0 22px; font-size: 28px; }
h2 { margin: 0 0 16px; font-size: 19px; }
.card { background: rgba(17, 24, 39, 0.94); border: 1px solid var(--line); border-radius: 18px; padding: 20px; margin-bottom: 18px; box-shadow: 0 20px 50px rgba(0,0,0,0.22); }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat span { display: block; color: var(--muted); margin-bottom: 10px; }
.stat strong { font-size: 34px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.pill { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; color: var(--muted); font-size: 12px; }
.btn, button { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; background: var(--accent); color: #00111a; padding: 11px 16px; font-weight: 700; cursor: pointer; }
.btn.small { padding: 7px 10px; font-size: 13px; }
label { display: block; margin: 14px 0 7px; color: var(--muted); }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #020617; color: var(--text); padding: 12px 14px; outline: none; }
textarea { resize: vertical; }
pre, code { background: #020617; border: 1px solid var(--line); border-radius: 10px; padding: 2px 6px; color: #bae6fd; }
pre { padding: 14px; overflow-x: auto; }
.muted { color: var(--muted); }
.alert { padding: 12px 14px; border-radius: 12px; margin: 0 0 14px; }
.alert.ok { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.35); }
.alert.error { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.35); }
.login-wrap { min-height: calc(100vh - 56px); display: grid; place-items: center; }
.login-card { max-width: 440px; width: 100%; }
.chat-meta { display: flex; flex-wrap: wrap; gap: 16px; }
.chat-box { max-height: 65vh; overflow-y: auto; }
.message { padding: 14px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; background: #020617; }
.message.assistant { border-color: rgba(56,189,248,0.35); }
.message.user { border-color: rgba(255,255,255,0.16); }
.message.system { border-color: rgba(239,68,68,0.35); }
.message-head { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.message-head strong { color: var(--text); }
.message-head time { margin-left: auto; }
.message-body { white-space: normal; line-height: 1.55; }
@media (max-width: 860px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .content { padding: 18px; }
}

.form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.plan-editor { border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 16px 0; background: rgba(2,6,23,0.55); }
.inline-form { display: inline; }
.inline-form button { white-space: nowrap; }
.cmd-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.cmd-grid code { display: inline-block; padding: 8px 10px; }
@media (max-width: 1000px) {
    .form-grid { grid-template-columns: 1fr; }
}
.alert.bad, .alert.error { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.35); }
button.secondary { background: #475569; color: #e5e7eb; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
