:root {
  color-scheme: light;
  --canvas: #f5f4ee;
  --surface: #fffefa;
  --ink: #1b2b2b;
  --muted: #546465;
  --border: #d7ddd6;
  --slate: #192d31;
  --slate-text: #e0ebe6;
  --accent: #006448;
  --accent-hover: #004d38;
  --accent-light: #def2e8;
  --mint: #78ebba;
  --error: #9c2d20;
  --error-bg: #fceee9;
  --radius: 12px;
  --sans: "Aptos", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --display: "Manrope", "Aptos Display", var(--sans);
}

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 1rem/1.5 var(--sans);
}

h1, h2, h3, p, dl, dd { margin: 0; }

h1, h2, h3 {
  font-family: var(--display);
  line-height: 1.14;
  overflow-wrap: anywhere;
}

h1 {
  font-size: 2.8rem;
  font-weight: 750;
  letter-spacing: -.055em;
}

h2 {
  font-size: 1.27rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

h3 { font-size: 1rem; }

a {
  color: var(--accent);
  text-decoration-color: #59947e;
  text-underline-offset: .17em;
}

a:hover { color: var(--accent-hover); }

button, input, select, textarea { font: inherit; }

:focus-visible {
  outline: 3px solid #008967;
  outline-offset: 3px;
}

time, .numeric { font-variant-numeric: tabular-nums; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.muted { color: var(--muted); }
.numeric { text-align: right; }
.nowrap { white-space: nowrap; }

.shell {
  width: min(100% - 72px, 1232px);
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 3;
  top: 10px;
  left: 10px;
  padding: 10px 16px;
  transform: translateY(calc(-100% - 13px));
  border-radius: 6px;
  background: var(--surface);
}

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

.topbar {
  background: var(--slate);
  color: var(--slate-text);
}

.topbar-inner {
  display: grid;
  min-height: 68px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 34px;
}

.topbar :focus-visible { outline-color: var(--mint); }

.brand {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 11px;
  color: #fff;
  font-family: var(--display);
  font-size: 1.12rem;
  font-weight: 750;
  letter-spacing: -.025em;
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover { color: var(--mint); }

.brand-mark {
  display: inline-flex;
  width: 29px;
  height: 29px;
  align-items: end;
  justify-content: center;
  gap: 2px;
  padding-bottom: 6px;
  border-radius: 8px;
  background: var(--mint);
}

.brand-mark i {
  width: 3px;
  height: 7px;
  border-radius: 2px 2px 0 0;
  background: var(--slate);
}

.brand-mark i:nth-child(2) { height: 11px; }
.brand-mark i:nth-child(3) { height: 16px; }

.navigation {
  display: flex;
  align-self: stretch;
  gap: 4px;
}

.navigation a {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-block: 3px solid transparent;
  color: var(--slate-text);
  font-size: .9rem;
  font-weight: 650;
  text-decoration: none;
}

.navigation a:hover, .navigation [aria-current] {
  background: #294146;
  color: #fff;
}

.navigation [aria-current] { border-bottom-color: var(--mint); }

.logout button {
  min-height: 40px;
  padding: 5px 0 5px 8px;
  border: 0;
  background: transparent;
  color: var(--slate-text);
  cursor: pointer;
}

.logout button:hover { color: var(--mint); }

.page { padding-block: 36px 64px; }
.page:focus { outline: none; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px 24px;
  margin-bottom: 26px;
}

.page-header > div { min-width: 0; }

.actions, .record-meta, .section-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.actions { flex: 0 0 auto; }

.record-meta { margin-top: 12px; }

.record-meta, .section-meta {
  column-gap: 16px;
  color: var(--muted);
  font-size: .88rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  font-size: .9rem;
  font-weight: 650;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 8px 15px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.button:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: #fff;
}

.button-secondary {
  border-color: #9cb8aa;
  background: var(--surface);
  color: var(--accent);
}

.button-secondary:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent-hover);
}

.text-button {
  min-height: 38px;
  padding: 5px 10px;
  border: 1px solid #b5cfc2;
  border-radius: 6px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  font-size: .84rem;
  font-weight: 700;
  white-space: nowrap;
}

.text-button:hover { background: var(--accent-light); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--border);
  overflow: hidden;
}

.stats > div {
  padding: 15px 19px;
  background: var(--surface);
}

.stats-seller { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stats-metrics { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }

.stats dt, .details-grid dt {
  color: var(--muted);
  font-size: .86rem;
  font-weight: 650;
}

.stats dd {
  margin-top: 3px;
  font: 720 1.7rem/1.14 var(--display);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
  overflow-wrap: anywhere;
}

.stats dd.metric-detail {
  margin-top: 6px;
  color: var(--muted);
  font: .81rem/1.35 var(--sans);
  letter-spacing: normal;
}

.panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel + .panel { margin-top: 22px; }

.panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 17px 19px;
}

.panel-header a { font-size: .88rem; }

.empty { padding: 17px 19px 21px; color: var(--muted); }

.table-wrap {
  max-width: 100%;
  overflow: auto;
  border-radius: 0 0 var(--radius) var(--radius);
}

.table-wrap:focus-visible { outline-offset: -3px; }

.panel > .table-wrap:first-child { border-radius: var(--radius); }

table {
  width: 100%;
  min-width: 490px;
  border-collapse: collapse;
  text-align: left;
}

.wide-table { min-width: 650px; }

th, td {
  padding: 11px 16px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

th:first-child, td:first-child { padding-left: 19px; }
th:last-child, td:last-child { padding-right: 19px; }

thead {
  background: #eef1e9;
  color: #465858;
  font-size: .8rem;
  line-height: 1.3;
}

.panel > .table-wrap:first-child th { border-top: 0; }

tbody { font-size: .9rem; }
tbody th { font-weight: 650; }
tbody tr:hover { background: #f7faf4; }
tbody td a, tbody th a { overflow-wrap: anywhere; }

.cell-meta {
  margin-top: 3px;
  font-size: .81rem;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.source-url { display: block; }

.pill {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 5px;
  background: #edf0ea;
  color: #374c49;
  font-size: .78rem;
  font-weight: 650;
  line-height: 1.4;
}

.pill-accent {
  background: var(--accent-light);
  color: var(--accent-hover);
}

.table-actions {
  display: grid;
  gap: 5px;
  min-width: 130px;
  font-size: .82rem;
}

.inbox-layout, .listing-layout {
  display: grid;
  align-items: start;
  gap: 22px;
}

.inbox-layout { grid-template-columns: minmax(240px, 290px) minmax(0, 1fr); }
.listing-layout { grid-template-columns: minmax(0, 1fr) minmax(230px, 290px); }

.form-panel { padding: 19px; }
.form-panel > h2, .login-panel > h1 { margin-bottom: 16px; }

.stack-form { display: grid; gap: 13px; }
.stack-form > div { min-width: 0; }
.stack-form > .button { justify-self: start; }

.stack-form label, .stack-form legend {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: .89rem;
  font-weight: 650;
}

.stack-form input:not([type="checkbox"], [type="radio"], [type="hidden"]),
.stack-form select,
.stack-form textarea {
  width: 100%;
  min-width: 0;
  min-height: 41px;
  padding: 8px 10px;
  border: 1px solid #aebdb4;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.stack-form textarea { min-height: 94px; resize: vertical; }

.stack-form input[type="checkbox"], .stack-form input[type="radio"] { accent-color: var(--accent); }
.stack-form label:has(input[type="checkbox"], input[type="radio"]) { display: inline; }
.stack-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }

.stack-form :is(input, select, textarea)[aria-invalid="true"] { border-color: var(--error); }

.helptext {
  margin-block: 4px;
  color: var(--muted);
  font-size: .82rem;
  overflow-wrap: anywhere;
}

.errorlist, .messages {
  padding: 0;
  list-style: none;
  overflow-wrap: anywhere;
}

.errorlist {
  margin: 0 0 5px;
  color: var(--error);
  font-size: .86rem;
}

.errorlist.nonfield, .messages li {
  padding: 10px 13px;
  border-radius: 6px;
}

.messages { display: grid; gap: 6px; margin: 0 0 22px; }

.messages li {
  border: 1px solid #a6c8b7;
  background: var(--accent-light);
  color: var(--accent-hover);
}

.errorlist.nonfield, .messages li.error {
  border: 1px solid #e8b6a9;
  background: var(--error-bg);
  color: var(--error);
}

.kind-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.kind-nav a {
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-weight: 650;
  text-decoration: none;
}

.kind-nav a:hover, .kind-nav [aria-current] {
  border-color: #99c4ad;
  background: var(--accent-light);
  color: var(--accent-hover);
}

.capture-panel { max-width: 860px; }

.capture-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.capture-form > :is(
  .errorlist,
  .button,
  div:has(textarea),
  div:has(input[type="url"], input[name="url"], input[name="seller_url"]),
  div:has(fieldset)
) { grid-column: 1 / -1; }

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px 20px;
  padding: 0 19px 19px;
}

.details-grid dd { overflow-wrap: anywhere; }

.price { font-size: 1.1rem; font-weight: 750; }
.price del { color: var(--muted); font-size: .84rem; font-weight: 400; }

.detail-section {
  padding: 15px 19px 18px;
  border-top: 1px solid var(--border);
}

.detail-section h3 { margin-bottom: 9px; }

.note-section { background: #f9f2e3; }

.formatted-text { white-space: pre-wrap; overflow-wrap: anywhere; }

.related-list {
  margin: 0 0 16px;
  padding-inline-start: 18px;
}

.related-list li + li { margin-top: 6px; }

.candidate-list, .record-list, .timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.candidate-list li {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(290px, 4fr);
  align-items: center;
  gap: 12px 24px;
  padding: 17px 19px;
}

.candidate-list li + li { border-top: 1px solid var(--border); }
.candidate-info h2 { font-size: 1.04rem; }
.candidate-info .record-meta { margin-top: 6px; }
.next-step { gap: 0; }

.next-step > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.record-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 16px;
  padding: 10px 19px;
  border-top: 1px solid var(--border);
}

.record-list li > span { overflow-wrap: anywhere; }

.timeline-entry {
  position: relative;
  padding: 13px 19px 16px 39px;
  border-top: 1px solid var(--border);
}

.timeline-entry::before {
  position: absolute;
  top: 21px;
  left: 20px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  content: "";
}

.timeline-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 10px;
}

.timeline-heading a, .timeline-empty, .counter-note { font-size: .85rem; }
.counter-note, .timeline-empty { margin-top: 7px; }
.counter-note { color: var(--accent-hover); }

.changes { margin-top: 10px; }

.changes > div {
  padding: 8px 0 2px;
  border-top: 1px solid var(--border);
}

.changes dt { margin-bottom: 4px; font-size: .89rem; font-weight: 700; }
.changes dd { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.changes dd > div {
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 7px 8px;
  border-radius: 5px;
  background: #edf0ea;
  font-size: .86rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.changes dd > div + div { background: var(--accent-light); }

.change-label { color: var(--muted); font-size: .76rem; font-weight: 650; }

.login-panel {
  width: min(100%, 410px);
  margin: clamp(26px, 8vh, 85px) auto;
  padding: 24px;
  border-top: 3px solid var(--accent);
}

.login-panel h1 { font-size: 2rem; }
.login-panel .button { justify-self: stretch; }

@media (max-width: 950px) {
  .shell { width: calc(100% - 44px); }
  .inbox-layout { grid-template-columns: 1fr; }
  .inbox-layout > .panel + .panel { margin-top: 0; }
}

@media (max-width: 720px) {
  .page { padding-top: 25px; }
  .page-header { flex-direction: column; }
  .listing-layout, .candidate-list li { grid-template-columns: 1fr; }
  .stats-seller { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats-seller > div:last-child { grid-column: span 2; }
}

@media (max-width: 560px) {
  h1 { font-size: 2.15rem; }
  .shell { width: calc(100% - 28px); }
  .topbar-inner { grid-template-columns: 1fr auto; min-height: 58px; row-gap: 4px; column-gap: 12px; }
  .brand { margin-block: 12px 6px; }
  .logout { grid-column: 2; grid-row: 1; }
  .navigation { grid-column: 1 / -1; }
  .navigation a { padding-inline: 9px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats > div:nth-child(odd):last-child { grid-column: span 2; }
  .stats > div { padding: 12px; }
  .stats dd { font-size: 1.45rem; }
  .capture-form, .changes dd { grid-template-columns: 1fr; }
}
