/*
 * Full Circle SDLC - one hand-written stylesheet (no build step).
 * Dark is the default theme; [data-theme="light"] switches the tokens.
 * The CSP is style-src 'self', so every style lives here: no inline styles.
 */

:root {
    --bg: #0d1020;
    --surface: #151a30;
    --surface-2: #1c2340;
    --text: #e8eaf6;
    --muted: #a6acc9;
    --border: #2a3157;
    --accent: #8fa2ff;
    --accent-ink: #0b1033;
    --amber: #f0b84d;
    --danger: #ff8a80;
    --ok: #8ee0a1;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .25);
    --composer-bg: #1b2242;
    --radius: 12px;
    --radius-sm: 8px;
    --container: 1120px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-hero: Verdana, Geneva, sans-serif;
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #f5f6fb;
    --surface: #ffffff;
    --surface-2: #eceffa;
    --text: #161a33;
    --muted: #4d5476;
    --border: #d7dbec;
    --accent: #3343b8;
    --accent-ink: #ffffff;
    --amber: #a86a00;
    --danger: #b3261e;
    --ok: #1d6b34;
    --shadow: 0 1px 2px rgba(22, 26, 51, .08), 0 8px 24px rgba(22, 26, 51, .08);
    --composer-bg: #eef1fd;
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.6 var(--font);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1 0 auto; }
main:focus { outline: none; }

img, svg { max-width: 100%; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 4px; }

code { font: .9em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 1px 6px; border-radius: 4px; overflow-wrap: anywhere; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

.skip-link {
    position: absolute; left: 16px; top: -60px; z-index: 100;
    background: var(--accent); color: var(--accent-ink); padding: 8px 16px; border-radius: var(--radius-sm);
    font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
.container--narrow { max-width: 560px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 10px 20px; border-radius: 999px;
    border: 2px solid transparent; font: 600 1rem/1.2 var(--font);
    text-decoration: none; cursor: pointer; transition: transform .15s, background .15s, border-color .15s;
    background: var(--surface-2); color: var(--text);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn--small { min-height: 36px; padding: 6px 14px; font-size: .9rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; transform: none; }

.link-button {
    background: none; border: 0; padding: 0; font: inherit; color: var(--accent);
    cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.text-link { font-weight: 600; }

/* ---------- Navbar ---------- */
.navbar {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--border);
}
.navbar__inner {
    max-width: var(--container); margin: 0 auto; padding: 10px 16px;
    display: flex; align-items: center; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; white-space: nowrap; }
.brand__logo { display: inline-flex; width: 38px; height: 38px; }
.brand__logo svg { width: 100%; height: 100%; }
.brand__logo--small { width: 32px; height: 32px; flex: none; }
.brand__name { font-size: 1.1rem; letter-spacing: .01em; }

.site-nav { margin-left: auto; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 4px; }
.site-nav a, .site-nav .link-button {
    display: inline-block; padding: 8px 12px; border-radius: var(--radius-sm);
    color: var(--text); text-decoration: none; font-weight: 500;
}
.site-nav a:hover, .site-nav .link-button:hover { background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.site-nav__account form { margin: 0; }
.site-nav .link-button { text-decoration: none; }

.navbar__tools { display: flex; align-items: center; gap: 8px; }

/* iPhone-style theme switch: pill track, sliding round knob. On = light mode. */
.theme-switch {
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: 0; padding: 6px; cursor: pointer; border-radius: 999px;
}
.theme-switch__track {
    position: relative; width: 51px; height: 31px; border-radius: 999px;
    background: #39393d; transition: background .25s;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.theme-switch__knob {
    position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
    background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .3), 0 1px 1px rgba(0, 0, 0, .16);
    transition: transform .25s cubic-bezier(.3, .7, .4, 1);
}
.theme-switch[aria-checked="true"] .theme-switch__track { background: #34c759; }
.theme-switch[aria-checked="true"] .theme-switch__knob { transform: translateX(20px); }

.nav-toggle {
    display: none; width: 44px; height: 44px; padding: 10px; border-radius: var(--radius-sm);
    background: none; border: 1px solid var(--border); cursor: pointer;
    flex-direction: column; justify-content: center; gap: 5px;
}
.nav-toggle__bar { display: block; height: 2px; width: 100%; background: var(--text); border-radius: 2px; transition: transform .2s, opacity .2s; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
    .navbar__tools { margin-left: auto; }
    .nav-toggle { display: inline-flex; }
    .site-nav {
        display: none; position: absolute; left: 0; right: 0; top: 100%;
        background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
        padding: 8px 16px 16px;
    }
    .site-nav.is-open { display: block; }
    .site-nav ul { flex-direction: column; align-items: stretch; gap: 2px; }
    .site-nav a, .site-nav .link-button { display: block; width: 100%; text-align: left; padding: 12px; }
    .site-nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--accent); background: var(--surface-2); border-radius: var(--radius-sm); }
    .site-nav__account { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }
}
@media (max-width: 360px) {
    .brand__name { font-size: 1rem; }
    .brand__logo { width: 32px; height: 32px; }
    .navbar__inner { gap: 8px; }
}

/* ---------- Hero ---------- */
.hero {
    position: relative; isolation: isolate; overflow: hidden;
    min-height: min(78vh, 680px); display: flex; align-items: center;
    color: #fff;
}
.hero__img {
    position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%;
    object-fit: cover; object-position: 60% 55%;
}
.hero::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(100deg, rgba(10, 13, 32, .88) 0%, rgba(10, 13, 32, .76) 45%, rgba(10, 13, 32, .6) 100%);
}
.hero__inner { width: 100%; max-width: var(--container); margin: 0 auto; padding: 64px 16px; }
.hero__inner > * { max-width: 640px; }
.hero__title {
    font-family: var(--font-hero); font-weight: 700;
    font-size: clamp(1.9rem, 4.6vw, 3.1rem); line-height: 1.12; letter-spacing: -.01em;
    margin-bottom: 16px; color: #fff;
}
.hero__lead { font-size: 1.15rem; color: #e4e7f7; margin-bottom: 28px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero .btn--primary { background: #8fa2ff; color: #0b1033; }
.hero .btn--ghost { color: #fff; border-color: rgba(255, 255, 255, .7); }
.hero .btn--ghost:hover { background: rgba(255, 255, 255, .12); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 700; color: var(--amber); margin-bottom: 12px; }
.hero .eyebrow { color: #f2c46d; }

/* ---------- Sections ---------- */
.section { padding: 64px 0; }
.section--tight { padding: 32px 0 64px; }
.section--alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section__title { font-size: 1.6rem; margin-bottom: 24px; }
.page-head { padding: 48px 0 8px; }
.page-title { font-family: var(--font-hero); font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.14; margin-bottom: 12px; }
.lead { font-size: 1.125rem; color: var(--muted); max-width: 60ch; }

.grid { display: grid; gap: 24px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.split { display: grid; gap: 32px; grid-template-columns: 1.3fr 1fr; align-items: start; }
@media (max-width: 800px) { .split { grid-template-columns: 1fr; } }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px; box-shadow: var(--shadow);
}
.section--alt .card { background: var(--bg); }
.card > :last-child { margin-bottom: 0; }

.note {
    background: var(--surface-2); border-left: 4px solid var(--amber); border-radius: var(--radius-sm);
    padding: 20px 24px; margin-top: 24px;
}
.split .note { margin-top: 0; }
.note > :last-child { margin-bottom: 0; }
.note .btn { margin-top: 4px; }

.steps { padding-left: 1.3em; margin: 0; }
.steps li { margin-bottom: 10px; }


.empty { text-align: center; padding: 48px 16px; border: 1px dashed var(--border); border-radius: var(--radius); }
.empty > :last-child { margin-bottom: 0; }

.error-page { text-align: center; padding-top: 32px; }
.error-page .lead { margin-left: auto; margin-right: auto; }

/* ---------- Forms ---------- */
.form { margin-top: 24px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], textarea {
    width: 100%; min-height: 44px; padding: 10px 14px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font: 1rem/1.4 var(--font);
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 0; }
input[aria-invalid="true"] { border-color: var(--danger); }
.field__error { color: var(--danger); font-size: .9rem; margin: 6px 0 0; }
.alert {
    background: color-mix(in srgb, var(--danger) 14%, transparent);
    border: 1px solid var(--danger); border-radius: var(--radius-sm); padding: 12px 16px; margin-top: 16px;
}
.alert p { margin: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: auto; }
.site-footer__inner {
    max-width: var(--container); margin: 0 auto; padding: 40px 16px 120px;
    display: grid; gap: 24px; grid-template-columns: 2fr 1.4fr 1.6fr;
}
.site-footer__brand { display: flex; gap: 12px; align-items: flex-start; }
.site-footer__brand p { margin: 0 0 6px; }
.site-footer__name { font-weight: 700; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 8px 18px; align-content: flex-start; }
.site-footer__links a { color: var(--text); }
.site-footer__legal p { margin: 0 0 6px; }
.site-footer__legal a { color: var(--text); }
@media (max-width: 800px) { .site-footer__inner { grid-template-columns: 1fr; } }

/* ---------- Board ---------- */
.status-counts { list-style: none; margin: 0 0 24px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.status-count {
    display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px;
    border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .9rem;
}
.status-count__n { font-weight: 700; font-size: 1.05rem; }
/* Each count is a link that filters the board to that status; a second click clears it. */
a.status-count { text-decoration: none; min-height: 36px; align-items: center; transition: background-color .15s ease; }
a.status-count:hover { background: var(--surface-2); }
a.status-count:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a.status-count[aria-current="page"] { background: color-mix(in srgb, currentColor 16%, var(--surface)); border-width: 2px; padding: 5px 11px; }
a.status-count[aria-current="page"] .status-count__label { font-weight: 700; }
.status-count--all { color: var(--accent); border-color: var(--accent); }
.filter-note { margin: -12px 0 20px; color: var(--muted); }
.board-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px 24px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.board-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.board-card__title { font-size: 1.15rem; margin: 0; overflow-wrap: anywhere; }
.board-card__request {
    margin: 12px 0; padding: 10px 14px; border-left: 3px solid var(--border);
    color: var(--muted); white-space: pre-line; overflow-wrap: anywhere;
}
.board-card__meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 8px 24px; margin: 0; }
.board-card__meta dt { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.board-card__meta dd { margin: 0; overflow-wrap: anywhere; }
.board-card__notes { margin: 12px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.board-card .small { margin: 12px 0 0; }
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .85rem; font-weight: 700; white-space: nowrap; border: 1px solid currentColor; }
.status--new { color: var(--muted); }
.status--in-progress, .status--deploying { color: #7fb8ff; }
.status--needs-info, .status--waiting-approval, .status--tickets-proposed, .status--proposed { color: var(--amber); }
.status--deployed, .status--fixed { color: var(--ok); }
.status--failed, .status--still-failing { color: var(--danger); }
.status--open { color: #7fb8ff; }
.status--dropped { color: var(--muted); }

/* ---------- Whose turn it is: next step, "Waiting for you", approvals ---------- */
.next-step {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
    margin: 0 0 16px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2);
}
.next-step__text { margin: 0; flex: 1 1 260px; overflow-wrap: anywhere; }
.next-step__label { color: var(--muted); }
.next-step--yours { border-left: 4px solid var(--amber); }
.next-step--yours .next-step__label { color: var(--amber); }
.approve-form { margin: 0; }
.board-card .approve-form .btn, .waiting .approve-form .btn { white-space: nowrap; }

.waiting {
    background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--amber);
    border-radius: var(--radius); padding: 16px 20px; margin: 0 0 24px; box-shadow: var(--shadow);
}
.waiting--none { border-left-color: var(--ok); box-shadow: none; padding: 12px 20px; }
.waiting--none .small { margin: 4px 0 0; }
.waiting__title { font-size: 1.05rem; margin: 0; display: flex; align-items: center; gap: 8px; }
.waiting__count {
    display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px;
    border-radius: 999px; background: var(--amber); color: #1a1300; font-size: .85rem;
}
.waiting > .small { margin: 6px 0 0; }
.waiting__list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 12px; }
.waiting__item { padding-top: 12px; border-top: 1px solid var(--border); }
.waiting__what { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.waiting__card { font-weight: 700; overflow-wrap: anywhere; }
.waiting__project { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.waiting__step { margin: 4px 0 8px; color: var(--muted); }
.waiting__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }

.flash {
    margin: 16px 0 0; padding: 12px 16px; border-radius: var(--radius-sm);
    background: var(--surface-2); border-left: 4px solid var(--ok);
}
.flash--warn { border-left-color: var(--danger); }
.flash__text { margin: 0; }
/* Pinned under the sticky navbar, so it is on screen after a jump to a thread. */
.flash--pinned {
    position: fixed; z-index: 45; top: 80px; left: 50%; transform: translateX(-50%);
    width: min(640px, calc(100% - 32px)); margin: 0;
    display: flex; align-items: flex-start; gap: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.flash--pinned .flash__text { flex: 1; }
.flash__close {
    flex: none; width: 32px; height: 32px; margin: -4px -6px -4px 0; border: 0; border-radius: 50%;
    background: transparent; color: inherit; font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.flash__close:hover { background: var(--border); }
.flash__close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:root[data-theme="light"] .status--open { color: #1b5fb3; }
.board-card__tickets { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.board-card__tickets-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; font-family: inherit; }
.tickets { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ticket { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.ticket__round { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.ticket__title { flex: 1 1 220px; overflow-wrap: anywhere; }
.badge--small { padding: 2px 10px; font-size: .78rem; }
:root[data-theme="light"] .status--in-progress, :root[data-theme="light"] .status--deploying { color: #1b5fb3; }
.status-count.status--new, .status-count[class*="status--"] { border-color: currentColor; }
.status-count__label { color: var(--text); }

/* ---------- Channel ---------- */
.channel__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.channel__head > div { flex: 1 1 320px; }
.channel__title { font-weight: 700; }
.channel__hash { color: var(--muted); margin-right: 2px; }
.help { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 20px; }
.help summary { cursor: pointer; font-weight: 600; }
.help ol { margin: 12px 0 0; padding-left: 1.3em; }
.help li { margin-bottom: 6px; }
.channel__feed { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.msg-thread { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 0; }
.msg-thread:target { border-color: var(--amber); }
.msg { display: flex; gap: 12px; padding: 10px 16px; }
.msg--reply { margin-left: 32px; border-left: 2px solid var(--border); padding-left: 14px; }
.msg__avatar {
    flex: none; width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center;
    background: var(--surface-2); color: var(--text); font-weight: 700; font-size: .9rem;
}
.msg--agent .msg__avatar { background: var(--accent); color: var(--accent-ink); font-size: .8rem; }
.msg__body { min-width: 0; flex: 1; }
.msg__meta { margin: 0 0 2px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.msg__text { overflow-wrap: anywhere; position: relative; }
/* "card #10" in a message: a link to the card, with its brief below the line on hover or focus.
   The brief is placed against the whole message (.msg__text), so it never runs off a narrow screen.
   Above the floating reply button (40), below the navbar (50). With too little room below
   (sticky composer, button, screen edge), channel.js adds .card-ref--up to show it above the message. */
.card-ref__link { font-weight: 600; }
.card-ref__tip {
    position: absolute; left: 0; z-index: 45; display: none; flex-direction: column; gap: 4px;
    width: max-content; max-width: min(360px, 100%); margin-top: 4px; padding: 10px 12px;
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: .88rem; line-height: 1.4;
    pointer-events: none; overflow-wrap: anywhere;
}
.card-ref:hover .card-ref__tip, .card-ref:focus-within .card-ref__tip { display: flex; }
.card-ref--up .card-ref__tip { bottom: calc(100% + var(--brief-lift, 0px)); margin: 0 0 4px; }
.card-ref__head { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.card-ref__title { font-weight: 600; }
.card-ref__excerpt { color: var(--muted); }
/* Under each request: its card's status, or that it is waiting to be picked up. */
.msg-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 6px 0 0; font-size: .9rem; }
.msg-status__label { color: var(--muted); }
.tag { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); color: var(--muted); }
.reactions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.reaction-form { margin: 0; display: inline; }
.reaction {
    display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 2px 10px;
    border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
    font: .9rem/1.2 var(--font); cursor: default;
}
button.reaction, summary.reaction { cursor: pointer; }
.reaction--mine { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); }
.reaction--add { list-style: none; font-weight: 700; color: var(--muted); }
.reaction--add::-webkit-details-marker { display: none; }
.reaction-picker { position: relative; display: inline-block; }
.reaction-picker__list {
    position: absolute; z-index: 5; left: 0; bottom: calc(100% + 6px);
    display: flex; gap: 4px; padding: 6px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 999px; box-shadow: var(--shadow);
}
.reply-form { display: flex; gap: 8px; margin: 6px 16px 8px 64px; }
.reply-form input { flex: 1; min-width: 0; min-height: 36px; padding: 6px 12px; }
.msg-thread__count { margin: 0 16px 8px 64px; }
@media (max-width: 520px) {
    .msg--reply { margin-left: 12px; }
    .reply-form, .msg-thread__count { margin-left: 16px; }
}
.composer {
    /* A touch of the accent over the surface, so the composer stands apart from the messages above it. */
    position: sticky; bottom: 12px; background: var(--composer-bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow);
}
.composer textarea { border: 0; background: transparent; padding: 6px; min-height: 64px; }
.composer textarea:focus { outline: none; }
.composer:focus-within { border-color: var(--accent); }
.composer__bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.composer__error { color: var(--danger); margin: 8px 0 0; }
.channel__signin { margin-top: 0; }

/* Floating "Reply to the latest chat" button (board and channel) */
/* On the channel it floats above the composer: channel.js keeps --fab-lift (the composer's distance
   from the bottom of the screen) current as the page scrolls. */
.page-channel .fab { bottom: calc(max(16px, env(safe-area-inset-bottom)) + var(--fab-lift, 0px)); }
/* Room between the last thread and the composer for the button, so it never covers that thread's reply box. */
.page-channel:has(.fab) .channel__feed { margin-bottom: 80px; }
.fab {
    position: fixed; z-index: 40;
    right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
    display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 10px 18px;
    border-radius: 999px; background: var(--accent); color: var(--accent-ink);
    font-weight: 700; text-decoration: none; box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
    transition: transform .15s ease;
}
.fab:hover { transform: translateY(-2px); }
.fab:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
.fab__icon { flex: none; }
/* Room under the last thing on the page, so the button never covers it. */
.page-board .site-footer, .page-channel .site-footer { padding-bottom: 72px; }
@media (max-width: 480px) {
    .fab { padding: 12px; width: 48px; justify-content: center; }
    .fab__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
/* ---------- Bot message alerts (notify.js): navbar bell and toasts ---------- */
.alerts-switch {
    display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
    border-radius: 999px; background: none; border: 1px solid var(--border); color: var(--text); cursor: pointer;
}
.alerts-switch:hover { background: var(--surface-2); }
.alerts-switch:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.alerts-switch__slash { display: none; }
.alerts-switch[aria-pressed="false"] { color: var(--muted); }
.alerts-switch[aria-pressed="false"] .alerts-switch__slash { display: inline; }
/* Small phones: the bell, theme switch and menu button must fit beside the logo and name at 320 px. */
@media (max-width: 400px) {
    .navbar__inner { gap: 6px; }
    .brand { gap: 8px; }
    .navbar__tools { gap: 2px; }
    .alerts-switch { width: 38px; height: 38px; border-color: transparent; }
    .theme-switch { padding: 2px; }
    .nav-toggle { width: 40px; height: 40px; padding: 9px; }
}
@media (max-width: 340px) {
    .navbar__inner { padding-left: 12px; padding-right: 12px; }
    .brand__name { font-size: .86rem; }
}

/* Top right, under the sticky navbar (notify.js sets --toast-top from its height), clear of the latest-chat button and the composer at the bottom. */
.toast-stack {
    position: fixed; z-index: 60; top: var(--toast-top, 84px); right: max(16px, env(safe-area-inset-right));
    width: min(380px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
}
.toast {
    position: relative; pointer-events: auto; padding: 14px 44px 14px 16px;
    background: var(--surface); color: var(--text); border: 1px solid var(--border);
    border-left: 4px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow);
    animation: toast-in .2s ease-out;
}
.toast p { margin: 0; }
.toast__head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; font-size: .95rem; }
.toast__project { color: var(--muted); font-size: .85rem; }
.toast__text { margin-top: 4px !important; overflow-wrap: anywhere; }
.toast__actions { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 10px !important; font-size: .9rem; }
.toast__open { color: var(--accent); font-weight: 700; }
.toast__desktop {
    background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline;
    cursor: pointer; font: inherit; text-align: left;
}
.toast__close {
    position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 50%;
    background: none; border: 0; color: var(--muted); font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.toast__close:hover { background: var(--surface-2); color: var(--text); }
.toast a:focus-visible, .toast button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.reply-form--target { outline: 2px solid var(--amber); outline-offset: 4px; border-radius: var(--radius-sm); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Home: the loop ---------- */
.loop { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: 1fr; counter-reset: loop; }
/* Six steps: 2 x 3 on tablets, 3 x 2 on desktops, so no card is ever left on its own. */
@media (min-width: 600px) { .loop { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .loop { grid-template-columns: repeat(3, 1fr); } }
.loop li { counter-increment: loop; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.section--alt .loop li { background: var(--bg); }
.loop li::before {
    content: counter(loop); display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%; margin-bottom: 10px;
    background: var(--accent); color: var(--accent-ink); font-weight: 700;
}
.loop h3 { font-size: 1.05rem; margin-bottom: 6px; }
.loop p { margin: 0; color: var(--muted); }
.loop__repeat { margin-top: 20px; }

/* Projects: channel tabs, board filter chips, the project on each card */
.project-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.project-tab { display: flex; flex-direction: column; gap: 2px; padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); text-decoration: none; min-width: 0; }
.project-tab:hover { background: var(--surface-2); }
.project-tab[aria-current="page"] { border-color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
.project-tab__channel { font-weight: 700; overflow-wrap: anywhere; }
.project-tab__name { font-size: .85rem; color: var(--muted); }
.project-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { display: inline-block; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-size: .9rem; }
.chip:hover { background: var(--surface-2); }
.chip[aria-current="page"] { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.project-badge { margin: 0 0 8px; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.project-badge a { color: var(--muted); }
.composer__note { margin: 8px 0 0; }
.composer textarea:disabled, .composer .btn:disabled { opacity: .55; cursor: not-allowed; }
.card__links { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 0; }
