/* LibStop styles. Colors and type follow the screen sketches. */
:root {
  --ground: #F6F4EF;
  --card: #FFFFFF;
  --ink: #1D2327;
  --body: #33393E;
  --muted: #4A5157;
  --faint: #5B6168;
  --line: #E2DED5;
  --track: #E9E4DA;
  --teal: #1E5A66;
  --teal-dark: #143F48;
  --teal-tint: #E3EFF1;
  --rust: #A6481B;
  --rust-dark: #6E2D10;
  --rust-tint: #FBEAE2;
  --amber-ink: #7A4E0B;
  --amber-tint: #FBF1DF;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", sans-serif;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}
a { color: var(--teal); }
a:hover { color: var(--teal-dark); }
img, svg { max-width: 100%; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.75rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 720px; }

/* ---------- header and footer ---------- */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 24px; padding-top: 12px; padding-bottom: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-name { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; }
.brand svg { flex-shrink: 0; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; font-size: .95rem; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 0; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--teal); }
.nav form { display: inline; margin: 0; }

.site-footer { margin-top: 64px; border-top: 1px solid var(--line); background: var(--card); }
.site-footer .wrap {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding-top: 20px; padding-bottom: 24px; font-size: .875rem; color: var(--faint);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.site-footer a { color: var(--faint); }

main { padding-top: 40px; }

/* ---------- buttons and forms ---------- */
.button, button.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px; border-radius: 8px; border: 1px solid var(--teal);
  background: var(--teal); color: #fff; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--teal-dark); color: #fff; }
.button.secondary { background: var(--card); color: var(--teal); }
.button.secondary:hover { background: var(--teal-tint); color: var(--teal-dark); }
.button.danger { background: var(--card); color: #8E3A12; border-color: var(--rust); }
.button.danger:hover { background: var(--rust-tint); }
.button.small { min-height: 38px; padding: 0 14px; font-size: .9rem; }
.link-button {
  background: none; border: none; padding: 8px 0; font: inherit; color: var(--muted);
  cursor: pointer;
}
.link-button:hover { color: var(--teal); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

label { font-weight: 600; }
input[type="email"], input[type="text"], input[type="file"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #B9B3A7;
  border-radius: 8px; background: #fff; font: inherit; color: var(--ink);
}
textarea { min-height: 110px; }
input:focus, select:focus, textarea:focus, .button:focus-visible, a:focus-visible {
  outline: 3px solid #8DB8BF; outline-offset: 2px;
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-bottom: 12px; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--teal); flex-shrink: 0; }
.hint { font-size: .875rem; color: var(--faint); font-weight: 400; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 220px; }

/* ---------- cards and layout ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px;
}
.card + .card { margin-top: 20px; }
.grid > .card + .card { margin-top: 0; }
.card > .pill + h3, .card > .pill + h2 { margin-top: 14px; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 16px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stack > * + * { margin-top: 20px; }
.section { margin-top: 48px; }
.eyebrow {
  font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--teal); margin-bottom: 10px; display: block;
}
.lead { font-size: 1.15rem; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem;
  font-weight: 600; background: var(--teal-tint); color: var(--teal);
}
.pill.rust { background: var(--rust-tint); color: var(--rust-dark); }
.pill.amber { background: var(--amber-tint); color: var(--amber-ink); }
a.card { display: block; color: var(--ink); text-decoration: none; }
a.card:hover { border-color: #8DB8BF; }
a.card .more { color: var(--teal); font-weight: 600; }

.hero { display: grid; gap: 40px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: center; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.3rem); }
.hero-panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }

.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-radius: 10px;
  background: var(--teal-tint); color: #23474E;
}
.notice.rust { background: var(--rust-tint); color: var(--rust-dark); }
.notice.amber { background: var(--amber-tint); color: #5A3A08; }
.notice svg { flex-shrink: 0; margin-top: 2px; }
.notice p:last-child { margin-bottom: 0; }

.flashes { list-style: none; padding: 0; margin: 0 0 24px; }
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 8px; background: var(--teal-tint); color: #23474E; }
.flash.error { background: var(--rust-tint); color: var(--rust-dark); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: .925rem; }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-top: 1px solid #ECE8E0; }
thead th { background: #F0EDE6; border-top: none; font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.removed td { color: #6B7075; background: var(--ground); }
tr.removed .col-name { text-decoration: line-through; }
tr.flagged td { background: #FDF6EA; }

/* ---------- report ---------- */
.stats-row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat .value { font-size: 1.9rem; font-weight: 600; line-height: 1.1; }
.stat .label { font-size: .9rem; color: var(--muted); }
.bar-row { display: grid; grid-template-columns: minmax(110px, 170px) 1fr minmax(64px, auto); gap: 12px; align-items: center; margin-bottom: 12px; font-size: .925rem; }
.bar-row .value { text-align: right; white-space: nowrap; }
.note-line { margin: 14px 0 0; }
.age-rows .bar-row { grid-template-columns: minmax(110px, 170px) 1fr 7.5rem; }
svg.bar { width: 100%; height: 12px; display: block; }
svg.bar .track { fill: var(--track); }
svg.bar .fill { fill: var(--teal); }
svg.bar .fill.aging { fill: var(--rust); }
.report-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 24px; }
.toc { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: .925rem; margin: 0 0 24px; }
details summary { cursor: pointer; font-weight: 600; color: var(--teal); }
details[open] summary { margin-bottom: 12px; }
.cta-band { background: var(--teal); color: #fff; border-radius: 16px; padding: 28px; display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: center; }
.cta-band h2 { color: #fff; margin-bottom: .3em; }
.cta-band p { color: #E3EFF1; margin: 0; max-width: 640px; }
.cta-band .button { background: #fff; color: var(--teal); border-color: #fff; }
.cta-band .button:hover { background: var(--teal-tint); }

/* ---------- article ---------- */
.prose { max-width: 720px; }
.prose h2 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: .4em; }

@media (max-width: 640px) {
  main { padding-top: 28px; }
  .card { padding: 18px; }
  .bar-row, .age-rows .bar-row { grid-template-columns: 1fr 7.5rem; }
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 14px; }
  .stat .value { font-size: 1.6rem; }
  .bar-row .label { grid-column: 1 / -1; margin-bottom: -6px; }
  th, td { padding: 8px 10px; }
}

@media print {
  .site-header, .site-footer, .no-print { display: none !important; }
  body { background: #fff; }
}
