:root {
  color-scheme: dark;
  --bg: #070a11;
  --panel: #0d121e;
  --panel-2: #121a29;
  --line: #202c3f;
  --text: #f4f7fb;
  --muted: #8d9bb0;
  --blue: #66a3ff;
  --blue-strong: #3986ff;
  --green: #4bddad;
  --amber: #ffca6e;
  --red: #ff7d8c;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 80% -10%, #17315f55, transparent 38%), var(--bg); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { min-height: 20px; color: var(--red); }
.eyebrow { margin: 0 0 7px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .15em; }

.login-shell { min-height: 100vh; padding: 24px; display: grid; place-items: center; }
.login-card { width: min(420px, 100%); padding: 36px; border: 1px solid var(--line); border-radius: 26px; background: #0c111ce8; box-shadow: 0 30px 90px #0008; }
.brand-mark, .logo span { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 25px; color: #06101e; border-radius: 13px; background: linear-gradient(145deg, #91c2ff, #4d8fff); font-weight: 900; }
.login-card h1 { margin: 0; font-size: 38px; letter-spacing: -.05em; }
.login-card label { display: grid; gap: 8px; margin-top: 20px; color: #c6d0df; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; padding: 13px 14px; color: var(--text); border: 1px solid #27354b; border-radius: 12px; outline: none; background: #0a0f19; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #4b91ff22; }
textarea { min-height: 130px; resize: vertical; }
button { cursor: pointer; border: 0; }
.primary { padding: 12px 17px; color: white; border-radius: 12px; background: var(--blue-strong); font-weight: 800; }
.login-card .primary { width: 100%; margin-top: 25px; }
.ghost { padding: 10px 14px; color: #b5c1d1; border: 1px solid var(--line); border-radius: 11px; background: transparent; }
.danger { color: var(--red); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 220px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 18px; display: flex; flex-direction: column; border-right: 1px solid #172135; background: #080c14cc; backdrop-filter: blur(20px); }
.logo { display: flex; align-items: center; gap: 11px; color: white; text-decoration: none; font-size: 18px; }
.logo span { width: 34px; height: 34px; margin: 0; border-radius: 10px; }
.sidebar nav { margin-top: 42px; display: grid; gap: 6px; }
.sidebar nav a, .mobile-nav a { padding: 11px 13px; color: var(--muted); border-radius: 10px; text-decoration: none; font-size: 14px; font-weight: 700; }
.sidebar nav a.active, .sidebar nav a:hover { color: white; background: #172239; }
.sidebar > button { margin-top: auto; }
main { min-width: 0; }
.topbar { min-height: 106px; padding: 26px 34px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #172135; }
.topbar h1 { margin: 0; font-size: 27px; letter-spacing: -.04em; }
.agent-pill { padding: 9px 12px; display: flex; align-items: center; gap: 8px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; font-weight: 750; }
.agent-pill i { width: 7px; height: 7px; border-radius: 50%; background: #5d6878; }
.agent-pill.online { color: #baf5df; border-color: #245746; background: #10291f; }
.agent-pill.online i { background: var(--green); box-shadow: 0 0 12px var(--green); }
.page { padding: 28px 34px 70px; }
.grid { display: grid; gap: 16px; }
.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, #111827, #0b101a); box-shadow: 0 12px 35px #0002; }
.metric span { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric strong { margin-top: 8px; display: block; font-size: 32px; letter-spacing: -.05em; }
.section-head { margin: 28px 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-head h2 { margin: 0; font-size: 17px; }
.task-list { display: grid; gap: 10px; }
.task { padding: 16px 18px; display: grid; grid-template-columns: 1fr auto; gap: 10px 18px; border: 1px solid var(--line); border-radius: 14px; background: #0c121e; }
.task:hover { border-color: #344967; }
.task h3 { margin: 0; font-size: 15px; }
.task p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.badge { align-self: start; padding: 6px 9px; color: #b9c6d8; border: 1px solid #2a3a52; border-radius: 999px; background: #121b2b; font-size: 10px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.badge.running, .badge.claimed { color: #a9ceff; border-color: #2b5f9d; background: #10284b; }
.badge.completed { color: #baf5df; border-color: #245746; background: #10291f; }
.badge.needs_input, .badge.awaiting_approval { color: #ffe0a8; border-color: #725325; background: #2d210f; }
.badge.failed, .badge.cancelled { color: #ffc0c7; border-color: #74333c; background: #2c1318; }
.task-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.task-actions button { padding: 8px 10px; color: #c8d5e6; border: 1px solid #2a3a52; border-radius: 9px; background: #121a27; font-size: 12px; font-weight: 750; }
.empty { padding: 36px; color: var(--muted); border: 1px dashed #28364c; border-radius: var(--radius); text-align: center; }
.project-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.project-card h3 { margin: 0 0 7px; }
.project-card code { color: #9cc4ff; }
.agent-card { display: flex; align-items: center; justify-content: space-between; }
.agent-card h3 { margin: 0; }
.agent-card p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.form-grid { display: grid; gap: 15px; }
.form-grid label { display: grid; gap: 7px; color: #b9c5d5; font-size: 12px; font-weight: 750; }
.timeline { margin: 18px 0 0; padding: 0; list-style: none; }
.timeline li { position: relative; margin-left: 6px; padding: 0 0 17px 22px; border-left: 1px solid #28364c; }
.timeline li:before { content: ""; position: absolute; left: -4px; top: 2px; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.timeline small { display: block; margin-top: 5px; color: var(--muted); }
dialog { width: min(680px, calc(100% - 30px)); max-height: 88vh; padding: 0; color: var(--text); border: 1px solid #2b3a51; border-radius: 20px; background: #0e1522; box-shadow: 0 30px 100px #000c; }
dialog::backdrop { background: #03050ac4; backdrop-filter: blur(5px); }
dialog form { position: relative; padding: 26px; }
.dialog-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; color: var(--muted); border-radius: 10px; background: #172132; font-size: 23px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 10; max-width: 340px; padding: 12px 15px; color: white; border: 1px solid #35517a; border-radius: 12px; background: #13233d; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: none; }
.mobile-nav { display: none; }

@media (max-width: 850px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { min-height: 88px; padding: 20px 18px 14px; }
  .topbar h1 { font-size: 23px; }
  .agent-pill span { display: none; }
  .agent-pill { padding: 10px; }
  .page { padding: 18px 14px 90px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 16px; }
  .metric strong { font-size: 27px; }
  .mobile-nav { position: fixed; z-index: 5; left: 10px; right: 10px; bottom: 10px; padding: 7px; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid #26344a; border-radius: 16px; background: #0b111ceF; box-shadow: 0 15px 50px #0009; backdrop-filter: blur(20px); }
  .mobile-nav a { padding: 9px 4px; text-align: center; font-size: 11px; }
  .mobile-nav a.active { color: white; background: #18243a; }
  .task { grid-template-columns: 1fr; }
  .task .badge { justify-self: start; }
}

