:root {
  color-scheme: dark;
  --bg: #101614;
  --bg-elev: #171f1c;
  --sidebar: #0c1210;
  --sidebar-line: #24302b;
  --text: #e7eee9;
  --muted: #9aada3;
  --faint: #b7ccc2;
  --line: #24302b;
  --accent: #3d9a62;
  --accent-deep: #1f7a45;
  --accent-soft: rgba(61, 154, 98, 0.16);
  --user: #1c4d32;
  --user-text: #f3faf6;
  --danger: #e7b4a8;
  --mark: #3d6b32;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  --logo-ink: #0c1210;
  --chip: #1f7a45;
  --radius: 14px;
  --sidebar-w: 272px;
  --font: "Inter", "Segoe UI", system-ui, sans-serif;
  --thread: 800px;
}

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/inter-latin-ext-400.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+011E-011F, U+0130-0131, U+015E-015F, U+011E, U+011F, U+0130, U+0131, U+015E, U+015F, U+0160-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/inter-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 650;
  font-display: swap;
  src: url("/static/fonts/inter-latin-ext-600.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+011E-011F, U+0130-0131, U+015E-015F, U+0160-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 650;
  font-display: swap;
  src: url("/static/fonts/inter-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f1ea;
  --bg-elev: #fffcf7;
  --sidebar: #faf8f4;
  --sidebar-line: #e4ddd0;
  --text: #1c241f;
  --muted: #5c6b63;
  --faint: #3e5148;
  --line: #e4ddd0;
  --accent: #1d7a43;
  --accent-deep: #146335;
  --accent-soft: #e7f5ec;
  --user: #e7f5ec;
  --user-text: #143222;
  --danger: #8a3b2b;
  --mark: #d7efc8;
  --shadow: 0 12px 32px rgba(40, 48, 40, 0.08);
  --logo-ink: #faf8f4;
  --chip: #1d7a43;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.shell { display: flex; height: 100%; min-height: 0; min-width: 0; }
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px 12px 10px;
  height: 100%;
  overflow: hidden;
}
.brand-row { display: flex; align-items: center; justify-content: space-between; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.02em;
}
.logo { color: var(--accent); display: flex; }
.brand-name { font-size: 1.15rem; }
.new-chat {
  margin: 14px 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  text-decoration: none;
  background: var(--accent);
  color: #f4fff8;
  border-radius: 999px;
  padding: 9px 12px;
  font-weight: 650;
}
.new-chat:hover { background: var(--accent-deep); }
.history { margin: 6px 0 8px; }
.history summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 6px 8px;
}
.sidebar-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; padding-right: 2px; }
.history-list { display: flex; flex-direction: column; gap: 2px; }
.history-more {
  display: block;
  margin: 2px 8px 8px;
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
}
.history-more:hover { color: var(--text); }
.history-item {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 8px;
  min-width: 0;
}
.history-item a {
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: var(--text);
  font-size: 0.84rem;
  padding: 4px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item:hover, .history-item.is-current { background: var(--accent-soft); }
.history-item form { margin: 0; }
.history-rename, .history-item form button {
  border: 0;
  background: transparent;
  color: var(--faint);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 6px;
  flex: none;
}
.history-rename:hover, .history-item form button:hover { color: var(--text); background: var(--bg); }
.history-edit {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 0.86rem;
}
.history-empty { color: var(--faint); font-size: 0.82rem; margin: 4px 8px; }
.menu { display: flex; flex-direction: column; gap: 1px; overflow: visible; min-height: 0; flex: none; }
.menu-label {
  margin: 8px 8px 2px;
  color: var(--faint);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 10px;
  color: var(--text);
  font-size: 0.88rem;
}
.menu-group a { padding: 4px 8px; font-size: 0.84rem; }
.ico { width: 18px; height: 18px; flex: none; color: var(--accent); }
.new-chat .ico, .primary .ico, .send .ico, .ghost .ico { color: currentColor; }
.menu a.is-active .ico { color: var(--accent); }
.menu a:hover { background: var(--accent-soft); }
.menu a.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.menu em {
  margin-left: auto;
  font-style: normal;
  font-size: 0.68rem;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 6px;
}
.sidebar-foot {
  flex: 0 0 auto;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--sidebar-line);
  background: var(--sidebar);
}
.theme-switch {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}
.theme-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 0;
  font-size: 0.78rem;
}
.theme-switch button.is-on { background: var(--accent); color: #f4fff8; }
.profile {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-top: 1px solid var(--line);
}
.profile strong, .profile small { display: block; max-width: 168px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile > span:last-child { min-width: 0; }
.profile small { color: var(--faint); }
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-deep);
  color: #f4fff8;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.backdrop { display: none; }
.sidebar-close { display: none; }

.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.topbar {
  height: 58px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}
.topbar-title { font-weight: 650; flex: 1; min-width: 0; }
.title-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 8px;
  font-weight: 650;
}
.title-input:focus { outline: none; border-color: var(--line); background: var(--bg-elev); }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn, .ghost, .primary, .text-btn, .send, .tool {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 10px;
}
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0; }
button.sidebar-close { display: none; }
.menu-open { display: none; }
.ghost, .primary { padding: 7px 12px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.primary { background: var(--accent); color: #f4fff8; border-color: transparent; font-weight: 650; }
.primary.inline { display: inline-block; margin-top: 8px; }
.ghost:hover, .icon-btn:hover, .text-btn:hover { border-color: var(--accent); }
.text-btn { border: 0; background: transparent; color: var(--accent); padding: 0; }

.content { flex: 1; min-height: 0; min-width: 0; overflow: auto; padding: 22px 28px 40px; }
.search-layout, .page-narrow, .filters, .result-card, .snippet, .kunye, .prose, .start-card {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.search-layout { max-width: 920px; margin: 0 auto; }
.filters {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.query-label, .filter-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; color: var(--muted); }
.query-label input, .filter-grid input, .filter-grid select, .composer-filters input, .composer-filters select, .filters input, .filters select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  min-width: 0;
  width: 100%;
  max-width: 100%;
}
.query-label input { font-size: 1.05rem; }
.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.filter-grid label, .filter-field { min-width: 0; }
.filter-field { position: relative; display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; color: var(--muted); }
.filter-chip { width: 100%; justify-content: space-between; border-radius: 10px; padding: 10px 12px; background: var(--bg); font-size: 1rem; max-width: none; }
.sort-field { min-width: 140px; }
.sort-field .filter-chip { width: auto; }
.filter-menu {
  top: calc(100% + 6px);
  bottom: auto;
  left: 0;
  width: max(100%, 220px);
  max-height: 240px;
  overflow: auto;
}
.filter-menu button[hidden] { display: none; }
.live-status, .model-note, .sources-line { margin: 0 0 8px; color: var(--muted); font-size: 0.88rem; }
.check-badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel, #f4f1ea);
  color: var(--muted);
  font-size: 0.82rem;
}
.filter-actions { display: flex; gap: 12px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.intro { margin: 28px 4px; }
.intro h1, .page-narrow h1, .empty-chat h1, .decision h1 {
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.25;
  font-size: 1.65rem;
}
.intro p, .lede { color: var(--muted); line-height: 1.55; max-width: 68ch; }
.warnings, .banner, .warning-note {
  background: color-mix(in srgb, var(--danger) 16%, var(--bg-elev));
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 14px 0;
}
.warnings { padding-left: 28px; }
.result-meta { color: var(--muted); font-size: 0.88rem; }
.results { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.result-card, .fav-list li, .similar {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.result-card header { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.result-card header a { font-weight: 650; text-decoration: none; }
.result-card header a:hover { color: var(--accent); }
.badge {
  font-size: 0.75rem;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--accent);
}
.badge.muted { color: var(--muted); background: transparent; border: 1px solid var(--line); }
.kunye, .fav-list span, .similar span { color: var(--muted); font-size: 0.86rem; }
.snippet { line-height: 1.5; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.label-ozet { margin: 6px 0; }
.decision-label { margin: 4px 0 18px; }
.decision-label blockquote {
  margin: 8px 0;
  padding-left: 12px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }
.empty { color: var(--muted); }
.pager { display: flex; gap: 14px; margin-top: 16px; }
.pager a { color: var(--accent); }

.decision { max-width: 860px; }
.eyebrow { color: var(--accent); letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.75rem; }
.meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0 22px; }
.meta div { background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.meta dt { color: var(--faint); font-size: 0.75rem; }
.meta dd { margin: 4px 0 0; }
.prose { line-height: 1.65; }
.prose h1, .prose h2, .prose h3, .answer-body h2, .answer-body h3, .answer-body h4 {
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.prose pre, .answer-body pre { white-space: pre-wrap; background: var(--bg-elev); padding: 12px; border-radius: 10px; }
.similar { max-width: 860px; margin-top: 22px; }
.similar ul { list-style: none; padding: 0; margin: 0; }
.similar li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.similar a { text-decoration: none; }
.page-narrow { max-width: 760px; }
.soon { padding-top: 24px; }
.fav-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.fav-list li { display: grid; gap: 4px; }
.fav-list a { font-weight: 650; text-decoration: none; }

.content:has(.chat-shell) { padding: 0; overflow: hidden; }
.chat-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}
.transcript {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 28px 24px 8px;
  display: flex;
  flex-direction: column;
}
.thread {
  width: min(var(--thread), 100%);
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.empty-chat { margin: auto; max-width: 640px; text-align: center; }
.bubble { border-radius: 16px; line-height: 1.65; }
.bubble.user {
  align-self: flex-end;
  max-width: min(75%, 560px);
  background: var(--user);
  color: var(--user-text);
  border-bottom-right-radius: 6px;
  padding: 10px 14px;
  white-space: pre-wrap;
}
.bubble.assistant {
  align-self: stretch;
  width: 100%;
  max-width: none;
  background: transparent;
  padding: 2px 2px 8px;
}
.bubble.pending { opacity: 0.85; }
.answer-body p { margin: 0.55em 0; }
.answer-body ul, .answer-body ol { margin: 0.35em 0 0.7em; padding-left: 1.25em; }
.answer-body li { margin: 0.28em 0; }
.answer-body h2 { font-size: 1.25rem; margin: 0.2em 0 0.35em; }
.answer-body h3, .answer-body h4 { font-size: 1.05rem; margin: 0.85em 0 0.3em; }
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 5px;
  margin: 0 2px;
  border-radius: 999px;
  background: var(--chip);
  color: #f4fff8;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  vertical-align: 1px;
}
.chip-tip {
  position: fixed;
  z-index: 50;
  width: min(300px, 74vw);
  padding: 8px 10px;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 450;
  line-height: 1.45;
  box-shadow: var(--shadow);
  pointer-events: none;
}
.chip-tip[hidden] { display: none; }
.used { list-style: none; padding: 8px 0 0; margin: 10px 0 0; border-top: 1px solid var(--line); }
.used li { margin: 8px 0; font-size: 0.9rem; }
.used a:not(.chip) { color: var(--accent); }
.excerpt { color: var(--muted); font-size: 0.84rem; margin: 4px 0 0; }
.cite-side { color: var(--accent); font-size: 0.78rem; margin: 2px 0 0; font-weight: 650; }
.chat-index { list-style: none; padding: 0; margin: 12px 0; }
.chat-index li { margin: 6px 0; }
.chat-index a { color: var(--accent); }
.composer {
  flex: none;
  padding: 8px 24px 18px;
  background: linear-gradient(to top, var(--bg) 72%, transparent);
}
.composer-box {
  width: min(var(--thread), 100%);
  margin: 0 auto;
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 6px 8px 8px 14px;
}
.composer-box textarea {
  width: 100%;
  resize: none;
  border: 0;
  background: transparent;
  padding: 8px 4px 4px;
  min-height: 48px;
  max-height: 160px;
}
.composer-box textarea:focus { outline: none; }
.composer-bar { display: flex; align-items: center; gap: 6px; }
.tool {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  position: relative;
  border-radius: 10px;
}
.filter-toggle.tool { width: auto; padding: 0 12px; font-size: 0.82rem; }
.attach-note { margin: 0; color: var(--muted); font-size: 0.78rem; flex: 1; min-width: 0; }
.attach-preview {
  margin: 8px 0 0;
  max-height: 9rem;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 0.78rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 8px;
}
.query-label input:focus, .filter-grid input:focus, .filter-grid select:focus, .filter-popover input:focus, .filter-popover select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-color: var(--accent);
}
.send {
  width: 36px;
  height: 36px;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #f4fff8;
  font-size: 1.05rem;
  display: grid;
  place-items: center;
}
.send:disabled { opacity: 0.5; }
.filter-popover {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  box-shadow: var(--shadow);
  z-index: 5;
}
.filter-popover[hidden] { display: none; }
.filter-popover label { display: flex; flex-direction: column; gap: 6px; font-size: 0.78rem; color: var(--muted); }
.filter-popover input, .filter-popover select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--text);
}
.sources-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 92vw);
  border-left: 1px solid var(--line);
  background: var(--bg-elev);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 6;
  box-shadow: var(--shadow);
}
.sources-panel[hidden] { display: none; }
.sources-panel header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.sources-panel h2 { margin: 0; font-size: 1rem; }
#sources-body { overflow: auto; padding: 12px 14px 24px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88em; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    z-index: 40;
    inset: 0 auto 0 0;
    transform: translateX(-105%);
    transition: transform 0.18s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.is-open { transform: none; }
  button.sidebar-close { display: inline-grid; place-items: center; }
  .menu-open { display: inline-grid; place-items: center; }
  .backdrop.is-open { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 30; }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meta { grid-template-columns: 1fr 1fr; }
  .transcript, .composer { padding-left: 12px; padding-right: 12px; }
  .content { padding: 16px; }
  .topbar-actions .ghost { padding: 7px 8px; }
  .filter-popover { grid-template-columns: 1fr; }
}

@media (max-width: 1440px) {
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .filter-grid, .meta { grid-template-columns: minmax(0, 1fr); }
  .bubble.user { max-width: 88%; }
  .sources-panel { top: auto; height: 46%; width: 100%; border-left: 0; border-top: 1px solid var(--line); }
}

.facets, .tool-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.facets a, .tool-nav a {
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.84rem;
  color: var(--muted);
  background: var(--bg-elev);
}
.facets a.is-on, .tool-nav a.is-on { background: var(--accent); color: #f4fff8; border-color: transparent; }
.facets span { opacity: 0.8; }
.sort-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
  flex: none;
}
.sort-label span { white-space: nowrap; }
.sort-label select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}
.page-narrow form.filters { display: grid; gap: 12px; }
.page-narrow form.filters > label { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; color: var(--muted); }
.page-narrow form.filters input, .page-narrow form.filters select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  min-width: 0;
  width: 100%;
  max-width: 100%;
}
.start-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.start-card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.start-card h2 { margin: 0 0 8px; font-size: 1rem; }
.start-card ul, .plain-list { list-style: none; padding: 0; margin: 0; }
.start-card li, .plain-list li { margin: 0; }
.start-card a, .plain-list a { display: block; padding: 6px 0; text-decoration: none; }
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-links a { text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; }
.used-title { font-size: 0.95rem; margin: 16px 0 6px; }
.project-chip { position: relative; min-width: 0; }
.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 168px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px 4px 8px;
  font-size: 0.8rem;
}
.chip-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-btn .ico { width: 14px; height: 14px; }
.project-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  min-width: 200px;
  max-width: 260px;
  display: grid;
  gap: 2px;
  padding: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.project-menu[hidden] { display: none; }
.project-menu button {
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  border-radius: 8px;
  padding: 8px 10px;
}
.project-menu button[aria-selected="true"],
.project-menu button:hover { background: var(--accent-soft); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head, .cal-cell { min-width: 0; border-radius: 8px; padding: 4px; font-size: 0.75rem; overflow-wrap: anywhere; }
.cal-head { color: var(--muted); text-align: center; }
.cal-cell { min-height: 64px; border: 1px solid var(--line); background: var(--bg-elev); }
.cal-cell strong { display: block; }
.cal-cell a { display: block; text-decoration: none; }
.view-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0 14px; }
@media (max-width: 900px) {
  .start-grid { grid-template-columns: minmax(0, 1fr); }
}
.page-narrow form.filters .check { flex-direction: row; align-items: center; }
.rate-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; margin: 8px 0 24px; }
.rate-table th, .rate-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.amount { font-size: 1.7rem; font-weight: 650; letter-spacing: -0.03em; margin: 6px 0 12px; }
.coverage { color: var(--muted); font-size: 0.88rem; margin: 12px 0 0; padding-top: 8px; border-top: 1px solid var(--line); }
.quote-hit {
  background: color-mix(in srgb, var(--accent) 18%, var(--bg-elev));
  border-left: 3px solid var(--accent);
  padding: 4px 12px;
  border-radius: 8px;
  scroll-margin: 24px;
}
.sentence-hit {
  background: color-mix(in srgb, var(--accent) 55%, transparent);
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
}

@media print {
  body { overflow: visible; background: white; color: black; height: auto; }
  .sidebar, .backdrop, .composer, .topbar-actions, .menu-open, .sources-panel, .sidebar-foot, .filters { display: none !important; }
  .shell, .workspace, .content, .chat-shell, .transcript { height: auto; overflow: visible; display: block; }
  .bubble { break-inside: avoid; border: 1px solid #ccc; color: black; background: white; }
  .chip { border: 1px solid #1d7a43; color: #1d7a43; background: white; }
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
summary:focus-visible, [role="option"]:focus-visible, .chip:focus-visible, .filter-chip:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.result-card:hover, .project-card:hover, .start-card:hover, .file-card:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
}
html[data-theme="light"] .result-card,
html[data-theme="light"] .start-card,
html[data-theme="light"] .project-card,
html[data-theme="light"] .file-card,
html[data-theme="light"] .panel,
html[data-theme="light"] .filters,
html[data-theme="light"] .composer-box {
  box-shadow: 0 1px 2px rgba(40, 48, 40, 0.05), 0 10px 28px rgba(40, 48, 40, 0.06);
}

.page-wide { max-width: 980px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 16px; }
.page-head h1, .page-wide h1 { margin: 0 0 6px; font-size: 1.55rem; letter-spacing: -0.03em; }
.page-wide h2 { font-size: 1.05rem; margin: 22px 0 10px; }
.search-lede { margin: 14px 2px 0; }
.muted-line { color: var(--muted); margin: 6px 0; }

.home-shell:has(.empty-chat) { justify-content: center; overflow: auto; }
.home-shell:has(.empty-chat) .transcript { flex: 0 0 auto; overflow: visible; padding-bottom: 0; }
.home-hero { text-align: center; width: min(720px, 100%); margin: 0 auto; }
.home-hero h1 { font-size: 1.85rem; margin-bottom: 8px; }
.home-extra { width: min(var(--thread), 100%); margin: 0 auto; padding: 4px 24px 28px; }
.example-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 4px 0 16px; }
.example-chip, .followups .example-chip {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  text-align: left;
  max-width: 100%;
  line-height: 1.35;
}
.example-chip:hover, .followups .example-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.home-shell:has(.empty-chat) .composer { background: none; padding-top: 0; }
.home-shell:has(.empty-chat) .composer-box textarea { min-height: 72px; font-size: 1.05rem; }
.start-card h2 { display: flex; align-items: center; gap: 8px; }
.start-card h2 .ico { width: 16px; height: 16px; }

.cal-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.segmented { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.segmented a { text-decoration: none; padding: 6px 12px; border-radius: 999px; color: var(--muted); font-size: 0.84rem; }
.segmented a.is-on, .segmented a:hover { background: var(--accent); color: #f4fff8; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-nav strong { min-width: 11rem; text-align: center; font-size: 1.05rem; }
.nav-btn {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--text);
  text-decoration: none;
}
.nav-btn .ico { width: 22px; height: 22px; color: currentColor; }
.nav-btn:hover { background: var(--accent-soft); }
.cal-cell.is-out { opacity: 0.45; }
.cal-cell.is-today, .week-day.is-today { outline: 2px solid var(--accent); outline-offset: -2px; }
.today-mark { font-weight: 650; color: var(--accent); font-size: 0.68rem; }
.ev {
  display: block;
  width: 100%;
  margin-top: 3px;
  border: 0;
  border-radius: 6px;
  padding: 2px 5px;
  font-size: 0.7rem;
  text-align: left;
  background: var(--accent-soft);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ev.durusma { background: #1d4f86; color: #e8f2ff; }
.ev.sure { background: #8a5a12; color: #fff6e6; }
.ev.hatirlatma { background: #1f7a45; color: #f3fff7; }
.ev.diger { background: var(--line); color: var(--text); }
html[data-theme="light"] .ev.durusma { background: #d7e6f8; color: #16345c; }
html[data-theme="light"] .ev.sure { background: #f8e7c8; color: #5c3b08; }
html[data-theme="light"] .ev.hatirlatma { background: #d9f3e4; color: #145232; }
html[data-theme="light"] .ev.diger { background: #ece7de; color: #1c241f; }
.ev-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--accent); flex: none; }
.ev-dot.durusma { background: #3c7ec4; }
.ev-dot.sure { background: #c4842a; }
.ev-dot.hatirlatma { background: #1f7a45; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week-day { background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px; padding: 8px; min-height: 140px; min-width: 0; }
.week-day header { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.78rem; margin-bottom: 6px; }
.week-day header strong { color: var(--text); }

.panel, .auth-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.split-panels { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 14px; margin-top: 18px; }
.stack-form { display: grid; gap: 10px; }
.stack-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; color: var(--muted); }
.stack-form input, .stack-form select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  width: 100%;
}
.card-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.card-list.compact a { display: flex; gap: 8px; align-items: center; text-decoration: none; padding: 8px 2px; }
.file-card, .project-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  text-decoration: none;
}
.file-card p, .project-card p { margin: 2px 0 0; color: var(--muted); font-size: 0.82rem; }
.file-card a, .project-card strong { font-weight: 650; text-decoration: none; }
.file-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.project-card { grid-template-columns: auto 1fr; min-height: 92px; }
.dropzone {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: var(--radius);
  padding: 28px 16px;
  background: var(--bg-elev);
  margin-bottom: 8px;
}
.dropzone.is-over { background: var(--accent-soft); border-color: var(--accent); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .primary { position: relative; z-index: 1; }
.dropzone p { margin: 0; color: var(--muted); }
.empty-state {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 6px;
  padding: 28px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--muted);
}
.empty-state .ico { width: 28px; height: 28px; }
.empty-state strong { color: var(--text); font-size: 1.05rem; }
.empty-state p { margin: 0; max-width: 46ch; }
.empty-state.compact { padding: 16px; }
.soon-mark {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--accent);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
}
.modal {
  width: min(440px, 92vw);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 16px;
}
.modal::backdrop { background: rgba(8, 12, 10, 0.55); }
.modal-head, .modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.modal-head h2 { margin: 0; font-size: 1.05rem; }
.modal-actions { justify-content: flex-end; margin-top: 4px; }
.danger-form { margin-top: 12px; }
.text-btn.danger { color: var(--danger); }
.auth-card { max-width: 420px; margin: 32px auto; }
.auth-card h1 { margin-top: 0; }
.auth-links { display: flex; gap: 14px; }
.auth-links a { color: var(--accent); }
.banner.ok { background: var(--accent-soft); }
.banner.credit-banner {
  margin: 8px 12px 0;
  padding: 8px 12px;
  font-size: 0.88rem;
}
.profile form { margin: 0; }
.profile .text-btn { font-size: 0.78rem; }

.confidence {
  display: inline-flex;
  margin: 8px 0 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 650;
}
.answer-tools { display: flex; flex-wrap: nowrap; align-items: center; gap: 2px; margin-top: 10px; }
.answer-tools .tool {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}
.answer-tools .tool .ico { width: 16px; height: 16px; color: currentColor; }
.answer-tools .tool:hover { background: var(--accent-soft); color: var(--text); }
.answer-tools .tool.is-on { color: var(--accent); background: var(--accent-soft); }
.followups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 20px;
  padding-top: 4px;
}
.followups > span {
  flex: 1 0 100%;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.skeleton { display: grid; gap: 8px; }
.skeleton i, .skeleton span {
  display: block;
  height: 12px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--line), var(--bg-elev), var(--line));
  background-size: 200% 100%;
  animation: shimmer 1.1s linear infinite;
}
.skeleton i:nth-child(2), .skeleton span:nth-child(2) { width: 86%; }
.skeleton i:nth-child(3), .skeleton span:nth-child(3) { width: 64%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.search-skeleton { margin-top: 16px; display: grid; gap: 10px; }
.search-skeleton .result-card { min-height: 84px; }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: grid; gap: 8px; }
.toast {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px 14px;
  min-width: 180px;
}

.bell { position: relative; }
.bell-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  line-height: 16px;
  text-align: center;
}
.save-search { display: flex; gap: 12px; align-items: center; margin: 4px 0 12px; flex-wrap: wrap; }
.doctrine-keys, .yeni { color: var(--accent); }
.doctrine-keys { font-size: 0.85rem; }
.notice-list, .saved-list { list-style: none; padding: 0; display: grid; gap: 12px; }
.notice-list li, .saved-list li {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.notice-list .is-unread { border-left: 3px solid var(--accent); }
.guide-screens { padding-left: 1.1rem; }
.guide-screens li { margin: 10px 0; }
.guide-screens span { display: block; color: var(--muted); }
a.statute { color: var(--accent); text-underline-offset: 2px; }
.export-menu { position: relative; }
.export-menu > summary { list-style: none; cursor: pointer; }
.export-menu > summary::-webkit-details-marker { display: none; }
.export-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 180px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: grid;
}
.export-pop a, .export-pop button {
  text-align: left;
  background: none;
  border: 0;
  color: var(--text);
  font: inherit;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
}
.export-pop a:hover, .export-pop button:hover { background: var(--bg); }
.draft-setup { display: grid; gap: 12px; margin: 16px 0 20px; }
.draft-setup textarea, .draft-setup select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.cite-pick { color: var(--muted); font-size: 0.9rem; padding-left: 1.1rem; }
.doctrine-filter .filter-menu { max-height: 280px; overflow: auto; max-width: 420px; }
.statute-pop {
  position: fixed;
  z-index: 40;
  width: min(440px, calc(100vw - 24px));
  max-height: 360px;
  overflow: auto;
  white-space: normal;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  line-height: 1.45;
}
.statute-pop p { margin: 0 0 8px; }
.statute-pop .madde-no { margin-bottom: 10px; }
.statute-pop .madde-item { margin: 0 0 4px; padding-left: 0.4rem; }
.statute-title { font-weight: 650; }
.statute-open { font-weight: 650; }
.madde-text p { margin: 0 0 8px; }
.madde-text .madde-no { margin-bottom: 10px; }
.madde-text .madde-item { margin: 0 0 4px; }
.keyword-chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 8px 0; }
.keyword-chips li {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.78rem;
  color: var(--text);
  background: var(--bg);
}
.abstract-toggle { margin: 8px 0; }
.abstract-toggle summary { cursor: pointer; color: var(--accent); font-weight: 650; }
.abstract-toggle p { margin: 8px 0 0; color: var(--muted); }
.card-links { display: flex; gap: 12px; margin: 8px 0 0; }
.health-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 12px 0; }
.health-counts div { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--bg-elev); }
.health-counts dt { color: var(--faint); font-size: 0.78rem; }
.health-counts dd { margin: 4px 0 0; font-size: 1.25rem; font-weight: 650; }
.health-sources { list-style: none; padding: 0; display: grid; gap: 8px; }
.health-sources li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.health-sources span { color: var(--muted); text-align: right; }
.draft-gaps { margin: 8px 0 12px; padding-left: 1.1rem; }
.draft-gaps li { margin: 2px 0; }
.draft-editor { position: relative; }
.draft-backdrop, .draft-editor textarea {
  font: 12pt "Times New Roman", Times, serif;
  line-height: 1.5;
  padding: 12px;
  margin: 0;
  border: 1px solid transparent;
  width: 100%;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-sizing: border-box;
}
.draft-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  color: var(--text);
  background: var(--bg);
  border-color: var(--line);
  border-radius: 12px;
}
.draft-editor textarea {
  position: relative;
  color: transparent;
  caret-color: var(--text);
  background: transparent;
  resize: vertical;
  min-height: 420px;
}
.missing-mark { background: #f3d36b; color: #1c241f; border-radius: 2px; }
.toast-retry {
  display: inline-block;
  margin-left: 10px;
  background: transparent;
  color: var(--accent);
  border: 0;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.draft-form textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  line-height: 1.45;
}
.draft-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.answer-tools { flex-wrap: wrap; }
.answer-tools .taslak-link {
  width: auto;
  height: auto;
  margin-left: 6px;
  padding: 6px 10px;
  font-size: 0.82rem;
  text-decoration: none;
}
.tour[hidden] { display: none !important; }
.tour {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  align-items: end;
  justify-items: end;
  padding: 16px;
}
.tour-card {
  width: min(380px, 100%);
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
}
.tour-step { color: var(--muted); font-size: 0.78rem; margin: 0 0 6px; }
.tour-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.topbar-actions { flex-wrap: wrap; }
.topbar-actions .ghost { text-decoration: none; }
.fact-tags { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; }
.fact-tags label { font-size: 0.85rem; color: var(--text); }
.ceza-bucket { margin-top: 22px; }
.ceza-bucket h2 { font-size: 1.05rem; display: flex; gap: 8px; align-items: center; }

@media (max-width: 900px) {
  .week-grid { grid-template-columns: 1fr; }
  .split-panels { grid-template-columns: 1fr; }
  .home-extra { padding-left: 12px; padding-right: 12px; }
  .cal-nav strong { min-width: 0; }
  .tour { justify-items: stretch; align-items: end; }
  .topbar-actions .ghost { padding: 7px 8px; }
}
