:root {
  --paper:   #e4e7df;
  --card:    #fbfcf9;
  --ink:     #29323d;
  --soft:    #626e7b;
  --rule:    #c6ccc0;
  --oxblood: #782b37;
  --brass:   #8a6f2c;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
}

a { color: var(--oxblood); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--oxblood);
  outline-offset: 2px;
}

/* ---------- masthead ---------- */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--card);
}
.masthead-inner {
  max-width: 68rem;
  margin: 0 auto;
  padding: 1.1rem 1.5rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 1rem 1.75rem;
}
.wordmark {
  font-family: var(--serif);
  font-size: 1.6rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}
.wordmark span { color: var(--oxblood); }
.masthead form { margin-left: auto; }
.masthead input[type="search"] {
  width: 13rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: #fff;
  font: inherit;
  font-size: 0.9rem;
}
nav {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0.5rem 1.5rem 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.92rem;
}
nav a { color: var(--soft); text-decoration: none; }
nav a:hover, nav a[aria-current] { color: var(--oxblood); }
nav a[aria-current] { box-shadow: inset 0 -2px var(--oxblood); }

main {
  max-width: 68rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

/* ---------- type ---------- */

h1 {
  font-family: var(--serif);
  font-size: 2.1rem;
  line-height: 1.15;
  font-weight: 400;
  margin: 0 0 0.2rem;
  letter-spacing: -0.015em;
}
h2 {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 400;
  margin: 2.2rem 0 0.8rem;
}
h3 { font-size: 0.95rem; font-weight: 600; margin: 1.4rem 0 0.5rem; }
p { max-width: 68ch; }
.lede { color: var(--soft); margin: 0 0 1.6rem; }
.byline { font-family: var(--serif); font-style: italic; color: var(--soft); }
.muted { color: var(--soft); }
.empty {
  color: var(--soft);
  border: 1px dashed var(--rule);
  padding: 1.25rem;
  border-radius: 3px;
  max-width: 46rem;
}

/* ---------- panels ---------- */

.panel {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1.5rem;
}
.stack > * + * { margin-top: 1.25rem; }

/* ---------- the credit block: set like a program page ---------- */

.credit-block { max-width: 40rem; margin: 0 0 1.75rem; }
.credit-block h3 {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 400;
  font-style: italic;
  color: var(--brass);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.3rem;
  margin-bottom: 0.6rem;
}
.credit-line {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.22rem 0;
}
.credit-role {
  font-family: var(--serif);
  font-style: italic;
  color: var(--soft);
  flex: 0 1 auto;
}
.credit-leader {
  flex: 1 1 auto;
  border-bottom: 1px dotted var(--rule);
  transform: translateY(-0.28em);
  min-width: 1.5rem;
}
.credit-name {
  font-family: var(--serif);
  font-size: 1.02rem;
  flex: 0 0 auto;
}
.credit-line .remove {
  flex: 0 0 auto;
  border: 0;
  background: none;
  color: var(--rule);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.2rem;
}
.credit-line:hover .remove { color: var(--oxblood); }

/* ---------- forms ---------- */

label { display: block; font-size: 0.85rem; color: var(--soft); margin-bottom: 0.22rem; }
input[type="text"], input[type="date"], input[type="number"],
input[type="search"], select, textarea {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
textarea { min-height: 5rem; resize: vertical; }
.field { margin-bottom: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: 1rem; }
.row > .field { flex: 1 1 12rem; margin-bottom: 0; }
.row + .row { margin-top: 1rem; }

button, .button {
  font: inherit;
  font-size: 0.92rem;
  padding: 0.45rem 1rem;
  border: 1px solid var(--oxblood);
  border-radius: 2px;
  background: var(--oxblood);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .button:hover { background: #64232d; color: #fff; }
.button-quiet {
  background: transparent;
  color: var(--oxblood);
  border-color: var(--rule);
}
.button-quiet:hover { background: #fff; color: var(--oxblood); border-color: var(--oxblood); }

/* ---------- credit entry bar ---------- */

.entry {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--brass);
  border-radius: 3px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.75rem;
}
.entry-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.entry-row .field { margin-bottom: 0; }
.entry-name { flex: 2 1 14rem; }
.entry-type { flex: 0 1 11rem; }
.entry-detail { flex: 2 1 14rem; }
.entry-hint { font-size: 0.82rem; color: var(--soft); margin: 0.7rem 0 0; }
.entry-hint kbd {
  font: inherit;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 0 0.28rem;
  background: #fff;
}

.merge-prompt {
  margin-top: 0.7rem;
  padding: 0.6rem 0.8rem;
  background: #fff;
  border: 1px solid var(--brass);
  border-radius: 2px;
  font-size: 0.9rem;
}
.merge-prompt button {
  padding: 0.2rem 0.6rem;
  font-size: 0.85rem;
  margin-left: 0.4rem;
}

/* ---------- tables ---------- */

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 0.55rem 0.7rem 0.55rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: baseline;
}
th { font-size: 0.82rem; font-weight: 600; color: var(--soft); }
td.title { font-family: var(--serif); font-size: 1.02rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- dashboard tallies ---------- */

.tallies {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2.5rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1.4rem;
  margin-bottom: 2rem;
}
.tally { padding: 0.3rem 0; }
.tally b {
  display: block;
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 400;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.tally span { font-size: 0.85rem; color: var(--soft); }

.seen-mark { color: var(--brass); }
.badge {
  font-size: 0.78rem;
  color: var(--soft);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.05rem 0.35rem;
}

.split { display: flex; flex-wrap: wrap; gap: 2.5rem; align-items: flex-start; }
.split > * { flex: 1 1 20rem; min-width: 0; }

.flash {
  background: #fff;
  border-left: 3px solid var(--oxblood);
  padding: 0.7rem 1rem;
  margin-bottom: 1.5rem;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (max-width: 34rem) {
  h1 { font-size: 1.7rem; }
  .masthead input[type="search"] { width: 100%; }
  .credit-line { flex-wrap: wrap; }
}

/* ---------- people: bio, photos, contact ---------- */

.bio { max-width: 62ch; white-space: pre-wrap; }

.photo-primary { margin-bottom: 1rem; }
.photo-primary img {
  width: 100%;
  display: block;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--card);
}

.photo-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.photo-strip figure { margin: 0; }
.photo-strip img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  border: 1px solid var(--rule);
  border-radius: 2px;
}
.photo-strip figcaption {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.2rem;
  font-size: 0.75rem;
}

button.linkish {
  border: 0;
  background: none;
  color: var(--soft);
  padding: 0;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
button.linkish:hover { background: none; color: var(--oxblood); }

.contact-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}
.contact-row:last-child { border-bottom: 0; }
.contact-row .muted { flex: 0 0 4.5rem; font-size: 0.82rem; }

.rel {
  font-size: 0.72rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0 0.3rem;
  white-space: nowrap;
  color: var(--soft);
}
.rel-mutual { color: var(--brass); border-color: var(--brass); }
.rel-following { color: var(--ink); }

.social-row { margin-bottom: 1rem; }
.social-row + .social-row { margin-top: 0; }

label.check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}
label.check input { width: auto; }

input[type="file"] {
  width: 100%;
  font: inherit;
  font-size: 0.88rem;
  padding: 0.3rem 0;
}

.pronouns {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-style: normal;
  color: var(--soft);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.1rem 0.4rem;
  margin-left: 0.7rem;
  vertical-align: 0.35em;
  white-space: nowrap;
}

.mine {
  font-size: 0.72rem;
  color: var(--oxblood);
  border: 1px solid var(--oxblood);
  border-radius: 2px;
  padding: 0 0.3rem;
  margin-left: 0.5rem;
  font-family: var(--sans);
  white-space: nowrap;
}
.mine-tag { color: var(--oxblood); border-color: var(--oxblood); }

.filters { margin-left: 0.5rem; }
.filters a {
  color: var(--soft);
  text-decoration: none;
  margin-right: 0.9rem;
  font-size: 0.9rem;
}
.filters a:hover { color: var(--oxblood); }
.filters a[aria-current] { color: var(--oxblood); box-shadow: inset 0 -2px var(--oxblood); }

.doclist { margin-bottom: 1rem; }
.docrow {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}
.docrow:last-child { border-bottom: 0; }
.docext {
  flex: 0 0 auto;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  color: var(--card);
  background: var(--soft);
  border-radius: 2px;
  padding: 0.1rem 0.3rem;
}
.docmain { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.docmain a { font-family: var(--serif); font-size: 1rem; }
.docmeta {
  display: block;
  font-size: 0.8rem;
  color: var(--soft);
}

.modeswitch {
  margin-left: auto;
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  font-size: 0.85rem;
}
.modeswitch form { display: inline; }
.modeswitch a { color: var(--soft); text-decoration: none; }
.modeswitch a:hover { color: var(--oxblood); }
.modecurrent {
  color: var(--oxblood);
  border: 1px solid var(--oxblood);
  border-radius: 2px;
  padding: 0 0.35rem;
}
@media (max-width: 34rem) {
  .modeswitch { margin-left: 0; width: 100%; }
}

/* ---------- sortable column headers ---------- */

th.sortable { padding-right: 0; }
th.sortable a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  white-space: nowrap;
}
th.sortable a:hover { color: var(--oxblood); }
th.num.sortable a { flex-direction: row-reverse; }
th.sorted a { color: var(--oxblood); }
.caret { font-size: 0.6rem; line-height: 1; }

.perf-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.35rem;
  font-size: 0.78rem;
}
.perf-actions a {
  color: var(--soft);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.perf-actions a:hover { color: var(--oxblood); }

.picker { margin-bottom: 0.75rem; }

.importtable { font-size: 0.9rem; }
.importtable th, .importtable td { padding: 0.35rem 0.5rem 0.35rem 0; }
.importtable input[type="text"], .importtable select {
  padding: 0.25rem 0.4rem;
  font-size: 0.9rem;
}
.importtable input[type="checkbox"] { width: auto; }
.importtable td:nth-child(2) { width: 9rem; }
.importtable .badge, .importtable .mine { display: inline-block; margin-top: 0.2rem; }
.row-new td { background: #fff; }
pre.panel { font-size: 0.85rem; line-height: 1.5; white-space: pre; }

.promptbox {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--brass);
  border-radius: 3px;
  padding: 1rem 1.25rem;
  margin: 2rem 0;
  max-width: 48rem;
}
.promptbox summary {
  cursor: pointer;
  font-family: var(--serif);
  font-size: 1.05rem;
}
.promptbox textarea {
  font-family: var(--sans);
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}

/* ---------- list thumbnails ---------- */

.thumbcell { width: 3.4rem; padding-right: 0.9rem !important; }
.thumb {
  display: block;
  width: 3.4rem;
  height: 3.4rem;
  object-fit: cover;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--card);
}
.thumb-round { border-radius: 50%; }
.thumb-empty {
  border-style: dashed;
  border-color: var(--rule);
  opacity: 0.5;
}

/* ---------- instagram ---------- */

.navcount {
  font-size: 0.72rem;
  background: var(--oxblood);
  color: #fff;
  border-radius: 9px;
  padding: 0.05rem 0.4rem;
  vertical-align: 1px;
}
.ig-status { font-size: 0.88rem; margin: -1rem 0 1.4rem; }
.ig-status.ig-error { color: var(--oxblood); }
.ig-tools { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: center;
            margin: 0 0 1.25rem; }
.ig-tools .filters { margin-left: 0; }
.ig-tools input[type="search"] { padding: 0.3rem 0.5rem; border: 1px solid var(--rule);
                                 border-radius: 2px; width: 14rem; }
.ig-list { max-width: 52rem; }
.ig-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.75rem;
}
.ig-card.ig-linked { border-left: 3px solid var(--brass); }
.ig-card.ig-suggested { border-left: 3px solid var(--oxblood); }
.ig-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.7rem; }
.ig-name { font-family: var(--serif); font-size: 1.08rem; }
.ig-handle { font-size: 0.9rem; }
.ig-meta { font-size: 0.82rem; color: var(--soft); margin-top: 0.15rem; }
.ig-bio { font-size: 0.9rem; margin: 0.45rem 0 0; white-space: pre-line;
          max-width: 62ch; overflow-wrap: anywhere; }
.ig-match { font-size: 0.9rem; margin-top: 0.55rem; }
.ig-actions { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; align-items: center;
              margin-top: 0.6rem; font-size: 0.88rem; }
.ig-actions form { display: inline-flex; gap: 0.35rem; align-items: center; margin: 0; }
.ig-actions select { width: auto; max-width: 15rem; padding: 0.25rem 0.4rem; font-size: 0.85rem; }
.ig-actions button:not(.linkish) { padding: 0.25rem 0.7rem; font-size: 0.85rem; }
