:root {
  --paper:        #FBF7F0;
  --surface:      #FFFDF9;
  --surface-sunk: #F5EFE4;
  --ink:          #2E2A26;
  --ink-soft:     #6B6259;
  --line:         #E5DCCF;
  --clay:         #A85E3C;
  --clay-soft:    #F2E5DC;
  --sage:         #5F7A5A;
  --amber:        #9A6B1F;
  --brick:        #A6412F;
  --radius:       10px;
  --gap:          1.1rem;
  --measure:      68ch;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  font-size: 15px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; margin: 0 0 .5rem; }
h2 { font-size: 1.2rem; margin: 1.9rem 0 .8rem; }
h3 { font-size: 1.02rem; margin: 1.5rem 0 .5rem; }
p  { max-width: var(--measure); }
a  { color: var(--clay); text-underline-offset: 3px; }

.masthead {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 1rem 0;
}
.masthead-inner, .page { max-width: 1120px; margin: 0 auto; padding: 0 2rem; }
/* Its own flex layout (not the .nav class) so the brand link never inherits
   .nav a's padding, which was nudging it out of line with the page content. */
.masthead-inner { display: flex; align-items: center; justify-content: space-between; }
.page { padding-top: 1.9rem; padding-bottom: 3rem; }

.brand { font-family: var(--serif); font-size: 1.2rem; text-decoration: none; color: var(--ink); }
.nav { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.nav a {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem .85rem; border-radius: var(--radius);
  text-decoration: none; color: var(--ink-soft);
}
.nav a:hover  { background: var(--surface-sunk); color: var(--ink); }
.nav a.active { background: var(--clay-soft); color: var(--clay); }

.lede { font-size: 1rem; color: var(--ink-soft); max-width: var(--measure); margin: 0 0 2rem; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.25rem 1.4rem; margin-bottom: var(--gap);
}
.card > :first-child { margin-top: 0; }
.card-footer { border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1.25rem; }

.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  font: inherit; font-size: .95rem;
  padding: .45rem .85rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-sunk); }
.btn-primary { background: var(--clay); border-color: var(--clay); color: #fff; }
.btn-primary:hover { background: #96522F; }
.btn-danger { background: var(--brick); border-color: var(--brick); color: #fff; }
.btn-danger:hover { background: #8E3727; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-soft); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }

/* Ghost controls keep their padding for a comfortable target; a negative
   margin equal to that padding pulls them flush with the surrounding text. */
.inset-left  { margin-left: -0.85rem; }
.inset-right { margin-right: -0.85rem; }

.icon { width: 1.05em; height: 1.05em; flex: none; stroke-width: 1.9; }

.field { margin-bottom: 1rem; max-width: 34rem; }
.field label { display: block; font-weight: 600; margin-bottom: .35rem; }
.field .hint { color: var(--ink-soft); font-size: .88rem; margin: .3rem 0 0; }

/* Controls share one definition so an input outside a .field — the inline name
   editors on the Levels page — is styled identically to one inside. */
.field input, .field select, .field textarea, .input-inline {
  width: 100%; font: inherit; font-size: .95rem;
  padding: .45rem .7rem; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); color: var(--ink);
}
/* One height for every single-line control, so a text box and a select sitting
   side by side line up. Selects carry extra intrinsic height otherwise. */
.field input:not([type=checkbox]), .field select, .input-inline {
  height: 2.2rem; line-height: 1.3;
}
.field input:focus-visible, .field select:focus-visible,
.field textarea:focus-visible, .input-inline:focus-visible {
  outline: 2px solid var(--clay); outline-offset: 1px;
}
/* Align on the TOP edge: every control then starts at the same height, and a
   hint hanging under one field cannot shove its neighbour's control down. */
.field-row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.field-row .field { flex: 1 1 12rem; }
/* A button has no label, so it needs a spacer the exact size of one to line up
   with the controls beside it. Expressed in em so it tracks the label's own box. */
.field-row .field-action { margin-bottom: 1rem; }
.field-row .field-action::before {
  content: ''; display: block; height: 1.65em; margin-bottom: .35rem;
}
.input-inline { max-width: 22rem; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--line); }
th { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
tbody tr:hover { background: var(--surface-sunk); }
td.numeric, th.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--ink-soft); padding: 2.5rem 0; text-align: center; }

.banner {
  display: flex; gap: .85rem; align-items: flex-start;
  border: 1px solid var(--line); border-left: 4px solid var(--ink-soft);
  border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: var(--gap);
  background: var(--surface);
}
.banner .icon { width: 1.2rem; height: 1.2rem; margin-top: .12rem; }
.banner-good    { border-left-color: var(--sage); }
.banner-warning { border-left-color: var(--amber); }
.banner-bad     { border-left-color: var(--brick); }
.banner h3 { margin: 0 0 .2rem; font-size: 1.05rem; }
.banner p  { margin: 0; }

.pill {
  display: inline-block; padding: .15rem .6rem; border-radius: 999px;
  font-size: .85rem; background: var(--surface-sunk); color: var(--ink-soft);
}
.pill-good { background: #E8EFE6; color: var(--sage); }
.pill-bad  { background: #F6E3DF; color: var(--brick); }
.pill-wait { background: #F6EEDD; color: var(--amber); }

.progress { background: var(--surface-sunk); border-radius: 999px; height: .75rem; overflow: hidden; }
.progress-fill { background: var(--clay); height: 100%; width: 0; transition: width .3s ease; }
.progress-label { font-variant-numeric: tabular-nums; margin: .6rem 0 0; color: var(--ink-soft); }

dialog {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 2rem; max-width: 32rem; background: var(--surface); color: var(--ink);
}
dialog::backdrop { background: rgba(46, 42, 38, .45); }

.stack > * + * { margin-top: 1.25rem; }
.muted { color: var(--ink-soft); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* A <select> upgraded into something you can type into. The select itself is
   still there, holding the value; this is only what you see. */
.combo { position: relative; }
.combo-input { width: 100%; }
.combo-list {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + .25rem);
  margin: 0; padding: .25rem; list-style: none; max-height: 15rem; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 6px 20px rgba(46, 42, 38, .08);
}
.combo-option {
  padding: .4rem .6rem; border-radius: 6px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.combo-option.is-active { background: var(--clay-soft); color: var(--clay); }
.combo-empty { padding: .4rem .6rem; color: var(--ink-soft); }
