*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0B0B14; --surface: #13131F; --surface2: #1A1A2A; --border: #26263A;
  --primary: #6D28D9; --primary-hover: #5B21B6; --accent: #F59E0B;
  --text: #E7E7F4; --muted: #8A8AA8; --green: #10b981; --red: #ef4444;
  --radius: 12px;
}
body { background: var(--bg); color: var(--text); font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; min-height: 100vh; line-height: 1.5; }
a { color: var(--primary); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Auth pages */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.auth .brand { margin-bottom: 32px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px 28px; width: 100%; max-width: 420px; }
.card h1 { font-size: 1.45rem; margin-bottom: 6px; }
.card .subtitle { color: var(--muted); font-size: .9rem; margin-bottom: 24px; }
.footer-link { text-align: center; margin-top: 20px; font-size: .875rem; color: var(--muted); }
.footer-link a { text-decoration: none; }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 800; font-size: 1.2rem; letter-spacing: -.3px; }
.brand img { height: 34px; width: auto; border-radius: 8px; }

/* Forms */
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
input, textarea, select { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font: inherit; font-size: .95rem; padding: 11px 13px; outline: none; margin-bottom: 16px; }
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); }
input[type=checkbox] { width: auto; margin: 0 8px 0 0; }
.check { display: flex; align-items: center; margin-bottom: 16px; color: var(--text); font-weight: 500; }
.field-help { color: var(--muted); font-size: .78rem; margin: -10px 0 14px; }
.btn { display: inline-block; width: 100%; background: var(--primary); color: #fff; border: none; border-radius: 8px; font: inherit; font-size: .95rem; font-weight: 700; padding: 12px; cursor: pointer; text-align: center; text-decoration: none; transition: background .2s; }
.btn:hover { background: var(--primary-hover); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { width: auto; padding: 7px 12px; font-size: .82rem; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface2); border-color: var(--primary); }
.btn-danger { background: transparent; border: 1px solid #7f2020; color: #fca5a5; }
.alert { border-radius: 8px; padding: 12px 14px; font-size: .875rem; margin-bottom: 16px; }
.alert-error { background: #3f1010; border: 1px solid #7f2020; color: #fca5a5; }
.alert-ok { background: #062a1d; border: 1px solid #14532d; color: #bbf7d0; }
.alert-warn { background: #2d1f05; border: 1px solid #78510f; color: #fde68a; }

/* App shell */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 236px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 22px 14px; z-index: 50; }
.sidebar .brand { margin: 0 8px 28px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: .92rem; border: 0; background: none; width: 100%; cursor: pointer; font: inherit; text-align: left; }
.nav-item:hover, .nav-item.active { background: var(--surface2); color: var(--text); }
.sidebar-footer { margin-top: auto; }
.user-pill { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: .8rem; margin-bottom: 8px; }
.user-pill .user-plan { color: var(--accent); text-transform: uppercase; font-size: .72rem; font-weight: 700; }
.main { margin-left: 236px; padding: 36px 40px; max-width: 1100px; }
.topbar { display: none; }
.page-title { font-size: 1.55rem; font-weight: 800; margin-bottom: 6px; }
.page-sub { color: var(--muted); margin-bottom: 28px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; }
.panel h2 { font-size: 1.05rem; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.badge { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .74rem; font-weight: 700; background: var(--surface2); border: 1px solid var(--border); }
.badge.done { color: #86efac; border-color: #14532d; }
.badge.failed { color: #fca5a5; border-color: #7f2020; }
.badge.running, .badge.pending, .badge.queued { color: #fde68a; border-color: #78510f; }
.credits-pill { display: inline-flex; gap: 6px; align-items: center; background: var(--surface2); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-weight: 700; }
.job { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; background: var(--surface2); }
.job-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.job-title { font-weight: 700; }
.job-output { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-top: 10px; font-size: .9rem; max-height: 260px; overflow: auto; }
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.progress { height: 6px; background: var(--bg); border-radius: 4px; overflow: hidden; margin-top: 10px; }
.progress > div { height: 100%; background: var(--primary); transition: width .4s; }
.gen-steps { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.gen-step { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.gen-step.current { color: var(--text); font-weight: 600; }
.gen-step.done { color: var(--text); }
.gen-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); display: inline-flex;
  align-items: center; justify-content: center; font-size: 12px; flex: none; box-sizing: border-box; }
.gen-step.done .gen-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.gen-step.current .gen-dot { border-color: var(--primary); border-top-color: transparent; animation: gen-spin .8s linear infinite; }
@keyframes gen-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .gen-step.current .gen-dot { animation: none; border-top-color: var(--primary); } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; }
.table-wrap { overflow-x: auto; }

/* Pricing */
.toggle { display: inline-flex; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 5px; margin-bottom: 24px; }
.toggle button { border: 0; background: transparent; color: var(--muted); border-radius: 999px; padding: 8px 16px; font: inherit; font-weight: 700; cursor: pointer; }
.toggle button.active { background: var(--primary); color: #fff; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.plan { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 22px; position: relative; display: flex; flex-direction: column; }
.plan.popular { border-color: var(--primary); }
.plan .tag { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; font-size: .72rem; font-weight: 700; padding: 3px 12px; border-radius: 20px; white-space: nowrap; }
.plan .name { text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-size: .8rem; font-weight: 700; }
.plan .price { font-size: 2.2rem; font-weight: 800; margin: 6px 0 2px; }
.plan .price span { font-size: .95rem; color: var(--muted); font-weight: 500; }
.plan ul { list-style: none; margin: 14px 0 22px; flex: 1; }
.plan li { padding: 4px 0; font-size: .9rem; }
.plan li::before { content: '✓ '; color: var(--green); font-weight: 700; }
.offer { background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 25%, transparent), color-mix(in srgb, var(--accent) 12%, transparent)); border: 1px solid var(--primary); border-radius: var(--radius); padding: 22px; margin-bottom: 24px; display: flex; justify-content: space-between; gap: 20px; align-items: center; flex-wrap: wrap; }

@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; padding: 20px 16px; }
  .topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 40; }
  .grid-2 { grid-template-columns: 1fr; }
}
.file-list { display: flex; flex-direction: column; gap: 6px; margin: -8px 0 12px; }
.file-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: .88rem; }
input[type=file] { padding: 9px; cursor: pointer; }
