/* Tavsin Web — Vibe Coding workspace. Framework-free, dark, enterprise-clean. */
:root {
  --bg: #07090e;
  --bg-2: #0c1018;
  --surface: #11151f;
  --surface-2: #161b27;
  --border: #232a39;
  --border-2: #2c3445;
  --text: #f1f4fa;
  --muted: #aeb6c6;
  --faint: #828ca0;
  --sky: #38bdf8;
  --emerald: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(1200px 600px at 72% -12%, #122036 0%, transparent 55%), var(--bg);
  color: var(--text);
  font: 14px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#app { display: flex; flex-direction: column; height: 100vh; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ── topbar ── */
.topbar { display: flex; align-items: center; gap: 12px; height: 54px; padding: 0 16px; flex: 0 0 auto; border-bottom: 1px solid var(--border); background: rgba(10,13,20,0.72); backdrop-filter: blur(12px); z-index: 5; }
.brand { display: flex; align-items: center; gap: 9px; }
.logo { display: grid; place-items: center; height: 27px; width: 27px; border-radius: 9px; background: linear-gradient(135deg, #0ea5e9, #0369a1); font-size: 15px; box-shadow: 0 0 0 1px rgba(255,255,255,0.08); }
.brand-name { font-weight: 800; letter-spacing: 0.18em; font-size: 14px; }
.brand-sub { color: var(--muted); font-size: 12px; padding-left: 8px; border-left: 1px solid var(--border); }
.spacer { flex: 1 1 auto; }

.pill { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 6px 12px; font-size: 12px; cursor: pointer; transition: background .15s, border-color .15s; }
.pill:hover { background: var(--surface-2); }
.pill-user .avatar { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: linear-gradient(135deg, #0ea5e9, #0369a1); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; flex: 0 0 auto; }
.pill-user .tier { font-size: 10px; padding: 2px 6px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.pill-tier-pro .tier { border-color: rgba(56,189,248,.4); background: rgba(56,189,248,.10); color: #bfe7fb; }
.pill-tier-team .tier { border-color: rgba(168,85,247,.4); background: rgba(168,85,247,.10); color: #e9d5ff; }
.pill-tier-enterprise .tier { border-color: rgba(251,191,36,.4); background: rgba(251,191,36,.10); color: #fde68a; }
.pill-upgrade { background: linear-gradient(135deg, #0ea5e9, #0369a1); color: #fff; border-color: transparent; font-weight: 600; box-shadow: 0 4px 14px rgba(2,132,199,.35); }
.pill-upgrade:hover { background: linear-gradient(135deg, #38bdf8, #0284c7); box-shadow: 0 6px 20px rgba(2,132,199,.5); }
.pill .dot { height: 8px; width: 8px; border-radius: 50%; background: var(--muted); }
.pill-ok .dot { background: var(--emerald); box-shadow: 0 0 8px var(--emerald); }
.pill-warn { border-color: rgba(251,191,36,0.4); }
.pill-warn .dot { background: var(--amber); }
.model-select { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 6px 9px; font: inherit; font-size: 12px; cursor: pointer; outline: 0; }
.model-select:focus { border-color: var(--sky); }

/* ── body grid ── */
.body { flex: 1 1 auto; display: grid; grid-template-columns: 244px 1fr 360px; min-height: 0; }

/* ── sidebar ── */
.sidebar { display: flex; flex-direction: column; min-height: 0; background: var(--bg-2); border-right: 1px solid var(--border); }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sessions { overflow-y: auto; padding: 0 8px 8px; }
.side-empty { color: var(--faint); font-size: 12.5px; padding: 8px 8px; }
.session { display: flex; align-items: stretch; border-radius: 9px; margin-bottom: 2px; }
.session:hover { background: var(--surface); }
.session-active { background: var(--surface) !important; box-shadow: inset 2px 0 0 var(--sky); }
.session-main { flex: 1 1 auto; min-width: 0; text-align: left; border: 0; background: transparent; color: var(--text); padding: 8px 9px; cursor: pointer; font: inherit; }
.session-title { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-meta { font-size: 10.5px; color: var(--faint); margin-top: 2px; }
.session-x { border: 0; background: transparent; color: var(--faint); cursor: pointer; padding: 0 9px; font-size: 11px; }
.session-x:hover { color: var(--red); }

/* ── center ── */
.center { display: flex; flex-direction: column; min-height: 0; }
.landing { place-items: center; display: grid; padding: 32px; overflow-y: auto; }
.hero { width: 100%; max-width: 680px; text-align: center; }
.hero-title { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 10px; }
.hero-sub { color: var(--muted); font-size: 14.5px; margin: 0 auto 24px; max-width: 540px; }
.hero-note { color: var(--amber); font-size: 12px; margin-top: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 10px; padding: 8px 12px; font-size: 12.5px; cursor: pointer; text-align: left; transition: all .15s; }
.chip:hover { color: var(--text); border-color: rgba(56,189,248,0.5); transform: translateY(-1px); }

.stream .transcript { flex: 1 1 auto; overflow-y: auto; padding: 22px 26px; }
.stream .composer { margin: 0 16px 16px; }

.turn { margin-bottom: 18px; }
.turn-role { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }
.turn-user .turn-role { color: var(--sky); }
.turn-body { word-break: break-word; }
.turn-user .turn-body { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 13px; display: inline-block; }
.code { background: #0a0d14; border: 1px solid var(--border); border-radius: 10px; padding: 12px; overflow-x: auto; font: 12.5px/1.5 ui-monospace, "SF Mono", Menlo, monospace; color: #cdd6e6; white-space: pre-wrap; margin: 8px 0; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-family: ui-monospace, Menlo, monospace; font-size: .9em; }

/* ── composer ── */
.composer { border: 1px solid var(--border); background: var(--surface); border-radius: 14px; padding: 11px; box-shadow: 0 10px 40px rgba(0,0,0,.32); }
.composer-big { box-shadow: 0 16px 60px rgba(2,132,199,.12), 0 10px 40px rgba(0,0,0,.4); }
.composer-input { width: 100%; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; padding: 5px 5px 2px; }
.composer-input::placeholder { color: var(--faint); }
.composer-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.toggle { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; cursor: pointer; }
.toggle input { accent-color: var(--sky); }
.mode-row { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mode-select { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 9px; padding: 6px 26px 6px 10px; font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; outline: 0; -webkit-appearance: none; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 14px) center, calc(100% - 9px) center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.mode-select:focus { border-color: var(--sky); }
.mode-select.mode-edit { border-color: rgba(56,189,248,.45); background-color: rgba(56,189,248,.10); color: #bfe7fb; }
.mode-select.mode-agent { border-color: rgba(251,191,36,.45); background-color: rgba(251,191,36,.10); color: #fde68a; }
.mode-extra { border: 1px solid var(--border); background: transparent; color: var(--muted); border-radius: 9px; padding: 5px 10px; font: inherit; font-size: 11.5px; cursor: pointer; transition: border-color .15s, color .15s; }
.mode-extra:hover { border-color: var(--text); color: var(--text); }
.mode-extra.mode-warn { border-color: rgba(248,113,113,.45); background: rgba(248,113,113,.08); color: #fecaca; }
.mode-extra.mode-ok { border-color: rgba(52,211,153,.45); background: rgba(52,211,153,.08); color: #bbf7d0; }
.boundaries-panel { margin: 8px 0 4px; border: 1px solid rgba(52,211,153,.30); background: rgba(52,211,153,.05); border-radius: 11px; padding: 10px 12px; }
.boundaries-head { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #6ee7b7; margin-bottom: 6px; }
.boundaries-input { width: 100%; resize: vertical; border: 1px solid var(--border); background: var(--bg-2); color: var(--text); border-radius: 8px; padding: 8px 10px; font: 12.5px ui-monospace, monospace; outline: 0; }
.boundaries-input:focus { border-color: #34d399; }

/* ── Team panel ── */
.panel-section { padding: 6px 0; border-top: 1px solid var(--border); }
.panel-section:first-of-type { border-top: 0; }
.panel-subhead { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.members { padding: 0 8px 8px; display: flex; flex-direction: column; gap: 2px; }
.member { display: flex; align-items: center; gap: 9px; padding: 6px 6px; border-radius: 7px; font-size: 12.5px; }
.member-avatar { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, #0ea5e9, #0369a1); color: #fff; font-size: 11px; font-weight: 700; flex: 0 0 auto; }
.member-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-role { font-size: 10px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.member-role-owner { color: #fde68a; border-color: rgba(251,191,36,.4); background: rgba(251,191,36,.08); }
.team-memory { padding: 10px 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.team-memory:first-of-type { border-top: 0; }
.team-memory-title { font-size: 13px; font-weight: 600; }
.team-memory-body { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.team-memory-meta { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 10px; color: var(--faint); letter-spacing: .04em; text-transform: uppercase; }
.team-memory-actions { display: flex; gap: 6px; padding-top: 4px; }
.team-memory-proposed { background: rgba(251,191,36,.04); }
.team-memory-approved { background: rgba(52,211,153,.04); }
.team-memory-approved .team-memory-meta { color: #6ee7b7; }
.team-memory-rejected { opacity: 0.55; }
.team-memory-rejected .team-memory-meta { color: var(--red); }

.btn { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 10px; padding: 8px 14px; font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; transition: all .12s; }
.btn:hover { border-color: rgba(56,189,248,0.5); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #0ea5e9, #0369a1); border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }

/* ── rail / panels ── */
.rail { display: flex; flex-direction: column; min-height: 0; background: var(--bg-2); border-left: 1px solid var(--border); }
.tabs { display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--border); }
.tab { flex: 1 1 0; border: 0; background: transparent; color: var(--muted); padding: 9px 6px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--text); }
.tab-active { color: var(--text); border-bottom-color: var(--sky); }
.panel { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.panel-empty { color: var(--faint); font-size: 12.5px; padding: 12px 14px; }

.files { padding: 0 8px 8px; }
.file { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text); padding: 7px 8px; border-radius: 8px; cursor: pointer; font: inherit; }
.file:hover { background: var(--surface); }
.file-active { background: var(--surface); box-shadow: inset 2px 0 0 var(--sky); }
.file-badge { display: grid; place-items: center; height: 20px; width: 20px; border-radius: 6px; background: rgba(56,189,248,.12); color: var(--sky); font-size: 11px; font-weight: 700; flex: 0 0 auto; }
.file-path { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.diff { margin: 0 12px 12px; max-height: 50vh; white-space: pre; }
.d-add { color: var(--emerald); }
.d-del { color: var(--red); }
.d-hunk { color: var(--sky); }

.tree { overflow-y: auto; padding: 4px 6px; }
.tree-row { display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--muted); padding: 4px 6px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-row:hover { background: var(--surface); color: var(--text); }
.tree-file { color: var(--text); }
.file-view { border-top: 1px solid var(--border); }
.file-view-head { padding: 8px 12px; font-size: 11px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
.file-view .code { margin: 0 12px 12px; max-height: 46vh; }

/* ── runs ── */
.run-launch { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 4px 12px 12px; }
.run-launch .field { flex: 1 1 160px; }
.sandbox-list { padding: 0 12px 8px; }
.sandbox { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; }
.sandbox-goal { flex: 1 1 auto; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sandbox-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.jobs { padding: 0 8px 8px; }
.job { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text); padding: 7px 8px; border-radius: 8px; cursor: pointer; font: inherit; }
.job:hover { background: var(--surface); }
.job-active { background: var(--surface); box-shadow: inset 2px 0 0 var(--sky); }
.job-goal { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { font-size: 9px; text-transform: uppercase; letter-spacing: .04em; padding: 2px 5px; border-radius: 5px; border: 1px solid var(--border); flex: 0 0 auto; }
.status-running { color: var(--sky); border-color: rgba(56,189,248,.4); }
.status-completed { color: var(--emerald); border-color: rgba(52,211,153,.4); }
.status-failed { color: var(--red); border-color: rgba(248,113,113,.4); }
.status-queued, .status-cancelled { color: var(--muted); }
.console { margin: 8px 12px 12px; background: #05070b; border: 1px solid var(--border); border-radius: 10px; padding: 10px; font: 12px/1.5 ui-monospace, Menlo, monospace; max-height: 40vh; overflow-y: auto; }
.console-line { display: flex; gap: 8px; }
.console-caret { color: var(--emerald); }
.console-summary { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; color: var(--muted); white-space: pre-wrap; }

/* ── modal / drawer ── */
.overlay { position: fixed; inset: 0; background: rgba(3,5,9,.6); display: grid; place-items: center; padding: 24px; z-index: 50; }
/* Locked (sign-in) overlay: a branded backdrop so the card has somewhere to sit. */
.overlay-locked { background:
    radial-gradient(900px 520px at 50% -8%, rgba(56,189,248,.16), transparent 60%),
    radial-gradient(700px 500px at 85% 110%, rgba(2,132,199,.12), transparent 55%),
    rgba(4,6,11,.96);
  backdrop-filter: blur(8px); pointer-events: auto; }
.modal { width: 100%; max-width: 460px; max-height: 88vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-2); border-radius: 18px; box-shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 40px 100px -20px rgba(0,0,0,.7); overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 15px; }
.modal-body { padding: 20px; overflow-y: auto; }

/* ── branded auth header ── */
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 8px 0 18px; }
.auth-logo { height: 56px; width: 56px; border-radius: 16px; box-shadow: 0 8px 28px -8px rgba(2,132,199,.6), 0 0 0 1px rgba(255,255,255,.08); }
.auth-logo svg { display: block; height: 100%; width: 100%; border-radius: 16px; }
.auth-wordmark { font-weight: 700; letter-spacing: .22em; font-size: 14px; color: var(--text); }
.auth-tagline { color: var(--muted); font-size: 13px; max-width: 300px; line-height: 1.5; }
/* topbar logo svg sizing */
.logo svg { display: block; height: 100%; width: 100%; }
.logo { background: none; box-shadow: none; }
.drawer { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 12.5px; font-weight: 500; color: #c9d0dd; margin-top: 8px; letter-spacing: .01em; }
.field { width: 100%; border: 1px solid var(--border-2); background: #0e131d; color: var(--text); border-radius: 10px; padding: 11px 13px; font: inherit; font-size: 14px; outline: 0; transition: border-color .12s, box-shadow .12s; }
.field::placeholder { color: var(--faint); }
.field:hover { border-color: #3a4356; }
.field:focus { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(56,189,248,.18); }
.drawer-actions { margin-top: 14px; }
.drawer-actions .btn-primary { width: 100%; padding: 11px 14px; font-size: 14px; box-shadow: 0 8px 24px -8px rgba(2,132,199,.6); }
.drawer-note { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; line-height: 1.5; }

/* ── toasts ── */
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.4); opacity: 1; transform: translateY(0); transition: all .25s; }
.toast-out { opacity: 0; transform: translateY(8px); }
.toast-success { border-color: rgba(52,211,153,.4); }
.toast-error { border-color: rgba(248,113,113,.4); }

@media (max-width: 1100px) { .body { grid-template-columns: 0 1fr 320px; } .sidebar { display: none; } }
@media (max-width: 820px) { .body { grid-template-columns: 1fr; } .rail { display: none; } }
