:root {
    color-scheme: light;
    --ink: #1c1915;
    --muted: #5c564c;
    --line: #e4ddd0;
    --paper: #f7f4ee;
    --card: #fffdf9;
    --navy: #1e3a4c;
    --navy-2: #163041;
    --amber: #8a5a12;
    --amber-bg: #f8ecd4;
    --blue: #1d4e89;
    --blue-bg: #e4eef8;
    --danger: #8f2d2d;
    --ok-bg: #e5f2e8;
    --ok: #1f6b3a;
    --err-bg: #f8e6e2;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
    color: var(--ink);
    background: var(--paper);
}

a { color: var(--navy); }
a:hover { color: var(--blue); }

.site-header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    align-items: center;
    padding: 0.85rem 1.25rem;
    background: var(--navy);
    color: #f7f4ee;
}

.site-header a { color: #f7f4ee; text-decoration: none; }
.brand a { font-weight: 650; letter-spacing: 0.01em; }
.nav { display: flex; gap: 1rem; }
.who {
    margin-left: auto;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.92rem;
}
.role { color: #d9e2e8; }

main {
    max-width: 1080px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

main:has(.board) {
    max-width: 1240px;
}
main:has(.board.has-transferred) {
    max-width: 1480px;
}

h1 { font-size: 1.7rem; line-height: 1.2; margin: 0 0 0.4rem; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 0.5rem; }
.lede, .hint { color: var(--muted); margin-top: 0; }
.crumb { margin: 0 0 0.4rem; }

.flash {
    padding: 0.7rem 0.85rem;
    border-radius: 6px;
    margin: 0 0 1rem;
}
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--err-bg); color: var(--danger); }

.notice {
    background: var(--amber-bg);
    border: 1px solid #e2c48a;
    padding: 0.9rem 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}
.notice .code {
    font: 700 2rem/1 ui-monospace, monospace;
    letter-spacing: 0.18em;
    margin: 0.6rem 0 0;
}
.lost-reasons p { margin: 0; }
.lost-reason-list { margin: 0.35rem 0 0; padding-left: 1.2rem; }
.lost-reason-list li { margin: 0.12rem 0; }

form.stack, .stack { display: grid; gap: 0.65rem; }
.narrow { max-width: 28rem; }
label { display: grid; gap: 0.25rem; font-weight: 600; }
input, select, textarea, button {
    font: inherit;
    color: inherit;
}
input, select, textarea {
    width: 100%;
    padding: 0.45rem 0.55rem;
    border: 1px solid #cfc6b8;
    border-radius: 6px;
    background: white;
}
button {
    width: fit-content;
    padding: 0.45rem 0.8rem;
    border: 0;
    border-radius: 6px;
    background: var(--navy);
    color: white;
    cursor: pointer;
}
button:hover { background: var(--navy-2); }
button.danger { background: var(--danger); }
button.linkish {
    background: transparent;
    color: #f7f4ee;
    padding: 0;
    text-decoration: underline;
}
form.inline, .inline {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}
.inline select { width: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border: 1px solid var(--line);
}
th, td {
    text-align: left;
    vertical-align: top;
    padding: 0.65rem 0.7rem;
    border-bottom: 1px solid var(--line);
}
th { font-size: 0.82rem; letter-spacing: 0.02em; color: var(--muted); }
.snippet { display: block; color: var(--muted); font-size: 0.92rem; }

.badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 650;
}
.badge-queue { background: var(--amber-bg); color: var(--amber); }
.badge-reminder { background: var(--blue-bg); color: var(--blue); }
.badge-late { background: var(--err-bg); color: var(--danger); }

.board-scroll { overflow-x: auto; }

.board {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: start;
}
.board.has-transferred { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.column {
    min-width: 0;
    min-height: 8rem;
    padding: 0.65rem;
    background: rgba(255, 253, 249, 0.55);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.column-title {
    margin: 0 0 0.6rem;
    font-size: 0.82rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    color: var(--muted);
}

.column-cards { display: grid; gap: 0.6rem; }

.card {
    display: grid;
    gap: 0.15rem;
    padding: 0.7rem 0.75rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.card .badge { justify-self: start; }

.card:hover { border-color: #c9bfb0; color: inherit; }
.card.is-transferred { text-decoration: none; }
.card-open {
    display: grid;
    gap: 0.15rem;
    color: inherit;
    text-decoration: none;
}
.card-open:hover { color: inherit; }
.recall-form { margin: 0.45rem 0 0; }
.recall-form button { width: 100%; }
.card-customer { font-weight: 650; }
.card-company,
.card-stage,
.card-reminder { color: var(--muted); font-size: 0.92rem; }
.card-stage-line { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; }
.badge-reply { background: #f3e4c8; color: #6a4b16; }
.badge-new { background: var(--blue-bg); color: var(--blue); }
.card-reminder.is-late { color: var(--danger); }
.card-subject { font-weight: 650; margin-top: 0.2rem; }
.card-amount { font-weight: 650; }

.task-list { list-style: none; padding: 0; }
.task-item { margin: 0 0 0.9rem; }
.task-line { margin: 0; }
details.task-edit { margin-top: 0.35rem; }
details.task-edit > summary {
    width: fit-content;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    background: var(--navy);
    color: white;
    cursor: pointer;
    list-style: none;
}
details.task-edit > summary::-webkit-details-marker { display: none; }
details.task-edit[open] > summary { margin-bottom: 0.55rem; }
fieldset {
    border: 1px solid var(--line);
    border-radius: 6px;
    margin: 0;
}
label.check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
}
label.check input { width: auto; }
.file-list { list-style: none; padding: 0; margin: 0.35rem 0 0; }
.file-list li { margin: 0.2rem 0; }
.file-list a { font-weight: 650; }
.pending-files { list-style: none; padding: 0; margin: 0.35rem 0 0; }
.pending-files-block .hint { margin: 0 0 0.2rem; }
.pending-files-block .pending-files { margin-top: 0; }
.pending-files button {
    background: transparent;
    color: var(--navy);
    padding: 0 0 0 0.4rem;
    text-decoration: underline;
}

.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.75rem 1rem;
    margin: 1rem 0;
    padding: 0;
}
.facts div { margin: 0; }
.facts dt { color: var(--muted); font-size: 0.82rem; }
.facts dd { margin: 0.1rem 0 0; font-weight: 650; }
.facts .fact-late dt,
.facts .fact-late dd { color: var(--danger); }

body:has(.chain-page) main {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0.55rem 1.25rem 2.5rem;
}

.stage-bar-scroll { overflow-x: auto; margin: 0.35rem 0 1rem; }
.stage-bar {
    display: flex;
    gap: 0;
    min-width: 40rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.stage-bar li {
    flex: 1 1 0;
    margin: 0;
    padding: 0.55rem 0.4rem;
    border: 1px solid var(--line);
    border-left-width: 0;
    background: var(--card);
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 650;
    text-align: center;
}
.stage-bar li:first-child {
    border-left-width: 1px;
    border-radius: 8px 0 0 8px;
}
.stage-bar li:last-child { border-radius: 0 8px 8px 0; }
.stage-bar li.is-current {
    background: var(--navy);
    border-color: var(--navy);
    color: #f7f4ee;
}
.stage-bar li.is-lost.is-current {
    background: var(--danger);
    border-color: var(--danger);
}

.chain-layout {
    display: grid;
    grid-template-columns: minmax(16.5rem, 21rem) minmax(0, 1fr);
    gap: 1.25rem 1.5rem;
    align-items: start;
}
.chain-side { grid-column: 1; grid-row: 1; min-width: 0; }
.chain-main { grid-column: 2; grid-row: 1; min-width: 0; }
.chain-side h2 { margin: 0 0 0.3rem; font-size: 1rem; }
.chain-facts {
    display: grid;
    gap: 0.7rem;
    margin: 0;
}
.chain-facts .fact { margin: 0; }
.chain-facts dt,
.chain-facts .fact-label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.02em;
}
.chain-facts .fact-label,
.chain-facts .fact-value { margin: 0; }
.chain-facts dd,
.chain-facts .fact-value { margin-top: 0.08rem; font-weight: 650; }
.chain-facts .fact-late dt,
.chain-facts .fact-late dd,
.chain-facts .fact-late .fact-label,
.chain-facts .fact-late .fact-value,
.chain-facts .late-phrase { color: var(--danger); }
.chain-side .hint { margin: 0.35rem 0 0; }

.task-block {
    margin-top: 0.75rem;
    padding: 0.75rem 0.8rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
}
.task-block .stack { margin-top: 0.65rem; }
.task-assignee { margin: 0; font-weight: 650; }
.task-role,
.task-meta { margin: 0; color: var(--muted); font-size: 0.92rem; }
a.task-open {
    display: block;
    color: inherit;
    text-decoration: none;
}
a.task-open:hover .task-assignee { color: var(--blue); }
a.back-control {
    display: inline-block;
    margin: 0 0 0.75rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--card);
    font-weight: 650;
    text-decoration: none;
}
a.back-control:hover { border-color: #c9bfb0; }

.follow-up {
    margin: 0 0 0.75rem;
    padding: 0.5rem 0.8rem 0.55rem;
    background: var(--amber-bg);
    border: 1px solid #e2c48a;
    border-radius: 8px;
}
.follow-up h2 { margin: 0; font-size: 1.15rem; line-height: 1.25; }
.follow-up-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.follow-up-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    flex: none;
}
.follow-up-date .late-phrase,
.follow-up-date .reminder-day {
    margin: 0;
    font-weight: 650;
    white-space: nowrap;
}
.follow-up-date .late-phrase { color: var(--danger); }
.follow-up-date input[type="date"] { width: auto; background: #fff; }
.follow-up .stack { gap: 0.35rem; }
.follow-up textarea {
    min-height: 2.8rem;
    font-size: 1rem;
    line-height: 1.4;
    padding: 0.35rem 0.5rem;
    background: #fff;
    resize: vertical;
}
.follow-up .hint { margin: 0; }
.follow-up-text {
    margin: 0;
    font-size: 1.15rem;
    line-height: 1.45;
    font-weight: 650;
}
.chain-main .thread { margin-top: 0; }
.chain-main .message {
    background: #fff;
    border: 1px solid var(--line);
    border-left: 1px solid var(--line);
}
.chain-main .message-in.is-unread {
    background: #d5e5f7;
    border-color: #c3d6ee;
    cursor: pointer;
}
.chain-main form.open-mail { margin: 0; }
.chain-main button.open-mail {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    border: 0;
    border-radius: 0;
    text-align: left;
    font: inherit;
    cursor: pointer;
}
.chain-main button.open-mail:hover { background: transparent; }
.chain-main button.open-mail .meta,
.chain-main button.open-mail .subject,
.chain-main button.open-mail .body,
.chain-main .message > .meta,
.chain-main .message > .subject,
.chain-main .message > .body {
    display: block;
}
.chain-main .message-in.is-read {
    background: #fff;
    border-color: var(--line);
}
.chain-main .message-out {
    background: #fff4c2;
    border-color: #ead98a;
    border-left-color: #ead98a;
}
.chain-main .internal-replies {
    list-style: none;
    padding: 0;
    margin: 0 0 0.75rem;
    display: grid;
    gap: 0.75rem;
}
.chain-main .internal-reply {
    display: block;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: inherit;
}
.chain-main .internal-reply.is-unread {
    background: #e5f6ea;
    border-color: #c5e6cf;
}
.chain-main a.internal-reply-open {
    display: block;
    color: inherit;
    text-decoration: none;
}
.chain-main .internal-reply .sender {
    margin: 0 0 0.15rem;
    font-weight: 650;
}
.chain-main .internal-reply .internal-reply-line { margin: 0; }
.chain-main button.mark-unread {
    margin-top: 0.45rem;
    padding: 0.2rem 0.55rem;
    background: transparent;
    color: var(--navy);
    border: 1px solid #c9bfb0;
    font-size: 0.85rem;
}
.chain-main button.mark-unread:hover { background: #f7f4ee; }
.chain-main .mark-unread-form { margin: 0; }
.message-latest { box-shadow: 0 1px 0 rgba(30, 58, 76, 0.04); }
body:has(.task-page) {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
body:has(.task-page) main {
    flex: 1 1 auto;
    min-height: 0;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0.4rem 1rem 0.55rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
body:has(.task-page) .flash { margin: 0 0 0.4rem; flex: none; }
.task-page {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.task-page > p,
.task-page > h1 { flex: none; margin: 0 0 0.35rem; }
.task-layout {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(13rem, 16rem) minmax(0, 1fr);
    gap: 0.75rem 1.25rem;
    align-items: stretch;
}
.task-record { min-width: 0; min-height: 0; overflow: auto; }
.task-record .stack { margin-top: 0.75rem; }
.job-chat {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.job-chat-bar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}
.job-chat-bar h2 { margin: 0; flex: none; font-size: 1.2rem; }
.observer-form {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0 auto;
    min-width: 0;
}
.observer-form select { width: 13rem; max-width: 34vw; margin: 0; }
.observer-form button { flex: none; }
.job-chat .thread-window {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    margin-top: 0.45rem;
}
.job-chat .thread {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
}
.job-chat .message {
    max-width: min(100%, 36rem);
    background: #f3e4c8;
    border: 1px solid #e4d0aa;
    border-left: 1px solid #e4d0aa;
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
}
.job-chat .message-out {
    margin-left: auto;
    background: #d5e5f7;
    border-color: #c3d6ee;
    border-left-color: #c3d6ee;
}
.job-chat .sender { margin: 0 0 0.15rem; font-weight: 650; }
.job-chat .task-files { list-style: none; padding: 0; margin: 0 0 0.85rem; display: grid; gap: 0.75rem; }
.job-chat .task-files .is-picture { width: min(36rem, 100%); }
.job-chat .task-files .attachment-picture {
    display: block;
    width: min(36rem, 100%);
    height: auto;
    border-radius: 8px;
    background: #fff;
}
.job-chat .task-files a { font-weight: 650; }
.job-chat .compose {
    max-width: none;
    margin-top: 0.45rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.4rem 0.55rem;
    align-items: end;
}
.job-chat .compose textarea {
    height: 5.6rem;
    min-height: 5.6rem;
    max-height: 5.6rem;
    line-height: 1.35;
    resize: none;
}
.job-chat .add-files {
    flex: none;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0.35rem 0 0;
}
.job-chat .add-files label { margin: 0; }
.observed-jobs { margin: 0 0 1rem; }
.observed-jobs h2 { margin: 0 0 0.35rem; font-size: 1.15rem; }
.observed-jobs ul { margin: 0; padding-left: 1.2rem; }
.observed-jobs a { font-weight: 650; }

.late-list a {
    display: block;
    margin: -0.65rem -0.7rem;
    padding: 0.65rem 0.7rem;
    color: inherit;
    text-decoration: none;
    font-weight: 650;
}
.late-list a:hover { text-decoration: underline; }
.late-list td.is-late,
.late-list td.is-late a { color: var(--danger); }

body:has(.inbox) {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
body:has(.inbox) main {
    flex: 1 1 auto;
    min-height: 0;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
body:has(.inbox) .flash { margin: 0.6rem 1rem 0; }
.inbox {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: grid;
    grid-template-columns: 17.5rem minmax(0, 1fr);
    gap: 0;
    align-items: stretch;
}
.inbox-list {
    background: #fff;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    overflow: auto;
    max-height: none;
    height: 100%;
}
.inbox-start {
    display: block;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--line);
    font-weight: 650;
    text-decoration: none;
}
#message-list { list-style: none; margin: 0; padding: 0; }
#message-list a {
    display: block;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--line);
    color: inherit;
    text-decoration: none;
}
#message-list a:hover,
.inbox-start:hover { background: var(--paper); }
#message-list a.is-open,
.inbox-start.is-open,
#message-list a.is-open:hover,
.inbox-start.is-open:hover { background: var(--blue-bg); }
#message-list .name { font-weight: 650; }
.inbox-list > .empty { margin: 0; padding: 0.7rem 0.85rem; }
.inbox-thread {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0.85rem 1.1rem 0.75rem;
    background: var(--paper);
}
.inbox-thread.has-thread { height: auto; }
.thread-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: none;
    margin: 0 0 0.65rem;
    min-width: 0;
}
.thread-bar h2 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.3;
    min-width: 0;
}
.thread-who { font-weight: 450; color: var(--muted); }
.thread-window {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf9;
}
.inbox-thread .thread {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.inbox-thread .message { max-width: min(100%, 36rem); }
.inbox-thread .message-out { margin-left: auto; }
#start-group { max-width: 36rem; }
fieldset.people-pick { display: grid; gap: 0.35rem; }
.member-list { margin: 0.2rem 0 1rem; padding-left: 1.2rem; }

.thread { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.message {
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 4px solid var(--navy);
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
}
.message-out { border-left-color: var(--blue); }
.inbox-thread .message {
    background: #f3e4c8;
    border: 1px solid #e4d0aa;
    border-left: 1px solid #e4d0aa;
}
.inbox-thread .message-out {
    background: #d5e5f7;
    border-color: #c3d6ee;
    border-left-color: #c3d6ee;
}
.inbox-thread .sender { margin: 0 0 0.15rem; font-weight: 650; }
.inbox-thread .attachments { list-style: none; padding: 0; margin: 0.55rem 0 0; display: grid; gap: 0.65rem; }
.inbox-thread .attachment-item { position: relative; max-width: 100%; }
.inbox-thread .attachment-item.is-picture { width: 24rem; max-width: 100%; }
.inbox-thread .attachment-picture {
    display: block;
    width: 24rem;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    background: #fff;
}
.inbox-thread .attachment-file { font-weight: 650; }
.inbox-thread .attachment-more {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    z-index: 2;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--navy);
    font-size: 1.15rem;
    line-height: 1;
    letter-spacing: 0;
    opacity: 0;
}
.inbox-thread .is-file .attachment-more {
    position: static;
    width: 1.7rem;
    height: 1.7rem;
    margin-left: 0.35rem;
    vertical-align: middle;
}
.inbox-thread .is-file { display: flex; align-items: center; }
.inbox-thread .attachment-item:hover .attachment-more,
.inbox-thread .attachment-item:focus-within .attachment-more,
.inbox-thread .attachment-item.is-open .attachment-more { opacity: 1; }
.inbox-thread .attachment-more:hover,
.inbox-thread .attachment-more[aria-expanded="true"] { background: var(--blue-bg); }
.inbox-thread .attachment-menu {
    display: none;
    position: absolute;
    z-index: 40;
    top: 2.7rem;
    right: 0.45rem;
    min-width: 9.5rem;
    padding: 0.3rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(30, 58, 76, 0.16);
}
.inbox-thread .is-file .attachment-menu { top: calc(100% + 0.25rem); right: 0; }
.inbox-thread .attachment-item:hover .attachment-menu,
.inbox-thread .attachment-item:focus-within .attachment-menu,
.inbox-thread .attachment-item.is-open .attachment-menu { display: grid; }
.inbox-thread .attachment-menu a,
.inbox-thread .attachment-menu button {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.4rem 0.6rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--navy);
    font: inherit;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.inbox-thread .attachment-menu form { margin: 0; }
.inbox-thread .attachment-menu a:hover,
.inbox-thread .attachment-menu button:hover { background: var(--blue-bg); color: var(--navy); }
.thread-bar .thread-search {
    margin: 0 0 0 auto;
    width: min(22rem, 36%);
    flex: none;
}
.thread-search { max-width: 22rem; margin: 0; flex: none; }
.thread-search label { font-weight: 500; }
.compose { margin-top: 0.75rem; flex: none; display: grid; gap: 0.55rem; }
.compose-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}
.compose-actions { display: flex; gap: 0.5rem; align-items: center; }
.attach-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 0.45rem 0.8rem;
    border-radius: 6px;
    background: var(--card);
    color: var(--navy);
    border: 1px solid var(--line);
    font-weight: 650;
    cursor: pointer;
    overflow: hidden;
}
.attach-button input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    cursor: pointer;
}
.message .meta, .message .subject { margin: 0 0 0.35rem; }
.message .subject { font-weight: 650; }
.message .body { white-space: normal; }
.empty { color: var(--muted); }
.compose textarea { min-height: 3.2rem; resize: vertical; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

@media (max-width: 980px) {
    .board { grid-template-columns: repeat(5, 13.5rem); }
    .board.has-transferred { grid-template-columns: repeat(6, 13.5rem); }
}

@media (max-width: 800px) {
    .chain-layout { grid-template-columns: 1fr; }
    .task-layout { grid-template-columns: 1fr; }
    body:has(.task-page) { height: auto; overflow: auto; }
    body:has(.task-page) main { overflow: visible; }
    .job-chat .thread-window { min-height: 18rem; flex: none; }
    .job-chat-bar { flex-wrap: wrap; }
    .observer-form { margin-left: 0; }
    .chain-main { grid-column: 1; grid-row: 1; }
    .chain-side { grid-column: 1; grid-row: 2; }
    body:has(.inbox) { height: auto; overflow: auto; }
    body:has(.inbox) main { overflow: visible; }
    .inbox { grid-template-columns: 1fr; }
    .inbox-list { max-height: 16rem; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
    .thread-bar { flex-wrap: wrap; }
    .thread-bar .thread-search { width: 100%; margin-left: 0; }
    .thread-window { min-height: 18rem; max-height: 28rem; }
    .who { margin-left: 0; width: 100%; }
    table, thead, tbody, tr, th, td { display: block; }
    thead { display: none; }
    td { border-bottom: 0; padding-bottom: 0.2rem; }
    tr { border-bottom: 1px solid var(--line); padding: 0.4rem 0; }
    .inline { flex-wrap: wrap; }
}
