/* ==========================================================================
   Margin — tokens
   A warm paper and ink workspace. Clay for actions, forest for calm.
   ========================================================================== */

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 400 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f4efe4;
  --paper-deep: #ece4d4;
  --surface: #faf7f0;
  --surface-raised: #fffdf8;
  --surface-2: #eee6d7;
  --sidebar: #eee7da;
  --ink: #221f19;
  --ink-2: #4d463a;
  --muted: #6b6051;
  --faint: #796d5b;
  --line: #dfd4c1;
  --line-soft: #e9e0d2;
  --line-strong: #cbbda5;
  --accent: #b9472b;
  --accent-hover: #a23a20;
  --accent-ink: #8b311a;
  --accent-soft: #f2ddd2;
  --accent-softer: #f8ece5;
  --forest: #254b3d;
  --forest-ink: #1c3a2f;
  --forest-soft: #dde8e0;
  --gold: #946f2b;
  --gold-soft: #f1e6ca;
  --plum: #5c4059;
  --sea: #335f6b;
  --danger: #a3332a;
  --danger-soft: #f5ddd8;
  --success: #2f6249;
  --success-soft: #e0ede4;
  --focus: #2b6b8c;
  --focus-ring: rgba(43, 107, 140, 0.28);
  --user-note: #f7f1e7;
  --code-bg: #1e1c17;
  --code-head: #25221c;
  --code-line: #353127;
  --code-ink: #e9e1d2;
  --btn-bg: #26231d;
  --btn-fg: #faf6ec;
  --btn-hover: #383329;
  --selected: #e9dfcd;
  --hover: rgba(70, 54, 30, 0.055);
  --hover-strong: rgba(70, 54, 30, 0.09);
  --backdrop: rgba(30, 24, 15, 0.38);
  --shadow-sm: 0 1px 2px rgba(62, 45, 22, 0.055), 0 3px 10px rgba(62, 45, 22, 0.035);
  --shadow-md: 0 14px 40px -18px rgba(48, 34, 14, 0.32), 0 3px 12px rgba(48, 34, 14, 0.05);
  --shadow-lg: 0 35px 90px -32px rgba(35, 24, 9, 0.5), 0 8px 28px rgba(35, 24, 9, 0.08);
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans: "Instrument Sans", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --sidebar-w: 288px;
  --reading: 768px;
  --quick: 130ms;
  --motion: 200ms;
  --panel: 300ms;
  --ease: cubic-bezier(0.22, 0.75, 0.28, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #13120f;
  --paper-deep: #0e0d0b;
  --surface: #191814;
  --surface-raised: #201e19;
  --surface-2: #23211b;
  --sidebar: #161510;
  --ink: #eee7d9;
  --ink-2: #c8bead;
  --muted: #a99e8b;
  --faint: #968b79;
  --line: #2d2a23;
  --line-soft: #26231d;
  --line-strong: #3f392e;
  --accent: #df7557;
  --accent-hover: #ec8a6e;
  --accent-ink: #f1a28b;
  --accent-soft: #34241e;
  --accent-softer: #241b17;
  --forest: #93b6a6;
  --forest-ink: #b6d1c4;
  --forest-soft: #1d2923;
  --gold: #d0a75c;
  --gold-soft: #2c2519;
  --plum: #bfa4bc;
  --sea: #8bb5bf;
  --danger: #e5897b;
  --danger-soft: #34201c;
  --success: #92c3a8;
  --success-soft: #1c2a22;
  --focus: #7db7d6;
  --focus-ring: rgba(125, 183, 214, 0.25);
  --user-note: #1e1c17;
  --code-bg: #100f0c;
  --code-head: #171510;
  --code-line: #2a261e;
  --code-ink: #e7dfcf;
  --btn-bg: #ece4d4;
  --btn-fg: #1d1a15;
  --btn-hover: #fff9ed;
  --selected: #2b2720;
  --hover: rgba(243, 231, 209, 0.055);
  --hover-strong: rgba(243, 231, 209, 0.095);
  --backdrop: rgba(0, 0, 0, 0.58);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 3px 10px rgba(0, 0, 0, 0.14);
  --shadow-md: 0 16px 45px -18px rgba(0, 0, 0, 0.7), 0 3px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 38px 95px -30px rgba(0, 0, 0, 0.8), 0 8px 28px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    color-scheme: dark;
    --paper: #13120f;
    --paper-deep: #0e0d0b;
    --surface: #191814;
    --surface-raised: #201e19;
    --surface-2: #23211b;
    --sidebar: #161510;
    --ink: #eee7d9;
    --ink-2: #c8bead;
    --muted: #a99e8b;
    --faint: #968b79;
    --line: #2d2a23;
    --line-soft: #26231d;
    --line-strong: #3f392e;
    --accent: #df7557;
    --accent-hover: #ec8a6e;
    --accent-ink: #f1a28b;
    --accent-soft: #34241e;
    --accent-softer: #241b17;
    --forest: #93b6a6;
    --forest-ink: #b6d1c4;
    --forest-soft: #1d2923;
    --gold: #d0a75c;
    --gold-soft: #2c2519;
    --plum: #bfa4bc;
    --sea: #8bb5bf;
    --danger: #e5897b;
    --danger-soft: #34201c;
    --success: #92c3a8;
    --success-soft: #1c2a22;
    --focus: #7db7d6;
    --focus-ring: rgba(125, 183, 214, 0.25);
    --user-note: #1e1c17;
    --code-bg: #100f0c;
    --code-head: #171510;
    --code-line: #2a261e;
    --code-ink: #e7dfcf;
    --btn-bg: #ece4d4;
    --btn-fg: #1d1a15;
    --btn-hover: #fff9ed;
    --selected: #2b2720;
    --hover: rgba(243, 231, 209, 0.055);
    --hover-strong: rgba(243, 231, 209, 0.095);
    --backdrop: rgba(0, 0, 0, 0.58);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 3px 10px rgba(0, 0, 0, 0.14);
    --shadow-md: 0 16px 45px -18px rgba(0, 0, 0, 0.7), 0 3px 12px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 38px 95px -30px rgba(0, 0, 0, 0.8), 0 8px 28px rgba(0, 0, 0, 0.35);
  }
}

/* ==========================================================================
   Base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: "ss01" 0, "cv11" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.32;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

:root[data-theme="dark"] body::before {
  mix-blend-mode: screen;
  opacity: 0.14;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] body::before {
    mix-blend-mode: screen;
    opacity: 0.14;
  }
}

::selection {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: var(--accent-ink);
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

img,
svg {
  display: block;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
  margin: 0;
}

ul,
ol {
  margin: 0;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
}

kbd,
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: 5px;
  background: var(--surface-raised);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 0 rgba(60, 42, 20, 0.05);
  white-space: nowrap;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--faint) 42%, transparent);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--faint) 70%, transparent);
  background-clip: content-box;
}

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 10000;
  transform: translateY(-150%);
  background: var(--btn-bg);
  color: var(--btn-fg);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  text-decoration: none;
}
.skip-link:focus {
  transform: none;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
}
.icon--xs {
  width: 14px;
  height: 14px;
}
.icon--sm {
  width: 16px;
  height: 16px;
}
.icon--md {
  width: 20px;
  height: 20px;
}
.icon--lg {
  width: 24px;
  height: 24px;
}

.muted {
  color: var(--muted);
}
.faint {
  color: var(--faint);
}
.small {
  font-size: 12.5px;
}
.tabular {
  font-variant-numeric: tabular-nums;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sr-only-focusable:focus {
  position: static !important;
}

/* ==========================================================================
   Boot
   ========================================================================== */

.boot {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--paper);
  color: var(--ink);
}
.boot__mark {
  width: 34px;
  height: 34px;
  color: var(--ink);
  opacity: 0.9;
  animation: boot-in 500ms var(--ease-out) both;
}
.boot__mark svg {
  width: 100%;
  height: 100%;
}
.boot__word {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
  animation: boot-in 500ms 60ms var(--ease-out) both;
}
.boot__word span {
  color: var(--accent);
}
.boot__line {
  width: 96px;
  height: 1px;
  background: var(--line);
  overflow: hidden;
  margin-top: 6px;
}
.boot__line span {
  display: block;
  width: 40%;
  height: 100%;
  background: var(--accent);
  animation: boot-line 1.35s var(--ease) infinite;
}
.boot__hint {
  font-size: 11px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
  animation: boot-in 500ms 140ms var(--ease-out) both;
}
@keyframes boot-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes boot-line {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(260%);
  }
}
.noscript {
  padding: 40px;
  text-align: center;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 1.7px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
  flex: none;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.spin {
  animation: spin 800ms linear infinite;
}

/* ==========================================================================
   App shell
   ========================================================================== */

#app {
  height: 100%;
  position: relative;
  z-index: 1;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
  transition: grid-template-columns var(--panel) var(--ease);
}
.app-shell.is-collapsed {
  --sidebar-w: 72px;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar {
  position: relative;
  z-index: 30;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  overflow: hidden;
  transition: width var(--panel) var(--ease), transform var(--panel) var(--ease);
}

.sidebar__head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 62px;
  padding: 0 14px 0 18px;
  flex: none;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
  border-radius: 7px;
}
.brand:hover {
  color: var(--ink);
}
.brand-mark {
  width: 21px;
  height: 21px;
  color: var(--ink);
  flex: none;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.wordmark__mark {
  width: 21px;
  height: 21px;
}
.wordmark__text {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--ink);
}
.wordmark__dot {
  color: var(--accent);
}
.sidebar__head .brand {
  flex: 1;
}
.sidebar__collapse {
  flex: none;
}

.sidebar__top {
  padding: 0 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: none;
}

.new-thread {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 13.5px;
  font-weight: 550;
  letter-spacing: 0.005em;
  box-shadow: var(--shadow-sm);
  transition: background var(--quick) var(--ease), transform var(--quick) var(--ease), box-shadow var(--quick);
}
.new-thread:hover {
  background: var(--btn-hover);
  box-shadow: var(--shadow-md);
}
.new-thread:active {
  transform: translateY(1px);
}
.new-thread .icon {
  color: var(--accent);
}
.sidebar__top .new-thread kbd {
  margin-left: auto;
  background: transparent;
  border-color: color-mix(in srgb, var(--btn-fg) 22%, transparent);
  color: color-mix(in srgb, var(--btn-fg) 70%, transparent);
  box-shadow: none;
}

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 34px;
  padding: 0 9px 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  transition: background var(--quick), border-color var(--quick);
}
.sidebar-search:hover,
.sidebar-search:focus-within {
  background: color-mix(in srgb, var(--surface-raised) 55%, transparent);
  border-color: var(--line);
  color: var(--ink-2);
}
.sidebar-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: var(--ink);
}
.sidebar-search input::placeholder {
  color: var(--muted);
}
.sidebar-search kbd {
  flex: none;
  background: transparent;
  color: var(--faint);
  border-color: color-mix(in srgb, var(--line-strong) 70%, transparent);
}
.sidebar-search .search-clear {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 2px;
  display: none;
  align-items: center;
  justify-content: center;
}
.sidebar-search.has-query .search-clear {
  display: inline-flex;
}
.sidebar-search.has-query kbd {
  display: none;
}

.sidebar__nav {
  padding: 2px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: none;
}
.nav-row {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  transition: background var(--quick), color var(--quick);
}
.nav-row:hover {
  background: var(--hover);
  color: var(--ink);
}
.nav-row.is-active {
  background: var(--hover-strong);
  color: var(--ink);
  font-weight: 550;
}
.nav-row .icon {
  color: var(--muted);
  width: 16px;
  height: 16px;
}
.nav-row.is-active .icon {
  color: var(--accent);
}
.nav-row__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-row__count {
  font-size: 10.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  min-width: 14px;
  text-align: right;
}
.nav-row__add {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  flex: none;
}
.nav-row__add:hover {
  background: var(--hover-strong);
  color: var(--accent);
}

.sidebar__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 10px 14px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.side-group {
  margin-top: 12px;
}
.side-group:first-child {
  margin-top: 2px;
}
.side-group__head {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 7px 0 9px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  user-select: none;
}
.side-group__head .label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-group__head button {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--faint);
  opacity: 0;
  transition: opacity var(--quick), background var(--quick), color var(--quick);
}
.side-group__head:hover button,
.side-group__head button:focus-visible {
  opacity: 1;
}
.side-group__head button:hover {
  background: var(--hover-strong);
  color: var(--accent);
}
.side-group__head .icon {
  width: 12px;
  height: 12px;
}

.convo-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 33px;
  padding: 0 27px 0 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.2;
  text-align: left;
  width: 100%;
  transition: background var(--quick), color var(--quick);
}
.convo-row:hover {
  background: var(--hover);
  color: var(--ink);
}
.convo-row.is-active {
  background: var(--selected);
  color: var(--ink);
  font-weight: 550;
}
.convo-row.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}
.convo-row__icon {
  display: none;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface-raised) 60%, transparent);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  flex: none;
}
.convo-row__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.convo-row__marks {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  color: var(--accent);
  flex: none;
  opacity: 0.9;
}
.convo-row__marks .icon {
  width: 11px;
  height: 11px;
}
.convo-row .convo-more {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  opacity: 0;
  transition: opacity var(--quick), background var(--quick), color var(--quick);
}
.convo-row:hover .convo-more,
.convo-row:focus-within .convo-more,
.convo-row.is-active .convo-more {
  opacity: 1;
}
.convo-row .convo-more:hover {
  background: var(--hover-strong);
  color: var(--ink);
}
.convo-row .convo-more .icon {
  width: 14px;
  height: 14px;
}

.side-show-more {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  text-align: left;
}
.side-show-more:hover {
  background: var(--hover);
  color: var(--ink);
}

.sidebar__empty {
  padding: 12px 9px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--faint);
}

.sidebar__foot {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 9px 10px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.plan-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 11px;
  text-align: left;
  border: 0;
  background: transparent;
}
.plan-card:hover {
  background: var(--hover);
  color: var(--ink-2);
}
.plan-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 12%, transparent);
  flex: none;
}
.plan-card .plan-name {
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 9.5px;
  color: var(--ink-2);
}
.plan-card .plan-usage {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
}
.account-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  padding: 5px 7px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  color: var(--ink);
}
.account-row:hover {
  background: var(--hover);
}
.avatar {
  width: 29px;
  height: 29px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  letter-spacing: 0.01em;
}
.avatar--forest {
  background: var(--forest-soft);
  border-color: color-mix(in srgb, var(--forest) 25%, transparent);
  color: var(--forest-ink);
}
.avatar--gold {
  background: var(--gold-soft);
  border-color: color-mix(in srgb, var(--gold) 25%, transparent);
  color: var(--gold);
}
.account-row__meta {
  min-width: 0;
  flex: 1;
}
.account-row__name {
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-row__sub {
  font-size: 10.5px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-row > .icon {
  color: var(--faint);
  width: 15px;
  height: 15px;
}

/* Sidebar search results */
.search-results {
  padding-top: 3px;
}
.search-result {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 7px;
  padding: 8px 9px;
  color: var(--ink-2);
}
.search-result:hover,
.search-result:focus-visible {
  background: var(--hover);
}
.search-result__title {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result__snippet {
  font-family: var(--font-serif);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-result__snippet mark {
  background: var(--gold-soft);
  color: var(--ink);
  border-radius: 2px;
  padding: 0 1px;
}
.search-result__meta {
  font-size: 10px;
  color: var(--faint);
  margin-top: 3px;
}
.search-empty {
  padding: 20px 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.search-empty strong {
  color: var(--ink-2);
  font-weight: 600;
}

/* Collapsed sidebar */
.app-shell.is-collapsed .sidebar__head {
  padding: 0;
  justify-content: center;
}
.app-shell.is-collapsed .brand .wordmark__text {
  display: none;
}
.app-shell.is-collapsed .sidebar__collapse {
  display: none;
}
.app-shell.is-collapsed .brand {
  flex: none;
}
.app-shell.is-collapsed .sidebar__top {
  padding-inline: 16px;
  align-items: center;
}
.app-shell.is-collapsed .new-thread,
.app-shell.is-collapsed .sidebar-search {
  width: 40px;
  padding: 0;
  justify-content: center;
}
.app-shell.is-collapsed .sidebar-search {
  display: none;
}
.app-shell.is-collapsed .new-thread span,
.app-shell.is-collapsed .new-thread kbd,
.app-shell.is-collapsed .sidebar-search input,
.app-shell.is-collapsed .sidebar-search kbd,
.app-shell.is-collapsed .sidebar-search .search-clear {
  display: none;
}
.app-shell.is-collapsed .new-thread {
  color: var(--btn-fg);
}
.app-shell.is-collapsed .sidebar-search {
  color: var(--muted);
}
.app-shell.is-collapsed .sidebar__nav {
  padding-inline: 16px;
}
.app-shell.is-collapsed .nav-row {
  width: 40px;
  justify-content: center;
  padding: 0;
}
.app-shell.is-collapsed .nav-row__label,
.app-shell.is-collapsed .nav-row__count,
.app-shell.is-collapsed .nav-row__add {
  display: none;
}
.app-shell.is-collapsed .sidebar__scroll {
  padding-inline: 14px;
}
.app-shell.is-collapsed .side-group__head {
  justify-content: center;
  padding: 0;
  height: 20px;
}
.app-shell.is-collapsed .side-group__head .label,
.app-shell.is-collapsed .side-group__head button {
  display: none;
}
.app-shell.is-collapsed .side-group__head::after {
  content: "· · ·";
  color: var(--faint);
  letter-spacing: 0.1em;
}
.app-shell.is-collapsed .convo-row {
  width: 40px;
  height: 36px;
  padding: 0;
  justify-content: center;
  margin: 2px auto;
}
.app-shell.is-collapsed .convo-row__title,
.app-shell.is-collapsed .convo-row__marks,
.app-shell.is-collapsed .convo-more {
  display: none;
}
.app-shell.is-collapsed .convo-row__icon {
  display: inline-flex;
}
.app-shell.is-collapsed .convo-row.is-active::before {
  left: -8px;
}
.app-shell.is-collapsed .side-show-more,
.app-shell.is-collapsed .sidebar__empty,
.app-shell.is-collapsed .search-results,
.app-shell.is-collapsed .plan-card {
  display: none;
}
.app-shell.is-collapsed .sidebar__foot {
  padding-inline: 16px;
  align-items: center;
}
.app-shell.is-collapsed .account-row {
  width: 40px;
  padding: 5px;
  justify-content: center;
}
.app-shell.is-collapsed .account-row__meta,
.app-shell.is-collapsed .account-row > .icon {
  display: none;
}
.app-shell.is-collapsed .sidebar-search-trigger {
  display: inline-flex;
}

.sidebar-search-trigger {
  display: none;
}

/* Mobile sidebar */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 25;
  background: var(--backdrop);
  opacity: 0;
  transition: opacity var(--panel) var(--ease);
  backdrop-filter: blur(1.5px);
}
.sidebar-mobile-head {
  display: none;
}

/* ==========================================================================
   Workspace + topbar
   ========================================================================== */

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
  background: var(--surface);
  position: relative;
  overflow: hidden;
}

.topbar {
  flex: none;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px 0 22px;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  position: relative;
  z-index: 10;
}
.topbar .topbar__menu {
  display: none;
}
.topbar__title-wrap {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar__title-block {
  min-width: 0;
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}
.thread-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: min(100%, 560px);
  border: 0;
  background: transparent;
  padding: 1px 4px;
  margin-left: -4px;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
}
.thread-title:hover {
  background: var(--hover);
}
.thread-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread-title .icon {
  opacity: 0;
  width: 12px;
  height: 12px;
  color: var(--faint);
  transition: opacity var(--quick);
}
.thread-title:hover .icon,
.thread-title:focus-visible .icon {
  opacity: 1;
}
.thread-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding-left: 0;
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-sub .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}
.thread-sub .project-link {
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 550;
}
.thread-sub .project-link:hover {
  color: var(--accent);
}
.topbar__actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: none;
}
.topbar__divider {
  width: 1px;
  height: 20px;
  background: var(--line);
  margin: 0 5px;
}
.model-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  max-width: 240px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 500;
  transition: border-color var(--quick), background var(--quick), color var(--quick);
}
.model-pill:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--surface);
}
.model-pill__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-pill .icon {
  width: 12px;
  height: 12px;
  color: var(--faint);
}
.family-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
  background: var(--family-color, var(--faint));
}
.family--chat {
  --family-color: var(--forest);
}
.family--anthropic {
  --family-color: var(--accent);
}
.family--responses {
  --family-color: var(--sea);
}
.family--gemini {
  --family-color: var(--gold);
}
.family--mock {
  --family-color: var(--plum);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.status-pill::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}
.status-pill--busy {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ==========================================================================
   Buttons, inputs, pills, misc controls
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 550;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--quick) var(--ease), border-color var(--quick), color var(--quick),
    box-shadow var(--quick), transform var(--quick);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
}
.btn--primary {
  background: var(--btn-bg);
  color: var(--btn-fg);
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover {
  background: var(--btn-hover);
}
.btn--accent {
  background: var(--accent);
  color: #fdf7ef;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 22%, transparent);
}
.btn--accent:hover {
  background: var(--accent-hover);
}
.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-2);
}
.btn--ghost:hover {
  background: var(--hover);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn--quiet {
  background: transparent;
  color: var(--ink-2);
}
.btn--quiet:hover {
  background: var(--hover);
  color: var(--ink);
}
.btn--danger {
  background: var(--danger);
  color: #fff8f4;
}
.btn--danger:hover {
  filter: brightness(0.94);
}
.btn--danger-quiet {
  background: transparent;
  border-color: color-mix(in srgb, var(--danger) 38%, transparent);
  color: var(--danger);
}
.btn--danger-quiet:hover {
  background: var(--danger-soft);
}
.btn--sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 7px;
}
.btn--lg {
  height: 44px;
  padding: 0 18px;
  font-size: 14px;
  border-radius: 10px;
}
.btn--block {
  width: 100%;
}
.btn .icon {
  width: 15px;
  height: 15px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  transition: background var(--quick), color var(--quick), border-color var(--quick);
}
.icon-btn:hover {
  background: var(--hover);
  color: var(--ink);
}
.icon-btn:active {
  transform: translateY(1px);
}
.icon-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.icon-btn:disabled {
  opacity: 0.38;
}
.icon-btn--bordered {
  border-color: var(--line);
  background: var(--surface-raised);
}
.icon-btn--danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-raised);
  color: var(--ink);
  font-size: 13.5px;
  transition: border-color var(--quick), box-shadow var(--quick), background var(--quick);
}
.input,
.select {
  height: 38px;
  padding: 0 11px;
}
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}
.textarea {
  padding: 9px 11px;
  resize: vertical;
  min-height: 80px;
  line-height: 1.55;
}
.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--line-strong);
}
.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.input::placeholder,
.textarea::placeholder {
  color: var(--faint);
}
.input:disabled,
.textarea:disabled {
  opacity: 0.6;
  background: var(--surface-2);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field > label,
.field__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.01em;
}
.field__hint {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
}
.field__error {
  font-size: 11.5px;
  color: var(--danger);
  line-height: 1.45;
}
.field.has-error .input,
.field.has-error .textarea,
.field.has-error .select {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 12%, transparent);
}
.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.switch-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}
.switch-row:last-child {
  border-bottom: 0;
}
.switch-copy {
  min-width: 0;
}
.switch-copy strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}
.switch-copy span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
}
.switch {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--line-strong);
  border: 0;
  padding: 0;
  transition: background var(--quick);
  margin-top: 2px;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface-raised);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform var(--quick) var(--ease);
}
.switch[aria-checked="true"] {
  background: var(--accent);
}
.switch[aria-checked="true"]::after {
  transform: translateX(16px);
  background: #fff8f1;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.segmented button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  height: 28px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 550;
}
.segmented button:hover {
  color: var(--ink);
}
.segmented button[aria-pressed="true"] {
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.pill--accent {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.pill--forest {
  background: var(--forest-soft);
  color: var(--forest-ink);
}
.pill--gold {
  background: var(--gold-soft);
  color: var(--gold);
}
.pill--danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.pill .family-dot {
  width: 5px;
  height: 5px;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 18px 0;
}
.divider--soft {
  background: var(--line-soft);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--accent);
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.5;
}
.notice .icon {
  color: var(--muted);
  margin-top: 1px;
}
.notice--info {
  background: var(--accent-softer);
  border-color: color-mix(in srgb, var(--accent) 20%, var(--line));
}
.notice--info .icon {
  color: var(--accent);
}
.notice--warning {
  background: var(--gold-soft);
  border-color: color-mix(in srgb, var(--gold) 30%, var(--line));
}
.notice--warning .icon {
  color: var(--gold);
}
.notice--danger {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 25%, var(--line));
}
.notice--danger .icon {
  color: var(--danger);
}
.notice--success {
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 25%, var(--line));
}
.notice--success .icon {
  color: var(--success);
}
.notice__body {
  min-width: 0;
  flex: 1;
}
.notice__title {
  font-weight: 600;
  color: var(--ink);
}
.notice__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 56px 24px;
  color: var(--muted);
}
.empty-state__icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--muted);
  margin-bottom: 16px;
}
.empty-state h3 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 5px;
}
.empty-state p {
  font-size: 12.5px;
  line-height: 1.6;
  max-width: 320px;
}
.empty-state .btn {
  margin-top: 16px;
}

/* ==========================================================================
   Thread
   ========================================================================== */

.main-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  position: relative;
  overscroll-behavior: contain;
}

.thread {
  width: 100%;
  max-width: calc(var(--reading) + 64px);
  margin: 0 auto;
  padding: 34px 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.date-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 8px 0 -6px;
}
.date-divider::before,
.date-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line-soft);
}
.date-divider:first-child {
  margin-top: 0;
}
.date-divider:first-child::before {
  display: none;
}

.turn {
  position: relative;
  scroll-margin-top: 80px;
}
.thread.is-entering {
  animation: thread-in 240ms var(--ease-out) both;
}
@keyframes thread-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.turn.is-target {
  animation: target-pulse 1.8s var(--ease) both;
}
@keyframes target-pulse {
  0%,
  100% {
    background: transparent;
  }
  15%,
  60% {
    background: color-mix(in srgb, var(--gold-soft) 55%, transparent);
  }
}

.turn__head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  margin-bottom: 7px;
}
.turn__author {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  color: var(--ink-2);
  flex: none;
}
.turn--assistant .turn__author {
  color: var(--accent-ink);
  letter-spacing: 0.04em;
}
.turn__glyph {
  width: 16px;
  height: 16px;
  color: currentColor;
}
.turn__glyph svg {
  width: 100%;
  height: 100%;
}
.turn__user-mark {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8.5px;
  font-family: var(--font-sans);
  font-weight: 650;
  letter-spacing: 0.02em;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.turn__model {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding-left: 2px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}
.turn__time {
  font-size: 10.5px;
  color: var(--faint);
  letter-spacing: 0;
  font-weight: 450;
  text-transform: none;
  white-space: nowrap;
}
.turn__head-spacer {
  flex: 1;
}
.turn__actions {
  display: flex;
  align-items: center;
  gap: 1px;
  opacity: 0;
  transition: opacity var(--motion) var(--ease);
}
.turn:hover .turn__actions,
.turn:focus-within .turn__actions {
  opacity: 1;
}
.turn__actions .icon-btn {
  width: 27px;
  height: 27px;
  border-radius: 6px;
}
.turn__actions .icon-btn .icon {
  width: 14px;
  height: 14px;
}
.turn__actions .icon-btn.is-rated {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.turn__actions .icon-btn.is-rated-down {
  background: var(--danger-soft);
  color: var(--danger);
}
.turn__actions .action-divider {
  width: 1px;
  height: 13px;
  background: var(--line);
  margin: 0 3px;
}

.turn__body {
  position: relative;
  min-width: 0;
}
.turn--user .turn__body {
  padding: 14px 18px;
  background: var(--user-note);
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--accent);
  border-radius: 0 11px 11px 0;
  font-size: 14.5px;
  line-height: 1.62;
}
.turn--user .turn__head {
  margin-bottom: 8px;
}
.turn--assistant .turn__body {
  font-family: var(--font-serif);
  font-size: 17.5px;
  line-height: 1.72;
  color: var(--ink);
  letter-spacing: 0.001em;
}
:root[data-serif="off"] .turn--assistant .turn__body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.68;
}
:root[data-fontsize="large"] .turn--assistant .turn__body {
  font-size: 19px;
}
:root[data-fontsize="large"] .turn--user .turn__body,
:root[data-fontsize="large"] .composer textarea {
  font-size: 15.5px;
}

.turn__attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 280px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface-raised) 55%, transparent);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 11px;
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--quick), background var(--quick);
}
.attachment-pill:hover {
  border-color: var(--line-strong);
  background: var(--surface-raised);
  color: var(--ink);
}
.attachment-pill .icon {
  color: var(--accent);
  width: 13px;
  height: 13px;
  flex: none;
}
.attachment-pill__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-pill__meta {
  color: var(--faint);
  font-size: 10px;
  white-space: nowrap;
}
.attachment-pill--image {
  height: 52px;
  padding: 3px 9px 3px 3px;
}
.attachment-pill--image img {
  width: 44px;
  height: 44px;
  border-radius: 5px;
  object-fit: cover;
  background: var(--surface-2);
}
.attachment-pill--image .attachment-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border-radius: 5px;
  color: var(--muted);
}

.turn__body > *:first-child {
  margin-top: 0;
}
.turn__body > *:last-child {
  margin-bottom: 0;
}

/* Prose --------------------------------------------------------------- */

.prose {
  overflow-wrap: break-word;
  word-break: break-word;
}
.prose p {
  margin: 0 0 0.95em;
}
.prose p:last-child {
  margin-bottom: 0;
}
.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 550;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 1.7em 0 0.55em;
  text-wrap: balance;
}
.prose h1 {
  font-size: 1.62em;
}
.prose h2 {
  font-size: 1.4em;
  margin-top: 1.6em;
}
.prose h3 {
  font-size: 1.18em;
  margin-top: 1.4em;
}
.prose h4,
.prose h5,
.prose h6 {
  font-size: 1em;
  font-family: var(--font-sans);
  font-weight: 650;
  letter-spacing: 0;
}
.prose h1:first-child,
.prose h2:first-child,
.prose h3:first-child {
  margin-top: 0;
}
.prose strong,
.prose b {
  font-weight: 650;
  color: var(--ink);
}
.prose em {
  font-family: var(--font-serif);
  font-style: italic;
}
:root[data-serif="off"] .prose em {
  font-family: inherit;
}
.prose del {
  color: var(--muted);
}
.prose a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.prose a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}
.prose .link-glyph {
  display: inline;
  vertical-align: -1px;
  margin-left: 1px;
  opacity: 0.5;
}
.prose ul,
.prose ol {
  margin: 0.5em 0 1em;
  padding-left: 1.35em;
}
.prose li {
  margin: 0.32em 0;
  padding-left: 0.25em;
}
.prose li::marker {
  color: var(--faint);
}
.prose ul.md-list {
  list-style: disc;
}
.prose ol.md-list {
  list-style: decimal;
}
.prose .md-list .md-list {
  margin: 0.35em 0 0.35em;
}
.prose li > p {
  margin: 0.2em 0;
}
.prose .task-box {
  display: inline-flex;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  vertical-align: -2px;
  align-items: center;
  justify-content: center;
  color: var(--surface);
  background: var(--surface-raised);
}
.prose .task-box.is-done {
  background: var(--forest);
  border-color: var(--forest);
}
.prose blockquote {
  margin: 1.15em 0;
  padding: 2px 0 2px 18px;
  border-left: 2px solid var(--accent);
  color: var(--ink-2);
  font-style: italic;
}
.prose blockquote p {
  margin: 0.35em 0;
}
.prose hr {
  margin: 1.7em 0;
  border-color: var(--line);
}
.prose .inline-code {
  font-family: var(--font-mono);
  font-size: 0.79em;
  padding: 0.14em 0.34em;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  color: var(--ink);
  white-space: break-spaces;
}
.prose .table-wrap {
  margin: 1.15em 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
}
.prose table {
  border-collapse: collapse;
  width: 100%;
  min-width: 360px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.5;
}
.prose th,
.prose td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}
.prose th {
  background: color-mix(in srgb, var(--surface-2) 45%, transparent);
  color: var(--ink-2);
  font-weight: 650;
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.prose tr:last-child td {
  border-bottom: 0;
}
.prose .ta-right {
  text-align: right;
}
.prose .ta-center {
  text-align: center;
}
.prose .md-image {
  display: block;
  margin: 1em 0;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  width: fit-content;
  max-width: 100%;
}
.prose .md-image img {
  max-width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
}
.prose .cite-wrap {
  line-height: 0;
}
.prose .cite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;
  height: 14px;
  padding: 0 4px;
  margin: 0 1px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 650;
  text-decoration: none;
  vertical-align: 2px;
  line-height: 1;
}
.prose .cite:hover {
  background: var(--accent);
  color: #fff8f1;
}

/* Code ---------------------------------------------------------------- */

.code-block {
  margin: 1.1em 0;
  border: 1px solid var(--code-line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--code-bg);
  color: var(--code-ink);
  font-family: var(--font-sans);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  padding: 0 8px 0 12px;
  background: var(--code-head);
  border-bottom: 1px solid var(--code-line);
}
.code-lang {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9c9381;
}
.code-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: #a59c8b;
  font-size: 10.5px;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color var(--quick), background var(--quick);
}
.code-copy:hover {
  color: #efe7d8;
  background: rgba(255, 255, 255, 0.06);
}
.code-copy.is-copied {
  color: #a6caae;
}
.code-copy .icon {
  width: 12px;
  height: 12px;
}
.code-block pre {
  margin: 0;
  padding: 13px 15px 15px;
  overflow: auto;
  max-height: 540px;
  scrollbar-color: #4a4436 transparent;
}
.code-block code {
  display: block;
  font-family: var(--font-mono);
  font-size: 12.2px;
  line-height: 1.62;
  color: var(--code-ink);
  white-space: pre;
  tab-size: 2;
  font-variant-ligatures: none;
}
.code-block code .tok-com {
  color: #847b69;
  font-style: italic;
}
.code-block code .tok-str {
  color: #c5a875;
}
.code-block code .tok-num {
  color: #d39072;
}
.code-block code .tok-kw {
  color: #e0a184;
}
.code-block code .tok-fn {
  color: #d9c9a0;
}
.code-block code .tok-bool {
  color: #b8a4c7;
}
.code-block code .tok-type {
  color: #a9c2af;
}
.code-block code .tok-tag {
  color: #df9c81;
}
.code-block code .tok-attr {
  color: #c8b578;
}
.code-block code .tok-add {
  color: #8fbc9a;
}
.code-block code .tok-del {
  color: #d78d7d;
}
.code-block code .tok-meta {
  color: #9a9180;
}

/* Math ---------------------------------------------------------------- */

.math {
  font-family: var(--font-serif);
  font-style: normal;
  white-space: nowrap;
}
.math.is-failed {
  font-family: var(--font-mono);
  font-size: 0.86em;
  color: var(--accent-ink);
  white-space: pre-wrap;
}
.math--display,
.math-block {
  display: block;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 0;
}
.math-block {
  margin: 1em 0;
}
.katex {
  font-size: 1.03em;
}
.math-block .katex-display {
  margin: 0;
}
.katex-display > .katex {
  white-space: normal;
}

/* Streaming, reasoning, notices, usage -------------------------------- */

.stream-caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 3px;
  background: var(--accent);
  vertical-align: -0.12em;
  animation: caret 1s steps(1) infinite;
}
@keyframes caret {
  50% {
    opacity: 0;
  }
}
.composing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--accent-ink);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.composing__bars {
  display: inline-flex;
  gap: 2px;
  align-items: flex-end;
  height: 9px;
}
.composing__bars i {
  width: 2px;
  background: var(--accent);
  border-radius: 1px;
  animation: compose 900ms var(--ease) infinite;
}
.composing__bars i:nth-child(1) {
  height: 4px;
  animation-delay: 0ms;
}
.composing__bars i:nth-child(2) {
  height: 8px;
  animation-delay: 120ms;
}
.composing__bars i:nth-child(3) {
  height: 6px;
  animation-delay: 240ms;
}
@keyframes compose {
  0%,
  100% {
    opacity: 0.35;
    transform: scaleY(0.7);
  }
  40% {
    opacity: 1;
    transform: scaleY(1);
  }
}

.reasoning {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 28%, transparent);
  overflow: hidden;
}
.reasoning summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 11px;
  color: var(--muted);
  font-weight: 550;
  list-style: none;
  user-select: none;
}
.reasoning summary::-webkit-details-marker {
  display: none;
}
.reasoning summary .icon {
  width: 13px;
  height: 13px;
  transition: transform var(--quick) var(--ease);
}
.reasoning[open] summary .icon {
  transform: rotate(90deg);
}
.reasoning summary .reasoning-note {
  margin-left: auto;
  font-weight: 450;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.02em;
}
.reasoning__body {
  padding: 2px 13px 13px;
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
  white-space: pre-wrap;
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
  max-height: 360px;
  overflow: auto;
}
.reasoning.is-live summary {
  color: var(--accent-ink);
}

.sources {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.sources__head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.sources__head .icon {
  width: 12px;
  height: 12px;
}
.sources__list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.source-link {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 7px 6px;
  margin: 0 -6px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink-2);
}
.source-link:hover {
  background: var(--hover);
  color: var(--ink);
}
.source-link__num {
  width: 17px;
  height: 17px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 650;
  flex: none;
  margin-top: 2px;
}
.source-link__body {
  min-width: 0;
}
.source-link__title {
  display: block;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 550;
  color: var(--ink);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-link__domain {
  display: block;
  font-family: var(--font-sans);
  font-size: 10px;
  color: var(--faint);
  margin-top: 1px;
}
.source-link__snippet {
  display: block;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.source-link > .icon {
  margin-left: auto;
  width: 11px;
  height: 11px;
  color: var(--faint);
  opacity: 0;
  margin-top: 4px;
}
.source-link:hover > .icon {
  opacity: 1;
}

.search-activity {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  background: var(--surface-raised);
}
.search-activity .icon {
  width: 12px;
  height: 12px;
  color: var(--accent);
}

.message-notice {
  margin-top: 14px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.5;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--ink-2);
}
.message-notice .icon {
  flex: none;
  margin-top: 1px;
  color: var(--muted);
  width: 15px;
  height: 15px;
}
.message-notice__body {
  min-width: 0;
  flex: 1;
}
.message-notice--error {
  border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
  background: var(--danger-soft);
  color: var(--danger);
}
.message-notice--error .icon {
  color: var(--danger);
}
.message-notice--error .message-notice__body {
  color: var(--ink-2);
}
.message-notice--error strong {
  color: var(--danger);
}
.message-notice--stopped {
  border-color: color-mix(in srgb, var(--gold) 28%, var(--line));
  background: color-mix(in srgb, var(--gold-soft) 55%, var(--surface));
  color: var(--ink-2);
}
.message-notice--stopped .icon {
  color: var(--gold);
}
.message-notice--info {
  background: var(--accent-softer);
  border-color: color-mix(in srgb, var(--accent) 15%, var(--line));
}
.message-notice__actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.message-notice details {
  margin-top: 6px;
}
.message-notice summary {
  cursor: pointer;
  font-size: 10.5px;
  color: var(--muted);
}
.message-notice details pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--muted);
  margin: 6px 0 0;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  max-height: 160px;
  overflow: auto;
}

.turn__usage {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
  font-family: var(--font-sans);
  font-size: 10px;
  color: var(--faint);
  letter-spacing: 0.01em;
}
.turn__usage .sep {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}
.turn__usage button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--faint);
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.turn__usage button:hover {
  color: var(--ink-2);
}
.turn__usage .icon {
  width: 11px;
  height: 11px;
}
.turn__usage .rated-up {
  color: var(--success);
}
.turn__usage .rated-down {
  color: var(--danger);
}

.turn-divider {
  height: 1px;
  background: var(--line-soft);
  margin: 0 0 2px;
}

.load-older {
  align-self: center;
  margin-bottom: -8px;
}

.jump-latest {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 550;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion), transform var(--motion);
}
.jump-latest.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.jump-latest:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}
.jump-latest .icon {
  width: 12px;
  height: 12px;
}

.thread-status-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--faint);
  font-size: 10.5px;
  padding: 4px 0 0;
  min-height: 18px;
}
.thread-status-line .spinner {
  width: 11px;
  height: 11px;
}

/* ==========================================================================
   Composer
   ========================================================================== */

.composer-dock {
  position: relative;
  flex: none;
  z-index: 12;
  padding: 10px 24px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(
    to top,
    var(--surface) 0%,
    var(--surface) 74%,
    color-mix(in srgb, var(--surface) 72%, transparent) 91%,
    transparent 100%
  );
}
.composer-wrap {
  width: 100%;
  max-width: calc(var(--reading) + 64px);
  margin: 0 auto;
}
.composer {
  position: relative;
  padding: 11px 12px 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface-raised);
  box-shadow: 0 2px 3px rgba(60, 43, 20, 0.035), 0 14px 35px -24px rgba(60, 43, 20, 0.35);
  transition: border-color var(--motion), box-shadow var(--motion), background var(--motion);
}
.composer:focus-within {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line-strong));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 9%, transparent),
    0 16px 40px -26px rgba(60, 43, 20, 0.4);
}
.composer.is-disabled {
  opacity: 0.78;
}
.composer textarea {
  display: block;
  width: 100%;
  min-height: 27px;
  max-height: 260px;
  padding: 4px 2px 3px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.58;
  overflow-y: hidden;
}
.composer textarea::placeholder {
  color: var(--faint);
}
.composer__context {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 7px;
}
.context-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10.5px;
  max-width: 320px;
}
.context-chip .icon {
  width: 11px;
  height: 11px;
  color: var(--accent);
  flex: none;
}
.context-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.context-chip button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--faint);
  display: inline-flex;
}
.context-chip button:hover {
  color: var(--danger);
}
.context-chip--project {
  color: var(--forest-ink);
  background: var(--forest-soft);
  border-color: color-mix(in srgb, var(--forest) 18%, transparent);
}
.context-chip--search {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 18%, transparent);
}

.composer__attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 7px;
}
.attach-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 250px;
  min-height: 38px;
  padding: 5px 28px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}
.attach-chip.is-error {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
  background: var(--danger-soft);
}
.attach-chip__thumb {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  overflow: hidden;
}
.attach-chip__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.attach-chip__thumb .icon {
  width: 14px;
  height: 14px;
}
.attach-chip__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.attach-chip__name {
  font-size: 11px;
  font-weight: 550;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}
.attach-chip__meta {
  font-size: 9.5px;
  color: var(--faint);
  white-space: nowrap;
}
.attach-chip.is-error .attach-chip__meta {
  color: var(--danger);
}
.attach-chip__remove {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--faint);
  padding: 0;
}
.attach-chip__remove:hover {
  background: var(--hover-strong);
  color: var(--ink);
}
.attach-chip__remove .icon {
  width: 11px;
  height: 11px;
}
.attach-chip__progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--line-soft);
}
.attach-chip__progress span {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  background: var(--accent);
  transition: width 160ms linear;
}
.attach-chip__retry {
  border: 0;
  background: transparent;
  color: var(--accent-ink);
  font-size: 9.5px;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.attach-chip.is-uploading .attach-chip__meta {
  color: var(--muted);
}

.composer__bar {
  display: flex;
  align-items: center;
  gap: 3px;
  min-height: 34px;
  margin-top: 2px;
}
.composer__tools {
  display: flex;
  align-items: center;
  gap: 1px;
  min-width: 0;
  flex: 1;
}
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--quick), color var(--quick), border-color var(--quick);
}
.tool-btn .icon {
  width: 15px;
  height: 15px;
}
.tool-btn:hover {
  background: var(--hover);
  color: var(--ink);
}
.tool-btn.is-on {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.tool-btn:disabled {
  opacity: 0.4;
}
.tool-divider {
  width: 1px;
  height: 14px;
  background: var(--line);
  margin: 0 3px;
}
.composer__send-area {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
}
.composer-model {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 29px;
  max-width: 220px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  transition: background var(--quick), color var(--quick), border-color var(--quick);
}
.composer-model:hover {
  background: var(--hover);
  color: var(--ink-2);
}
.composer-model span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.composer-model .icon {
  width: 11px;
  height: 11px;
  color: var(--faint);
  flex: none;
}
.send-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff9f2;
  transition: background var(--quick), transform var(--quick), opacity var(--quick);
  box-shadow: 0 2px 7px color-mix(in srgb, var(--accent) 26%, transparent);
}
.send-btn:hover {
  background: var(--accent-hover);
}
.send-btn:active {
  transform: translateY(1px);
}
.send-btn:disabled {
  background: var(--surface-2);
  color: var(--faint);
  box-shadow: none;
  opacity: 0.75;
}
.send-btn .icon {
  width: 16px;
  height: 16px;
}
.send-btn.is-stop {
  background: var(--ink);
  color: var(--surface);
}
.send-btn.is-stop:hover {
  background: var(--ink-2);
}
.send-btn.is-stop .icon {
  width: 13px;
  height: 13px;
}
.composer.is-streaming textarea {
  color: var(--ink-2);
}
.composer__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: calc(var(--reading) + 64px);
  margin: 0 auto;
  padding: 6px 3px 0;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.4;
}
.composer__foot-left,
.composer__foot-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.composer__foot kbd {
  height: 16px;
  min-width: 16px;
  font-size: 8.5px;
  padding: 0 3px;
  background: transparent;
  border-color: var(--line);
}
.composer__foot .hint-dot {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--faint);
}
.composer__search-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent-ink);
}
.composer__search-hint .icon {
  width: 10px;
  height: 10px;
}
.composer__save {
  opacity: 0;
  transition: opacity var(--motion);
}
.composer__save.is-visible {
  opacity: 1;
}
.composer__save .icon {
  display: inline-block;
  width: 9px;
  height: 9px;
  vertical-align: -1px;
  margin-right: 2px;
  color: var(--success);
}

.drop-overlay {
  position: absolute;
  inset: 10px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1.5px dashed var(--accent);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--accent-softer) 92%, transparent);
  color: var(--accent-ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion);
  backdrop-filter: blur(1px);
}
.drop-overlay.is-visible {
  opacity: 1;
}
.drop-overlay__inner {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 17px;
}
.drop-overlay .icon {
  width: 22px;
  height: 22px;
}

/* Composer extension panels */

.tune-panel {
  width: 320px;
  padding: 15px;
}
.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}
.panel-heading h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 550;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.panel-heading p {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.45;
}
.tune-row {
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
}
.tune-row:first-of-type {
  border-top: 0;
}
.tune-row__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  font-weight: 550;
  color: var(--ink-2);
  margin-bottom: 7px;
}
.tune-row__value {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 450;
}
input[type="range"] {
  width: 100%;
  height: 16px;
  appearance: none;
  background: transparent;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 2px;
  background: var(--line-strong);
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -5px;
  border-radius: 50%;
  border: 2px solid var(--surface-raised);
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
input[type="range"]::before {
  display: none;
}
.tune-note {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  color: var(--faint);
  font-size: 10px;
  line-height: 1.5;
}
.tune-note .icon {
  width: 12px;
  height: 12px;
  flex: none;
  margin-top: 1px;
}
.tune-select {
  width: 100%;
}

.prompt-picker {
  width: 340px;
  padding: 8px;
}
.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 7px 8px;
}
.picker-head__title {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.picker-list {
  display: flex;
  flex-direction: column;
  max-height: 280px;
  overflow-y: auto;
}
.picker-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  color: var(--ink-2);
}
.picker-item:hover,
.picker-item:focus-visible {
  background: var(--hover);
  color: var(--ink);
}
.picker-item__icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.picker-item__icon .icon {
  width: 13px;
  height: 13px;
}
.picker-item__body {
  min-width: 0;
  flex: 1;
}
.picker-item__title {
  font-size: 12px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picker-item__body p {
  margin-top: 1px;
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.picker-item__remove {
  border: 0;
  background: transparent;
  color: var(--faint);
  padding: 2px;
  border-radius: 4px;
  display: inline-flex;
}
.picker-item__remove:hover {
  color: var(--danger);
  background: var(--danger-soft);
}
.picker-empty {
  padding: 18px 12px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
}
.picker-foot {
  border-top: 1px solid var(--line-soft);
  padding: 7px;
  margin-top: 4px;
  display: flex;
  gap: 6px;
  justify-content: space-between;
}
.picker-foot .btn {
  font-size: 11px;
}

/* Model picker */

.model-picker {
  width: 430px;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.model-picker__search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
}
.model-picker__search .icon {
  color: var(--muted);
  width: 15px;
  height: 15px;
}
.model-picker__search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--ink);
}
.model-picker__search input::placeholder {
  color: var(--faint);
}
.model-picker__list {
  max-height: 330px;
  overflow-y: auto;
  padding: 5px;
}
.model-group-label {
  padding: 8px 9px 5px;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.model-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 40px;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  color: var(--ink-2);
}
.model-item:hover,
.model-item:focus-visible,
.model-item.is-highlighted {
  background: var(--hover);
  color: var(--ink);
}
.model-item.is-selected {
  background: var(--accent-softer);
  color: var(--ink);
}
.model-item__main {
  min-width: 0;
  flex: 1;
}
.model-item__name {
  display: block;
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.model-item__id {
  display: block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.model-item__tags {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: none;
}
.model-item__tags .pill {
  height: 17px;
  padding: 0 5px;
  font-size: 8.5px;
}
.model-item__check {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex: none;
}
.model-item__check .icon {
  width: 14px;
  height: 14px;
}
.model-picker__empty {
  padding: 28px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.model-picker__details {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 30%, var(--surface-raised));
  padding: 10px 13px 11px;
  min-height: 78px;
}
.model-detail__name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
}
.model-detail__family {
  font-size: 10px;
  color: var(--muted);
  margin-top: 1px;
}
.model-detail__caps {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 7px;
}
.cap-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 19px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 9px;
  font-weight: 550;
}
.cap-chip .icon {
  width: 9px;
  height: 9px;
  color: var(--success);
}
.cap-chip.is-off {
  color: var(--faint);
  border-style: dashed;
}
.cap-chip.is-off .icon {
  color: var(--faint);
}
.model-detail__note {
  margin-top: 6px;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.45;
}
.model-detail__limits {
  margin-top: 4px;
  font-size: 9.5px;
  color: var(--faint);
}

/* ==========================================================================
   Welcome
   ========================================================================== */

.welcome {
  width: 100%;
  max-width: calc(var(--reading) + 96px);
  margin: 0 auto;
  padding: clamp(38px, 8vh, 92px) 36px 30px;
  position: relative;
}
.welcome__head {
  position: relative;
  max-width: 640px;
}
.welcome__head::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 12px;
  bottom: 4px;
  width: 1px;
  background: linear-gradient(to bottom, var(--accent) 0 34px, var(--line) 34px);
  opacity: 0.55;
}
.welcome__eyebrow {
  margin-bottom: 20px;
}
.welcome h1 {
  font-family: var(--font-display);
  font-size: clamp(39px, 5.1vw, 58px);
  font-weight: 450;
  line-height: 1.03;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin: 0;
  text-wrap: balance;
}
.welcome h1 em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.025em;
  color: var(--accent);
}
.welcome__lede {
  max-width: 520px;
  margin-top: 18px;
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--muted);
}
.welcome__lede strong {
  color: var(--ink-2);
  font-weight: 550;
}
.starters {
  margin-top: clamp(30px, 4.6vh, 46px);
  border-top: 1px solid var(--line);
  max-width: 700px;
}
.starter {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 57px;
  padding: 10px 8px 10px 4px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  text-align: left;
  color: var(--ink-2);
  transition: padding-left var(--motion) var(--ease), background var(--quick), color var(--quick);
}
.starter:hover {
  padding-left: 12px;
  background: linear-gradient(90deg, var(--accent-softer), transparent 72%);
  color: var(--ink);
}
.starter__cat {
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.starter__title {
  font-family: var(--font-display);
  font-size: 17.5px;
  font-weight: 480;
  letter-spacing: -0.012em;
  line-height: 1.28;
  color: var(--ink);
}
.starter__title em {
  font-family: var(--font-serif);
  color: var(--muted);
  font-size: 0.9em;
}
.starter__arrow {
  color: var(--faint);
  display: flex;
  transition: transform var(--motion) var(--ease), color var(--quick);
}
.starter__arrow .icon {
  width: 16px;
  height: 16px;
}
.starter:hover .starter__arrow {
  transform: translateX(3px);
  color: var(--accent);
}
.welcome__recent {
  max-width: 700px;
  margin-top: 34px;
}
.welcome__recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  font-weight: 650;
}
.welcome__recent-head button {
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: 9.5px;
  text-transform: none;
  letter-spacing: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.welcome__recent-head button:hover {
  color: var(--accent);
}
.recent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 5px 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  text-align: left;
}
.recent-row:hover {
  background: var(--hover);
  color: var(--ink);
}
.recent-row__title {
  min-width: 0;
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-row__time {
  font-size: 9.5px;
  color: var(--faint);
  flex: none;
}
.recent-row__icon {
  color: var(--faint);
  flex: none;
  display: flex;
}
.recent-row__icon .icon {
  width: 12px;
  height: 12px;
}
.welcome__fineprint {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 28px;
  color: var(--faint);
  font-size: 10px;
}
.welcome__fineprint .icon {
  width: 11px;
  height: 11px;
}
.welcome__fineprint kbd {
  height: 15px;
  min-width: 15px;
  font-size: 8px;
}
.welcome__fineprint-extras {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.welcome-empty {
  padding: 20vh 32px;
  text-align: center;
  color: var(--muted);
}

/* Skeleton */
.thread-skeleton {
  max-width: calc(var(--reading) + 64px);
  margin: 0 auto;
  padding: 52px 32px;
}
.sk-line {
  height: 13px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--hover-strong) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
  margin-bottom: 11px;
}
.sk-line--eyebrow {
  width: 120px;
  height: 9px;
  margin-bottom: 24px;
}
.sk-line--title {
  width: 46%;
  height: 20px;
  margin-bottom: 26px;
}
.sk-line:nth-child(3n) {
  width: 86%;
}
.sk-line:nth-child(4n) {
  width: 64%;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ==========================================================================
   Collections (starred, archive, folders, projects)
   ========================================================================== */

.collection {
  width: 100%;
  max-width: calc(var(--reading) + 96px);
  margin: 0 auto;
  padding: 44px 36px 40px;
}
.collection__head {
  display: flex;
  align-items: flex-start;
  gap: 22px;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.collection__eyebrow {
  margin-bottom: 10px;
}
.collection h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 450;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: var(--ink);
}
.collection__desc {
  max-width: 560px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}
.collection__actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  flex: none;
}
.collection-list {
  margin-top: 8px;
}
.collection-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 8px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  text-align: left;
  color: var(--ink);
  transition: background var(--quick), padding-left var(--motion);
}
.collection-row:hover {
  background: linear-gradient(90deg, var(--hover), transparent 78%);
  padding-left: 13px;
}
.collection-row__main {
  flex: 1;
  min-width: 0;
}
.collection-row__title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 480;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.collection-row__preview {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 620px;
}
.collection-row__meta {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--faint);
  font-size: 10px;
}
.collection-row__marks {
  display: inline-flex;
  gap: 4px;
  color: var(--accent);
}
.collection-row__marks .icon {
  width: 12px;
  height: 12px;
}
.collection-row__actions {
  display: flex;
  gap: 2px;
  flex: none;
}
.collection-row__actions .icon-btn {
  width: 26px;
  height: 26px;
}
.collection-row__actions .icon {
  width: 13px;
  height: 13px;
}
.collection__date {
  margin-top: 26px;
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  font-weight: 650;
  padding: 0 8px 5px;
}

.project-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 26px;
  margin-top: 26px;
}
.project-instructions {
  position: relative;
  padding: 18px 20px;
  background: var(--user-note);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.project-instructions h2,
.project-docs h2 {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.project-instructions p {
  font-family: var(--font-serif);
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink-2);
  white-space: pre-wrap;
}
.project-instructions .btn {
  margin-top: 12px;
}
.doc-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.doc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  margin: 0 -6px;
  border-radius: 6px;
}
.doc-row:hover {
  background: var(--hover);
}
.doc-row__icon {
  width: 26px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex: none;
}
.doc-row__icon .icon {
  width: 13px;
  height: 13px;
}
.doc-row__body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0;
  font: inherit;
  cursor: pointer;
}
.doc-row__body:hover .doc-row__name {
  color: var(--accent);
}
.doc-row__name {
  font-size: 11.5px;
  font-weight: 550;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-row__meta {
  font-size: 9.5px;
  color: var(--faint);
}
.doc-row__actions {
  display: flex;
  gap: 2px;
}
.doc-row__actions .icon-btn {
  width: 24px;
  height: 24px;
}
.doc-empty {
  padding: 12px 4px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.55;
}
.project-docs .btn {
  margin-top: 10px;
}
.project-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.project-meta-strip .pill {
  height: 24px;
}

.collection-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 0 4px;
}
.collection-toolbar .input {
  height: 32px;
  max-width: 280px;
  font-size: 12px;
}
.collection-empty {
  border-bottom: 1px solid var(--line-soft);
}
.trash-note {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  font-size: 10.5px;
  margin-top: 10px;
}
.trash-note .icon {
  width: 11px;
  height: 11px;
}

/* ==========================================================================
   Popovers and menus
   ========================================================================== */

.popover {
  position: fixed;
  z-index: 1250;
  min-width: 200px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  color: var(--ink);
  animation: pop-in 150ms var(--ease-out) both;
}
.popover.is-closing {
  animation: pop-out 120ms var(--ease) both;
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes pop-out {
  to {
    opacity: 0;
    transform: translateY(-3px) scale(0.99);
  }
}
.menu {
  position: fixed;
  z-index: 1300;
  min-width: 210px;
  max-width: 290px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  animation: pop-in 150ms var(--ease-out) both;
}
.menu__item {
  display: grid;
  grid-template-columns: 19px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 32px;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12px;
  text-align: left;
  line-height: 1.35;
}
.menu__item:hover,
.menu__item:focus-visible {
  background: var(--hover-strong);
  color: var(--ink);
  outline: none;
}
.menu__item:disabled {
  opacity: 0.4;
}
.menu__item--danger {
  color: var(--danger);
}
.menu__item--danger:hover,
.menu__item--danger:focus-visible {
  background: var(--danger-soft);
  color: var(--danger);
}
.menu__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  width: 19px;
}
.menu__item--danger .menu__icon {
  color: currentColor;
}
.menu__icon .icon {
  width: 14px;
  height: 14px;
}
.menu__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu__desc {
  grid-column: 2 / 3;
  color: var(--faint);
  font-size: 9.5px;
  margin-top: -1px;
}
.menu__shortcut {
  color: var(--faint);
  font-size: 9px;
  margin-left: 13px;
  font-variant-numeric: tabular-nums;
}
.menu__separator {
  height: 1px;
  background: var(--line-soft);
  margin: 5px 4px;
}
.menu__heading {
  padding: 7px 8px 4px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.menu__check {
  color: var(--accent);
}

/* ==========================================================================
   Toasts
   ========================================================================== */

.toast-host {
  position: fixed;
  right: 18px;
  top: 74px;
  z-index: 2200;
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-width: min(380px, calc(100vw - 28px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 8px 8px 8px 11px;
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--ink-2);
  border-radius: 9px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.4;
  animation: toast-in 220ms var(--ease-out) both;
}
.toast--success {
  border-left-color: var(--success);
}
.toast--error {
  border-left-color: var(--danger);
}
.toast__icon {
  color: var(--muted);
  display: flex;
  flex: none;
}
.toast--error .toast__icon {
  color: var(--danger);
}
.toast--success .toast__icon {
  color: var(--success);
}
.toast__message {
  flex: 1;
  min-width: 0;
}
.toast__action {
  border: 0;
  background: transparent;
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 4px;
  flex: none;
}
.toast__action:hover {
  background: var(--accent-soft);
}
.toast__close {
  border: 0;
  background: transparent;
  color: var(--faint);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex: none;
}
.toast__close:hover {
  background: var(--hover);
  color: var(--ink);
}
.toast.is-leaving {
  animation: toast-out 170ms var(--ease) both;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(4px);
  }
}

/* ==========================================================================
   Modals
   ========================================================================== */

dialog.modal {
  width: calc(100% - 32px);
  max-width: 560px;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}
dialog.modal--sm {
  max-width: 420px;
}
dialog.modal--lg {
  max-width: 720px;
}
dialog.modal--xl {
  max-width: 900px;
}
dialog.modal::backdrop {
  background: var(--backdrop);
  backdrop-filter: blur(2px);
  animation: backdrop-in 180ms var(--ease) both;
}
@keyframes backdrop-in {
  from {
    opacity: 0;
  }
}
.modal__card {
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-in 240ms var(--ease-out) both;
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.988);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.modal__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 22px 0;
}
.modal__heading {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  flex: 1;
  min-width: 0;
}
.modal__icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  margin-top: -2px;
}
.modal__title {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.modal__subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}
.modal__close {
  flex: none;
  margin: -4px -7px 0 0;
}
.modal__body {
  padding: 17px 22px 22px;
  max-height: 72vh;
  overflow-y: auto;
}
.modal__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 13px 22px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 22%, transparent);
}
.modal__foot:empty {
  display: none;
}
.modal__foot .modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  justify-content: flex-end;
}
.confirm-copy p {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-2);
}
.confirm-details {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}
.form-modal {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.inline-field {
  display: flex;
  gap: 7px;
}
.inline-field .input {
  flex: 1;
}
.code-secret {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.07em;
  color: var(--ink);
  user-select: all;
}
.code-secret span {
  flex: 1;
  word-break: break-all;
}
.modal-lead {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 14px;
}
.modal-note {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.modal-note .icon {
  width: 13px;
  height: 13px;
  flex: none;
  margin-top: 1px;
}
.share-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.share-link input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-2);
}
.share-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  margin: 14px 0;
}
.share-controls .field {
  min-width: 0;
}
.share-controls .select {
  height: 32px;
  font-size: 11.5px;
}
.share-meta {
  font-size: 10.5px;
  color: var(--faint);
  line-height: 1.5;
}
.recovery-card {
  text-align: center;
  padding: 5px 0;
}
.recovery-card__icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.recovery-card p {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 14px;
}
.file-preview {
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: var(--surface);
}
.file-preview__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-2);
}
.file-preview__head .icon {
  color: var(--accent);
  width: 13px;
  height: 13px;
}
.file-preview pre {
  margin: 0;
  padding: 12px;
  max-height: 300px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.55;
  color: var(--ink-2);
}

/* ==========================================================================
   Command palette
   ========================================================================== */

dialog.palette {
  width: min(640px, calc(100vw - 30px));
  margin: 10vh auto auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}
dialog.palette::backdrop {
  background: var(--backdrop);
  backdrop-filter: blur(3px);
  animation: backdrop-in 160ms var(--ease) both;
}
.palette__card {
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-in 220ms var(--ease-out) both;
}
.palette__search {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--line);
}
.palette__search .icon {
  color: var(--muted);
  width: 18px;
  height: 18px;
}
.palette__search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 16px;
  font-weight: 450;
  color: var(--ink);
}
.palette__search input::placeholder {
  color: var(--faint);
}
.palette__esc {
  flex: none;
}
.palette__list {
  max-height: min(430px, 55vh);
  overflow-y: auto;
  padding: 7px;
}
.palette__group {
  padding: 9px 9px 4px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.palette__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 6px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  text-align: left;
}
.palette__item:hover,
.palette__item.is-selected {
  background: var(--accent-softer);
  color: var(--ink);
}
.palette__item.is-selected {
  box-shadow: inset 2px 0 0 var(--accent);
}
.palette__icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.palette__item.is-selected .palette__icon {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.palette__icon .icon {
  width: 13px;
  height: 13px;
}
.palette__body {
  min-width: 0;
  flex: 1;
}
.palette__title {
  display: block;
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.palette__sub {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.palette__item mark {
  background: var(--gold-soft);
  color: var(--ink);
  border-radius: 2px;
  padding: 0 1px;
}
.palette__shortcut {
  font-size: 9px;
  color: var(--faint);
  flex: none;
}
.palette__empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.palette__foot {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 9px 15px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 24%, transparent);
  color: var(--faint);
  font-size: 9.5px;
  flex-wrap: wrap;
}
.palette__foot span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.palette__foot kbd {
  height: 16px;
  min-width: 16px;
  font-size: 8px;
  padding: 0 3px;
}
.palette__spinner {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 9.5px;
  color: var(--faint);
}
.palette__spinner .spinner {
  width: 11px;
  height: 11px;
}

/* Shortcuts dialog */
.shortcut-grid {
  display: flex;
  flex-direction: column;
}
.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--ink-2);
}
.shortcut-row:last-child {
  border-bottom: 0;
}
.shortcut-row .keys {
  display: flex;
  gap: 4px;
  flex: none;
}

/* ==========================================================================
   Settings
   ========================================================================== */

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  animation: settings-in 260ms var(--ease-out) both;
}
@keyframes settings-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}
.settings-topbar {
  flex: none;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.settings-topbar .brand {
  flex: none;
  padding-right: 4px;
}
.settings-topbar__spacer {
  flex: 1;
}
.settings-topbar .btn {
  height: 32px;
  font-size: 12px;
}
.settings-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  overflow: hidden;
}
.settings-nav {
  min-height: 0;
  overflow-y: auto;
  padding: 30px 16px 40px 22px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}
.settings-nav__title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin: 0 8px 3px;
}
.settings-nav__sub {
  margin: 0 8px 22px;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.5;
}
.settings-nav__group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 18px;
}
.settings-nav__label {
  padding: 0 9px 5px;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
}
.settings-nav__item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 33px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  text-align: left;
  font-size: 12.5px;
}
.settings-nav__item:hover {
  background: var(--hover);
  color: var(--ink);
}
.settings-nav__item.is-active {
  background: var(--selected);
  color: var(--ink);
  font-weight: 550;
}
.settings-nav__item .icon {
  width: 15px;
  height: 15px;
  color: var(--muted);
}
.settings-nav__item.is-active .icon {
  color: var(--accent);
}
.settings-nav__item .badge {
  margin-left: auto;
  font-size: 9px;
  color: var(--faint);
}
.settings-nav__meta {
  padding: 14px 9px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.6;
}
.settings-main {
  min-height: 0;
  overflow-y: auto;
  background: var(--surface);
}
.settings-content {
  max-width: 790px;
  padding: 38px 42px 90px;
  margin: 0 auto;
}
.settings-section {
  display: none;
}
.settings-section.is-active {
  display: block;
  animation: section-in 220ms var(--ease-out) both;
}
@keyframes section-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
}
.settings-section__head {
  margin-bottom: 24px;
}
.settings-section__head h2 {
  font-family: var(--font-display);
  font-size: 31px;
  line-height: 1.1;
  font-weight: 450;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.settings-section__head p {
  max-width: 580px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}
.settings-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
  padding: 20px;
  margin-bottom: 16px;
}
.settings-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 15px;
}
.settings-card__head h3 {
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.settings-card__head p {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.settings-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--line-soft);
}
.settings-actions__note {
  margin-right: auto;
  font-size: 10.5px;
  color: var(--faint);
}
.settings-actions .btn {
  height: 33px;
  font-size: 12px;
}
.settings-profile {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}
.settings-profile .avatar {
  width: 46px;
  height: 46px;
  font-size: 17px;
}
.settings-profile__name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.2;
}
.settings-profile__sub {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}
.readonly-value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
}
.readonly-value .pill {
  height: 19px;
}
.theme-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.theme-option {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  text-align: left;
  transition: border-color var(--quick), background var(--quick);
}
.theme-option:hover {
  border-color: var(--line-strong);
}
.theme-option[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-softer);
}
.theme-swatch {
  height: 54px;
  border-radius: 6px;
  border: 1px solid var(--line);
  overflow: hidden;
  position: relative;
  background: #f4efe4;
}
.theme-swatch--dark {
  background: #161510;
  border-color: #2e2a22;
}
.theme-swatch--system {
  background: linear-gradient(115deg, #f4efe4 0 49.6%, #161510 50%);
}
.theme-swatch::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 8px;
  width: 26%;
  height: 38px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.08);
}
.theme-swatch--dark::before {
  background: rgba(255, 255, 255, 0.08);
}
.theme-swatch::after {
  content: "";
  position: absolute;
  right: 9px;
  top: 12px;
  width: 45%;
  height: 3px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.16);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.09), 0 16px 0 rgba(0, 0, 0, 0.07);
}
.theme-swatch--dark::after {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 0 rgba(255, 255, 255, 0.13), 0 16px 0 rgba(255, 255, 255, 0.1);
}
.theme-swatch--system::after {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.16) 0 50%, rgba(255, 255, 255, 0.25) 50%);
}
.theme-option__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 550;
  padding: 0 2px;
}
.theme-option__label .icon {
  width: 13px;
  height: 13px;
  color: var(--faint);
}
.theme-option[aria-pressed="true"] .icon {
  color: var(--accent);
}
.settings-fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}
.settings-fieldset legend {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 9px;
}
.settings-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 22px 0 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}
.settings-subhead:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.settings-subhead h4 {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--ink-2);
}
.settings-list {
  display: flex;
  flex-direction: column;
}
.settings-list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.settings-list-row:last-child {
  border-bottom: 0;
}
.settings-list-row__body {
  flex: 1;
  min-width: 0;
}
.settings-list-row__title {
  font-size: 12px;
  font-weight: 550;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-list-row__sub {
  margin-top: 1px;
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.5;
}
.settings-list-row__actions {
  display: flex;
  gap: 4px;
  flex: none;
}
.settings-empty {
  padding: 13px 0;
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.55;
}
.preset-instructions {
  font-family: var(--font-serif);
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  max-height: 64px;
  overflow: hidden;
  white-space: pre-wrap;
}
.usage-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--line-soft);
  margin-bottom: 16px;
}
.usage-stat {
  background: var(--surface-raised);
  padding: 14px 16px;
}
.usage-stat__label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.usage-stat__value {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.usage-stat__sub {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}
.usage-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 54px;
  padding-top: 6px;
}
.usage-bar {
  flex: 1;
  min-width: 3px;
  background: var(--accent-soft);
  border-radius: 2px 2px 0 0;
  position: relative;
}
.usage-bar span {
  position: absolute;
  inset: 0;
  background: var(--accent);
  border-radius: inherit;
  opacity: 0.65;
}
.usage-bar:hover span {
  opacity: 1;
}
.usage-bar.is-empty {
  background: transparent;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}
.usage-bar.is-empty span {
  display: none;
}
.usage-legend {
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-size: 9px;
  margin-top: 5px;
}
.danger-zone {
  border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
  background: color-mix(in srgb, var(--danger-soft) 34%, var(--surface-raised));
}
.danger-zone .settings-card__head h3 {
  color: var(--danger);
}
.settings-hint {
  display: flex;
  gap: 7px;
  font-size: 10.5px;
  color: var(--faint);
  line-height: 1.55;
  margin-top: 8px;
}
.settings-hint .icon {
  width: 12px;
  height: 12px;
  flex: none;
  margin-top: 1px;
}
.settings-save-status {
  font-size: 10.5px;
  color: var(--success);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--motion);
}
.settings-save-status.is-visible {
  opacity: 1;
}
.settings-save-status .icon {
  width: 11px;
  height: 11px;
}
.model-settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}
.model-settings-row:last-child {
  border-bottom: 0;
}
.model-settings-row__body {
  flex: 1;
  min-width: 0;
}
.model-settings-row__name {
  font-size: 12px;
  font-weight: 550;
  color: var(--ink);
}
.model-settings-row__sub {
  font-size: 10px;
  color: var(--faint);
  font-family: var(--font-mono);
  margin-top: 1px;
}
.model-settings-row__caps {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.model-settings-row__caps .cap-chip {
  height: 17px;
  font-size: 8px;
  padding: 0 4px;
}
.settings-model-pick {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  font-size: 12.5px;
}
.settings-model-pick:hover {
  border-color: var(--line-strong);
}
.settings-model-pick .icon {
  color: var(--faint);
  width: 14px;
  height: 14px;
  margin-left: auto;
}

/* ==========================================================================
   Sidebar row wrappers
   ========================================================================== */

[hidden] {
  display: none !important;
}

.side-row-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}
.side-row-wrap > .nav-row,
.side-row-wrap > .convo-row {
  flex: 1;
  min-width: 0;
}
.side-row-wrap > .nav-row {
  padding-right: 27px;
}
.side-row-wrap .convo-more,
.side-row-wrap .row-more {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  opacity: 0;
  transition: opacity var(--quick), background var(--quick), color var(--quick);
}
.side-row-wrap .convo-more .icon,
.side-row-wrap .row-more .icon {
  width: 14px;
  height: 14px;
}
.side-row-wrap:hover .convo-more,
.side-row-wrap:focus-within .convo-more,
.side-row-wrap:hover .row-more,
.side-row-wrap:focus-within .row-more {
  opacity: 1;
}
.side-row-wrap .convo-more:hover,
.side-row-wrap .row-more:hover {
  background: var(--hover-strong);
  color: var(--ink);
}
.sidebar__mobile-close {
  display: none;
}
.sidebar-expand {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 32px;
  margin: 2px auto 4px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
}
.sidebar-expand:hover {
  background: var(--hover);
  color: var(--ink);
}
.app-shell.is-collapsed .sidebar-expand {
  display: inline-flex;
}
.app-shell.is-collapsed .side-row-wrap {
  justify-content: center;
}
.app-shell.is-collapsed .side-row-wrap > .nav-row {
  padding-right: 0;
}
.app-shell.is-collapsed .side-row-wrap .row-more,
.app-shell.is-collapsed .side-row-wrap .convo-more {
  display: none;
}
.app-shell.is-collapsed .side-group__head::after {
  content: "";
}
.app-shell.is-collapsed .side-group__head {
  height: 9px;
  border-bottom: 1px solid var(--line-soft);
  width: 28px;
  margin: 8px auto 4px;
}
.sidebar-search-trigger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}
.sidebar-search-trigger:hover {
  background: var(--hover);
  color: var(--ink);
}
.app-shell.is-collapsed .sidebar-search-trigger {
  display: inline-flex;
}
.app-shell.is-collapsed .side-show-more {
  display: none;
}

/* ==========================================================================
   Small shared additions
   ========================================================================== */

.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}
.collection-row__main {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.attachment-pill {
  font: inherit;
  text-align: left;
  cursor: pointer;
}
button.starter,
button.recent-row,
button.collection-row,
button.doc-row,
button.picker-item__body {
  font: inherit;
}
.search-result mark,
.collection-row__preview mark,
.palette__sub mark,
.search-result__title mark {
  background: var(--gold-soft);
  color: var(--ink);
  border-radius: 2px;
  padding: 0 1px;
}
.collection-row {
  border-bottom: 1px solid var(--line-soft);
}
.collection-row__main {
  border: 0;
  background: transparent;
  display: block;
  min-width: 0;
}

:root[data-density="compact"] .thread {
  gap: 22px;
  padding-top: 24px;
  padding-bottom: 26px;
}
:root[data-density="compact"] .turn--assistant .turn__body {
  font-size: 16.5px;
  line-height: 1.62;
}
:root[data-density="compact"] .turn--user .turn__body {
  padding: 10px 14px;
  font-size: 14px;
}
:root[data-density="compact"] .convo-row {
  height: 29px;
}
:root[data-density="compact"] .nav-row {
  height: 30px;
}
:root[data-density="compact"] .sidebar__foot {
  padding-top: 5px;
}
:root[data-density="compact"] .prose p {
  margin-bottom: 0.8em;
}
:root[data-density="compact"] .date-divider {
  margin-top: 0;
}

.turn__body.is-streaming {
  min-height: 24px;
}
.turn__body.is-streaming > p:last-child::after,
.turn__body.is-streaming > h1:last-child::after,
.turn__body.is-streaming > h2:last-child::after,
.turn__body.is-streaming > h3:last-child::after,
.turn__body.is-streaming > h4:last-child::after,
.turn__body.is-streaming > blockquote:last-child p:last-child::after,
.turn__body.is-streaming > ul:last-child > li:last-child::after,
.turn__body.is-streaming > ol:last-child > li:last-child::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.02em;
  margin-left: 3px;
  background: var(--accent);
  vertical-align: -0.12em;
  animation: caret 1s steps(1) infinite;
}

@media (max-width: 1023px) {
  .sidebar__mobile-close {
    display: inline-flex;
  }
}


/* ==========================================================================
   Authentication
   ========================================================================== */

.auth-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(0, 0.97fr);
  background: var(--paper);
  overflow: auto;
}
.auth-aside {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 40px clamp(32px, 5vw, 70px) 34px;
  background: #1d1b16;
  color: #f3ecde;
}
.auth-aside::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.08'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.5;
}
.auth-aside::after {
  content: "";
  position: absolute;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  right: -260px;
  top: -240px;
  background: radial-gradient(circle, rgba(185, 71, 43, 0.28), transparent 68%);
  pointer-events: none;
}
.auth-aside__top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.auth-aside .wordmark__text {
  color: #f3ecde;
  font-size: 25px;
}
.auth-aside .brand-mark {
  color: #f3ecde;
}
.auth-aside__tag {
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(243, 236, 222, 0.45);
}
.auth-aside__middle {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 0 30px;
  max-width: 560px;
}
.auth-aside__headline {
  font-family: var(--font-display);
  font-size: clamp(44px, 5.2vw, 68px);
  font-weight: 400;
  line-height: 0.99;
  letter-spacing: -0.04em;
  color: #f7f0e3;
  text-wrap: balance;
}
.auth-aside__headline em {
  font-family: var(--font-serif);
  font-style: italic;
  color: #e2795b;
  font-weight: 400;
  letter-spacing: -0.03em;
}
.auth-aside__lede {
  max-width: 410px;
  margin-top: 20px;
  color: rgba(243, 236, 222, 0.58);
  font-size: 13.5px;
  line-height: 1.65;
}
.auth-art {
  position: relative;
  height: 262px;
  margin-top: 38px;
  max-width: 480px;
}
.auth-art__sheet {
  position: absolute;
  width: 216px;
  height: 265px;
  border-radius: 7px;
  background: #f1e9da;
  color: #262219;
  box-shadow: 0 28px 55px -22px rgba(0, 0, 0, 0.7), 0 3px 8px rgba(0, 0, 0, 0.2);
  padding: 26px 24px 24px 31px;
  transform: rotate(-5deg);
  left: 34px;
  top: -3px;
}
.auth-art__sheet::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 20px;
  bottom: 20px;
  width: 1px;
  background: #c65a3c;
  opacity: 0.7;
}
.auth-art__sheet--back {
  left: 218px;
  top: 31px;
  width: 196px;
  height: 226px;
  transform: rotate(4deg);
  background: #ded3bf;
  opacity: 0.72;
  box-shadow: 0 18px 42px -20px rgba(0, 0, 0, 0.7);
}
.auth-art__sheet--back::before {
  background: #8d8272;
}
.auth-art__lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auth-art__lines span {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: #3a342a;
  opacity: 0.24;
}
.auth-art__lines span:nth-child(1) {
  width: 52%;
  height: 8px;
  opacity: 0.66;
  margin-bottom: 6px;
  background: #29251e;
}
.auth-art__lines span:nth-child(2) {
  width: 86%;
}
.auth-art__lines span:nth-child(3) {
  width: 74%;
}
.auth-art__lines span:nth-child(4) {
  width: 92%;
}
.auth-art__lines span:nth-child(5) {
  width: 63%;
}
.auth-art__lines span:nth-child(6) {
  width: 83%;
}
.auth-art__lines span:nth-child(7) {
  width: 44%;
}
.auth-art__note {
  position: absolute;
  right: 8px;
  bottom: 4px;
  width: 210px;
  padding: 14px 16px;
  background: #2c493d;
  color: #e9e0cf;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 13.5px;
  line-height: 1.45;
  transform: rotate(-2deg);
  box-shadow: 0 14px 35px -15px rgba(0, 0, 0, 0.65);
  border-radius: 3px;
}
.auth-art__asterisk {
  position: absolute;
  left: 2px;
  bottom: 8px;
  color: #d97053;
  font-family: var(--font-display);
  font-size: 72px;
  line-height: 0.6;
  opacity: 0.9;
  transform: rotate(9deg);
}
.auth-aside__features {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(243, 236, 222, 0.12);
}
.auth-feature {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 10px;
  line-height: 1.45;
  color: rgba(243, 236, 222, 0.5);
  max-width: 140px;
}
.auth-feature .icon {
  color: #d97053;
  width: 13px;
  height: 13px;
  flex: none;
  margin-top: 1px;
}
.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px clamp(24px, 5vw, 64px);
  background: var(--surface);
  overflow-y: auto;
}
.auth-card {
  width: 100%;
  max-width: 386px;
  animation: auth-in 420ms var(--ease-out) both;
}
@keyframes auth-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
.auth-mobile-brand {
  display: none;
  margin-bottom: 26px;
}
.auth-card__eyebrow {
  margin-bottom: 14px;
}
.auth-card h1 {
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1.05;
  font-weight: 450;
  letter-spacing: -0.035em;
  color: var(--ink);
}
.auth-card__sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}
.auth-card__sub a {
  color: var(--ink-2);
}
.auth-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  margin: 22px 0 20px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}
.auth-tab {
  flex: 1;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}
.auth-tab[aria-pressed="true"], .auth-tab[aria-selected="true"] {
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.auth-form .field > label {
  font-size: 11px;
}
.auth-form .input {
  height: 42px;
  background: var(--surface-raised);
}
.password-wrap {
  position: relative;
}
.password-wrap .input {
  padding-right: 40px;
}
.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  border-radius: 5px;
}
.password-toggle:hover {
  background: var(--hover);
  color: var(--ink);
}
.password-toggle .icon {
  width: 14px;
  height: 14px;
}
.auth-submit {
  height: 42px;
  margin-top: 3px;
  border-radius: 9px;
  font-size: 13px;
}
.auth-error {
  display: flex;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--danger) 25%, var(--line));
  border-radius: 7px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 11.5px;
  line-height: 1.5;
}
.auth-error .icon {
  width: 13px;
  height: 13px;
  flex: none;
  margin-top: 1px;
}
.auth-switch {
  margin-top: 20px;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
}
.auth-switch a,
.auth-switch button {
  color: var(--ink-2);
  font-weight: 550;
  border: 0;
  background: transparent;
  padding: 0;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.auth-switch a:hover,
.auth-switch button:hover {
  color: var(--accent);
}
.auth-fineprint {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.6;
  display: flex;
  gap: 7px;
  align-items: flex-start;
}
.auth-fineprint .icon {
  width: 12px;
  height: 12px;
  flex: none;
  margin-top: 1px;
}
.auth-recover-hint {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
}
.auth-recover-hint strong {
  color: var(--ink-2);
}
.auth-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  justify-content: center;
  color: var(--muted);
  font-size: 11.5px;
}

/* ==========================================================================
   Shared conversation page
   ========================================================================== */

.share-body {
  overflow: auto;
  height: auto;
  min-height: 100%;
  background: var(--paper);
}
#share-app {
  min-height: 100dvh;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
}
.share-topbar {
  height: 62px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.share-topbar .wordmark__text {
  font-size: 21px;
}
.share-topbar__badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 550;
}
.share-topbar__badge .icon {
  width: 10px;
  height: 10px;
}
.share-topbar__spacer {
  flex: 1;
}
.share-topbar .btn {
  height: 32px;
  font-size: 11.5px;
}
.share-main {
  width: 100%;
  max-width: 840px;
  margin: 0 auto;
  padding: 46px 32px 60px;
  flex: 1;
}
.share-head {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 34px;
}
.share-head h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.6vw, 46px);
  font-weight: 450;
  letter-spacing: -0.035em;
  line-height: 1.06;
  color: var(--ink);
  text-wrap: balance;
  margin: 12px 0 12px;
}
.share-head__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--faint);
  font-size: 10.5px;
}
.share-head__meta .sep {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--faint);
}
.share-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--muted);
  font-size: 10.5px;
}
.share-banner .icon {
  width: 13px;
  height: 13px;
  color: var(--accent);
  flex: none;
}
.share-messages {
  display: flex;
  flex-direction: column;
  gap: 34px;
}
.share-messages .turn__actions {
  display: none;
}
.share-footer {
  border-top: 1px solid var(--line);
  background: var(--surface-raised);
}
.share-footer__inner {
  max-width: 840px;
  margin: 0 auto;
  padding: 26px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.share-footer__text {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--ink-2);
}
.share-footer__text em {
  font-family: var(--font-serif);
  color: var(--accent);
}
.share-expired {
  max-width: 520px;
  margin: 15vh auto;
  padding: 32px;
  text-align: center;
}
.share-expired .empty-state__icon {
  width: 52px;
  height: 52px;
}
.share-expired h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 450;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.share-expired p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.share-expired .btn {
  margin-top: 20px;
}

/* ==========================================================================
   Connection, errors, misc states
   ========================================================================== */

.connection-banner {
  position: fixed;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  z-index: 1900;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid color-mix(in srgb, var(--gold) 30%, var(--line));
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--ink-2);
  box-shadow: var(--shadow-md);
  font-size: 11px;
  animation: attention-in 220ms var(--ease-out) both;
}
.connection-banner .icon {
  width: 12px;
  height: 12px;
  color: var(--gold);
}
@keyframes attention-in {
  from {
    opacity: 0;
    transform: translate(-50%, -5px);
  }
}

.error-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: var(--paper);
  position: relative;
  z-index: 2;
}
.error-page__card {
  max-width: 430px;
  text-align: center;
}
.error-page__card .wordmark {
  justify-content: center;
  margin-bottom: 30px;
}
.error-page__icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--danger-soft);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 17px;
}
.error-page h1 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 450;
  letter-spacing: -0.03em;
}
.error-page p {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
  margin-top: 7px;
}
.error-page__actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
}
.error-page code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--surface-2);
  padding: 2px 4px;
  border-radius: 3px;
}

.offline-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  background: var(--gold-soft);
  color: var(--ink-2);
  border-bottom: 1px solid color-mix(in srgb, var(--gold) 25%, var(--line));
  font-size: 11px;
}
.offline-banner .icon {
  width: 13px;
  height: 13px;
  color: var(--gold);
}
.sr-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1280px) {
  :root {
    --sidebar-w: 272px;
    --reading: 728px;
  }
  .topbar {
    padding-left: 18px;
  }
  .settings-content {
    padding-inline: 32px;
  }
}

@media (max-width: 1100px) {
  .model-pill {
    max-width: 190px;
  }
  .turn--assistant .turn__body {
    font-size: 17px;
  }
  .welcome {
    padding-top: 58px;
  }
}

@media (max-width: 1023px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .app-shell.is-collapsed {
    --sidebar-w: 288px;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(310px, calc(100vw - 44px));
    height: 100dvh;
    transform: translateX(-102%);
    box-shadow: 14px 0 50px -24px rgba(30, 20, 8, 0.55);
    border-right: 1px solid var(--line-strong);
    transition: transform var(--panel) var(--ease);
  }
  .app-shell.sidebar-open .sidebar {
    transform: none;
  }
  .sidebar__collapse {
    display: none;
  }
  .sidebar__mobile-close {
    display: inline-flex;
  }
  .sidebar-backdrop {
    display: block;
    opacity: 0;
    pointer-events: none;
  }
  .app-shell.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .topbar .topbar__menu {
    display: inline-flex;
  }
  .toast-host {
    top: auto;
    bottom: calc(92px + env(safe-area-inset-bottom));
  }
  .settings-layout {
    grid-template-columns: 205px minmax(0, 1fr);
  }
  .settings-nav {
    padding-left: 16px;
  }
  .settings-content {
    padding: 32px 28px 80px;
  }
}

@media (max-width: 899px) {
  .auth-shell {
    grid-template-columns: 1fr;
    background: var(--surface);
  }
  .auth-aside {
    display: none;
  }
  .auth-main {
    padding: 40px 28px;
    min-height: 100dvh;
  }
  .auth-mobile-brand {
    display: flex;
  }
  .settings-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }
  .settings-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: none;
  }
  .settings-nav::-webkit-scrollbar {
    display: none;
  }
  .settings-nav__title,
  .settings-nav__sub,
  .settings-nav__label,
  .settings-nav__meta {
    display: none;
  }
  .settings-nav__group {
    display: flex;
    flex-direction: row;
    gap: 2px;
    margin: 0;
  }
  .settings-nav__item {
    min-height: 32px;
    padding: 0 10px;
    border-radius: 7px;
    font-size: 11.5px;
    flex: none;
  }
  .settings-nav__item .icon {
    width: 13px;
    height: 13px;
  }
  .project-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
  .usage-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  :root {
    --reading: 100%;
  }
  .topbar {
    height: 54px;
    padding: 0 10px 0 12px;
  }
  .topbar__actions {
    gap: 1px;
  }
  .topbar__divider {
    display: none;
  }
  .thread {
    padding: 26px 20px 26px;
    gap: 26px;
  }
  .turn--user .turn__body {
    padding: 12px 14px;
  }
  .turn__head {
    gap: 6px;
  }
  .turn__model {
    max-width: 130px;
  }
  .composer-dock {
    padding: 8px 12px calc(9px + env(safe-area-inset-bottom));
  }
  .composer__foot {
    padding-inline: 4px;
  }
  .composer__foot-left {
    display: none;
  }
  .composer__foot {
    justify-content: flex-end;
  }
  .sidebar__top .new-thread kbd,
  .sidebar-search kbd {
    display: none;
  }
  .welcome {
    padding: 44px 22px 18px;
  }
  .welcome__head::before {
    display: none;
  }
  .welcome h1 {
    font-size: clamp(36px, 8.3vw, 47px);
  }
  .welcome__lede {
    font-size: 13.5px;
    margin-top: 14px;
  }
  .starter {
    grid-template-columns: minmax(0, 1fr) 20px;
    min-height: 52px;
    padding-block: 9px;
  }
  .starter__cat {
    display: none;
  }
  .starter__title {
    font-size: 16.5px;
  }
  .collection {
    padding: 30px 20px 30px;
  }
  .collection__head {
    flex-direction: column;
    gap: 14px;
  }
  .collection__actions {
    width: 100%;
  }
  .collection-row {
    padding: 12px 4px;
    gap: 10px;
  }
  .collection-row__meta {
    gap: 6px;
  }
  .collection-row__preview {
    max-width: 100%;
  }
  .settings-topbar {
    padding: 0 14px;
  }
  .settings-topbar__email {
    display: none !important;
  }
  .settings-content {
    padding: 24px 18px 70px;
  }
  .settings-section__head h2 {
    font-size: 27px;
  }
  .settings-card {
    padding: 16px;
  }
  .theme-options {
    gap: 7px;
  }
  .theme-swatch {
    height: 44px;
  }
  .share-main {
    padding: 30px 20px 44px;
  }
  .share-head {
    margin-bottom: 26px;
  }
  .share-topbar {
    padding: 0 14px;
    height: 54px;
  }
  .share-messages {
    gap: 28px;
  }
  .share-footer__inner {
    padding: 22px 20px;
  }
  dialog.palette {
    margin-top: 6vh;
  }
  .modal__head {
    padding: 17px 17px 0;
  }
  .modal__body {
    padding: 14px 17px 18px;
  }
  .modal__foot {
    padding: 12px 17px;
  }
  .toast-host {
    top: auto;
    right: 12px;
    left: 12px;
    max-width: none;
    bottom: calc(96px + env(safe-area-inset-bottom));
  }
  .field-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .topbar__title-wrap {
    gap: 2px;
  }
  .thread-title {
    font-size: 13px;
  }
  .thread-sub {
    font-size: 10px;
  }
  .thread-sub .hide-mobile {
    display: none;
  }
  .model-pill {
    max-width: 132px;
    height: 28px;
    padding: 0 7px;
    font-size: 10.5px;
  }
  .model-pill .model-pill__name {
    max-width: 78px;
  }
  .topbar .share-button span,
  .topbar .share-label {
    display: none;
  }
  .topbar__actions .icon-btn {
    width: 30px;
    height: 30px;
  }
  .composer textarea {
    font-size: 14px;
  }
  .composer {
    border-radius: 14px;
    padding: 9px 9px 7px 11px;
  }
  .composer__tools .tool-btn span {
    display: none;
  }
  .composer__tools .tool-btn {
    width: 29px;
    padding: 0;
    justify-content: center;
  }
  .composer__tools .tool-btn .icon {
    width: 16px;
    height: 16px;
  }
  .composer-model {
    max-width: 125px;
    font-size: 10px;
    padding: 0 6px;
  }
  .composer-model .family-dot {
    display: none;
  }
  .composer__foot {
    display: none;
  }
  .composer__search-hint span {
    display: none;
  }
  .thread {
    padding: 22px 16px 20px;
    gap: 24px;
  }
  .turn--assistant .turn__body {
    font-size: 16.5px;
    line-height: 1.68;
  }
  .turn__head {
    flex-wrap: wrap;
  }
  .turn__model {
    display: none;
  }
  .turn__time {
    margin-right: auto;
  }
  .turn__actions {
    opacity: 1;
  }
  .turn__actions .icon-btn {
    width: 26px;
    height: 26px;
  }
  .turn--user .turn__head .turn__time {
    display: none;
  }
  .prose h1 {
    font-size: 1.45em;
  }
  .prose h2 {
    font-size: 1.28em;
  }
  .code-block pre {
    padding: 11px 12px 13px;
  }
  .code-block code {
    font-size: 11.5px;
  }
  .welcome {
    padding: 36px 18px 14px;
  }
  .welcome h1 {
    font-size: clamp(33px, 9.2vw, 42px);
  }
  .welcome__eyebrow {
    margin-bottom: 15px;
  }
  .welcome__lede {
    font-size: 13px;
  }
  .starters {
    margin-top: 28px;
  }
  .starter__title {
    font-size: 15.5px;
  }
  .welcome__recent {
    margin-top: 26px;
  }
  .welcome__fineprint {
    flex-wrap: wrap;
    line-height: 1.6;
  }
  .welcome__fineprint-extras {
    display: none;
  }
  .collection {
    padding: 26px 16px;
  }
  .collection h1 {
    font-size: 29px;
  }
  .collection-row__meta .meta-date {
    display: none;
  }
  .collection-row__preview {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .project-instructions {
    padding: 15px;
  }
  .settings-card__head {
    flex-direction: column;
    gap: 8px;
  }
  .usage-stats {
    grid-template-columns: minmax(0, 1fr);
  }
  .usage-stat {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 10px 13px;
    border-bottom: 1px solid var(--line-soft);
  }
  .usage-stat:last-child {
    border-bottom: 0;
  }
  .usage-stat__value {
    margin: 0;
    font-size: 18px;
    margin-left: auto;
  }
  .settings-section__head h2 {
    font-size: 25px;
  }
  .settings-list-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .settings-list-row__actions {
    margin-left: auto;
  }
  .modal__title {
    font-size: 20px;
  }
  .modal__foot {
    flex-wrap: wrap;
  }
  .modal__foot .btn {
    flex: 1;
  }
  .code-secret {
    font-size: 13px;
    letter-spacing: 0.04em;
  }
  .palette__shortcut {
    display: none;
  }
  .palette__list {
    max-height: 58vh;
  }
  dialog.palette {
    margin-top: 4vh;
  }
  .share-head h1 {
    font-size: 31px;
  }
  .share-topbar .wordmark__text {
    display: none;
  }
  .share-topbar__badge {
    display: none;
  }
  .share-messages .turn--assistant .turn__body {
    font-size: 16.5px;
  }
  .auth-main {
    padding: 28px 20px;
    align-items: flex-start;
  }
  .auth-card h1 {
    font-size: 31px;
  }
  .auth-art {
    display: none;
  }
  .model-picker {
    width: calc(100vw - 20px);
    max-width: 430px;
  }
  .model-picker__list {
    max-height: 48vh;
  }
  .tune-panel,
  .prompt-picker {
    width: calc(100vw - 24px);
    max-width: 340px;
  }
  .toast-host {
    top: auto;
    bottom: calc(88px + env(safe-area-inset-bottom));
  }
}

@media (hover: none) {
  .turn__actions {
    opacity: 1;
  }
  .convo-row .convo-more {
    opacity: 0.7;
  }
  .side-group__head button {
    opacity: 0.7;
  }
  .source-link > .icon {
    opacity: 0.5;
  }
  .thread-title .icon {
    opacity: 0.45;
  }
}

@media (pointer: coarse) {
  .icon-btn {
    min-width: 36px;
    min-height: 36px;
  }
  .turn__actions .icon-btn {
    min-width: 34px;
    min-height: 34px;
  }
  .menu__item {
    min-height: 40px;
  }
  .nav-row {
    min-height: 38px;
  }
  .convo-row {
    min-height: 39px;
  }
  .composer__tools .tool-btn {
    min-width: 36px;
    min-height: 36px;
  }
  .send-btn {
    width: 38px;
    height: 38px;
  }
  .settings-nav__item {
    min-height: 36px;
  }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="off"]) *,
  :root:not([data-motion="off"]) *::before,
  :root:not([data-motion="off"]) *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  :root:not([data-motion="off"]) .spinner,
  :root:not([data-motion="off"]) .spin {
    animation-duration: 800ms !important;
    animation-iteration-count: infinite !important;
  }
  :root:not([data-motion="off"]) .boot__line span {
    animation: none !important;
    transform: none;
    width: 100%;
  }
  :root:not([data-motion="off"]) .stream-caret {
    animation: none !important;
    opacity: 1;
  }
  .main-scroll {
    scroll-behavior: auto !important;
  }
}
:root[data-motion="on"] *,
:root[data-motion="on"] *::before,
:root[data-motion="on"] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}
:root[data-motion="on"] .spinner,
:root[data-motion="on"] .spin {
  animation-duration: 800ms !important;
  animation-iteration-count: infinite !important;
}
:root[data-motion="on"] .stream-caret {
  animation: none !important;
  opacity: 1;
}
:root[data-motion="on"] .boot__line span {
  animation: none !important;
  width: 100%;
}

/* ==========================================================================
   Focus and forced colors
   ========================================================================== */

@media (forced-colors: active) {
  .btn,
  .icon-btn,
  .input,
  .textarea,
  .composer,
  .modal__card,
  .popover,
  .menu,
  .settings-card {
    border: 1px solid CanvasText;
  }
  .family-dot,
  .plan-dot {
    forced-color-adjust: none;
  }
  .convo-row.is-active {
    outline: 2px solid Highlight;
  }
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
  body {
    background: #fff;
    overflow: visible;
    height: auto;
  }
  body::before,
  .sidebar,
  .topbar,
  .composer-dock,
  .share-topbar,
  .share-banner,
  .share-footer,
  .turn__actions,
  .welcome__recent,
  .welcome__fineprint,
  .toast-host,
  .connection-banner {
    display: none !important;
  }
  .app-shell,
  .workspace,
  .share-body,
  #share-app {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
    background: #fff !important;
  }
  .main-scroll {
    overflow: visible !important;
  }
  .thread,
  .share-main {
    max-width: 100% !important;
    padding: 0 !important;
  }
  .turn {
    break-inside: avoid;
  }
  .turn--assistant .turn__body {
    color: #000;
  }
  .code-block {
    border: 1px solid #ccc;
  }
  .code-block pre {
    max-height: none;
    overflow: visible;
  }
}





