/* Synucleo — warm charcoal + single amber accent. Deliberately avoids the
   generic violet/teal gradient look. */
:root {
  --bg: #0e0f12;
  --bg-elev: #16181d;
  --bg-elev2: #1d2027;
  --sidebar: #121317;
  --border: #292d36;
  --border-soft: #21242b;
  --text: #e9ebef;
  --muted: #868d9b;
  --accent: #e0a24a;         /* amber — the one confident color */
  --accent-ink: #201603;     /* text on amber */
  --accent-dim: rgba(224,162,74,.14);
  --ok: #63c08e;
  --danger: #e06a60;
  --radius: 10px;
  --shadow: 0 16px 50px rgba(0,0,0,.45);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  --sans: "Söhne", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv02","cv03","cv04";
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; cursor: pointer; border: none; border-radius: 8px; font-weight: 600; transition: filter .15s, background .15s, border-color .15s; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: not-allowed; }

.btn { background: var(--accent); color: var(--accent-ink); padding: 10px 17px; font-size: 14px; letter-spacing: .01em; }
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.ghost:hover { background: var(--bg-elev2); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.danger { background: transparent; border: 1px solid rgba(224,106,96,.5); color: var(--danger); }
.btn.danger:hover { background: rgba(224,106,96,.1); }
.btn.success { background: var(--ok); color: #04160d; }
.btn.block { width: 100%; }

input, textarea, select {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 10px 12px; font-size: 14px; font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim);
}
textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 6px; font-weight: 600; letter-spacing: .01em; }
.field { margin-bottom: 15px; }

.card { background: var(--bg-elev); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid { display: grid; gap: 15px; }
.center { text-align: center; }
.mt { margin-top: 15px; } .mb { margin-bottom: 15px; }

.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-elev2); border: 1px solid var(--border); padding: 3px 9px; border-radius: 6px; font-size: 12px; color: var(--muted); }
.tag { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.tag.new { background: var(--accent-dim); color: var(--accent); }
.tag.drafted { background: rgba(99,192,142,.14); color: var(--ok); }
.tag.pending { background: rgba(134,141,155,.14); color: var(--muted); }
.tag.contacted, .tag.submitted, .tag.applying, .tag.human_required { background: var(--accent-dim); color: var(--accent); }
.tag.applying { display: inline-flex; align-items: center; gap: 5px; }
.tag.replied, .tag.applied { background: rgba(99,192,142,.18); color: var(--ok); }
.tag.failed { background: rgba(224,106,96,.15); color: var(--danger); }

/* ---------- Sidebar layout (authed) ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex-shrink: 0; background: var(--sidebar); border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 18px 20px; border-bottom: 1px solid var(--border-soft); }
.side-brand .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.side-brand h1 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.side-brand p { margin: 1px 0 0; font-size: 11px; color: var(--muted); }
.side-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.side-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px;
  color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; margin-bottom: 2px;
  border-left: 2px solid transparent;
}
.side-link:hover { color: var(--text); background: var(--bg-elev); text-decoration: none; }
.side-link.active { color: var(--text); background: var(--bg-elev); border-left-color: var(--accent); }
.side-link svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; flex-shrink: 0; }
.side-user { padding: 12px; border-top: 1px solid var(--border-soft); }
.side-credits { display: flex; align-items: center; justify-content: space-between; padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.side-credits .n { color: var(--accent); }
.side-account { display: flex; align-items: center; gap: 9px; }
.side-account .av { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-dim); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; }

.main { flex: 1; min-width: 0; }
.main-inner { max-width: 1040px; margin: 0 auto; padding: 30px 30px 70px; }
.page-title { font-size: 25px; font-weight: 700; margin: 0 0 3px; letter-spacing: -.02em; }
.page-sub { color: var(--muted); margin: 0 0 24px; font-size: 14.5px; }

/* mobile top bar for the shell */
.mobile-bar { display: none; }
@media (max-width: 820px) {
  .sidebar { position: fixed; z-index: 60; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); position: sticky; top: 0; background: var(--bg); z-index: 30; }
  .mobile-bar .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; }
  .main-inner { padding: 20px 18px 60px; }
  .backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 55; }
}

/* ---------- Stats / cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 14px; }
.stat .n { font-size: 27px; font-weight: 700; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.auto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px,1fr)); gap: 14px; }
.auto-card { cursor: pointer; transition: border-color .15s, transform .1s; }
.auto-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.auto-card .icn { font-size: 22px; margin-bottom: 9px; opacity: .9; }
.auto-card h3 { margin: 0 0 6px; font-size: 15.5px; font-weight: 700; }

.list-item { background: var(--bg-elev); border: 1px solid var(--border-soft); border-radius: 10px; padding: 15px; margin-bottom: 11px; }
.score { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 9px; font-weight: 700; font-size: 14px; background: var(--bg-elev2); border: 1px solid var(--border); }
.score.hi { color: var(--ok); border-color: rgba(99,192,142,.4); }
.score.mid { color: var(--accent); border-color: rgba(224,162,74,.4); }

.msgbox { background: var(--bg); border: 1px solid var(--border-soft); border-radius: 9px; padding: 12px; white-space: pre-wrap; font-size: 13px; line-height: 1.55; max-height: 260px; overflow-y: auto; }

/* live browser automation view */
.live-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; }
.live-screen { background: #000; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; aspect-ratio: 1366/768; display: grid; place-items: center; }
.live-screen img { width: 100%; height: 100%; object-fit: contain; display: block; }
.live-empty { color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: center; }
.live-console { background: var(--bg); border: 1px solid var(--border-soft); border-radius: 9px; padding: 11px; font-family: var(--mono); font-size: 12px; line-height: 1.5; color: var(--ok); height: 100%; max-height: 320px; overflow-y: auto; }
.live-console div { margin-bottom: 3px; word-break: break-word; }
@media (max-width: 720px) { .live-grid { grid-template-columns: 1fr; } }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.62); display: grid; place-items: center; z-index: 80; padding: 20px; }
.modal { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--bg-elev2); border: 1px solid var(--border); padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); z-index: 100; font-size: 14px; max-width: 90%; }
.toast.err { border-color: var(--danger); }
.toast.ok { border-color: var(--ok); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--border-soft); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Public landing ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 30px; border-bottom: 1px solid var(--border-soft); position: sticky; top: 0; background: rgba(14,15,18,.85); backdrop-filter: blur(10px); z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: 17px; }
.shell { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 28px 24px 60px; }
.hero { text-align: center; padding: 88px 20px 44px; max-width: 760px; margin: 0 auto; }
.hero h1 { font-size: clamp(36px, 6vw, 60px); font-weight: 800; line-height: 1.03; margin: 0 0 20px; letter-spacing: -.03em; }
.hero h1 .grad { color: var(--accent); }
.hero p { font-size: 18px; color: var(--muted); max-width: 600px; margin: 0 auto 30px; line-height: 1.55; }
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px,1fr)); gap: 16px; margin-top: 44px; }

.credits-chip { display: flex; align-items: center; gap: 7px; background: var(--accent-dim); border: 1px solid var(--border); padding: 6px 12px; border-radius: 8px; font-weight: 700; font-size: 14px; color: var(--accent); }

.spinner { width: 17px; height: 17px; border: 2px solid rgba(255,255,255,.2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-full { min-height: 60vh; display: grid; place-items: center; }

code { font-family: var(--mono); font-size: 12px; background: var(--bg-elev2); padding: 1px 6px; border-radius: 5px; }
