/* Locally served, font-independent application styles. Uploaded documents stay in their own iframe. */
:root {
  color-scheme: light;
  --paper: #f8f5ed;
  --surface: #fffdf8;
  --ink: #203641;
  --muted: #5c696b;
  --line: #d9d8ce;
  --accent: #4f665a;
  --soft: #ebece3;
  --danger: #9b342e;
  --radius: 10px;
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #98691c; outline-offset: 4px; }
::selection { background: #d9e0cb; }
img { max-width: 100%; height: auto; }
h1, h2, h3, .wordmark, .footer-wordmark { font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
h1 { font-size: clamp(2.1rem, 5vw, 3.5rem); line-height: 1.12; letter-spacing: -.045em; margin: 0 0 1rem; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.25; letter-spacing: -.025em; margin: 0 0 .75rem; }
h3 { font-size: 1.3rem; line-height: 1.35; margin: 0 0 .5rem; }
p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.container { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.main-content { flex: 1; padding-block: 3.5rem 5rem; min-width: 0; }
.main-content:focus { outline: none; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner { min-height: 96px; display: flex; gap: 2rem; justify-content: space-between; align-items: center; }
.wordmark { display: inline-flex; align-items: center; font-size: 1.75rem; letter-spacing: -.06em; text-decoration: none; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; margin-right: .7rem; width: 38px; height: 42px; background: var(--ink); color: var(--paper); border-radius: 19px 19px 4px 4px; font-size: 1.75rem; }
.brand-dot { color: var(--accent); }
.site-nav, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: .8rem 1.5rem; }
.site-nav { font-size: .9rem; }
.site-nav > a:not(.button) { padding-block: .6rem; text-decoration: none; }
.site-nav [aria-current="page"] { text-decoration: underline !important; text-decoration-thickness: 2px !important; text-underline-offset: .45em; }
.nav-form { margin: 0; }
.nav-button { background: transparent; border: 0; padding: .65rem 0; color: var(--muted); cursor: pointer; }
.nav-button:hover { color: var(--ink); text-decoration: underline; }
.site-footer { border-top: 1px solid var(--line); padding-block: 1.75rem; font-size: .8rem; color: var(--muted); }
.footer-inner { display: flex; gap: 1rem; justify-content: space-between; align-items: center; }
.footer-wordmark { font-size: 1.1rem; color: var(--ink); }
.skip-link { position: absolute; left: 1rem; top: -100px; z-index: 10; background: var(--ink); color: white; padding: .75rem 1rem; border-radius: 4px; }
.skip-link:focus { top: 1rem; }
.page-header { display: flex; gap: 2rem; justify-content: space-between; align-items: end; margin-bottom: 2.5rem; }
.page-header p { max-width: 620px; }
.eyebrow { display: block; color: var(--accent); font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin-bottom: .75rem; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 640px; }
.muted, small { color: var(--muted); }
.small { font-size: .875rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.75rem; min-width: 0; }
.card + .card { margin-top: 1.25rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1.5rem; }
.grid > .card { margin-top: 0; }
.stack { display: grid; gap: 1.5rem; }
.stack > .card { margin-top: 0; }
.narrow, .auth-card { max-width: 500px; margin-inline: auto; }
.auth-card { padding: 2.25rem; }
.auth-card h1 { font-size: 2.4rem; }
.auth-card > .muted { margin-bottom: 1.75rem; }
.account-settings > h1 { margin-bottom: 1.75rem; }
.settings-layout { display: grid; grid-template-columns: 12rem minmax(0, 38rem); gap: 1.5rem; align-items: start; }
.settings-nav { display: grid; gap: .25rem; }
.settings-nav a { padding: .6rem .8rem; border-radius: 5px; font-size: .9rem; text-decoration: none; }
.settings-nav a:hover { background: var(--surface); }
.settings-nav a[aria-current="page"] { background: var(--soft); font-weight: 600; }
.settings-panel > form { max-width: 26rem; }
.settings-panel input + .field-hint { margin-top: .4rem; }
.passkey-list { list-style: none; padding: 0; margin: 0 0 1.75rem; }
.passkey-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.passkey-list li > div { min-width: 0; overflow-wrap: anywhere; }
.passkey-list small { display: block; }
.button, button[type="submit"] { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .65rem 1.15rem; border: 1px solid var(--ink); border-radius: 5px; background: var(--ink); color: var(--surface); text-decoration: none; font-weight: 600; font-size: .9rem; line-height: 1.4; cursor: pointer; text-align: center; }
.button:hover, button[type="submit"]:hover { background: #304c57; border-color: #304c57; text-decoration: none; }
.button.secondary, button.secondary { color: var(--ink); background: transparent; border-color: #a5aea8; }
.button.secondary:hover, button.secondary:hover { background: var(--soft); }
.button.danger, button.danger { color: var(--danger); background: transparent; border-color: #cba39a; }
.button.danger:hover, button.danger:hover { background: #f8ece6; }
.button.small { padding: .5rem .9rem; font-size: .8rem; }
button[type="submit"].nav-button { min-height: 44px; background: transparent; color: var(--muted); border: 0; padding: .5rem 0; font-weight: 400; }
button[type="submit"].nav-button:hover { color: var(--ink); background: transparent; text-decoration: underline; }
button:disabled, .button[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.actions { margin-top: 1.5rem; gap: .75rem; }
.actions form { margin: 0; }
form { margin: 0; }
label, legend { font-weight: 600; font-size: .9rem; }
label { display: block; margin-bottom: .4rem; }
.field { margin-bottom: 1.25rem; }
.field:last-child { margin-bottom: 0; }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), textarea, select { display: block; width: 100%; min-width: 0; padding: .65rem .8rem; border: 1px solid #a4aea8; border-radius: 5px; background: #fffefa; color: var(--ink); min-height: 46px; }
input::placeholder, textarea::placeholder { color: #727b78; }
input[type="file"] { font-size: .875rem; }
input[type="file"]::file-selector-button { background: var(--soft); color: var(--ink); border: 0; border-radius: 3px; padding: .35rem .6rem; margin-right: .75rem; cursor: pointer; }
textarea { resize: vertical; min-height: 130px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ink); width: 1rem; height: 1rem; vertical-align: middle; }
input[readonly] { background: var(--soft) !important; }
[aria-invalid="true"] { border-color: var(--danger) !important; }
.field-hint, .help, .field-error { font-size: .85rem; margin: -.1rem 0 .5rem; color: var(--muted); }
.field-error { color: var(--danger); margin: .4rem 0 0; }
.optional { color: var(--muted); font-weight: 400; }
.checkbox-label { display: flex; align-items: baseline; gap: .6rem; font-weight: 400; }
.checkbox-label input { flex-shrink: 0; }
.error, .notice, .warning { padding: 1rem 1.2rem; border: 1px solid #bac8b6; border-left: 3px solid var(--accent); border-radius: 5px; background: #eff2e9; margin-bottom: 1.5rem; overflow-wrap: anywhere; }
.error { color: #812a26; border-color: #d7b4a9; border-left-color: var(--danger); background: #fbefe8; }
.error p { margin-top: .3rem; }
.warning { background: #faf0dc; border-color: #d8c38e; border-left-color: #98691c; }
.badge { display: inline-block; border-radius: 3px; background: var(--soft); color: #3d5347; padding: .15rem .5rem; font-size: .7rem; font-weight: 700; letter-spacing: .045em; text-transform: uppercase; vertical-align: middle; white-space: nowrap; }
.badge.draft { color: #765718; background: #f3e9ce; }
.empty-state { text-align: center; padding: 4rem 1.5rem; border: 1px dashed #b7bfb3; border-radius: var(--radius); background: #f4f3e9; }
.empty-state p { max-width: 430px; margin: 0 auto 1.5rem; }
.empty-mark { display: block; color: #758269; font-size: 2.25rem; margin-bottom: 1rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
th, td { padding: 1rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
.subscriber-status { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .75rem; }
code { font-size: .85em; overflow-wrap: anywhere; }
.issue-list { list-style: none; margin: 0; padding: 0; }
.item-list { list-style: none; margin: 1rem 0 0; padding: 0; }
.item-list > li { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem 1.5rem; padding-block: 1rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.item-list > li:last-child { border-bottom: 0; padding-bottom: 0; }
.issue-list > li { border-bottom: 1px solid var(--line); padding-block: 1.5rem; }
.issue-list > li:first-child { padding-top: 0; }
.issue-meta { display: flex; flex-wrap: wrap; gap: .5rem 1rem; font-size: .8rem; color: var(--muted); margin-bottom: .6rem; }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 2rem; }
.issue-frame { display: block; width: 100%; height: 78vh; min-height: 480px; border: 1px solid var(--line); border-radius: 5px; background: white; margin-inline: auto; }
.preview { margin-top: 1.5rem; }
.preview-controls { border: 0; padding: 0 0 .75rem; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.preview-controls legend { margin-bottom: .5rem; }
.preview-controls label { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .75rem; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; margin: 0; }
.preview-controls label:has(input:checked) { background: var(--soft); border-color: var(--accent); }
.preview-stage { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: #e9e9e1; }
.preview:has(input[value="phone"]:checked) .issue-frame { width: min(375px, 100%); }
.image-slot img { display: block; width: 100%; aspect-ratio: 8 / 5; object-fit: cover; border-radius: 5px; margin-bottom: 1rem; background: var(--soft); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 700px) {
  .container { width: calc(100% - 32px); }
  .main-content { padding-block: 2rem 3rem; }
  .header-inner { min-height: 0; padding-block: 1rem; align-items: flex-start; flex-direction: column; gap: .75rem; }
  .site-nav { width: 100%; gap: .5rem 1.25rem; font-size: .85rem; }
  .site-nav .nav-form { margin-left: auto; }
  .wordmark { font-size: 1.6rem; }
  .brand-mark { width: 30px; height: 34px; font-size: 1.4rem; }
  .page-header { flex-direction: column; align-items: stretch; gap: 1rem; margin-bottom: 1.5rem; }
  .page-header .actions { margin-top: 0; }
  .card, .auth-card { padding: 1.25rem; }
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
  .settings-nav { display: flex; flex-wrap: wrap; }
  .grid { gap: 1rem; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: .4rem; }
  .empty-state { padding: 2.5rem 1rem; }
  .preview-stage { padding: .4rem; }
  .issue-frame { min-height: 440px; height: 72vh; }
}
@media (prefers-reduced-motion: no-preference) {
  .button, button { transition: background-color 120ms ease, border-color 120ms ease; }
}
@media print {
  .site-header, .site-footer, .actions, .skip-link, .preview-controls { display: none; }
  body, .card { background: white; }
  .container { width: 100%; }
  .main-content { padding: 0; }
}
