:root {
  --paper: #fbfbfc;
  --surface: #ffffff;
  --surface-2: #f4f4f7;
  --ink: #15161a;
  --ink-2: #5d6068;
  --line: #e7e7ec;
  --line-2: #d8d8e0;
  --violet: #8a2be2;
  --violet-soft: #f3ebfd;
  --grad: linear-gradient(95deg, #e0218a 0%, #8a2be2 38%, #3a6ff0 70%, #16c79a 100%);
  --ok: #16a34a;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  height: 4px;
  background: var(--grad);
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

.center {
  text-align: center;
  padding: 80px 20px;
}

h1 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.01em;
  margin: 18px 0 4px;
  text-wrap: balance;
}

h2 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  font-size: 17px;
  margin: 0;
}

.sub {
  margin-top: 0;
}

.muted {
  color: var(--ink-2);
}

code {
  font-family: "Space Mono", monospace;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.85em;
}

/* header */
.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.head-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand {
  display: flex;
  align-items: center;
}

.pill {
  font-family: "Space Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ok);
  background: #eafaf0;
  border: 1px solid #cdeeda;
  padding: 3px 9px;
  border-radius: 999px;
}
.pill.paused {
  color: #b45309;
  background: #fdf3e7;
  border-color: #f2ddc0;
}

/* cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 16px 0;
}
.center-card {
  margin-top: 40px;
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.hint {
  color: var(--ink-2);
  font-size: 13px;
  text-align: right;
}

textarea,
select,
input {
  width: 100%;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 11px 12px;
}
textarea {
  resize: vertical;
  line-height: 1.55;
}
textarea:focus,
select:focus,
input:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-soft);
}

/* buttons */
button {
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
  padding: 10px 16px;
  border: 1px solid transparent;
  transition: filter 0.12s ease, background 0.12s ease;
}
.primary {
  background: var(--violet);
  color: #fff;
}
.primary:hover {
  filter: brightness(1.08);
}
.primary:disabled {
  background: var(--surface-2);
  color: var(--ink-2);
  cursor: not-allowed;
}
.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-2);
}
.ghost:hover {
  background: var(--surface-2);
}

/* mcp */
.mcp-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mcp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
}
.mcp-row .m-name {
  font-family: "Space Mono", monospace;
  font-size: 13px;
  font-weight: 700;
}
.mcp-row .m-url {
  font-family: "Space Mono", monospace;
  font-size: 12px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}
.mcp-row .m-del {
  color: #c02626;
  background: none;
  border: none;
  font-size: 13px;
  padding: 2px 6px;
}
.mcp-empty {
  color: var(--ink-2);
  font-size: 13px;
  font-style: italic;
}
.mcp-add {
  margin-top: 12px;
}
.mcp-add summary {
  cursor: pointer;
  color: var(--violet);
  font-weight: 600;
  font-size: 13px;
  list-style: none;
}
.mcp-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.mcp-form input:nth-child(2) {
  grid-column: 1 / 3;
}
.mcp-form button {
  grid-column: 1 / 3;
}

/* drive */
.drive-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.drive-title {
  font-weight: 600;
}
.note {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--ink-2);
  background: var(--violet-soft);
  border: 1px solid #e6d6fb;
  border-radius: 10px;
  padding: 10px 12px;
}
.drive-state.connected .drive-title::after {
  content: " ✓";
  color: var(--ok);
}

/* save bar */
.save-bar {
  position: sticky;
  bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 20px;
  box-shadow: 0 6px 24px rgba(21, 22, 26, 0.06);
}

.foot {
  text-align: center;
  color: var(--ink-2);
  font-size: 13px;
  margin-top: 32px;
}

@media (max-width: 520px) {
  .mcp-row .m-url {
    max-width: 140px;
  }
  .hint {
    display: none;
  }
}

.drive-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.drive-picker {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.drive-picker select {
  flex: 1;
}

/* drive browser */
.drive-browser {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.drive-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.crumb {
  background: none;
  border: none;
  color: var(--violet);
  font-weight: 600;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 6px;
}
.crumb:hover { background: var(--violet-soft); }
.crumb:last-of-type { color: var(--ink); }
.crumb-sep { color: var(--ink-2); }
.drive-folders {
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.folder-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 10px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink);
}
.folder-row:hover { background: var(--surface-2); }
.folder-ico { font-size: 15px; }
.folder-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-into { color: var(--ink-2); font-size: 18px; }
.drive-browser-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

/* usage card */
.usage-card {
  display: flex;
  align-items: center;
  gap: 20px;
}
.usage-item { display: flex; flex-direction: column; }
.usage-num {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.usage-num-sm {
  font-family: "Space Mono", monospace;
  font-size: 13px;
  font-weight: 700;
}
.usage-lbl {
  font-size: 12px;
  color: var(--ink-2);
  text-transform: lowercase;
}
.usage-sep {
  width: 1px;
  align-self: stretch;
  background: var(--line);
}
.usage-model {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* onboarding: telegram connect */
.tg-card { border-color: var(--violet); }
.tg-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-link {
  display: inline-block;
  text-decoration: none;
  text-align: center;
}

/* add member */
.member-add { display: flex; gap: 8px; margin-top: 12px; }
.member-add input { flex: 1; }
#member-link code { word-break: break-all; }

/* mail panel actions */
.mail-actions { display: flex; gap: 8px; margin-top: 12px; align-items: center; }

/* the hidden attribute must win over explicit display rules (usage-card, save-bar) */
[hidden] { display: none !important; }

/* --- Landing --- */
.landing-nav {
  max-width: 1000px;
  margin: 0 auto;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-actions { display: flex; gap: 10px; }
.hero {
  max-width: 820px;
  margin: 0 auto;
  padding: 56px 24px 40px;
  text-align: center;
}
.hero-eyebrow {
  font-family: "Space Mono", monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--violet);
  margin-bottom: 20px;
}
.hero-title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  text-wrap: balance;
}
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 620px;
  margin: 0 auto 30px;
}
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.big { font-size: 16px; padding: 14px 26px; border-radius: 12px; }
.features {
  max-width: 1000px;
  margin: 20px auto 0;
  padding: 0 24px 60px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.feature {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.feature-ico { font-size: 26px; margin-bottom: 10px; }
.feature h3 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  font-size: 18px;
  margin: 0 0 6px;
}
.feature p { color: var(--ink-2); font-size: 14px; line-height: 1.5; margin: 0; }
@media (max-width: 640px) {
  .features { grid-template-columns: 1fr; }
}

/* --- Auth --- */
.auth-brand { justify-content: center; margin-top: 40px; }
.auth-card { max-width: 400px; margin: 24px auto 0; display: flex; flex-direction: column; gap: 12px; }
.auth-card h1 { text-align: center; margin: 0 0 6px; }
.auth-card input { font-size: 15px; padding: 12px 14px; }
.auth-error {
  background: #fdecec;
  border: 1px solid #f4c9c9;
  color: #b02525;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}
.auth-switch { text-align: center; font-size: 13px; color: var(--ink-2); margin: 4px 0 0; }
.auth-switch a { color: var(--violet); font-weight: 600; text-decoration: none; }

/* wallet balance badge */
.wallet {
  font-family: "Space Mono", monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--ok);
  background: #eafaf0;
  border: 1px solid #cdeeda;
  padding: 3px 10px;
  border-radius: 999px;
}
.wallet.empty { color: #b02525; background: #fdecec; border-color: #f4c9c9; }
.month-spend {
  font-family: "Space Mono", monospace;
  font-size: 11px;
  color: var(--ink-2);
}

/* Vasudev wordmark: "Vasu" ink, "dev" in the gradient */
.brand-mark { color: var(--ink); background: none; -webkit-text-fill-color: currentColor; }
.brand-dev {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* header with a back button */
.head-left { display: flex; align-items: center; gap: 12px; }

/* bots list */
.bots-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.bot-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.bot-name { font-family: "Space Grotesk", sans-serif; font-weight: 500; font-size: 18px; }
.bot-meta { color: var(--ink-2); font-size: 13px; margin-top: 2px; }

/* Telegram-bot setup card */
.tg-steps { margin: 4px 0 14px; padding-left: 20px; color: var(--ink-2); line-height: 1.7; }
.tg-steps code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-family: "Space Mono", monospace; font-size: 12px; color: var(--ink); }
.tg-bot-status { display: flex; align-items: center; gap: 12px; }
.tg-bot-status .tg-check {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: #16C79A; color: #fff; font-weight: 700;
}
.tg-bot-title { font-weight: 600; }
.tg-bot-status > div:nth-child(2) { flex: 1; }
.tg-bot-status .ghost { flex: none; }
.note.ok { color: #0a7d5a; }
.note.bad { color: #c0392b; }

/* ============ Dashboard: sidebar + panels ============ */
.dash-shell { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  width: 240px; flex: none; box-sizing: border-box;
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh;
}
.side-top { display: flex; flex-direction: column; gap: 12px; }
.side-back {
  background: none; border: none; color: var(--ink-2); text-align: left;
  cursor: pointer; font: inherit; font-size: 13px; padding: 0;
}
.side-back:hover { color: var(--ink); }
.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  text-align: left; background: none; border: none; padding: 10px 12px;
  border-radius: 9px; cursor: pointer; color: var(--ink-2);
  font: 500 14px/1.2 "Inter", sans-serif;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.is-active { background: var(--violet-soft); color: var(--ink); box-shadow: inset 3px 0 0 var(--violet); }
.side-foot { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

.dash-main { flex: 1; min-width: 0; padding: 30px 40px; max-width: 920px; }
.dash-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.dash-head h1 { margin: 0; }
.issue-badge {
  background: #fdecea; color: #c0392b; border: 1px solid #f5c6cb;
  border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.issue-badge:hover { background: #fbdcd8; }

.panel { display: flex; flex-direction: column; gap: 16px; }
.panel-head h2 { margin: 0 0 2px; }
.panel-tools { display: flex; gap: 14px; align-items: center; }
.check { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.sub-h { font-family: "Space Grotesk", sans-serif; font-size: 15px; margin: 6px 0 0; }

/* stat cards */
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 20px; min-width: 130px; flex: 1;
}
.stat-num { display: block; font-family: "Space Grotesk", sans-serif; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-lbl { color: var(--ink-2); font-size: 12px; }
.tag { font-size: 10px; background: var(--surface-2); color: var(--ink-2); padding: 1px 6px; border-radius: 6px; vertical-align: middle; }

/* messages / logs */
.msg-list { display: flex; flex-direction: column; gap: 10px; }
.msg { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.msg-error { border-color: #f0c2c2; background: #fdf4f3; }
.msg-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; margin-bottom: 6px; }
.msg-who { font-weight: 600; color: var(--ink); }
.msg-meta { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.msg-user { font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.msg-bot { font-size: 14px; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; margin-top: 6px; border-left: 2px solid var(--line); padding-left: 10px; }
.msg-err { color: #c0392b; font: 400 13px/1.4 "Space Mono", monospace; margin-top: 6px; word-break: break-word; }

@media (max-width: 720px) {
  .dash-shell { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .dash-main { padding: 22px 18px; }
}

/* Drive picker: create-folder row */
.drive-mkdir { display: flex; gap: 8px; margin: 10px 0 4px; }
.drive-mkdir input { flex: 1; }

/* small/danger button modifiers */
.small { font-size: 12px; padding: 5px 11px; border-radius: 8px; }
.ghost.danger { color: #c02626; border-color: #f4c9c9; }
.ghost.danger:hover { background: #fdecec; }

/* skills panel */
.skill-card { padding: 0; }
.skill-card summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding: 16px 18px; cursor: pointer; list-style: none;
}
.skill-card summary::-webkit-details-marker { display: none; }
.skill-card[open] summary { border-bottom: 1px solid var(--line); }
.skill-meta { margin-left: auto; font-size: 12px; }
.skill-actions { display: flex; gap: 6px; }
.skill-body-wrap { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.skill-body-wrap textarea { width: 100%; }
.skill-sched-label { display: flex; flex-direction: column; gap: 4px; width: 100%; font-size: 12px; color: var(--ink-2); }
.skill-body {
  white-space: pre-wrap; word-break: break-word; margin: 0;
  font-family: "Space Mono", monospace; font-size: 13px; color: var(--ink-2);
}
