/* App shell layout — sidebar + main, auth-page centering, chat composer, files grid. */

/* ── Two-column shell: sidebar + main ──────────────────── */
.shell { display: flex; min-height: 100dvh; }
.shell-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100dvh;
  margin: 0;
  padding: 8px 8px 0;
  display: flex;
  flex-direction: column;
  /* Flush, anchored panel — solid surface + divider. */
  background: #FBFAF5;
  border: none;
  border-right: 1px solid var(--stroke-1);
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
/* Collapse toggle — chevron at the top-right of the expanded sidebar */
.sidebar-collapse {
  position: absolute; top: 16px; right: 12px; width: 26px; height: 26px;
  border-radius: 7px; display: flex; align-items: center; justify-content: center;
  color: var(--ink-40); cursor: pointer; z-index: 25;
}
.sidebar-collapse:hover { background: var(--ink-06); color: var(--ink); }

/* Collapsed = slim icon rail (click the logo to expand). Desktop only —
   mobile keeps the off-canvas overlay below. */
@media (min-width: 769px) {
  .shell.collapsed .shell-sidebar { width: 64px; }
  .shell.collapsed .sidebar-inner { padding: 16px 0; align-items: center; }
  .shell.collapsed .sidebar-brand { padding: 0 0 14px; justify-content: center; gap: 0; width: 100%; cursor: pointer; }
  .shell.collapsed .sidebar-brand > div { display: none; }
  .shell.collapsed .sidebar-collapse { display: none; }
  .shell.collapsed .sidebar-actions { padding: 12px 0 8px; }
  .shell.collapsed .sidebar-actions .btn { width: 40px; height: 40px; padding: 0; font-size: 0; justify-content: center; border-radius: 11px; }
  .shell.collapsed .sidebar-nav.top { width: 100%; align-items: center; }
  .shell.collapsed .sidebar-nav.top .nav-item { width: 42px; height: 42px; padding: 0; justify-content: center; }
  .shell.collapsed .sidebar-nav.top .label, .shell.collapsed .nav-count { display: none; }
  .shell.collapsed .sidebar-search,
  .shell.collapsed .sidebar-section-label,
  .shell.collapsed .sidebar-list,
  .shell.collapsed .sidebar-resize { display: none; }
  .shell.collapsed .sidebar-user { justify-content: center; padding: 12px 0; }
  .shell.collapsed .sidebar-user .meta { display: none; }
}
/* Drag-to-resize handle on the sidebar's right edge */
.sidebar-resize {
  position: absolute; top: 0; right: -3px; width: 9px; height: 100%;
  cursor: col-resize; z-index: 30; touch-action: none;
}
.sidebar-resize::after {
  content: ""; position: absolute; top: 0; bottom: 0; right: 3px; width: 2px;
  background: transparent; transition: background .15s;
}
.sidebar-resize:hover::after, body.vb-resizing .sidebar-resize::after { background: rgba(158,103,247,.45); }
body.vb-resizing { cursor: col-resize; user-select: none; }
.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ── Sidebar internals ──────────────────────────────────── */
.sidebar-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  min-height: 0;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px 18px;
  border-bottom: 1px solid var(--stroke-1);
  margin-bottom: 14px;
}
.sidebar-brand .mark { width: 34px; height: 34px; display: inline-flex; flex-shrink: 0; }
.sidebar-brand .name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}
.sidebar-brand .name em {
  font-style: normal; color: var(--purple-deep);
}
.sidebar-brand .sub {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--fg-3); margin-top: 3px;
}

.sidebar-actions { padding: 0 4px 10px; display: flex; flex-direction: column; gap: 8px; }
.sidebar-actions .btn { width: 100%; }
/* New chat = ink (matches mocks), not purple */
.sidebar-actions .btn-primary { background: var(--ink); color: var(--paper); }
.sidebar-actions .btn-primary:hover:not(:disabled) { background: #1a1616; filter: none; }
/* Claude-style top nav (Search / Projects / Files) */
.sidebar-nav.top { margin: 0 0 6px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav.top .nav-item { width: 100%; }
.sidebar-nav.top .nav-item.active { background: rgba(158,103,247,0.12); color: var(--purple-deep); }
.nav-count { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--ink-40); }
.sidebar-list { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
a.sidebar-brand { text-decoration: none; color: inherit; }

.sidebar-search {
  padding: 0 4px 8px;
}

.sidebar-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
  padding: 8px 8px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-list { flex: 1; overflow-y: auto; padding: 0 4px 8px; }

.ws-folder { margin-bottom: 2px; }
.ws-folder-head {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-1);
  cursor: pointer;
  border-radius: 8px;
  user-select: none;
}
.ws-folder-head:hover { background: rgba(158, 103, 247, 0.08); }
.ws-folder-head .chev {
  color: var(--fg-3); font-size: 10px;
  transition: transform .15s; display: inline-block;
}
.ws-folder.open .ws-folder-head .chev { transform: rotate(90deg); }
.ws-folder-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-folder-count {
  font-family: var(--font-mono); font-size: 10px; color: var(--fg-3);
}
.ws-folder-body {
  display: none;
  padding: 2px 0 6px 22px;
}
.ws-folder.open .ws-folder-body { display: block; }
.conv-item {
  display: block;
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--fg-2);
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv-item:hover { background: rgba(158, 103, 247, 0.08); color: var(--fg-1); }
.conv-item.active {
  background: rgba(158, 103, 247, 0.15);
  color: var(--inkwell-twilight);
  font-weight: 500;
}
.conv-empty { font-size: 12px; color: var(--fg-3); padding: 4px 10px; font-style: normal; }

.sidebar-nav {
  border-top: 1px solid var(--stroke-1);
  padding: 10px 4px;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--fg-2);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.nav-item:hover { background: rgba(158, 103, 247, 0.08); color: var(--fg-1); }
.nav-item.active {
  background: rgba(158, 103, 247, 0.15);
  color: var(--inkwell-twilight);
  font-weight: 500;
}
.nav-item .label { flex: 1; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 8px 6px;
  border-top: 1px solid var(--stroke-1);
  margin-top: 10px;
  text-decoration: none; color: inherit;
  border-radius: 10px;
  transition: background .15s;
}
a.sidebar-user:hover { background: rgba(158, 103, 247,0.08); }
.sidebar-user .uname { color: var(--fg-1); font-weight: 600; font-size: 14px; }
.sidebar-user .urole { color: var(--fg-3); font-size: 12px; text-transform: capitalize; }
.sidebar-user .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--inkwell-sky-deep), var(--inkwell-twilight));
  color: var(--fg-on-dark); font-weight: 600; font-size: 13px;
}
.sidebar-user .meta { flex: 1; min-width: 0; }
.sidebar-user .uname { font-size: 13px; font-weight: 500; color: var(--fg-1); line-height: 1.2; }
.sidebar-user .urole { font-size: 11px; color: var(--fg-3); line-height: 1.2; }

/* ── Main column ────────────────────────────────────────── */
.main-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--stroke-1);
  background: rgba(255,255,255,0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.main-head .title { font-family: var(--font-display); font-size: 22px; font-weight: 500; }
.main-head .title em { font-style: normal; color: var(--purple-deep); font-weight: inherit; }
.main-head .meta { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); letter-spacing: 0.04em; text-transform: uppercase; }
.main-body { flex: 1; overflow-y: auto; padding: 32px 28px; }

/* ── Auth pages (login/signup/forgot) ───────────────────── */
.auth-shell {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  position: relative; z-index: 1;
  width: 100%;
  max-width: 404px;
  padding: 34px 32px;
  background: rgba(255, 255, 255, 0.66);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border-radius: 22px;
  box-shadow: var(--glass-shadow);
  border: 1px solid rgba(255, 255, 255, 0.8);
  text-align: center;
}
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 11px; margin-bottom: 26px; }
.auth-brand .mark { width: 52px; height: 52px; display: inline-flex; }
.auth-brand .name {
  font-family: var(--font-display); font-size: 24px; font-weight: 400;
  letter-spacing: -0.02em; line-height: 1;
}
.auth-brand .name em { font-style: normal; color: var(--ink); }
.auth-brand .lock { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-40); }
.auth-title {
  font-family: var(--font-sans); font-size: 26px; font-weight: 500;
  letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 4px;
}
.auth-title em { font-style: normal; color: var(--purple-deep); }
.auth-lede {
  color: var(--ink-60); margin-bottom: 26px; font-size: 14.5px;
}
.auth-form { text-align: left; }
.auth-foot { text-align: center; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-3); margin-bottom: 4px; display: block;
}
.auth-form .btn { margin-top: 8px; }
.auth-foot {
  margin-top: 22px;
  text-align: center;
  font-size: 14px;
  color: var(--fg-2);
}
.auth-foot a { color: var(--inkwell-sky-deep); font-weight: 500; }
.auth-error {
  background: rgba(232, 68, 10, 0.08);
  border: 1px solid rgba(232, 68, 10, 0.25);
  color: var(--inkwell-orange);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 14px;
}

/* ── Home dashboard ─────────────────────────────────────── */
.dash-hero {
  padding: 32px 40px 40px;
  margin-bottom: 28px;
}
.dash-hero .eyebrow { margin-bottom: 14px; }
.dash-hero h1 { font-size: 56px; line-height: 0.95; margin-bottom: 16px; }
.dash-hero p { max-width: 580px; color: var(--fg-2); font-size: 18px; }
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.dash-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  text-decoration: none;
  color: inherit;
  /* Grid items default to min-width:auto, so a nowrap/truncated child forces the
     1fr track wider than the viewport (cards overflow + clip on mobile). Allow
     the card to shrink to its track so .truncate children actually ellipsize. */
  min-width: 0;
}
/* Belt-and-suspenders: every direct child can shrink so truncation works inside
   the flex column instead of pushing the card wide. */
.dash-card > * { min-width: 0; max-width: 100%; }
.dash-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 14px 40px rgba(40, 35, 35, 0.12),
    0 2px 6px rgba(40, 35, 35, 0.04);
  text-decoration: none;
}
.dash-card h3 { font-size: 22px; overflow-wrap: anywhere; }
.dash-card h3 em { font-style: normal; color: var(--inkwell-sky-deep); font-weight: 400; }
.dash-card p { color: var(--fg-2); font-size: 14px; }
.dash-card .glass-icon-cell { align-self: flex-start; }
.dash-card .arrow { color: var(--inkwell-sky-deep); margin-top: 4px; font-size: 14px; }

/* ── Chat ───────────────────────────────────────────────── */
.chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 28px 28px 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px 8vh;
}
.chat-empty .mark { width: 50px; height: 50px; margin-bottom: 18px; }
.chat-empty h2 { font-size: 30px; letter-spacing: -0.02em; margin-bottom: 8px; }
.chat-empty p { color: var(--ink-60); font-size: 16px; max-width: 440px; margin-bottom: 28px; line-height: 1.5; }
/* Starters: a tidy centered column of clean cards (not wrapping gray pills). */
.chat-empty .starters {
  display: flex; flex-direction: column; gap: 10px;
  width: 100%; max-width: 520px;
}
.chat-empty .starter {
  padding: 14px 18px;
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--ink-12);
  border-radius: 13px;
  cursor: pointer;
  font-size: 15px;
  color: var(--ink);
  text-align: left;
  transition: border-color .15s, background .15s, transform .15s;
}
.chat-empty .starter:hover {
  border-color: var(--purple);
  background: #fff;
  transform: translateY(-1px);
}

.msg-row { display: flex; gap: 12px; max-width: var(--composer-max); width: 100%; margin: 0 auto; }
.msg-row.user { justify-content: flex-end; }
.msg-row.assistant { justify-content: flex-start; }
.msg-bubble {
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 15px;
  line-height: 1.55;
  max-width: 78%;
  word-wrap: break-word;
}
/* U2 — your message: soft ink tint, no border, right-aligned */
.msg-row.user .msg-bubble {
  background: rgba(40, 35, 35, 0.06);
  color: var(--ink);
  border-radius: 14px;
}
/* A3 — assistant: purple accent rule + mono label + plain editorial text */
.msg-row.assistant { display: block; }
.msg-row.assistant .msg-bubble {
  background: transparent;
  border: none;
  border-left: 2px solid var(--purple);
  border-radius: 0;
  padding: 2px 0 2px 18px;
  max-width: 100%;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.7;
}
.msg-row.assistant .msg-bubble::before {
  content: "Vanderbot";
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--purple-deep);
  margin-bottom: 8px;
}
.msg-bubble pre {
  background: rgba(40, 35, 35, 0.05);
  padding: 10px 12px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  margin: 8px 0;
}
.msg-row.user .msg-bubble pre { background: rgba(255,255,255,0.15); color: var(--fg-on-dark); }
.msg-bubble code { font-family: var(--font-mono); font-size: 0.92em; background: rgba(40, 35, 35, 0.06); padding: 1px 5px; border-radius: 4px; }
.msg-row.user .msg-bubble code { background: rgba(255,255,255,0.18); }
.msg-bubble p + p { margin-top: 8px; }
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 { font-size: 1.1em; margin: 12px 0 6px; }
.msg-bubble ul, .msg-bubble ol { padding-left: 20px; margin: 6px 0; }
.msg-bubble a { color: var(--inkwell-sky-deep); text-decoration: underline; }
.msg-row.user .msg-bubble a { color: #BFE4F0; }

.msg-files {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px; margin-top: 12px;
}
.msg-file-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--stroke-1);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color .15s;
}
.msg-file-card:hover { border-color: var(--inkwell-sky-deep); }
.msg-row.user .msg-file-card { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.2); color: var(--fg-on-dark); }
.msg-file-card .name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.composer-wrap {
  padding: 16px 28px 24px;
  position: sticky; bottom: 0;
  background: linear-gradient(to top, rgba(249,247,241,0.96) 60%, rgba(249,247,241,0));
}
.composer {
  max-width: var(--composer-max);
  margin: 0 auto;
  padding: 14px 14px 12px;
  background: #fff;
  border: 1px solid var(--ink-12);
  border-radius: 18px;
  box-shadow: 0 1px 1px rgba(0,0,0,.03), 0 12px 30px -14px rgba(0,0,0,.1);
  position: relative;
}
/* C3 composer accents: orange send, purple active skill toggle */
.composer-send { background: var(--orange) !important; color: #fff !important; border-radius: 10px !important; }
.composer-send:disabled { opacity: 0.4; }
.skill-pill.active { background: var(--purple) !important; color: #fff !important; border-color: var(--purple) !important; }
.skill-pill.active svg { color: #fff; }
/* ── Projects (sidebar section + view) ───────────────────────────── */
.sidebar-section-label { display: flex; align-items: center; justify-content: space-between; }
/* "View all" link in section headers — replaces the old AUTO tag */
.section-link {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--inkwell-sky-deep);
  text-decoration: none; cursor: pointer; padding: 2px 4px; border-radius: 5px;
}
.section-link:hover { background: rgba(158, 103, 247,0.10); color: var(--inkwell-twilight); }

/* All-conversations page */
.conv-page-search { position: relative; max-width: var(--composer-max); margin: 4px 0 18px; }
.conv-page-search .input { padding-left: 38px; }
.conv-search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--fg-3); pointer-events: none; display: flex; }
.conv-page-grid { display: flex; flex-direction: column; gap: 8px; max-width: var(--composer-max); }
.conv-row { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; text-decoration: none; color: inherit; }
.conv-row:hover { border-color: var(--inkwell-sky-deep); }
.conv-row-main { flex: 1; min-width: 0; }
.conv-row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.conv-row-title { font-size: 15px; font-weight: 600; color: var(--fg-1); }
.conv-row-date { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); flex: 0 0 auto; }
.conv-row-snippet { font-size: 13px; color: var(--fg-2); margin-top: 3px; }
.conv-row-topic { flex: 0 0 auto; align-self: center; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--inkwell-sky-deep); background: rgba(158, 103, 247,0.10); padding: 3px 8px; border-radius: var(--radius-pill); }
@media (max-width: 767px) { .conv-row-topic { display: none; } }
.section-add {
  width: 22px; height: 22px; border-radius: 6px; display: inline-flex;
  align-items: center; justify-content: center; color: var(--inkwell-sky-deep);
  cursor: pointer; flex: 0 0 auto;
}
.section-add:hover { background: rgba(158, 103, 247,0.10); }
.sidebar-projects { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.proj-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 8px;
  color: var(--fg-2); text-decoration: none; font-size: 13px; font-weight: 500;
}
.proj-item:hover { background: rgba(158, 103, 247,0.08); color: var(--fg-1); }
.proj-item.active { background: rgba(158, 103, 247,0.14); color: var(--inkwell-twilight); }
.proj-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.proj-empty {
  text-align: left; color: var(--fg-3); font-size: 12px; font-style: normal;
  padding: 6px 10px; cursor: pointer; border-radius: 8px;
}
.proj-empty:hover { background: rgba(158, 103, 247,0.06); color: var(--inkwell-sky-deep); }

.head-actions { display: flex; align-items: center; gap: 8px; }
.btn-ghost { background: transparent; border: 1px solid var(--glass-border); color: var(--fg-2); }
.btn-ghost:hover { background: rgba(158, 103, 247,0.08); color: var(--fg-1); }
.btn-ghost.danger:hover { background: rgba(232,68,10,0.10); color: var(--inkwell-orange); border-color: rgba(232,68,10,0.3); }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* Inline-editable project title — looks like the page heading, edits in place. */
.project-title-input {
  font-family: var(--font-display);
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 500; letter-spacing: -0.01em;
  color: var(--fg-1);
  background: transparent;
  border: none; outline: none;
  padding: 2px 6px; margin: -2px -6px;
  border-radius: 8px;
  width: 100%; max-width: 560px;
  transition: background .15s, box-shadow .15s;
}
.project-title-input::placeholder { color: var(--fg-3); font-style: normal; }
.project-title-input:hover { background: rgba(158, 103, 247,0.05); }
.project-title-input:focus { background: rgba(158, 103, 247,0.08); box-shadow: inset 0 -2px 0 var(--inkwell-sky-deep); }

.project-body { max-width: var(--composer-max); margin: 0 auto; padding: 8px 0 40px; display: flex; flex-direction: column; gap: 24px; }
.project-instructions { padding: 20px; }
.pi-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.pi-head h3 { font-size: 18px; margin-bottom: 2px; }
.pi-head p { font-size: 13px; }
.pi-textarea { width: 100%; resize: vertical; min-height: 120px; line-height: 1.5; font-family: inherit; }
.pi-desc-row { margin-top: 10px; }
.proj-pill { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; }

.page-pad { padding: 32px; }

/* Profile → Install app card */
.install-done {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--inkwell-twilight); font-weight: 500; font-size: 14px;
  background: rgba(158, 103, 247,0.10); border: 1px solid rgba(158, 103, 247,0.25);
  padding: 8px 14px; border-radius: var(--radius-pill);
}
.ios-steps { margin-top: 14px; }
.ios-steps ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.ios-steps li { font-size: 13px; color: var(--fg-2); line-height: 1.5; }
.ios-steps strong { color: var(--fg-1); }
.ios-share-glyph { color: var(--inkwell-sky-deep); }

/* Skill bar — visible row of skill pills docked to the top of the composer.
   Default = no pill active (plain chat). Click toggles a skill for subsequent
   messages; sticky until re-clicked or another is chosen. */
.skill-bar {
  display: flex; gap: 8px;
  padding: 2px 4px 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--ink-12);
  overflow-x: auto;
  scrollbar-width: none;
}
.skill-bar::-webkit-scrollbar { display: none; }
.skill-pill {
  display: inline-flex; align-items: center; gap: 7px;
  flex: 0 0 auto;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.55);
  color: var(--fg-2);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.skill-pill svg { color: var(--inkwell-sky-deep); transition: color .15s; }
.skill-pill:hover {
  background: rgba(158, 103, 247,0.10);
  border-color: rgba(158, 103, 247,0.30);
  color: var(--fg-1);
}
.skill-pill.active {
  background: linear-gradient(135deg, var(--inkwell-sky-deep), var(--inkwell-twilight));
  border-color: transparent;
  color: var(--fg-on-dark);
  box-shadow: 0 4px 14px rgba(158, 103, 247,0.35);
}
.skill-pill.active svg { color: var(--fg-on-dark); }

.composer-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 0 4px 10px;
  display: none;
}
.composer-chips.has-chips { display: flex; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px;
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--stroke-1);
  border-radius: var(--radius-pill);
  font-size: 12px;
  color: var(--fg-1);
}
.chip-thumb { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; background: var(--inkwell-cloud); display: flex; align-items: center; justify-content: center; }
.chip-thumb svg { width: 18px; height: 18px; color: var(--fg-3); }
.chip-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-remove { color: var(--fg-3); margin-left: 4px; line-height: 1; }
.chip-remove:hover { color: var(--inkwell-orange); }
.chip.uploading .chip-name::after { content: " · uploading…"; color: var(--inkwell-sky-deep); }
.chip.error { border-color: var(--inkwell-orange); }
.chip.error .chip-name { color: var(--inkwell-orange); }

.composer-row {
  display: flex; align-items: flex-end; gap: 8px;
}
.composer-textarea {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  line-height: 1.5;
  padding: 8px 4px;
  outline: none;
  min-height: 32px;
  max-height: 240px;
  overflow-y: auto;
  font-family: var(--font-sans);
  color: var(--fg-1);
}
.composer-textarea::placeholder { color: var(--fg-3); }

.composer-attach, .composer-mode, .composer-send {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}
.composer-attach, .composer-mode {
  color: var(--fg-2); background: transparent;
}
.composer-attach:hover, .composer-mode:hover { background: rgba(158, 103, 247, 0.10); color: var(--inkwell-sky-deep); }
.composer-send {
  background: var(--inkwell-sky-deep); color: var(--fg-on-dark);
}
.composer-send:hover:not(:disabled) { background: var(--inkwell-twilight); }
.composer-send:disabled { background: var(--inkwell-cloud); color: var(--fg-3); opacity: 1; cursor: not-allowed; }

.composer-mode-chip {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--inkwell-sky-deep);
  padding: 4px 10px;
  background: rgba(158, 103, 247, 0.12);
  border-radius: var(--radius-pill);
  margin-right: 8px;
  display: none;
}
.composer-mode-chip.active { display: inline-block; }

.slash-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--ink-12);
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
  padding: 8px;
  min-width: 330px;
  z-index: 10;
}
.slash-label {
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-40); padding: 8px 10px 8px;
}
.slash-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px;
  border-radius: 11px;
  cursor: pointer;
}
.slash-item:hover { background: var(--ink-06); }
.slash-item.on { background: rgba(158, 103, 247, 0.10); }
.slash-ic {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink-06); color: var(--purple-deep);
}
.slash-item.on .slash-ic { background: rgba(158,103,247,0.18); }
.slash-text { flex: 1; min-width: 0; }
.slash-title { font-size: 14.5px; font-weight: 500; color: var(--ink); }
.slash-desc { font-size: 11.5px; color: var(--ink-60); margin-top: 1px; }
.slash-item .hint {
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-40); margin-left: auto; flex-shrink: 0;
}

/* Streaming dots */
.streaming-dots { display: inline-flex; gap: 4px; }
.streaming-dots span {
  width: 6px; height: 6px;
  background: var(--inkwell-sky-deep);
  border-radius: 50%;
  animation: pulse 1.2s ease-in-out infinite;
}
.streaming-dots span:nth-child(2) { animation-delay: 0.15s; }
.streaming-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

/* ── Files grid ─────────────────────────────────────────── */
.files-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 12px;
}
.files-head h1 { font-size: 40px; }
.files-actions { display: flex; gap: 8px; }
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.file-card {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  display: flex; flex-direction: column;
}
.file-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px rgba(40, 35, 35, 0.12);
}
.file-card-preview {
  height: 160px;
  background: var(--inkwell-cloud);
  display: flex; align-items: center; justify-content: center;
  background-size: cover; background-position: center top; background-repeat: no-repeat;
  position: relative;
  overflow: hidden;
}
/* Designed type-tinted placeholders so doc cards never read as "blank".
   A real thumbnail (image / rendered PDF page) overrides the gradient via
   inline background-image when available. */
.file-card-preview.t-pdf  { background: linear-gradient(150deg, #FCE9E9, #F6CFCF); }
.file-card-preview.t-docx { background: linear-gradient(150deg, #E6EFFB, #CFE0F6); }
.file-card-preview.t-xlsx { background: linear-gradient(150deg, #E4F4EA, #CDE9D6); }
.file-card-preview.t-pptx { background: linear-gradient(150deg, #FCEBE2, #F7D6C5); }
.file-card-preview.t-doc,
.file-card-preview.t-other { background: linear-gradient(150deg, #E9F2F4, #D6E6EA); }
.file-card-preview .ph-glyph {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.file-card-preview .ph-glyph svg { width: 52px; height: 52px; opacity: .85; }
.file-card-preview.t-pdf  .ph-glyph svg { color: #C8262C; }
.file-card-preview.t-docx .ph-glyph svg { color: #185ABD; }
.file-card-preview.t-xlsx .ph-glyph svg { color: #107C41; }
.file-card-preview.t-pptx .ph-glyph svg { color: #C24E1C; }
.file-card-preview.t-doc  .ph-glyph svg,
.file-card-preview.t-other .ph-glyph svg { color: var(--inkwell-sky-deep); }
.file-card-preview .ph-ext {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--fg-2);
}
.file-card-preview.has-thumb .ph-glyph { display: none; }
.file-thumb-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity .25s ease;
}
.file-card-preview.has-thumb .file-thumb-img { opacity: 1; }
.file-card-preview svg { width: 48px; height: 48px; color: var(--fg-3); }
.file-card-body { padding: 12px 14px 14px; }
.file-card-name { font-size: 13px; font-weight: 500; color: var(--fg-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--fg-3); }
.file-badge {
  position: absolute; bottom: 8px; left: 8px;
  padding: 2px 8px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  background: rgba(40, 35, 35, 0.7); color: #FFF;
}
.file-badge.pdf { background: #C8262C; }
.file-badge.img { background: #9E67F7; }
.file-badge.docx { background: #185ABD; }
.file-badge.xlsx { background: #107C41; }
.file-badge.pptx { background: #C24E1C; }
.file-badge.doc, .file-badge.other { background: rgba(40, 35, 35, 0.7); }

/* Delete button — top-right of the preview, revealed on card hover. */
.file-del-btn {
  position: absolute; top: 8px; right: 8px;
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  border: none; border-radius: 8px;
  background: rgba(255, 255, 255, 0.85);
  color: #C8262C; cursor: pointer;
  box-shadow: 0 2px 8px rgba(40, 35, 35, 0.14);
  backdrop-filter: blur(4px);
  opacity: 0; transform: translateY(-2px);
  transition: opacity .15s, transform .15s, background .15s;
}
.file-card:hover .file-del-btn,
.file-del-btn:focus-visible { opacity: 1; transform: translateY(0); }
.file-del-btn:hover { background: #C8262C; color: #FFF; }
/* Touch devices have no hover — always show it. */
@media (hover: none) {
  .file-del-btn { opacity: 1; transform: none; }
}

/* Danger buttons (delete confirmation + preview footer). */
.btn-danger {
  background: #C8262C; color: #FFF; border: 1px solid #C8262C;
}
.btn-danger:hover { background: #A91E24; border-color: #A91E24; }
.btn-ghost-danger {
  background: transparent; color: #C8262C; border: 1px solid transparent;
}
.btn-ghost-danger:hover { background: rgba(200, 38, 44, 0.08); border-color: rgba(200, 38, 44, 0.2); }
.spinner-sm {
  display: inline-block; width: 13px; height: 13px; vertical-align: -2px;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: #FFF;
  border-radius: 50%; animation: spin .7s linear infinite;
}

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--fg-3);
  border: 1px dashed var(--stroke-1);
  border-radius: var(--radius-lg);
}
.empty-state .mark { width: 56px; height: 56px; margin: 0 auto 12px; opacity: 0.6; }
.empty-state h3 { margin-bottom: 6px; color: var(--fg-1); }

/* ── Profile ────────────────────────────────────────────── */
.profile-card {
  padding: 28px;
  max-width: 640px;
}
.profile-card .row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--stroke-1); }
.profile-card .row:last-child { border-bottom: none; }
.profile-card .row .label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-3); width: 140px; flex-shrink: 0; }
.profile-card .row .value { font-size: 15px; color: var(--fg-1); flex: 1; }

/* ── Install banner ─────────────────────────────────────── */
.install-banner {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 340px;
  max-width: calc(100vw - 40px);
  padding: 18px 20px;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.2);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slidein-up .25s ease-out;
}
.install-banner h4 { font-family: var(--font-display); font-size: 20px; font-weight: 500; }
.install-banner h4 em { font-style: normal; color: var(--inkwell-sky-deep); font-weight: 400; }
.install-banner p { color: var(--fg-2); font-size: 14px; }
.install-banner .actions { display: flex; gap: 8px; justify-content: flex-end; }
.install-banner .ios-hint {
  background: rgba(158, 103, 247, 0.08);
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--fg-2);
}

/* ── Toast ──────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  padding: 12px 20px;
  background: var(--inkwell-dark);
  color: var(--fg-on-dark);
  border-radius: var(--radius-pill);
  font-size: 14px;
  z-index: 200;
  animation: slidein-up .2s ease-out;
}
.toast.error { background: var(--inkwell-orange); }

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .shell { flex-direction: column; }
  .shell-sidebar {
    position: fixed;
    top: 0; left: -110%;
    margin: 0;
    width: min(86vw, 320px);
    height: 100dvh;
    z-index: 60;
    transition: left .25s ease;
    padding: 14px 12px;
    /* Solid, crisp drawer — NOT translucent glass over the dimmed scrim
       (that's what made the mobile sidebar look grey/washed out). */
    background: #FFFFFF !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none;
    border-right: 1px solid var(--stroke-1);
    border-radius: 0;
    box-shadow: 6px 0 30px rgba(40, 35, 35, 0.22);
  }
  .shell-sidebar.open { left: 0; }
  /* Header sits flush at the top with the menu button inline on its left;
     header-less screens (home) get top clearance so the button doesn't overlap. */
  .main-head { padding: 16px 16px 16px 62px; min-height: 56px; }
  .main-body { padding: 64px 16px 20px; }

  /* Composer: clear the home-indicator safe area; reserve thread space so the
     last message + input are never clipped. */
  .composer-wrap { padding: 10px 12px max(14px, env(safe-area-inset-bottom)); }
  .chat-thread { padding: 18px 14px 96px; }
  .msg-bubble { max-width: 90%; }

  .mobile-menu-btn { position: fixed; top: 12px; left: 12px; z-index: 65; width: 40px; height: 40px; border-radius: 11px; color: var(--ink); }
  .mobile-menu-scrim {
    position: fixed; inset: 0;
    background: rgba(40, 35, 35, 0.45);
    z-index: 55;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
  }

  .dash-hero { padding: 12px 4px 24px; }
  .dash-hero h1 { font-size: 32px; }
  .files-head h1 { font-size: 28px; }

  /* 16px inputs prevent iOS zoom-on-focus */
  .input, .composer-textarea, textarea, input[type="text"], input[type="email"], input[type="password"] { font-size: 16px; }

  /* Single-column grids on phones */
  .dash-grid, .files-grid { grid-template-columns: 1fr; }

  /* Dialogs/modals comfortable on small screens */
  .scrim { padding: 12px; }
  .dialog { width: 96vw; max-height: 88vh; }

  /* Project + conversations pages span full width */
  .project-body, .conv-page-search, .conv-page-grid { max-width: 100%; }
  .project-title-input { font-size: 26px; }
  .project-instructions { padding: 16px; }
  .head-actions { gap: 6px; }
  .head-actions .btn { padding: 8px 12px; font-size: 13px; }

  /* Bigger tap targets in the sidebar */
  .nav-item { padding: 11px 12px; }
  .sidebar-user { padding: 12px 8px; }
}
@media (min-width: 769px) {
  .mobile-menu-btn, .mobile-menu-scrim { display: none; }
}
