/* Briefdock desktop app: a two-row top header and full-width screens */
.app-body { --bar: 40px; }
.app-body .demo-bar { position: sticky; top: 0; z-index: 15; height: var(--bar); flex-wrap: nowrap; white-space: nowrap; }

.top { position: sticky; top: var(--bar); z-index: 12; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-row, .topnav ul, .content { width: min(1264px, 100% - 48px); margin-inline: auto; }
.top-row { display: flex; align-items: center; gap: 14px; height: 62px; }
.top-org { padding-left: 14px; border-left: 1px solid var(--line-2); color: var(--ink-2); font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.global-search { position: relative; flex: 1; max-width: 400px; margin-left: auto; min-width: 160px; }
.global-search > .icon { position: absolute; left: 14px; top: 11px; color: var(--ink-2); }
.global-search input { width: 100%; height: 40px; padding: 0 14px 0 40px; border: 1px solid var(--line); border-radius: 99px; background: var(--bg); }
.topnav ul { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.topnav ul::-webkit-scrollbar { display: none; }
.topnav a { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 14px; border-bottom: 3px solid transparent; color: var(--ink-2); font-weight: 650; font-size: 14.5px; text-decoration: none; white-space: nowrap; }
.topnav li:first-child a { padding-left: 4px; }
.topnav a:hover { color: var(--ink); background: var(--bg); }
.topnav a.is-active { color: var(--accent-dark); border-bottom-color: var(--accent); }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--bg); border-color: var(--line-2); }
.icon-btn:disabled { opacity: .4; cursor: default; }
.dot { position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 750; line-height: 19px; text-align: center; }
.pop-wrap { position: relative; flex: none; }
.who { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 8px 0 4px; border: 1px solid transparent; border-radius: 99px; background: none; cursor: pointer; text-align: left; }
.who:hover { border-color: var(--line); background: var(--bg); }
.who > span:not(.avatar) { display: grid; line-height: 1.2; }
.who strong { font-size: 14px; }
.who small { font-size: 13px; color: var(--ink-2); }
.who > .icon { width: 14px; height: 14px; transform: rotate(90deg); }
.results, .popover { position: absolute; z-index: 20; top: 48px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-lg); box-shadow: 0 18px 40px -16px rgba(46, 19, 34, .38); }
.results { left: 0; right: 0; padding: 6px; max-height: min(420px, 60vh); overflow-y: auto; }
.results a, .popover li a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; line-height: 1.4; }
.results a:hover, .popover li a:hover { background: var(--accent-tint); }
.results span, .popover li span { display: block; font-size: 13px; color: var(--ink-2); }
.results .none { padding: 8px 10px; color: var(--ink-2); font-size: 13.5px; }
.popover { right: 0; width: min(330px, calc(100vw - 28px)); padding: 12px; }
.popover h2 { font-size: 14px; padding: 0 10px 6px; }
.popover > p { padding: 0 10px 8px; color: var(--ink-2); font-size: 13.5px; }
.popover-all { display: block; padding: 9px 10px 2px; font-weight: 700; font-size: 13.5px; }
.popover-menu { width: 240px; padding: 8px; }
.popover-menu > p { padding: 4px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.popover-menu :is(button, a) { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font-weight: 600; font-size: 14px; text-decoration: none; text-align: left; cursor: pointer; }
.popover-menu :is(button, a):hover { background: var(--accent-tint); }

.content { padding: 26px 0 72px; min-height: calc(100vh - 150px); }
.content > * + * { margin-top: 18px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.page-head h1 { font: 700 30px/1.15 var(--display); letter-spacing: -.018em; outline: none; }
.page-head p { color: var(--ink-2); margin-top: 3px; }
.page-head .head-badges { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; font-weight: 700; text-decoration: none; font-size: 14px; }
.content > .back + .page-head, .back + .page-head { margin-top: 4px; }

.card { min-width: 0; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.card h2 { font: 700 17px/1.3 var(--display); letter-spacing: -.005em; }
.card h2 a { color: inherit; text-decoration: none; }
.card h2 a:hover { text-decoration: underline; }
.card h3 { font-size: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.pair > .card { display: flex; flex-direction: column; }
.pair > .summary > .summary-foot { margin-top: auto; }
/* Two charts side by side share the row height: the shorter one spreads its rows to fill it */
.pair > .card > .xc-plan { flex: 1; display: flex; flex-direction: column; }
.pair > .card > .xc-plan > ul { flex: 1; display: flex; flex-direction: column; }
.pair > .card > .xc-plan > ul > li { flex: 1; display: flex; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { display: flex; flex-direction: column; padding: 16px 20px; color: var(--ink); text-decoration: none; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); min-width: 0; }
a.stat:hover { background: #fdf3f6; }
.stat-name { font-size: 13.5px; color: var(--ink-2); font-weight: 600; }
.stat-value { font: 700 29px/1.3 var(--display); letter-spacing: -.02em; }
.stat-sub { font-size: 13.5px; color: var(--ink-2); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; line-height: 1.55; white-space: nowrap; }
.badge .icon { width: 13px; height: 13px; }
.tone-ok { background: var(--ok-tint); color: var(--ok); }
.tone-done, .tone-neutral { background: var(--soft); color: #4a3b43; }
.tone-warn { background: var(--warn-tint); color: var(--warn); }
.tone-danger { background: var(--danger-tint); color: var(--danger); }
.tone-info { background: var(--info-tint); color: var(--info); }
.tone-accent { background: var(--accent-tint); color: var(--accent-dark); }
.tone-note { background: #fff; color: var(--warn); box-shadow: inset 0 0 0 1px #e3c682; }
.prio { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; white-space: nowrap; }
.prio::before { content: ""; width: 9px; height: 9px; border-radius: 2px; border: 1.5px solid #6d5c64; }
.prio-urgent { font-weight: 750; color: var(--danger); }
.prio-urgent::before { background: var(--danger); border-color: var(--danger); transform: rotate(45deg); }
.prio-high { font-weight: 700; }
.prio-high::before { background: #c27800; border-color: #c27800; }
.prio-normal::before { background: linear-gradient(to top, #6d5c64 50%, transparent 50%); }
.pill { display: inline-block; min-width: 21px; padding: 0 6px; border-radius: 99px; background: var(--soft); color: var(--ink); font-size: 13px; font-weight: 750; line-height: 20px; text-align: center; }
.pill-accent { background: var(--accent); color: #fff; }
.avatar { display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 12.5px; font-weight: 750; }
.avatar-client { background: var(--accent-tint); color: var(--accent-dark); }
.muted { color: var(--ink-2); }
.late { color: var(--danger) !important; font-weight: 650; }
.nowrap { white-space: nowrap; }
.note { margin-top: 12px; font-size: 13.5px; color: var(--ink-2); }

.empty { padding: 30px 16px; text-align: center; }
.empty > .icon { width: 26px; height: 26px; color: var(--line-2); margin-bottom: 6px; }
.empty h3 { font-size: 15.5px; }
.empty p { color: var(--ink-2); margin: 2px auto 12px; max-width: 46ch; }
.empty p:last-child { margin-bottom: 0; }

.field { display: grid; gap: 4px; min-width: 0; align-content: start; }
.field > span, .field-title { font-size: 13.5px; font-weight: 650; color: var(--ink-2); }
.field em { font-style: normal; font-weight: 400; }
.field input:not([type="file"]), .field select, .field textarea { width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); }
.field textarea { resize: vertical; }
.field [aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.error { color: var(--danger); font-size: 13.5px; font-weight: 650; }
.error:empty { display: none; }
.grow { flex: 1 1 240px; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.filters .field:not(.grow) { flex: 0 1 200px; }
.count { margin: 14px 0 4px; font-size: 13.5px; color: var(--ink-2); }
.check { display: flex; align-items: center; gap: 9px; min-height: 36px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { display: inline-flex; align-items: center; gap: 7px; flex: none; min-height: 38px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 99px; background: var(--surface); font-weight: 650; font-size: 13.5px; white-space: nowrap; cursor: pointer; }
.tab:hover { border-color: var(--ink-2); }
.tab.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }
.tab.is-active .pill { background: #fff; color: var(--ink); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table thead th { font-size: 13px; font-weight: 700; color: var(--ink-2); white-space: nowrap; padding-block: 8px; }
.table tbody th a { display: block; font-weight: 750; color: var(--ink); text-decoration: none; }
.table tbody th span, .table .sub { display: block; font-weight: 400; font-size: 13px; color: var(--ink-2); line-height: 1.4; }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr[data-href]:hover { background: #fdf3f6; }
.table tbody th { padding-left: 6px; }
.table thead th:first-child { padding-left: 6px; }
.table .num { text-align: right; padding-right: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.meter { display: grid; grid-template-columns: minmax(60px, 1fr) 40px; align-items: center; gap: 10px; }
.meter-track { position: relative; height: 8px; border-radius: 99px; background: var(--soft); }
.meter-track i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--accent); }
.meter-track b { position: absolute; top: -4px; width: 3px; height: 16px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 1.5px #fff; }
.meter-val { font-size: 13.5px; font-weight: 700; text-align: right; }

.as-table { margin-top: 10px; font-size: 13.5px; }
.as-table summary { cursor: pointer; font-weight: 700; min-height: 30px; color: var(--accent-dark); }
.as-table table { width: 100%; border-collapse: collapse; }
.as-table th, .as-table td { padding: 6px 0; border-bottom: 1px solid var(--line); text-align: right; font-size: 13.5px; }
.as-table th:first-child { text-align: left; }

/* Dashboard */
.todo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
.card > .tabs + .todo { margin-top: 8px; }
.todo li { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.todo li:nth-child(-n+2) { border-top-color: transparent; }
.todo li:last-child:nth-child(odd) { grid-column: 1 / -1; }
.todo-icon { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 11px; background: var(--soft); color: var(--ink-2); }
.todo-danger .todo-icon { background: var(--danger-tint); color: var(--danger); }
.todo-warn .todo-icon { background: var(--warn-tint); color: var(--warn); }
.todo-accent .todo-icon { background: var(--accent-tint); color: var(--accent-dark); }
.todo-main { display: grid; min-width: 0; color: var(--ink); text-decoration: none; line-height: 1.4; }
.todo-main:hover strong { text-decoration: underline; }
.todo-main span { color: var(--ink-2); font-size: 13.5px; }
.todo-more { margin-top: 6px; color: var(--accent-dark); }
.feed li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.feed-icon { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-tint); color: var(--accent-dark); }
.feed-icon .icon { width: 16px; height: 16px; }
.feed a { display: grid; min-width: 0; color: var(--ink); text-decoration: none; line-height: 1.4; font-size: 14px; overflow-wrap: anywhere; }
.feed a:hover > span { text-decoration: underline; }
.feed small { color: var(--ink-2); font-size: 13px; }
.feed-two .feed { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
.feed-two .feed li:nth-last-child(-n+2) { border-bottom: 0; }
.summary dl.summary-foot { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 14px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.summary-foot dt { font-size: 13px; color: var(--ink-2); }
.summary-foot dd { font-weight: 700; line-height: 1.35; }
.summary-foot small { display: block; font-weight: 400; font-size: 13px; color: var(--ink-2); }
.update-brief li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.update-brief li:first-child { border-top: 0; padding-top: 0; }
.update-brief a { display: grid; color: var(--ink); text-decoration: none; line-height: 1.45; }
.update-brief a:hover b { text-decoration: underline; }
.update-brief small { color: var(--ink-2); font-size: 13px; }

/* One project */
.subtabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line-2); }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a { display: inline-flex; align-items: center; gap: 7px; flex: none; height: 44px; padding: 0 16px; border-bottom: 3px solid transparent; color: var(--ink-2); font-weight: 700; font-size: 14.5px; text-decoration: none; }
.subtabs a.is-active { color: var(--accent-dark); border-bottom-color: var(--accent); }
.miles { position: relative; }
.mile { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 11px 0; }
.mile + .mile { border-top: 1px solid var(--line); }
.mile:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 50%; height: 100%; width: 2px; background: var(--line); }
.mile-done:not(:last-child)::before { background: var(--accent); }
.mile-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--surface); }
.mile-done .mile-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.mile-done .mile-dot .icon { width: 15px; height: 15px; }
.mile-doing .mile-dot { border-color: var(--accent); box-shadow: inset 0 0 0 5px #fff; background: var(--accent); }
.mile.is-late .mile-dot { border-color: var(--danger); background: var(--danger-tint); box-shadow: none; }
.mile-main { display: grid; line-height: 1.4; min-width: 0; }
.mile-main span { font-size: 13.5px; color: var(--ink-2); }
.mile.is-late .mile-main span { color: var(--danger); font-weight: 650; }
.mile-status select { min-height: 36px; padding: 4px 8px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); font-size: 13.5px; }
.mile-tools, .post-tools { display: flex; gap: 6px; }
.mile-tools .icon-btn, .post-tools .icon-btn { width: 36px; height: 36px; }
.mile-tools .icon, .post-tools .icon { width: 16px; height: 16px; }
.mile > .badge { grid-column: 3 / -1; justify-self: end; }
.about { max-width: 70ch; }
.facts-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.facts-row dt { font-size: 13px; color: var(--ink-2); }
.facts-row dd { font-weight: 700; line-height: 1.35; }
.internal { display: flex; align-items: center; gap: 14px; margin-top: 16px; padding: 13px 16px; border: 1px dashed #c99b2e; border-radius: var(--radius); background: #fdf6e3; }
.internal > .icon { color: var(--warn); }
.internal > div { flex: 1; min-width: 0; font-size: 14px; }
.composer { display: grid; gap: 10px; }
.composer > .btn { justify-self: end; }
.composer-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.posts { display: grid; gap: 14px; }
.post-head { display: flex; align-items: center; gap: 12px; }
.post-head > div { display: grid; flex: 1; line-height: 1.35; }
.post-head > div span { font-size: 13px; color: var(--ink-2); }
.post-head .post-tools { flex: none; display: flex; }
.post-text { margin-top: 10px; max-width: 76ch; overflow-wrap: anywhere; }
.replies { display: grid; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.replies li { display: flex; gap: 10px; }
.replies li > div { min-width: 0; padding: 8px 14px; border-radius: 12px; background: var(--bg); font-size: 14.5px; overflow-wrap: anywhere; }
.replies small { color: var(--ink-2); font-size: 13px; }
.reply-form { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; }
.reply-form .field { flex: 1; }

/* One file */
.decision { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 18px 20px; border-radius: var(--radius-lg); border: 1px solid var(--line-2); }
.decision > .icon { width: 28px; height: 28px; align-self: flex-start; }
.decision > div:not(.decision-actions) { flex: 1 1 320px; min-width: 0; color: var(--ink); }
.decision h2 { font: 700 18px/1.3 var(--display); }
.decision p { color: var(--ink-2); }
.decision blockquote { margin-top: 6px; font-size: 16px; max-width: 70ch; }
.decision blockquote::before { content: "\201C"; }
.decision blockquote::after { content: "\201D"; }
.decision-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.decision.tone-neutral { background: var(--surface); }
.decision.tone-ok { border-color: #b4d9bf; }
.decision.tone-warn { border-color: #ecd391; }
.decision.tone-danger { border-color: #f0bca5; }
.decision.tone-accent { border-color: #e7a9c0; }
.version-rail { position: relative; display: flex; gap: 14px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.version { flex: 1 0 280px; display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.version.is-current { border: 2px solid var(--accent); background: #fef7f9; }
.version-file { display: flex; gap: 12px; align-items: center; min-width: 0; }
.version-file > div { display: grid; min-width: 0; line-height: 1.35; }
.version-file div span { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.version p { font-size: 14px; flex: 1; }
.version small { font-size: 13px; color: var(--ink-2); }
.filetype { display: grid; place-items: end center; flex: none; width: 42px; height: 50px; padding-bottom: 7px; border-radius: 6px 14px 6px 6px; background: var(--accent-tint); color: var(--accent-dark); font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.trail li { position: relative; display: flex; gap: 14px; padding-bottom: 18px; }
.trail li:last-child { padding-bottom: 0; }
.trail li:not(:last-child)::before { content: ""; position: absolute; left: 16px; top: 34px; bottom: 0; width: 2px; background: var(--line); }
.trail-dot { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--soft); color: var(--ink-2); }
.trail-dot .icon { width: 17px; height: 17px; }
.trail-approved .trail-dot { background: var(--ok); color: #fff; }
.trail-changes .trail-dot { background: var(--danger-tint); color: var(--danger); }
.trail-shared .trail-dot { background: var(--accent-tint); color: var(--accent-dark); }
.trail li > div { min-width: 0; padding-top: 4px; }
.trail blockquote { margin: 6px 0; padding: 9px 14px; border-radius: 4px 12px 12px 12px; background: var(--bg); max-width: 68ch; overflow-wrap: anywhere; }
.trail small { display: block; color: var(--ink-2); font-size: 13px; }

/* One invoice */
.inv-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.content > .inv-layout { margin-top: 14px; }
.sheet { min-width: 0; padding: 36px 40px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 16px 36px -26px rgba(46, 19, 34, .5); border-top: 6px solid var(--accent); }
.sheet-head { display: flex; justify-content: space-between; gap: 20px; font-size: 14px; color: var(--ink-2); }
.sheet-agency { font: 700 21px/1.3 var(--display); color: var(--ink); }
.sheet-no { text-align: right; }
.sheet-no h2 { font: 700 28px/1.2 var(--display); color: var(--ink); }
.sheet-meta { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 26px; padding: 16px 0; border-block: 1px solid var(--line); }
.sheet-meta dt { font-size: 13px; color: var(--ink-2); }
.sheet-meta dd { font-weight: 700; line-height: 1.4; }
.sheet-meta small { display: block; font-weight: 400; font-size: 13px; color: var(--ink-2); }
.lines { width: 100%; margin-top: 18px; border-collapse: collapse; font-size: 14.5px; }
.lines th, .lines td { padding: 11px 0 11px 12px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; white-space: nowrap; }
.lines th:first-child { padding-left: 0; text-align: left; white-space: normal; font-weight: 650; overflow-wrap: anywhere; }
.lines thead th { font-size: 13px; color: var(--ink-2); font-weight: 700; }
.sheet-total { margin: 14px 0 0 auto; width: min(320px, 100%); font-variant-numeric: tabular-nums; }
.sheet-total div { display: flex; justify-content: space-between; gap: 16px; padding: 5px 0; }
.sheet-total .is-due { margin-top: 6px; padding: 12px 14px; border-radius: var(--radius); background: var(--accent-tint); font-weight: 800; font-size: 17px; }
.sheet-note { margin-top: 20px; font-size: 14px; }
.sheet-foot { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.inv-panel { position: sticky; top: calc(var(--bar) + 128px); display: grid; gap: 14px; }
.inv-state { display: grid; justify-items: start; gap: 4px; }
.inv-state > strong { font: 700 28px/1.2 var(--display); }
.inv-state p { font-size: 14px; color: var(--ink-2); }
.inv-state .badge { margin-right: 4px; }
.inv-actions { display: grid; gap: 8px; }
.inv-panel .note { margin: 0; }
.reported { padding: 12px 14px; border-radius: var(--radius); background: var(--accent-tint); font-size: 14px; }
.events li { display: grid; padding: 8px 0; border-top: 1px solid var(--line); line-height: 1.4; font-size: 14px; }
.events b { font-weight: 650; overflow-wrap: anywhere; }
.events span { color: var(--ink-2); font-size: 13px; }

/* One request */
.req-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.req-main { display: grid; gap: 18px; min-width: 0; }
.req-main .post-text { margin-top: 12px; }
.thread { display: grid; gap: 12px; margin-bottom: 18px; }
.thread li { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--bg); }
.thread li > div { min-width: 0; overflow-wrap: anywhere; }
.thread li.is-internal { background: #fdf6e3; border: 1px dashed #c99b2e; }
.thread-who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.thread-who small { color: var(--ink-2); font-size: 13px; }
.thread-empty { margin-bottom: 14px; color: var(--ink-2); }
.triage { display: grid; gap: 10px; margin-top: 12px; }
.req-side .facts { margin-top: 16px; }
.req-side h2 + .facts { margin-top: 8px; }
.facts div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.facts dt { font-size: 13.5px; color: var(--ink-2); }
.facts dd { overflow-wrap: anywhere; font-weight: 600; font-size: 14px; }
.triage-more { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

/* Clients */
.client-list { display: grid; gap: 12px; }
.client-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 20px; align-items: center; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.client-id { display: flex; gap: 12px; min-width: 0; }
.client-id h2 { font: 700 16px/1.3 var(--display); }
.client-id p { font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere; }
.client-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.client-nums dt { font-size: 13px; color: var(--ink-2); line-height: 1.3; }
.client-nums dd { font-weight: 750; font-size: 17px; }
.client-note { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--radius); background: #fdf6e3; border: 1px dashed #c99b2e; font-size: 13.5px; line-height: 1.45; }
.client-note .icon { width: 15px; height: 15px; margin-top: 3px; color: var(--warn); }
.client-note b { display: block; }
.client-actions { display: grid; gap: 6px; }

/* Role screen */
.signin { max-width: 800px; margin: 0 auto; padding: 56px 20px 64px; text-align: center; }
.signin h1 { margin-top: 34px; font: 700 clamp(27px, 4vw, 38px)/1.15 var(--display); letter-spacing: -.02em; outline: none; }
.signin-sub { margin-top: 6px; color: var(--ink-2); }
.roles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 30px; text-align: left; }
.role { display: flex; flex-direction: column; width: 100%; height: 100%; padding: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; text-align: left; cursor: pointer; transition: border-color .15s, transform .15s; }
.role:hover { border-color: var(--accent); transform: translateY(-2px); }
.role-top { display: flex; gap: 14px; align-items: center; padding: 20px; }
.role-top > span:last-child { display: grid; line-height: 1.35; }
.role-icon { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 13px; background: var(--accent-tint); color: var(--accent); }
.role-icon .icon { width: 24px; height: 24px; }
.role-title { font: 700 18px/1.3 var(--display); }
.role-name { color: var(--accent); font-weight: 700; font-size: 14px; }
.role-org { padding: 9px 20px; background: var(--navy); color: #fff; font-size: 13.5px; font-weight: 650; }
.role-points { display: grid; gap: 9px; padding: 16px 20px 20px; font-size: 14.5px; color: var(--ink-2); }
.role-points span { display: flex; gap: 9px; }
.role-points .icon { width: 16px; height: 16px; margin-top: 3px; color: var(--accent); }

/* Modal, toasts, loading. The title and buttons stay in view while the fields scroll. */
dialog { width: min(600px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 18px; color: var(--ink); background: var(--surface); box-shadow: 0 30px 70px -20px rgba(46, 19, 34, .55); overflow: hidden; }
dialog.is-wide { width: min(760px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(46, 19, 34, .55); }
dialog form { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); }
.modal-head { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font: 700 18px/1.3 var(--display); }
.modal-body { min-height: 0; overflow-y: auto; padding: 18px 20px; }
.modal-foot { display: flex; flex: none; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.wide { grid-column: 1 / -1; }
.modal-note { color: var(--ink-2); }
.modal-note strong { color: var(--ink); }
.quote { padding: 10px 14px; border-radius: var(--radius); background: var(--danger-tint); }
.quote small { display: block; color: var(--danger); font-weight: 700; }
.filefield > span { font-size: 13.5px; }
.filepick { display: flex; flex-wrap: wrap; gap: 8px; }
.filepick label:focus-within { outline: 3px solid #2f7fb8; outline-offset: 2px; }
.filechip { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px dashed var(--line-2); border-radius: var(--radius); font-size: 13.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.filechip .icon { color: var(--accent); }
.filechip span { min-width: 0; }
.filechip b { color: var(--ink); }
.filefield .note { margin-top: 0; }
.line-row { display: grid; grid-template-columns: minmax(0, 1fr) 72px 120px 96px 40px; gap: 8px; align-items: end; margin: 0 0 8px; padding: 0; }
.line-sum { align-self: end; height: 40px; line-height: 40px; text-align: right; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lines-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.lines-foot strong { margin-left: 8px; font: 700 20px/1.3 var(--display); }

.toasts { position: fixed; z-index: 60; right: 16px; bottom: 16px; display: grid; gap: 8px; max-width: min(400px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 15px; border-radius: var(--radius); background: var(--navy); color: #fff; box-shadow: 0 12px 28px -12px rgba(46, 19, 34, .6); }
.toast .icon { margin-top: 2px; color: #f2a9c3; }
.toast-warn .icon { color: #ffc35c; }
.skeleton { display: grid; gap: 16px; }
.skeleton > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.sk { display: block; height: 92px; border-radius: var(--radius-lg); background: linear-gradient(90deg, #ece6e8 25%, #f8f5f6 50%, #ece6e8 75%); background-size: 200% 100%; animation: shimmer 1s linear infinite; }
.sk-title { width: 240px; max-width: 70%; height: 34px; }
.sk-block { height: 280px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.noscript { padding: 40px; text-align: center; }

@media (max-width: 1100px) {
  .pair { grid-template-columns: minmax(0, 1fr); }
  .client-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .client-note { grid-column: 1 / 3; grid-row: 2; }
  .client-actions { grid-column: 3; grid-row: 1 / 3; }
  .top-org { display: none; }
  .table .col-wide { display: none; }
}
@media (max-width: 960px) {
  .top-row, .topnav ul, .content { width: calc(100% - 32px); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .who > span:not(.avatar) { display: none; }
  .inv-layout, .req-layout { grid-template-columns: minmax(0, 1fr); }
  .inv-panel { position: static; }
  .inv-layout .inv-panel { order: -1; }
  .todo, .feed-two .feed { grid-template-columns: minmax(0, 1fr); }
  .todo li:nth-child(2) { border-top-color: var(--line); }
  .feed-two .feed li:nth-last-child(2) { border-bottom: 1px solid var(--line); }
  .facts-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .table .col-mid { display: none; }
  .topnav a { padding: 0 11px; }
  .topnav a .icon { display: none; }
}

/* Printing shows only the invoice sheet */
@page { margin: 14mm; }
@media print {
  .no-print, .demo-bar, .toasts, .preview, dialog { display: none !important; }
  .app-body { background: #fff; }
  .content, .m-content { width: 100% !important; padding: 0 !important; min-height: 0 !important; }
  .inv-layout { display: block !important; }
  .sheet { border: 0; border-top: 6px solid var(--accent); box-shadow: none; padding: 20px 0 0; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

.role-short { display: none; }
