/* Layout and colours follow the plan's wireframe: navy #1F3B73 bar, white cards on #F4F6FA. */
* { box-sizing: border-box; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; margin: 0; background: #f4f6fa; color: #1a1a1a; font-size: 14px; }
.bar { background: #1f3b73; color: #fff; padding: 12px 18px; font-weight: 600; font-size: 16px;
       display: flex; justify-content: space-between; align-items: center; }
.bar form { margin: 0; }
.linklike.on-bar { color: #fff; font-size: 13px; font-weight: 400; }
.wrap { display: grid; grid-template-columns: 1fr 1.1fr; gap: 16px; padding: 16px; align-items: start; }
.col { display: grid; gap: 16px; min-width: 0; }
.single { max-width: 760px; margin: 24px auto; padding: 0 16px; }
.login { max-width: 360px; }
.login form { display: grid; gap: 8px; }
.login input { font: inherit; padding: 6px 8px; border: 1px solid #b8c2d6; border-radius: 4px; }
.login .btn { justify-self: start; }
@media (max-width: 900px) { .wrap { grid-template-columns: 1fr; } }

.card { background: #fff; border: 1px solid #d8dee9; border-radius: 6px; padding: 14px; min-width: 0; }
.card h2 { margin: 0 0 10px; color: #1f3b73; font-size: 15px; }
p { margin: 8px 0; }
.muted, .hint { color: #6b7280; }
.hint { font-size: 12px; }
.ok { color: #15803d; }
.err { color: #b91c1c; }
.problem { font-weight: 600; }
.note { font-size: 13px; }
.warn { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; padding: 6px 8px; border-radius: 4px; }

.drop { display: flex; flex-direction: column; gap: 4px; align-items: center; border: 2px dashed #b8c2d6; border-radius: 6px;
        padding: 22px; text-align: center; color: #6b7280; cursor: pointer; }
.drop strong { color: #1a1a1a; }
.drop.over { border-color: #1f3b73; background: #eef2fa; }
.drop:focus-within { outline: 2px solid #1f3b73; outline-offset: 2px; }
.link { color: #1f3b73; text-decoration: underline; }
.template { margin: 8px 0 0; }
.company-pick { display: flex; gap: 8px; align-items: center; margin: 10px 0 0; }
.company-pick label { font-weight: 600; color: #1f3b73; }
.company-pick select { flex: 1; min-width: 0; padding: 4px; font: inherit; }
.company-note { margin-top: 10px; }
.template a { color: #1f3b73; font-weight: 600; }
.file-name { color: #1f3b73; font-weight: 600; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.busy { margin-top: 8px; color: #1f3b73; font-size: 13px; }
.htmx-indicator { display: none; }
.htmx-request.htmx-indicator, .htmx-request .htmx-indicator { display: block; }

table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { border-bottom: 1px solid #eee; padding: 5px 6px; text-align: left; vertical-align: top; }
th { color: #6b7280; font-weight: 600; background: #fff; position: sticky; top: 0; }
.rows td:nth-child(-n+2) { white-space: nowrap; }
.scroll { max-height: 420px; overflow: auto; border: 1px solid #eee; border-radius: 4px; }
.tabs { display: flex; gap: 4px; margin: 8px 0 6px; }
.tab { background: #fff; border: 1px solid #b8c2d6; color: #1f3b73; border-radius: 4px; padding: 4px 10px;
       font: inherit; font-size: 12px; cursor: pointer; }
.tab[aria-pressed="true"] { background: #1f3b73; border-color: #1f3b73; color: #fff; }
.tab:disabled { color: #9aa6bf; cursor: default; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 6px; font-size: 12px; }
.btn.small { padding: 3px 8px; font-size: 12px; }
.page-input { width: 4.5em; padding: 2px 4px; font: inherit; }
.mapping select { width: 100%; padding: 4px; }
.mapping { margin-bottom: 12px; }

.pick { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.pick select { flex: 1; min-width: 0; padding: 4px; }
.email-pick { flex-wrap: wrap; margin: 8px 0; font-size: 13px; }
.email-pick label { font-weight: 600; color: #1f3b73; }
#shared-emails p { margin: 0 0 4px; }
#shared-emails ul { margin: 0; padding-left: 18px; }
.pdf { width: 100%; height: 72vh; min-height: 420px; border: 1px solid #d8dee9; background: #fafafa; }
.placeholder { display: flex; align-items: center; justify-content: center; color: #6b7280; font-size: 13px; }
.downloads { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.btn { display: inline-block; background: #1f3b73; color: #fff; border: 0; padding: 8px 12px; border-radius: 4px;
       font: inherit; font-size: 13px; cursor: pointer; text-decoration: none; }
.btn:disabled { background: #9aa6bf; cursor: default; }
.btn.done { background: #15803d; }
.btn.done:disabled { background: #86b89a; }
.zip-parts { margin-top: 10px; }
.zip-parts .note { margin: 0; }

/* The Email card (_email.html): Trix with its attach and code buttons hidden. */
.email [hidden] { display: none !important; }
.email label.field { display: block; font-weight: 600; color: #1f3b73; margin: 10px 0 4px; }
.email input.text { width: 100%; padding: 6px 8px; font: inherit; border: 1px solid #b8c2d6; border-radius: 4px; }
.email trix-toolbar .trix-button-group--file-tools, .email trix-toolbar .trix-button--icon-code { display: none; }
/* The toolbar wraps instead of scrolling sideways; plain emails need no nesting. */
.email trix-toolbar .trix-button-row { flex-wrap: wrap; overflow-x: visible; justify-content: flex-start; column-gap: 8px; }
.email trix-toolbar .trix-button-group:not(:first-child) { margin-left: 0; }
.email trix-toolbar .trix-button-group-spacer { display: none; }
.email trix-toolbar .trix-button--icon-increase-nesting-level,
.email trix-toolbar .trix-button--icon-decrease-nesting-level { display: none; }
.email trix-editor { min-height: 140px; border-color: #b8c2d6; background: #fff; }
.email-variables select { max-width: 11em; font: inherit; font-size: 12px; padding: 0 4px; border: 0; background: #fff; color: #1a1a1a; cursor: pointer; }
.email-actions { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.email-actions .note { margin: 0; }
.email-for { margin: 14px 0 6px; }
.email-for label { font-weight: 600; color: #1f3b73; }
.email-preview { border: 1px dashed #9aa6bf; border-radius: 4px; padding: 8px; background: #fafafa; }
.email-head { margin: 0 0 6px; font-size: 13px; line-height: 1.6; }
.email-frame { display: block; width: 100%; height: 320px; border: 1px solid #e5e7eb; background: #fff; }
.email-preview .hint { margin: 6px 0 0; }
#email-problem, #email-preview-problem { margin: 8px 0; }
#email-problem p, #email-preview-problem p { margin: 0; }
#email-problem ul, #email-preview-problem ul { margin: 4px 0; padding-left: 18px; }
#email-vars { margin: 8px 0; }
#email-vars p { margin: 0; }
#email-vars ul { margin: 4px 0; padding-left: 18px; }
.email-summary { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.email-summary p { margin: 0; flex: 1; min-width: 14em; color: #4b5563; font-size: 13px; overflow-wrap: anywhere; }
.email-summary strong { color: #1a1a1a; }
.email-edit { border: 0; margin: 0; padding: 0; min-width: 0; }
.email-edit:disabled trix-editor, .email-edit:disabled input.text { background: #f3f4f6; color: #6b7280; }
.drop.locked { cursor: default; opacity: .55; }

/* Sending: test, Send to all, progress, results and the confirmation dialog. */
.email-send { border-top: 1px solid #e5e7eb; margin-top: 14px; padding-top: 12px; }
.send-test { margin: 0; flex-wrap: wrap; }
.send-test label, .send-step .step { font-weight: 600; color: #1f3b73; }
.send-test input.text { flex: 1; width: auto; min-width: 12em; }
.send-step { flex-wrap: wrap; }
.send-run { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; margin-top: 10px; }
.send-bar { grid-column: 1 / -1; height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.send-bar i { display: block; height: 100%; width: 0; background: #1f3b73; transition: width .3s; }
.send-count { grid-column: 1 / -1; margin: 0; font-size: 13px; font-weight: 600; color: #1f3b73; }
.send-run .note { margin: 0; }
#send-results { margin-top: 8px; }
#send-results .scroll { max-height: 260px; }
.rows td.email-cell { white-space: normal; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 3px; margin-right: 2px; }
.tag.fix { background: #fee2e2; color: #991b1b; }
.tag.retry { background: #e0e7ff; color: #1f3b73; }
small.code { color: #6b7280; font-size: 10px; font-family: ui-monospace, Consolas, monospace; }
.btn.plain, .btn.outline { background: #fff; color: #1f3b73; border: 1px solid #1f3b73; }
.btn.plain { border-color: #b8c2d6; }
.btn.outline:disabled { background: #fff; color: #9aa6bf; border-color: #c9d1e0; }
.send-confirm { max-width: 560px; width: calc(100% - 32px); border: 1px solid #d8dee9; border-radius: 6px; padding: 16px; }
.send-confirm::backdrop { background: rgba(15, 23, 42, .45); }
.send-confirm p { margin: 0 0 8px; }
.send-confirm > div { margin: 0 0 12px; }
.send-confirm label { display: flex; gap: 6px; align-items: center; font-weight: 600; }
.confirm-total { font-size: 15px; }
#confirm-shared ul { margin: 0 0 6px; padding-left: 18px; }
.linklike { background: none; border: 0; padding: 0; color: #1f3b73; text-decoration: underline; cursor: pointer; font: inherit; }
