:root {
  --paper:#f7f6f2;
  --ink:#202925;
  --muted:#666e66;
  --line:#e1e3da;
  --accent:#b8492d;
  --soft:#f0e9df;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  color:var(--ink);
  background:var(--paper);
  font-synthesis:none;
}

* {
  box-sizing:border-box;
}

body {
  margin:0;
}

a {
  color:inherit;
  text-decoration:none;
}

button,input,textarea {
  font:inherit;
}

button,a,input,summary {
  -webkit-tap-highlight-color:transparent;
}

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

h1 {
  font-size:clamp(26px,5vw,38px);
  line-height:1.3;
  overflow-wrap:anywhere;
}

h2 {
  font-size:19px;
  margin-bottom:12px;
}

h3 {
  font-size:20px;
  margin:8px 0;
  overflow-wrap:anywhere;
}

p {
  line-height:1.65;
}

button,a,summary {
  touch-action:manipulation;
}

a:focus-visible,button:focus-visible,input:focus-visible,textarea:focus-visible,summary:focus-visible {
  outline:3px solid #a84930;
  outline-offset:3px;
}

.skip {
  position:fixed;
  left:16px;
  top:-100px;
  padding:12px;
  background:white;
  z-index:10;
}

.skip:focus {
  top:12px;
}

.topbar {
  height:72px;
  display:flex;
  align-items:center;
  gap:16px;
  max-width:960px;
  margin:auto;
  padding:0 24px;
  border-bottom:1px solid var(--line);
}

.access-avatar-frame {
  width:30px;
  height:30px;
  min-width:30px;
  min-height:30px;
  max-width:30px;
  max-height:30px;
  flex:0 0 30px;
  display:block;
  overflow:hidden;
  border-radius:50%;
  -webkit-clip-path:circle(50% at 50% 50%);
  clip-path:circle(50% at 50% 50%);
}

.access-avatar-frame>.access-avatar {
  width:30px;
  height:30px;
  min-width:30px;
  min-height:30px;
  max-width:30px;
  max-height:30px;
  display:block;
  object-fit:cover;
  border-radius:50%;
  -webkit-clip-path:circle(50% at 50% 50%);
  clip-path:circle(50% at 50% 50%);
}

.brand {
  font-size:27px;
  font-weight:750;
  letter-spacing:-1px;
}

.brand span {
  color:var(--accent);
}

.staff-label {
  font-size:12px;
  letter-spacing:1px;
  color:var(--muted);
}

.topbar form {
  margin-left:auto;
}

.text-button {
  border:0;
  background:none;
  padding:12px;
  color:var(--muted);
  cursor:pointer;
}

main {
  max-width:900px;
  margin:auto;
  padding:0 24px 40px;
  min-height:80vh;
}

.page-heading {
  padding:36px 0 28px;
}

.page-heading>*+* {
  margin-top:10px;
}

.page-heading.compact {
  padding:18px 0 24px;
}

.eyebrow {
  font-size:10px;
  letter-spacing:2px;
  color:var(--muted);
  font-weight:650;
}

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

.small,.hint {
  font-size:13px;
}

.hint {
  margin:8px 0 14px;
  line-height:1.6;
}

.panel {
  background:white;
  border:1px solid var(--line);
  border-radius:16px;
  padding:22px;
  margin:16px 0;
}

.panel h2 {
  margin-top:0;
}

.narrow {
  max-width:480px;
}

.section-heading {
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:baseline;
  margin-top:28px;
}

.section-heading h2 {
  margin:0;
}

.code {
  color:var(--accent);
  font-size:14px;
  font-weight:750;
  letter-spacing:1px;
}

.owned {
  padding-top:14px;
  font-size:13px;
}

.owned strong,.owned span {
  display:block;
}

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

.actions {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:16px;
  margin-top:18px;
}

.primary,.secondary {
  min-height:48px;
  padding:13px 18px;
  border-radius:10px;
  font-weight:650;
  display:inline-flex;
  justify-content:center;
  align-items:center;
  text-align:center;
  cursor:pointer;
  font-size:14px;
}

.primary {
  background:var(--ink);
  color:white;
  border:1px solid var(--ink);
}

.secondary {
  background:var(--soft);
  color:var(--ink);
  border:1px solid #e1d8ca;
}

.primary:hover {
  background:#34433a;
}

.secondary:hover {
  background:#e7dfd3;
}

.wide {
  display:flex;
  width:100%;
  margin-top:16px;
}

button:disabled {
  opacity:.65;
  cursor:not-allowed;
}

.text-link,.back {
  color:var(--accent);
  padding:12px 0;
  font-size:14px;
  font-weight:600;
}

.back {
  display:inline-block;
  margin-top:12px;
}

label:not(.choice) {
  display:block;
  font-size:14px;
  font-weight:600;
  margin:18px 0 8px;
}

.panel>label:first-child,.search>label {
  margin-top:0;
}

input:not([type=checkbox]):not([type=hidden]),textarea {
  width:100%;
  min-width:0;
  border:1px solid #ccd0c7;
  border-radius:10px;
  padding:12px;
  background:#fff;
  color:var(--ink);
  min-height:48px;
  font-size:16px;
}

textarea {
  resize:vertical;
  line-height:1.7;
}

.search-row {
  display:flex;
  gap:10px;
}

.search-row input {
  flex:1;
  min-width:0;
}

.search-row button {
  flex:none;
}

.customer-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
}

.customer-grid .panel {
  margin:14px 0 0;
}

.empty {
  grid-column:1/-1;
  text-align:center;
  padding:40px 20px;
}

.pagination {
  display:flex;
  justify-content:center;
  gap:24px;
  padding:28px 0;
  font-size:14px;
}

.pagination a {
  color:var(--accent);
}

fieldset {
  min-width:0;
}

legend {
  padding:0 8px;
  font-size:18px;
  font-weight:700;
  max-width:100%;
  overflow-wrap:anywhere;
}

.choice {
  display:flex;
  align-items:center;
  gap:12px;
  padding:15px;
  border:1px solid var(--line);
  border-radius:10px;
  min-height:54px;
  cursor:pointer;
  font-size:14px;
}

.choice:has(input:checked) {
  background:#f8eee6;
  border-color:#bd7453;
}

.choice:has(input:disabled) {
  opacity:.45;
  cursor:default;
}

.choice input {
  accent-color:var(--accent);
  width:20px;
  height:20px;
  flex:none;
  margin:0;
}

.choice small {
  display:block;
  font-size:12px;
  font-weight:400;
  color:var(--muted);
  line-height:1.6;
  margin-top:4px;
}

.episode-grid {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  margin-top:12px;
}

.submit-bar {
  position:sticky;
  bottom:0;
  background:rgba(247,246,242,.97);
  border-top:1px solid var(--line);
  padding:14px 0 max(14px,env(safe-area-inset-bottom));
  z-index:2;
}

.submit-bar .wide {
  margin-top:8px;
}

.submit-bar p {
  text-align:center;
  color:var(--muted);
}

.error-summary,.errorlist {
  color:#9d321d;
  font-size:14px;
  line-height:1.6;
}

.error-summary {
  background:#fff0ea;
  border:1px solid #e9b39f;
  padding:16px;
  border-radius:12px;
}

.errorlist {
  padding-left:20px;
  margin:8px 0;
}

.success-icon {
  width:50px;
  height:50px;
  background:#e5eddf;
  color:#466043;
  border-radius:50%;
  display:grid;
  place-items:center;
  font-size:27px;
}

.plain-list {
  padding-left:20px;
  font-size:14px;
  line-height:1.8;
  margin:12px 0;
}

.history-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.history p {
  margin-top:7px;
}

.tag {
  font-size:11px;
  background:var(--soft);
  border-radius:30px;
  padding:5px 10px;
}

.note {
  white-space:normal;
  overflow-wrap:anywhere;
  border-top:1px solid var(--line);
  padding-top:10px;
  font-size:14px;
}

summary {
  min-height:32px;
  cursor:pointer;
  font-weight:600;
  line-height:1.8;
}

details[open]>summary {
  margin-bottom:12px;
}

footer {
  max-width:900px;
  margin:auto;
  border-top:1px solid var(--line);
  padding:22px 24px 30px;
  color:var(--muted);
  font-size:11px;
  letter-spacing:1px;
}

@media(max-width:600px) {
  main {
    padding:0 18px 30px;
  }
  .topbar {
    height:64px;
    padding:0 18px;
  }
  .page-heading {
    padding:28px 0 20px;
  }
  .panel {
    padding:18px;
  }
  .customer-grid {
    grid-template-columns:1fr;
    gap:0;
  }
  .episode-grid {
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .full-choice {
    padding:14px;
  }
  .search-row {
    gap:8px;
  }
  .search-row button {
    padding:12px;
  }
  .choice {
    padding:13px;
    gap:10px;
  }
  .section-heading {
    margin-top:24px;
  }
  .history-heading {
    align-items:flex-start;
  }
  .tag {
    flex:none;
  }
  footer {
    margin:0 18px;
    padding-left:0;
  }
}
