/* ── Default: frappe (dark) ── */
:root {
  --bg: #303446;
  --bg-surface: #414559;
  --text: #c6d0f5;
  --text-dim: #a5adce;
  --text-muted: #949cbb;
  --border: #51576d;
  --rosewater: #f2d5cf;
  --flamingo: #eebebe;
  --pink: #f4b8e4;
  --mauve: #ca9ee6;
  --red: #e78284;
  --maroon: #ea999c;
  --peach: #ef9f76;
  --yellow: #e5c890;
  --green: #a6d189;
  --teal: #81c8be;
  --sky: #99d1db;
  --sapphire: #85c1dc;
  --blue: #8caaee;
  --lavender: #babbf1;
  --bright-white: #b5bfe2;
  --magenta: #f4b8e4;
  --cyan: #81c8be;
  --diff-add-bg: #225c2b;
  --diff-add-word: #38a660;
  --diff-remove-bg: #7a2936;
  --diff-remove-word: #b44050;
  --diff-text: #ffffff;
}

/* ── Explicit overrides ── */
:root[data-theme="light"] {
  --bg: #eff1f5;
  --bg-surface: #e6e9ef;
  --text: #4c4f69;
  --text-dim: #5c5f77;
  --text-muted: #7c7f93;
  --border: #ccd0da;
  --rosewater: #dc8a78;
  --flamingo: #dd7878;
  --pink: #ea76cb;
  --mauve: #8839ef;
  --red: #d20f39;
  --maroon: #e64553;
  --peach: #fe640b;
  --yellow: #df8e1d;
  --green: #40a02b;
  --teal: #179299;
  --sky: #04a5e5;
  --sapphire: #209fb5;
  --blue: #1e66f5;
  --lavender: #7287fd;
  --bright-white: #5c5f77;
  --magenta: #ea76cb;
  --cyan: #179299;
  --diff-add-bg: #d4edda;
  --diff-add-word: #a3d9b1;
  --diff-remove-bg: #f8d7da;
  --diff-remove-word: #f0b0b8;
  --diff-text: #4c4f69;
}

:root[data-theme="dark"] {
  --bg: #303446;
  --bg-surface: #414559;
  --text: #c6d0f5;
  --text-dim: #a5adce;
  --text-muted: #949cbb;
  --border: #51576d;
  --rosewater: #f2d5cf;
  --flamingo: #eebebe;
  --pink: #f4b8e4;
  --mauve: #ca9ee6;
  --red: #e78284;
  --maroon: #ea999c;
  --peach: #ef9f76;
  --yellow: #e5c890;
  --green: #a6d189;
  --teal: #81c8be;
  --sky: #99d1db;
  --sapphire: #85c1dc;
  --blue: #8caaee;
  --lavender: #babbf1;
  --bright-white: #b5bfe2;
  --magenta: #f4b8e4;
  --cyan: #81c8be;
  --diff-add-bg: #225c2b;
  --diff-add-word: #38a660;
  --diff-remove-bg: #7a2936;
  --diff-remove-word: #b44050;
  --diff-text: #ffffff;
}
/* Theme related styling located in server code */

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/JetBrainsMono-latin.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;
}

:root {
  --font:
    "JetBrains Mono", "SF Mono", "Menlo", "Monaco", "Cascadia Mono",
    "Liberation Mono", "Courier New", monospace;
  /* Comfortable reading measure for prose. Code/diffs/tables stay full-width. */
  --measure: 78ch;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 15px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
}

/* ── Header ── */
.session-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.session-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-header h1 {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-author {
  color: var(--text-dim);
  font-weight: 400;
}
.session-author svg,
.session-title svg {
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.3rem;
  position: relative;
  top: 0;
  transition: transform 0.15s;
}
h1 svg {
  width: 28px;
  height: 28px;
  vertical-align: middle;
  margin-right: 0.4rem;
  top: 0;
  transition: transform 0.15s;
}
.author-link {
  text-decoration: none;
  color: inherit;
}
.author-link:hover .session-author {
  color: var(--text);
}
.author-link:hover svg {
  transform: translate(-1px, -1px);
}
.home-link {
  display: inline-block;
  vertical-align: middle;
  text-decoration: none;
  line-height: 0;
  cursor: pointer;
}
.home-link svg {
  width: 18px;
  height: 18px;
  transition: transform 0.4s;
}
.home-link:hover svg {
  transform: rotate(360deg);
}
h1 .home-link svg {
  width: 28px;
  height: 28px;
}

.session-meta {
  font-size: 0.85rem;
  color: var(--text-dim);
  white-space: nowrap;
  margin-left: auto;
}

.copy-md-btn {
  cursor: pointer;
}
.copy-md-btn.copied {
  color: var(--green);
}

.expiry-badge {
  font-size: 1rem;
  white-space: nowrap;
}
.expiry-green { color: var(--green); }
.expiry-yellow { color: var(--yellow); }
.expiry-red { color: var(--red); }

.privacy-badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.privacy-badge svg {
  width: 12px;
  height: 12px;
  display: inline-block;
  vertical-align: -2px;
  margin-right: 2px;
}
.privacy-public { color: var(--green); }
.privacy-secret { color: var(--yellow); }
.privacy-private { color: var(--red); }

.privacy-dropdown {
  position: relative;
  display: inline-flex;
  vertical-align: baseline;
}
.privacy-dropdown-trigger {
  display: inline;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
}
.privacy-dropdown-trigger svg {
  width: 12px;
  height: 12px;
  display: inline-block;
  vertical-align: -2px;
  margin-right: 2px;
}
.privacy-dropdown-chevron {
  width: 10px;
  height: 10px;
  vertical-align: -1px;
  margin-right: 0;
  margin-left: 1px;
  opacity: 0.5;
  transition: transform 0.15s;
}
.privacy-dropdown.open .privacy-dropdown-chevron { transform: rotate(180deg); }
.privacy-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 100;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 120px;
}
.privacy-dropdown.open .privacy-dropdown-menu { display: flex; flex-direction: column; }
.privacy-dropdown-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  background: none;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}
.privacy-dropdown-item:hover { background: var(--bg-surface); }
.privacy-dropdown-item svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
.privacy-dropdown-item-active { font-weight: bold; }
.privacy-dropdown .privacy-public { color: var(--green); }
.privacy-dropdown .privacy-secret { color: var(--yellow); }
.privacy-dropdown .privacy-private { color: var(--red); }

.pill-privacy { font-size: 10px; text-transform: uppercase; letter-spacing: 0.03em; }
.pill-privacy-public { color: var(--green); border-color: var(--green); }
.pill-privacy-secret { color: var(--yellow); border-color: var(--yellow); }
.pill-privacy-private { color: var(--red); border-color: var(--red); }

.type-badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.meta-toggle {
  cursor: pointer;
  border-radius: 3px;
  padding: 0 3px;
  transition: background 0.15s, color 0.15s;
}
.meta-toggle:hover {
  background: var(--text-muted);
  color: var(--bg);
}
.meta-toggle.active {
  background: var(--text-muted);
  color: var(--bg);
}
.meta-models {
  color: var(--text-dim);
  opacity: 0.7;
}
.meta-models .meta-toggle.active {
  opacity: 1;
}
.meta-hidden {
  display: none;
}
.meta-highlight.turn-human {
  border-left-color: var(--blue);
}
.meta-highlight.turn-assistant {
  border-left: 3px solid var(--green);
  padding-left: 0.5rem;
}
.type-badge-session  { color: var(--green); }
.type-badge-plan     { color: var(--blue); }
.type-badge-provider { color: var(--mauve); }
.provider-icon {
  width: 12px;
  height: 12px;
  vertical-align: -2px;
  margin-right: 3px;
  display: inline-block;
}

/* ── Deep Search ── */
.deep-search {
  margin-bottom: 1rem;
  position: relative;
}
.deep-search .deep-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  font-size: 0.95rem;
  margin-left: 0;
}
.deep-search-results {
  position: absolute;
  z-index: 50;
  width: 100%;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.deep-search-count {
  padding: 6px 10px;
  font-size: 0.95rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.deep-search-row {
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
.deep-search-row:last-child {
  border-bottom: none;
}
.deep-search-row:hover,
.deep-search-row.active {
  background: var(--bg-surface);
}
.deep-search-badge {
  font-size: 10px;
  vertical-align: 1px;
}
.deep-search-label {
  color: var(--text-muted);
  font-size: 0.95rem;
}
.deep-search-snippet {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deep-search-snippet mark {
  background: var(--yellow);
  color: var(--bg);
  border-radius: 2px;
  padding: 0 1px;
}
.deep-search-highlight {
  animation: deep-search-flash 1.5s ease-out;
}
@keyframes deep-search-flash {
  0% { background: var(--yellow); background: color-mix(in srgb, var(--yellow) 25%, transparent); }
  100% { background: transparent; }
}

/* ── Turns ── */
.turn-sep {
  border: none;
  border-top: 2px solid var(--border);
  margin: 0.9rem 0 0.4rem;
}

.turn {
  margin: 0;
  padding: 0;
}

.turn-human {
  border-left: 3px solid var(--blue);
  padding-left: 0.5rem;
  margin-left: -0.5rem;
}

/* ── User prompt ── */
.prompt {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
  padding: 0.2rem 0.5em;
  background: var(--bg-surface);
  border-radius: 2px;
  max-width: calc(var(--measure) + 2em);
}

.prompt-char {
  color: var(--blue);
  font-weight: 700;
  flex-shrink: 0;
}

/* Inline plan content below prompt */
.plan-card {
  display: block;
  margin-left: calc(1em + 0.5em);
  margin-top: 0.4rem;
  margin-bottom: 0.2rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--text-muted);
  border-left: 3px solid var(--blue);
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.plan-card:hover {
  border-color: var(--blue);
  background: var(--bg-hover);
}
.plan-card-title {
  display: block;
  color: var(--blue);
  font-weight: 600;
  font-size: 1rem;
}
.plan-card-meta {
  display: block;
  color: var(--text-dim);
  font-size: 1rem;
  margin-top: 0.15rem;
}

.plan-inline {
  padding-left: calc(1em + 0.5em);
  margin-top: 0.2rem;
  max-width: calc(var(--measure) + 2em);
}

.prompt-content {
  flex: 1;
  min-width: 0;
}

/* ── Assistant ── */
.turn-assistant {
  padding: 0.3rem 0 0.3rem 0.6rem;
  margin-left: -0.6rem;
  border-left: 2px solid color-mix(in srgb, var(--green) 32%, transparent);
}

/* ── Block layout (dot gutter + content) ── */
.block {
  margin: 1px 0;
}

/* Two-level rhythm: tool calls cluster tight; reasoning/action steps get air. */
.tool-group + .text-block,
.tool-group + .thinking-block,
.text-block + .tool-group,
.text-block + .thinking-block,
.thinking-block + .text-block,
.thinking-block + .tool-group {
  margin-top: 0.6rem;
}
.turn-assistant > .block:first-child {
  margin-top: 0;
}

.text-block {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
}

.text-block .content {
  flex: 1;
  min-width: 0;
}

.dot {
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.5;
  flex-shrink: 0;
  width: 1em;
  text-align: center;
  padding-top: 0.25em;
}

.dot-muted {
  color: var(--text-muted);
}

/* Green dot marks substance (the model's prose); tool-call dots stay muted. */
.dot-text {
  color: var(--green);
}

/* ── Tool call: ● Name(args) ── */
.tool-group {
  padding-left: 0;
  margin: 0;
}
.tool-group + .tool-group {
  margin-top: 0;
}

.tool-call {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
  line-height: 1.4;
}

.tool-name {
  font-weight: 400;
  color: var(--text-dim);
}

.tool-args {
  color: var(--text-dim);
}

/* ── Tool result: └ summary ── */
.tool-result {
  margin: 0;
  padding-left: calc(1em + 0.5em);
}

.tool-result summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 0.35em;
  font-size: 1rem;
  color: var(--text-dim);
  user-select: none;
  padding: 0;
  line-height: 1.35;
}

.tool-result summary::-webkit-details-marker {
  display: none;
}

.tree {
  color: var(--text-muted);
  flex-shrink: 0;
}
.disclosure {
  display: inline-block;
  transition: transform 0.15s ease;
}
.tool-result[open] > summary .disclosure {
  transform: rotate(90deg);
}

.result-ok {
  color: var(--text-dim);
}
.tool-result-modal .result-ok {
  color: var(--teal);
}
.tool-result summary:hover .result-ok {
  text-decoration: underline;
}
.result-error {
  color: var(--red);
}

.tool-result-inline {
  display: block;
  padding-left: calc(1em + 0.5em);
  font-size: 1rem;
}

.expand-hint {
  color: var(--blue);
  font-size: 1rem;
}
.tool-result summary:hover .expand-hint {
  text-decoration: underline;
}

/* ── Tool result modal trigger ── */
.tool-result-modal {
  padding-left: calc(1em + 0.5em);
  display: flex;
  align-items: baseline;
  gap: 0.35em;
  font-size: 1rem;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  line-height: 1.35;
}
.tool-result-modal:hover .result-ok {
  text-decoration: underline;
}
.group-call-modal {
  cursor: pointer;
  color: var(--blue);
}
.group-call-modal:hover {
  text-decoration: underline;
}

/* ── Expanded content (tool input + result) ── */
.block-expand {
  padding-left: calc(1em + 0.5em);
}

.expand-content,
.thinking-content {
  margin: 2px 0;
  padding: 0.4em 0.6em;
  background: var(--bg-surface);
  font-size: 1rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-x: auto;
  max-height: 500px;
  overflow-y: auto;
  color: var(--text-dim);
  line-height: 1.4;
  border-left: 1px solid var(--border);
}

/* ── Thinking ── */
.thinking-block {
  margin: 1px 0;
}

.thinking-block summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-size: 1rem;
  color: var(--text-muted);
  user-select: none;
  padding: 0;
}

.thinking-block summary::-webkit-details-marker {
  display: none;
}

.thinking-label {
  font-style: italic;
  color: var(--text-muted);
}
.thinking-block summary:hover .thinking-label {
  text-decoration: underline;
}
.thinking-block[open] > summary .disclosure {
  transform: rotate(90deg);
}

/* ── Compaction divider ── */
.turn-compaction {
  padding: 0.4rem 0;
}
.compaction-details summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-dim);
}
.compaction-details summary::-webkit-details-marker { display: none; }
.compaction-label {
  font-style: italic;
}
.compaction-details summary:hover .compaction-label {
  text-decoration: underline;
}
.compaction-details[open] > summary .disclosure {
  transform: rotate(90deg);
}
.compaction-content {
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  border-left: 2px solid var(--border);
  color: var(--text-dim);
  max-height: 30rem;
  overflow-y: auto;
}

/* ── Subagent conversations ── */
.subagent-conversation {
  margin: 2px 0;
  padding-left: calc(1em + 0.5em);
}
.subagent-conversation summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-size: 1rem;
  color: var(--text-muted);
  user-select: none;
}
.subagent-conversation summary::-webkit-details-marker {
  display: none;
}
.subagent-conversation summary:hover .expand-hint {
  text-decoration: underline;
}
.subagent-conversation[open] > summary .disclosure {
  transform: rotate(90deg);
}
.subagent-turns {
  border-left: 2px solid var(--border);
  margin: 0.3rem 0;
  padding-left: 0.75rem;
}
.subagent-turn-human {
  border-left: 2px solid var(--blue);
  padding-left: 0.4rem;
  margin: 0.3rem 0;
}
.subagent-turn-assistant {
  margin: 0.3rem 0;
}

/* ── Markdown content ── */
.content {
  color: var(--text);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Cap prose at a comfortable measure; leave code, diffs and tables full-width
   (the child combinator never selects pre/.chroma/table/.edit-diff/.file-lines). */
.content > p,
.content > ul,
.content > ol,
.content > blockquote,
.content > h1,
.content > h2,
.content > h3,
.content > h4,
.content > h5,
.content > h6 {
  max-width: var(--measure);
}
.content li > p {
  max-width: var(--measure);
}

.content p {
  margin: 0.4em 0;
}
.content p:first-child {
  margin-top: 0;
}
.content p:last-child {
  margin-bottom: 0;
}

.content h1 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0.9em 0 0.35em;
  line-height: 1.25;
  color: var(--text);
}
.content h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0.8em 0 0.3em;
  color: var(--text);
}
.content h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0.7em 0 0.25em;
  color: var(--text-dim);
}
.content h4,
.content h5,
.content h6 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0.6em 0 0.2em;
  color: var(--text-dim);
}
.content h1:first-child,
.content h2:first-child,
.content h3:first-child {
  margin-top: 0;
}

.content ul,
.content ol {
  padding-left: 1.75em;
  margin: 0.4em 0;
}
.content li {
  margin: 0.4em 0;
}
.content li > p {
  margin: 0.4em 0;
}

.content blockquote {
  border-left: 2px solid var(--text-muted);
  padding-left: 0.6em;
  color: var(--text-dim);
  margin: 0.3em 0;
}

.content pre {
  background: var(--bg-surface);
  padding: 0.4em 0.6em;
  overflow-x: auto;
  margin: 0.3em 0;
  font-size: 1rem;
  line-height: 1.4;
}

.content code {
  font-family: var(--font);
  font-size: 1rem;
}
.content p code,
.content li code,
.content td code {
  background: var(--bg-surface);
  padding: 0.1em 0.3em;
  font-size: 1rem;
}
.content pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* ── Chroma syntax highlighting wrapper ── */
.content .chroma {
  background: var(--bg-surface);
  margin: 0.3em 0;
}
.content .chroma pre {
  margin: 0;
  padding: 0.4em 0.6em;
  background: transparent;
}

.content table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.3em 0;
  font-size: 1rem;
}
.content th,
.content td {
  border: 1px solid var(--border);
  padding: 0.3em 0.6em;
  text-align: left;
}
.content th {
  background: var(--bg-surface);
  font-weight: 600;
}

.content a {
  color: var(--blue);
  text-decoration: none;
}
.content a:hover {
  text-decoration: underline;
}
.content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.5em 0;
}
.content strong {
  font-weight: 700;
}
.content em {
  font-style: italic;
}

/* ── Page header (standalone pages) ── */
.page-header {
  padding: 1.5rem 0 0;
}
.page-logo {
  display: inline-block;
  cursor: pointer;
}
.page-logo img {
  height: 1.4rem;
  opacity: 0.6;
  transition: opacity 200ms;
}
.page-logo:hover img {
  opacity: 1;
}

/* ── Privacy page ── */
.privacy {
  line-height: 1.6;
  padding: 1rem 0;
}

/* ── Plan page ── */
.plan-content {
  line-height: 1.6;
}

/* ── Plan history ── */
.history-list {
  margin: 1rem 0;
}

.history-entry {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
}

.history-version {
  color: var(--blue);
  text-decoration: none;
  font-weight: 700;
  min-width: 3em;
}
.history-version:hover {
  text-decoration: underline;
}

.history-date {
  color: var(--text-dim);
  font-size: 1rem;
}

.history-diff {
  color: var(--cyan);
  text-decoration: none;
  font-size: 1rem;
}
.history-diff:hover {
  text-decoration: underline;
}

/* ── Diff view ── */
.diff-view {
  margin: 1rem 0;
  overflow-x: auto;
}

.diff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.4;
}

.diff-line td {
  padding: 0;
  vertical-align: top;
  border: none;
}

.diff-num {
  width: 3em;
  text-align: right;
  padding-right: 0.5em;
  color: var(--text-muted);
  user-select: none;
  font-size: 1rem;
}

.diff-marker {
  width: 1.5em;
  text-align: center;
  color: var(--text-muted);
  user-select: none;
}

.diff-content {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.diff-content pre {
  margin: 0;
  padding: 0;
  background: none;
  font-size: inherit;
  line-height: inherit;
}

.diff-add {
  background: var(--diff-add-bg);
  color: var(--diff-text);
}
.diff-add .diff-marker {
  color: var(--diff-text);
}

.diff-remove {
  background: var(--diff-remove-bg);
  color: var(--diff-text);
}
.diff-remove .diff-marker {
  color: var(--diff-text);
}

/* ── Edit tool inline diff ── */
.edit-diff {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.4;
  margin: 2px 0;
  border-left: 1px solid var(--border);
}

.edit-diff .diff-line td {
  padding: 0;
  vertical-align: top;
  border: none;
}

.edit-diff .diff-num {
  width: 3em;
  text-align: right;
  padding-right: 0.5em;
  color: var(--text-muted);
  user-select: none;
  font-size: 1rem;
}

.edit-diff .diff-marker {
  width: 1.5em;
  text-align: center;
  user-select: none;
}

.edit-diff .diff-content {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: var(--font);
}

.edit-diff .diff-add {
  background: var(--diff-add-bg);
  color: var(--diff-text);
}
.edit-diff .diff-add .diff-marker {
  color: var(--diff-text);
}

.edit-diff .diff-remove {
  background: var(--diff-remove-bg);
  color: var(--diff-text);
}
.edit-diff .diff-remove .diff-marker {
  color: var(--diff-text);
}

/* Word-level highlighting within diff lines */
.diff-word-add {
  background: var(--diff-add-word);
  border-radius: 2px;
}
.diff-word-remove {
  background: var(--diff-remove-word);
  border-radius: 2px;
}

.edit-diff .diff-elided td {
  text-align: center;
  color: var(--text-muted);
  padding: 0.1em 0;
  font-size: 1rem;
}

.edit-diff-grouped {
  margin-left: 1.2em;
}

/* ── File lines (Read tool) ── */
.file-lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.4;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  max-height: 500px;
  overflow-y: auto;
  display: block;
}
.file-lines td {
  padding: 0;
  vertical-align: top;
  border: none;
  white-space: pre;
}
.file-lines .file-line-num {
  width: 3em;
  min-width: 3em;
  text-align: right;
  padding-right: 0.5em;
  color: var(--text-dim);
  user-select: none;
  font-size: 1rem;
}
.file-lines .file-line-content {
  color: var(--text-dim);
  white-space: pre-wrap;
  word-wrap: break-word;
}
tr.file-line-elided td {
  text-align: center;
  color: var(--text-dim);
  opacity: 0.6;
  padding: 0.8em 0;
}
.file-lines-grouped {
  margin-left: 1.2em;
}
.expand-content-grouped {
  margin-left: 1.2em;
}

.group-call {
  margin: 1px 0;
}
.group-call b {
  font-weight: 400;
  color: var(--text-dim);
}

/* ── 404 ── */
.notfound {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}

.notfound-ghost {
  white-space: pre;
  line-height: 1.1;
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  animation: ghost-float 3s ease-in-out infinite;
  background: linear-gradient(
    90deg,
    #e78284 0%,
    #e5c890 16.7%,
    #a6d189 33.3%,
    #81c8be 50%,
    #8caaee 66.7%,
    #f4b8e4 83.3%,
    #e78284 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

@keyframes ghost-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.notfound-code {
  font-size: 3rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.notfound-msg {
  font-size: 1rem;
  color: var(--text-dim);
}

/* ── Footer ── */
.footer {
  margin-top: 1.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 1rem;
  color: var(--text-muted);
  text-align: center;
}

.footer a {
  color: var(--text-dim);
  text-decoration: none;
}
.footer a:hover {
  color: var(--text);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── File references ── */
.file-ref {
  font-weight: 700;
  color: var(--text);
}

/* ── File modal ── */
.file-dialog {
  border: none;
  padding: 0;
  margin: auto;
  width: min(92vw, 920px);
  max-width: 920px;
  max-height: 80vh;
  background: var(--bg-surface);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  color: var(--text);
}
.file-dialog::backdrop {
  background: rgba(0, 0, 0, 0.3);
}
.file-dialog-content {
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}
.file-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.file-dialog-path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: rtl;
  text-align: left;
}
.file-dialog-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  line-height: 1;
  flex-shrink: 0;
  margin-left: 1rem;
  border-radius: 4px;
}
.file-dialog-close:focus {
  outline: none;
}
.file-dialog-close:hover {
  background: rgba(140, 170, 238, 0.1);
  color: var(--text);
}
.file-dialog-body {
  overflow: auto;
  flex: 1;
}
.file-dialog-code {
  width: 100%;
  border-collapse: collapse;
  border: 0;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text);
}
.file-dialog-code tr {
  transition: background 0.1s;
}
.file-dialog-code tr:hover {
  background: rgba(140, 170, 238, 0.04);
}
.file-dialog-code td {
  white-space: pre;
  vertical-align: top;
  border: none;
  color: var(--text);
}
.file-dialog-code .line-num {
  padding: 0 1rem 0 0.75rem;
  color: var(--text-dim);
  text-align: right;
  user-select: none;
  min-width: 3em;
  opacity: 0.5;
  border-right: 1px solid var(--border);
}
.file-dialog-code .line-content {
  padding: 0 1rem 0 0.75rem;
}
.file-dialog-code .highlight {
  background: rgba(140, 170, 238, 0.12);
}
.file-dialog-code .highlight .line-num {
  opacity: 1;
  color: var(--blue);
}
.file-dialog-code mark {
  background: rgba(231, 196, 114, 0.25);
  color: inherit;
  border-radius: 2px;
  padding: 0.1em 0;
}

/* ── Reactions ── */
.reactions-layer {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  width: 120px;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}

.reaction-float {
  position: absolute;
  top: -60px;
  pointer-events: none;
  animation: reaction-fall 8s linear forwards;
  opacity: 0.9;
}
.reaction-float svg {
  width: 48px;
  height: 48px;
}

@keyframes reaction-fall {
  0% {
    transform: translateY(0) scale(1);
  }
  100% {
    transform: translateY(4000px) scale(0.8);
  }
}

.toolbar {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 60;
  display: flex;
  gap: 0.5rem;
  transition: opacity 0.2s;
}
@media (max-width: 1500px) {
  .toolbar {
    opacity: 0.4;
  }
  .toolbar:hover {
    opacity: 1;
  }
}
.toolbar-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  transition: background 0.2s;
  line-height: 1;
}
.toolbar-btn svg {
  width: 16px;
  height: 16px;
  display: block;
  transition: fill 0.2s, stroke 0.2s;
}
.toolbar-btn:hover {
  background: var(--border);
}
.toolbar-btn:hover svg {
  fill: var(--text-dim);
  stroke: var(--text-dim);
}
.toolbar-user {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: 6px;
  padding: 4px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.5;
  text-decoration: none;
  cursor: pointer;
}
.toolbar-user:hover {
  border-color: var(--text-muted);
}
.toolbar-expiry {
  color: var(--text-dim);
  font-size: 0.65rem;
}
.user-dropdown {
  position: relative;
}
.user-dropdown-chevron {
  width: 10px;
  height: 10px;
  vertical-align: -1px;
  opacity: 0.5;
  transition: transform 0.15s;
}
.user-dropdown.open .user-dropdown-chevron { transform: rotate(180deg); }
.user-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 100;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 160px;
}
.user-dropdown.open .user-dropdown-menu { display: flex; flex-direction: column; }
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  white-space: nowrap;
  background: none;
  border: none;
  border-radius: 4px;
  padding: 6px 8px;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.user-dropdown-item:hover { background: var(--bg-surface); }
.user-dropdown-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.user-dropdown-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2px 4px;
}
.user-dropdown-logout { color: var(--text-muted); }
.user-dropdown-logout:hover { color: var(--text); }

.reactions-bar {
  position: fixed;
  bottom: 1.5rem;
  right: 1rem;
  z-index: 60;
  display: flex;
  gap: 1rem;
  transition: transform 0.3s ease;
}
.reactions-bar.muted {
  transform: translateX(calc(100% + 1rem));
}

.reactions-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.15s;
  line-height: 1;
  position: relative;
}
.reactions-btn svg {
  width: 32px;
  height: 32px;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}
.reactions-count {
  position: absolute;
  bottom: -4px;
  right: -6px;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--text);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1px 4px;
  pointer-events: none;
}
.reactions-count:empty {
  display: none;
}
.reactions-btn:hover {
  transform: scale(1.2);
}
.reactions-btn:active {
  transform: scale(0.9);
}
.reactions-btn:disabled {
  pointer-events: none;
}
.reactions-btn.cooldown {
  pointer-events: none;
  animation: reaction-cooldown 1s linear forwards;
}
@keyframes reaction-cooldown {
  0%   { opacity: 0.3; }
  100% { opacity: 1; }
}

/* ── Home / Landing ── */
.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 0;
}

.home-logo {
  margin-bottom: 1.5rem;
}

.home-shuriken-svg {
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
}

.home-title {
  display: block;
  width: 100%;
  max-width: 672px;
  height: auto;
  margin: 0 auto;
}

.home-tagline {
  font-size: 1rem;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}
.home-tagline-sub {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}
.home-tagline a {
  color: var(--blue);
  text-decoration: none;
}
.home-tagline a:hover {
  text-decoration: underline;
}

#install-app {
  display: none;
}
.home-install {
  margin-bottom: 1rem;
  text-align: center;
  width: 100%;
  max-width: 520px;
}

.home-install-label {
  font-size: 1rem;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

.home-install-row {
  display: flex;
  align-items: stretch;
}

.home-install-cmd {
  flex: 1;
  display: block;
  background: var(--bg-surface);
  padding: 0.6em 1em;
  font-size: 1rem;
  color: var(--green);
  border-left: 2px solid var(--green);
  cursor: text;
}

.home-copy-btn {
  background: var(--bg-surface);
  border: none;
  border-left: 1px solid var(--border);
  padding: 0 0.75em;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.home-copy-btn:hover {
  color: var(--green);
}
.home-copy-btn svg {
  width: 16px;
  height: 16px;
}

.home-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.65em 1.5em;
  background: var(--green);
  color: var(--bg);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  border-radius: 4px;
  transition: opacity 0.15s;
}
.home-download-btn:hover {
  opacity: 0.85;
}
.home-download-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.home-download-sub {
  margin-top: 0.4rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}
.home-download-version {
  font-weight: 400;
  opacity: 0.7;
}
.home-install-cli {
  text-align: left;
  margin-bottom: 2rem;
}

.home-section-label {
  font-size: 1rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  text-align: left;
}

/* ── Quickstart ── */
.home-quickstart {
  margin-top: 1.5rem;
  text-align: left;
  width: 100%;
  max-width: 520px;
}
.home-steps {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.home-step {
  display: flex;
  gap: 0.75em;
  padding: 0.75em 0;
  border-bottom: 1px solid var(--border);
}
.home-step:last-child {
  border-bottom: none;
}
.home-step-num {
  color: var(--green);
  font-weight: 700;
  flex-shrink: 0;
  width: 1.5em;
  text-align: right;
}
.home-step-body {
  flex: 1;
  min-width: 0;
}
.home-step-title {
  color: var(--text);
  font-weight: 700;
  margin-bottom: 0.25em;
}
.home-step-cmd {
  display: block;
  background: var(--bg-surface);
  padding: 0.4em 0.75em;
  font-size: 1rem;
  color: var(--green);
  border-left: 2px solid var(--green);
}
.home-step-note {
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: 0.25em;
}
.home-step-output {
  color: var(--text-dim);
  font-size: 1rem;
  margin-top: 0.25em;
}
.home-step-output a {
  color: var(--blue);
  text-decoration: none;
}
.home-step-output a:hover {
  text-decoration: underline;
}

/* ── Features grid ── */
.home-features {
  margin-top: 3rem;
  text-align: left;
  width: 100%;
  max-width: 620px;
}
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem 2rem;
}
.home-grid-item {
  display: flex;
  gap: 0.75em;
  align-items: flex-start;
}
.home-grid-icon {
  font-weight: 700;
  flex-shrink: 0;
  width: 2.5em;
  text-align: right;
}
.home-grid-icon--green { color: var(--green); }
.home-grid-icon--red { color: var(--red); }
.home-grid-icon--blue { color: var(--blue); }
.home-grid-icon--peach { color: var(--peach); }
.home-grid-icon--yellow { color: var(--yellow); }
.home-grid-icon--magenta { color: var(--magenta); }
.home-grid-title {
  color: var(--text);
  font-weight: 700;
}
.home-grid-desc {
  color: var(--text-dim);
  font-size: 1rem;
}

/* ── macOS app showcase ── */
.home-app {
  margin-top: 3rem;
  text-align: left;
  width: 100%;
  max-width: 620px;
}
.home-app-showcase {
  display: flex;
  gap: 2rem;
  align-items: center;
}
.home-app-media {
  flex-shrink: 0;
  width: 220px;
}
.home-app-video {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.home-app-details {
  flex: 1;
}
.home-app-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.home-app-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
}
.home-app-features li {
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1.6;
}
.home-app-features li::before {
  content: "* ";
  color: var(--green);
  font-weight: 700;
}
.home-download-btn-sm {
  font-size: 0.95rem;
  padding: 0.5em 1.2em;
}
.home-app-docs-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  margin-left: 1rem;
}
.home-app-docs-link:hover {
  color: var(--blue);
}

/* Theme-aware video toggle */
.home-app-video.theme-light { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .home-app-video.theme-dark { display: none; }
  :root:not([data-theme]) .home-app-video.theme-light { display: block; }
}
:root[data-theme="light"] .home-app-video.theme-dark { display: none; }
:root[data-theme="light"] .home-app-video.theme-light { display: block; }
:root[data-theme="dark"] .home-app-video.theme-light { display: none; }
:root[data-theme="dark"] .home-app-video.theme-dark { display: block; }

@media (max-width: 768px) {
  .home-app-showcase {
    flex-direction: column;
    text-align: center;
  }
  .home-app-media {
    width: 200px;
  }
  .home-app-docs-link {
    margin-left: 0;
    display: block;
    margin-top: 0.5rem;
  }
}

/* ── Examples ── */
.home-examples {
  margin-top: 3rem;
  text-align: left;
  width: 100%;
  max-width: 620px;
}
.home-examples-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ── Trust line ── */
.home-capacity {
  margin-top: 0.75rem;
  margin-bottom: 1.5rem;
  max-width: 420px;
  width: 100%;
}
.capacity-bar-track {
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 0.35rem;
}
.capacity-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.capacity-bar-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 0.2rem;
}
.capacity-rationale {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.4;
}
.home-trust {
  margin-top: 2rem;
  color: var(--text-muted);
  font-size: 1rem;
}
.home-trust a {
  color: var(--blue);
  text-decoration: none;
}
.home-trust a:hover {
  text-decoration: underline;
}

.home-demo {
  margin-top: 3rem;
  text-align: left;
  width: 100%;
  max-width: 620px;
}

.home-demo-label {
  font-size: 1rem;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

/* ── Mock terminal ── */
.term {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
  width: 100%;
}
.term-chrome {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.term-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.term-dot-red    { background: var(--red);    opacity: 0.7; }
.term-dot-yellow { background: var(--yellow); opacity: 0.7; }
.term-dot-green  { background: var(--green);  opacity: 0.7; }
.term-title {
  font-size: 1rem;
  color: var(--text-dim);
  margin-left: auto;
  margin-right: auto;
}
.term-body {
  padding: 12px;
  font-size: 1rem;
  line-height: 1.5;
  max-height: 320px;
  overflow-y: auto;
  cursor: text;
}
.term-line {
  white-space: pre-wrap;
  word-break: break-all;
}
.term-line-cmd    { color: var(--green); }
.term-line-prompt { color: var(--text-muted); }
.term-line-output { color: var(--text); }
.term-line-dim    { color: var(--text-dim); }
.term-line-error  { color: var(--red); }
.term-line-blue   { color: var(--blue); }
.term-line-cyan   { color: var(--cyan); }
.term-line-green  { color: var(--green); }
.term-line-yellow { color: var(--yellow); }
.term-line-bold   { font-weight: bold; }
.term-s-blue     { color: var(--blue); }
.term-s-lavender { color: var(--lavender); }
.term-s-teal     { color: var(--teal); }
.term-s-peach    { color: var(--peach); }
.term-s-muted    { color: var(--text-muted); }
.term-s-dim      { color: var(--text-dim); }
.term-s-green    { color: var(--green); }
.term-s-red      { color: var(--red); }
.term-s-yellow   { color: var(--yellow); }
.term-input-line {
  display: flex;
  align-items: center;
}
.term-prompt {
  color: var(--text-muted);
  user-select: none;
  margin-right: 0.4em;
}
.term-input {
  color: var(--green);
  white-space: pre;
}
.term-cursor {
  display: inline-block;
  width: 7px;
  height: 15px;
  background: var(--text);
  animation: term-blink 1s step-end infinite;
  vertical-align: text-bottom;
}
@keyframes term-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}
.term-hint {
  font-size: 1rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
  text-align: right;
  opacity: 0;
  transition: opacity 0.3s;
}
.term-hint-visible { opacity: 1; }

/* ── Profile ── */
.profile {
  padding: 1rem 0;
}
.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.profile-avatar svg { display: block; }
.profile-username {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.25rem;
}
.profile-meta {
  font-size: 1rem;
  color: var(--text-dim);
}
.profile-sep {
  margin: 0 0.3em;
  color: var(--text-muted);
}

/* ── Tile grid ── */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.tile {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
}
.tile:hover { border-color: var(--text-muted); }
.tile-chrome {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.tile-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.tile-dot-red    { background: var(--red);    opacity: 0.7; }
.tile-dot-yellow { background: var(--yellow); opacity: 0.7; }
.tile-dot-green  { background: var(--green);  opacity: 0.7; }
.tile-type {
  font-size: 11px;
  margin-left: auto;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.tile-type-session { color: var(--green); }
.tile-type-plan    { color: var(--blue); }
.tile-type-project { color: var(--teal); }
.tile-type-skill   { color: var(--peach); }
.tile-body {
  padding: 12px;
  flex: 1;
}
.tile-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile-desc {
  font-size: 1rem;
  color: var(--text-dim);
  line-height: 1.4;
  margin-top: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-snippet {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-snippet mark {
  background: var(--yellow);
  color: var(--base);
  padding: 0 2px;
  border-radius: 2px;
}
.tile-versions {
  font-size: 1rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}
.tile-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  font-size: 1rem;
  color: var(--text-muted);
}
.tile-reactions {
  display: flex;
  gap: 0.6em;
}
.tile-reaction {
	font-variant-numeric: tabular-nums;
	display: inline-flex;
	align-items: center;
	gap: 0.2em;
}
.tile-reaction svg {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
}

/* ── Profile pagination ── */
.profile-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  font-size: 1rem;
}
.profile-page-link {
  color: var(--blue);
  text-decoration: none;
}
.profile-page-link:hover { text-decoration: underline; }
.profile-page-disabled { color: var(--text-muted); }
.profile-page-current { color: var(--text-dim); }
.profile-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 4rem 0;
  font-size: 1rem;
}

/* ── Turn navigation ── */
.turn-nav {
  display: flex;
  gap: 1em;
  padding: 0.15rem 0.5em;
  font-size: 1rem;
  color: var(--text-dim);
}

.turn-nav a {
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
}

.turn-nav a:hover {
  color: var(--blue);
}

.turn-nav-pos {
  color: var(--text-dim);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  body {
    font-size: 1rem;
  }
  .container {
    padding: 0.75rem;
  }
  .turn-human {
    border-left-width: 2px;
    padding-left: 0.3rem;
    margin-left: -0.3rem;
  }
  .reactions-btn svg {
    width: 28px;
    height: 28px;
  }
  .reaction-float svg {
    width: 36px;
    height: 36px;
  }
  .file-dialog {
    width: 95vw;
  }
  .term-body {
    max-height: 260px;
    font-size: 1rem;
  }
  .profile-header {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  .profile-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25em;
  }
  .profile-grid {
    grid-template-columns: 1fr;
  }
  .home-grid {
    grid-template-columns: 1fr;
  }
  .home-examples-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Docs ───────────────────────────────────────────────────────── */

.docs {
  display: flex;
  gap: 2rem;
  min-height: 60vh;
}

.docs-sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding-right: 1.5rem;
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
}

.docs-logo {
  display: block;
  margin-bottom: 1rem;
  cursor: pointer;
}

.docs-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.docs-home {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.docs-home:hover { color: var(--blue); }

.docs-section {
  margin: 0.5rem 0;
}

.docs-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
  margin-top: 0.75rem;
}

.docs-nav-link {
  display: block;
  font-size: 1rem;
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.15rem 0 0.15rem 0.75rem;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.docs-nav-link:hover {
  color: var(--text);
}

.docs-nav-active {
  color: var(--blue);
  border-left-color: var(--blue);
}

.docs-home.docs-nav-active {
  color: var(--blue);
}

.docs-version {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-dim);
}

.docs-content {
  flex: 1;
  min-width: 0;
  max-width: 800px;
}

.docs-content h1 {
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
}

.docs-content h2 {
  font-size: 1.1rem;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.docs-content h3 {
  font-size: 1rem;
  margin-top: 1.5rem;
  margin-bottom: 0.35rem;
}

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  margin: 1rem 0;
}

.docs-content th,
.docs-content td {
  text-align: left;
  padding: 0.4em 0.75em;
  border: 1px solid var(--border);
}

.docs-content th {
  background: var(--bg-surface);
  font-weight: 700;
  color: var(--text);
}

.docs-content td {
  color: var(--text-dim);
}

.docs-content td code {
  font-size: 1rem;
  background: var(--bg-surface);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

.docs-content img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin: 1rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

:root[data-theme="light"] .docs-content img {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.docs-content img[src*="macos-"] {
  max-width: 360px;
}

/* Theme-aware documentation images */
.docs-content img.theme-light { display: none; }

:root[data-theme="light"] .docs-content img.theme-dark { display: none; }
:root[data-theme="light"] .docs-content img.theme-light { display: block; }

/* Inline SVG icons in docs (reaction icons, etc.) */
.docs-content img[src$=".svg"] {
  display: inline;
  vertical-align: middle;
  border: none;
  box-shadow: none;
  border-radius: 0;
  margin: 0 0.15em;
  height: 1.2em;
  width: auto;
}

.docs-content img.theme-light[src$=".svg"] { display: none; }

:root[data-theme="light"] .docs-content img.theme-dark[src$=".svg"] { display: none; }
:root[data-theme="light"] .docs-content img.theme-light[src$=".svg"] { display: inline; }

/* ── Code copy button (docs) ── */
.code-copy-btn {
  position: absolute;
  top: 0.3em;
  right: 0.3em;
  background: none;
  border: none;
  padding: 0.25em;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s;
}
.code-copy-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}
.code-copy-btn:hover {
  color: var(--green);
}
.code-copy-btn.copied {
  color: var(--green);
}

.docs-nav-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 1rem;
}

.docs-nav-footer a {
  color: var(--blue);
  text-decoration: none;
}

.docs-nav-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .docs {
    flex-direction: column;
  }
  .docs-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    position: static;
    max-height: none;
  }
}

/* ── Project page ── */
.project-description {
  color: var(--text-muted);
  margin: 0 0 24px;
  line-height: 1.5;
}
.project-link {
  color: var(--teal);
}
.project-link:hover {
  color: var(--blue);
}
.type-badge-project {
  color: var(--teal);
}

/* Project filters */
.project-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-pills {
  display: flex;
  gap: 4px;
}
.filter-pill {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 0.85em;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.filter-pill:hover {
  border-color: var(--text-muted);
  color: var(--text);
}
.filter-pill-active {
  border-color: var(--green);
  color: var(--green);
  background: var(--bg-surface);
}
.filter-branch {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85em;
  cursor: pointer;
}
.filter-branch:hover {
  border-color: var(--text-muted);
}
.filter-search {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  width: 160px;
  margin-left: auto;
}
.filter-search:focus {
  outline: none;
  border-color: var(--blue);
}
.filter-search::placeholder {
  color: var(--text-dim);
}

/* Unified timeline */
.project-timeline {
  position: relative;
  padding-left: 24px;
}
.project-timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}
.timeline-row {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}
.timeline-row:hover {
  background: var(--bg-surface);
}
.timeline-dot {
  position: absolute;
  left: -24px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  box-sizing: border-box;
  flex-shrink: 0;
}
.timeline-dot-session {
  background: var(--green);
}
.timeline-dot-plan {
  background: var(--blue);
}
.timeline-row .type-badge {
  flex-shrink: 0;
  min-width: 56px;
  text-align: center;
}
.timeline-title {
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.timeline-pills {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.8em;
  white-space: nowrap;
}
.pill-branch {
  color: var(--teal);
}
.pill-provider {
  color: var(--text-muted);
}
.pill-provider img {
  width: 14px;
  height: 14px;
  vertical-align: middle;
}
.pill-turns {
  color: var(--text-dim);
}
.pill-version {
  color: var(--text-dim);
}
.timeline-time {
  flex-shrink: 0;
  font-size: 0.85em;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ── Dashboard ── */
.dashboard {
  padding: 1rem 0;
}
.dashboard-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.dashboard-search {
  margin-bottom: 1.5rem;
}
.dashboard-search-input {
  width: 100%;
  box-sizing: border-box;
}
.search-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.search-filters .filter-pills {
  display: flex;
  align-items: center;
  gap: 4px;
}
.filter-label {
  font-size: 0.8em;
  color: var(--text-dim);
  margin-right: 6px;
}
.timeline-snippet {
  margin-left: 24px;
  padding-left: 24px;
  margin-top: -4px;
  margin-bottom: 8px;
}
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.dashboard-stat {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  text-align: center;
  background: var(--bg-surface);
}
.dashboard-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}
.dashboard-stat-label {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}
.dashboard-section {
  margin-bottom: 2rem;
}
.dashboard-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.dashboard-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.dashboard-actions {
  display: flex;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.dashboard-action {
  color: var(--blue);
  font-size: 0.9rem;
}
.dashboard-action:hover {
  text-decoration: underline;
}
.tile-privacy {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-dim);
}
.dashboard-storage {
  margin-bottom: 2rem;
}
.dashboard-storage-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.4rem;
}
.dashboard-storage-label {
  font-size: 0.85rem;
  color: var(--text-dim);
}
.dashboard-storage-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.dashboard-storage-track {
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
}
.dashboard-storage-segment {
  height: 100%;
  transition: width 0.3s ease;
}
.dashboard-storage-segment:first-child {
  border-radius: 2px 0 0 2px;
}
.dashboard-storage-segment:last-child {
  border-radius: 0 2px 2px 0;
}
.dashboard-storage-segment:only-child {
  border-radius: 2px;
}
.dashboard-storage-cat-sessions { background: var(--blue); }
.dashboard-storage-cat-plans { background: var(--green); }
.dashboard-storage-cat-skills { background: var(--yellow); }
.dashboard-storage-cat-search { background: var(--mauve); }
.dashboard-storage-cat-other { background: var(--text-dim); }
.dashboard-storage-warn {
  border-color: var(--yellow);
}
.dashboard-storage-danger {
  border-color: var(--red);
}
.dashboard-storage-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.dashboard-storage-legend-item {
  display: inline-flex;
  align-items: center;
}
.dashboard-storage-legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 0.3rem;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Skill pages */
.type-badge-skill { color: var(--peach); }
.skill-page { max-width: 960px; margin: 0 auto; }
.skill-header { margin-bottom: 1.5em; }
.skill-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.3em;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 0.3em;
}
.skill-sep { color: var(--text-dim); }
.skill-name {
  font-family: var(--font);
  font-size: 28px;
  color: var(--peach);
  margin: 0 0 0.3em;
  font-weight: 600;
}
.skill-description {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 0.8em;
  line-height: 1.5;
}
.skill-meta-bar {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 0.4em;
}
.skill-meta-bar a { color: var(--blue); }
.skill-arg-hint {
  background: var(--bg-surface);
  padding: 0.15em 0.4em;
  font-size: 11px;
  color: var(--text-dim);
}
.skill-usage {
  margin-top: 0.6em;
}
.skill-usage-row {
  display: flex;
  align-items: stretch;
  background: var(--bg-surface);
  border-left: 2px solid var(--peach);
  max-width: 520px;
}
.skill-usage-prompt {
  padding: 0.5em 0 0.5em 0.8em;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 13px;
  user-select: none;
}
.skill-usage-cmd {
  flex: 1;
  padding: 0.5em 0.6em;
  font-family: var(--font);
  font-size: 13px;
  color: var(--peach);
  cursor: text;
  user-select: all;
}
.skill-copy-btn {
  background: transparent;
  border: none;
  border-left: 1px solid var(--border);
  padding: 0 0.75em;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}
.skill-copy-btn:hover { color: var(--peach); }
.skill-copy-btn svg { width: 16px; height: 16px; }

/* Skill file browser */
.skill-file-browser {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1.5em;
}
.skill-file-list {
  border-bottom: 1px solid var(--border);
}
.skill-file-entry {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.4em 0.8em;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.skill-file-entry:last-child { border-bottom: none; }
.skill-file-entry:hover { background: var(--bg-surface); }
.skill-file-active { background: var(--bg-surface); }
.skill-file-icon {
  width: 1.2em;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}
.skill-file-name {
  flex: 1;
  color: var(--text);
  font-family: var(--font);
}
.skill-file-size {
  color: var(--text-dim);
  font-size: 11px;
  font-family: var(--font);
}
.skill-file-viewer {
  min-height: 80px;
  background: var(--bg-surface);
}
.skill-file-viewer-empty,
.skill-file-loading {
  padding: 1.5em;
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}
.skill-file-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4em 0.8em;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  font-size: 12px;
}
.skill-file-viewer-name {
  font-family: var(--font);
  color: var(--text-muted);
}
.skill-file-raw {
  color: var(--text-dim);
  font-size: 11px;
}
.skill-file-raw:hover { color: var(--blue); }
.skill-file-code {
  padding: 0.6em 0.8em;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
}
.skill-file-code pre {
  margin: 0;
  background: transparent;
}

/* Skill documentation section */
.skill-docs {
  margin-top: 1em;
}
.skill-section-title {
  font-size: 14px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.5em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border);
}

/* Skill badge in session metadata */
.skill-badge {
  color: var(--peach);
  font-family: var(--font);
  font-size: 11px;
}

/* Skill dot in timeline */
.timeline-dot-skill { background: var(--peach); }

/* ── Admin app (/admin) ── */
.admin { padding-bottom: 2rem; }
.admin-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 0 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.admin-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--peach);
  border: 1px solid var(--peach);
  border-radius: 10px;
  padding: 1px 8px;
}
.admin-nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.admin-nav-link {
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.admin-nav-link:hover { color: var(--text); background: var(--bg-surface); }
.admin-nav-active { color: var(--text); background: var(--bg-surface); }
.admin-logout { margin-left: auto; }
.admin-page-hd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.admin-page-hd h1 { font-size: 1.4rem; display: flex; align-items: center; gap: 0.6rem; }
.admin-hint { font-size: 0.8rem; color: var(--text-dim); }
.admin-hint a, .admin-hint code { color: var(--text-muted); }
.admin-dim { color: var(--text-dim); }
.admin-small { font-size: 0.75rem; }
.admin-mono { font-family: var(--font); }
.admin-break { overflow-wrap: anywhere; }
.admin-ok { color: var(--green); }
.admin-warn { color: var(--yellow); }
.admin-err { color: var(--red); }
.admin-num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: start;
}
.admin-span { grid-column: 1 / -1; }
.admin-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  margin-bottom: 1rem;
  overflow: hidden;
}
.admin-grid > .admin-card { margin-bottom: 0; }
.admin-card-danger { border-color: var(--red); }
.admin-card-hd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 8px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.admin-card-hd h2 { font-size: 0.95rem; font-weight: 700; }
.admin-card-bd { padding: 12px; }
.admin-card-bd > p { margin-bottom: 0.75rem; }
.admin-stat-red .dashboard-stat-value { color: var(--red); }
.admin-stat-yellow .dashboard-stat-value { color: var(--yellow); }
.admin-kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}
.admin-kv dt { color: var(--text-dim); }
.admin-kv dd { min-width: 0; }
.admin-checks { list-style: none; font-size: 0.9rem; }
.admin-checks li { display: flex; align-items: center; gap: 0.5rem; padding: 2px 0; }
.admin-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.admin-dot-ok { background: var(--green); }
.admin-dot-warn { background: var(--yellow); }
.admin-dot-err { background: var(--red); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th, .admin-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.admin-table th { color: var(--text-dim); font-weight: 400; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.admin-table tbody tr:hover { background: var(--bg-surface); }
.admin-table code { font-size: 0.85em; }
.admin-table-audit td:last-child { color: var(--text-muted); }
.admin-table-audit td:first-child, .admin-table-users td:nth-child(8) { white-space: nowrap; }
.admin-row-actions { white-space: nowrap; text-align: right; }
.admin-row-actions form { display: inline-block; margin-left: 4px; }
.admin-user-link { color: var(--blue); text-decoration: none; }
.admin-user-link:hover { text-decoration: underline; }
.admin-status { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
.admin-status-active { color: var(--green); border-color: var(--green); }
.admin-status-banned { color: var(--red); border-color: var(--red); }
.admin-status-suspended { color: var(--yellow); border-color: var(--yellow); }
.admin-empty { color: var(--text-dim); font-size: 0.9rem; }
.admin-flash {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.admin-flash-ok { border-color: var(--green); color: var(--green); }
.admin-flash-err { border-color: var(--red); color: var(--red); }
.admin-form { margin-top: 0.5rem; }
.admin-form-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.admin-field { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; min-width: 0; }
.admin-field > span { color: var(--text-dim); font-size: 0.8rem; }
.admin-grow { flex: 1 1 200px; }
.admin-input {
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  width: 100%;
}
.admin-input:focus { outline: none; border-color: var(--blue); }
.admin-textarea { resize: vertical; min-height: 5em; line-height: 1.4; }
.admin-check { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; font-size: 0.9rem; }
.admin-settings .admin-field { margin-bottom: 0.75rem; }
.admin-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-top: 0.5rem; }
.admin-inline { display: inline-block; margin-left: 0.5rem; }
.admin-btn {
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--bg);
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  line-height: 1.4;
}
.admin-btn:hover { filter: brightness(1.1); }
.admin-btn:disabled { opacity: 0.5; cursor: default; }
.admin-btn-ghost { background: transparent; color: var(--blue); }
.admin-btn-ghost:hover { background: var(--bg-surface); }
.admin-btn-danger { background: var(--red); border-color: var(--red); color: var(--bg); }
.admin-btn-danger.admin-btn-ghost { background: transparent; color: var(--red); }
.admin-copy { background: none; border: none; cursor: pointer; color: var(--text-muted); vertical-align: middle; padding: 0 2px; }
.admin-copy svg { width: 13px; height: 13px; }
.admin-copy:hover { color: var(--text); }
.admin-log {
  margin-top: 0.75rem;
  min-height: 3em;
  max-height: 18em;
  overflow: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.8rem;
  white-space: pre-wrap;
  color: var(--text-muted);
}
.admin-log:empty::before { content: "idle"; color: var(--text-dim); }
.admin-login { max-width: 460px; margin: 3rem auto; }
.admin-search { margin-bottom: 0.75rem; }
@media (max-width: 700px) {
  .admin-kv { grid-template-columns: 1fr; gap: 0.1rem 0; }
  .admin-kv dt { margin-top: 0.4rem; }
  .admin-table-users { display: block; overflow-x: auto; }
}

.chroma { color: #c6d0f5; background-color: #303446; }
.hljs-keyword, .hljs-selector-tag { color: #ca9ee6; background-color: #303446 }
.hljs-literal { color: #ef9f76; background-color: #303446 }
.hljs-type { color: #e78284; background-color: #303446 }
.hljs-title, .hljs-title.function_ { color: #8caaee; background-color: #303446 }
.hljs-title.class_, .hljs-title.class_.inherited__ { color: #e5c890; background-color: #303446 }
.hljs-built_in { color: #99d1db; background-color: #303446 }
.hljs-attr, .hljs-attribute, .hljs-property { color: #8caaee; background-color: #303446 }
.hljs-variable, .hljs-template-variable, .hljs-variable.language_ { color: #f2d5cf; background-color: #303446 }
.hljs-tag, .hljs-name, .hljs-selector-id, .hljs-selector-class { color: #ca9ee6; background-color: #303446 }
.hljs-symbol, .hljs-bullet { color: #a6d189; background-color: #303446 }
.hljs-string, .hljs-quote { color: #a6d189; background-color: #303446 }
.hljs-regexp { color: #81c8be; background-color: #303446 }
.hljs-number { color: #ef9f76; background-color: #303446 }
.hljs-operator { color: #99d1db; background-color: #303446; font-weight: bold }
.hljs-punctuation { color: #c6d0f5; background-color: #303446 }
.hljs-comment { color: #737994; background-color: #303446; font-style: italic }
.hljs-meta, .hljs-meta .hljs-keyword, .hljs-meta .hljs-string { color: #737994; background-color: #303446; font-style: italic }
.hljs-doctag { color: #737994; background-color: #303446; font-style: italic }
.hljs-addition { color: #a6d189; background-color: #414559 }
.hljs-deletion { color: #e78284; background-color: #414559 }
.hljs-section { color: #ef9f76; background-color: #303446; font-weight: bold }
.hljs-emphasis { color: #c6d0f5; background-color: #303446; font-style: italic }
.hljs-strong { color: #c6d0f5; background-color: #303446; font-weight: bold }
.hljs-params { color: #c6d0f5; background-color: #303446 }

:root[data-theme="light"] .chroma { color: #4c4f69; background-color: #eff1f5; }
:root[data-theme="light"] .hljs-keyword, :root[data-theme="light"] .hljs-selector-tag { color: #8839ef; background-color: #eff1f5 }
:root[data-theme="light"] .hljs-literal { color: #fe640b; background-color: #eff1f5 }
:root[data-theme="light"] .hljs-type { color: #d20f39; background-color: #eff1f5 }
:root[data-theme="light"] .hljs-title, :root[data-theme="light"] .hljs-title.function_ { color: #1e66f5; background-color: #eff1f5 }
:root[data-theme="light"] .hljs-title.class_, :root[data-theme="light"] .hljs-title.class_.inherited__ { color: #df8e1d; background-color: #eff1f5 }
:root[data-theme="light"] .hljs-built_in { color: #04a5e5; background-color: #eff1f5 }
:root[data-theme="light"] .hljs-attr, :root[data-theme="light"] .hljs-attribute, :root[data-theme="light"] .hljs-property { color: #1e66f5; background-color: #eff1f5 }
:root[data-theme="light"] .hljs-variable, :root[data-theme="light"] .hljs-template-variable, :root[data-theme="light"] .hljs-variable.language_ { color: #dc8a78; background-color: #eff1f5 }
:root[data-theme="light"] .hljs-tag, :root[data-theme="light"] .hljs-name, :root[data-theme="light"] .hljs-selector-id, :root[data-theme="light"] .hljs-selector-class { color: #8839ef; background-color: #eff1f5 }
:root[data-theme="light"] .hljs-symbol, :root[data-theme="light"] .hljs-bullet { color: #40a02b; background-color: #eff1f5 }
:root[data-theme="light"] .hljs-string, :root[data-theme="light"] .hljs-quote { color: #40a02b; background-color: #eff1f5 }
:root[data-theme="light"] .hljs-regexp { color: #179299; background-color: #eff1f5 }
:root[data-theme="light"] .hljs-number { color: #fe640b; background-color: #eff1f5 }
:root[data-theme="light"] .hljs-operator { color: #04a5e5; background-color: #eff1f5; font-weight: bold }
:root[data-theme="light"] .hljs-punctuation { color: #4c4f69; background-color: #eff1f5 }
:root[data-theme="light"] .hljs-comment { color: #9ca0b0; background-color: #eff1f5; font-style: italic }
:root[data-theme="light"] .hljs-meta, :root[data-theme="light"] .hljs-meta .hljs-keyword, :root[data-theme="light"] .hljs-meta .hljs-string { color: #9ca0b0; background-color: #eff1f5; font-style: italic }
:root[data-theme="light"] .hljs-doctag { color: #9ca0b0; background-color: #eff1f5; font-style: italic }
:root[data-theme="light"] .hljs-addition { color: #40a02b; background-color: #ccd0da }
:root[data-theme="light"] .hljs-deletion { color: #d20f39; background-color: #ccd0da }
:root[data-theme="light"] .hljs-section { color: #fe640b; background-color: #eff1f5; font-weight: bold }
:root[data-theme="light"] .hljs-emphasis { color: #4c4f69; background-color: #eff1f5; font-style: italic }
:root[data-theme="light"] .hljs-strong { color: #4c4f69; background-color: #eff1f5; font-weight: bold }
:root[data-theme="light"] .hljs-params { color: #4c4f69; background-color: #eff1f5 }
