/* vlt design system. Tokens first; dark theme via [data-theme] (set by theme.js) or the system preference.
   Layout follows the forge conventions users already know (GitHub, GitLab): dark global bar, repo band with
   underline tabs, bordered boxes with a header row, list rows divided by hairlines. */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --text: #111827;
  --muted: #5b6474;
  --border: #d8dce6;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef0ff;
  --on-primary: #ffffff;
  --focus: #6366f1;
  --header-bg: #1e1b4b;
  --header-text: #eef0ff;
  --header-muted: #c7cbf5;
  --header-hover: rgb(255 255 255 / 12%);
  --ok: #166534;
  --ok-bg: #dcfce7;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --danger-bg: #b91c1c;
  --on-danger: #ffffff;
  --info: #1e40af;
  --info-bg: #dbeafe;
  --neutral: #374151;
  --neutral-bg: #e5e7eb;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --diff-add-bg: #dcfce7; --diff-del-bg: #fee2e2; --diff-hunk: #4f46e5;
  --tk-c: #5b6474; --tk-s: #0a6b34; --tk-n: #a3480a; --tk-k: #7c3aed; --line-hl: #fff3b0;
  --shadow: 0 1px 3px rgb(16 24 40 / 10%), 0 8px 24px rgb(16 24 40 / 12%);
  --radius: 8px;
  --radius-sm: 6px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --icon-in: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1.5v8.4l2.7-2.7 1.1 1.1L7.2 13 2.6 8.3l1.1-1.1 2.7 2.7V1.5zM1.5 13.5h13V15h-13z'/%3E%3C/svg%3E");
  --icon-out: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M7.2 13V4.6L4.5 7.3 3.4 6.2 8 1.5l4.6 4.7-1.1 1.1-2.7-2.7V13zM1.5 13.5h13V15h-13z'/%3E%3C/svg%3E");
  --icon-dir: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1 3.5A1.5 1.5 0 0 1 2.5 2h3.6l1.5 1.5h5.9A1.5 1.5 0 0 1 15 5v7.5a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 1 12.5z'/%3E%3C/svg%3E");
  --icon-file: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M3.5 1h6L13 4.5v9a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 2 13.5v-11A1.5 1.5 0 0 1 3.5 1zm0 1.5v11h8V5.5H9V2.5z'/%3E%3C/svg%3E");
  --icon-link: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6.8 9.2a3 3 0 0 0 4.2 0l2.6-2.6a3 3 0 0 0-4.2-4.2L8.3 3.5l1.1 1 1.1-1a1.5 1.5 0 0 1 2.1 2.1L10 8.2a1.5 1.5 0 0 1-2.1 0zm2.4-2.4a3 3 0 0 0-4.2 0L2.4 9.4a3 3 0 0 0 4.2 4.2l1.1-1.1-1.1-1-1.1 1a1.5 1.5 0 0 1-2.1-2.1L6 7.8a1.5 1.5 0 0 1 2.1 0z'/%3E%3C/svg%3E");
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d13; --surface: #141823; --surface-2: #1b2130; --text: #e6e8ee; --muted: #a2aab8; --border: #2e3647;
    --primary: #8b93ff; --primary-hover: #a5abff; --primary-soft: #1d2140; --on-primary: #0b0d13; --focus: #a5abff;
    --header-bg: #13112e; --header-text: #eef0ff; --header-muted: #b9bdeb;
    --ok: #86efac; --ok-bg: #14321f; --warn: #fcd34d; --warn-bg: #3a2a0b; --bad: #fca5a5; --bad-bg: #3b1515; --danger-bg: #f87171; --on-danger: #0b0d13;
    --info: #93c5fd; --info-bg: #142540; --neutral: #d1d5db; --neutral-bg: #2a303c; --code-bg: #0a0d14;
    --diff-add-bg: #12301d; --diff-del-bg: #3a1717; --diff-hunk: #a5abff;
  --tk-c: #a2aab8; --tk-s: #86efac; --tk-n: #fdba74; --tk-k: #c4b5fd; --line-hl: #3a3410;
    --shadow: 0 1px 3px rgb(0 0 0 / 45%), 0 8px 24px rgb(0 0 0 / 40%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0d13; --surface: #141823; --surface-2: #1b2130; --text: #e6e8ee; --muted: #a2aab8; --border: #2e3647;
  --primary: #8b93ff; --primary-hover: #a5abff; --primary-soft: #1d2140; --on-primary: #0b0d13; --focus: #a5abff;
  --header-bg: #13112e; --header-text: #eef0ff; --header-muted: #b9bdeb;
  --ok: #86efac; --ok-bg: #14321f; --warn: #fcd34d; --warn-bg: #3a2a0b; --bad: #fca5a5; --bad-bg: #3b1515; --danger-bg: #f87171; --on-danger: #0b0d13;
  --info: #93c5fd; --info-bg: #142540; --neutral: #d1d5db; --neutral-bg: #2a303c; --code-bg: #0a0d14;
  --diff-add-bg: #12301d; --diff-del-bg: #3a1717; --diff-hunk: #a5abff;
  --tk-c: #a2aab8; --tk-s: #86efac; --tk-n: #fdba74; --tk-k: #c4b5fd; --line-hl: #3a3410;
  --shadow: 0 1px 3px rgb(0 0 0 / 45%), 0 8px 24px rgb(0 0 0 / 40%);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 var(--s3); font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 var(--s3); }
p:last-child { margin-bottom: 0; }
ul { margin: 0 0 var(--s3); padding-left: 1.25em; }
code, pre, .mono { font-family: var(--mono); font-size: 0.9em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--s2); top: -48px; background: var(--surface); color: var(--primary); padding: var(--s2) var(--s3); z-index: 30; border-radius: var(--radius-sm); }
.skip:focus { top: var(--s2); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.row { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: var(--s4); }

/* layout */
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: var(--s5) var(--s5) var(--s8); }
.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; padding-bottom: var(--s4); margin-bottom: var(--s5); border-bottom: 1px solid var(--border); }
.page-head h1 { margin: 0; }
.page-head p { margin: var(--s1) 0 0; }
.form-page { max-width: 720px; margin: 0 auto; }
.col { max-width: 880px; }
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.app-footer { color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--border); text-align: center; padding: var(--s5) var(--s4); }
.old-browser { display: none; }
:root[data-old-browser] .old-browser { display: block; }

/* global bar */
.app-header { background: var(--header-bg); color: var(--header-text); position: sticky; top: 0; z-index: 10; }
.app-header .inner { max-width: 1280px; margin: 0 auto; padding: var(--s2) var(--s5); min-height: 56px; display: flex; align-items: center; gap: var(--s4); }
.app-header :focus-visible { outline-color: var(--header-text); }
.brand { display: flex; align-items: center; gap: var(--s2); font-weight: 700; font-size: 1.1rem; color: var(--header-text); text-decoration: none; }
.brand:hover { color: var(--header-text); }
.brand img { width: 28px; height: 28px; }
.nav { display: flex; gap: var(--s1); flex: 1; }
.nav a { color: var(--header-muted); text-decoration: none; padding: 6px var(--s3); border-radius: var(--radius-sm); font-weight: 600; font-size: 0.92rem; white-space: nowrap; }
.nav a:hover { color: var(--header-text); background: var(--header-hover); }
.nav a[aria-current="page"] { color: var(--header-text); background: var(--header-hover); }
.user { display: flex; align-items: center; gap: var(--s2); margin-left: auto; position: relative; }
.app-header .btn-ghost { color: var(--header-text); }
.app-header .btn-ghost:hover { background: var(--header-hover); color: var(--header-text); }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: 0.85rem; text-transform: uppercase; }
.menu-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--header-text); padding: 4px 6px; cursor: pointer; font: inherit; }
.menu-btn:hover { background: var(--header-hover); }
.menu-btn::after { content: ""; border: 4px solid transparent; border-top-color: currentColor; margin-top: 4px; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--s1) 0; z-index: 20; }
.menu > * { display: block; width: 100%; }
.menu .menu-who { padding: var(--s2) var(--s4); font-size: 0.85rem; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: var(--s1); overflow-wrap: anywhere; }
.menu .menu-who strong { color: var(--text); display: block; font-weight: 600; }
.menu .btn { justify-content: flex-start; border-radius: 0; min-height: 36px; font-weight: 500; color: var(--text); background: none; padding: 6px var(--s4); }
.menu .btn:hover { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: var(--s1) 0; }

/* boxes (forge-style bordered panels) */
.box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.box + .box, .box + form, .banner + .box { margin-top: var(--s4); }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; min-height: 54px; padding: var(--s2) var(--s4); background: var(--surface-2); border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.box-head h2 { font-size: 0.95rem; margin: 0; }
.box-body { padding: var(--s4); }
.box-body > :last-child { margin-bottom: 0; }
.box-row { padding: var(--s3) var(--s4); margin: 0; }
.box-row + .box-row { border-top: 1px solid var(--border); }
.box.highlight { border-color: var(--primary); }
.box.highlight > .box-head { background: var(--primary-soft); border-bottom-color: var(--primary); }
.box.danger { border-color: var(--bad); }
.box.danger > .box-head { background: var(--bad-bg); color: var(--bad); border-bottom-color: var(--bad); }
.blankslate { text-align: center; padding: var(--s7) var(--s4); }
.blankslate .icon { width: 32px; height: 32px; margin: 0 auto var(--s3); background: var(--muted); -webkit-mask: var(--icon-in) center / contain no-repeat; mask: var(--icon-in) center / contain no-repeat; }
.blankslate h1, .blankslate h2 { font-size: 1.25rem; }
.blankslate .row { justify-content: center; margin-top: var(--s4); }

/* repository list rows */
.repo-list { list-style: none; margin: 0; padding: 0; }
.repo-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; padding: var(--s4); color: inherit; text-decoration: none; }
li + li > .repo-row { border-top: 1px solid var(--border); }
.repo-row h2 { font-size: 1.05rem; margin: 0 0 2px; color: var(--primary); word-break: break-word; }
.repo-row:hover h2 { text-decoration: underline; }
.repo-row p { margin: 0; }
.repo-row:hover { background: var(--surface-2); color: inherit; }
li:first-child > .repo-row { border-radius: var(--radius) var(--radius) 0 0; }
li:last-child > .repo-row { border-radius: 0 0 var(--radius) var(--radius); }
li:only-child > .repo-row { border-radius: var(--radius); }

/* repository band: breadcrumb, title and underline tabs */
.repo-band { background: var(--surface); border-bottom: 1px solid var(--border); }
.repo-band .container { padding-top: var(--s4); padding-bottom: 0; }
.crumbs { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }
.crumbs a { font-size: 1.25rem; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { color: var(--muted); font-size: 1.25rem; }
.crumbs h1 { font-size: 1.25rem; margin: 0; word-break: break-word; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 10px; align-self: center; }
.tabs { display: flex; gap: var(--s1); overflow-x: auto; margin-bottom: -1px; }
.tabs a { display: inline-flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3) var(--s3); color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.92rem; border-bottom: 2px solid transparent; white-space: nowrap; border-radius: 0; }
.tabs a:hover { color: var(--text); border-bottom-color: var(--border); }
.tabs a[aria-selected="true"] { color: var(--text); border-bottom-color: var(--primary); }
.counter { display: inline-block; min-width: 20px; padding: 0 6px; font-size: 0.75rem; line-height: 18px; text-align: center; border-radius: 999px; background: var(--neutral-bg); color: var(--neutral); }

/* two columns: main list + sidebar (Activity), and settings sub-nav + content (admin) */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 296px; gap: var(--s5); align-items: start; }
.about h2 { font-size: 0.95rem; }
.about dl { margin: 0; }
.about dt { font-size: 0.8rem; color: var(--muted); margin-top: var(--s3); }
.about dd { margin: 2px 0 0; }
.about .copybox { margin: var(--s1) 0 0; }
.about .copybox code { white-space: normal; word-break: break-all; }
.with-subnav { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s5); align-items: start; }
.subnav { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 2px; }
.subnav a { padding: 6px var(--s3); border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-weight: 500; }
.subnav a:hover { background: var(--surface-2); }
.with-subnav section { scroll-margin-top: 72px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); font: inherit; font-weight: 600; font-size: 0.9rem; padding: 7px 14px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; text-decoration: none; line-height: 1.2; min-height: 36px; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); color: var(--on-primary); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--text); }
.btn-danger { background: var(--danger-bg); color: var(--on-danger); }
.btn-danger-outline { background: var(--surface-2); color: var(--bad); border-color: var(--border); }
.btn-danger-outline:hover { background: var(--danger-bg); color: var(--on-danger); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-sm { padding: 4px 10px; min-height: 30px; font-size: 0.82rem; }
.btn[disabled], .btn[aria-busy="true"] { opacity: 0.6; cursor: not-allowed; }
.btn[aria-busy="true"]::before { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* forms */
.field { margin-bottom: var(--s4); }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; }
.field .help { color: var(--muted); font-size: 0.82rem; margin-top: 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="search"], input:not([type]) {
  width: 100%; font: inherit; font-size: 16px; padding: 7px 12px; min-height: 38px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text);
}
input:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); background: var(--surface); }
input[aria-invalid="true"] { border-color: var(--bad); }
.inline-form { display: flex; gap: var(--s2); align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1 1 260px; margin: 0; }
.inline-form .form-error { flex-basis: 100%; margin: 0; }
.form-error { color: var(--bad); background: var(--bad-bg); border: 1px solid currentColor; border-radius: var(--radius-sm); padding: var(--s2) var(--s3); margin-bottom: var(--s4); font-size: 0.92rem; }
.meter { height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; margin-top: var(--s2); }
.meter > span { display: block; height: 100%; width: 0; background: var(--bad); transition: width 0.2s; }
.meter[data-level="1"] > span { width: 33%; background: var(--warn); }
.meter[data-level="2"] > span { width: 66%; background: var(--primary); }
.meter[data-level="3"] > span { width: 100%; background: var(--ok); }

/* auth pages: logo, centred title, form box, then a box with the alternative */
.auth { max-width: 360px; padding-top: var(--s7); }
.auth-logo { display: block; width: 48px; height: 48px; margin: 0 auto var(--s4); }
.auth-card > h1 { text-align: center; font-size: 1.5rem; font-weight: 400; margin-bottom: var(--s4); }
.auth-card .btn-primary[type="submit"] { width: 100%; }
.auth-card .form-actions { display: flex; flex-direction: column; gap: var(--s3); align-items: stretch; }
.auth-card .form-actions a { text-align: center; }
.auth-alt { text-align: center; padding: var(--s4); margin-top: var(--s4); border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.92rem; }

/* banners, badges */
.banner { border-radius: var(--radius-sm); padding: var(--s3) var(--s4); margin: 0 0 var(--s4); display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; border: 1px solid currentColor; }
.banner-info { background: var(--info-bg); color: var(--info); }
.banner-warn { background: var(--warn-bg); color: var(--warn); }
.banner-bad { background: var(--bad-bg); color: var(--bad); }
.banner .copybox { background: var(--surface); color: var(--text); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.76rem; font-weight: 600; padding: 1px 10px; border-radius: 999px; white-space: nowrap; border: 1px solid currentColor; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral); border-color: transparent; }
.badge-live::before { animation: pulse 1.2s ease-in-out infinite; }
.badge-action { background: none; border: 0; border-left: 1px solid currentColor; padding: 0 0 0 6px; margin-left: 2px; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; }
.badge-action:disabled { cursor: default; opacity: 0.6; }
@keyframes pulse { 50% { opacity: 0.25; } }

/* copy boxes and code */
.copybox { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); margin-bottom: var(--s3); }
.copybox code { flex: 1; padding: 7px 12px; overflow-x: auto; white-space: pre; font-size: 0.86rem; align-self: center; }
.copybox .btn { border-radius: 0; border-width: 0 0 0 1px; border-color: var(--border); min-height: 0; }
pre.code { background: var(--code-bg); color: var(--code-text); padding: var(--s4); border-radius: var(--radius-sm); overflow-x: auto; white-space: pre-wrap; word-break: break-word; font-size: 0.85rem; max-height: 480px; margin: 0 0 var(--s3); }
details summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: var(--s2); }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: var(--s2) var(--s4); border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 600; font-size: 0.82rem; background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
.box > .table-wrap:last-child { border-radius: 0 0 var(--radius) var(--radius); }

/* activity: threads as rows in one box, replies hang off a thread line */
.thread + .thread { border-top: 1px solid var(--border); }
.msg { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: var(--s3); align-items: start; padding: var(--s3) var(--s4); position: relative; }
.msg.nested { padding-left: calc(var(--s4) + 32px); }
.msg.nested::before { content: ""; position: absolute; left: calc(var(--s4) + 9px); top: 0; bottom: 0; border-left: 2px solid var(--border); }
.msg .dir { width: 16px; height: 16px; margin-top: 3px; background: var(--muted); -webkit-mask: var(--icon-in) center / contain no-repeat; mask: var(--icon-in) center / contain no-repeat; }
.msg .dir.out { -webkit-mask-image: var(--icon-out); mask-image: var(--icon-out); }
.msg .subject { font-weight: 600; word-break: break-word; }
.msg .toggle:hover .subject { color: var(--primary); text-decoration: underline; }
.msg .meta { color: var(--muted); font-size: 0.82rem; word-break: break-all; }
.msg .toggle { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.msg .detail { grid-column: 2 / -1; padding-top: var(--s2); }
.list-foot { padding: var(--s3) var(--s4); border-top: 1px solid var(--border); text-align: center; }
.msg .tag { display: inline-block; font-family: var(--mono); font-size: 0.75rem; font-weight: 600; padding: 1px 8px; margin-right: var(--s2); border-radius: var(--radius-sm); background: var(--neutral-bg); color: var(--neutral); vertical-align: 1px; white-space: nowrap; }
.patch { margin-bottom: var(--s3); }
.patch-msg { white-space: pre-wrap; word-break: break-word; margin-bottom: var(--s3); }
pre.diffstat { color: var(--muted); font-size: 0.8rem; overflow-x: auto; margin: 0 0 var(--s3); }
.file { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: var(--s3); overflow: hidden; }
.file summary { display: flex; gap: var(--s2); align-items: center; padding: var(--s2) var(--s3); background: var(--surface-2); cursor: pointer; font-size: 0.85rem; word-break: break-all; }
.file summary .mono { flex: 1; font-weight: 600; }
.count-add { color: var(--ok); font-weight: 600; }
.count-del { color: var(--bad); font-weight: 600; }
pre.diff { margin: 0; padding: var(--s2) 0; overflow: auto; max-height: 480px; font-size: 0.8rem; line-height: 1.45; background: var(--surface); }
pre.diff span { display: block; padding: 0 var(--s3); min-width: max-content; }
pre.diff .add { background: var(--diff-add-bg); }
pre.diff .del { background: var(--diff-del-bg); }
pre.diff .hunk { color: var(--diff-hunk); }
pre.diff .meta { color: var(--muted); }

/* toasts and dialogs */
.toasts { position: fixed; bottom: var(--s4); right: var(--s4); display: flex; flex-direction: column; gap: var(--s2); z-index: 40; max-width: calc(100vw - 32px); }
.toast { background: var(--text); color: var(--bg); padding: var(--s3) var(--s4); border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: 0.9rem; }
.toast.bad { background: var(--danger-bg); color: var(--on-danger); }
dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: var(--s5); width: min(480px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(0 0 0 / 50%); }

/* skeletons */
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius-sm); height: 18px; margin: var(--s2) 0; }
.skeleton.block { height: 96px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* landing */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--s7); align-items: center; padding: var(--s7) 0 var(--s7); max-width: 1040px; margin: 0 auto; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.02em; font-weight: 700; }
.hero .lead { font-size: 1.15rem; color: var(--muted); margin-bottom: var(--s5); }
.hero .row { margin-bottom: var(--s3); }
.how { max-width: 1040px; margin: 0 auto; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); }
.step { padding: var(--s5); }
.step + .step { border-left: 1px solid var(--border); }
.step p { color: var(--muted); }
.step .num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--primary); color: var(--primary); font-weight: 700; font-size: 0.9rem; margin-bottom: var(--s3); }
.flow { width: 100%; height: auto; }
.flow .mail { animation: travel 4s ease-in-out infinite; }
.flow .tick { opacity: 0; animation: done 4s ease-in-out infinite; }
@keyframes travel { 0% { transform: translateX(0); } 45%, 100% { transform: translateX(168px); } }
@keyframes done { 0%, 45% { opacity: 0; } 55%, 90% { opacity: 1; } 100% { opacity: 0; } }
.fill-surface { fill: var(--surface); }
.fill-surface2 { fill: var(--surface-2); }
.fill-primary { fill: var(--primary); }
.fill-ok { fill: var(--ok-bg); }
.stroke-border { stroke: var(--border); }
.stroke-ok { stroke: var(--ok); }
.stroke-muted { stroke: var(--muted); }
.fill-text { fill: var(--text); }
.fill-muted { fill: var(--muted); }

@media (max-width: 1011px) {
  .split, .with-subnav { grid-template-columns: minmax(0, 1fr); }
  .subnav { position: static; flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 760px) {
  .container { padding: var(--s4) var(--s4) var(--s7); }
  .auth { padding-top: var(--s5); }
  .app-header { position: static; }
  .app-header .inner { flex-wrap: wrap; padding: var(--s2) var(--s4); gap: var(--s2) var(--s3); }
  .app-header .nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .tabs { gap: 0; }
  .tabs a { padding-left: var(--s2); padding-right: var(--s2); }
  .hero { grid-template-columns: 1fr; padding-top: var(--s5); gap: var(--s5); }
  .steps { grid-template-columns: 1fr; }
  .step + .step { border-left: 0; border-top: 1px solid var(--border); }
  .msg { grid-template-columns: 16px minmax(0, 1fr); gap: var(--s2) var(--s3); }
  .msg > .badge { grid-column: 2; justify-self: start; }
  .msg.nested { padding-left: calc(var(--s4) + 20px); }
  .msg.nested::before { left: calc(var(--s4) + 6px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .flow .tick { opacity: 1; }
}

/* code browser */
.code-head { margin-bottom: var(--s3); min-height: 30px; }
.path { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s1); font-size: 1.05rem; word-break: break-all; }
.path a { text-decoration: none; font-weight: 600; }
.path a:hover { text-decoration: underline; }
.path .sep { color: var(--muted); padding: 0 2px; }
.commit-bar code { color: var(--muted); }
table.files td { padding: 7px var(--s4); }
table.files tr:hover td { background: var(--surface-2); }
table.files a { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: var(--s2); }
table.files a:hover { color: var(--primary); text-decoration: underline; }
.ico { display: inline-block; flex: none; width: 16px; height: 16px; vertical-align: -3px; margin-right: var(--s2); background: var(--muted); -webkit-mask: var(--icon-file) center / contain no-repeat; mask: var(--icon-file) center / contain no-repeat; }
a .ico { margin-right: 0; }
.ico-dir { background: var(--primary); -webkit-mask-image: var(--icon-dir); mask-image: var(--icon-dir); }
.ico-sub, .ico-link { -webkit-mask-image: var(--icon-link); mask-image: var(--icon-link); }
.num { text-align: right; white-space: nowrap; }
.readme .box-body { padding: var(--s5); }
.file-view .file-body { padding: var(--s4); }
.file-view .file-body > pre.plain { margin: calc(-1 * var(--s4)); border-radius: 0 0 var(--radius) var(--radius); background: var(--surface); }
pre.plain { margin: 0; padding: var(--s4); background: var(--surface-2); border-radius: var(--radius-sm); overflow-x: auto; font-size: 0.85rem; line-height: 1.5; tab-size: 4; }
table.files .col-msg { width: 50%; }
table.files a.last-msg, .last-msg { color: var(--muted); display: inline; }
.last-msg { overflow-wrap: anywhere; }
.head-commit { min-width: 0; }
.search-form { display: flex; gap: var(--s2); }
.search-form input { width: 200px; max-width: 100%; min-height: 32px; padding: 4px var(--s2); -webkit-appearance: none; appearance: none; }
/* file contents: line number gutter + highlighted code */
.code-lines { overflow-x: auto; font-family: var(--mono); font-size: 0.85rem; line-height: 1.5; tab-size: 4; padding: var(--s2) 0; margin: calc(-1 * var(--s4)); background: var(--surface); border-radius: 0 0 var(--radius) var(--radius); }
.cl { display: flex; min-width: max-content; scroll-margin-top: 80px; }
.cl.hl { background: var(--line-hl); }
.cl .ln { flex: none; width: 4.5em; padding-right: var(--s3); text-align: right; color: var(--muted); user-select: none; cursor: pointer; }
.cl .ln:hover { color: var(--primary); }
.cl .lc { white-space: pre; padding-right: var(--s4); }
.tk-c { color: var(--tk-c); font-style: italic; }
.tk-s { color: var(--tk-s); }
.tk-n { color: var(--tk-n); }
.tk-k { color: var(--tk-k); font-weight: 600; }
/* search results */
.plain-list { list-style: none; margin: 0; padding: 0; }
.search-hit { margin-bottom: var(--s3); }
.search-hit .box-head h2 { font-size: 0.9rem; }
.search-hit li + li, .box-body .plain-list li + li { margin-top: var(--s1); }
.search-hit .plain-list { padding: var(--s2) 0; }
.search-hit a.hit { display: flex; gap: var(--s3); padding: 2px var(--s4); color: var(--text); text-decoration: none; font-size: 0.85rem; }
.search-hit a.hit:hover { background: var(--surface-2); }
.search-hit .ln { flex: none; width: 3.5em; text-align: right; color: var(--muted); font-family: var(--mono); }
.search-hit code { white-space: pre; overflow: hidden; text-overflow: ellipsis; }
/* commits */
.commit-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); }
.commit-row .subject { font-weight: 600; color: var(--text); text-decoration: none; word-break: break-word; }
.commit-row .subject:hover { color: var(--primary); text-decoration: underline; }
.commit-row .meta, .commit-view .meta { color: var(--muted); font-size: 0.82rem; word-break: break-word; }
.commit-view { margin: var(--s3) 0; }
.commit-subject { margin: 0 0 var(--s2); font-size: 1.2rem; word-break: break-word; }
.commit-ids { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s1) var(--s3); margin: var(--s3) 0 0; font-size: 0.85rem; }
.commit-ids dt { color: var(--muted); }
.commit-ids dd { margin: 0; word-break: break-all; }
@media (max-width: 600px) {
  table.files .col-msg, table.files .col-time { display: none; }
  .search-form input { width: 140px; }
}
.image-view { text-align: center; }
.image-view img { max-width: 100%; height: auto; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; }

/* rendered markdown */
.markdown { line-height: 1.6; overflow-wrap: break-word; }
.markdown > :first-child { margin-top: 0; }
.markdown h1, .markdown h2 { padding-bottom: 0.3em; border-bottom: 1px solid var(--border); }
.markdown h1 { font-size: 1.75rem; } .markdown h2 { font-size: 1.4rem; } .markdown h3 { font-size: 1.15rem; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4, .markdown h5, .markdown h6 { margin: 1.4em 0 0.6em; scroll-margin-top: 72px; }
.markdown p, .markdown ul, .markdown ol, .markdown blockquote, .markdown pre, .markdown .table-wrap { margin: 0 0 1em; }
.markdown ul, .markdown ol { padding-left: 2em; }
.markdown li + li { margin-top: 0.25em; }
.markdown li.task { list-style: none; margin-left: -1.4em; }
.markdown li.task input { margin-right: 0.5em; }
.markdown code { background: var(--surface-2); padding: 0.15em 0.4em; border-radius: 4px; font-size: 0.88em; }
.markdown pre.code code { background: none; padding: 0; font-size: inherit; }
.markdown blockquote { margin-left: 0; padding: 0 1em; color: var(--muted); border-left: 4px solid var(--border); }
.markdown img { max-width: 100%; height: auto; }
.markdown hr { border: 0; border-top: 1px solid var(--border); margin: 1.5em 0; }
.markdown table th, .markdown table td { border: 1px solid var(--border); padding: 6px 12px; text-transform: none; letter-spacing: 0; font-size: 0.92rem; color: var(--text); }
.markdown table tr:nth-child(2n) td { background: var(--surface-2); }
.markdown tbody tr:last-child td { border-bottom: 1px solid var(--border); }
.markdown .align-center { text-align: center; } .markdown .align-right { text-align: right; }
