:root {
  color-scheme: light;
  font: 15px/1.5 system-ui, "Segoe UI", sans-serif;
  color: #242424;
  background: #fff;
  --muted: #555;
  --line: #d8d8d8;
  --control-line: #777;
  --hover: #f3f3f3;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, p, dl, dd, figure { margin: 0; }
button, input { font: inherit; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid #222; outline-offset: 3px; }

.shell { width: min(100% - 36px, 840px); margin-inline: auto; }
.topbar { border-bottom: 1px solid var(--line); }
.topbar-inner, .topbar nav { display: flex; flex-wrap: wrap; align-items: center; }
.topbar-inner { min-height: 54px; justify-content: space-between; gap: 0 18px; }
.topbar nav { gap: 0 14px; }
.brand, .topbar-link { display: inline-flex; align-items: center; min-height: 44px; }
.brand { font-size: 1.0625rem; font-weight: 700; text-decoration: none; }
.topbar-link, .quiet { font-size: .9rem; }

main { padding-block: 28px 40px; }
.page-heading { margin-bottom: 16px; }
h1 { font-size: clamp(1.4rem, 5vw, 1.8rem); line-height: 1.2; }
h2 { font-size: 1.15rem; line-height: 1.25; }
.state { display: grid; justify-items: start; gap: 10px; padding-block: 12px; border-top: 1px solid var(--line); }
.profile { display: flex; flex-wrap: wrap; gap: 5px 20px; padding-block: 8px; border-block: 1px solid var(--line); }
.profile > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; min-width: 0; }
.profile dt { color: var(--muted); font-size: .875rem; }
.profile dd { overflow-wrap: anywhere; font-weight: 650; }

.button, input {
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--control-line);
  border-radius: 0;
  color: inherit;
  background: #fff;
}
.button { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; }
.button:hover:not(:disabled) { background: var(--hover); }
.button:disabled { color: var(--muted); cursor: default; }
.primary { color: #fff; background: #333; border-color: #333; }
.primary:hover:not(:disabled) { background: #1c1c1c; }
.quiet { border-color: transparent; padding-inline: 6px; }

.history { margin-top: 24px; }
.history-heading, .month-form { display: flex; flex-wrap: wrap; align-items: center; }
.history-heading { justify-content: space-between; gap: 8px 16px; }
.month-form { gap: 6px 8px; }
.month-form input { min-width: 0; max-width: 100%; }
.month-form label, .retention-info, .history-status, .item-meta { color: var(--muted); font-size: .875rem; }
.retention-info > summary { width: fit-content; min-height: 44px; padding-block: 10px; cursor: pointer; }
.retention { max-width: 64ch; margin-bottom: 8px; }
.history-status { margin-block: 3px 8px; min-height: 1.4em; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  margin: -1px;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.more { margin-top: 10px; }

#history-list:not(:empty) { border-top: 1px solid var(--line); }
#history-list > details { border-bottom: 1px solid var(--line); }
#history-list > details > summary {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 14px;
  min-height: 44px;
  padding: 7px 25px 7px 6px;
  list-style: none;
  cursor: pointer;
}
#history-list > details > summary::-webkit-details-marker { display: none; }
#history-list > details > summary:hover, #history-list > details[open] > summary { background: var(--hover); }
#history-list > details > summary::after {
  position: absolute;
  inset-inline-end: 9px;
  top: calc(50% - 5px);
  width: 7px;
  height: 7px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg);
  content: "";
}
#history-list > details[open] > summary::after { transform: rotate(225deg); }
.item-title { overflow-wrap: anywhere; font-weight: 600; }
.item-body { display: grid; gap: 10px; padding: 10px 6px 12px; }
.item-body dt { color: var(--muted); font-size: .875rem; font-weight: 600; }
.item-body dd { margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.item-body pre { margin: 0; padding: 8px; border: 1px solid var(--line); background: var(--hover); white-space: pre-wrap; overflow-wrap: anywhere; }
.item-body figure { display: grid; justify-items: start; gap: 6px; }
.item-body img { display: block; max-width: 100%; max-height: 75vh; object-fit: contain; border: 1px solid var(--line); }
.item-body figcaption { color: var(--muted); font-size: .875rem; }
.snapshot { justify-self: start; }

@media (max-width: 520px) {
  .shell { width: calc(100% - 28px); }
  main { padding-top: 20px; }
  .profile { gap: 4px 14px; }
  #history-list > details > summary { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 390px) {
  .month-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; width: 100%; }
  .month-form label { grid-column: 1 / -1; }
}
