:root {
  --bg: #f6f7fb; --panel: #fff; --ink: #0f172a; --muted: #64748b; --line: #e5e7eb;
  --brand: #4f46e5; --brand-2: #7c3aed; --brand-soft: #eef2ff;
  --ok: #10b981; --warn: #f59e0b; --bad: #ef4444; --side: #0b1020; --side-ink: #cbd5e1;
  --radius: 14px; --shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .right { margin-left: auto; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; transition: .15s; white-space: nowrap; }
.btn:hover { border-color: #c7cbd4; transform: translateY(-1px); }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border: 0; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .6; cursor: wait; transform: none; }
input, select, textarea { width: 100%; font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
label.f { display: block; margin-bottom: 12px; } label.f span { display: block; font-weight: 600; font-size: 12px; margin-bottom: 4px; color: #334155; }

/* switch */
.switch { position: relative; width: 40px; height: 22px; flex: none; cursor: pointer; }
.switch input { display: none; }
.switch i { position: absolute; inset: 0; background: #cbd5e1; border-radius: 99px; transition: .2s; }
.switch i::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(18px); }

/* layout */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.logo { display: flex; gap: 10px; align-items: center; font-weight: 800; font-size: 17px; color: #fff; padding: 4px 10px 18px; }
.logo b { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: linear-gradient(135deg, var(--brand), #ec4899); }
.nav a { display: flex; gap: 10px; align-items: center; color: var(--side-ink); padding: 8px 10px; border-radius: 9px; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(99,102,241,.22); color: #fff; }
.nav .sec { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 16px 10px 6px; }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: rgba(246,247,251,.85); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--line); }
.content { padding: 24px 28px 60px; max-width: 1280px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #f1f5f9; color: #334155; }
.pill.ok { background: #d1fae5; color: #065f46; } .pill.warn { background: #fef3c7; color: #92400e; } .pill.bad { background: #fee2e2; color: #991b1b; } .pill.brand { background: var(--brand-soft); color: var(--brand); }
.autopilot { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 99px; background: #fff; border: 1px solid var(--line); font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 4px rgba(16,185,129,.18); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(16,185,129,.05); } }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.click { cursor: pointer; transition: .15s; } .card.click:hover { transform: translateY(-2px); border-color: #c7d2fe; }
.stat .v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; } .stat .l { color: var(--muted); font-size: 12px; font-weight: 600; }
.bar { height: 8px; background: #eef0f4; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 99px; transition: width .6s; }
.mod-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex: none; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 8px; }
.chart div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.chart b { width: 100%; background: linear-gradient(180deg, var(--brand-2), var(--brand)); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.chart span { font-size: 10px; color: var(--muted); }

/* automation list */
.auto { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.auto:last-child { border-bottom: 0; }
.auto .t { font-weight: 700; }
.auto .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: top; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
tr.click { cursor: pointer; } tr.click:hover td { background: #fafbff; }

/* logs */
.log { font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; background: #0b1020; color: #cbd5e1; border-radius: 10px; padding: 10px 12px; margin-top: 8px; white-space: pre-wrap; }
.feed-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: 0; }
details summary { cursor: pointer; list-style: none; } details summary::-webkit-details-marker { display: none; }

/* modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 16px; width: min(560px, 100%); max-height: 90vh; overflow-y: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); max-width: 380px; animation: up .25s; }
.toast.err { background: #b91c1c; }
@keyframes up { from { transform: translateY(10px); opacity: 0; } }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 7px 12px; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-size: 13px; }
.tabs a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.empty { text-align: center; padding: 40px; color: var(--muted); }
code.inline { background: #f1f5f9; padding: 2px 6px; border-radius: 6px; font-size: 12px; word-break: break-all; }

/* landing */
.landing { min-height: 100vh; background: radial-gradient(1200px 600px at 10% -10%, #e0e7ff, transparent), radial-gradient(900px 500px at 100% 0%, #fce7f3, transparent), var(--bg); }
.land-nav { display: flex; align-items: center; padding: 20px 40px; max-width: 1200px; margin: auto; }
.land-nav .logo { color: var(--ink); padding: 0; }
.hero { max-width: 1200px; margin: auto; padding: 60px 40px 30px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.hero h1 { font-size: 52px; line-height: 1.05; letter-spacing: -.03em; }
.hero h1 em { font-style: normal; background: linear-gradient(135deg, var(--brand), #ec4899); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: 18px; color: #475569; max-width: 560px; }
.auth-card { background: #fff; border-radius: 20px; padding: 28px; box-shadow: 0 20px 60px rgba(79,70,229,.15); border: 1px solid var(--line); }
.section { max-width: 1200px; margin: auto; padding: 30px 40px 60px; }
.promo { max-width: 1000px; padding-top: 10px; padding-bottom: 20px; text-align: center; }
.promo-video { display: block; width: 100%; aspect-ratio: 16 / 9; margin-top: 14px; background: #000; border-radius: var(--radius); box-shadow: 0 20px 60px rgba(79,70,229,.2); }
.goal-pick { border: 2px solid var(--line); border-radius: 14px; padding: 16px; cursor: pointer; background: #fff; transition: .15s; }
.goal-pick.on { border-color: var(--brand); background: var(--brand-soft); }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 10; height: auto; padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
  .logo { padding: 0; font-size: 0; } .logo b { font-size: 16px; }
  .nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .nav a { white-space: nowrap; padding: 6px 10px; font-size: 13px; }
  .nav .sec { display: none; }
  .top { position: static; flex-wrap: wrap; }
  .toasts { left: 12px; right: 12px; }
  .hero { grid-template-columns: 1fr; padding: 30px 16px; } .hero h1 { font-size: 36px; }
  .content, .top { padding-left: 16px; padding-right: 16px; }
  .land-nav, .section { padding-left: 16px; padding-right: 16px; }
}
