:root {
  --ink-green: #1f3b2e;
  --ink-green-dark: #152a20;
  --paper: #f3efe2;
  --paper-dark: #e8e0c8;
  --card: #fbf9f1;
  --brass: #b4924c;
  --brass-light: #d8c08c;
  --red: #9e352e;
  --ink: #1a2620;
  --muted: #53665a;
  --line: #d9d0b5;
  --shadow: 0 2px 8px rgb(20 30 20 / 8%);
  --shadow-deep: 0 8px 28px rgb(20 30 20 / 16%);
  --radius: 5px;
  --serif: "PT Serif", Georgia, serif;
  --sans: "PT Sans", "Source Sans 3", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--ink);
  background: repeating-linear-gradient(var(--paper) 0 27px, var(--line) 27px 28px);
  font: 1rem/1.55 var(--sans);
  min-height: 100vh;
}

a { color: var(--ink-green); text-underline-offset: .16em; }
a:hover { text-decoration-thickness: 2px; }
input, select, button { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid #9a681d; outline-offset: 3px; }
::selection { background: var(--brass-light); }

.skip-link {
  position: absolute;
  z-index: 3;
  inset: 6px auto auto 6px;
  transform: translateY(calc(-100% - 6px));
  padding: 8px 16px;
  background: var(--card);
}

.skip-link:focus { transform: none; }

.topbar { background: var(--ink-green); color: var(--paper); border-bottom: 3px solid var(--brass); }
.header-content {
  max-width: 1230px;
  min-height: 66px;
  margin: 0 auto;
  padding: 11px 22px;
  display: flex;
  gap: 12px 20px;
  align-items: center;
  justify-content: space-between;
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; line-height: 1.2; }
.brand strong { display: block; font: 700 1.08rem/1.25 var(--serif); }
.brand small { color: var(--brass-light); font-size: .75rem; }
.seal {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  color: var(--brass-light);
  border: 2px solid var(--brass-light);
  border-radius: 50%;
  font: 700 .78rem var(--serif);
  background: radial-gradient(circle at 35% 30%, rgb(216 192 140 / 18%), transparent 70%);
}

.header-actions, .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  gap: .4rem;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-align: center;
  text-decoration: none;
  font-size: .875rem;
  font-weight: 700;
  line-height: 1.3;
}

.primary { background: var(--ink-green); color: var(--paper); }
.primary:hover { background: var(--ink-green-dark); }
.secondary { background: var(--paper-dark); color: var(--ink-green); border-color: var(--line); }
.secondary:hover { background: var(--line); }
.delete-action { color: var(--red); border-color: currentColor; background: transparent; }
.delete-action:hover { background: #f9e9e3; }
.danger { background: var(--red); color: #fff; }
.danger:hover { background: #7a2822; }
.ghost { color: var(--paper); border-color: rgb(243 239 226 / 45%); background: transparent; }
.ghost:hover { background: rgb(255 255 255 / 10%); }
.export { color: #20180a; background: var(--brass-light); border-color: var(--brass); }
.export:hover { background: var(--brass); }

.month-nav {
  background: var(--paper-dark);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
}
.tabs {
  max-width: 1180px;
  margin-inline: auto;
  display: flex;
  overflow-x: auto;
  scrollbar-width: thin;
  gap: 3px;
  padding: 8px 12px 0;
}
.tab {
  flex: 0 0 auto;
  padding: 9px 13px;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  text-decoration: none;
  font-size: .875rem;
  font-weight: 700;
}
.tab:focus-visible { outline-offset: -3px; }
.tab:hover { color: var(--ink-green); }
.tab[aria-current] { color: var(--ink-green); background: var(--card); box-shadow: inset 0 -3px var(--brass); }
.tab-home { margin-right: 4px; background: var(--ink-green); color: var(--paper); }
.tab-home:hover, .tab-home[aria-current] { color: var(--paper); background: var(--ink-green-dark); }
.tab-count { margin-left: .28rem; font-weight: 400; }

main { max-width: 1180px; margin-inline: auto; padding: 26px 22px 44px; min-height: 62vh; }
h1, h2, h3 { color: var(--ink-green); font-family: var(--serif); line-height: 1.25; overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(1.65rem, 4vw, 2.05rem); }
h2 { margin: 0 0 14px; font-size: 1.4rem; }

.cover {
  position: relative;
  margin-top: 14px;
  padding: 52px 46px 43px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow-deep);
  text-align: center;
}
.cover::before { content: ""; position: absolute; inset: 10px; border: 1px solid var(--brass-light); border-radius: 4px; pointer-events: none; }
.cover-seal {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 96px;
  height: 96px;
  margin: 0 auto 21px;
  border: 3px double var(--brass);
  border-radius: 50%;
  color: var(--ink-green);
  font-family: var(--serif);
  transform: rotate(-6deg);
}
.cover-seal b { font-size: 1.45rem; line-height: 1.05; }
.cover-seal span { color: var(--red); font-size: .75rem; letter-spacing: .08em; }
.cover h1 { max-width: 850px; margin-inline: auto; font-size: clamp(1.65rem, 4vw, 2.5rem); }
.cover-subtitle { color: var(--red); font-size: .82rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; margin: 12px 0 24px; }
.cover-lead { max-width: 660px; margin: 0 auto 26px; line-height: 1.7; }
.cover-cta { padding: 11px 24px; }
.cover-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 15px 38px; margin: 33px 0 0; padding-top: 22px; border-top: 1px dashed var(--line); }
.cover-stats dt { color: var(--ink-green); font: 700 1.65rem var(--serif); }
.cover-stats dd { margin: 0; color: var(--muted); font-size: .79rem; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 5px 0 18px; }
.eyebrow { color: var(--muted); font-size: .8rem; margin: 0 0 4px; }
.page-head .meta { color: var(--red); font-size: .9rem; margin: 5px 0 0; }
.breadcrumb { margin: 0 0 14px; font-size: .9rem; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  margin: 0 0 17px;
  padding: 12px 14px;
}
.field { display: grid; gap: 5px; min-width: 0; color: var(--ink-green); font-size: .88rem; font-weight: 700; }
.toolbar .field { flex: 1 1 210px; max-width: 100%; }
.field input:not([type=checkbox]), .field select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 7px 10px;
  color: var(--ink);
  background: white;
  border: 1px solid #b6aa8c;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 400;
}
.field-hint { color: var(--muted); font-size: .82rem; font-weight: 400; }
.checkbox { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.checkbox input { width: 1rem; height: 1rem; accent-color: var(--ink-green); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr)); gap: 16px; }
.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 16px 16px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-inline-start: 5px solid var(--accent, var(--brass));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-wrap: anywhere;
}
.accent-1 { --accent: #7c9082; }
.accent-2 { --accent: #8c6e52; }
.accent-3 { --accent: #5f7a6b; }
.accent-4 { --accent: #a67c52; }
.accent-5 { --accent: #6e8074; }
.accent-6 { --accent: #9b8148; }
.accent-7 { --accent: #4f6b57; }
.card h2 { margin: 0; color: var(--ink); font-size: 1.08rem; line-height: 1.36; }
.card .eyebrow { margin: 0; font-weight: 700; font-size: .69rem; text-transform: uppercase; letter-spacing: .055em; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 1px 0 5px; }
.chip { padding: 2px 8px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper-dark); color: var(--ink-green); font-size: .74rem; font-weight: 700; }
.chip-points { background: #efe7cf; border-color: var(--brass); color: #724e16; }
.chip-month { background: #e7ece4; color: var(--muted); border-style: dashed; }
.card-footer { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); font-size: .84rem; }
.card-footer .registration-status { color: var(--muted); margin-inline-start: auto; }

.notice { margin: 0; padding: 18px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); background: var(--card); text-align: center; }
.notice .button { margin: 12px auto 0; }
.message { margin: 10px 0; color: var(--ink-green); overflow-wrap: anywhere; }
.message:empty { margin: 0; }
.error { color: var(--red); }

.panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.login { max-width: 470px; margin: 22px auto; padding: 27px; }
.login h1 { margin-bottom: 20px; }
.fields { display: grid; gap: 14px; margin-bottom: 16px; }
.form-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr)); }
.span-form { grid-column: 1 / -1; }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: .9rem; }
td, th { padding: 10px 12px; vertical-align: top; overflow-wrap: anywhere; }
th { border-bottom: 2px solid var(--brass); background: var(--paper-dark); color: var(--ink-green); }
td { border-top: 1px solid var(--line); }
td:first-child { min-width: 140px; }
td:last-child .button { min-height: 35px; font-size: .82rem; padding: 6px 9px; }
.dates { white-space: nowrap; }
.results-count { color: var(--muted); font-size: .84rem; margin: 0 0 9px; }
.pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 15px 0 0; }
.pagination p { margin: 0; color: var(--muted); font-size: .88rem; }
.admin-section { margin: 24px 0 0; }

dialog {
  width: min(640px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  padding: 20px;
  border: 1px solid var(--brass);
  border-radius: 7px;
  color: var(--ink);
  background: var(--card);
  box-shadow: var(--shadow-deep);
}
dialog::backdrop { background: rgb(21 42 32 / 60%); }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 6px 0 0; }
.answers { display: grid; gap: 10px; margin: 0; }
.answers div { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.answers dt { color: var(--ink-green); font-weight: 700; overflow-wrap: anywhere; }
.answers dd { margin: 2px 0 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.status-enabled { color: var(--ink-green); }
.status-disabled { color: var(--red); }

footer { padding: 15px 20px 30px; color: var(--muted); text-align: center; font-size: .78rem; }

@media (max-width: 640px) {
  .header-content { padding: 10px 12px; flex-wrap: wrap; }
  .brand strong { font-size: .98rem; }
  .header-actions .button { min-height: 36px; }
  main { padding: 16px 12px 34px; }
  .cover { margin-top: 6px; padding: 32px 22px; }
  .cover-seal { width: 78px; height: 78px; }
  .cover-stats { gap: 12px 20px; margin-top: 22px; padding-top: 17px; }
  .cover-stats dt { font-size: 1.4rem; }
  .panel { padding: 16px; }
  .login { margin: 10px auto; }
  .toolbar { padding: 10px; }
  .toolbar .field { flex-basis: 100%; }
  dialog { padding: 14px; }
}
