:root {
  color-scheme: light;
  --ink: #263f35;
  --forest: #254e3e;
  --forest-dark: #183c2e;
  --leaf: #e5eddf;
  --clay: #9c5739;
  --muted: #586b5c;
  --line: #d2d8c9;
  --paper: #fbfaf2;
  --serif: "Noto Serif TC", "Songti TC", "PMingLiU", Georgia, serif;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: var(--ink);
  background: #f4f3e9;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; line-height: 1.55; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea, a { font: inherit; }
button, select, a, input[type="file"] { touch-action: manipulation; }
button { color: inherit; cursor: pointer; }
button:disabled, fieldset:disabled button { opacity: .56; cursor: default; }
:where(button, a, summary, input, select, textarea, [tabindex]):focus-visible { outline: 3px solid #a86a34; outline-offset: 3px; }
.sr {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.portalMast {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 69px;
  padding: max(9px, env(safe-area-inset-top)) max(clamp(15px, 5vw, 70px), env(safe-area-inset-right)) 9px max(clamp(15px,5vw,70px),env(safe-area-inset-left));
  background: #faf8ee; border-bottom: 1px solid #ccd4c3;
}
.wordmark, .portalMast nav, .townLink { display: inline-flex; align-items: center; }
.wordmark { flex: none; gap: 9px; text-decoration: none; color: var(--ink); }
.wordmark img { display: block; }
.wordmark span { font: 780 clamp(19px,2vw,25px)/1.25 var(--serif); letter-spacing: .05em; }
.portalMast nav { min-width: 0; gap: 14px; }
#account { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
#account:empty { display: none; }
.townLink {
  flex: none; justify-content: center; gap: 5px; min-height: 42px; border: 1px solid #a9b9a4;
  border-radius: 22px; padding: 7px 15px; color: var(--forest); text-decoration: none; font-size: 14px; font-weight: 700;
}
.portalMain { width: min(1070px, calc(100% - 42px)); margin: 0 auto; padding: clamp(27px,4.6vw,61px) 0 max(55px,env(safe-area-inset-bottom)); }
.pageIntro { margin-bottom: clamp(20px, 3vw, 32px); }
.pageIntro h1 { display: flex; align-items: center; gap: 13px; font: 780 clamp(29px,4.2vw,49px)/1.25 var(--serif); letter-spacing: .04em; }
.pageIntro h1::before { content: ""; width: 6px; height: .95em; border-radius: 3px; background: var(--clay); }
.pageIntro p, .intro { color: var(--muted); font-size: 15px; line-height: 1.7; }
.pageIntro p { margin-top: 8px; }
.pageLoading, .emptyBox { padding: 15px 18px; border: 1px dashed #bbc8b3; border-radius: 12px; color: var(--muted); background: #f4f6eb; }
.pageLoading { display: inline-block; }
body > main:not(.portalMain) { max-width: 620px; margin: 9vh auto; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
body > main:not(.portalMain) p { margin: 8px 0 16px; }
body > main:not(.portalMain) a { color: var(--forest); }
.card, .caseDetail, .applicationStatus, .submitBar {
  min-width: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--paper);
  padding: clamp(16px,2.5vw,27px);
}
.formSection h2, .accessCard h2, .caseDetail h2 {
  font: 720 clamp(21px,2.8vw,29px)/1.4 var(--serif); letter-spacing: .025em; color: var(--ink);
}
.formSection > .intro, .accessCard > .intro { margin: 4px 0 15px; }
.accessCard { max-width: 650px; border-top: 4px solid #8daa83; }
.accessCard .primary, .accessCard .secondary { margin-top: 2px; }
.applicationStatus {
  padding-block: 15px; margin-bottom: 17px; border-color: #c1cfb8; border-left: 5px solid #749574; background: #edf1e4;
}
.statusLine, .inlineActions, .lotTags, .statusFilters { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.statusLine h2 { font-size: 17px; line-height: 1.4; }
.applicationStatus > p, .reviewNote p { margin-top: 5px; font-size: 14px; }
.statusBadge {
  display: inline-flex; align-items: center; gap: 5px; width: max-content; max-width: 100%;
  border: 1px solid #c7cdbf; border-radius: 20px; padding: 2px 8px; color: #536358; background: #f3f4eb;
  font-size: 11px; font-weight: 710; line-height: 1.55; white-space: nowrap;
}
.statusBadge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.statusBadge[data-status="waitlisted"] { background: #f7ecd4; border-color: #d7bc8f; color: #79572a; }
.statusBadge[data-status="approved"] { background: #e1eedd; border-color: #a9c29d; color: #345d3c; }
.statusBadge[data-status="returned"] { background: #f8e6dc; border-color: #dab59f; color: #8c472f; }
.lotTags { margin-top: 7px; }
.lotTags span { padding: 3px 8px; border: 1px solid #bbcbb3; border-radius: 6px; background: #f8faee; font-size: 13px; font-weight: 700; }
.reviewNote { margin-top: 12px; border-left: 3px solid #b78463; padding: 8px 12px; background: #f7ede0; color: #654e39; }
.reviewNote strong { font-size: 13px; }
.reviewNote p { white-space: pre-wrap; overflow-wrap: anywhere; }
.editorFields, .stallFields { min-width: 0; margin: 0; padding: 0; border: 0; }
.applicationForm > .editorFields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.applicationForm .formSection:nth-of-type(n+3), .submitBar { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin-bottom: 12px; }
.fieldName, .shapeChoices legend { color: #344f40; font-size: 14px; font-weight: 700; }
.help, .mediaCurrent, .muted, .productCount { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
input:not([type="radio"]):not([type="checkbox"]), select, textarea {
  display: block; width: 100%; min-width: 0; min-height: 44px;
  border: 1px solid #b6c1af; border-radius: 9px; padding: 8px 11px; background: #fffef8; color: var(--ink);
}
input::placeholder, textarea::placeholder { color: #758274; opacity: 1; }
input[type="url"] { direction: ltr; text-align: left; }
textarea { resize: vertical; }
input[type="file"] { font-size: 13px; }
input[type="file"]::file-selector-button {
  margin: -3px 8px -3px -4px; border: 1px solid #c7cebd; border-radius: 6px; padding: 5px 8px;
  background: #ecefe2; color: var(--forest); font: inherit; cursor: pointer;
}
input[type="radio"], input[type="checkbox"] { accent-color: var(--forest); width: 18px; height: 18px; }
.primary, .secondary, .textButton, .filterButton {
  display: inline-flex; justify-content: center; align-items: center; gap: 6px; min-height: 44px; max-width: 100%;
  padding: 8px 15px; border: 1px solid var(--forest); border-radius: 10px; color: #fffbed; background: var(--forest);
  font-size: 14px; font-weight: 710; line-height: 1.4; text-decoration: none; text-align: center;
}
.secondary { color: var(--forest); border-color: #adbea6; background: #f0f3e7; }
.textButton { min-height: 40px; color: var(--forest); border-color: transparent; background: transparent; padding-inline: 5px; text-decoration: underline; text-underline-offset: 3px; }
.danger { color: #8a4934; }
.secondary.danger { border-color: #ceb49e; background: #fff6e9; }
.registerForm { margin-top: 15px; }
.notice:not(:empty) {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  margin: 10px 0; padding: 9px 12px; border-radius: 8px;
  color: #4d5e50; background: #edf0e5; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere;
}
.notice[data-kind="error"]:not(:empty) { border-left: 3px solid #aa684d; background: #f8e8df; color: #833f28; }
.notice[data-kind="success"]:not(:empty) { border-left: 3px solid #799674; background: #e8efe0; color: #35573d; }
.notice .primary { padding-block: 6px; }
.importWarnings { flex-basis: 100%; margin: 0; padding-left: 20px; }
.importOptions .field { margin-bottom: 8px; }
.importedChoices:not(:empty) { margin-top: 11px; }
.importList { display: grid; gap: 2px; min-width: 0; max-height: 238px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin: 6px 0; padding: 3px 7px 7px; }
.importList legend { font-size: 13px; font-weight: 700; }
.importPick { display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 3px; color: var(--ink); font-size: 13px; cursor: pointer; overflow-wrap: anywhere; }
.importPick input { flex: none; }
.importPick:has(input:disabled) { color: var(--muted); }
.mediaEditor { display: grid; grid-template-columns: minmax(66px, .34fr) minmax(0,1fr); align-items: start; gap: 12px; margin-block: 10px; }
.mediaInputs { min-width: 0; }
.mediaInputs .field { margin-bottom: 7px; }
.mediaCurrent { display: block; }
.picture {
  position: relative; display: grid; place-items: center; overflow: hidden; width: 100%; aspect-ratio: 1;
  border: 1px solid #d3d9cc; border-radius: 10px; background: #fffef8; color: #728170; text-align: center;
}
.picture img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.pictureFallback { padding: 5px; font-size: 11px; }
.twoFields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.productEditors { display: grid; gap: 7px; margin-bottom: 12px; }
.productEditor { min-width: 0; border: 1px solid #d2dacb; border-radius: 11px; background: #fffef7; }
.productEditor summary {
  display: flex; align-items: center; gap: 11px; min-height: 47px; padding: 9px 14px;
  cursor: pointer; list-style: none; border-radius: inherit;
}
.productEditor summary::-webkit-details-marker { display: none; }
.productEditor summary small { flex: none; color: #667b68; font-size: 12px; }
.productEditor summary strong { min-width: 0; overflow-wrap: anywhere; font-size: 15px; }
.productEditor summary::after {
  content: ""; flex: none; margin-left: auto; border: solid #607c63; border-width: 0 1.7px 1.7px 0;
  width: 8px; height: 8px; transform: rotate(45deg);
}
.productEditor[open] summary { background: #edf1e5; border-radius: 10px 10px 0 0; }
.productEditor[open] summary::after { transform: rotate(225deg); }
.productFields { padding: 13px; }
.productFields .mediaEditor { grid-template-columns: 92px minmax(0,1fr); }
.productFields .mediaInputs { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 12px; }
.productFields .mediaCurrent, .productFields .mediaInputs .notice { grid-column: 1/-1; }
.checkLabel { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.checkLabel input { margin: 0; }
.stallFields { margin-top: 7px; padding-top: 14px; border-top: 1px solid var(--line); }
.shapeChoices { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; padding: 0; border: 0; margin: 0; }
.shapeChoices legend { margin-bottom: 7px; }
.shapeChoice {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 6px 3px; min-height: 74px; border: 1px solid #c4ceba; border-radius: 9px; color: #4e6350; background: #f8f8ee;
  font-size: 12px; font-weight: 700; cursor: pointer;
}
.shapeChoice input { position: absolute; top: 5px; left: 5px; width: 15px; height: 15px; margin: 0; }
.shapeChoice:has(input:checked) { border-color: #587c5d; background: #e7eede; color: var(--forest); }
.shapeChoice:has(input:focus-visible) { outline: 3px solid #a86a34; }
.shapeArt { position: relative; display: inline-block; flex: none; width: 41px; height: 40px; }
.shapeArt::before, .shapeArt::after { content: ""; position: absolute; display: block; }
.shapeArt[data-shape="bottle"]::before { width: 17px; height: 25px; bottom: 2px; left: 12px; border-radius: 5px 5px 3px 3px; background: linear-gradient(90deg,#759783,#b6c7a6 28%,#dce1b9 46%,#73917c); box-shadow: inset 0 -3px #80917a; }
.shapeArt[data-shape="bottle"]::after { width: 8px; height: 7px; top: 7px; left: 17px; border-radius: 2px 2px 0 0; background: #416454; }
.shapeArt[data-shape="cup"]::before { width: 25px; height: 25px; bottom: 2px; left: 8px; background: linear-gradient(90deg,#a86a4b,#e2b282 40%,#b07e57); clip-path: polygon(0 0,100% 0,80% 100%,20% 100%); }
.shapeArt[data-shape="cup"]::after { width: 27px; height: 7px; top: 10px; left: 7px; border-radius: 50%; border: 2px solid #e7d2a9; background: #775439; }
.shapeArt[data-shape="box"]::before { width: 29px; height: 22px; bottom: 4px; left: 6px; border-radius: 2px; background: linear-gradient(90deg,#ddbd8c 0 70%,#a78359 71%); box-shadow: inset 0 3px #ead4ad; transform: skewY(-7deg); }
.shapeArt[data-shape="box"]::after { width: 5px; height: 22px; bottom: 4px; left: 17px; background: #ad6d4a; transform: skewY(-7deg); }
.shapeArt[data-shape="bag"]::before { width: 24px; height: 23px; bottom: 2px; left: 8px; background: linear-gradient(90deg,#9fa885,#c1c8a5 68%,#8a9374 69%); border-radius: 2px 2px 4px 4px; }
.shapeArt[data-shape="bag"]::after { width: 12px; height: 10px; top: 6px; left: 14px; border: 2px solid #657c67; border-bottom: 0; border-radius: 8px 8px 0 0; }
.shapeArt[data-shape="book"]::before { width: 24px; height: 29px; bottom: 3px; left: 8px; border: 1px solid #606f88; border-left: 5px solid #50687b; border-radius: 2px 4px 4px 2px; background: #96a8ae; box-shadow: inset 0 -3px #efdfb4; transform: rotate(-7deg); }
.shapeArt[data-shape="book"]::after { width: 11px; height: 3px; top: 15px; left: 17px; background: #e1cfac; transform: rotate(-7deg); }
.submitBar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; background: #ecf1e4; }
.submitBar .notice { flex-basis: 100%; margin: 1px 0; }
.adminToolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 13px; }
.statusFilters { gap: 5px; }
.filterButton { border-color: #b8c6b0; border-radius: 22px; padding-inline: 13px; background: #f8f8ee; color: #45614e; }
.filterButton[aria-pressed="true"] { border-color: var(--forest); background: var(--forest); color: #fff9e9; }
.filterButton b { font-size: 12px; font-variant-numeric: tabular-nums; }
.reviewLayout { display: grid; grid-template-columns: minmax(190px,.37fr) minmax(0,1fr); align-items: start; gap: 15px; }
.reviewLayout.noCases { display: block; }
.reviewLayout.noCases .caseDetail { display: none; }
.caseList { display: grid; gap: 6px; min-width: 0; max-height: min(78vh,850px); overflow: auto; scrollbar-width: thin; }
.caseItem {
  display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 3px 6px; min-height: 60px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; text-align: start; background: #fbfaf2;
}
.caseItem strong { overflow-wrap: anywhere; line-height: 1.4; }
.caseItem small { grid-column: 1/-1; color: var(--muted); font-size: 11px; }
.caseItem[aria-pressed="true"] { border-color: #789571; border-left: 4px solid #63865f; background: #e6eedf; }
.caseItem:focus-visible { outline-offset: -3px; }
.caseDetail:focus:not(:focus-visible) { outline: none; }
.caseHead { display: grid; grid-template-columns: 69px minmax(0,1fr); gap: 14px; align-items: center; }
.reviewImage { display: block; border-radius: 10px; }
.caseDetail h2 { margin: 3px 0 1px; overflow-wrap: anywhere; }
.caseDetail h3 { font: 720 19px/1.5 var(--serif); margin: 0 0 8px; }
.reviewSource { display: grid; grid-template-columns: max-content minmax(0,1fr); align-items: baseline; gap: 4px 11px; margin-top: 17px; padding: 10px 12px; border-radius: 9px; background: #edf1e6; font-size: 13px; }
.sourceLink { color: #315e45; overflow-wrap: anywhere; text-decoration: underline; text-underline-offset: 3px; }
.reviewProducts, .reviewStall, .reviewForm { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.matchingLot { margin: 0 0 10px; padding: 6px 10px; border-radius: 7px; color: #3d6044; background: #e8efdf; font-size: 13px; }
.reviewProduct { display: grid; grid-template-columns: 56px minmax(0,1fr); align-items: center; gap: 10px; padding-block: 6px; }
.reviewProduct strong, .reviewProduct a.sourceLink, .stallPreview strong, .stallPreview small { display: block; }
.reviewProduct strong { font-size: 14px; overflow-wrap: anywhere; }
.reviewProduct .sourceLink, .stallPreview small { font-size: 12px; }
.stallPreview { display: flex; gap: 10px; align-items: center; }
.stallPreview .shapeArt { background: #f0eedf; border-radius: 8px; }
.stallPreview small { color: var(--muted); }
@media (hover:hover) {
  .primary:hover { background: var(--forest-dark); }
  .secondary:not(:disabled):hover, .townLink:hover, .caseItem:hover, .filterButton:not([aria-pressed="true"]):hover { background: #e5eddd; }
  .secondary.danger:hover { background: #f5e4d4; }
  .sourceLink:hover, .textButton:hover { text-decoration-thickness: 2px; }
}
@media (max-width:760px) {
  .portalMain { width: calc(100% - 28px); padding-top: 23px; }
  .portalMast { min-height: 57px; padding-inline: 14px; }
  .portalMast .wordmark img { width: 31px; height: 31px; }
  .portalMast nav { gap: 5px; }
  #account { max-width: 23vw; font-size: 11px; }
  .applicationForm > .editorFields { grid-template-columns: minmax(0,1fr); gap: 11px; }
  .card, .caseDetail, .applicationStatus, .submitBar { border-radius: 13px; padding: 15px; }
  .reviewLayout { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .caseList { max-height: 260px; }
  .caseItem { min-height: 49px; }
  .caseDetail { scroll-margin-top: 8px; }
  .filterButton { min-height: 42px; padding: 6px 10px; }
  .shapeChoices { gap: 4px; }
}
@media (max-width:500px) {
  .portalMain { width: calc(100% - 20px); }
  .portalMast { padding-inline: 10px; }
  .wordmark { gap: 5px; }
  .townLink { min-height: 40px; padding: 5px 9px; font-size: 12px; }
  .twoFields { grid-template-columns: 1fr; gap: 0; }
  .productFields .mediaInputs { display: block; }
  .mediaEditor, .productFields .mediaEditor { grid-template-columns: 62px minmax(0,1fr); gap: 7px; }
  .productFields { padding: 9px; }
  input:not([type="file"]), textarea, select { font-size: 16px; }
  .shapeChoice { min-height: 75px; padding-top: 13px; }
  .shapeChoice input { width: 12px; height: 12px; left: 3px; top: 3px; }
  .shapeArt { transform: scale(.92); }
  .submitBar .primary { width: 100%; }
  .adminToolbar { align-items: flex-start; }
  .statusFilters { gap: 3px; }
  .filterButton { font-size: 12px; padding-inline: 8px; }
  .caseHead { grid-template-columns: 54px minmax(0,1fr); gap: 8px; }
  .reviewSource { grid-template-columns: minmax(0,1fr); }
  .reviewForm .inlineActions > button { flex: 1; }
}
