:root {
  color-scheme: light;
  --paper: #f7f5ee;
  --surface: #fffcf6;
  --ink: #202b24;
  --muted: #61695d;
  --line: #dfdfd3;
  --sage: #e9ede0;
  --pine: #284437;
  --pine-dark: #1d352a;
  --danger: #8b332d;
  --serif: Georgia, 'Times New Roman', serif;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: pan-x pan-y;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  touch-action: pan-x pan-y;
}
body:has(dialog[open]) { overflow: hidden; }
button, select, input { font: inherit; }
button {
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button:disabled { cursor: default; opacity: .64; }
button:focus-visible, select:focus-visible {
  outline: 2px solid #4d7a62;
  outline-offset: 3px;
}
h1, h2, p { margin: 0; }
svg { width: 24px; height: 24px; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
svg:has(use) {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.frame {
  width: min(100%, 840px);
  margin-inline: auto;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}
.masthead {
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--line);
}
.masthead-inner {
  min-height: 67px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .17em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  color: #fcfaf2;
  background: var(--pine);
  border-radius: 11px;
}
.brand-mark svg { width: 23px; height: 23px; margin-top: -2px; }
.catalog-count {
  flex: none;
  font-size: 12px;
  font-weight: 650;
  color: var(--pine);
  background: var(--sage);
  border: 1px solid #dce2d3;
  border-radius: 999px;
  padding: 7px 12px;
}
.main { padding-top: 28px; padding-bottom: calc(106px + env(safe-area-inset-bottom)); }
.page-heading { margin-bottom: 26px; }
.page-heading h1, .login-intro h1 {
  font-family: var(--serif);
  font-size: clamp(38px, 10.4vw, 57px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -.06em;
}
.heading-detail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}
.page-heading p, .login-intro p { color: var(--muted); font-size: 15px; line-height: 1.45; }
.status-panel, .empty-state {
  padding: 32px 19px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 25px;
}
.status-heading { font-weight: 700; }
.status-panel p + p { margin-top: 8px; color: var(--muted); line-height: 1.5; }
.status-panel button { margin: 15px auto 0; }
.sign-in {
  width: min(100%, 420px);
  padding: 29px 23px 25px;
  margin: clamp(8px, 5vh, 55px) auto 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 25px;
}
.login-intro { margin-bottom: 20px; text-align: center; }
.login-intro .empty-illustration { width: 92px; height: 92px; margin-bottom: 16px; }
.login-intro .empty-illustration svg { width: 48px; height: 48px; }
.login-intro .empty-spark-top { top: 14px; right: 17px; }
.login-intro .empty-spark-bottom { left: 17px; bottom: 15px; }
.login-intro h1 { font-size: clamp(30px, 9.7vw, 43px); }
.login-intro p { margin-top: 9px; }
.text-button.auth-alternative { display: flex; width: max-content; margin: 7px auto -8px; }
#pairing-submit { margin-top: 13px; }
.empty-state { padding-block: 40px 26px; }
.empty-illustration {
  position: relative;
  display: grid;
  place-items: center;
  width: 118px;
  height: 118px;
  margin: 0 auto 19px;
  background: var(--sage);
  color: var(--pine);
  border: 1px solid #dce2d3;
  border-radius: 50%;
}
.empty-illustration::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px dashed #bac8b7;
  border-radius: inherit;
}
.empty-illustration svg { width: 61px; height: 61px; margin-top: -6px; stroke-width: 1.15; }
.empty-spark { position: absolute; font-size: 16px; color: #58705f; }
.empty-spark-top { top: 20px; right: 23px; }
.empty-spark-bottom { left: 22px; bottom: 22px; font-size: 12px; }
.empty-state h2, .sheet h2, .group-title {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -.045em;
}
.empty-state h2 { font-size: 31px; }
.empty-state p {
  margin: 9px auto 5px;
  max-width: 245px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}
.text-button {
  min-height: 44px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  padding: 0 7px;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: var(--pine);
  font-size: 14px;
  font-weight: 750;
}
.text-button svg { width: 17px; height: 17px; }
.category-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: -1px 0 24px;
  padding: 4px 3px;
  overscroll-behavior-x: contain;
}
.category-nav::-webkit-scrollbar { display: none; }
.category-button {
  flex: none;
  min-height: 44px;
  padding-inline: 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 650;
}
.category-button[aria-pressed="true"] {
  background: var(--pine);
  color: #fffdf5;
  border-color: var(--pine);
}
.group + .group { margin-top: 27px; }
.group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.group-title { font-size: 28px; }
.group-count { color: var(--muted); font-size: 13px; }
.item-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.item-card {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
}
.item-image {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  background: var(--sage);
  color: #687b6d;
}
.item-image svg {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 35px;
  height: 35px;
}
.item-image img {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.item-label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 45px;
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 650;
}
.swatch {
  flex: none;
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1px solid #252b24aa;
  border-radius: 50%;
}
.action-bar {
  position: fixed;
  z-index: 1;
  inset: auto 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.action-inner { padding-top: 12px; padding-bottom: 12px; }
.button {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid transparent;
  padding: 0 18px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}
.button svg { width: 21px; height: 21px; }
.primary { background: var(--pine); color: #fffdf5; }
.primary:active { background: var(--pine-dark); }
.secondary { border-color: var(--line); background: var(--surface); color: var(--ink); }
.add-button, .save-button { min-height: 52px; width: 100%; }
dialog {
  position: fixed;
  inset: auto 0 0;
  width: 100%;
  max-width: 560px;
  max-height: calc(100% - 12px - env(safe-area-inset-top));
  max-height: calc(100dvh - 12px - env(safe-area-inset-top));
  padding: 0;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 25px 25px 0 0;
  background: var(--paper);
  color: var(--ink);
  overflow-y: auto;
  overscroll-behavior: contain;
}
dialog::backdrop { background: #15231988; }
.sheet {
  padding: 20px max(20px, env(safe-area-inset-right)) max(20px, calc(12px + env(safe-area-inset-bottom))) max(20px, env(safe-area-inset-left));
}
.sheet-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.sheet h2 { font-size: 33px; }
.sheet-heading p { margin-top: 5px; color: var(--muted); font-size: 14px; }
.icon-button {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: var(--sage);
  border: 1px solid #dce2d3;
  border-radius: 50%;
}
.icon-button svg { width: 19px; height: 19px; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.photo-picker {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 155px;
  background: var(--sage);
  border: 1px dashed #9cae9d;
  border-radius: 16px;
  overflow: hidden;
  color: var(--pine);
}
.photo-picker:focus-within { outline: 2px solid #4d7a62; outline-offset: 3px; }
.photo-picker input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
  font-size: 16px;
}
.photo-prompt {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 15px;
  text-align: center;
}
.photo-prompt svg { width: 29px; height: 29px; }
.photo-prompt small { color: var(--muted); font-size: 13px; }
.photo-picker.has-photo { border-style: solid; }
.photo-picker img {
  display: block;
  width: 100%;
  height: min(23vh, 190px);
  min-height: 155px;
  object-fit: contain;
}
.photo-selected {
  position: absolute;
  right: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--pine);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.field { margin-top: 15px; }
.field label { display: block; margin: 0 0 6px; font-size: 14px; font-weight: 700; }
.select-wrap { position: relative; }
.select-wrap select, .sign-in input {
  display: block;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 48px;
  padding: 0 43px 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
}
.sign-in input { padding-right: 13px; }
.sign-in input:focus-visible { outline: 2px solid #4d7a62; outline-offset: 2px; }
.select-wrap svg {
  pointer-events: none;
  position: absolute;
  right: 12px;
  top: 14px;
  width: 20px;
  height: 20px;
}
.save-button { margin-top: 18px; }
.form-error { margin-top: 12px; color: var(--danger); font-size: 14px; line-height: 1.4; }
.detail-image {
  background: var(--sage);
  border-radius: 15px;
  overflow: hidden;
}
.detail-image img {
  display: block;
  width: 100%;
  height: min(55vh, 510px);
  height: min(55dvh, 510px);
  object-fit: contain;
}
.detail-actions { margin-top: 11px; }
.danger-text { color: var(--danger); }
.danger { background: var(--danger); color: white; }
.confirm-panel { margin-top: 14px; }
.confirm-panel p { margin-bottom: 11px; font-size: 14px; }
.confirm-panel > div { display: flex; flex-wrap: wrap; gap: 8px; }
.toast {
  position: fixed;
  z-index: 2;
  inset: auto 16px calc(86px + env(safe-area-inset-bottom));
  width: max-content;
  max-width: calc(100% - 32px);
  margin: auto;
  color: #fffdf5;
  background: var(--pine-dark);
  border-radius: 11px;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.4;
  text-align: center;
  pointer-events: none;
}
.toast:not(:empty) { padding: 10px 16px; }

@media (min-width: 630px) {
  .main { padding-top: 38px; }
  .item-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .action-inner { display: flex; justify-content: flex-end; }
  .add-button { width: auto; min-width: 180px; }
  dialog { inset: 0; margin: auto; border-radius: 25px; border-bottom: 1px solid var(--line); }
}
@media (max-width: 350px) {
  .frame { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .item-grid { gap: 8px; }
}
