/* cool neutrals to match the house (white walls, light gray, matte black hardware), one sage accent */
:root {
  --bg: #f5f6f4;
  --surface: #ffffff;
  --surface-2: #eef0ed;
  --ink: #1d201f;
  --ink-2: #4b5250;
  --muted: #646b68;
  --line: #dde1de;
  --line-strong: #c6ccc8;
  /* form fields need 3:1 against the surface to be findable */
  --field-border: #8a918d;
  --accent: #3b6a56;
  --accent-ink: #ffffff;
  --accent-soft: #e3ede7;
  --accent-text: #2f5747;
  --warn: #8a5a00;
  --warn-soft: #fbf0d9;
  --danger: #a3302a;
  --danger-soft: #fbe9e7;
  --research: #3f5f86;
  --research-soft: #e6edf6;
  --shadow: 0 1px 2px rgb(20 30 25 / 6%), 0 8px 24px -12px rgb(20 30 25 / 18%);
  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --tap: 44px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161817;
    --surface: #1f2221;
    --surface-2: #272b29;
    --ink: #eceeec;
    --ink-2: #c3c8c5;
    --muted: #9aa29e;
    --line: #313634;
    --line-strong: #434a47;
    --field-border: #6b7470;
    --accent: #8cc0a6;
    --accent-ink: #0f1a15;
    --accent-soft: #24332c;
    --accent-text: #a5d1bb;
    --warn: #e7b85c;
    --warn-soft: #3a2f1a;
    --danger: #f0928a;
    --danger-soft: #3d2220;
    --research: #9bb8de;
    --research-soft: #222c3a;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 28px -14px rgb(0 0 0 / 60%);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html.sheet-open {
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
  min-height: 100vh;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: var(--accent-text);
  text-underline-offset: 2px;
}

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

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

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

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 10;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.skip:focus {
  top: 12px;
}

.muted {
  color: var(--muted);
}

.wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

/* header */

.top {
  padding: calc(env(safe-area-inset-top) + 20px) 0 8px;
}

.top-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.top h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.home-line {
  color: var(--muted);
  margin-top: 2px;
}

.who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  max-width: 45%;
}

.who:hover {
  border-color: var(--line-strong);
}

.who-avatar,
.fb-avatar {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 650;
  font-family: var(--font-display);
  flex-shrink: 0;
}

.who-name {
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* send bar */

.sendbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-top: 16px;
  padding: 14px 14px 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.sendbar-text {
  flex: 1 1 220px;
  min-width: 0;
}

.run-status {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.run-status.is-running {
  color: var(--accent-text);
}

.run-status.is-failed {
  color: var(--danger);
}

.run-status.is-failed a {
  color: inherit;
}

.sendbar-hint {
  color: var(--muted);
  font-size: 0.9375rem;
}

.sendbar .btn-primary {
  flex: 0 0 auto;
}

.sendbar .inline-error {
  flex-basis: 100%;
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.3;
    transform: scale(0.75);
  }
}

.count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  margin-left: 4px;
  border-radius: 999px;
  background: rgb(255 255 255 / 22%);
  font-variant-numeric: tabular-nums;
  font-size: 0.875rem;
}

/* buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
}

.btn:hover {
  background: var(--surface-2);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  background: var(--accent);
  filter: brightness(1.08);
}

.btn-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn:disabled {
  cursor: not-allowed;
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--muted);
  filter: none;
}

.btn:disabled .count {
  background: var(--line);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  cursor: pointer;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.link-btn {
  border: 0;
  background: none;
  padding: 10px 0;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font-size: 0.875rem;
  min-height: var(--tap);
}

.icon,
.icon-sm {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.icon-sm {
  width: 15px;
  height: 15px;
}

/* overview */

.overview {
  margin-top: 28px;
}

.overview-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
}

.total {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
}

.total-num {
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.total-label,
.progress-text {
  color: var(--muted);
}

.progress-text {
  font-variant-numeric: tabular-nums;
}

/* one tile per item, so the strip reads as "how much of the house is done" */
.bar {
  display: flex;
  gap: 3px;
  margin-top: 12px;
  height: 14px;
}

.tile {
  flex: 1 1 0;
  min-width: 4px;
  border-radius: 4px;
  background: var(--line);
}

.tile-purchased {
  background: var(--accent);
}

.tile-decided {
  background: color-mix(in srgb, var(--accent) 45%, var(--surface));
}

.tile-ready {
  background: var(--warn);
}

.tile-researching {
  background: var(--research);
}

.tile-idea {
  background: var(--line-strong);
}

.tile-dropped {
  background: transparent;
  border: 1.5px dashed var(--line-strong);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 10px;
  font-size: 0.875rem;
  color: var(--muted);
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-n {
  color: var(--ink);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* filter chips */

.filters {
  margin-top: 20px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 0 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 550;
  font-size: 0.9375rem;
  white-space: nowrap;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--line-strong);
}

.chip-n {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.chip[aria-pressed="true"] .chip-n {
  color: inherit;
  opacity: 0.7;
}

/* list */

.list {
  margin-top: 12px;
  outline: none;
}

.group + .group {
  margin-top: 28px;
}

.group-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 1.125rem;
  font-weight: 650;
  margin: 16px 0 10px;
}

.group-n {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9375rem;
  font-family: var(--font);
}

.cards {
  display: grid;
  gap: 10px;
}

.card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.card:focus-visible {
  border-radius: var(--radius-lg);
}

.card-dropped {
  opacity: 0.6;
}

.card-dropped .card-name {
  text-decoration: line-through;
}

.photo {
  display: block;
  object-fit: contain;
  background: #fff;
  border-radius: var(--radius);
}

.photo-empty {
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--line-strong);
}

.photo-icon {
  width: 38%;
  height: 38%;
  max-width: 48px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.card-photo {
  width: 84px;
  height: 84px;
  flex-shrink: 0;
  align-self: flex-start;
}

.card-body {
  flex: 1;
  min-width: 0;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.card-name {
  margin-top: 6px;
  font-size: 1.0625rem;
  font-weight: 650;
}

.card-room {
  color: var(--muted);
  font-size: 0.875rem;
}

.card-purpose {
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 0.9375rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin-top: 6px;
  font-size: 0.875rem;
}

.card-price {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.card-pick {
  color: var(--muted);
}

.card-chevron {
  width: 20px;
  height: 20px;
  color: var(--line-strong);
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* pills */

.pill,
.prio,
.queued-tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill {
  background: var(--surface-2);
  color: var(--ink-2);
}

.pill-ready {
  background: var(--warn-soft);
  color: var(--warn);
}

.pill-researching {
  background: var(--research-soft);
  color: var(--research);
}

.pill-decided {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.pill-purchased {
  background: var(--accent);
  color: var(--accent-ink);
}

.prio {
  padding: 0 2px;
  color: var(--muted);
  font-weight: 500;
}

.prio-now {
  color: var(--ink);
  font-weight: 600;
}

.queued-tag {
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font-weight: 500;
}

/* states */

.state {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 48px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
}

.state .btn {
  margin-top: 10px;
}

.state-inline {
  padding: 32px 20px;
  margin-top: 24px;
}

.state-title {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.125rem;
  color: var(--ink);
}

.state-icon {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1.4;
  stroke-linejoin: round;
  margin-bottom: 4px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.inline-error {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.9375rem;
}

.offline {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.9375rem;
  box-shadow: var(--shadow);
  z-index: 5;
}

/* suggestions */

.suggest-block {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.suggest-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
}

.suggest-head h2 {
  font-size: 1.125rem;
  font-weight: 650;
}

.suggest-head > div {
  flex: 1 1 260px;
}

.suggest-block .thread {
  margin-top: 16px;
}

#main {
  padding-bottom: calc(env(safe-area-inset-bottom) + 48px);
}

/* feedback thread */

.thread {
  display: grid;
  gap: 10px;
}

.fb {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.fb-open {
  border-style: dashed;
  border-color: var(--line-strong);
}

.fb-pending {
  opacity: 0.75;
}

.fb-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 0.875rem;
}

.fb-avatar {
  width: 26px;
  height: 26px;
  font-size: 0.8125rem;
}

.fb-who {
  font-weight: 650;
}

.fb-time {
  color: var(--muted);
}

.fb-status {
  margin-left: auto;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

.fb-status-open {
  color: var(--warn);
}

.fb-status-done {
  color: var(--accent-text);
}

.fb-title {
  margin-top: 6px;
  font-weight: 600;
}

.fb-body {
  margin-top: 2px;
  color: var(--ink-2);
  white-space: pre-line;
}

.reply {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

.reply-who {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent-text);
}

.reply-body {
  white-space: pre-line;
}

/* item sheet: full screen on phones, side panel on wider screens */

.sheet {
  margin: 0;
  padding: 0;
  border: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}

.sheet[open] {
  display: flex;
  flex-direction: column;
  animation: sheet-up 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sheet::backdrop {
  background: rgb(15 20 18 / 40%);
}

@keyframes sheet-up {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}

.sheet-bar {
  display: flex;
  justify-content: flex-end;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 6px;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: calc(env(safe-area-inset-top) + 20px) 16px calc(env(safe-area-inset-bottom) + 40px);
}

@media (min-width: 860px) {
  .sheet {
    margin-left: auto;
    width: min(680px, 62vw);
    border-left: 1px solid var(--line);
    box-shadow: -20px 0 60px -30px rgb(0 0 0 / 40%);
  }

  .sheet[open] {
    animation-name: sheet-in;
  }

  .sheet-body {
    padding: 28px 32px 48px;
  }

  @keyframes sheet-in {
    from {
      transform: translateX(40px);
      opacity: 0;
    }
  }
}

/* keep the tags and title clear of the floating close button */
.item-head .card-tags,
.item-head h2 {
  padding-right: 52px;
}

.item-head h2 {
  margin-top: 10px;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  outline: none;
}

.item-where {
  color: var(--muted);
  margin-top: 2px;
}

.item-purpose {
  margin-top: 12px;
  color: var(--ink-2);
}

.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-weight: 600;
}

.banner-icon {
  margin-top: 3px;
}

.banner-chosen {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.banner-done {
  background: var(--accent);
  color: var(--accent-ink);
}

.banner-dropped {
  background: var(--surface-2);
  color: var(--muted);
}

.verdict {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
}

.verdict-est {
  color: var(--muted);
}

.verdict-est strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.item-section {
  margin-top: 28px;
}

.section-title {
  font-size: 1.0625rem;
  font-weight: 650;
  margin-bottom: 10px;
}

.needs {
  display: grid;
  gap: 8px;
  list-style: disc;
  padding-left: 1.25em;
}

/* picks: stacked on phones, side by side when there's room */

.picks {
  display: grid;
  gap: 12px;
}

@media (min-width: 560px) {
  .picks-2,
  .picks-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .picks-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sheet:has(.picks-3) {
    width: min(960px, 72vw);
  }
}

.picks > li {
  display: flex;
}

.pick {
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.pick-chosen {
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.pick-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 260px;
  border-radius: 0;
}

/* an empty photo slot shouldn't eat half a phone screen */
.pick-photo.photo-empty {
  aspect-ratio: auto;
  height: 96px;
}

.pick-body {
  flex: 1;
  padding: 14px 16px 4px;
}

.pick-label-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.pick-label,
.chosen-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 650;
  background: var(--surface-2);
  color: var(--ink-2);
}

.label-top-pick {
  background: var(--ink);
  color: var(--bg);
}

.chosen-tag {
  background: var(--accent);
  color: var(--accent-ink);
}

.pick-brand {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.875rem;
}

.pick-name {
  font-size: 1.0625rem;
  font-weight: 650;
}

.pick-price {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pick-note {
  color: var(--muted);
  font-size: 0.8125rem;
}

.pick-why {
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.proscons {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  font-size: 0.9375rem;
}

.pc-title {
  font-size: 0.8125rem;
  font-weight: 700;
}

.pc-pro {
  color: var(--accent-text);
}

.pc-con {
  color: var(--danger);
}

.proscons ul {
  display: grid;
  gap: 2px;
  margin-top: 2px;
}

.proscons li {
  position: relative;
  padding-left: 14px;
  color: var(--ink-2);
}

.proscons li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.65em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line-strong);
}

.specs {
  margin: 12px 0 0;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
}

.specs div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.specs dt {
  flex: 0 0 auto;
  max-width: 45%;
  color: var(--muted);
}

/* body's overflow-wrap: anywhere lets flex squeeze labels to a letter per line */
.specs dt,
.specs dd {
  overflow-wrap: break-word;
}

.specs dd {
  margin: 0;
  text-align: right;
  font-weight: 550;
}

.pick-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  font-weight: 600;
}

.pick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 16px 16px;
}

.pick-actions .btn {
  flex: 1 1 120px;
  padding: 0 12px;
}

.plain-list {
  display: grid;
  gap: 10px;
}

.plain-list li {
  display: grid;
  gap: 1px;
}

.sources {
  display: grid;
}

.sources a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
}

/* closed reference sections: the summary is the heading and the tap target */
.fold > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  margin-bottom: 0;
  cursor: pointer;
  list-style: none;
}

.fold > summary::-webkit-details-marker {
  display: none;
}

.fold > summary::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  flex-shrink: 0;
}

.fold[open] > summary::before {
  transform: rotate(45deg);
}

.fold[open] > summary {
  margin-bottom: 10px;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.thread-empty {
  margin-bottom: 4px;
}

.item-section .inline-error {
  margin-bottom: 10px;
}

.comment {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.comment .btn {
  justify-self: end;
}

textarea,
input[type="text"],
input[type="password"] {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 1rem;
}

textarea {
  resize: vertical;
}

textarea:focus,
input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

::placeholder {
  color: var(--muted);
  opacity: 1;
  font-style: italic;
}

.history {
  display: grid;
  gap: 8px;
  font-size: 0.9375rem;
}

.history li {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
}

.history time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* note dialog */

.ask {
  width: min(460px, calc(100% - 24px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 60px -20px rgb(0 0 0 / 40%);
}

.ask::backdrop {
  background: rgb(15 20 18 / 45%);
}

.ask-form {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.ask h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.field {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9375rem;
}

.field[hidden] {
  display: none;
}

.ask-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

/* login */

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 16px;
}

.login-card {
  width: 100%;
  max-width: 400px;
}

.login-mark {
  width: 48px;
  height: 48px;
  display: block;
}

.login h1 {
  margin-top: 16px;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-sub {
  color: var(--muted);
  margin-top: 4px;
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 28px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.login-form fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.login-form legend {
  padding: 0;
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 6px;
}

.names {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.names .chip {
  padding: 0 18px;
}

.login-form .btn-primary {
  width: 100%;
}

.login-form .field[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 400px) {
  .top h1,
  .item-head h2,
  .login h1 {
    font-size: 1.5rem;
  }
}
