:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #d9dee7;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --danger: #b42318;
  --soft: #eef4ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

.shell {
  min-height: 100vh;
}

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.topbar-inner,
.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font-weight: 700;
  font-size: 20px;
}

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

.nav a,
.btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 8px 12px;
  cursor: pointer;
}

.btn.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
}

.btn.primary:hover {
  background: var(--brand-dark);
}

.btn.danger {
  border-color: #f3b4ad;
  color: var(--danger);
}

.container {
  padding: 28px 0 56px;
}

.admin-container {
  width: min(1600px, calc(100% - 24px));
}

.display-container {
  width: 100%;
  max-width: none;
  padding: 24px clamp(12px, 2.5vw, 36px) 56px;
}

.display-container > .panel {
  width: 100%;
}

.hero {
  padding: 40px 0 28px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.05;
}

.hero p {
  margin: 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.page-heading {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.15;
}

.page-heading p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.preserve-lines {
  white-space: pre-line;
}

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

.card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.card {
  padding: 18px;
}

.card h2,
.card h3,
.panel h2,
.panel h3 {
  margin: 0 0 8px;
}

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

.layout {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.sidebar,
.content {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sidebar {
  padding: 10px;
  position: sticky;
  top: 16px;
}

.sidebar h2 {
  font-size: 17px;
  line-height: 1.25;
}

.sidebar .muted,
.item-tab span {
  font-size: 12px;
}

.add-template-panel {
  display: grid;
  gap: 10px;
}

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

.template-type-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.template-type-button.active {
  border-color: var(--brand);
  background: var(--soft);
  color: var(--brand-dark);
  font-weight: 700;
}

.content {
  padding: 18px;
}

.admin-create-start {
  width: min(420px, 100%);
  margin: 0 auto;
}

.item-tab {
  width: 100%;
  display: block;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  padding: 8px;
  cursor: pointer;
}

.item-tab.active {
  border-color: #b8cdfd;
  background: var(--soft);
}

.form-grid {
  display: grid;
  gap: 14px;
}

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

label {
  display: grid;
  gap: 6px;
  color: #374151;
  font-size: 14px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 10px 11px;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.section {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.image-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.image-list img,
.placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #eef0f4;
}

.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
}

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

.chip {
  border: 1px solid #b8cdfd;
  background: var(--soft);
  color: #1e40af;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
}

.chip-button {
  cursor: pointer;
}

.chip.unavailable,
.calendar-day.unavailable {
  border-color: #fecdca;
  background: #fff1f3;
  color: #b42318;
}

.chip.logistics,
.calendar-day.logistics {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.path {
  color: #365314;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 6px 8px;
  display: inline-flex;
  margin: 2px 0 12px;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

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

.catalog-head h3 {
  margin: 0;
}

.catalog-filters {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) repeat(5, minmax(130px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.catalog-filters label {
  display: grid;
  gap: 8px;
}

.catalog-filters span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.catalog-search input {
  width: 100%;
}

.catalog-empty {
  margin-top: 14px;
  min-height: 96px;
  aspect-ratio: auto;
}

.photo-admin {
  display: grid;
  gap: 14px;
}

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

.service-package-row {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.service-package-row textarea {
  min-height: 86px;
}

.service-package-row .btn {
  justify-self: end;
}

.photo-service-page {
  display: grid;
  gap: 4px;
}

.photo-service-heading {
  max-width: 920px;
}

.service-package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.service-package-card {
  display: grid;
  align-content: start;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.service-package-card h4 {
  margin: 0 0 6px;
  font-size: 17px;
}

.service-package-card strong {
  color: #b42318;
  font-size: 20px;
}

.service-package-card p,
.service-info-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

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

.service-info-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.service-info-grid h3 {
  margin-top: 0;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.product-card {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.product-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #eef0f4;
}

.product-body {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.product-attributes {
  min-height: 31px;
  align-content: flex-start;
}

.product-body h4 {
  min-height: 44px;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.status-pill {
  width: fit-content;
  border: 1px solid #abefc6;
  border-radius: 999px;
  background: #ecfdf3;
  color: #067647;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.unavailable {
  border-color: #eaecf0;
  background: #f2f4f7;
  color: #667085;
}

.status-pill.logistics {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.product-card .list-status.earliest {
  border-color: #fbcfe8;
  background: #fdf2f8;
  color: #be185d;
}

.negotiable-time {
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.product-body p {
  min-height: 42px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.product-meta strong {
  color: #b42318;
  font-size: 16px;
}

.product-meta span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-calendar {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.product-calendar > .muted {
  font-size: 12px;
}

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

.admin-product {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.admin-product-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-product-row {
  display: grid;
  grid-template-columns: 28px 54px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.admin-product-row:hover {
  border-color: #b8c3d6;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.admin-product-row.active {
  border-color: var(--brand);
  background: #f8fbff;
}

.admin-product-row.dragging {
  opacity: 0.55;
}

.admin-product-row.drag-over {
  border-color: var(--brand);
  background: var(--soft);
}

.drag-handle {
  width: 28px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  cursor: grab;
  font-size: 15px;
}

.drag-handle:active {
  cursor: grabbing;
}

.admin-product-thumb {
  width: 54px;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  background: #eef0f4;
}

.admin-product-thumb.placeholder {
  display: grid;
  place-items: center;
  padding: 4px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.admin-product-summary {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.admin-product-summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-product-title-line,
.admin-product-meta-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-product-title-line strong {
  min-width: 0;
  font-size: 14px;
}

.admin-product-title-line span {
  flex: 0 0 auto;
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 13px;
}

.admin-product-meta-line {
  flex-wrap: wrap;
  font-size: 12px;
}

.admin-product-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-product-actions .btn {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.chips.compact {
  max-height: 72px;
  overflow: auto;
}

.admin-product-detail {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  border-color: #b8cdfd;
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.1);
}

.admin-product-detail h3 {
  margin: 0;
}

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

.tag-picker {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.tag-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tag-picker-head strong {
  font-size: 14px;
}

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

.tag-option-wrap {
  display: inline-flex;
  align-items: stretch;
}

.tag-option,
.tag-add-button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 5px 10px;
  cursor: pointer;
  font-size: 13px;
}

.tag-option-wrap .tag-option {
  border-radius: 999px 0 0 999px;
}

.tag-option.active {
  border-color: var(--brand);
  background: var(--soft);
  color: #1e40af;
  font-weight: 700;
}

.tag-delete-button {
  width: 28px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 999px 999px 0;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.tag-option.active + .tag-delete-button {
  border-color: var(--brand);
  background: var(--soft);
}

.tag-delete-button:hover {
  color: var(--danger);
}

.tag-add-button {
  width: 30px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.product-image-editor {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.product-image-editor input[type="file"] {
  padding: 8px;
}

.product-image-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.product-range-editor {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

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

.product-range-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.product-range-panel > strong {
  font-size: 14px;
}

.product-image-preview figure,
.product-detail-gallery figure {
  margin: 0;
}

.product-image-preview img,
.product-image-preview .placeholder,
.product-detail-gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  background: #eef0f4;
}

.product-image-preview figcaption,
.product-detail-gallery figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 18px;
  color: var(--brand);
  font-weight: 700;
}

.product-detail {
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.product-detail-media img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #eef0f4;
}

.product-detail-media > .placeholder {
  aspect-ratio: 1 / 1;
}

.product-detail-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

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

.product-status-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.product-detail-info h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.18;
}

.product-detail-info p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.detail-price {
  color: #b42318;
  font-size: 24px;
}

.product-trade-link {
  width: fit-content;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.calendar-day {
  min-height: 44px;
  border: 1px solid #b8cdfd;
  border-radius: 6px;
  background: var(--soft);
  color: #1e40af;
  cursor: pointer;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

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

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-dot.available {
  background: #12b76a;
}

.legend-dot.unavailable {
  background: #98a2b3;
}

.legend-dot.logistics {
  background: #2e90fa;
}

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

.calendar-month {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.calendar-month h4 {
  margin: 0 0 12px;
}

.calendar-weekdays,
.calendar-cells {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekdays {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.calendar-cell {
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 2px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 4px;
  text-align: center;
}

.calendar-cell strong {
  font-size: 14px;
}

.calendar-cell span {
  font-size: 11px;
}

.calendar-cell.empty {
  background: transparent;
}

.calendar-cell.available {
  border-color: #abefc6;
  background: #ecfdf3;
  color: #067647;
}

.calendar-cell.unavailable {
  border-color: #eaecf0;
  background: #f2f4f7;
  color: #667085;
}

.calendar-cell.logistics {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.notice {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #ecfdf3;
  color: #067647;
  border: 1px solid #abefc6;
}

.xianyu-login-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.xianyu-login-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.xianyu-login-head p {
  margin: 4px 0 0;
}

.xianyu-login-frame {
  width: 100%;
  max-width: 720px;
  aspect-ratio: 1366 / 900;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.xianyu-login-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.xianyu-login-done {
  padding: 12px;
  border: 1px solid #abefc6;
  border-radius: 6px;
  background: #ecfdf3;
  color: #067647;
}

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

  .catalog-search {
    grid-column: span 2;
  }
}

@media (max-width: 820px) {
  .container,
  .display-container {
    width: 100%;
    padding: 14px 12px 36px;
  }

  .topbar-inner,
  .layout,
  .grid,
  .two {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    align-items: flex-start;
    padding: 14px 0;
  }

  .layout {
    display: grid;
  }

  .sidebar {
    position: static;
  }

  .product-detail {
    grid-template-columns: 1fr;
  }

  .admin-product-row,
  .admin-products,
  .service-package-editor,
  .service-info-grid,
  .product-image-editor,
  .product-image-preview,
  .tag-editor-grid,
  .product-range-columns {
    grid-template-columns: 1fr;
  }

  .admin-product-row {
    grid-template-columns: 28px 48px minmax(0, 1fr);
    align-items: center;
  }

  .drag-handle {
    width: 28px;
    height: 48px;
  }

  .admin-product-thumb {
    width: 48px;
  }

  .admin-product-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
  }

  .xianyu-login-head {
    display: grid;
  }

  .catalog-filters {
    grid-template-columns: 1fr;
  }

  .catalog-search {
    grid-column: auto;
  }

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

  .product-body {
    gap: 8px;
    padding: 9px;
  }

  .product-body h4 {
    min-height: 40px;
    font-size: 13px;
    line-height: 1.5;
  }

  .product-body p {
    min-height: 38px;
    font-size: 12px;
  }

  .booking-calendars {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .display-container {
    padding-right: 8px;
    padding-left: 8px;
  }

  .content {
    padding: 12px;
  }

  .page-heading h1 {
    font-size: 25px;
  }

  .catalog-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}
