:root {
  color-scheme: light;
  --navy: #0d1b2e;
  --ink: #182b3e;
  --muted: #506477;
  --line: #ccdce7;
  --wash: #edf4f8;
  --blue: #075981;
  --paper: #fff;
  font: 1rem/1.55 Aptos, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: #f4f8fb;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--blue); text-underline-offset: .16em; }
button, input, select { font: inherit; }
button, .primary, .secondary { cursor: pointer; }
:focus-visible { outline: 3px solid #39a3d3; outline-offset: 3px; }
.topbar { color: var(--paper); background: var(--navy); }
.topbar-inner, .shell { width: min(1150px, calc(100% - 3rem)); margin: auto; }
.topbar-inner { min-height: 4.2rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { color: var(--paper); text-decoration: none; display: flex; gap: .65rem; align-items: center; font-weight: 700; }
.logo-mark { --logo-size: 39px; position: relative; flex: none; width: var(--logo-size); height: var(--logo-size); border-radius: 50%; overflow: hidden; }
.logo-mark img { position: absolute; width: calc(100% / .7); height: auto; top: 50%; left: 50%; transform: translate(-50%, -50%); }
nav { display: flex; align-items: center; gap: 1.25rem; }
nav a, .logout { color: #cedde9; font-size: .92rem; font-weight: 600; text-decoration: none; }
nav a:hover, nav a[aria-current], .logout:hover { color: var(--paper); text-decoration: underline; }
.logout { background: none; border: 0; padding: .4rem 0; }
.shell { padding: 2.4rem 0 4rem; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font: 400 clamp(2rem, 5vw, 2.75rem)/1.13 Georgia, serif; letter-spacing: -.025em; }
h2 { margin-bottom: .8rem; font-size: 1.05rem; line-height: 1.3; }
.page-heading { margin-bottom: 1.3rem; display: flex; gap: 1rem; align-items: center; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.95fr) minmax(0, 1fr); gap: 1.4rem; align-items: start; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: .7rem; }
.editor { padding: .25rem 1.35rem 1.25rem; }
.form-section { padding: 1.08rem 0; border-bottom: 1px solid #e3edf2; }
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
label { display: grid; min-width: 0; gap: .32rem; font-size: .92rem; font-weight: 600; }
input, select { width: 100%; min-width: 0; border: 1px solid #aebfcd; border-radius: .4rem; padding: .49rem .65rem; background: var(--paper); color: var(--ink); }
input::placeholder { color: #607689; }
.line-row { display: grid; grid-template-columns: minmax(0, 1fr) 5.25rem 7rem 1.8rem; gap: .55rem; align-items: end; margin-bottom: .55rem; }
.remove { border: 0; background: transparent; color: var(--blue); height: 2.55rem; font-size: 1.35rem; }
.remove:disabled { opacity: .35; cursor: default; }
.text-button { color: var(--blue); background: none; border: 0; padding: .3rem 0; font-weight: 650; }
.text-button:hover { text-decoration: underline; }
.editor-actions, .panel-heading { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem; }
.editor-actions { justify-content: flex-end; padding-top: 1rem; }
.primary, .secondary { display: inline-flex; align-items: center; min-height: 2.55rem; padding: .42rem .9rem; border: 1px solid transparent; border-radius: .4rem; text-decoration: none; font-weight: 650; }
.primary { color: white; background: var(--blue); }
.primary:hover { background: #064b6d; }
.secondary { color: var(--blue); border-color: var(--line); background: white; }
.secondary:hover { background: var(--wash); }
.editor-preview { padding: 1.1rem; background: #e5eff6; border-radius: .7rem; }
.preview-paper { border: 1px solid var(--line); border-radius: .45rem; overflow: hidden; background: var(--paper); }
.paper-brand { display: flex; align-items: center; gap: .45rem; justify-content: flex-start; padding: .8rem .9rem; color: white; background: var(--navy); }
.paper-brand .logo-mark { --logo-size: 28px; }
.paper-brand span { font-size: .85rem; font-weight: 650; }
.paper-brand strong { margin-left: auto; font: 400 1.32rem Georgia, serif; }
.paper-details { padding: 1rem .9rem .9rem; }
dl { margin: 0; }
dl div { margin-bottom: .65rem; }
dt { color: var(--muted); font-size: .88rem; }
dd { margin: 0; overflow-wrap: anywhere; }
.paper-total { display: flex; justify-content: space-between; gap: .5rem; align-items: center; padding: .55rem .65rem; background: var(--wash); border-radius: .33rem; }
.paper-total span { font-size: .9rem; }
.paper-total strong, .total, table { font-variant-numeric: tabular-nums; }
.panel-heading { justify-content: space-between; padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0; }
.pdf-panel { overflow: hidden; }
.pdf-preview { display: grid; justify-items: center; gap: 1rem; padding: .75rem; background: var(--wash); }
.pdf-preview img { display: block; max-width: 100%; height: auto; box-shadow: 0 1px 4px #182b3e26; }
.send-card { padding: 1rem; }
.send-card .total { font-size: 1.4rem; font-weight: 700; }
.edit-link { display: inline-block; margin-top: .8rem; }
.notice { border: 1px solid #aeccd9; background: #e5f2f7; padding: .65rem .85rem; border-radius: .45rem; }
.notice.error { color: #74271c; background: #fff0eb; border-color: #efc7be; }
.notice.compact { margin: .85rem 0 0; font-size: .9rem; }
.muted { color: var(--muted); }
.tag { padding: .14rem .55rem; border-radius: .4rem; background: #e6eef5; color: #244962; font-size: .82rem; font-weight: 650; white-space: nowrap; }
.tag.sent { color: #145338; background: #e4f3e9; }
.tag.sending { color: #62401a; background: #faefd9; }
.journal-heading { justify-content: space-between; }
.table-shell { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .8rem 1rem; border-bottom: 1px solid #e3edf2; }
th { background: var(--wash); color: var(--muted); font-size: .9rem; }
tbody tr:last-child td { border-bottom: 0; }
td small { display: block; color: var(--muted); }
td a { font-weight: 700; }
.empty, .login { padding: 1.4rem; }
.empty p { margin-bottom: 0; }
.login-shell { max-width: 410px; padding-top: 3.5rem; }
.login h1 { margin-bottom: 1rem; font-size: 2rem; }
.login-form { display: grid; gap: .9rem; }
.login-form button { justify-self: start; }
.remember-device { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
.remember-device input { width: 1rem; height: 1rem; margin: 0; }
.settings-shell { max-width: 980px; }
.settings-header { margin-bottom: 1.3rem; }
.settings-title { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; }
.settings-header h1 { font-size: clamp(2rem, 4vw, 2.65rem); }
.settings-header p { margin: .45rem 0 0; color: var(--muted); }
.settings-back { display: inline-block; margin-bottom: .6rem; font-size: .9rem; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 1.15rem; align-items: start; }
.settings-record, .settings-sending { border: 1px solid var(--line); border-radius: .65rem; background: var(--paper); }
.settings-section, .settings-sending { padding: 1.2rem 1.35rem; scroll-margin-top: 1rem; }
.settings-section + .settings-section { border-top: 1px solid var(--line); }
.settings-section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem; margin-bottom: .85rem; }
.settings-section-head h2 { margin: 0; font-size: 1.12rem; }
.settings-addresses > div { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: .5rem; margin: 0; padding: .55rem 0; }
.settings-addresses > div + div { border-top: 1px solid var(--line); }
.settings-addresses dd { font-weight: 600; }
.settings-addresses dd.muted { font-weight: 400; }
.settings-form { display: grid; gap: .85rem; margin: .85rem 0 0; max-width: 36rem; }
.settings-form > button { justify-self: start; }
.settings-form .notice { margin: 0; }
.settings-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem 1rem; }
.settings-help { margin: 0 0 .85rem; max-width: 55ch; color: var(--muted); font-size: .92rem; }
.settings-form .settings-help { margin: 0; }
.settings-period { margin-bottom: .42rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.settings-sending { background: #edf4f8; }
.settings-cadence { margin-bottom: .65rem; padding-top: .65rem; border-top: 1px solid var(--line); }
.settings-cadence strong { font-size: 1.2rem; }
.settings-cadence p { margin: 0; }
.settings-test { margin-bottom: .9rem; color: #145338; font-size: .9rem; }
.settings-controls > summary, .schedule-create > summary { cursor: pointer; color: var(--blue); font-weight: 650; }
.settings-controls { padding-top: .75rem; border-top: 1px solid var(--line); }
.schedule-recipient { margin-bottom: .7rem; overflow-wrap: anywhere; }
.schedule-list .login-form, .schedule-list details { margin-top: 1rem; }
.schedule-create { margin-top: .9rem; }
.schedule-create > summary { padding: .75rem 1.35rem; }
.schedule-create > .settings-section { padding-top: .45rem; }
@media (max-width: 780px) {
  .workspace, .settings-grid { grid-template-columns: 1fr; }
  .topbar-inner, .shell { width: calc(100% - 2rem); }
  .shell { padding-top: 1.5rem; }
  .editor-preview { max-width: 34rem; }
}
@media (max-width: 560px) {
  .topbar-inner { min-height: auto; padding: .65rem 0; flex-wrap: wrap; }
  .brand .logo-mark { --logo-size: 33px; }
  nav { flex-wrap: wrap; gap: .3rem .9rem; }
}
@media (max-width: 480px) {
  .editor { padding-inline: .8rem; }
  .line-row { grid-template-columns: 1fr 1fr 1.8rem; align-items: end; }
  .item-description { grid-column: 1 / -1; }
  .journal-heading { align-items: start; }
  .settings-section, .settings-sending, .schedule-create > summary { padding-inline: .85rem; }
  .settings-addresses > div { grid-template-columns: 1fr; gap: .12rem; }
}
