:root {
    --rail: #121a24;
    --rail-text: #e7eef6;
    --rail-dim: #9aabbd;
    --copper: #1f7a4d;
    --canvas: #e6edf3;
    --panel: #ffffff;
    --ink: #1c2836;
    --muted: #5d6d7e;
    --line: #d5dee6;
    --pine: #1f7a4d;
    --bounce: #9c3a32;
    --sans: "Schibsted Grotesk", "Segoe UI", sans-serif;
    --serif: "Source Serif 4", Georgia, serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
    background: var(--canvas);
    color: var(--ink);
    font-family: var(--sans);
    line-height: 1.45;
}

a { color: inherit; }

h1, h2 {
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1.1;
    margin: 0;
}

h1 { font-size: 22px; font-weight: 600; }
h2 { font-size: 15px; font-weight: 600; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }

.app {
    display: grid;
    grid-template-columns: 212px minmax(0, 1fr);
    min-height: 100vh;
}

.rail {
    background: var(--rail);
    color: var(--rail-text);
    padding: 22px 18px 18px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: block;
    margin-bottom: 22px;
}
.brand img,
.brand .brand-mark,
.door-rail .brand-mark,
.mobile-brand .brand-mark {
    display: block;
    width: min(100%, 178px);
    height: auto;
}

.mobile-bar,
.rail-close,
.nav-scrim {
    display: none;
}

.rail-top {
    display: block;
}

.rail nav { display: flex; flex-direction: column; gap: 2px; }

.rail nav a, .rail-foot a {
    color: var(--rail-dim);
    text-decoration: none;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 6px;
}

.rail nav a:hover, .rail-foot a:hover { color: white; background: rgba(255, 255, 255, 0.06); }

.rail nav a.on, .rail-foot a.on {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.rail nav a.nav-mail {
    position: relative;
}

.nav-badge {
    margin-left: auto;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 6px;
    border-radius: 999px;
    background: #d97706;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.menu-mail-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    margin: 0;
    min-width: 1.05rem;
    height: 1.05rem;
    padding: 0 4px;
    font-size: 10px;
    line-height: 1.05rem;
    pointer-events: none;
}

.nav-ico {
    width: 18px;
    height: 18px;
    flex: none;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.rail-foot { margin-top: auto; padding-top: 18px; }
.rail-foot .who { color: white; padding: 8px 10px 0; font-size: 14px; }
.rail-foot button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: 0;
    color: var(--rail-dim);
    padding: 7px 10px;
    cursor: pointer;
    border-radius: 6px;
}

.rail-foot button:hover { color: white; background: rgba(255, 255, 255, 0.06); }

.canvas { min-width: 0; background: var(--canvas); }

.flash {
    margin: 0;
    padding: 10px 32px;
    background: #d7efe6;
    color: var(--pine);
}

.flash.err, .err { background: #f8e4e1; color: var(--bounce); }

.canvas-pad {
    margin: 12px;
    padding: 18px 20px 28px;
    background: var(--panel);
    border: 1px solid var(--line);
    min-height: calc(100vh - 24px);
}

.head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.head-actions { display: flex; gap: 18px; align-items: center; white-space: nowrap; flex: none; }

.head > a.text { white-space: nowrap; flex: none; }

.quiet { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

.markets { display: flex; gap: 14px; }
.markets a { color: var(--muted); text-decoration: none; }
.markets a.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--copper); }

.pipeline {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin: 16px 0 22px;
    border: 1px solid var(--line);
    background: #f7fafb;
}

.pipeline a {
    text-decoration: none;
    padding: 12px 14px;
    border-right: 1px solid var(--line);
}
.pipeline a:last-child { border-right: 0; }
.pipeline a:hover { background: #fff; }
.pipeline a { border-top: 3px solid #c5d0da; }
.pipeline .not_opened { border-top-color: #245074; }
.pipeline .not_opened strong { color: #245074; }
.pipeline .opened,
.pipeline .sent_answered,
.pipeline .client { border-top-color: #1f7a4d; }
.pipeline .opened strong,
.pipeline .sent_answered strong,
.pipeline .client strong { color: #1f7a4d; }
.pipeline .followup_3 { border-top-color: #8a5a12; }
.pipeline .followup_3 strong { color: #8a5a12; }
.pipeline strong {
    display: block;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
}
.pipeline span { color: var(--muted); font-size: 13px; }

.overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    margin: 0 0 22px;
}

.chart-card {
    background: #fff;
    border: 1px solid var(--line);
    padding: 14px 16px 8px;
    min-width: 0;
}

.chart-card h2 { margin: 0; }

.day-head,
.day-list li {
    display: grid;
    grid-template-columns: 3.2rem repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: center;
}

.day-head {
    margin-top: 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.day-head .sent { color: #1f7a4d; }
.day-head .opened { color: #245074; }
.day-head .replies { color: #8a5a12; }
.day-head .bounces { color: #9c3a32; }

.day-list { list-style: none; margin: 0; padding: 0; }

.day-list li {
    padding: 6px 0;
    border-top: 1px solid var(--line);
}

.day-date {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-size: 13px;
}

.day-list .is-today .day-date { color: var(--ink); font-weight: 600; }

.day-metric {
    display: grid;
    grid-template-columns: 2.8rem 2.8rem minmax(0, 1fr);
    column-gap: 10px;
    align-items: center;
}

.day-metric.sent {
    grid-template-columns: calc(2.8rem + 10px + 2.8rem) minmax(0, 1fr);
}

.day-metric strong,
.day-metric em { white-space: nowrap; }

.day-metric em {
    font-style: normal;
    font-weight: 500;
    font-size: 11px;
    color: var(--muted);
}

.day-metric strong {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 15px;
}

.day-metric.sent strong { color: #1f7a4d; }
.day-metric.opened strong { color: #245074; }
.day-metric.replies strong { color: #8a5a12; }
.day-metric.bounces strong { color: #9c3a32; }
.day-metric .track { height: 8px; background: #eef2f5; }
.day-metric.sent .fill { display: block; height: 100%; background: #1f7a4d; }
.day-metric.opened .fill { display: block; height: 100%; background: #245074; }
.day-metric.replies .fill { display: block; height: 100%; background: #8a5a12; }
.day-metric.bounces .fill { display: block; height: 100%; background: #9c3a32; }
.day-list .is-quiet { opacity: 0.38; }

.bars { list-style: none; margin: 12px 0 4px; padding: 0; }

.bars a {
    display: grid;
    grid-template-columns: 6.6rem 4.8rem minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding: 7px 0;
    text-decoration: none;
    color: var(--ink);
    font-size: 13px;
}

.bars strong {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    text-align: right;
}

.bars .track { height: 8px; background: #eef2f5; }
.bars .fill { display: block; height: 100%; background: #8aa0b3; }
.bars .sent .fill { background: #1f7a4d; }
.bars .not_opened .fill { background: #245074; }
.bars .opened .fill,
.bars .sent_answered .fill,
.bars .client .fill { background: #1f7a4d; }
.bars .followup_3 .fill { background: #8a5a12; }
.bars a:hover .track { background: #e4ebf0; }

.board-kicker { margin: 18px 0 8px; }
.board-note { margin: 8px 0 0; }

.walk {
    position: relative;
    height: 88px;
    margin: 18px 0 0;
    overflow: hidden;
    border-top: 1px solid var(--line);
}

.walk::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 14px;
    height: 1px;
    background: var(--line);
}

.walk-strip {
    position: absolute;
    left: 0;
    bottom: 15px;
    display: flex;
    width: max-content;
    animation: scenery-scroll 48s linear infinite;
}

.walk-strip .city rect { fill: #d5dee6; }
.walk-strip .city rect:nth-child(3n) { fill: #c5d0da; }

.walker {
    position: absolute;
    left: 22px;
    bottom: 14px;
    width: 36px;
    height: 58px;
    z-index: 1;
}

.walker svg {
    display: block;
    overflow: visible;
}

.walker .head,
.walker .torso,
.walker .arm line,
.walker .leg line {
    fill: none;
    stroke: var(--ink);
    stroke-width: 1.7;
    stroke-linecap: round;
}

.walker .letter {
    fill: var(--pine);
    stroke: none;
}

.walker .arm,
.walker .leg {
    transform-box: fill-box;
    transform-origin: 50% 0;
}

.walker .arm.a,
.walker .leg.b { animation: step 0.9s ease-in-out infinite; }

.walker .arm.b,
.walker .leg.a { animation: step 0.9s ease-in-out infinite; animation-delay: -0.45s; }

@keyframes scenery-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

@keyframes step {
    0%, 100% { transform: rotate(16deg); }
    50% { transform: rotate(-16deg); }
}

.stroll {
    max-width: 42em;
    margin: 12px 0 4px;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
    .walk-strip,
    .walker .arm,
    .walker .leg { animation: none; }
}

.stroll strong {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.figures {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
    border: 1px solid var(--line);
    background: #fff;
}

.figures.letters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.figures.firms { grid-template-columns: repeat(7, minmax(0, 1fr)); margin-bottom: 22px; }
.figures.firms li { padding: 12px 8px; }
.figures.firms strong { font-size: 18px; }

.figures a {
    display: block;
    color: inherit;
    text-decoration: none;
}

.figures a:hover strong { text-decoration: underline; text-underline-offset: 3px; }

.figures li {
    padding: 14px 16px;
    border-right: 1px solid var(--line);
    border-top: 3px solid var(--line);
}

.figures .sent { border-top-color: #1f7a4d; }
.figures .sent strong { color: #1f7a4d; }
.figures .opened { border-top-color: #245074; }
.figures .opened strong { color: #245074; }
.figures .replies { border-top-color: #1b6b4a; }
.figures .replies strong { color: #1b6b4a; }
.figures .bounce { border-top-color: #9c3a32; }
.figures .bounce strong { color: #9c3a32; }
.figures .total { border-top-color: #1c2836; }
.figures .quota { border-top-color: #1f7a4d; }
.figures .quota strong { color: #1f7a4d; }
.figures .not_opened { border-top-color: #245074; }
.figures .not_opened strong { color: #245074; }
.figures .sent_answered,
.figures .client { border-top-color: #1f7a4d; }
.figures .sent_answered strong,
.figures .client strong { color: #1f7a4d; }

.figures li:last-child { border-right: 0; }

.figures strong {
    display: block;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.figures span { color: var(--muted); font-size: 13px; white-space: nowrap; }

#ledger-main[aria-busy="true"] { opacity: 0.45; }

.running { margin: 8px 0 22px; max-width: 760px; }
.running h2 { margin-bottom: 4px; }

.desk {
    margin: 18px 0 8px;
    max-width: 760px;
}

.deal-summary {
    margin: 0 0 22px;
}

.deal-summary .section-head { margin-bottom: 10px; }

.deals-figures {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    margin: 0 0 8px;
}

.deals-figures li { padding: 12px 8px; }
.deals-figures strong { font-size: 18px; }
.deals-figures .deal-needs_proposal { border-top-color: #1f7a4d; }
.deals-figures .deal-needs_proposal strong { color: #1f7a4d; }
.deals-figures .deal-interested { border-top-color: #245074; }
.deals-figures .deal-interested strong { color: #245074; }
.deals-figures .deal-proposal_sent { border-top-color: #1f7a4d; }
.deals-figures .deal-proposal_sent strong { color: #1f7a4d; }
.deals-figures .deal-refused { border-top-color: #9c3a32; }
.deals-figures .deal-refused strong { color: #9c3a32; }
.deals-figures .deal-later { border-top-color: #8a5a12; }
.deals-figures .deal-later strong { color: #8a5a12; }
.deals-figures .deal-unclear { border-top-color: #5d6d7e; }
.deals-figures .deal-unclear strong { color: #5d6d7e; }
.deals-figures .deal-client { border-top-color: #1f7a4d; }
.deals-figures .deal-client strong { color: #1f7a4d; }

.deals {
    margin: 0 0 22px;
    max-width: none;
}

.deals-page .head { margin-bottom: 14px; }

.deals-head-actions {
    flex-wrap: wrap;
    gap: 12px 16px;
}

.deals-filter select {
    min-width: 11rem;
    max-width: 16rem;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font: inherit;
}

.deal-manual { font-style: italic; }

.deal-add {
    width: min(420px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    box-shadow: 0 18px 48px rgba(18, 26, 36, 0.22);
}

.deal-add::backdrop {
    background: rgba(18, 26, 36, 0.35);
}

.deal-add-form {
    display: grid;
    gap: 12px;
    padding: 16px 18px 18px;
}

.deal-add-form header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.deal-add-search {
    display: grid;
    gap: 6px;
    margin: 0;
}

.deal-add-search span {
    font-size: 13px;
    color: var(--muted);
}

.deal-add-search input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line);
    font: inherit;
}

.deal-add-hint { margin: 0; }

.deal-add-results {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--line);
}

.deal-add-results li + li { border-top: 1px solid var(--line); }

.deal-add-pick {
    display: grid;
    gap: 2px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    background: #fff;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.deal-add-pick:hover,
.deal-add-pick:focus-visible {
    background: #f3f7f5;
}

.deal-add-pick strong {
    font-size: 14px;
    font-weight: 650;
}

.deal-add-pick span {
    color: var(--muted);
    font-size: 12px;
}

.deals .section-head {
    margin-bottom: 10px;
    justify-content: space-between;
}

.deals .section-head .quiet { margin: 4px 0 0; }

.deal-board {
    display: grid;
    grid-template-columns: repeat(7, minmax(11.5rem, 1fr));
    gap: 0;
    overflow-x: auto;
    border: 1px solid var(--line);
    background: #fff;
}

.deal-col {
    min-width: 11.5rem;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    min-height: 280px;
    max-height: 520px;
}

.deal-col:last-child { border-right: 0; }

.deal-needs_proposal { --deal: #1f7a4d; }
.deal-interested { --deal: #245074; }
.deal-proposal_sent { --deal: #1f7a4d; }
.deal-refused { --deal: #9c3a32; }
.deal-later { --deal: #8a5a12; }
.deal-unclear { --deal: #5d6d7e; }
.deal-client { --deal: #1f7a4d; }

.deal-col-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px 8px;
    border-bottom: 1px solid var(--line);
    border-top: 3px solid var(--deal, var(--line));
}

.deal-col-head h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.deal-col-count {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.deal-col-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.deal-col.is-over .deal-col-body {
    background: rgba(31, 122, 77, 0.06);
    outline: 1px dashed var(--pine);
    outline-offset: -4px;
}

.deal-card {
    padding: 8px 10px;
    border: 1px solid var(--line);
    background: #f7fafc;
    cursor: grab;
}

.deal-card:active { cursor: grabbing; }

.deal-card.is-dragging {
    opacity: 0.45;
}

.deal-card a {
    display: block;
    font-weight: 650;
    font-size: 13px;
    text-decoration: none;
    line-height: 1.25;
}

.deal-card a:hover { color: var(--copper); }

.deal-campaign {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
}

.deal-note {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.deal-col-empty {
    margin: 8px 4px;
    color: var(--muted);
    font-size: 12px;
}

.section-head {
    display: flex;
    align-items: baseline;
    gap: 18px;
    margin-bottom: 4px;
}

.section-head h2 { margin: 0; }
.section-head a { color: var(--muted); font-size: 14px; text-decoration: none; }
.section-head a:hover { color: var(--copper); }

.desk h2 { margin-bottom: 12px; }

.work-list, .reply-list { list-style: none; margin: 0; padding: 0; }

.work-list li, .reply-list li {
    border-top: 1px solid var(--line);
    padding: 12px 0;
}

.work-list a, .reply-list a { text-decoration: none; }
.work-list a:hover, .reply-list a:hover { color: var(--copper); }

.reply-list .excerpt {
    font-family: var(--serif);
    font-size: 17px;
    line-height: 1.45;
    margin: 4px 0 0;
    max-width: 62ch;
}

.meta { color: var(--muted); font-size: 13px; }

.ledger-list {
    min-width: 0;
    padding: 0 0 56px;
}

.page-size {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.page-size select {
    width: auto;
    min-width: 4.5rem;
    min-height: 32px;
    padding: 4px 8px;
    border: 1px solid var(--line);
    background: #fff;
}

.firm-search {
    margin: 0 0 16px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
}

.firm-search input {
    font-size: 18px;
    font-weight: 400;
    padding: 8px 0 10px;
    border-bottom-width: 2px;
}

.split {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.split > * { min-width: 0; }

.mailbox {
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 0;
    align-items: stretch;
    height: calc(100vh - 148px);
    min-height: 460px;
    border: 1px solid var(--line);
    background: #fff;
}

.mail-list {
    min-height: 0;
    overflow: auto;
    border-right: 1px solid var(--line);
}

.mailbox > article {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    max-width: none;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.mailbox-head { align-items: center; }
.mailbox-head-actions {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 14px;
    flex-wrap: wrap;
}
.mailbox-head form { text-align: right; }
.mailbox-head .quiet { margin: 6px 0 0; font-size: 13px; }

.letter-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex: none;
    margin: 0;
    padding: 16px 28px 14px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.letter-body {
    min-height: 0;
    overflow: auto;
    padding: 18px 28px 32px;
}

.letter-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: none;
}

.letter-id {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}

.letter-id strong { font-size: 16px; font-weight: 600; line-height: 1.3; }

.letter-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.3;
}

.letter-meta a { color: var(--pine); text-decoration: none; }
.letter-meta a:hover { text-decoration: underline; text-underline-offset: 3px; }

.letter-head time {
    flex: none;
    color: var(--muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.letter-title {
    font-family: var(--sans);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.25;
    max-width: 36em;
    margin: 0 0 18px;
}

.mail-list a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 78px;
    align-items: start;
    column-gap: 10px;
    row-gap: 4px;
    min-height: 64px;
    min-width: 0;
    text-decoration: none;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}

.mail-list a.on { background: #eef6f1; }

.mail-list a.is-unread .who,
.mail-list a.is-unread .subject {
    font-weight: 700;
    color: var(--ink, #1a1a1a);
}

.mail-list a.is-unread .who::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: #d97706;
    vertical-align: middle;
}

.mail-list .who {
    grid-column: 1;
    grid-row: 1;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-list time {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mail-list .subject {
    grid-column: 1 / -1;
    grid-row: 2;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thread-letter {
    border-top: 1px solid var(--line);
    padding: 16px 0;
}

.thread-who {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin: 0 0 8px;
    font-weight: 600;
}

.thread-who time {
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    flex: none;
}

.quote { margin-top: 14px; }
.quote summary {
    cursor: pointer;
    color: var(--copper);
    font-family: var(--sans);
    font-size: 14px;
}
.quote .letter { color: var(--muted); font-size: 16px; margin-top: 10px; }

.reply-open { margin: 22px 0 0; }

dialog.compose {
    width: min(1080px, calc(100vw - 64px));
    height: min(860px, calc(100vh - 40px));
    max-width: calc(100vw - 64px);
    max-height: calc(100vh - 40px);
    padding: 0;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    box-shadow: 0 28px 80px rgba(18, 26, 36, 0.28);
}

dialog.compose[open] {
    display: flex;
    flex-direction: column;
}

dialog.compose::backdrop { background: rgba(18, 26, 36, 0.55); }

dialog.compose form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
}

dialog.compose header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex: none;
    padding: 16px 22px;
    border-bottom: 1px solid var(--line);
}

dialog.compose header span {
    color: var(--muted);
    font-size: 14px;
    margin-right: auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

dialog.compose textarea {
    flex: 1;
    min-height: 0;
    margin: 18px 22px;
    width: auto;
    font-size: 16px;
    line-height: 1.5;
}

dialog.compose .err { margin: 0 22px; }

dialog.compose .go { margin: 0 22px 18px; align-self: flex-start; min-width: 148px; }

.filters {
    display: flex;
    flex-direction: column;
    gap: 18px;
    border-right: 1px solid var(--line);
    padding-right: 16px;
    min-width: 0;
}

.filters > label { gap: 6px; }

.filters input, .filters select { min-width: 0; max-width: 100%; }

.emtak {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 2px 0 0;
    padding: 16px 0 2px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.emtak legend {
    padding: 0;
    margin: 0 0 2px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--ink);
}

.emtak { gap: 8px; }

.emtak-chosen {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 14px;
    min-height: 1.35em;
}

.emtak-all {
    color: var(--muted);
    font-size: 13px;
}

.emtak-chip,
.emtak-clear {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    font-size: 13px;
    line-height: 1.3;
    cursor: pointer;
}

.emtak-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    max-width: 100%;
    color: var(--ink);
    border-bottom: 1px solid var(--pine);
}

.emtak-chip span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.emtak-chip span:last-child,
.emtak-clear { color: var(--muted); }
.emtak-chip:hover span:last-child,
.emtak-clear:hover { color: var(--ink); }

.emtak-book {
    max-height: 248px;
    overflow: auto;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    scrollbar-color: var(--line) transparent;
}

.emtak-book .emtak-row.is-on {
    box-shadow: inset 2px 0 0 var(--pine);
}

.emtak-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 36px;
    padding: 8px 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.emtak-toggle span {
    min-width: 0;
    white-space: normal;
}

.emtak-toggle::after {
    content: "";
    flex: none;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid var(--muted);
    border-bottom: 1.5px solid var(--muted);
    transform: rotate(45deg) translateY(-2px);
}

.emtak-toggle[aria-expanded="true"]::after {
    transform: rotate(-135deg) translateY(-2px);
}

.emtak-panel {
    max-height: 320px;
    overflow-x: hidden;
    overflow-y: auto;
    margin-top: 8px;
    border: 1px solid var(--line);
    background: #fff;
}

.emtak-panel[hidden] { display: none; }

.emtak-find {
    gap: 4px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
}

.emtak-find input {
    min-height: 30px;
    padding: 2px 0 4px;
    font-size: 14px;
    font-weight: 400;
    color: var(--ink);
}

.emtak-empty {
    margin: 0;
    padding: 10px;
    color: var(--muted);
    font-size: 13px;
}

.emtak-node,
.emtak-children,
.emtak-line { min-width: 0; }

.emtak-line { display: flex; align-items: stretch; }

.emtak-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
}

.emtak-row:hover { background: #f7fafb; }
.emtak-row.is-on { background: #eef6f1; }

.emtak-letter {
    flex: none;
    width: 1.1em;
    font-weight: 600;
    color: var(--pine);
}

.emtak-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.emtak-count {
    flex: none;
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.emtak-fold {
    flex: none;
    width: 28px;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.emtak-fold::before {
    content: "";
    display: block;
    width: 6px;
    height: 6px;
    margin: 0 auto;
    border-right: 1.5px solid var(--muted);
    border-bottom: 1.5px solid var(--muted);
    transform: rotate(-45deg);
}

.emtak-node.is-open > .emtak-line > .emtak-fold::before { transform: rotate(45deg); }

.emtak-children { display: none; }
.emtak-node.is-open > .emtak-children { display: block; }
.emtak-children .emtak-row { padding-left: 28px; }
.emtak-children .emtak-children .emtak-row { padding-left: 40px; }

.emtak-block { margin-top: 28px; }
.emtak-block h2 { margin-bottom: 8px; }
.emtak-block .emtak-panel { max-height: 420px; margin-top: 12px; }

.block-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.block-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}

.block-empty { color: var(--muted); }

label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--muted);
}

input, select, textarea {
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    padding: 8px 0;
    width: 100%;
    min-height: 36px;
}

input:focus, select:focus, textarea:focus { border-bottom-color: var(--ink); }

textarea {
    border: 1px solid var(--line);
    padding: 12px;
    min-height: 280px;
}

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.stages { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 0 0 12px; }
.stages a { color: var(--muted); text-decoration: none; font-size: 14px; }
.stages a.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--copper); }

.sendbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 20px;
    align-items: end;
    padding: 4px 0 18px;
    margin-bottom: 8px;
}

.sendbar label { min-width: 220px; flex: 1; }
.sendbar .actions { display: flex; gap: 14px; align-items: center; padding-bottom: 4px; }

.book {
    width: 100%;
    border-collapse: collapse;
}

.ledger-list {
    min-width: 0;
    overflow-x: auto;
    padding-left: 16px;
}

#ledger.split {
    gap: 28px;
}

.ledger-book { table-layout: fixed; min-width: 920px; }

.col-account { width: auto; }
.col-stage { width: 108px; }
.col-sent,
.col-opened { width: 118px; }
.col-mark { width: 156px; }
.col-list { width: 164px; }

.ledger-book td.mark,
.ledger-book td.list {
    overflow: hidden;
    white-space: nowrap;
}

.drop {
    border: 0;
    background: none;
    padding: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.drop:hover { color: var(--bounce); }

.choice {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    border: 0;
    background: none;
}

.choice button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    min-height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.choice button::before {
    content: "";
    width: 15px;
    height: 15px;
    flex: none;
    border: 1.5px solid #b7c4ce;
    border-radius: 50%;
    background: var(--panel);
}

.choice button:hover { color: var(--ink); }
.choice button:hover::before { border-color: var(--ink); }

.choice button.is-on {
    color: var(--ink);
    background: none;
    box-shadow: none;
}

.choice button.is-on::before {
    border-color: var(--pine);
    background: radial-gradient(circle at center, var(--pine) 42%, var(--panel) 46%);
}

.choice button:focus-visible {
    outline: 2px solid var(--pine);
    outline-offset: -2px;
}

.book th {
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    padding: 8px 12px 8px 0;
    white-space: nowrap;
    vertical-align: bottom;
}

.book td {
    border-bottom: 1px solid var(--line);
    padding: 10px 12px 10px 0;
    vertical-align: middle;
}

.ledger-book th,
.ledger-book td {
    padding: 8px 8px;
}

.ledger-book td:first-child,
.ledger-book th:first-child { padding-left: 0; }

.ledger-book td { overflow: hidden; }

.book tbody tr:hover td { background: #f7fafb; }
.book a { text-decoration: none; }
.book a:hover { text-decoration: underline; text-underline-offset: 3px; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.stage {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    background: #eef2f5;
    color: var(--ink);
}
.stage.replied, .stage.opened { background: #e5f4ec; color: var(--pine); }
.stage.sent { background: #e8eef4; color: #245074; }
.stage.client { background: #e5f4ec; color: var(--pine); }
.stage.suppressed, .skip { background: #f8e4e1; color: var(--bounce); }

.filters-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

.filters-foot {
    margin-top: 4px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.filters-clear.go {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    min-height: 44px;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 600;
    box-sizing: border-box;
    text-align: center;
}

.ledger-modes {
    flex-wrap: wrap;
    overflow: visible;
    gap: 8px;
    margin: 0 0 14px;
    padding-bottom: 0;
}
.ledger-modes a {
    flex: none;
    padding: 6px 10px;
    border: 1px solid var(--line);
    color: var(--muted);
}
.ledger-modes a.on {
    color: var(--ink);
    background: #eef6f1;
    border-color: var(--copper);
    box-shadow: none;
}

.campaign-launch {
    margin: 6px 0 22px;
    padding: 14px 0 16px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: transparent;
}

.campaign-launch-form {
    display: grid;
    gap: 8px;
    margin: 0;
}

.campaign-launch-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    align-items: end;
}

.campaign-launch-name {
    flex: 1 1 16rem;
    margin: 0;
    max-width: none;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.campaign-launch-name input[type="text"] {
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: #fff;
    font-size: 16px;
    font-weight: 550;
    color: var(--ink);
}

.campaign-launch-name input[type="text"]:focus {
    border-color: var(--pine);
    outline: 2px solid rgba(31, 122, 77, 0.16);
    outline-offset: 1px;
}

.campaign-launch-row .go {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 18px;
    font-size: 15px;
    white-space: nowrap;
}

.campaign-launch-note {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

.campaign-launch-note a {
    color: var(--pine);
    font-weight: 600;
    text-decoration: none;
}

.campaign-launch-note a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ledger-send,
.campaign-start {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 18px 24px;
    margin-bottom: 22px;
}

.ledger-send label,
.campaign-start label {
    flex: 1 1 14rem;
    max-width: 18rem;
    min-width: 0;
}

.campaign-start {
    max-width: 46rem;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.campaign-start .go { margin-bottom: 1px; }

.lists-block {
    margin-top: 36px;
    max-width: 52rem;
}

.lists-block h2 { margin-bottom: 4px; }
.lists-block .quiet { margin: 0 0 8px; }

.list-line,
.list-head {
    display: grid;
    grid-template-columns: minmax(10rem, 16rem) minmax(9rem, 14rem) 5rem auto;
    gap: 8px 20px;
    align-items: baseline;
    max-width: 52rem;
}

.list-head {
    padding: 8px 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    border-bottom: 1px solid var(--line);
}

.list-line {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.list-line a { text-decoration: none; }
.list-line a:hover { text-decoration: underline; text-underline-offset: 3px; }

.list-line .num { text-align: right; }

.list-name input {
    margin: 0;
    min-height: 32px;
    padding: 4px 0;
}

.member-search {
    display: grid;
    grid-template-columns: minmax(0, 320px) auto;
    gap: 16px;
    align-items: end;
    margin: 8px 0 16px;
}

.member-search .actions,
.lists .list-actions { padding-bottom: 6px; }

.lists .list-actions,
.book .list-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.list-line .list-actions {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    align-items: baseline;
}

.book .list-actions form { display: inline; margin-left: 16px; }

section:has(table.campaigns) {
    overflow-x: auto;
}

.campaigns {
    table-layout: fixed;
    min-width: 1140px;
}

.campaign-row.is-live [data-label] {
    color: var(--pine);
    font-weight: 600;
}

.campaign-row.is-live [data-sent] {
    font-variant-numeric: tabular-nums;
}

.campaigns .col-name { width: auto; }
.campaigns .col-country { width: 4.25rem; }
.campaigns .col-template { width: 16rem; }
.campaigns .col-status { width: 7.5rem; }
.campaigns .col-sent { width: 8.5rem; }
.campaigns .col-skip { width: 3.75rem; }
.campaigns .col-who { width: 6.25rem; }
.campaigns .col-act { width: 11.5rem; }

.campaign-template-form {
    margin: 0;
    max-width: none;
    width: 100%;
}

.campaign-template-form select {
    width: 100%;
    max-width: 100%;
    min-height: 34px;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: #fff;
    font-size: 13px;
    font-weight: 550;
    color: var(--ink);
    text-overflow: ellipsis;
}

.campaign-template-form select.is-missing {
    border-color: #d4a35c;
    background: #fff8ee;
    color: #7a4e12;
}

.campaign-template-form select:focus {
    border-color: var(--pine);
    outline: 2px solid rgba(31, 122, 77, 0.16);
    outline-offset: 1px;
}

.campaign-template .template-missing {
    display: block;
    color: #9c3a32;
    font-size: 13px;
    font-weight: 600;
}

.campaign-template .template-set {
    display: block;
    font-size: 13px;
    font-weight: 550;
}

.campaign-template .text {
    display: inline-block;
    margin-top: 4px;
    font-size: 13px;
}

.campaigns .campaign-name .audience-line {
    display: block;
    margin-top: 4px;
    line-height: 1.35;
    color: var(--ink);
    font-size: 13px;
}

.campaigns th:last-child,
.campaigns .campaign-send {
    padding-right: 8px;
}

.campaigns .campaign-send {
    text-align: right;
    vertical-align: middle;
    overflow: visible;
    white-space: nowrap;
}

.campaign-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px 8px;
}

.campaign-actions-main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.campaign-actions-main form,
.campaign-actions-remove {
    display: inline-flex;
    margin: 0;
    flex: 0 0 auto;
}

.campaign-actions-remove {
    margin-left: 0;
}

.campaign-actions .go {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    font-size: 13px;
}

.campaign-actions .text {
    font-size: 13px;
    font-weight: 600;
}

.campaign-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
}

.campaign-x:hover {
    color: var(--bounce);
    background: #f8e4e1;
}

.setup-page {
    max-width: 52rem;
}

.setup-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px 24px;
    margin: 0 0 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.setup-crumb {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 13px;
}

.setup-crumb a {
    color: var(--pine);
    font-weight: 600;
    text-decoration: none;
}

.setup-crumb a:hover { text-decoration: underline; text-underline-offset: 3px; }

.setup-hero h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: -0.04em;
    max-width: 28rem;
}

.setup-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.setup-meta a {
    color: var(--pine);
    font-weight: 600;
    text-decoration: none;
}

.setup-meta a:hover { text-decoration: underline; text-underline-offset: 3px; }

.setup-badge {
    margin: 4px 0 0;
    padding: 7px 12px;
    border: 1px solid var(--line);
    background: #f4f7f9;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.setup-badge.is-ready {
    border-color: #9fbfab;
    background: #eef6f1;
    color: var(--pine);
}

.setup-badge.is-warn {
    border-color: #e2c08a;
    background: #fff7ea;
    color: #7a4e12;
}

.setup-panel {
    display: grid;
    gap: 16px;
    margin: 0 0 18px;
    padding: 0 0 18px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
}

.setup-fields {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 14px 24px;
}

.setup-fields label {
    max-width: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.setup-fields input,
.setup-fields select {
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-size: 16px;
    font-weight: 550;
}

.setup-audience {
    margin: 0;
    padding: 0;
    border: 0;
}

.setup-audience legend {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.setup-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.setup-option {
    display: grid;
    grid-template-columns: 1rem 1fr;
    gap: 10px;
    align-items: start;
    margin: 0;
    padding: 14px 14px 13px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    cursor: pointer;
}

.setup-option input {
    width: 1rem;
    min-height: 1rem;
    margin-top: 3px;
    accent-color: var(--pine);
}

.setup-option-body {
    display: grid;
    gap: 3px;
}

.setup-option-body strong {
    font-size: 14px;
    font-weight: 650;
}

.setup-option-body span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.setup-option.is-on,
.setup-option:has(input:checked) {
    border-color: var(--pine);
    background: #f3f8f5;
    box-shadow: inset 3px 0 0 var(--pine);
}

.setup-panel-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
}

.text-btn {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.text-btn:hover { border-color: var(--ink); }

.setup-save-hint {
    margin: 4px 0 0;
}

.setup-schedule {
    margin: 0;
    padding: 0;
    border: 0;
    display: grid;
    gap: 14px;
}

.setup-schedule legend {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.setup-switch {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px 14px;
    align-items: start;
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
}

.setup-switch input {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.setup-switch-ui {
    position: relative;
    width: 42px;
    height: 24px;
    margin-top: 2px;
    border-radius: 999px;
    background: #cfd6dc;
    transition: background 0.15s ease;
}

.setup-switch-ui::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(20, 40, 50, 0.18);
    transition: transform 0.15s ease;
}

.setup-switch:has(input:checked),
.setup-schedule.is-on .setup-switch {
    border-color: var(--pine);
    background: #f3f8f5;
}

.setup-switch:has(input:checked) .setup-switch-ui,
.setup-schedule.is-on .setup-switch-ui {
    background: var(--pine);
}

.setup-switch:has(input:checked) .setup-switch-ui::after,
.setup-schedule.is-on .setup-switch-ui::after {
    transform: translateX(18px);
}

.setup-switch-copy {
    display: grid;
    gap: 3px;
}

.setup-switch-copy strong {
    font-size: 14px;
    font-weight: 650;
    color: var(--ink);
}

.setup-switch-copy span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.setup-schedule-fields {
    display: none;
    gap: 14px;
    padding: 2px 2px 0 56px;
}

.setup-schedule:has(input[name="schedule_enabled"]:checked) .setup-schedule-fields,
.setup-schedule.is-on .setup-schedule-fields {
    display: grid;
}

.campaign-clock {
    display: grid;
    gap: 14px;
    justify-items: start;
}

.plan-block {
    display: grid;
    gap: 8px;
}

.plan-label {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.plan-off {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.plan-off .danger {
    color: var(--muted);
    font-size: 13px;
    font-weight: 550;
}

.plan-off .danger:hover { color: var(--bounce); }

@media (max-width: 640px) {
    .setup-schedule-fields { padding-left: 0; }
}

@media (max-width: 900px) {
    .setup-options,
    .setup-fields { grid-template-columns: 1fr; }
}

.confirm-sheet {
    display: grid;
    gap: 14px 28px;
    max-width: 40rem;
    margin: 0 0 28px;
    padding: 0;
}

.confirm-sheet > div {
    display: grid;
    grid-template-columns: minmax(10rem, 14rem) 1fr;
    gap: 8px 16px;
    align-items: baseline;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.confirm-sheet dt {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.confirm-sheet dd {
    margin: 0;
    font-weight: 550;
}
.campaigns th,
.campaigns td {
    vertical-align: middle;
}

.campaigns th.num,
.campaigns td.num {
    text-align: left;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.campaigns .campaign-name {
    min-width: 0;
    overflow: hidden;
}

.campaigns .campaign-name > a {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.campaigns tr.campaign-row td {
    border-bottom-color: transparent;
    padding-bottom: 4px;
}

.campaigns tr.campaign-plan td {
    padding-top: 0;
    padding-bottom: 14px;
}

.day-picks {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.day-pick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
    user-select: none;
}

.day-pick input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.day-pick:has(input:checked) {
    color: #fff;
    border-color: var(--pine);
    background: var(--pine);
}

.day-pick:hover { border-color: var(--ink); color: var(--ink); }
.day-pick:has(input:checked):hover { color: #fff; border-color: var(--pine); }

.clock-time {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.clock-time .clock-24 {
    display: inline-flex;
    margin: 0;
    color: var(--ink);
}

.clock-time .clock-24 select {
    width: 4rem;
    min-height: 36px;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: #fff;
    font-variant-numeric: tabular-nums;
    font-size: 15px;
    font-weight: 600;
}

.clock-time .clock-sep {
    color: var(--ink);
    font-size: 18px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.next-slot {
    color: var(--muted);
    font-size: 13px;
}

.sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.campaign-clock .next-slot {
    color: var(--muted);
    font-size: 12px;
    align-self: center;
}

.campaigns tr.is-open td,
.campaigns tr.is-open + tr.campaign-plan td { border-bottom-color: transparent; }

.campaigns tr.campaign-plan + tr.campaign-open td { border-top: 0; }

.book tbody tr.campaign-open:hover td { background: transparent; }

.campaign-open td {
    padding-top: 0;
    padding-bottom: 22px;
}

.campaign-open .quiet { margin: 0 0 12px; }

.campaign-recipients-search {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    margin: 0 0 10px;
}

.campaign-recipients-search input[type="search"] {
    flex: 1 1 16rem;
    min-width: 0;
    max-width: 28rem;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: #fff;
    font-size: 14px;
}

.campaign-recipients-search input[type="search"]:focus {
    border-color: var(--pine);
    outline: 2px solid rgba(31, 122, 77, 0.16);
    outline-offset: 1px;
}

.campaign-recipient-act {
    text-align: right;
    white-space: nowrap;
}

.campaign-recipient-act form {
    display: inline;
    margin: 0;
}

.campaign-open .book { margin-top: 4px; }

.ledger-send label { min-width: 0; }

.ledger-send .actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 6px;
}

.book .account-name,
.book .addr,
.book .place {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book .account-name {
    font-weight: 600;
    line-height: 1.3;
}

.book .account-code,
.book .source {
    display: block;
    margin-top: 1px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.3;
    text-align: left;
}

.book .account-code { font-variant-numeric: tabular-nums; }

.book .when {
    display: block;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

button.text, .text {
    background: none;
    border: 0;
    padding: 0;
    color: var(--copper);
    text-decoration: none;
    cursor: pointer;
}

button.text:hover, .text:hover { text-decoration: underline; text-underline-offset: 3px; }

.go {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    background: var(--copper);
    color: white;
    border: 0;
    padding: 8px 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.go:hover { filter: brightness(1.08); }

.go.go-soft,
a.go.go-soft,
button.go.go-soft {
    background: #fff;
    color: var(--pine);
    border: 1.5px solid var(--pine);
    filter: none;
}

.go.go-soft:hover,
a.go.go-soft:hover,
button.go.go-soft:hover {
    background: #eef6f1;
    filter: none;
}

.account {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.facts { padding: 0; }
.facts p { margin: 0 0 10px; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0 0 10px; }
.facts dd .meta { display: block; }

.timeline { list-style: none; margin: 0; padding: 0; max-width: 640px; }
.timeline li { border-top: 1px solid var(--line); padding: 10px 0; }
.timeline .letter {
    margin: 6px 0 0;
    max-height: 160px;
    overflow: auto;
    font-size: 13px;
    line-height: 1.4;
}
.letter {
    font-family: var(--serif);
    font-size: 17px;
    line-height: 1.55;
    max-width: 62ch;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin: 0;
}

.letter-body > .letter {
    margin-top: 4px;
}

.quote-body {
    border-left: 2px solid var(--line);
    padding-left: 12px;
}

.bench-line {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: end;
    margin-bottom: 16px;
}

.bench-line label { min-width: 9rem; flex: 1; }

section.compose:not(.compose-letter),
div.compose:not(.compose-letter) {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
    gap: 22px;
    align-items: start;
    margin: 0 0 28px;
    padding: 18px;
    border: 1px solid var(--line);
    background: #fafcfd;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    box-shadow: none;
}

#ledger-results.is-loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.12s ease;
}

.compose-empty {
    margin: 0 0 24px;
    padding: 18px;
    border: 1px solid var(--line);
    background: #fafcfd;
}

.compose-empty .go { margin-top: 12px; display: inline-flex; }

.compose-form { min-width: 0; }

.compose-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.compose-letter { background: transparent; border: 0; padding: 0; }

.compose-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
}

.compose-side { min-width: 0; display: grid; gap: 16px; }

.compose-preview {
    border: 1px solid var(--line);
    background: #fff;
    padding: 14px 16px 18px;
}

.compose-preview h2 {
    margin: 4px 0 12px;
    font-size: 18px;
    letter-spacing: -0.03em;
}

.compose-preview .letter { max-width: none; }

/* —— Letter template desk —— */
.letter-desk {
    max-width: 920px;
    margin: 0 auto 36px;
    display: grid;
    gap: 18px;
}

.letter-desk-form {
    display: grid;
    gap: 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px 22px 22px;
}

.letter-desk-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 18px;
}

.letter-desk-titles {
    display: grid;
    gap: 6px;
}

.letter-desk-titles h1 {
    margin: 0;
    font-size: 24px;
}

.letter-desk-head-act {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.letter-desk-fields {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 12px 14px;
}

.letter-desk-fields label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.letter-desk-fields input {
    width: 100%;
    color: var(--ink);
    font-weight: 500;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
}

.letter-desk-fields input:focus {
    outline: 2px solid color-mix(in srgb, var(--pine) 30%, transparent);
    outline-offset: 1px;
    border-color: var(--pine);
}

.letter-desk-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 14px;
}

.letter-desk-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.letter-desk-note { margin: 0; }

.letter-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.letter-link:hover { color: var(--pine); }

.letter-btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.letter-btn:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--pine) 45%, var(--line));
}

.letter-btn.ghost {
    background: transparent;
}

.letter-btn.soft {
    background: #eef6f1;
    border-color: color-mix(in srgb, var(--pine) 35%, var(--line));
    color: var(--pine);
}

.letter-btn.soft:hover:not(:disabled) {
    background: #e4f0e9;
}

.letter-btn.is-on {
    border-color: var(--pine);
    color: var(--pine);
    background: #eef6f1;
}

.letter-icon-btn {
    width: 36px;
    height: 36px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
}

.letter-icon-btn:hover {
    background: #f1f4f7;
    color: var(--ink);
}

.letter-var { position: relative; }

.letter-var-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 30;
    width: min(280px, 80vw);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(18, 26, 36, 0.12);
    padding: 8px;
    display: grid;
    gap: 6px;
}

.letter-var-menu input[type="search"] {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
}

.letter-var-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 220px;
    overflow: auto;
}

.letter-var-item {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: baseline;
    border: 0;
    background: transparent;
    padding: 8px 8px;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    font-weight: 500;
}

.letter-var-item:hover {
    background: #f3f7f5;
}

.letter-var-item code {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

.letter-editor-wrap .tox-tinymce {
    border: 1px solid var(--line) !important;
    border-radius: 10px !important;
    overflow: hidden;
}

.letter-editor-wrap .tox .tox-toolbar,
.letter-editor-wrap .tox .tox-menubar {
    background: #f7f9fa !important;
}

.letter-test {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: end;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
}

.letter-test label {
    display: grid;
    gap: 5px;
    flex: 1 1 220px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.letter-test input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 11px;
}

body.letter-drawer-open { overflow: hidden; }

.letter-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(18, 26, 36, 0.42);
    z-index: 60;
}

.letter-drawer-backdrop[hidden],
.letter-drawer[hidden],
.letter-ai-panel[hidden],
.letter-ai-result[hidden],
.letter-var-menu[hidden] {
    display: none !important;
}

.letter-drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 70;
    width: min(420px, 100vw);
    height: 100%;
    background: #fff;
    border-left: 1px solid var(--line);
    box-shadow: -16px 0 40px rgba(18, 26, 36, 0.12);
    padding: 18px 18px 28px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: auto;
}

.letter-drawer.is-busy { opacity: 0.96; }

.letter-drawer-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.letter-drawer-head h2 {
    margin: 0;
    font-size: 18px;
}

.letter-drawer-head .quiet {
    margin: 4px 0 0;
    font-size: 13px;
}

.letter-ai-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 4px;
    background: #f3f6f8;
    border-radius: 10px;
}

.letter-ai-tab {
    border: 0;
    background: transparent;
    border-radius: 8px;
    padding: 9px 10px;
    font-weight: 600;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
}

.letter-ai-tab.is-on {
    background: #fff;
    color: var(--ink);
    box-shadow: 0 1px 2px rgba(18, 26, 36, 0.08);
}

.letter-ai-panel {
    display: grid;
    gap: 12px;
}

.letter-ai-label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.letter-ai-label textarea {
    width: 100%;
    min-height: 96px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 11px;
    resize: vertical;
    color: var(--ink);
    font-weight: 500;
    line-height: 1.4;
}

.letter-ai-label textarea:focus {
    outline: 2px solid color-mix(in srgb, var(--pine) 30%, transparent);
    border-color: var(--pine);
}

.letter-ai-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.letter-ai-quick button {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: var(--ink);
}

.letter-ai-quick button:hover:not(:disabled) {
    border-color: var(--pine);
    color: var(--pine);
}

.letter-ai-quick button:disabled {
    opacity: 0.55;
    cursor: wait;
}

.letter-ai-result {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafb;
    padding: 12px;
    display: grid;
    gap: 10px;
}

.letter-ai-result-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.letter-ai-result-subject {
    margin: 0;
    font-weight: 600;
    font-size: 15px;
}

.letter-ai-result-body {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    max-height: 280px;
    overflow: auto;
    font-family: var(--serif);
    font-size: 15px;
    line-height: 1.5;
}

.letter-ai-result-act {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.letter-preview-dialog {
    width: min(760px, calc(100vw - 24px));
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0;
    background: #fff;
    color: var(--ink);
}

.letter-preview-dialog::backdrop {
    background: rgba(18, 26, 36, 0.5);
}

.letter-preview-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--line);
}

.letter-preview-head h2 {
    margin: 4px 0 0;
    font-size: 18px;
}

.letter-preview-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.letter-preview-views {
    display: flex;
    gap: 4px;
}

.letter-preview-frame {
    padding: 18px;
    background: #eef2f5;
    min-height: 280px;
}

.letter-preview-frame[data-view="mobile"] .letter-preview-card {
    max-width: 380px;
    margin: 0 auto;
}

.letter-preview-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px 20px;
}

.letter-preview-card .letter {
    max-width: none;
    font-family: var(--serif);
    font-size: 16px;
    line-height: 1.55;
}

@media (max-width: 720px) {
    .letter-desk-fields { grid-template-columns: 1fr; }
    .letter-desk-form { padding: 16px; border-radius: 10px; }
    .letter-drawer { width: 100vw; }
}

.compose-audience {
    border: 1px solid var(--line);
    background: #fff;
    padding: 14px 16px;
}

.compose-audience h2 { margin: 0 0 6px; }
.compose-audience ul, .compose-audience ol {
    margin: 8px 0 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 14px;
}
.compose-audience li { margin: 0 0 4px; }

.muted, .today { color: var(--muted); }

.plain { padding-left: 18px; }

.reply {
    font-family: var(--serif);
    white-space: pre-wrap;
}

.pages {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 2px;
}

.pages a { font-weight: 600; text-decoration: none; }
.pages a:hover { color: var(--pine); }
.pages > span:not(.num) { color: var(--muted); }

.pages-dock {
    position: fixed;
    z-index: 30;
    left: 212px;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 10px 28px;
    justify-content: flex-end;
    background: #fff;
    border-top: 1px solid var(--line);
}
.hint { color: var(--muted); font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.narrow { max-width: 40rem; }
.preview { margin-top: 12px; font-size: 14px; }
.preview ol { padding-left: 18px; }

.door {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px 16px;
    background: var(--canvas);
}

.door-sheet {
    width: min(420px, 100%);
    background: #fff;
    border: 1px solid var(--line);
}

.door-rail {
    background: var(--rail);
    display: flex;
    align-items: center;
    padding: 22px 28px;
    border-bottom: 3px solid var(--pine);
}

.door-rail img,
.door-rail .brand-mark {
    height: 44px;
    width: auto;
    max-width: 220px;
}

.door-form {
    padding: 28px 28px 32px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.door-form .go { align-self: flex-start; min-width: 132px; margin-top: 4px; }

.door-form h1 { margin-bottom: 4px; }

.door-forgot,
.door-back {
    color: var(--pine);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    align-self: flex-start;
}

.door-forgot:hover,
.door-back:hover { text-decoration: underline; }

.door-form > .door-forgot {
    margin-top: -4px;
}

.door-form .ok {
    margin: 0;
    color: var(--pine);
    font-size: 14px;
}

.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
.check input { width: auto; border: 0; }

.people-page .head { margin-bottom: 4px; }

.people-list {
    margin: 10px 0 32px;
    border-top: 1px solid var(--line);
}

.person {
    padding: 18px 0 16px;
    border-bottom: 1px solid var(--line);
}

.person-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.person-who {
    min-width: 0;
}

.person-who strong {
    display: block;
    font-size: 16px;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.person-mail {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.person-sent {
    flex: none;
    font-size: 13px;
    white-space: nowrap;
}

.person-edit {
    display: grid;
    grid-template-columns: minmax(10rem, 1.4fr) 9rem 5.5rem minmax(8rem, 11rem) auto;
    gap: 12px 14px;
    align-items: end;
}

.person-edit label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.person-edit input,
.person-edit select {
    width: 100%;
    min-width: 0;
    color: var(--ink);
    font-weight: 500;
}

.person-edit .person-limit {
    font-variant-numeric: tabular-nums;
}

.person-edit-act {
    display: flex;
    align-items: center;
    min-height: 34px;
    padding-bottom: 1px;
}

.person-scope {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
}

.person-scope-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.person-scope-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.person-scope-meta {
    font-size: 12px;
    white-space: nowrap;
}

.person-scope-fields {
    display: grid;
    grid-template-columns: 7.5rem minmax(10rem, 1fr) minmax(9rem, 1.1fr) auto;
    gap: 12px 14px;
    align-items: end;
}

.person-scope-fields label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.person-scope-fields input,
.person-scope-fields select {
    width: 100%;
    min-width: 0;
    color: var(--ink);
    font-weight: 500;
}

.person-scope-act {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    min-height: 34px;
    padding-bottom: 1px;
}

.person-assign {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
}

.person-assign-label {
    color: var(--muted);
    font-size: 13px;
    margin-right: 4px;
}

.person-assign select {
    width: 7.5rem;
}

.person-assign input[type="text"] {
    width: 11rem;
    max-width: 100%;
}

.people-create {
    max-width: 40rem;
}

.people-create h2 { margin: 0 0 14px; }

.people-create-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
}

.people-create-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.people-create-act {
    grid-column: 1 / -1;
    margin-top: 4px;
}

@media (max-width: 1180px) {
    .ledger-book { min-width: 0; }
    #ledger.split { grid-template-columns: 1fr; gap: 22px; }
    #ledger .filters { border-right: 0; padding-right: 0; }
    #ledger .ledger-list { padding-left: 0; }
    .ledger-send,
    .campaign-start,
    .member-search { grid-template-columns: 1fr; }
    .ledger-book { table-layout: auto; }
    .ledger-book col { width: auto; }
    .ledger-book thead { display: none; }
    .ledger-book,
    .ledger-book tbody,
    .ledger-book tr,
    .ledger-book td { display: block; width: auto; }
    .ledger-book tr {
        padding: 14px 0 12px;
        border-bottom: 1px solid var(--line);
    }
    .ledger-book td {
        display: grid;
        grid-template-columns: 6.2rem minmax(0, 1fr);
        gap: 8px 12px;
        align-items: center;
        border: 0;
        padding: 3px 0;
        overflow: visible;
    }
    .ledger-book td[data-label="Ettevõte"] {
        display: block;
        padding-bottom: 6px;
    }
    .ledger-book td[data-label="Ettevõte"]::before { content: none; }
    .ledger-book td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        font-weight: 600;
    }
    .ledger-book .account-name,
    .ledger-book .addr,
    .ledger-book .place,
    .ledger-book .when {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }
    .ledger-book td.mark,
    .ledger-book td.list {
        display: block;
        overflow: visible;
    }
    .ledger-book td.mark::before { display: block; margin-bottom: 4px; }
    .ledger-book td.list::before { content: none; }
    .ledger-send .actions { flex-wrap: wrap; align-items: flex-start; }
    .ledger-send .actions .hint { flex-basis: 100%; margin: 4px 0 0; }

    .person-edit {
        grid-template-columns: 1fr 1fr;
    }

    .person-edit-act {
        grid-column: 1 / -1;
    }

    .person-scope-fields {
        grid-template-columns: 1fr 1fr;
    }

    .person-scope-act {
        grid-column: 1 / -1;
    }

    .person-assign select,
    .person-assign input[type="text"] {
        width: auto;
        flex: 1 1 8rem;
    }

    .people-create-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1100px) {
    section.compose:not(.compose-letter),
    div.compose:not(.compose-letter),
    .compose-grid { grid-template-columns: 1fr; }
}

.test-send {
    border: 1px solid var(--line);
    background: #fff;
    padding: 14px 16px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ai-draft {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #f7faf8 0%, #fff 42%);
    padding: 14px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: sticky;
    top: 12px;
}

.ai-draft-head {
    display: grid;
    gap: 2px;
}

.ai-draft-head h2 {
    margin: 0;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pine);
}

.ai-draft-head .quiet {
    margin: 0;
    font-size: 13px;
    line-height: 1.35;
}

.ai-draft.is-busy {
    opacity: 0.92;
}

.ai-draft label,
.ai-chat-label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.ai-composer {
    display: grid;
    gap: 8px;
    margin-top: 2px;
}

.ai-draft textarea {
    width: 100%;
    color: var(--ink);
    font-weight: 500;
    resize: vertical;
    min-height: 76px;
    border: 1px solid var(--line);
    background: #fff;
    padding: 10px 11px;
    line-height: 1.4;
}

.ai-draft textarea:focus {
    outline: 2px solid color-mix(in srgb, var(--pine) 35%, transparent);
    outline-offset: 1px;
    border-color: var(--pine);
}

.ai-chat {
    max-height: 160px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 2px 0 4px;
    border-bottom: 1px solid var(--line);
}

.ai-chat-row {
    max-width: 96%;
    padding: 7px 10px;
    font-size: 13px;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-chat-user {
    align-self: flex-end;
    background: #e7f1eb;
    color: var(--ink);
}

.ai-chat-assistant {
    align-self: flex-start;
    background: #f3f5f7;
    color: var(--muted);
}

.ai-draft-act {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.ai-draft-act .go,
.ai-draft-act .ai-secondary {
    min-width: 0;
    width: 100%;
    justify-content: center;
}

.ai-secondary {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: 9px 12px;
    font-weight: 600;
    cursor: pointer;
}

.ai-secondary:hover:not(:disabled) {
    border-color: var(--pine);
    color: var(--pine);
}

.ai-secondary:disabled,
.ai-draft-act .go:disabled {
    opacity: 0.6;
    cursor: wait;
}

.ai-kbd {
    margin: 0;
    font-size: 11px;
}

.ai-draft #aiDraftStatus { margin: 0; }

.ai-draft #aiDraftError { margin: 0; }

@media (max-width: 1100px) {
    .ai-draft { position: static; }
}

@media (max-width: 960px) {
    .app, .desk, .split, .account, .pipeline, .overview { grid-template-columns: 1fr; }
    .deal-board { grid-template-columns: repeat(7, minmax(12rem, 1fr)); }
    .deals-figures { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .canvas-pad { margin: 8px; padding: 14px 12px 24px; }

    body.nav-lock { overflow: hidden; }

    .mobile-bar {
        display: flex;
        align-items: center;
        gap: 12px;
        position: sticky;
        top: 0;
        z-index: 40;
        min-height: 52px;
        padding: 8px 12px;
        background: var(--rail);
        color: var(--rail-text);
    }

    .menu-toggle {
        position: relative;
        width: 40px;
        height: 40px;
        flex: none;
        border: 0;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.08);
        color: white;
        cursor: pointer;
        display: grid;
        place-items: center;
    }

    .menu-toggle-lines,
    .menu-toggle-lines::before,
    .menu-toggle-lines::after {
        display: block;
        width: 18px;
        height: 2px;
        background: currentColor;
        border-radius: 1px;
        content: "";
        transition: transform 0.2s ease, opacity 0.2s ease;
    }

    .menu-toggle-lines {
        position: relative;
    }

    .menu-toggle-lines::before {
        position: absolute;
        top: -6px;
        left: 0;
    }

    .menu-toggle-lines::after {
        position: absolute;
        top: 6px;
        left: 0;
    }

    .app.nav-open .menu-toggle-lines {
        background: transparent;
    }

    .app.nav-open .menu-toggle-lines::before {
        top: 0;
        transform: rotate(45deg);
    }

    .app.nav-open .menu-toggle-lines::after {
        top: 0;
        transform: rotate(-45deg);
    }

    .mobile-brand {
        display: block;
        width: min(168px, 52vw);
    }

    .mobile-brand img,
    .mobile-brand .brand-mark {
        display: block;
        width: 100%;
        height: auto;
        max-height: 36px;
        object-fit: contain;
        object-position: left center;
    }

    .mobile-bar-spacer {
        margin-left: auto;
        width: 40px;
    }

    .nav-scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 45;
        background: rgba(12, 16, 22, 0.45);
    }

    .nav-scrim[hidden] {
        display: none;
    }

    .rail {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 50;
        width: min(288px, 86vw);
        height: 100vh;
        height: 100dvh;
        padding-top: 16px;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        box-shadow: none;
        overflow-y: auto;
    }

    .app.nav-open .rail {
        transform: translateX(0);
        box-shadow: 12px 0 40px rgba(0, 0, 0, 0.28);
    }

    .rail-top {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 8px;
    }

    .rail .brand {
        flex: 1;
        margin-bottom: 12px;
    }

    .rail-close {
        display: grid;
        place-items: center;
        width: 36px;
        height: 36px;
        flex: none;
        border: 0;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.08);
        color: white;
        font-size: 22px;
        line-height: 1;
        cursor: pointer;
    }

    .rail nav {
        flex-direction: column;
        flex-wrap: nowrap;
    }

    .pipeline, .figures, .figures.letters, .figures.firms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pipeline a { padding: 12px 14px; border-bottom: 1px solid var(--line); }
    .filters { position: static; max-height: none; }
    .mailbox { height: auto; }
    .mail-list { max-height: 280px; border-right: 0; border-bottom: 1px solid var(--line); }
    .thread-letter { grid-template-columns: 1fr; }
    .reply-box { margin-left: 0; }
    .pages-dock { left: 0; }
    .door-rail { padding: 18px 20px; }
    .door-form { padding: 24px 20px 28px; }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; }
}

#kirjad,
#firmad { scroll-margin-top: 16px; }

.registry-page .head { margin-bottom: 10px; }

.registry-hero {
    margin: 8px 0 16px;
}

.registry-hero .muted {
    margin: 0 0 4px;
    font-size: 13px;
}

.registry-when {
    margin: 0;
    font-size: 28px;
    font-weight: 650;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.registry-stats-soft {
    margin-top: -8px;
    opacity: 0.92;
}

.registry-soft-num {
    font-size: 18px !important;
}

.registry-wp {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin: 8px 0 28px;
    padding: 16px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.registry-wp h2 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 650;
}

.registry-wp .quiet { margin: 0; }

.registry-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin: 12px 0 22px;
    border: 1px solid var(--line);
    background: var(--line);
}

.registry-stats article {
    padding: 14px 16px;
    background: var(--paper);
}

.registry-stats span {
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
}

.registry-stats strong {
    font-size: 22px;
    letter-spacing: -0.03em;
    font-weight: 650;
}

.registry-panel {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 28px;
    margin-bottom: 28px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
}

.registry-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 20px;
}

.registry-actions .registry-run {
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.registry-actions .registry-run input[type="number"] {
    width: 100%;
    max-width: 8rem;
}

.registry-latest h2,
.registry-run h2,
.registry-history h2 {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 650;
}

.registry-deltas {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.registry-deltas li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.registry-run {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.registry-run .hint { margin: 0; max-width: 36rem; }

.registry-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.registry-table th,
.registry-table td {
    text-align: left;
    padding: 8px 10px 8px 0;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.registry-table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
}

@media (max-width: 960px) {
    .registry-stats,
    .registry-panel { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    .registry-stats,
    .registry-panel { grid-template-columns: 1fr; }
}

/* —— Saadetud logi (tihe ajalugu) —— */
.log-page { max-width: 1080px; }

.log-head { margin-bottom: 10px; }
.log-head .stages { margin: 4px 0 0; }

.log-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    align-items: end;
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    background: #f7fafb;
}

.log-filters label {
    display: grid;
    gap: 3px;
    min-width: 0;
    flex: 0 1 auto;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
}

.log-filters label span { line-height: 1.2; }

.log-filters .log-q {
    flex: 1 1 220px;
    min-width: 180px;
}

.log-filters input,
.log-filters select {
    min-height: 32px;
    padding: 4px 8px;
    font-size: 13px;
    width: 100%;
}

.log-filters input[type="date"],
.log-filters select { width: auto; min-width: 7.5rem; }

.log-filters .go {
    min-height: 32px;
    padding: 0 12px;
    font-size: 13px;
}

.log-filters .text {
    align-self: center;
    font-size: 13px;
}

.log-scroll {
    overflow-x: auto;
    margin: 0 0 8px;
}

.log-book {
    table-layout: fixed;
    width: 100%;
    min-width: 720px;
    font-size: 13px;
}

.log-col-when { width: 72px; }
.log-col-who { width: 34%; }
.log-col-subject { width: auto; }
.log-col-state { width: 168px; }

.log-book th,
.log-book td {
    padding: 7px 10px 7px 0;
    vertical-align: top;
}

.log-book th { font-size: 11px; letter-spacing: 0.02em; }

.log-when time {
    display: grid;
    gap: 1px;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.log-day { color: var(--ink); font-weight: 600; font-size: 12px; }
.log-time { color: var(--muted); font-size: 11px; }

.log-who {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1px 8px;
    align-items: baseline;
}

.log-firm {
    grid-column: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
}

.log-firm:hover { text-decoration: underline; text-underline-offset: 2px; }

.log-code {
    grid-column: 2;
    color: var(--muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.log-mail {
    grid-column: 1 / -1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: 12px;
}

.log-subject {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink);
}

.log-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.log-pill {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 650;
    line-height: 1;
    white-space: nowrap;
}

.log-pill-open { background: #e7f3ec; color: var(--pine); }
.log-pill-mute { background: #eef2f5; color: var(--muted); }
.log-pill-reply { background: #e8eefc; color: #1d4ed8; }
.log-pill-bounce { background: #fce8e6; color: var(--bounce); }

.log-who .log-pill-bounce {
    grid-column: 1 / -1;
    justify-self: start;
    margin-top: 2px;
}

.log-replies { position: relative; }
.log-replies > summary {
    list-style: none;
    cursor: pointer;
}
.log-replies > summary::-webkit-details-marker { display: none; }

.log-reply-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    width: min(360px, 70vw);
    max-height: 220px;
    overflow: auto;
    padding: 10px 12px;
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.log-reply-panel article + article {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.log-reply-panel strong {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
}

.log-reply-panel p {
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--muted);
    white-space: pre-wrap;
}

.log-mark { margin: 0; }
.log-mark .text { font-size: 12px; }

.log-row.is-bounce td { background: #fffaf9; }
.log-book tbody tr:hover td { background: #f7fafb; }
.log-row.is-bounce:hover td { background: #fff5f3; }

.log-empty {
    color: var(--muted);
    padding: 18px 0 !important;
}

@media (max-width: 720px) {
    .log-page { max-width: none; }
    .log-book { min-width: 0; table-layout: auto; }
    .log-book thead { display: none; }
    .log-book,
    .log-book tbody,
    .log-book tr,
    .log-book td { display: block; width: auto; }
    .log-book tr {
        padding: 10px 0;
        border-bottom: 1px solid var(--line);
    }
    .log-book td {
        border: 0;
        padding: 2px 0;
    }
    .log-who { grid-template-columns: minmax(0, 1fr) auto; }
    .log-subject { white-space: normal; }
    .log-reply-panel { left: 0; right: auto; width: min(100%, 320px); }
}
