/* Inkrun App staff UI — "Modern CMYK / Print Shop" (inkrun-md/DESIGN.md).
   Tokens are copied verbatim from inkrun-site/index.html :root — keep in sync. */

:root {
  --ink: #1A1A1A;
  --paper: #FDFDF8;
  --cyan: #0077A8;       /* INTERACTIVE ONLY: links, CTA, focus */
  --cyan-dark: #00597D;  /* CTA hover/active */
  --magenta: #D6255B;    /* SPARING: h2 rule, form errors */
  --yellow: #F2B705;     /* highlight BEHIND ink words only */
  --line: #D0D0CC;       /* hairline rules, decoration only */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='140'%20height='140'%3E%3Cfilter%20id='n'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='0.85'%20numOctaves='2'%20stitchTiles='stitch'/%3E%3CfeColorMatrix%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.035%200'/%3E%3C/filter%3E%3Crect%20width='140'%20height='140'%20filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
}

::selection { background: rgba(242, 183, 5, 0.55); }

h1, h2, h3, .serif { font-family: var(--serif); }
h1 { font-size: clamp(1.75rem, 4vw, 2.25rem); line-height: 1.15; margin: 0 0 0.5rem; }
h2 { font-size: clamp(1.3rem, 3vw, 1.6rem); line-height: 1.2; margin: 2rem 0 0.75rem; }
h2::after {
  content: ""; display: block; width: 3rem; height: 3px;
  background: var(--magenta); margin-top: 0.35rem;
}
h3 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }
p { max-width: 46em; }

/* --- links: cyan, always underlined --- */
a { color: var(--cyan); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 0.16em; }
a:hover { color: var(--cyan-dark); }

/* --- focus: cyan ring everywhere --- */
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; border-radius: 2px; }

/* --- skip link --- */
.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--paper); color: var(--cyan);
  padding: 0.75rem 1.25rem; z-index: 10; font-weight: 700;
}
.skip:focus { left: 0; }

/* --- app frame: left nav + main --- */
.frame { display: flex; min-height: 100vh; }

.sidenav {
  flex: 0 0 15rem;
  border-right: 1px solid var(--line);
  padding: 1.25rem 1rem 2rem;
  display: flex; flex-direction: column; gap: 0.25rem;
}
.wordmark {
  font-family: var(--serif); font-weight: 700; font-size: 1.5rem;
  color: var(--ink); text-decoration: none; letter-spacing: 0.01em;
  padding: 0.25rem 0.5rem;
}
.wordmark:hover { color: var(--ink); }
.wordmark small { display: block; font-family: var(--sans); font-weight: 400; font-size: 0.8rem; }

/* registration strip: the one place all four process colors appear solid */
.regmarks { display: flex; gap: 4px; padding: 0.5rem; }
.regmarks span { width: 18px; height: 18px; display: block; }
.regmarks .c { background: var(--cyan); transform: translateY(1px); }
.regmarks .m { background: var(--magenta); transform: translateY(-1px); }
.regmarks .y { background: var(--yellow); transform: translateY(2px); }
.regmarks .k { background: var(--ink); transform: translateY(-2px); }
.regmarks .g { background: #D1D1D1; transform: translateY(1px); }

.sidenav nav { display: flex; flex-direction: column; margin-top: 0.75rem; }
.sidenav nav a {
  display: flex; align-items: center; gap: 0.7rem;
  min-height: 48px; padding: 0.5rem 0.6rem;
  color: var(--ink); text-decoration: none;
  border-radius: 4px; font-size: 1.05rem;
}
.sidenav nav a:hover { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 0.16em; }
.sidenav nav a[aria-current="page"] {
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--cyan);
}
.sidenav .icon { width: 26px; height: 26px; flex: none; opacity: 0.8; }

.maincol { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: baseline; justify-content: flex-end; gap: 1rem;
  padding: 0.75rem clamp(1.25rem, 4vw, 2.5rem);
  border-bottom: 3px solid var(--ink);  /* pressrule: thick… */
  box-shadow: 0 4px 0 -3px var(--paper), 0 5px 0 -4px var(--ink); /* …+thin */
}
.topbar .who { font-size: 0.95rem; }

.wrap {
  width: min(90vw, 1100px);
  margin-inline: auto;
  padding: 1.5rem clamp(1.25rem, 4vw, 2.5rem) 4rem;
}

/* --- buttons (DESIGN.md §"Button design rules") --- */
.btn, button.btn, input[type="submit"].btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  min-height: 64px; padding: 0.75rem 1.75rem;
  background: var(--cyan); color: #FFFFFF;
  border: 2px solid var(--ink); border-radius: 4px;
  font-family: var(--sans); font-weight: 700; font-size: 1.1rem;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--cyan-dark); color: #FFFFFF; }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 22px; height: 22px; }

.btn-outline {
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--ink);
}
.btn-outline:hover { background: var(--paper); color: var(--ink); text-decoration: underline; }

.btn-small { min-height: 44px; padding: 0.35rem 1rem; font-size: 1rem; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin: 1rem 0; }

/* --- stat cards (no shadows per DESIGN.md; ink rules instead) --- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1.25rem; margin: 1.25rem 0; }
.stat { border-top: 1px solid var(--ink); padding-top: 0.6rem; }
.stat .num { font-family: var(--serif); font-weight: 700; font-size: 2.2rem; line-height: 1.1; }
.stat .lbl { font-size: 0.95rem; letter-spacing: 0.04em; text-transform: uppercase; }
.stat .sub { font-size: 0.95rem; }

mark { background: rgba(242, 183, 5, 0.45); color: var(--ink); padding: 0 0.15em; box-decoration-break: clone; }

.warn { border-left: 4px solid var(--magenta); padding: 0.5rem 1rem; }

/* --- tables: hairline rules, no shading --- */
table.data { width: 100%; border-collapse: collapse; margin: 0.75rem 0 1.5rem; }
table.data caption { text-align: left; font-family: var(--serif); font-weight: 700; font-size: 1.15rem; padding-bottom: 0.4rem; }
table.data th, table.data td { text-align: left; padding: 0.55rem 0.75rem; vertical-align: top; }
table.data thead th { border-bottom: 1px solid var(--ink); font-size: 0.95rem; letter-spacing: 0.03em; }
table.data tbody tr + tr td { border-top: 1px solid var(--line); }

/* --- forms --- */
form .field { margin-bottom: 1.1rem; max-width: 34rem; }
label { display: block; font-weight: 700; margin-bottom: 0.3rem; }
input[type="text"], input[type="email"], input[type="number"], input[type="date"],
input[type="password"], select, textarea {
  width: 100%; padding: 0.65rem 0.75rem;
  border: 2px solid var(--ink); border-radius: 4px;
  background: #FFFFFF; color: var(--ink);
  font: inherit; min-height: 48px;
}
fieldset { border: 1px solid var(--line); border-radius: 4px; padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
legend { font-weight: 700; padding: 0 0.5rem; }
ul.radios { list-style: none; margin: 0; padding: 0; }
ul.radios li { margin: 0.4rem 0; }
ul.radios label { font-weight: 400; display: flex; gap: 0.6rem; align-items: center; min-height: 44px; }
ul.radios input { width: 1.3rem; height: 1.3rem; }
input[type="checkbox"] { width: 1.4rem; height: 1.4rem; }
.errorlist { color: var(--magenta); font-weight: 700; margin: 0.25rem 0; list-style: none; padding: 0; }
.helptext { font-size: 0.95rem; }

.searchbar { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; margin: 1rem 0 1.5rem; }
.searchbar .field { margin: 0; flex: 1 1 14rem; }
.searchbar select { min-width: 10rem; }

/* --- messages --- */
.messages { list-style: none; padding: 0; margin: 1rem 0; }
.messages li { border-left: 4px solid var(--cyan); padding: 0.5rem 1rem; margin: 0.4rem 0; }
.messages li.error { border-left-color: var(--magenta); }

/* --- wizard steps --- */
.steps { list-style: none; display: flex; gap: 1.5rem; padding: 0; margin: 0.5rem 0 1.5rem; }
.steps li { font-weight: 400; }
.steps li[aria-current="step"] { font-weight: 700; }
.steps li[aria-current="step"]::before { content: "▸ "; }

/* --- misc --- */
.muted { font-size: 0.95rem; }
.num-right { text-align: right !important; }
.pill { display: inline-block; border: 1px solid var(--ink); border-radius: 999px; padding: 0 0.7em; font-size: 0.9rem; }
.pagination { display: flex; gap: 1rem; align-items: center; margin: 1rem 0; }

.login-box { max-width: 26rem; margin: 10vh auto; }

@media (max-width: 50rem) {
  .frame { flex-direction: column; }
  .sidenav { flex: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidenav nav { flex-direction: row; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn { transition: background-color 120ms ease; }
}

/* --- public / subscriber-facing pages (DESIGN.md: seniors — 20px serif body) --- */
body.public { font-family: var(--serif); font-size: 1.25rem; line-height: 1.6; }
body.public h1 { font-size: clamp(2rem, 6vw, 2.8rem); }
.masthead { padding-top: 1.5rem; }
.masthead-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.masthead-row .regmarks { margin-left: auto; }
.masthead-img { max-width: min(100%, 30rem); height: auto; }
.pressrule { border-top: 3px solid var(--ink); border-bottom: 1px solid var(--ink); height: 4px; margin: 0.5rem 0 0; }
.lede { font-size: 1.375rem; line-height: 1.5; max-width: 36em; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 2rem; margin: 2rem 0; }
.plan { border-top: 1px solid var(--ink); padding-top: 0.75rem; }
.plan h2 { margin-top: 0.5rem; }
.price-figure { font-size: clamp(2rem, 6vw, 2.5rem); font-weight: 700; margin: 0.75rem 0 0.25rem; }
.price-figure .muted { font-size: 1.1rem; font-weight: 400; }
.price-break { font-family: var(--sans); font-size: 1.05rem; margin-bottom: 1.25rem; }
.account-id {
  font-family: var(--sans); font-weight: 700; letter-spacing: 0.12em;
  font-size: clamp(2.4rem, 8vw, 3.5rem); margin: 0.5rem 0;
}
.confirmation-copy { max-width: 40em; }
.public-footer { border-top: 1px solid var(--line); margin-top: 3rem; padding-top: 1rem; padding-bottom: 3rem; }
.public-footer a { min-height: 64px; display: inline-flex; align-items: center; }

/* --- inline action buttons match adjacent input height (bug: oversized Search) --- */
.btn-inline { min-height: 48px; padding: 0.4rem 1.25rem; font-size: 1rem; }
.searchbar .btn-inline { align-self: end; }

/* --- sortable headers --- */
table.data th a { color: var(--cyan); }
table.data th[aria-sort] a { font-weight: 700; }

/* --- schedule autosave state --- */
.error-text { color: var(--magenta); font-weight: 700; }
#schedule-grid input { min-height: 44px; padding: 0.3rem 0.5rem; width: auto; min-width: 7rem; }
#schedule-grid input[type="number"] { width: 5.5rem; min-width: 0; }

/* --- issues / publication widget --- */
.dropzone {
  border: 2px dashed var(--ink); border-radius: 4px;
  padding: 1.5rem; margin: 0.75rem 0; max-width: 34rem; text-align: center;
}
.dropzone.dragover { background: rgba(242, 183, 5, 0.18); } /* yellow wash, no text */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%);
}
.visually-hidden:focus-visible + * , a:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.thumb-grid figure { margin: 0; }
.thumb-grid img { width: 100%; height: auto; border: 1px solid var(--line); }
.thumb-grid figcaption { font-size: 0.9rem; }

/* --- upload/parsing status (dropzone + issue form) --- */
.parse-status {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 0.75rem 0; padding: 0.9rem 1.1rem; max-width: 34rem;
  border: 2px solid var(--ink); border-radius: 4px;
  background: rgba(242, 183, 5, 0.18); /* yellow wash */
  font-weight: 700;
}
.parse-status[hidden] { display: none; }
.parse-spinner {
  width: 1.4rem; height: 1.4rem; flex: none;
  border: 3px solid var(--line); border-top-color: var(--magenta);
  border-radius: 50%; animation: parse-spin 0.8s linear infinite;
}
@keyframes parse-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .parse-spinner { animation: none; } }
