:root {
  color-scheme: light;
  --ink: #29231e;
  --muted: #665e52;
  --paper: #f6f1e7;
  --surface: #fffcf7;
  --line: #ded6c9;
  --dark: #30271f;
  --dark-raised: #49382b;
  --accent: #7b4029;
  --accent-hover: #5e2f1d;
  --focus: #914c2f;
  --danger: #81282a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(48,39,31,.06), 0 4px 14px rgba(48,39,31,.035);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
:where(a) { color: var(--accent); text-underline-offset: .2em; }
:where(a:hover) { color: var(--accent-hover); }
:where(button, input, select, textarea) { font: inherit; }
:where(button, summary) { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
:where(h1, h2, h3, p) { margin: 0; }
:where(h1, h2, h3) { line-height: 1.15; }
h1 { font: 600 clamp(2rem, 5vw, 3.2rem) / 1.05 Georgia, "Times New Roman", serif; letter-spacing: -.045em; overflow-wrap: anywhere; }
h2 { font: 600 1.6rem / 1.2 Georgia, "Times New Roman", serif; letter-spacing: -.02em; }
h3 { font-size: 1rem; }
:where(form p + p, section > p + p) { margin-top: .65rem; }
:where(button[disabled]) { cursor: not-allowed; opacity: .55; }
[hidden] { display: none !important; }
.skip-link { position: fixed; top: 10px; left: 10px; transform: translateY(-150%); background: white; padding: .6rem .8rem; z-index: 20; }
.skip-link:focus { transform: translateY(0); }

.app { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; align-self: start; position: sticky; top: 0; min-height: 100vh; background: var(--dark); color: #f9ede1; padding: 1.55rem .95rem 1rem; }
.sidebar :focus-visible { outline-color: #ffc391; }
.wordmark { color: #fff2e4; text-decoration: none; display: flex; gap: .8rem; align-items: center; margin: 0 .4rem 2.25rem; min-height: 3.15rem; }
.wordmark:hover { color: #fff2e4; }
.wordmark-copy { display: grid; line-height: 1.2; }
.wordmark strong { font: 600 1.38rem / 1.1 Georgia, "Times New Roman", serif; }
.wordmark small { color: #dbbca6; font-size: .78rem; margin-top: .34rem; }
.barrel { display: inline-block; width: 2.55rem; height: 2.85rem; flex: 0 0 2.55rem; color: #e2ad82; border: 2px solid currentColor; border-radius: 24% / 50%; position: relative; background-image: linear-gradient(to right, transparent 29%, currentColor 31%, transparent 34%, transparent 65%, currentColor 67%, transparent 70%); }
.barrel::before, .barrel::after { content: ""; position: absolute; right: 0; left: 0; height: 2px; background-color: currentColor; top: 25%; }
.barrel::after { top: auto; bottom: 25%; }
.app-nav { display: grid; gap: .3rem; }
.app-nav a { display: flex; gap: .68rem; align-items: center; padding: .68rem .72rem; min-height: 44px; border-radius: 8px; color: #f7e9da; text-decoration: none; font-weight: 550; }
.app-nav a:hover, .app-nav a[aria-current] { background-color: var(--dark-raised); }
.app-nav a[aria-current] { box-shadow: inset 3px 0 #deb087; color: #fff5e9; }
.nav-icon { width: 1.2rem; text-align: center; color: #e2ad82; font-size: 1.1rem; }
.account { display: flex; gap: .55rem; align-items: center; border-top: 1px solid #5f4a3c; padding: .85rem .35rem 0; margin-top: auto; }
.avatar { background: #624938; color: #fff0e1; width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 50%; font-weight: 750; flex: 0 0 2rem; }
.account-name { overflow-wrap: anywhere; flex: 1; font-size: .88rem; }
.account button { border: 0; color: #fff0e1; background: transparent; font-size: 1.25rem; padding: .3rem; min-width: 40px; min-height: 40px; border-radius: 6px; }
.account button:hover { background-color: var(--dark-raised); }
.exit-glyph { display: inline-block; border-left: 1px solid currentColor; padding-left: .12rem; line-height: .68; }
.workspace { width: min(100%, 1390px); margin-inline: auto; padding: clamp(1.1rem, 3.1vw, 3.2rem); }
.workspace:focus { outline: none; }
.app-nav + .account { margin-block-start: auto; }

.page-heading { display: flex; align-items: end; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-bottom: 1.55rem; }
.page-heading > div:first-child { min-width: 0; }
.page-heading p { margin-top: .55rem; }
.breadcrumb { color: var(--muted); font-size: .85rem; margin-bottom: .7rem; }
.breadcrumb a { color: inherit; }

.panel, .details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; margin-bottom: 1rem; min-width: 0; }
.panel > h2, .panel > h3 { margin-bottom: .75rem; }
.panel > :last-child { margin-bottom: 0; }
.panel > .actions + .table-wrap { margin-top: .7rem; }
.panel-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .65rem; margin-bottom: .9rem; }
.panel-header > * { margin: 0; }
.panel-stack { display: grid; gap: 1rem; }
.panel-stack > * { margin-bottom: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.toolbar, .actions { display: flex; align-items: end; flex-wrap: wrap; gap: .55rem; }
.toolbar > * { min-width: 0; }
.toolbar .grow { flex: 1 1 18rem; }
.toolbar .narrow { flex: 0 1 9.5rem; }
.actions { align-items: center; }
.actions form { display: inline-flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.button, main button:not(.plain-button), .pagination a { display: inline-flex; justify-content: center; align-items: center; gap: .4rem; background: var(--accent); color: white; text-decoration: none; padding: .58rem .86rem; border: 1px solid transparent; border-radius: 7px; min-height: 42px; font-size: .9rem; font-weight: 650; line-height: 1.2; cursor: pointer; text-align: center; }
.button:hover, main button:not(.plain-button):hover, .pagination a:hover { background: var(--accent-hover); color: white; }
.button.secondary, main button.secondary:not(.plain-button), .pagination a { background: var(--surface); color: var(--ink); border-color: var(--line); }
.button.secondary:hover, main button.secondary:not(.plain-button):hover, .pagination a:hover { background: #efe5d7; color: #3f2b20; }
.button.danger, main button.danger:not(.plain-button) { background: var(--danger); color: white; }
.button.danger:hover, main button.danger:not(.plain-button):hover { background: #612022; }
.button.small, main button.small:not(.plain-button) { padding: .38rem .58rem; min-height: 34px; font-size: .82rem; }
.plain-button { border: 0; padding: .15rem .2rem; color: var(--accent); background: none; text-decoration: underline; text-underline-offset: .2em; }
.muted, .helptext { color: var(--muted); }
.helptext { font-size: .86rem; }
.quiet { color: var(--muted); font-size: .9rem; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: .12rem .5rem; color: #3e342a; background: #f5ebdf; border: 1px solid rgba(65,45,26,.17); border-radius: 5px; font-weight: 650; font-size: .78rem; white-space: nowrap; line-height: 1.35; }
.badge.recent { background: #e8f4e9; color: #255834; }
.badge.watch { background: #fbf0da; color: #66521c; }
.badge.old { background: #fae5df; color: #7d3727; }
.badge.never { background: #f1eee9; color: #554d44; }
.badge.status { background: var(--state-color, #f5ebdf); color: var(--state-text, #29231e); }
.badge.status-ack { background: #fff; color: #29231e; }
.count { font-size: .84rem; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); padding: 1.5rem .5rem; text-align: center; }
.notifications { margin-bottom: 1rem; display: grid; gap: .5rem; }
.notice { padding: .7rem .9rem; border: 1px solid #cfba9d; background: #f7eddf; border-radius: 8px; overflow-wrap: anywhere; }
.notice.error, .errorlist { color: var(--danger); }
.notice.error { border-color: #ceaaa4; background: #fff0ed; }
.notice.success { border-color: #aabda3; background: #edf4e9; color: #36552e; }
.notice.warning { border-color: #d7b575; background: #fff5e0; }
.errorlist { margin: .35rem 0 0; padding-left: 1.2rem; font-size: .9rem; }
.errorlist.nonfield { border: 1px solid #ceaaa4; border-radius: 7px; margin-bottom: .65rem; padding: .55rem 1rem .55rem 1.6rem; background: #fff0ed; }

.field, .form-stack, form > p { display: grid; gap: .26rem; }
.form-stack { gap: .8rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1rem; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid + .actions, .form-stack + .actions, form > .actions:last-child { margin-top: .85rem; }
.form-grid legend { padding: 0; font-weight: 700; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0; padding: .7rem .9rem .9rem; min-width: 0; }
label { font-size: .86rem; font-weight: 650; }
input:not([type="checkbox"],[type="radio"],[type="hidden"],[type="color"],[type="submit"]),
select, textarea { width: 100%; min-width: 0; min-height: 42px; border: 1px solid #c6bbab; border-radius: 7px; background: #fffdfa; color: var(--ink); padding: .5rem .65rem; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); inline-size: 1.1rem; block-size: 1.1rem; margin: .15rem .4rem .15rem 0; vertical-align: middle; }
input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="color"] { padding: .16rem; min-height: 40px; min-width: 57px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
textarea { min-height: 6rem; resize: vertical; }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
.checkbox { display: flex; align-items: center; gap: .3rem; min-height: 43px; }

.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; }
td, th { padding: .65rem .75rem; border-bottom: 1px solid rgba(65,45,26,.13); vertical-align: top; }
thead th { background: #f0e7d9; color: #45392e; font-size: .8rem; font-weight: 750; white-space: nowrap; }
tbody > tr:last-child > * { border-bottom: 0; }
td .quiet, td small { display: block; }
td a { overflow-wrap: anywhere; }
.month-row th { padding: .44rem .75rem; color: #514135; background: #f1e8d9; font-size: .81rem; font-weight: 750; letter-spacing: .045em; text-transform: uppercase; }
.month-row + .edition-row > * { border-top: 0; }
.edition-row { background-color: var(--state-color, #f9f3e9); }
.edition-row > *, .edition-row a, .edition-row .quiet, .edition-row .inline-details summary,
.edition-row .state-cell .badge { color: var(--state-text, #29231e); }
.edition-row td:first-child { font-variant-numeric: tabular-nums; }
.edition-row.is-provisional > * { font-weight: 700; }
.edition-row .state-cell { white-space: nowrap; }
.edition-row.status-ack .state-cell { background-color: #fff; }
.edition-row.status-ack .state-cell, .edition-row.status-ack .state-cell .badge { color: #29231e; }
.edition-row .state-cell .badge { background-color: transparent; }
.edition-row .event-link { font-weight: inherit; }
.edition-row .quote-links { display: grid; gap: .25rem; }
.edition-row .quote-links a { font-size: .82rem; white-space: nowrap; }
.status-contact { --state-color: #ffff99; }
.status-quote, .status-ack { --state-color: #ffcc99; }
.status-option { --state-color: #99ffcc; }
.status-contract, .status-signed { --state-color: #66cc99; }
.status-no { --state-color: #ff8080; }
.status-hs { --state-color: #ece5db; }

.data-pairs { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .44rem .8rem; margin: 0; }
.data-pairs dt { color: var(--muted); font-size: .88rem; }
.data-pairs dd { margin: 0; overflow-wrap: anywhere; }
.record-list { list-style: none; padding: 0; margin: 0; }
.record-list > li + li { border-top: 1px solid var(--line); }
.record-list > li { padding: .62rem 0; overflow-wrap: anywhere; }
.record-list > li:first-child { padding-top: 0; }
.record-list > li:last-child { padding-bottom: 0; }
.inline-details { min-width: 9rem; }
.inline-details summary { text-decoration: underline; text-underline-offset: .16em; font-size: .82rem; }
.inline-details[open] { min-width: min(15rem, 100%); }
.inline-details form { display: grid; gap: .4rem; margin: .4rem 0 0; }
.inline-details textarea { min-height: 4rem; }
.activity-log { padding: 0; margin: 0; list-style: none; }
.activity-log > li { border-left: 2px solid #ceb69c; padding: .4rem 0 .55rem .75rem; overflow-wrap: anywhere; }
.activity-log > li + li { margin-top: .35rem; }
.calendar-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .75rem; }
.calendar-grid > * { min-width: 0; }
.year-control { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; }
.year-control a { min-height: 39px; min-width: 38px; }
.year-control input { max-width: 6rem; }
.year-control strong { min-width: 3.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.auth-main { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 1.2rem; background: radial-gradient(ellipse at 25% 0, #524030, var(--dark) 55%); }
.auth-main > .notifications { position: fixed; top: 1rem; }
.auth-card { width: min(100%, 435px); background: var(--surface); border-radius: 15px; padding: clamp(1.5rem, 5vw, 2.55rem); box-shadow: 0 15px 50px #18151270; }
.auth-card .barrel { color: #a26643; }
.auth-brand { margin-top: .65rem; color: var(--accent); font-weight: 700; }
.auth-card h1 { font-size: clamp(1.8rem, 6vw, 2.65rem); margin: .1rem 0 1.4rem; }
.auth-card h2 { font-size: 1.23rem; letter-spacing: 0; margin-bottom: .75rem; }
.auth-card button { margin-top: .25rem; }
.color-preview { display: grid; grid-template-columns: 1fr auto; align-items: center; min-height: 40px; border-radius: 6px; overflow: hidden; color: var(--state-text, #29231e); border: 1px solid var(--line); background-color: var(--state-color, #f5e6da); }
.color-preview > * { padding: .38rem .6rem; }
.color-preview .badge { border-radius: 0; border: 0; min-height: 100%; }
.color-preview:not(.status-ack) .badge { background-color: transparent; color: inherit; }
.color-row { display: grid; grid-template-columns: 10rem 4rem 1fr; align-items: center; gap: .6rem; }
.color-row + .color-row { margin-top: .65rem; }

@media (max-width: 1040px) {
  .app { grid-template-columns: 185px minmax(0,1fr); }
  .workspace { padding: 1.2rem; }
  .sidebar { padding-inline: .65rem; }
  .calendar-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 760px) {
  .app { display: block; }
  .sidebar { position: static; padding: .65rem .85rem .4rem; min-height: auto; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .25rem; }
  .wordmark { margin: 0; min-height: 2.75rem; }
  .wordmark .barrel { width: 1.78rem; height: 2rem; flex-basis: 1.78rem; }
  .wordmark strong { font-size: 1.17rem; }
  .wordmark small { margin-top: .18rem; font-size: .73rem; }
  .account { grid-column: 2; grid-row: 1; border: 0; padding: 0; align-self: center; }
  .account .avatar { display: none; }
  .app-nav { display: flex; flex-wrap: wrap; grid-column: 1 / -1; gap: 0 .2rem; }
  .app-nav a { display: flex; gap: .26rem; padding: .4rem .5rem; font-size: .83rem; min-height: 41px; }
  .app-nav a[aria-current] { box-shadow: inset 0 -2px #deb087; }
  .nav-icon { width: auto; font-size: .95rem; }
  .workspace { padding: 1rem .85rem; }
  .split, .form-grid { grid-template-columns: minmax(0,1fr); }
  .form-grid .wide { grid-column: auto; }
  .annual-table, .annual-table tbody, .annual-table tr, .annual-table td, .annual-table th,
  .archive-table, .archive-table tbody, .archive-table tr, .archive-table td, .archive-table th { display: block; width: 100%; }
  .annual-table thead, .archive-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .annual-table .edition-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding: .45rem .65rem; border-bottom: 1px solid rgba(65,45,26,.18); }
  .annual-table .edition-row:last-child { border-bottom: 0; }
  .annual-table .edition-row .event-cell { grid-column: 1 / -1; grid-row: 1; order: -1; font-size: 1.05rem; }
  .annual-table .edition-row > td { border: 0; padding: .26rem .1rem; white-space: normal; overflow-wrap: anywhere; }
  .annual-table .edition-row > td[data-label]::before { content: attr(data-label); display: block; font-size: .73rem; font-weight: 650; color: var(--state-text, #29231e); }
  .annual-table .edition-row.status-ack > .state-cell[data-label]::before { color: #29231e; }
  .annual-table .edition-row > .state-cell { padding-inline: .3rem; }
  .annual-table .edition-row > .wide-cell { grid-column: 1 / -1; }
  .annual-table .edition-row > .empty-quotes { display: none; }
  .annual-table .month-row th { padding: .35rem .65rem; }
  .archive-table tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding: .48rem .65rem; }
  .archive-table tr + tr { border-top: 1px solid var(--line); }
  .archive-table td { border: 0; padding: .26rem .1rem; overflow-wrap: anywhere; }
  .archive-table td[data-label]:not(.archive-title)::before { content: attr(data-label); display: block; color: var(--muted); font-size: .73rem; font-weight: 650; }
  .archive-table .archive-title, .archive-table .archive-files, .archive-table td[colspan] { grid-column: 1 / -1; }
  .archive-table .archive-title { font-weight: 700; }
  .color-row { grid-template-columns: 1fr 4rem; }
  .color-row .color-preview { grid-column: 1 / -1; }
}

@media (max-width: 420px) {
  .calendar-grid { grid-template-columns: minmax(0,1fr); }
  .page-heading .actions { width: 100%; }
  .page-heading .actions .button { padding-inline: .63rem; font-size: .84rem; }
  .app-nav a { gap: .22rem; padding-inline: .36rem; font-size: .78rem; }
  .toolbar .narrow { flex: 1 1 8rem; }
  .data-pairs { grid-template-columns: minmax(0, 1fr); gap: .13rem; }
  .data-pairs dd + dt { margin-top: .45rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.reset-link { align-self: center; font-size: .85rem; }
.detail-meta, .contact-channels { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .65rem; }
.contact-channels { margin: .26rem 0; }
.record-item { display: flex; align-items: start; justify-content: space-between; gap: .7rem; flex-wrap: wrap; }
.record-item > a, .record-item .actions > a, .comment-text + .actions > a { font-size: .85rem; }
.organizer-address { font-style: normal; margin-bottom: .8rem; }
.divided { margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.panel-actions, .detail-section { margin-top: 1rem; }
.comment-form { margin-bottom: .8rem; }
.comment-text { margin: .25rem 0; }
.warning-panel { border-color: #d7b575; background: #fff5e0; }

.narrow-panel { max-width: 48rem; }
.form-stack > div:has(> input:not([type="hidden"]), > select, > textarea) { display: grid; gap: .26rem; }
.form-stack > div:has(> input[type="checkbox"]) { display: flex; align-items: center; }
.form-stack > .panel { margin-bottom: 0; }
.setting-label { font-size: .86rem; font-weight: 650; }
.calendar-option { background: #c6f8ea; color: #173f38; border-color: #82bfb0; }
.calendar-signed { background: #9cd8bc; color: #174834; border-color: #589b80; }
.calendar-month { margin-bottom: 0; }
.page-heading h1 + .toolbar { margin-top: .65rem; }
.calendar-periods, .hs-matches ul { list-style: none; margin: 0; padding: 0; }
.calendar-periods > li + li, .renewal-candidates > div + div { border-top: 1px solid var(--line); margin-top: .45rem; padding-top: .45rem; }
.calendar-periods small { display: block; color: var(--muted); margin-top: .23rem; }
.calendar-grid + .panel { margin-top: 1rem; }
.renewal-candidates { margin-bottom: .85rem; }
.renewal-candidate { display: flex; min-height: 40px; align-items: center; gap: .3rem; }
.renewal-candidate input { flex: 0 0 auto; }
.hs-matches { background: #fff5e0; border: 1px solid #d7b575; border-radius: 8px; padding: .65rem .75rem; margin-bottom: .8rem; }
.hs-matches ul { margin-top: .4rem; }
.hs-matches li + li { margin-top: .6rem; }
