:root {
  --ink: #1c1915;
  --muted: #5e584e;
  --paper: #f4efe4;
  --card: #fffdf8;
  --line: #e2d6c2;
  --spruce: #1c3330;
  --spruce-2: #274743;
  --cream: #f3efe4;
  --amber: #8d6410;
  --rust: #8d3b2a;
  --good: #2d6a4f;
  --shadow: 0 1px 0 rgba(28, 25, 21, 0.04);
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", "Avenir Next", "Trebuchet MS", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
code { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.92em; }

.banner {
  background: #8d6410;
  color: #fffaf0;
  padding: 0.55rem 1.25rem;
  font-size: 0.92rem;
}
.banner.bad { background: #8d3b2a; }
.score-incomplete { font-family: Palatino, Georgia, serif; font-size: 1.6rem; margin: 0.4rem 0 0; }
.sync-log { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.sync-log .failed { color: var(--rust); }
.hint { color: var(--muted); font-size: 0.88rem; }

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

aside {
  background: var(--spruce);
  color: var(--cream);
  padding: 1.1rem 1rem 2rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.brand a { font-family: Palatino, "Iowan Old Style", Georgia, serif; font-size: 1.45rem; text-decoration: none; letter-spacing: 0.01em; }
.chip {
  border: 1px solid rgba(243, 239, 228, 0.45);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

aside label, .rail-title, .score-caption, .score-label { display: block; font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: #c9c0ae; margin-top: 0.85rem; }
aside select, aside input[type="date"] {
  width: 100%;
  margin-top: 0.25rem;
  background: var(--spruce-2);
  color: var(--cream);
  border: 1px solid rgba(243, 239, 228, 0.25);
  border-radius: 6px;
  padding: 0.4rem 0.45rem;
}
aside button, .quiet-button, .button, button {
  font: inherit;
  cursor: pointer;
}
aside button {
  margin-top: 0.55rem;
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(243, 239, 228, 0.4);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
}

.score { text-align: center; margin: 1rem 0; }
.donut { width: 132px; height: 132px; }
.donut .track { fill: none; stroke: rgba(243, 239, 228, 0.18); stroke-width: 3.2; }
.donut .value { fill: none; stroke: #e7d7b8; stroke-width: 3.2; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 18px 18px; }
.donut.good .value { stroke: #8fbf9b; }
.donut.mid .value { stroke: #e2b15a; }
.donut.poor .value { stroke: #e08a78; }
.donut text { fill: var(--cream); font-size: 7px; font-family: Palatino, Georgia, serif; }
.score-count, .score-money { margin: 0.15rem 0 0; font-family: Palatino, Georgia, serif; font-size: 1.55rem; }
.score-caption { margin: 0; }

.checklist { display: flex; flex-direction: column; gap: 0.15rem; margin-top: 0.4rem; }
.check-link {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  text-decoration: none;
  padding: 0.28rem 0.35rem;
  border-radius: 6px;
  font-size: 0.88rem;
}
.check-link:hover, .check-link.active { background: rgba(243, 239, 228, 0.1); }
.check-link .mini { color: #e2b15a; white-space: nowrap; }
.check-link.quiet { color: #c9c0ae; }
.rail-links { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.2rem; font-size: 0.88rem; }
.rail-links a { color: #e7d7b8; }

.workspace { padding: 1.25rem 1.5rem 2.5rem; min-width: 0; }
.top { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.eyebrow { margin: 0; font-family: Palatino, Georgia, serif; font-size: 1.35rem; }
.sync { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.9rem; }
.button, button[type="submit"] {
  background: var(--spruce);
  color: var(--cream);
  text-decoration: none;
  border: 0;
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  display: inline-block;
}
.quiet-button { background: transparent; color: var(--ink); border: 1px solid var(--line); margin-top: 0.6rem; }

h1 { font-family: Palatino, "Iowan Old Style", Georgia, serif; font-weight: 600; font-size: 2rem; margin: 0.2rem 0; }
h2, h3 { font-family: Palatino, Georgia, serif; font-weight: 600; }
.page-head p, .lede, .rule, .gap { color: var(--muted); max-width: 70rem; }
.kicker { font-size: 0.85rem; letter-spacing: 0.03em; text-transform: uppercase; }
.gap { border-left: 3px solid #e2b15a; padding-left: 0.7rem; }

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1rem 0;
}
.cards article, .panel, .bank-card, .catalogue-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.cards article { padding: 0.9rem 1rem; }
.cards h2 { margin: 0; font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); font-family: inherit; }
.cards p { margin: 0.35rem 0 0; font-family: Palatino, Georgia, serif; font-size: 1.45rem; }
.cards span { display: block; font-family: "Segoe UI", sans-serif; font-size: 0.85rem; color: var(--muted); }

.panel { margin-top: 1rem; padding: 0.4rem 0 0.8rem; }
.panel-head, .panel > p, .panel > form, .panel > h3, .panel > ul { padding-left: 1rem; padding-right: 1rem; }
.panel-head { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; }
.panel-head h2 { margin-bottom: 0.2rem; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.65rem 0.8rem; border-top: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }
.imp.critical { color: var(--rust); }
.imp.high { color: #9a3d45; }
.imp.medium { color: var(--amber); }
.imp.low, .imp.unknown { color: var(--muted); }
.badge-extra {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #efe6d4;
  color: var(--ink);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 0.1em;
}
.text-link { color: var(--spruce); }

.callout { background: #fff6e4; border: 1px solid #ead7a8; border-radius: 10px; padding: 0.7rem 1rem 0.7rem 1.6rem; }
.flash { border-radius: 8px; padding: 0.6rem 0.8rem; }
.flash.bad { background: #fde8e4; color: #6d2a22; }
.flash.ok { background: #e5f2ea; color: #1d4a32; }

.filters, .thresholds, .upload, .link-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; }
.thresholds { align-items: stretch; }
.thresholds h3 { flex: 1 0 100%; margin: 0.8rem 0 0; }
.thresholds .hint, .thresholds fieldset, .thresholds .table-wrap, .thresholds button { flex: 1 0 100%; }
.thresholds fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem 0.8rem; }
.thresholds textarea { width: 100%; max-width: 28rem; font: inherit; }
.thresholds label.check { flex-direction: row; align-items: center; gap: 0.4rem; }
.filters label, .thresholds label, .bank-card label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; color: var(--muted); }
input, select {
  font: inherit;
  color: var(--ink);
  background: white;
  border: 1px solid #d9cdb8;
  border-radius: 6px;
  padding: 0.35rem 0.45rem;
}
.issues td span, .issues td strong { display: block; }
.issues form { display: flex; flex-direction: column; gap: 0.3rem; min-width: 9rem; }
.issues button { padding: 0.28rem 0.45rem; font-size: 0.82rem; }
.badge { display: inline-block; border-radius: 999px; padding: 0.05rem 0.45rem; background: #efe8da; font-size: 0.78rem; text-transform: capitalize; }
.badge.ignored { background: #e7e7e4; }
.badge.decision_needed { background: #f3e1b8; }
.unverified { font-size: 0.72rem; letter-spacing: 0.03em; text-transform: uppercase; color: var(--amber); }
.note { color: var(--muted); }
.pager { padding: 0 1rem; color: var(--muted); }
.bank-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.8rem; padding: 0 1rem 0.6rem; }
.bank-card { padding: 0.8rem; display: flex; flex-direction: column; gap: 0.35rem; }
.bank-card h3, .bank-card p { margin: 0; }
.catalogue-item { margin: 0.7rem 1rem; padding: 0.8rem 1rem; }
.catalogue-item h3 { margin: 0 0 0.2rem; }
.scope-list { columns: 2; padding-left: 1.2rem; }
footer { margin-top: 2rem; color: var(--muted); font-size: 0.85rem; }

@media (max-width: 900px) {
  .shell { display: block; }
  aside { position: static; height: auto; }
  .cards { grid-template-columns: 1fr; }
  .scope-list { columns: 1; }
  .top { flex-direction: column; }
}

/* Attachments in drill-downs */
.attach-cell { min-width: 9rem; }
.attach-slot { margin-bottom: .35rem; }
.attach-button { font-size: .85rem; }
.attach-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.attach-list li { display: grid; gap: .15rem; }
.attach-thumb { max-width: 9rem; max-height: 7rem; border: 1px solid #ccd; border-radius: 4px; display: block; }
.attach-name { font-weight: 600; word-break: break-word; }
.attach-meta, .attach-none { color: #667; font-size: .8rem; }
.attach-refresh { margin-top: .3rem; font-size: .75rem; }
