:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  color: #14253a;
  background: #f2f5f8;
  --ink: #14253a;
  --muted: #566980;
  --brand: #144c7d;
  --navy: #122b46;
  --border: #dce4ed;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 18rem; }
a { color: var(--brand); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: .11em; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, .table-wrap:focus-visible { outline: 3px solid #428de0; outline-offset: 3px; }
p { overflow-wrap: anywhere; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.65rem, 3.6vw, 2.4rem); letter-spacing: -.04em; line-height: 1.15; overflow-wrap: anywhere; }
h2 { margin-bottom: 1.1rem; font-size: 1.14rem; letter-spacing: -.015em; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); }
.skip:focus { position: fixed; top: .5rem; left: .5rem; z-index: 1; background: white; padding: .65rem; }
.shell, .top-inner { width: min(100% - 2.5rem, 88rem); margin-inline: auto; }
.top { background: var(--navy); color: #f8fbff; border-bottom: 3px solid #2977ad; }
.top-inner, .top-actions, .brand { display: flex; align-items: center; }
.top-inner { justify-content: space-between; gap: 1rem; min-height: 4.25rem; }
.brand { gap: .65rem; color: white; text-decoration: none; font-weight: 720; font-size: 1.05rem; }
.brand-icon { display: block; width: 1.1rem; height: 1.34rem; border: 1.5px solid #9fd5ff; border-radius: .18rem; position: relative; }
.brand-icon::after { content: ""; position: absolute; top: .38rem; left: .2rem; right: .2rem; height: .35rem; border-block: 1px solid #9fd5ff; }
.top-actions { gap: .85rem; }
.top-button { padding: .36rem .65rem; color: white; background: transparent; border: 1px solid #7992aa; border-radius: .4rem; }
.top-button:hover { background: #294767; }
.mode, .status { display: inline-block; border-radius: .32rem; padding: .25rem .55rem; font-size: .78rem; font-weight: 700; width: fit-content; }
.mode-test { color: #fff1cb; background: #5b461f; }
.mode-live { color: #d5fff0; background: #235944; }
.username { font-size: .9rem; color: #d7e3f0; overflow-wrap: anywhere; }

main.shell { padding-top: 2.4rem; min-height: 65vh; }
.foot { padding-block: 2.15rem; color: var(--muted); font-size: .82rem; }
.panel { padding: 1.35rem; border: 1px solid var(--border); border-radius: .8rem; background: #fff; box-shadow: 0 2px 8px #122b4608; min-width: 0; }
.login { max-width: 26rem; margin: 1.6rem auto; padding: 2rem; }
.login h1 { margin-bottom: 1.6rem; }
.upload-panel { max-width: 36rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.45rem; }
.archive-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .85rem; }
.service-status { display: grid; gap: .18rem; text-align: right; color: var(--muted); font-size: .8rem; }
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1.15rem; }
.summary div { display: flex; flex-direction: column; gap: .15rem; padding: .9rem 1.1rem; border: 1px solid var(--border); background: #fff; border-radius: .65rem; }
.summary span { color: var(--muted); font-size: .83rem; font-weight: 650; }
.summary strong { font-size: 1.55rem; font-variant-numeric: tabular-nums; }
.archive { padding: 0; overflow: hidden; }
.filters { display: grid; grid-template-columns: 1.15fr 1.15fr .9fr .9fr 1.15fr auto; align-items: end; gap: .75rem; padding: 1rem 1.2rem; }
.filter-reset { grid-column: 1 / -1; width: fit-content; font-size: .85rem; }
label { display: grid; gap: .32rem; min-width: 0; font-size: .83rem; font-weight: 650; }
label input, label select, label textarea { color: var(--ink); background: #fff; width: 100%; min-width: 0; border-radius: .42rem; border: 1px solid #b6c5d5; padding: .56rem .65rem; min-height: 2.55rem; font-weight: 400; }
label input::placeholder { color: #697c92; }
label textarea { resize: vertical; }
.primary, .secondary { border: 1px solid transparent; border-radius: .42rem; padding: .55rem .85rem; min-height: 2.55rem; font-weight: 700; }
.primary { background: var(--brand); color: white; }
.button-link { display: inline-flex; align-items: center; text-decoration: none; }
.primary:hover { background: #193b62; }
.secondary { background: #fff; color: var(--brand); border-color: #a5bbd1; }
.secondary:hover { background: #eaf3fc; }

.table-wrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: .9rem; }
th { background: #edf3f9; color: #314961; font-size: .8rem; }
th, td { padding: .82rem 1.05rem; border-top: 1px solid var(--border); vertical-align: middle; }
td:first-child { width: 29%; }
td { overflow-wrap: anywhere; }
tbody tr:nth-child(even) { background: #f9fbfd; }
tbody tr:hover { background: #edf5fc; }
.row-link { font-weight: 700; }
.row-subject { display: block; margin-top: .14rem; font-size: .78rem; }
.date { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
.status { color: #224964; background: #e3eef7; }
.status-sent, .status-simulated, .status-download_ready { color: #1a5d44; background: #e0f3e9; }
.status-review, .status-recipient_missing, .status-recipient_review, .status-send_unknown { color: #715012; background: #fcf0d3; }
.status-send_failed { color: #842f35; background: #fae4e6; }
.empty { margin: 0; padding: 2.5rem 1.2rem; text-align: center; border-top: 1px solid var(--border); color: var(--muted); }
.pagination { display: flex; justify-content: center; gap: 1rem; padding: 1rem; border-top: 1px solid var(--border); }
.notice { margin-bottom: 1rem; border: 1px solid #c9d9e9; border-radius: .5rem; background: #eaf3fd; padding: .75rem .9rem; overflow-wrap: anywhere; }
.notice-error { background: #fcecee; border-color: #f0c3c7; color: #852830; }
.notice-success { background: #e6f7ee; border-color: #bae5cb; color: #1c5a3d; }
.detail-note { margin-bottom: 1.15rem; }
.breadcrumb { margin-bottom: .8rem; }
.subheading { margin-bottom: .35rem; font-size: .84rem; }
.muted { color: var(--muted); }
.cols { display: grid; grid-template-columns: 1.15fr 1fr; gap: 1.1rem; }
.metadata { margin: 0; }
.metadata div { display: grid; grid-template-columns: minmax(8.4rem, 32%) minmax(0, 1fr); gap: .75rem; border-bottom: 1px solid var(--border); padding: .52rem 0; font-size: .9rem; }
.metadata dt { color: var(--muted); overflow-wrap: anywhere; }
.metadata dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.stack { display: grid; gap: .85rem; }
fieldset.panel { margin: 0; }
fieldset.panel legend { font-weight: 700; }
.draft-buyer { align-self: start; }
.edit { margin-top: 1.1rem; }
.buttons { display: flex; flex-wrap: wrap; gap: .55rem; }
.check { display: flex; gap: .5rem; align-items: start; }
.check input { margin: .2rem 0; width: 1rem; min-height: 1rem; }
.files, .history ol { margin: 0; padding: 0; list-style: none; }
.files li { display: flex; justify-content: space-between; gap: .8rem; border-bottom: 1px solid var(--border); padding: .58rem 0; font-size: .88rem; }
.files a { overflow-wrap: anywhere; }
.files span { white-space: nowrap; }
.history { margin-top: 1.1rem; }
.history li { padding: .7rem .85rem; border-left: 2px solid #cadae9; }
.history li + li { border-top: 1px solid var(--border); }
.event-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: .2rem .8rem; }
.history p { margin: .2rem 0; font-size: .92rem; }
.history .muted { font-size: .8rem; }
@media (max-width: 70rem) {
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 48rem) {
  .shell, .top-inner { width: calc(100% - 1.4rem); }
  .username { display: none; }
  .page-head { flex-wrap: wrap; align-items: flex-start; }
  .service-status { text-align: left; }
  .summary, .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols { grid-template-columns: 1fr; }
  th, td { padding: .62rem .75rem; }
}
@media (max-width: 29rem) {
  .top-actions { gap: .4rem; }
  .brand { font-size: .9rem; gap: .35rem; }
  .top-button { font-size: .78rem; }
  .mode { font-size: .68rem; }
  .filters { padding: .75rem; }
}

a.top-button { text-decoration: none; }
.account-panel { max-width: 43rem; }
.auth-qr { display: block; max-width: 100%; height: auto; image-rendering: pixelated; }
.managed-user { border-top: 1px solid var(--border); padding-block: .8rem; min-width: 0; overflow-wrap: anywhere; }
