/*
 * Design tokens in OKLCH: a neutral grey scale with a near-black primary
 * (near-white in dark mode); colour only for status (info, success, warning,
 * destructive). Inter Tight for text, IBM Plex Mono for anything a
 * machine produces; shadcn/ui-like proportions (36px controls, 3px focus ring).
 * White-label colors are injected as overrides (see branding.go).
 */
@font-face {
  font-family: "Inter Tight";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/inter-tight.woff") format("woff");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/ibm-plex-mono-regular.woff") format("woff");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/ibm-plex-mono-medium.woff") format("woff");
}

:root {
  --radius: 0.625rem;
  --background: oklch(0.985 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --primary: oklch(0.205 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.97 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.5 0 0);
  --accent: oklch(0.97 0 0);
  --border: oklch(0.922 0 0);
  --input: oklch(0.87 0 0);
  --ring: oklch(0.55 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --destructive-text: oklch(0.505 0.213 27.518);
  --success: oklch(0.627 0.17 149.214);
  --success-text: oklch(0.448 0.119 151.328);
  --warning: oklch(0.769 0.188 70.08);
  --warning-text: oklch(0.476 0.114 61.907);
  --info: oklch(0.546 0.215 262.881);
  --info-text: oklch(0.488 0.217 264.376);
  --mark-hold: oklch(0.205 0 0);
  --mark-beam: oklch(0.6 0 0);
  --topbar-height: 3.5rem;
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08);
  --font-sans: "Inter Tight", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --background: oklch(0.145 0 0);
    --foreground: oklch(0.985 0 0);
    --card: oklch(0.205 0 0);
    --primary: oklch(0.922 0 0);
    --primary-foreground: oklch(0.205 0 0);
    --secondary: oklch(0.269 0 0);
    --muted: oklch(0.269 0 0);
    --muted-foreground: oklch(0.708 0 0);
    --accent: oklch(0.269 0 0);
    --border: oklch(1 0 0 / 10%);
    --input: oklch(1 0 0 / 15%);
    --ring: oklch(0.556 0 0);
    --destructive: oklch(0.704 0.191 22.216);
    --destructive-text: oklch(0.704 0.191 22.216);
    --success-text: oklch(0.792 0.209 151.711);
    --warning-text: oklch(0.828 0.189 84.429);
    --info: oklch(0.707 0.165 254.624);
    --info-text: oklch(0.707 0.165 254.624);
    --mark-hold: oklch(0.985 0 0);
    --mark-beam: oklch(0.556 0 0);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; border-color: var(--border); }
/* Reserve the scrollbar's space so pages don't shift sideways between long and short pages. */
html { scrollbar-gutter: stable; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--background);
  color: var(--foreground);
  font: 14px/1.5 var(--font-sans);
  font-feature-settings: "rlig" 1, "calt" 1;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-underline-offset: 4px; }
h1 { font-size: 1.5rem; line-height: 1.25; font-weight: 600; letter-spacing: -0.025em; margin: .15em 0 .5em; }
h2 { font-size: 1rem; font-weight: 600; margin: 1.75em 0 .6em; letter-spacing: -0.01em; }
.card h2:first-child, .card h1:first-child { margin-top: 0; }
h3 { font-size: .85rem; font-weight: 600; margin: 1.4em 0 .5em; color: var(--muted-foreground); }
code, kbd { font: .85em var(--font-mono); background: var(--muted); padding: .1em .35em; border-radius: calc(var(--radius) - 4px); }
kbd { border: 1px solid var(--border); }
::selection { background: var(--primary); color: var(--primary-foreground); }

/* Topbar with mark and wordmark */
.top { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.top-inner { max-width: 1400px; margin: 0 auto; padding: 0 24px; min-height: var(--topbar-height); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--foreground); font-size: 1rem; }
.mark { width: 28px; height: 28px; flex-shrink: 0; }
.mark .hold { fill: none; stroke: var(--mark-hold); stroke-width: 7; stroke-linecap: round; }
.mark .beam { fill: var(--mark-beam); }
.wordmark { display: inline-flex; align-items: baseline; gap: .45em; }
.wm-name { font-weight: 700; letter-spacing: -0.03em; }
.wm-tag { font-family: var(--font-mono); font-size: .7em; color: var(--muted-foreground); }
.brand-plain { font-weight: 600; letter-spacing: -0.01em; }
nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
nav a, nav .linklike { color: var(--muted-foreground); text-decoration: none; padding: 6px 10px; border-radius: calc(var(--radius) - 2px); font-size: .875rem; font-weight: 500; }
nav a:hover, nav .linklike:hover { color: var(--foreground); background: var(--accent); }
nav a[aria-current] { color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); }

main { flex: 1 0 auto; width: 100%; max-width: 1400px; margin: 0 auto; padding: 32px 24px 48px; }
.top, .flash, .powered { flex-shrink: 0; }
.flash { width: calc(100% - 32px); }
.narrow { max-width: 640px; margin: 0 auto; }
.narrow.wider { max-width: 760px; }
.narrow.tight { max-width: 384px; }
.lead { color: var(--muted-foreground); font-size: .95rem; margin-top: 0; }
.eyebrow { color: var(--muted-foreground); font-size: .8rem; margin: 0; }
.muted { color: var(--muted-foreground); }
.small { font-size: .8rem; font-weight: 400; }
.center { text-align: center; }
.hint { color: var(--muted-foreground); font-size: .8rem; margin: .45em 0 0; }
.privacy { color: var(--muted-foreground); font-size: .75rem; text-align: center; margin-top: 24px; }
.back { margin: 0 0 8px; }
.back a { color: var(--muted-foreground); text-decoration: none; font-size: .875rem; }
.back a:hover { color: var(--foreground); }

.flash { max-width: 640px; margin: 16px auto 0; padding: 10px 14px; background: color-mix(in srgb, var(--info) 15%, var(--card)); color: var(--info-text); border-radius: var(--radius); text-align: center; font-weight: 500; }

/* Cards and form controls */
.card { background: var(--card); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); padding: 24px; box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.form .field { margin-bottom: 18px; border: 0; padding: 0; min-width: 0; }
.field > label, .label, legend { display: block; font-weight: 500; font-size: .875rem; margin-bottom: 8px; padding: 0; }
.meta .label { display: inline; margin-right: 6px; color: var(--muted-foreground); }
.opt { color: var(--muted-foreground); font-weight: 400; }
input[type=text], input[type=url], input[type=password], input[type=number], input[type=search], input[type=email], select, textarea {
  width: 100%; min-height: 36px; font: inherit; font-size: .875rem; color: inherit; background: transparent;
  border: 1px solid var(--input); border-radius: calc(var(--radius) - 2px); padding: 6px 12px; box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s;
}
@media (prefers-color-scheme: dark) {
  input[type=text], input[type=url], input[type=password], input[type=number], input[type=search], input[type=email], select, textarea { background: color-mix(in srgb, var(--input) 30%, transparent); }
}
select { padding-right: 8px; }
select option { background: var(--card); }
textarea { resize: vertical; padding: 8px 12px; }
input::placeholder, textarea::placeholder { color: var(--muted-foreground); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, .segmented input:focus-visible + span {
  outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent);
}
input[type=file] { font: inherit; font-size: .875rem; max-width: 100%; color: var(--muted-foreground); }
input[type=file]::file-selector-button {
  font: inherit; font-weight: 500; font-size: .8rem; margin-right: 10px; height: 32px; padding: 0 12px; cursor: pointer;
  border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px); background: var(--card); color: var(--foreground); box-shadow: var(--shadow-xs);
}
input[type=file]::file-selector-button:hover { background: var(--accent); }
input[type=checkbox] { accent-color: var(--primary); width: 16px; height: 16px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: .875rem; margin-bottom: 8px; cursor: pointer; }
.check.small { font-size: .8rem; margin-top: 6px; font-weight: 400; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.span2 { grid-column: span 2; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } .span2 { grid-column: auto; } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.error { color: var(--destructive-text); font-weight: 500; }
.actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.actions.sticky { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--background) 35%); }
.actions-inline { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.inline { display: inline; margin: 0; }

/* Buttons: default, outline, ghost, destructive */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px;
  font: inherit; font-size: .875rem; font-weight: 500; white-space: nowrap; text-decoration: none; cursor: pointer;
  border-radius: calc(var(--radius) - 2px); border: 1px solid var(--border); background: var(--card); color: var(--foreground);
  box-shadow: var(--shadow-xs); transition: background .15s, box-shadow .15s;
}
.btn:hover { background: var(--accent); }
.btn.primary { background: var(--primary); border-color: transparent; color: var(--primary-foreground); box-shadow: none; }
.btn.primary:hover { background: color-mix(in srgb, var(--primary) 90%, transparent); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--accent); }
.btn.danger { color: var(--destructive-text); }
.btn.danger.ghost { border-color: var(--border); }
.btn.danger.ghost:hover { background: color-mix(in srgb, var(--destructive) 10%, transparent); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.linklike.danger { color: var(--destructive-text); font-size: .8rem; }
nav .linklike { text-decoration: none; }
.muted-link { color: var(--muted-foreground); }

/* Category picker as toggle group */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; background: var(--muted); border-radius: var(--radius); }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-block; padding: 5px 14px; border-radius: calc(var(--radius) - 3px); font-size: .875rem; font-weight: 500; color: var(--muted-foreground); border: 1px solid transparent; }
.segmented span:hover { color: var(--foreground); }
.segmented input:checked + span { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-xs); border-color: var(--border); }

/* Upload */
.field > .drop, .drop {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 0; padding: 28px 16px;
  font-weight: 400; border: 1.5px dashed var(--input); border-radius: var(--radius); background: color-mix(in srgb, var(--muted) 50%, transparent);
  text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-main { font-weight: 500; }
.drop-main u { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.drop-sub { color: var(--muted-foreground); font-size: .8rem; }
.rec-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.rec-row[hidden] { display: none; }
.rec-row .btn { border-color: var(--border); box-shadow: var(--shadow-xs); }
.rec-hint { color: var(--muted-foreground); font-size: .8rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--destructive); display: inline-block; }
.recording { border-color: var(--destructive) !important; color: var(--destructive-text); }
.recording .dot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.filelist { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.filelist li { display: grid; grid-template-columns: 48px 1fr auto auto; align-items: center; gap: 12px; padding: 6px 12px 6px 6px; border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px); }
.thumb { width: 48px; height: 36px; object-fit: cover; border-radius: calc(var(--radius) - 4px); background: var(--muted); display: grid; place-items: center; }
.fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: .8rem; }
.fsize { color: var(--muted-foreground); font-size: .8rem; font-family: var(--font-mono); }
details.contact summary { cursor: pointer; font-weight: 500; font-size: .875rem; }
details.contact[open] summary { margin-bottom: 8px; }
.progress { flex: 1; min-width: 120px; height: 6px; background: color-mix(in srgb, var(--primary) 20%, transparent); border-radius: 999px; overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.copyline { display: flex; gap: 8px; margin: 14px 0; }
.copyline input { font-family: var(--font-mono); font-size: .8rem; }

/* Status page */
.steps { list-style: none; padding: 0; margin: 12px 0 24px; display: grid; grid-template-columns: repeat(4, 1fr); }
.steps li { position: relative; padding-top: 22px; font-size: .8rem; color: var(--muted-foreground); text-align: center; }
.steps li::before { content: ""; position: absolute; top: 5px; left: 0; right: 0; height: 3px; background: var(--border); }
.steps li::after { content: ""; position: absolute; top: 0; left: 50%; width: 13px; height: 13px; margin-left: -6.5px; border-radius: 50%; background: var(--card); border: 2px solid var(--input); }
.steps li.reached::before { background: var(--primary); }
.steps li.reached::after { background: var(--primary); border-color: var(--primary); }
.steps li.current { color: var(--foreground); font-weight: 600; }
.steps li.current::after { box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent); }
.status-rejected { border-left: 3px solid var(--muted-foreground); }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }

.thread, .notes { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.msg { padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); }
.msg.team { border-left: 3px solid var(--primary); }
.msg.me { background: var(--muted); }
.msg-head { display: flex; align-items: baseline; gap: 10px; font-size: .8rem; color: var(--muted-foreground); margin-bottom: 4px; }
.msg-head strong { color: var(--foreground); font-weight: 600; }
.msg-head form { margin-left: auto; }
.notes li { padding: 10px 14px; background: color-mix(in srgb, var(--warning) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--border)); border-radius: var(--radius); }
.notes-form { display: flex; gap: 8px; align-items: flex-start; }
.notes-form textarea { flex: 1; }

.atts { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.att { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; background: var(--card); }
.att img, .att video { width: 100%; height: 128px; object-fit: cover; display: block; background: var(--muted); }
.att video { object-fit: contain; background: #000; }
.fileicon { height: 128px; display: grid; place-items: center; font-size: 2rem; text-decoration: none; background: var(--muted); }
.att-meta { padding: 6px 10px; font-size: .75rem; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-family: var(--font-mono); }
.att-meta a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; color: var(--foreground); }
.att-meta span { color: var(--muted-foreground); }
.att-meta .linklike { font-family: var(--font-sans); }

/* Badges: tinted status variants, muted, outline */
.chip, .badge, .labels .label {
  display: inline-flex; align-items: center; width: fit-content; padding: 1px 8px; font-size: .75rem; font-weight: 500;
  border-radius: calc(var(--radius) + 1px); border: 1px solid transparent; line-height: 1.4;
}
.chip { background: var(--secondary); color: var(--foreground); }
.chip.ghost { background: transparent; border-color: var(--border); color: var(--muted-foreground); }
.badge { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info-text); }
.labels .label { margin: 0; background: transparent; border-color: var(--border); color: var(--muted-foreground); font-family: var(--font-mono); font-size: .7rem; }

/* Board */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.tb-left { display: flex; align-items: center; gap: 12px; }
.tb-left h1 { margin: 0; }
.tb-right { display: flex; gap: 8px; flex-wrap: wrap; }
.tb-right input[type=search] { width: 240px; }
.tb-right select { width: auto; }
.quickadd { display: flex; gap: 6px; }
.quickadd input { width: 230px; }
.quickadd .btn { width: 36px; padding: 0; }

.board { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; align-items: start; overflow-x: auto; padding-bottom: 8px; }
.col { background: color-mix(in srgb, var(--muted) 70%, transparent); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); padding: 10px; min-height: 120px; }
.col h2 { font-size: .85rem; font-weight: 600; color: var(--muted-foreground); margin: 2px 4px 10px; display: flex; justify-content: space-between; align-items: center; }
.col h2 .count { font-family: var(--font-mono); font-size: .75rem; }
.col-planned h2 { color: var(--info-text); }
.col-rejected { opacity: .85; }
.count { font-weight: 500; color: var(--muted-foreground); }
.cards { list-style: none; padding: 0; margin: 0; min-height: 60px; display: grid; gap: 8px; align-content: start; border-radius: var(--radius); transition: background .1s; }
.cards.over { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.kcard { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); cursor: grab; transition: box-shadow .15s, border-color .15s; }
.kcard:hover { box-shadow: var(--shadow-sm); border-color: var(--input); }
.kcard[hidden] { display: none; }
.kcard.dragging { opacity: .45; }
.kcard.unread { border-color: var(--primary); }
.kcard-link { display: block; padding: 10px 12px; color: inherit; text-decoration: none; }
.kcard-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.id { font-size: .75rem; color: var(--muted-foreground); font-family: var(--font-mono); }
.dot-new { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-left: auto; }
.kcard-title { margin: 6px 0; font-weight: 500; font-size: .875rem; line-height: 1.4; overflow-wrap: anywhere; }
.labels { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.kcard-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: .75rem; color: var(--muted-foreground); }

/* Detail */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.detail-side { position: sticky; top: calc(var(--topbar-height) + 16px); }
.detail-side .card { padding: 18px; }
.meta p { margin: 0 0 8px; font-size: .875rem; }
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; } .detail-side { position: static; } }

/* Roadmap */
.page-head { max-width: 640px; }
.roadmap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }
@media (max-width: 800px) { .roadmap { grid-template-columns: 1fr; } }
.rm-col h2 { margin-top: 0; font-size: .95rem; display: flex; gap: 8px; align-items: center; }
.rm-col h2 .count { font-family: var(--font-mono); font-size: .75rem; background: var(--muted); padding: 0 8px; border-radius: 999px; }
.rm-col ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.rm-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-xs); }
.rm-item p { margin: 6px 0 4px; font-weight: 500; }
.rm-planned .rm-item { border-left: 3px solid var(--primary); }
.rm-done .rm-item p { color: var(--muted-foreground); }

.results { margin: 0 0 12px; padding-left: 18px; }

@media (max-width: 640px) {
  .top-inner { padding: 8px 16px; }
  main { padding: 20px 16px 48px; }
  .card { padding: 18px; }
  .tb-right input[type=search], .quickadd input { width: 100%; }
  .tb-right, .quickadd { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* White-label */
.brand .logo { height: 28px; width: 28px; object-fit: contain; flex-shrink: 0; }
.brand .logo.logo-wide { width: auto; max-width: 200px; }
.powered { text-align: center; font-size: .75rem; color: var(--muted-foreground); padding: 16px; border-top: 1px solid var(--border); background: var(--card); }
.powered a { color: inherit; }
.colors { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .colors { grid-template-columns: 1fr; } }
.colorfield .check { margin-bottom: 6px; }
.colorrow { display: flex; align-items: center; gap: 10px; }
input[type=color] { width: 44px; height: 32px; padding: 2px; border: 1px solid var(--input); border-radius: calc(var(--radius) - 2px); background: transparent; cursor: pointer; }
.logo-row { display: flex; gap: 20px; align-items: flex-start; }
.logo-preview { width: 72px; height: 72px; flex-shrink: 0; display: grid; place-items: center; border: 1px solid var(--border); border-radius: var(--radius); background: var(--muted); }
.logo-preview img { max-width: 56px; max-height: 56px; }
.logo-preview .mark { width: 44px; height: 44px; }

/* Tables, account, legal */
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th { text-align: left; font-weight: 500; color: var(--muted-foreground); font-size: .8rem; padding: 0 8px 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }
.table .mono { font-family: var(--font-mono); font-size: .8rem; }
.table .right { text-align: right; }
nav .me { color: var(--foreground); }
input:disabled { opacity: .6; }
.powered { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.selfdelete { text-align: center; margin-top: 8px; }
.legal { line-height: 1.6; }

/* Status track on the card page */
.track { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 4px 0 6px; }
.lane {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 10px;
  min-height: 76px; padding: 10px 12px; font: inherit; text-align: left; cursor: pointer; color: var(--muted-foreground);
  background: color-mix(in srgb, var(--muted) 70%, transparent); border: 1.5px dashed var(--border); border-radius: var(--radius);
  transition: border-color .15s, background .15s, color .15s;
}
.lane:hover { color: var(--foreground); border-color: var(--input); }
.lane-label { font-size: .85rem; font-weight: 600; }
.lane.current { color: var(--foreground); background: var(--card); border-style: solid; border-color: var(--input); box-shadow: var(--shadow-xs); }
.lane.over { border-color: var(--primary); border-style: solid; background: color-mix(in srgb, var(--primary) 6%, var(--card)); color: var(--foreground); }
.lane.saving { opacity: .7; }
.track.dragging .lane:not(.current) { border-color: var(--input); }
.token {
  display: inline-flex; align-items: center; height: 28px; padding: 0 10px; cursor: grab; user-select: none;
  font-family: var(--font-mono); font-size: .8rem; font-weight: 500;
  background: var(--primary); color: var(--primary-foreground); border-radius: calc(var(--radius) - 2px); box-shadow: var(--shadow-sm);
}
.token:active { cursor: grabbing; }
.track-hint { margin: 0 0 16px; }
.inline-row { display: flex; gap: 8px; }
.inline-row input { flex: 1; }
@media (max-width: 700px) {
  .track { grid-template-columns: 1fr 1fr; }
  .inline-row { flex-direction: column; }
}
.mono-input { font-family: var(--font-mono) !important; letter-spacing: .08em; text-transform: uppercase; }

/* Board tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: -8px 0 18px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: calc(var(--radius) - 2px); font-size: .875rem; font-weight: 500; color: var(--muted-foreground); text-decoration: none; }
.tab:hover { color: var(--foreground); background: var(--accent); }
.tab.active { color: var(--foreground); background: var(--card); box-shadow: var(--shadow-xs); border: 1px solid var(--border); }
.tab-count { font-family: var(--font-mono); font-size: .72rem; color: var(--muted-foreground); }
.tab .dot-new { margin-left: 0; }
.tab-manage { color: var(--muted-foreground); border: 1px dashed var(--border); }
.lock { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.rename { display: flex; gap: 6px; }
.rename input { max-width: 260px; }
.og-row { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.og-preview { width: 300px; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; border: 1px solid var(--border); border-radius: var(--radius); background: var(--muted); }
.og-row > div { flex: 1; min-width: 240px; }


/* ==========================================================================
   Motion. Everything here answers something the user does; nothing loops.
   prefers-reduced-motion (above) turns it off.
   ========================================================================== */
:root {
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

/* Page changes: header stays put, the active nav pill and board tab glide to
   their new place, content cross-fades (View Transitions, progressive). */
@view-transition { navigation: auto; }
.top { view-transition-name: topbar; }
nav a[aria-current] { view-transition-name: nav-pill; }
.tab.active { view-transition-name: board-tab; }
::view-transition-group(nav-pill), ::view-transition-group(board-tab) { animation-duration: .38s; animation-timing-function: var(--ease-spring); }
::view-transition-old(root) { animation: .16s ease-in both vt-out; }
::view-transition-new(root) { animation: .28s var(--ease-out) both vt-in; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }

/* Buttons respond to the press. */
.btn, .tab, nav a, .lane { transition: background .15s, color .15s, border-color .15s, box-shadow .15s, transform .18s var(--ease-spring); }
.btn:active, .tab:active, .lane:active { transform: scale(.97); }

/* Segmented control: a liquid blob that stretches towards the new option,
   lets its trailing edge catch up, and settles with a little bounce. */
.segmented { position: relative; isolation: isolate; overflow: hidden; }
.segmented .seg-blob {
  position: absolute; z-index: -1; top: 3px; bottom: 3px; left: var(--l, 3px); right: var(--r, 3px);
  border-radius: calc(var(--radius) - 3px); background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-xs);
  transition: left .46s cubic-bezier(.3, 1.22, .5, 1) var(--dl, 0s), right .46s cubic-bezier(.3, 1.22, .5, 1) var(--dr, 0s);
}
.segmented.js input:checked + span { background: transparent; border-color: transparent; box-shadow: none; }
.segmented.js label span { transition: color .2s; }
.segmented .seg-blob.squish { animation: squish .42s var(--ease-out); }
@keyframes squish { 40% { transform: scaleY(.86); } 100% { transform: none; } }

/* Checkboxes in forms become switches with a springy knob. */
.check input[type=checkbox] {
  -webkit-appearance: none; appearance: none; flex-shrink: 0; position: relative; margin: 0;
  width: 34px; height: 20px; border-radius: 999px; background: var(--input); cursor: pointer;
  transition: background .2s;
}
.check input[type=checkbox]::before {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25);
  transition: transform .32s var(--ease-spring), width .18s var(--ease-out);
}
.check input[type=checkbox]:active::before { width: 20px; }
.check input[type=checkbox]:checked { background: var(--primary); }
.check input[type=checkbox]:checked::before { transform: translateX(14px); }
.check input[type=checkbox]:checked:active::before { transform: translateX(10px); }
.check input[type=checkbox]:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 45%, transparent); }
.check.small input[type=checkbox] { width: 28px; height: 16px; }
.check.small input[type=checkbox]::before { width: 12px; height: 12px; }
.check.small input[type=checkbox]:checked::before { transform: translateX(12px); }

/* Kanban: cards make room smoothly (FLIP in board.js); the dragged card leaves a ghost slot. */
.kcard { transition: box-shadow .2s, border-color .2s, opacity .2s; }
.kcard.dragging { opacity: 1; background: transparent; border: 1.5px dashed var(--input); box-shadow: none; }
.kcard.dragging > * { visibility: hidden; }
.kcard.dropped { animation: drop-settle .45s var(--ease-spring); }
@keyframes drop-settle { 0% { transform: scale(1.04) rotate(-1deg); box-shadow: var(--shadow-sm); } 100% { transform: none; } }
.count.bump { animation: bump .4s var(--ease-spring); display: inline-block; }
@keyframes bump { 40% { transform: scale(1.35); } }

/* Status track: the token flies to its new lane (Web Animations in ticket.js). */
.lane.current { transition-duration: .3s; }
.lane.landed { animation: lane-land .5s var(--ease-out); }
@keyframes lane-land { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 35%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }

/* Flash messages become a toast that slides in and leaves on its own. */
.flash {
  position: fixed; z-index: 50; top: calc(var(--topbar-height) + 12px); left: 50%; width: auto; max-width: min(520px, calc(100vw - 32px));
  margin: 0; padding: 10px 18px; transform: translateX(-50%); box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  animation: toast-in .45s var(--ease-spring) both;
}
.flash.out { animation: toast-out .3s var(--ease-out) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -14px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, -10px); } }

/* Upload list: new files pop in. */
.filelist li { animation: pop-in .35s var(--ease-spring) both; }
@keyframes pop-in { from { opacity: 0; transform: scale(.94) translateY(4px); } }
.drop.over { transform: scale(1.01); transition: transform .25s var(--ease-spring), border-color .15s, background .15s; }

/* Success: the one orchestrated moment – a check draws itself. */
.done-check { width: 44px; height: 44px; margin-bottom: 8px; }
.done-check circle { fill: none; stroke: var(--success); stroke-width: 3; stroke-dasharray: 126; stroke-dashoffset: 126; animation: draw .55s var(--ease-out) .05s forwards; }
.done-check path { fill: none; stroke: var(--success); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .35s var(--ease-out) .5s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.done:not([hidden]) { animation: pop-in .45s var(--ease-spring) both; }

/* Status page: progress fills up to the current step. */
.steps li::before { transform-origin: left; animation: fill .7s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 90ms); }
.steps li:nth-child(2) { --i: 1; } .steps li:nth-child(3) { --i: 2; } .steps li:nth-child(4) { --i: 3; }
@keyframes fill { from { transform: scaleX(0); } }
.steps li.current::after { animation: pulse-ring 1.6s var(--ease-out) .5s 2; }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 40%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* Capture buttons */
.ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.filelist li { grid-template-columns: 48px 1fr auto auto; }
.factions { display: inline-flex; gap: 12px; }

/* Markup editor */
html.mk-open { overflow: hidden; }
.mk {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, #000 55%, transparent); backdrop-filter: blur(3px);
  animation: mk-fade .2s ease both;
}
.mk.closing { animation: mk-fade .18s ease reverse both; }
@keyframes mk-fade { from { opacity: 0; } }
.mk-panel {
  display: flex; flex-direction: column; gap: 10px; width: min(1200px, 100%); max-height: calc(100dvh - 32px);
  padding: 12px; background: var(--card); border: 1px solid var(--border); border-radius: calc(var(--radius) + 6px);
  box-shadow: 0 24px 64px rgb(0 0 0 / .35); animation: pop-in .32s var(--ease-spring) both;
}
.mk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mk-group { display: inline-flex; gap: 2px; padding: 3px; background: var(--muted); border-radius: var(--radius); }
.mk-spacer { flex: 1; }
.mk-btn {
  display: grid; place-items: center; width: 34px; height: 32px; border: 0; border-radius: calc(var(--radius) - 3px);
  background: transparent; color: var(--muted-foreground); cursor: pointer; transition: background .15s, color .15s, transform .18s var(--ease-spring);
}
.mk-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.mk-btn:hover { color: var(--foreground); }
.mk-btn.on { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-xs); }
.mk-btn:active { transform: scale(.92); }
.mk-swatch {
  width: 26px; height: 26px; margin: 3px; border-radius: 50%; border: 2px solid var(--card); background: var(--c); cursor: pointer;
  box-shadow: 0 0 0 1px var(--border); transition: transform .2s var(--ease-spring), box-shadow .15s;
}
.mk-swatch.on { transform: scale(1.15); box-shadow: 0 0 0 2px var(--foreground); }
.mk-stage { flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; border-radius: var(--radius); background: repeating-conic-gradient(var(--muted) 0 25%, var(--card) 0 50%) 0 0 / 16px 16px; }
.mk-canvas { max-width: 100%; max-height: calc(100dvh - 170px); width: auto; height: auto; cursor: crosshair; touch-action: none; display: block; }
.mk-hint { margin: 0; font-size: .8rem; color: var(--muted-foreground); }
@media (max-width: 640px) { .mk { padding: 0; } .mk-panel { max-height: 100dvh; border-radius: 0; } }

/* Prefilled context chip */
.sentfrom { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; padding: 8px 12px; font-size: .8rem; color: var(--muted-foreground); background: var(--muted); border-radius: var(--radius); transition: opacity .2s, transform .25s var(--ease-out); }
.sentfrom.removed { opacity: 0; transform: translateY(-4px); }
.sentfrom-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sentfrom-text strong { color: var(--foreground); font-weight: 500; }
.sentfrom-page { font-family: var(--font-mono); font-size: .75rem; }

/* Embedded in the widget */
body.embed { background: var(--card); }
body.embed main { padding: 8px 16px 20px; }
body.embed .narrow { max-width: none; }
body.embed h1 { font-size: 1.2rem; margin-top: 4px; }
body.embed .card.form { border: 0; box-shadow: none; padding: 0; background: transparent; }
body.embed .powered { background: transparent; border-top: 1px solid var(--border); padding: 10px; }
body.embed .privacy { margin-top: 12px; }
.embed-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; background: var(--card); }
.embed-top .brand { font-size: .9rem; gap: 8px; }
.embed-top .mark, .embed-top .logo { width: 22px; height: 22px; }
.embed-close { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--muted-foreground); cursor: pointer; transition: background .15s, color .15s, transform .2s var(--ease-spring); }
.embed-close:hover { background: var(--accent); color: var(--foreground); }
.embed-close:active { transform: scale(.9); }
.embed-close svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
body.embed .flash { top: 56px; }
.codebox { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; }
.codebox pre { flex: 1; margin: 0; padding: 10px 12px; overflow-x: auto; background: var(--muted); border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px); font: .8rem/1.5 var(--font-mono); }
.codebox code { background: none; padding: 0; font: inherit; white-space: pre-wrap; word-break: break-all; }
.pageurl a { word-break: break-all; font-family: var(--font-mono); font-size: .8rem; }
html:has(body.embed) { scrollbar-gutter: auto; }
