:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #6c7078;
  --line: #d9dde5;
  --paper: #f7f7f4;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-2: #b42318;
  --gold: #d69e2e;
  --blue: #2563eb;
  --shadow: 0 16px 42px rgba(32, 33, 36, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  padding-bottom: 82px;
}

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

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.96);
}

button.secondary {
  background: #2f3747;
}

button.ghost {
  background: transparent;
  color: var(--accent-2);
  border: 1px solid var(--line);
}

[hidden] {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px) 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

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

h1 {
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1;
}

.topbar p {
  color: var(--muted);
  margin-top: 8px;
}

.tabs {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(76px, auto));
  gap: 4px;
  background: #eef0f3;
  padding: 4px;
  border-radius: 10px;
}

.tab {
  background: transparent;
  color: var(--muted);
  min-height: 36px;
}

.tab.is-active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

main {
  padding: 24px clamp(18px, 4vw, 48px) 44px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.toolbar,
.content-grid,
.request-layout,
.manage-layout {
  display: grid;
  gap: 18px;
}

.toolbar {
  grid-template-columns: 1fr 180px 180px;
  align-items: end;
  margin-bottom: 22px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 40px;
  padding: 9px 11px;
}

textarea {
  resize: vertical;
}

.content-grid {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  align-items: start;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading h2 {
  font-size: 20px;
}

#resultCount {
  color: var(--muted);
  font-size: 14px;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}

.item-card {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition:
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.item-card:hover,
.item-card.is-selected {
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: var(--shadow);
}

.item-image-wrap {
  position: relative;
}

.item-card img,
.detail-hero {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e5e7eb;
}

.item-card:nth-child(2n) img {
  aspect-ratio: 3 / 4;
}

.item-card:nth-child(3n) img {
  aspect-ratio: 1 / 1;
}

.floating-chip {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(32, 33, 36, 0.78);
  color: #fff;
  font-size: 12px;
}

.item-meta {
  padding: 12px;
  display: grid;
  gap: 8px;
}

.item-meta strong {
  line-height: 1.25;
}

.chips,
.option-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #eef0f3;
  color: #4b5563;
  font-size: 12px;
}

.chip.priority {
  background: #fff3cd;
  color: #7a4b00;
}

.chip.available {
  background: #dff7ef;
  color: #0f5f53;
}

.chip.reserved {
  background: #f7e8df;
  color: #8a3f17;
}

.chip.keep {
  background: #e5ebff;
  color: #2346a0;
}

.chip.claimed {
  background: #f2d8d5;
  color: #8f1d14;
}

.chip.paused {
  background: #ece7ff;
  color: #4d3394;
}

.detail-panel,
.export-panel,
.help-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.detail-panel {
  position: sticky;
  top: 118px;
  min-height: 360px;
}

.empty-detail,
.detail-body,
.export-panel,
.help-panel {
  padding: 18px;
}

.empty-detail {
  min-height: 360px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.detail-title {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.detail-title h2 {
  font-size: 23px;
}

.detail-description {
  color: #444b55;
  line-height: 1.55;
  margin-bottom: 16px;
}

.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.product-heading {
  font-size: 16px;
  margin-bottom: 10px;
}

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

.option-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  color: var(--ink);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfbfa;
  cursor: pointer;
}

.option-card:hover,
.option-card.is-picked {
  border-color: rgba(15, 118, 110, 0.55);
  background: #f2fbf8;
}

.option-card.is-disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.option-card.no-image {
  grid-template-columns: 1fr;
}

.option-card img {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: 6px;
  background: #e5e7eb;
}

.option-copy {
  display: grid;
  gap: 7px;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 9px;
}

.checkline input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.quantity-field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.quantity-field input {
  width: 82px;
  min-height: 34px;
}

.option-copy p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.request-layout,
.manage-layout {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  align-items: start;
}

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

.request-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: 74px 1fr auto;
  gap: 14px;
  align-items: center;
}

.request-item img {
  width: 74px;
  height: 74px;
  object-fit: cover;
  border-radius: 6px;
  background: #e5e7eb;
}

.request-item small {
  color: var(--muted);
}

.export-panel {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 118px;
}

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

.compact-actions {
  justify-content: flex-end;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f0f2f5;
  border-radius: 8px;
  padding: 12px;
  color: #30343b;
  max-height: 360px;
  overflow: auto;
}

.manager-form,
.help-panel {
  display: grid;
  gap: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.help-panel p {
  color: #4b5563;
  line-height: 1.55;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #202124;
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 20;
}

.cart-bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  align-items: center;
  width: min(460px, calc(100vw - 24px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  z-index: 30;
}

.cart-bar button {
  flex: 1;
}

@media (max-width: 900px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs,
  .toolbar,
  .content-grid,
  .request-layout,
  .manage-layout,
  .form-row {
    grid-template-columns: 1fr;
  }

  .detail-panel,
  .export-panel {
    position: static;
  }

  .detail-panel {
    min-height: auto;
  }

  .item-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  main {
    padding-inline: 12px;
  }

  .topbar {
    padding-inline: 12px;
  }

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

  .item-card {
    min-width: 0;
  }

  .item-meta {
    padding: 10px;
  }

  .tabs {
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
  }

  .option-card {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .option-card.no-image {
    grid-template-columns: 1fr;
  }

  .option-card img {
    width: 64px;
    height: 64px;
  }

  .request-item {
    grid-template-columns: 58px 1fr;
  }

  .request-item img {
    width: 58px;
    height: 58px;
  }

  .request-item button {
    grid-column: 1 / -1;
  }
}

/* UI design adoption: light tactile vault */
:root {
  --ink: #191c1d;
  --muted: #574240;
  --line: #e1e3e4;
  --paper: #f8f9fa;
  --panel: #ffffff;
  --accent: #a43a39;
  --accent-soft: #ffdad7;
  --accent-text: #741619;
  --mint: #86f3d4;
  --mint-text: #005141;
  --violet: #e8ddff;
  --surface-low: #f3f4f5;
  --surface: #edeeef;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family:
    "Be Vietnam Pro", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  padding-bottom: 104px;
}

button {
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  min-height: 44px;
  font-weight: 700;
}

button.secondary {
  background: var(--mint);
  color: var(--mint-text);
}

button.ghost {
  background: var(--panel);
  color: var(--accent);
  border: 1px solid var(--line);
}

.topbar {
  align-items: center;
  padding: 10px 16px;
  min-height: 64px;
  background: rgba(248, 249, 250, 0.86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(225, 227, 228, 0.68);
}

.topbar h1 {
  color: var(--accent);
  font-size: 22px;
  line-height: 30px;
}

.topbar p {
  display: none;
}

.tabs {
  background: var(--surface-low);
  border-radius: 999px;
  padding: 4px;
}

.tab {
  border-radius: 999px;
  min-height: 38px;
  color: var(--muted);
}

.tab.is-active {
  background: var(--mint);
  color: var(--mint-text);
}

main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px 16px 44px;
}

.toolbar {
  grid-template-columns: 1fr 140px 140px;
  gap: 12px;
  padding: 12px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

input,
select,
textarea {
  border: 2px solid transparent;
  border-radius: 12px;
  background: var(--surface-low);
  min-height: 48px;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--mint);
}

.content-grid {
  grid-template-columns: minmax(0, 1fr) minmax(380px, 460px);
  gap: 18px;
}

.section-heading h2 {
  font-size: 22px;
  line-height: 30px;
}

.item-grid {
  gap: 12px;
}

.item-card {
  border-color: rgba(225, 227, 228, 0.9);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.item-card:hover,
.item-card.is-selected {
  border-color: rgba(164, 58, 57, 0.3);
  box-shadow: 0 8px 28px rgba(164, 58, 57, 0.12);
}

.item-card img {
  aspect-ratio: 4 / 3;
}

.item-card:nth-child(2n) img,
.item-card:nth-child(3n) img {
  aspect-ratio: 4 / 3;
}

.floating-chip {
  right: 10px;
  bottom: 10px;
  background: rgba(25, 28, 29, 0.76);
  font-weight: 700;
}

.item-meta {
  padding: 14px;
}

.item-meta strong {
  font-size: 17px;
}

.chip {
  min-height: 26px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
}

.chip.priority {
  background: #fff0c2;
  color: #714900;
}

.chip.available {
  background: var(--mint);
  color: var(--mint-text);
}

.chip.reserved,
.chip.paused {
  background: var(--surface);
  color: var(--muted);
}

.chip.claimed {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.detail-panel,
.export-panel,
.help-panel {
  border-color: rgba(225, 227, 228, 0.9);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.detail-panel {
  top: 82px;
  overflow: hidden;
}

.detail-hero-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  margin: 12px;
  background: var(--surface-low);
}

.detail-hero {
  aspect-ratio: 16 / 10;
  transition: transform 500ms ease;
}

.detail-hero-wrap:hover .detail-hero {
  transform: scale(1.03);
}

.detail-hero-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 42px 16px 14px;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.58), transparent);
}

.detail-hero-copy h2 {
  margin: 0;
  font-size: 20px;
  line-height: 28px;
}

.detail-hero-copy p {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
}

.detail-body {
  padding: 6px 16px 18px;
}

.detail-title {
  margin-bottom: 12px;
}

.detail-description {
  margin-bottom: 18px;
  color: var(--muted);
}

.product-heading {
  margin-bottom: 14px;
  font-size: 18px;
  line-height: 24px;
}

.option-list {
  gap: 14px;
}

.option-card {
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  border-color: transparent;
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.option-card.no-image {
  grid-template-columns: 1fr;
}

.option-card.is-picked {
  border-color: rgba(0, 107, 87, 0.18);
  background: #f5fffb;
}

.option-card.is-disabled {
  opacity: 0.72;
}

.option-card img {
  width: 80px;
  height: 80px;
  border-radius: 10px;
}

.product-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.product-line strong {
  min-width: 0;
  font-size: 16px;
  line-height: 24px;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.qty-control button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 20px;
}

.qty-control button:disabled {
  cursor: not-allowed;
}

.qty-control span {
  width: 28px;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
}

.qty-control.is-locked {
  opacity: 0.5;
}

.intent-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.request-layout,
.manage-layout {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
}

.request-item {
  grid-template-columns: 112px 1fr auto;
  padding: 16px;
  border-color: rgba(225, 227, 228, 0.9);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.request-item img {
  width: 112px;
  height: 112px;
  border-radius: 12px;
}

.request-item strong {
  font-size: 18px;
}

.export-panel {
  top: 82px;
}

.cart-bar {
  bottom: 18px;
  width: min(520px, calc(100vw - 32px));
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

.cart-bar button {
  min-height: 52px;
}

@media (max-width: 900px) {
  .topbar {
    align-items: center;
    gap: 10px;
  }

  .tabs {
    width: auto;
    grid-template-columns: repeat(2, minmax(72px, 1fr));
  }

  .tab.admin-only:not([hidden]) {
    display: block;
  }

  .toolbar,
  .content-grid,
  .request-layout,
  .manage-layout {
    grid-template-columns: 1fr;
  }

  .content-grid {
    gap: 20px;
  }

  .detail-panel,
  .export-panel {
    position: static;
  }
}

@media (max-width: 520px) {
  body {
    padding-bottom: 118px;
  }

  main {
    padding-inline: 12px;
  }

  .topbar {
    padding-inline: 12px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .toolbar {
    padding: 10px;
  }

  .item-grid {
    gap: 12px;
  }

  .item-meta strong {
    font-size: 15px;
  }

  .detail-hero-wrap {
    margin: 10px;
  }

  .detail-body {
    padding-inline: 14px;
  }

  .option-card {
    grid-template-columns: 76px minmax(0, 1fr);
    padding: 10px;
  }

  .option-card.no-image {
    grid-template-columns: 1fr;
  }

  .option-card img {
    width: 76px;
    height: 76px;
  }

  .request-item {
    grid-template-columns: 92px 1fr;
  }

  .request-item img {
    width: 92px;
    height: 92px;
  }
}

/* Stitch design alignment: mobile app shell */
:root {
  --primary: #a43a39;
  --primary-container: #ff7e79;
  --on-primary-container: #741619;
  --secondary: #006b57;
  --secondary-container: #86f3d4;
  --on-secondary-container: #00705b;
  --surface: #f8f9fa;
  --surface-lowest: #ffffff;
  --surface-low: #f3f4f5;
  --surface-container: #edeeef;
  --surface-variant: #e1e3e4;
  --outline: #8a716f;
  --outline-variant: #ddc0bd;
  --on-surface: #191c1d;
  --on-surface-variant: #574240;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

body {
  background: var(--surface);
  color: var(--on-surface);
  font-family:
    "Be Vietnam Pro", "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

.topbar {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  min-height: 76px;
  padding: 12px 22px;
  background: rgba(248, 249, 250, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 0;
}

.topbar h1 {
  justify-self: center;
  color: var(--primary);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 28px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0;
}

.menu-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--primary);
  font-size: 30px;
  line-height: 1;
  box-shadow: none;
}

.avatar {
  justify-self: end;
  width: 42px;
  height: 42px;
  border: 3px solid #2e3132;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 62%, #ff9a84 0 35%, transparent 36%),
    radial-gradient(circle at 50% 76%, #86f3d4 0 48%, transparent 49%),
    #f9d6cd;
  box-shadow: var(--shadow);
}

main {
  width: min(100%, 430px);
  padding: 24px 16px 108px;
}

.toolbar {
  display: none;
}

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  width: min(100%, 430px);
  height: 72px;
  margin: 0 auto;
  padding: 8px 10px;
  border: 1px solid rgba(221, 192, 189, 0.5);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.04);
}

body.admin-mode .tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 8px;
  border-radius: 999px;
  background: transparent;
  color: var(--on-surface-variant);
  font-size: 13px;
  line-height: 16px;
  letter-spacing: 0.8px;
}

.tab::before {
  content: attr(data-icon);
  display: block;
  font-size: 22px;
  line-height: 22px;
  margin-bottom: 3px;
}

.tab.is-active {
  background: var(--primary-container);
  color: var(--on-primary-container);
  box-shadow: none;
}

.tab span {
  margin-left: 2px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h2 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 24px;
  line-height: 32px;
  font-weight: 800;
}

#resultCount {
  color: var(--on-surface-variant);
  font-weight: 700;
}

.content-grid {
  display: block;
}

.gallery-section {
  display: block;
}

.item-grid {
  display: block;
  columns: 2;
  column-gap: 16px;
}

.item-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 20px;
  break-inside: avoid;
  border: 0;
  border-radius: 16px;
  background: var(--surface-lowest);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.item-card:hover,
.item-card.is-selected {
  border: 0;
  box-shadow: var(--shadow);
}

.item-card img,
.item-card:nth-child(2n) img,
.item-card:nth-child(3n) img {
  aspect-ratio: 4 / 5;
}

.item-card:nth-child(2n) img {
  aspect-ratio: 4 / 4.7;
}

.item-card:nth-child(3n) img {
  aspect-ratio: 4 / 3.9;
}

.floating-chip {
  top: 0;
  right: 0;
  bottom: auto;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 0 16px 0 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--primary);
  font-size: 15px;
  font-weight: 800;
  backdrop-filter: blur(10px);
}

.floating-chip.reserved,
.floating-chip.keep {
  color: var(--secondary);
}

.item-meta {
  padding: 18px 18px 20px;
  gap: 8px;
}

.item-meta strong {
  color: var(--on-surface);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 21px;
  line-height: 30px;
  font-weight: 800;
}

.like-line {
  color: var(--on-surface-variant);
  font-size: 18px;
  line-height: 24px;
}

.detail-panel {
  display: none;
  position: static;
  min-height: 0;
  scroll-margin-top: 88px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.detail-mode .gallery-section {
  display: none;
}

.detail-mode .detail-panel {
  display: block;
}

.detail-back {
  width: auto;
  min-height: 40px;
  margin-bottom: 14px;
  padding: 0 14px;
  background: transparent;
  color: var(--primary);
  box-shadow: none;
}

.detail-hero-wrap {
  margin: 0 0 24px;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.detail-hero {
  aspect-ratio: 4 / 3;
}

.detail-hero-copy {
  padding: 54px 18px 18px;
}

.detail-hero-copy h2 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 24px;
  line-height: 30px;
  font-weight: 800;
}

.detail-hero-copy p {
  font-size: 14px;
  font-weight: 700;
}

.detail-body {
  padding: 0 0 16px;
}

.detail-title {
  display: none;
}

.detail-description {
  margin-bottom: 24px;
  color: var(--on-surface-variant);
  font-size: 14px;
  line-height: 20px;
}

.product-heading {
  margin-bottom: 18px;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 24px;
  line-height: 32px;
  font-weight: 800;
}

.option-list {
  gap: 18px;
}

.option-card {
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 18px;
  min-height: 130px;
  padding: 18px;
  border: 0;
  border-radius: 16px;
  background: var(--surface-lowest);
  box-shadow: var(--shadow);
}

.option-card.no-image {
  grid-template-columns: 1fr;
}

.option-card img {
  width: 110px;
  height: 110px;
  border-radius: 10px;
}

.option-card.is-picked {
  background: var(--surface-lowest);
  outline: 2px solid rgba(255, 126, 121, 0.22);
}

.option-card.is-disabled img {
  opacity: 0.75;
}

.product-line strong {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 19px;
  line-height: 25px;
  font-weight: 800;
}

.chip.product-status {
  min-height: 30px;
  padding: 0 13px;
  background: var(--primary-container);
  color: var(--on-primary-container);
  font-size: 13px;
  font-weight: 700;
}

.chip.product-status.claimed {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
}

.chip.product-status.paused {
  background: var(--surface-variant);
  color: var(--on-surface-variant);
}

.option-copy p {
  color: var(--on-surface-variant);
  font-size: 15px;
  line-height: 22px;
}

.qty-control {
  gap: 18px;
}

.qty-control button {
  width: 38px;
  height: 38px;
  min-height: 38px;
  background: var(--surface-container);
  color: var(--on-surface);
  font-size: 24px;
}

.qty-control span {
  width: 30px;
  font-size: 20px;
}

.intent-form {
  margin-top: 28px;
  gap: 20px;
}

.intent-form label span,
.export-panel label span {
  color: var(--on-surface);
  font-size: 14px;
  letter-spacing: 1px;
  font-weight: 600;
}

.intent-form input,
.intent-form textarea,
.export-panel input,
.export-panel textarea {
  background: var(--surface-container);
  border: 2px solid transparent;
  border-radius: 14px;
  font-size: 16px;
}

.request-layout {
  display: block;
}

.request-layout > section {
  display: block;
}

.request-list {
  gap: 18px;
}

.request-item {
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--surface-variant);
  border-radius: 16px;
  background: var(--surface-lowest);
  box-shadow: var(--shadow);
}

.request-item img {
  width: 100%;
  height: 128px;
  border-radius: 10px;
}

.request-item strong {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 20px;
  line-height: 26px;
}

.request-item p {
  color: var(--on-surface);
  font-weight: 700;
}

.request-item small {
  display: block;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--surface-variant);
  border-radius: 8px;
  background: var(--surface);
  color: var(--on-surface-variant);
  font-style: italic;
}

.request-item button {
  justify-self: stretch;
}

.section-subtitle {
  margin-top: 4px;
  color: var(--on-surface-variant);
  font-size: 18px;
  line-height: 26px;
  font-weight: 600;
}

.manage-list {
  display: grid;
  gap: 18px;
  margin-bottom: 24px;
}

.manage-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 28px;
  gap: 16px;
  padding: 24px 18px;
  border-radius: 16px;
  background: var(--surface-lowest);
  box-shadow: var(--shadow);
}

.manage-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 12px;
  background: var(--secondary-container);
  color: var(--secondary);
  font-size: 28px;
  font-weight: 800;
}

.manage-card:nth-child(3n + 1) .manage-icon {
  background: #b69bff;
  color: #4f268a;
}

.manage-card:nth-child(3n) .manage-icon {
  background: var(--surface-container);
  color: var(--on-surface-variant);
}

.manage-copy strong {
  display: block;
  color: var(--on-surface);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 22px;
  line-height: 30px;
  font-weight: 800;
}

.manage-copy p,
.manage-status-panel p {
  color: var(--on-surface-variant);
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
}

.manage-menu {
  min-width: 28px;
  min-height: 44px;
  padding: 0;
  background: transparent;
  color: var(--on-surface-variant);
  font-size: 28px;
  box-shadow: none;
}

.manage-status-panel {
  grid-column: 1 / -1;
  padding: 18px;
  border: 1px solid rgba(221, 192, 189, 0.55);
  border-radius: 12px;
  background: var(--surface);
}

.status-segment {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 14px;
  padding: 6px;
  border-radius: 12px;
  background: var(--surface-low);
}

.status-segment.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.status-segment button {
  min-height: 72px;
  padding: 8px 4px;
  border-radius: 8px;
  background: transparent;
  color: var(--on-surface-variant);
  box-shadow: none;
  font-size: 15px;
  line-height: 20px;
  font-weight: 800;
}

.status-segment button span {
  font-size: 12px;
}

.status-segment button.is-on {
  background: var(--primary);
  color: var(--surface-lowest);
}

.visibility-panel {
  margin-top: 12px;
}

.form-title {
  margin-bottom: 12px;
  color: var(--on-surface);
  font-size: 20px;
  line-height: 28px;
}

.export-panel {
  position: static;
  margin-top: 18px;
  border: 1px solid var(--surface-variant);
  border-radius: 16px;
  background: var(--surface-lowest);
}

.profile-layout {
  display: grid;
  gap: 18px;
}

.profile-panel {
  padding: 20px;
  border-radius: 16px;
  background: var(--surface-lowest);
  box-shadow: var(--shadow);
}

.profile-panel h3 {
  margin-bottom: 12px;
  color: var(--on-surface);
  font-size: 20px;
  line-height: 28px;
}

.profile-actions {
  display: grid;
  gap: 12px;
}

.profile-actions button {
  min-height: 52px;
  border-radius: 999px;
  font-weight: 800;
}

.logic-list {
  display: grid;
  gap: 12px;
}

.logic-list p {
  padding: 14px;
  border: 1px solid rgba(221, 192, 189, 0.55);
  border-radius: 12px;
  background: var(--surface);
  color: var(--on-surface-variant);
  font-size: 15px;
  line-height: 1.55;
}

pre {
  background: var(--surface-low);
  border-radius: 12px;
}

.manage-layout {
  display: block;
}

.manager-form,
.help-panel,
.manage-layout > section {
  border-radius: 16px;
  background: var(--surface-lowest);
  box-shadow: var(--shadow);
}

.manage-layout > section {
  padding: 18px;
}

.help-panel {
  margin-top: 18px;
}

.form-row {
  grid-template-columns: 1fr;
}

.cart-bar {
  width: min(100% - 32px, 398px);
  bottom: 84px;
  padding: 10px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 28px rgba(164, 58, 57, 0.18);
}

.cart-bar button {
  min-height: 52px;
  border-radius: 999px;
}

.cart-bar.detail-action .ghost {
  display: none;
}

.cart-bar.detail-action #cartBarOpen {
  flex: 1 1 100%;
  background: var(--primary-container);
  color: var(--on-primary-container);
}

.cart-bar.detail-action #cartBarOpen::before {
  content: "生成意向清单 / ";
}

.toast {
  right: 16px;
  bottom: 156px;
  border-radius: 999px;
}

@media (min-width: 760px) {
  main {
    width: min(1180px, 100%);
  }

  .topbar {
    width: min(1180px, 100%);
    margin: 0 auto;
  }

  .toolbar {
    display: grid;
  }

  .content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 430px;
  }

  .item-grid {
    display: grid;
    columns: initial;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .item-card {
    display: block;
    margin: 0;
  }

  .detail-panel {
    display: block;
    position: sticky;
    top: 88px;
  }

  .detail-back {
    display: none;
  }

  .request-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 18px;
  }

  .request-item {
    grid-template-columns: 128px minmax(0, 1fr) auto;
  }

  .request-item img {
    width: 128px;
    height: 128px;
  }

  .request-item button {
    justify-self: end;
  }

  .manage-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
  }

  .help-panel {
    margin-top: 0;
  }
}

/* New planning library IA */
.add-button,
.icon-action {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(164, 58, 57, 0.22);
}

.tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.home-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 20px;
  border-radius: 18px;
  background: var(--surface-lowest);
  box-shadow: var(--shadow);
}

.home-hero h2 {
  font-size: 28px;
  line-height: 36px;
}

.home-hero p,
.muted-copy {
  color: var(--on-surface-variant);
  font-size: 14px;
  line-height: 1.5;
}

.home-hero button {
  min-width: 82px;
  min-height: 48px;
  border-radius: 999px;
  font-weight: 800;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 12px 8px;
  border-radius: 14px;
  background: var(--surface-lowest);
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-card strong,
.stat-card span {
  display: block;
}

.stat-card strong {
  color: var(--primary);
  font-size: 22px;
  line-height: 28px;
}

.stat-card span {
  color: var(--on-surface-variant);
  font-size: 12px;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 18px;
  padding: 6px;
  border-radius: 16px;
  background: var(--surface-container);
}

.mode-switch button,
.category-row button {
  min-height: 42px;
  border-radius: 12px;
  background: transparent;
  color: var(--on-surface-variant);
  font-weight: 800;
  box-shadow: none;
}

.mode-switch button.is-on,
.category-row button.is-on {
  background: var(--primary);
  color: #fff;
}

.home-panel,
.editor-panel,
.editor-card,
.request-card {
  margin-bottom: 18px;
  padding: 18px;
  border-radius: 18px;
  background: var(--surface-lowest);
  box-shadow: var(--shadow);
}

.section-heading.tight {
  align-items: start;
}

.plan-list {
  display: grid;
  gap: 18px;
}

.plan-card {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: var(--surface-lowest);
  box-shadow: var(--shadow);
}

.plan-cover {
  position: relative;
  height: 220px;
  background: var(--surface-container);
}

.plan-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.plan-cover span {
  position: absolute;
  top: 0;
  right: 0;
  padding: 10px 14px;
  border-radius: 0 18px 0 14px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary);
  font-weight: 900;
}

.plan-body {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.plan-body strong {
  font-size: 22px;
  line-height: 30px;
}

.plan-body p {
  color: var(--on-surface-variant);
  font-size: 14px;
  line-height: 1.45;
}

.mini-row,
.tag-row,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.mini-row span,
.tag-row span {
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-container);
  color: var(--on-surface-variant);
  font-size: 12px;
  font-weight: 800;
}

.edit-chip {
  position: absolute;
  right: 12px;
  bottom: 12px;
  min-height: 36px;
  border-radius: 999px;
  background: var(--primary-container);
  color: var(--on-primary-container);
  font-weight: 900;
}

.category-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.category-row button {
  flex: 0 0 auto;
  padding: 0 14px;
  background: var(--surface-lowest);
}

.product-list {
  display: grid;
  gap: 12px;
}

.product-card {
  position: relative;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--surface-variant);
  border-radius: 16px;
  background: var(--surface-lowest);
}

.select-check {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.select-check input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--primary);
}

.product-card img {
  width: 82px;
  height: 82px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface-container);
}

.product-card strong {
  display: block;
  font-size: 17px;
  line-height: 23px;
}

.product-card p {
  margin: 4px 0 8px;
  color: var(--on-surface-variant);
  font-size: 13px;
}

.product-card .card-actions {
  grid-column: 1 / -1;
}

.card-actions button {
  flex: 1;
  min-height: 38px;
  border-radius: 999px;
}

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

#planEditView,
#inventoryPickView,
#productEditView {
  display: none;
}

#planEditView.is-active,
#inventoryPickView.is-active,
#productEditView.is-active {
  display: block;
}

#planEditPage,
#inventoryPickPage,
#productEditPage {
  display: grid;
  gap: 18px;
}

.editor-head h2 {
  font-size: 22px;
}

.editor-card {
  display: grid;
  gap: 14px;
}

.editor-card h3 {
  font-size: 20px;
}

.editor-card label {
  color: var(--on-surface);
  font-size: 13px;
  font-weight: 800;
}

.form-hint {
  color: var(--on-surface-variant);
  font-size: 12px;
  line-height: 1.45;
}

.editor-card input,
.editor-card textarea,
.editor-card select {
  border: 0;
  border-radius: 14px;
  background: var(--surface-container);
}

.file-trigger {
  padding: 14px;
  border: 1px dashed var(--outline-variant);
  border-radius: 14px;
  background: var(--surface);
}

.file-trigger input {
  padding: 8px 0 0;
  background: transparent;
}

.compact-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.assign-toolbar {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border-radius: 16px;
  background: var(--surface-lowest);
  box-shadow: var(--shadow);
}

.assign-toolbar strong {
  display: block;
  margin-bottom: 4px;
  font-size: 18px;
}

.assign-toolbar p {
  color: var(--on-surface-variant);
  font-size: 13px;
  line-height: 1.45;
}

.assign-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.assign-actions button {
  min-height: 42px;
  border-radius: 999px;
  font-weight: 800;
}

.assign-list button {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  border-radius: 14px;
  background: var(--surface);
  color: var(--on-surface);
  text-align: left;
}

.assign-list img {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
}

.public-products {
  display: grid;
  gap: 8px;
  margin: 8px 0;
}

.public-search {
  margin-bottom: 16px;
  color: var(--on-surface);
  font-size: 13px;
  font-weight: 800;
}

.public-search input {
  border: 0;
  border-radius: 16px;
  background: var(--surface-container);
}

.public-products label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--on-surface);
  font-size: 14px;
}

.public-products input {
  width: 18px;
  min-height: 18px;
}

.request-card {
  display: grid;
  gap: 14px;
}

.request-card strong {
  font-size: 20px;
}

.request-card p {
  color: var(--on-surface-variant);
  line-height: 1.5;
}

.request-lines {
  display: grid;
  gap: 10px;
}

.request-lines div {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface);
}

.request-lines img {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
}

.app-dialog {
  width: min(360px, calc(100vw - 32px));
  border: 0;
  border-radius: 20px;
  padding: 0;
  background: var(--surface-lowest);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.app-dialog::backdrop {
  background: rgba(0, 0, 0, 0.22);
}

.app-dialog form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.dialog-actions {
  display: grid;
  gap: 10px;
}

@media (min-width: 760px) {
  main,
  .topbar,
  .tabs {
    width: min(1180px, 100%);
  }

  .tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .plan-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
