/* tokens.css */
/* Foundations, as in slashcheer-dev/takumi (src/styles/tokens.css): Linear-dark for the
   app (the editor), Inter, hairlines, one indigo accent. Keep the two in step. */
@font-face {
  font-family: "Inter";
  src: url("/_/fonts/inter-latin-wght.woff2") format("woff2-variations"), url("/_/fonts/inter-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  color-scheme: dark;

  /* Surfaces: chrome is darkest; the working panel sits one step up. */
  --chrome: #08090a;
  --surface: #0f1011;
  --panel: #141516;
  --raised: #1a1b1d;
  --hover: #1c1d20;
  --selected: #222326;
  --line: #1e1f22;
  --line-strong: #27282b;
  --control-line: #2c2d31;
  --field: #0c0d0e;

  /* Text — every pairing on --surface/--panel is ≥ 4.5:1 */
  --ink: #f7f8f8;
  --ink-2: #d0d6e0;
  --muted: #8a8f98;
  --faint: #62666d; /* decorative only, never body text */

  /* One accent: Linear indigo */
  --accent: #5e6ad2;
  --accent-ink: #9ea6ff;
  --accent-soft: rgba(94, 106, 210, .16);
  --accent-line: rgba(94, 106, 210, .45);
  --link: #9ea6ff;
  --primary: #5e6ad2;
  --primary-hover: #6c78e0;
  --primary-line: #6c78e0;

  /* Workflow status (Linear) */
  --done: #5e6ad2;
  --done-ink: #aab1ff;
  --success: #4cb782;
  --progress: #f2c94c;
  --warn: #f2994a;
  --blocked: #eb5757;
  --danger-ink: #ff9b9b;
  --info: #4ea7fc;
  --waiting: #8a8f98;

  /* Slashcheer mark only */
  --brand: #ff7666;
  --black: #08090a;
  /* Legacy aliases kept so older rules resolve to the new palette. */
  --coral: var(--accent);
  --acid: var(--done);
  --violet: var(--accent);
  --white: var(--ink);

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono-family: var(--sans); /* Linear sets IDs, times and counts in Inter with tabular figures */

  --r-sm: 4px;
  --r: 6px;
  --r-lg: 8px;
  --r-card: 12px;

  --sidebar-w: 220px;
  --topbar-h: 44px;
  --ease: cubic-bezier(.25, .46, .45, .94);
  --t-fast: 100ms;
  --t: 160ms;
  --shadow-pop: 0 8px 28px rgba(0, 0, 0, .5), 0 0 0 1px var(--line-strong);
}

/* base.css */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--chrome); color: var(--ink); font: 13px/1.5 var(--sans); font-feature-settings: "cv11", "ss01"; letter-spacing: -.003em; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, h4 { margin: 0; font-weight: 590; letter-spacing: -.012em; line-height: 1.3; }
p { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
img { max-width: 100%; display: block; }
ul, ol { margin: 0; padding: 0; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
::selection { background: rgba(94, 106, 210, .45); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 200; top: -60px; left: 12px; background: var(--raised); color: var(--ink); border: 1px solid var(--accent); padding: 8px 12px; border-radius: var(--r); }
.skip-link:focus { top: 12px; }
.tabular { font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }
/* Links inside running text are underlined, not distinguished by color alone. */
p a, .ink2 a, .row-sub a, .owner-strip a, .help a, .prose a, .small a:not(.btn) { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }

/* components.css */
/* Components. Proportions follow Linear: 28–32px controls, 13px labels,
   hairline borders, quiet hover, strong focus. */

/* Buttons — Linear: 28px default, 6px radius, a filled indigo primary, a
   subtle secondary with an inner hairline, and ghost for toolbars. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; min-height: 28px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--control-line); background: var(--raised); color: var(--ink); font-size: 13px; font-weight: 500; white-space: nowrap; text-decoration: none !important; box-shadow: 0 1px 1px rgba(0, 0, 0, .25); transition: background var(--t-fast), border-color var(--t-fast); }
.btn svg { width: 14px; height: 14px; color: currentColor; }
.btn:hover:not(:disabled) { background: #222327; border-color: #36373c; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; }
.btn.primary, .btn.accent { background: var(--primary); border-color: transparent; color: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn.primary:hover:not(:disabled), .btn.accent:hover:not(:disabled) { background: var(--primary-hover); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover:not(:disabled) { background: var(--hover); color: var(--ink); border-color: transparent; }
.btn.danger { background: rgba(235, 87, 87, .12); border-color: rgba(235, 87, 87, .35); color: var(--danger-ink); box-shadow: none; }
.btn.danger:hover:not(:disabled) { background: rgba(235, 87, 87, .2); border-color: rgba(235, 87, 87, .5); }
.btn.small { height: 24px; min-height: 24px; padding: 0 8px; font-size: 12px; gap: 4px; }
.btn.large { height: 32px; min-height: 32px; padding: 0 14px; font-size: 13px; }
.btn.icon { width: 28px; padding: 0; }
.btn.small.icon { width: 24px; }
.btn .spinner { width: 13px; height: 13px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.link-button { background: none; border: 0; padding: 0; color: var(--link); font-size: inherit; }
.link-button:hover { text-decoration: underline; text-underline-offset: 3px; }

.spinner { display: inline-block; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Status icon (Linear workflow circles) */
.status-icon { width: 14px; height: 14px; flex: none; display: inline-block; vertical-align: -2px; }
.status-icon.todo { color: var(--muted); }
.status-icon.progress { color: var(--progress); }
.status-icon.done { color: var(--done); }
.status-icon.blocked { color: var(--blocked); }
.status-icon.waiting, .status-icon.upcoming { color: var(--faint); }
.status-icon.warn { color: var(--warn); }

/* Chips — Linear labels: a neutral pill whose meaning is carried by a
   small coloured dot, never by a tinted background. */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 20px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.chip .swatch { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.done, .chip.progress, .chip.warn, .chip.blocked, .chip.info, .chip.violet, .chip.success { color: var(--ink-2); border-color: var(--line-strong); background: transparent; }
.chip.done::before, .chip.progress::before, .chip.warn::before, .chip.blocked::before, .chip.info::before, .chip.violet::before, .chip.success::before { content: ""; width: 6px; height: 6px; border-radius: 50%; flex: none; }
.chip:has(.swatch)::before, .chip:has(.status-icon)::before, .chip:has(svg)::before { content: none !important; }
.chip.done::before { background: var(--done); }
.chip.success::before { background: var(--success); }
.chip.progress::before { background: var(--progress); }
.chip.warn::before { background: var(--warn); }
.chip.blocked::before { background: var(--blocked); }
.chip.info::before { background: var(--info); }
.chip.violet::before { background: var(--accent); }
.chip svg, .chip .status-icon { width: 12px; height: 12px; }
.chip.done svg { color: var(--done); }
.chip.progress svg { color: var(--progress); }
.chip.warn svg { color: var(--warn); }
.chip.blocked svg { color: var(--blocked); }
.chip.info svg { color: var(--info); }
.chip.muted { color: var(--muted); }
.chip.mono { font-size: 11.5px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.kbd { font: 500 11px var(--sans); color: var(--muted); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 4px; background: var(--raised); }

/* Avatar */
.avatar { --size: 32px; width: var(--size); height: var(--size); border-radius: 50%; flex: none; display: inline-grid; place-items: center; font: 600 calc(var(--size) * .4) var(--sans); color: #08090a; background: var(--avatar, var(--accent-ink)); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { --size: 20px; box-shadow: 0 0 0 2px var(--surface); margin-left: -4px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* Cards and sections */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card > :first-child { border-top-left-radius: inherit; border-top-right-radius: inherit; }
.card-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); min-height: 42px; }
.card-head h2, .card-head h3 { font-size: 13px; font-weight: 590; }
.card-head p { color: var(--muted); font-size: 12px; }
.card-body { padding: 16px; }
.card-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.section { margin-bottom: 28px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.section-title h2 { font-size: 13px; font-weight: 590; }
.section-title .meta { color: var(--muted); font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
@media (max-width: 980px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* Linear-style list rows */
.list { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; }
.list-group-head { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; background: var(--raised); border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 500; color: var(--ink); }
.list-group-head .count { color: var(--muted); font-size: 13px; font-weight: 400; }
.row { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 14px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none !important; transition: background var(--t-fast); }
.row:last-child { border-bottom: 0; }
a.row:hover, button.row:hover, .row.interactive:hover { background: var(--hover); }
button.row { width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 500; font-size: 13px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-title > span.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.row-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; color: var(--muted); font-size: 12px; }
.row .id { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 58px; }
.row-actions { display: flex; gap: 6px; align-items: center; opacity: .0; transition: opacity var(--t-fast); }
.row:hover .row-actions, .row:focus-within .row-actions, .row-actions.always { opacity: 1; }
@media (hover: none) { .row-actions { opacity: 1; } }

/* Properties panel (Linear detail sidebar) */
.props { display: grid; gap: 2px; }
.prop { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; gap: 8px; min-height: 30px; font-size: 13px; }
.prop dt { color: var(--muted); }
.prop dd { margin: 0; color: var(--ink); min-width: 0; }

/* Forms */
.field { display: grid; gap: 6px; margin-bottom: 18px; }
.field > label, .field-label { font-size: 12px; font-weight: 500; color: var(--ink); display: flex; gap: 8px; align-items: baseline; }
.field .req { color: var(--muted); font-weight: 400; font-size: 12px; }
.field .opt { color: var(--muted); font-weight: 400; font-size: 12px; }
.help { color: var(--muted); font-size: 12px; }
.input, .select, .textarea { width: 100%; min-height: 32px; padding: 5px 10px; border-radius: var(--r); border: 1px solid var(--control-line); background: var(--field); color: var(--ink); font-size: 13px; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:hover, .select:hover, .textarea:hover { border-color: #3a3b40; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: #6f747c; }
.field.invalid .input, .field.invalid .textarea, .field.invalid .select { border-color: var(--blocked); }
.field-error { color: var(--danger-ink); font-size: 12px; display: flex; gap: 6px; align-items: center; }
.counter { margin-left: auto; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.counter.over { color: var(--danger-ink); }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; font-size: 13px; cursor: pointer; }
.check input { width: 14px; height: 14px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.choice { position: relative; display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--panel); cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast); }
.choice:hover { border-color: #36373c; background: var(--raised); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice strong { font-size: 13px; font-weight: 590; }
.choice span { color: var(--muted); font-size: 12px; }
.token-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; border: 1px solid var(--control-line); border-radius: var(--r); background: var(--field); }
.token-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.token-input input { flex: 1; min-width: 140px; border: 0; background: transparent; padding: 2px 4px; font-size: 13px; }
.token { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 2px 0 8px; border-radius: 999px; background: var(--raised); border: 1px solid var(--line-strong); font-size: 12px; }
.token button { border: 0; background: none; color: var(--muted); width: 18px; height: 18px; border-radius: 4px; display: grid; place-items: center; padding: 0; }
.token button:hover { background: var(--hover); color: var(--ink); }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.suggestions button { border: 1px dashed var(--line-strong); background: none; color: var(--muted); border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.suggestions button:hover { border-style: solid; color: var(--ink); }
fieldset { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
legend { padding: 0; font-size: 12px; font-weight: 500; margin-bottom: 8px; }

/* Segmented control (Linear view tabs) */
.segmented { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--chrome); border: 1px solid var(--line); }
.segmented a, .segmented button { border: 0; background: none; color: var(--ink-2); padding: 0 10px; min-height: 24px; border-radius: 6px; font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; text-decoration: none !important; }
.segmented a:hover, .segmented button:hover { color: var(--ink); }
.segmented [aria-current="page"], .segmented [aria-pressed="true"], .segmented [aria-selected="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong); }

/* Callouts */
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-lg); border: 1px solid var(--line-strong); background: var(--panel); }
.callout > svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--muted); }
.callout .callout-body { flex: 1; min-width: 0; }
.callout strong { display: block; font-size: 13px; font-weight: 590; margin-bottom: 2px; }
.callout p { color: var(--muted); font-size: 13px; }
.callout .btn-row { margin-top: 10px; }
.callout.warn { border-color: rgba(242, 153, 74, .3); }
.callout.warn > svg { color: var(--warn); }
.callout.danger { border-color: rgba(235, 87, 87, .35); }
.callout.danger > svg { color: var(--blocked); }
.callout.success > svg { color: var(--success); }
.callout.info > svg { color: var(--info); }
.callout.dev { border-style: dashed; border-color: rgba(242, 201, 76, .35); }
.callout.dev > svg { color: var(--progress); }

/* Empty / unavailable states */
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 40px 16px; color: var(--ink-2); }
.empty svg { width: 28px; height: 28px; color: var(--faint); }
.empty strong { color: var(--ink); font-size: 13px; font-weight: 590; }
.empty p { max-width: 46ch; font-size: 13px; }

/* Progress */
.meter { height: 4px; border-radius: 999px; background: var(--raised); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--acid); border-radius: inherit; transition: width var(--t) var(--ease); }
.ring { --p: 0; --size: 32px; width: var(--size); height: var(--size); border-radius: 50%; background: conic-gradient(var(--acid) calc(var(--p) * 1%), var(--raised) 0); display: grid; place-items: center; flex: none; }
.ring::after { content: attr(data-label); width: calc(var(--size) - 8px); height: calc(var(--size) - 8px); border-radius: 50%; background: var(--panel); display: grid; place-items: center; font: 600 10px var(--sans); color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* Dialog */
dialog.modal { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 12px; background: var(--raised); color: var(--ink); box-shadow: 0 24px 64px rgba(0, 0, 0, .6), 0 0 0 1px var(--line-strong); }
dialog.modal.wide { width: min(760px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(0, 0, 0, .55); }
dialog.modal[open] { animation: pop var(--t) var(--ease); }
@keyframes pop { from { opacity: 0; transform: scale(.98); } }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 6px; }
.modal-head h2 { font-size: 15px; font-weight: 590; }
.modal-head .crumb { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.modal-head .btn { margin-left: auto; }
.modal-body { padding: 8px 16px 16px; overflow-y: auto; max-height: calc(100vh - 180px); }
.modal-foot { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); }
.modal-foot .left { margin-right: auto; color: var(--muted); font-size: 12px; }

/* Toasts (bottom-right, like Linear) */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 300; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--raised); box-shadow: var(--shadow-pop); font-size: 13px; animation: pop var(--t) var(--ease); }
.toast svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.toast.success svg { color: var(--success); }
.toast.error svg { color: var(--blocked); }
.toast.info svg { color: var(--info); }
.toast .toast-body { flex: 1; }
.toast .toast-body small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.toast .close { border: 0; background: none; color: var(--muted); padding: 0 2px; }

/* Messages (support conversations) */
.thread { display: grid; gap: 14px; }
.msg { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; }
.msg-head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; flex-wrap: wrap; }
.msg-head strong { font-weight: 600; }
.msg-head time { color: var(--muted); font-size: 12px; }
.msg-body { margin-top: 4px; padding: 10px 12px; border-radius: 10px; background: var(--raised); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.organizer .msg-body { background: var(--accent-soft); border-color: var(--accent-line); }
.composer { border: 1px solid var(--control-line); border-radius: 8px; background: var(--field); }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea { width: 100%; border: 0; background: transparent; min-height: 80px; padding: 10px 12px; resize: vertical; }
.composer-foot { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-top: 1px solid var(--line); }
.composer-foot .help { margin-right: auto; }

/* Tables (organizer) */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; color: var(--muted); font: 500 12px/1.4 var(--sans); padding: 8px 12px; border-bottom: 1px solid var(--line); background: transparent; white-space: nowrap; }
table.data td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--hover); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 20px; }
.stat { padding: 12px 14px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--panel); text-decoration: none !important; color: var(--ink); display: grid; gap: 2px; }
a.stat:hover { border-color: var(--line-strong); background: var(--raised); }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-context { color: var(--muted); font-size: 12px; }

/* Tabs-as-links bar under page head */
.subnav { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.subnav a { padding: 8px 10px; color: var(--muted); font-size: 13px; font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none !important; display: inline-flex; gap: 6px; align-items: center; }
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.subnav .count { color: var(--muted); font-size: 12px; }

/* Search/filter toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .search { flex: 1; min-width: 200px; max-width: 360px; position: relative; }
.toolbar .search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.toolbar .search .input { padding-left: 30px; }
.toolbar .select { width: auto; min-width: 140px; }
.toolbar .count { color: var(--muted); font-size: 12px; margin-left: auto; }

.save-state { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.save-state.error { color: var(--danger-ink); }
.save-state.saved svg { color: var(--done); width: 14px; height: 14px; }
.divider { height: 1px; background: var(--line); margin: 20px 0; border: 0; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.small { font-size: 12px; }
.stack { display: grid; gap: 12px; }
.stack.tight { gap: 6px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.prose p + p { margin-top: 10px; }
.prose { color: var(--ink-2); line-height: 1.6; }
.prose strong { color: var(--ink); }
.ext::after { content: "↗"; margin-left: 3px; font-size: .85em; }
.ext:has(svg)::after { content: none; }

/* Short link: the address in the app's text color, then its copy button. */
.short-link { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.short-link-label { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.handle-field { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.handle-field .select { width: auto; flex: none; }
.handle-field .input { min-width: 0; }
.page-meta { margin-top: 8px; font-size: 13px; }

/* profile.css */
/* Bento-style profile. A light, quiet canvas: a large avatar and name in an
   identity column beside a grid of white tiles in four sizes (small 1×1,
   wide 2×1, tall 1×2, large 2×2) with generous gaps and soft edges, and a
   floating action bar. The canvas sets its own light palette, so the same
   markup renders as Bento inside the dark app (editor preview) and on the
   standalone profile page. */
/* Light by default; .theme-dark, or the public page on a dark system
   (.theme-auto), switches every token at once through light-dark(). */
.bento-surface {
  color-scheme: light;
  --surface: light-dark(#ffffff, #0b0b0c);
  --panel: light-dark(#ffffff, #161618);
  --raised: light-dark(#f5f5f5, #1f1f22);
  --hover: light-dark(#efefef, #26262a);
  --selected: light-dark(#e8e8e8, #2c2c30);
  --line: light-dark(rgba(0, 0, 0, .07), rgba(255, 255, 255, .08));
  --line-strong: light-dark(rgba(0, 0, 0, .1), rgba(255, 255, 255, .12));
  --control-line: light-dark(rgba(0, 0, 0, .12), rgba(255, 255, 255, .16));
  --field: light-dark(#ffffff, #161618);
  --ink: light-dark(#111111, #f5f5f5);
  --ink-2: light-dark(#3d3d3d, #cfcfcf);
  --muted: light-dark(#6b6b6b, #9b9b9b);
  --faint: light-dark(#a3a3a3, #6a6a6a);
  --link: var(--ink);
  --accent: var(--ink);
  --accent-ink: var(--ink);
  --accent-soft: light-dark(rgba(0, 0, 0, .06), rgba(255, 255, 255, .08));
  --primary: light-dark(#111111, #f5f5f5);
  --primary-hover: light-dark(#2b2b2b, #dcdcdc);
  --primary-ink: light-dark(#ffffff, #111111);
  --shadow-pop: 0 10px 30px light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .5)), 0 0 0 1px var(--line);
  --tile-shadow: light-dark(0 2px 6px rgba(0, 0, 0, .04), none);
  --tile-shadow-hover: light-dark(0 6px 18px rgba(0, 0, 0, .07), 0 6px 18px rgba(0, 0, 0, .4));
  --icon-tile: light-dark(#ffffff, #1f1f22);
  --bar: light-dark(rgba(255, 255, 255, .92), rgba(28, 28, 31, .92));
  --bar-shadow: 0 8px 30px light-dark(rgba(0, 0, 0, .12), rgba(0, 0, 0, .5)), 0 0 0 1px var(--line);
  --tools: light-dark(#111111, #2c2c30);
  background: var(--surface);
  color: var(--ink);
}
.bento-surface.theme-dark { color-scheme: dark; }
.bento-surface.theme-auto { color-scheme: light dark; }
.bento-surface ::selection { background: light-dark(rgba(0, 0, 0, .12), rgba(255, 255, 255, .2)); }
.bento-surface .btn { box-shadow: light-dark(0 1px 2px rgba(0, 0, 0, .05), none); }
.bento-surface .btn:hover:not(:disabled) { background: var(--hover); border-color: var(--control-line); }
.bento-surface .btn.primary:hover:not(:disabled) { background: var(--primary-hover); }
.bento-surface .btn.primary { box-shadow: none; color: var(--primary-ink); }
.bento-surface .chip { border-color: transparent; background: var(--raised); color: var(--ink-2); height: 24px; padding: 0 10px; font-size: 12.5px; }
.bento-surface .chip svg { color: var(--muted); }
.bento-surface .chip.violet::before, .bento-surface .chip.muted::before { content: none; }
.bento-surface :focus-visible { outline-color: var(--ink); }

/* Standalone profile page */
.app.profile-layout { background: var(--surface); min-height: 100vh; }
.profile-layout .dev-banner { position: sticky; top: 0; z-index: 30; background: light-dark(#fffbea, #1d1a0e); color: light-dark(#6b5b16, #d9c77a); border-bottom-color: light-dark(#f1e3a6, #3a3216); }
.profile-layout .dev-banner strong { color: light-dark(#8a6d00, #f0cf5a); }
.profile-layout .dev-banner strong::before { background: #d4a514; }
.profile-layout .dev-banner span { color: light-dark(#7a6a33, #bfb07a); }
.profile-layout .dev-banner button { color: light-dark(#6b5b16, #d9c77a); }
.profile-layout .dev-banner button:hover { background: var(--accent-soft); color: light-dark(#3d3200, #fff3c4); }

.bento-page { padding: clamp(28px, 6vw, 72px) clamp(20px, 5vw, 64px) 120px; max-width: 1320px; margin: 0 auto; }
.bento { display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); gap: clamp(32px, 5vw, 64px); align-items: start; }
.bento-identity { position: sticky; top: 56px; display: grid; gap: 6px; justify-items: start; }
.bento-identity .avatar { margin-bottom: 20px; font-weight: 600; }
.bento-identity h1 { font-size: clamp(30px, 3.6vw, 44px); font-weight: 700; letter-spacing: -.035em; line-height: 1.05; }
.bento-identity .handle { color: var(--muted); font-size: 15px; }
.bento-identity .btn-row { margin-top: 14px; }
.bento-identity .btn-row:empty { display: none; }

.bento-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 176px; grid-auto-flow: dense; gap: 20px; }
.bento-card { position: relative; border-radius: 24px; border: 1px solid var(--line); background: var(--panel); padding: 20px; overflow: hidden; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--tile-shadow); transition: box-shadow var(--t) var(--ease); }
.bento-card:hover { box-shadow: var(--tile-shadow-hover); }
.bento-card.size-small { grid-column: span 1; grid-row: span 1; }
/* Content that runs past a tile fades out instead of being cut mid-line. */
.bento-card::after { content: ""; position: absolute; left: 1px; right: 1px; bottom: 1px; height: 28px; border-radius: 0 0 23px 23px; background: linear-gradient(transparent, var(--panel) 85%); pointer-events: none; }
.bento-tools { z-index: 2; }
.bento-card.size-wide { grid-column: span 2; grid-row: span 1; }
.bento-card.size-tall { grid-column: span 1; grid-row: span 2; }
.bento-card.size-large { grid-column: span 2; grid-row: span 2; }
.bento-card.is-hidden { opacity: .45; border-style: dashed; box-shadow: none; }
.bento-title { font: 500 13px var(--sans); color: var(--muted); }
.sec-about .bento-title, .sec-projects .bento-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.bento-intro { font-size: 18px; line-height: 1.45; color: var(--ink); letter-spacing: -.012em; }
.size-large .bento-intro { font-size: 22px; }
.size-small .bento-intro { font-size: 14px; }
.bento-card .chip-row { margin-top: 0; overflow: hidden; }
.bento-card .stack .small.muted { display: block; margin-bottom: 2px; }

/* Links: each a small row with an icon tile, Bento's link-card grammar. */
.bento-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.bento-links li { min-width: 0; }
.bento-links a { display: flex; gap: 10px; align-items: center; padding: 6px; margin: 0 -6px; border-radius: 12px; color: var(--ink); font-size: 14px; font-weight: 500; text-decoration: none !important; overflow: hidden; }
.bento-links a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bento-links a:hover { background: var(--raised); }
.bento-links a svg { width: 18px; height: 18px; padding: 7px; box-sizing: content-box; flex: none; color: var(--ink); background: var(--icon-tile); border: 1px solid var(--line-strong); border-radius: 10px; }
.bento-links a.ext::after { content: none; }
.bento-links li.small { display: flex; gap: 6px; align-items: center; padding: 6px 0; }
.bento-links li.small svg { width: 14px; height: 14px; }

.bento-builds { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; overflow: hidden; }
.bento-builds a { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: center; color: var(--ink); text-decoration: none !important; }
.bento-builds a > span:last-child { display: grid; gap: 2px; }
.bento-builds strong { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.bento-builds a:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.bento-thumb { width: 96px; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; display: block; border: 1px solid var(--line); }

/* Editing controls: a small floating toolbar per tile, as in Bento. */
.bento-tools { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; gap: 2px; padding: 4px; border-radius: 12px; background: var(--tools); box-shadow: 0 6px 18px rgba(0, 0, 0, .2); opacity: 0; transition: opacity var(--t-fast); }
.bento-card:hover .bento-tools, .bento-card:focus-within .bento-tools { opacity: 1; }
@media (hover: none) { .bento-tools { opacity: 1; } }
.icon-btn { width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: #bdbdbd; }
.icon-btn:hover:not(:disabled), .icon-btn.on { background: rgba(255, 255, 255, .14); color: #fff; }
.icon-btn:disabled { opacity: .35; }
.icon-btn svg { width: 14px; height: 14px; }
.bento-tools .icon-btn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.size-glyph { display: block; border: 1.5px solid currentColor; border-radius: 2px; }
.size-glyph.small { width: 8px; height: 8px; }
.size-glyph.wide { width: 14px; height: 8px; }
.size-glyph.tall { width: 8px; height: 14px; }
.size-glyph.large { width: 14px; height: 14px; }

/* Floating action bar */
.share-bar { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: 16px; background: var(--bar); backdrop-filter: blur(12px); box-shadow: var(--bar-shadow); }
.share-bar .btn { height: 32px; min-height: 32px; border-radius: 10px; padding: 0 12px; font-size: 13px; }
.share-bar .btn:not(.primary) { border-color: transparent; background: transparent; box-shadow: none; }
.share-bar .btn:not(.primary):hover { background: var(--raised); }
.share-bar .sep { width: 1px; height: 18px; background: var(--line-strong); margin: 0 2px; }
.share-bar .home-mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; color: var(--ink) !important; text-decoration: none !important; }
.share-bar .home-mark:hover { background: var(--raised); }
.share-bar .home-mark .brand-mark { background: var(--primary); color: var(--primary-ink); box-shadow: none; }

.owner-strip { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 0 auto 32px; padding: 8px 14px; width: fit-content; max-width: 100%; border-radius: 999px; background: var(--raised); color: var(--ink-2); font-size: 13px; }
.owner-strip svg { width: 15px; height: 15px; color: var(--muted); flex: none; }

/* Editor (inside the dark app): the preview is a light Bento canvas. */
.editor-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.device-frame { border: 1px solid var(--line); border-radius: var(--r-card); padding: clamp(20px, 4vw, 48px); transition: max-width var(--t) var(--ease); margin: 0 auto; }
.device-frame.bento-surface { border-color: transparent; }
/* A dark preview sits on the dark app: a faint edge shows where the profile starts. */
.device-frame.bento-surface.theme-dark { border-color: rgba(255, 255, 255, .08); }
.device-frame.mobile { max-width: 400px; border-radius: 40px; box-shadow: 0 0 0 8px #1a1b1d, 0 0 0 9px #2c2d31; padding: 32px 20px; }
.device-frame .bento-identity { top: 0; }
/* Breakpoints follow the canvas, not the window, so the editor preview and
   the standalone page lay tiles out the same way at the same width. */
.bento-page, .device-frame { container-type: inline-size; }
@container (max-width: 1080px) { .bento-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 700px) {
  .bento { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .bento-identity { position: static; }
  .bento-identity .avatar { --size: 96px !important; width: 96px; height: 96px; margin-bottom: 12px; }
  .bento-identity h1 { font-size: 30px; }
  .bento-grid { grid-auto-rows: 150px; gap: 14px; }
  .bento-card { border-radius: 20px; padding: 16px; }
  .bento-card::after { border-radius: 0 0 19px 19px; }
  .bento-card.size-wide, .bento-card.size-large { grid-column: span 2; }
}
.bento-card .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.bento-card .chip svg { flex: none; }

/* site.css */
/* The profile site's own pieces: the public page's body, the home page,
   and the editor (a dark app page with a light or dark Bento preview). */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.brand-mark { width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center; background: var(--raised); box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--ink); font: 700 12px/1 var(--sans); flex: none; }
.brand-mark.big { width: 48px; height: 48px; border-radius: 12px; font-size: 26px; background: var(--primary); color: var(--primary-ink); box-shadow: none; }
.center { text-align: center; justify-content: center; }

/* Public page and home: the whole body is a Bento surface. */
body.surface-profile { min-height: 100vh; }
.narrow-page { max-width: 560px; }
.narrow-page .empty { padding-top: 15vh; }
.home { max-width: 640px; margin: 0 auto; padding: clamp(48px, 14vh, 140px) 24px 80px; display: grid; gap: 20px; justify-items: start; }
.home h1 { font-size: clamp(32px, 5vw, 48px); font-weight: 700; letter-spacing: -.035em; line-height: 1.05; }
.home .lede { font-size: 17px; line-height: 1.55; color: var(--ink-2); }
.home .btn-row { justify-content: flex-start; }
.home .callout { width: 100%; }
.domains { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.domains li { padding: 6px 12px; border-radius: 999px; background: var(--raised); color: var(--muted); font-size: 14px; }
.domains strong { color: var(--ink); font-weight: 600; }

/* The editor */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: var(--topbar-h); padding: 0 16px; background: var(--chrome); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink) !important; font-weight: 590; text-decoration: none !important; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.editor { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr); gap: 24px; padding: 24px; align-items: start; max-width: 1600px; margin: 0 auto; }
.editor-form { display: grid; gap: 16px; min-width: 0; }
.editor-head h1 { font-size: 20px; margin-bottom: 4px; }
.editor-form > .card { padding: 16px 16px 0; }
.editor-form > .card > h2 { font-size: 13px; margin-bottom: 14px; }
.editor-form > .card > .help:first-of-type { margin: -8px 0 12px; }
.editor-form > .card > .inline { padding-bottom: 16px; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.label-row label { font-size: 12px; font-weight: 500; }
.vis .select { width: auto; min-height: 24px; padding: 1px 6px; font-size: 12px; color: var(--muted); }
.field > .input + .input { margin-top: 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; }
.swatch span:not(.sr-only) { display: block; width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--chrome), 0 0 0 4px var(--ink); }
.swatch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 4px; }
.choices { display: grid; gap: 8px; padding-bottom: 16px; }
.choice { grid-template-columns: auto 1fr; align-items: start; }
.choice input { position: static; opacity: 1; pointer-events: auto; margin-top: 3px; accent-color: var(--accent); }
.choice > span { display: grid; gap: 2px; }
.choice > span strong { color: var(--ink); }
.link-rows, .layout-rows { list-style: none; display: grid; gap: 8px; padding-bottom: 16px; }
.link-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 6px; align-items: center; }
.link-row .field-error { grid-column: 1 / -1; }
.link-row.invalid .input[aria-invalid] { border-color: var(--blocked); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--blocked); }
.link-row .select { min-height: 32px; }
.layout-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r); }
.layout-name { flex: 1; font-weight: 500; }
.layout-row .select { width: auto; min-height: 24px; padding: 1px 6px; font-size: 12px; }
.layout-row .check { padding: 0; align-items: center; }
.layout-row .check input { margin: 0; }
.btn.icon-only { width: 24px; padding: 0; }
.save-bar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px; padding: 12px 0; background: linear-gradient(transparent, var(--chrome) 30%); }
.callout.success, .callout.danger { align-items: center; }
.callout.danger strong { display: inline; margin-right: 4px; }

.editor-preview { position: sticky; top: calc(var(--topbar-h) + 24px); display: grid; gap: 12px; min-width: 0; }
.preview-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
.segmented [aria-current="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong); }
.segmented svg { width: 13px; height: 13px; }
.editor-preview .device-frame { max-height: calc(100vh - var(--topbar-h) - 120px); overflow: auto; }

@media (max-width: 960px) {
  .editor { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .editor-preview { position: static; }
  .editor-preview .device-frame { max-height: none; }
}
@media (max-width: 560px) {
  .link-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .topbar-actions .btn span { display: none; }
}

/* Toast for Copy link */
.toast { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); z-index: 60; }
.surface-app .toast { bottom: 24px; }
/* Size containment: the frame takes the column's width, never its content's. */
.editor-preview .device-frame { width: 100%; }
