:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #eef4f1;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d8dee6;
  --accent: #157f72;
  --accent-dark: #0f5f56;
  --price-red: #c62828;
  --warn: #b45309;
  --danger: #b42318;
  --shadow: 0 18px 42px rgba(31, 41, 51, 0.09);
  --radius: 8px;
  --topbar-height: 56px;
  --project-sticky-top: 56px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  color: var(--ink);
  background: var(--bg);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

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

button {
  cursor: pointer;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 6px 18px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #fff;
  background: var(--accent);
  border-radius: 8px;
  overflow: hidden;
}

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

.brand span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.nav a {
  padding: 8px 12px;
  color: var(--muted);
  border-radius: 6px;
}

.nav a:hover,
.nav a.active {
  color: var(--accent-dark);
  background: var(--surface-soft);
}

.app {
  width: min(1180px, calc(100% - 32px));
  max-width: 100%;
  margin: 28px auto 42px;
  overflow-x: visible;
}

.site-footer {
  width: min(1180px, calc(100% - 32px));
  max-width: 100%;
  margin: 0 auto 28px;
  padding: 10px 0 18px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.site-footer a:hover {
  color: var(--accent-dark);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 28px;
  align-items: stretch;
  min-height: calc(100vh - 148px);
}

.intro-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(32px, 7vw, 88px);
  color: #fff;
  background:
    linear-gradient(rgba(18, 48, 47, 0.78), rgba(18, 48, 47, 0.66)),
    url("https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=1600&q=80")
      center/cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 12px;
  color: #c9efe6;
  font-weight: 700;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.08;
  letter-spacing: 0;
}

.lead {
  max-width: 680px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 18px;
  line-height: 1.8;
}

.entry-card,
.panel,
.summary-panel,
.detail-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.entry-card {
  align-self: center;
  padding: 28px;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  color: #344054;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cfd6df;
  border-radius: 6px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(21, 127, 114, 0.14);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.tiny-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 800;
}

.primary-btn {
  width: 100%;
  color: #fff;
  background: var(--accent);
}

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

.confirm-submit-btn {
  width: auto;
}

.secondary-btn {
  color: var(--accent-dark);
  background: var(--surface-soft);
  border-color: #b8d8d1;
}

.ghost-btn {
  color: var(--muted);
  background: #fff;
  border-color: var(--line);
}

.danger-btn {
  color: var(--danger);
  background: #fff5f5;
  border-color: #f3b8b5;
}

.tiny-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.quote-layout {
  display: block;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.page-head h2 {
  margin-bottom: 6px;
  font-size: 30px;
}

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

.panel {
  margin-bottom: 18px;
  padding: 20px;
}

.designer-select-panel {
  display: grid;
  grid-template-columns: minmax(220px, 360px);
  gap: 16px;
  align-items: end;
}

.designer-select-panel label,
.designer-select-panel p {
  margin-bottom: 0;
}

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

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

.project-browser-panel {
  padding: 0;
  overflow: visible;
}

.project-browser {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  max-width: 100%;
  min-height: 0;
  overflow: visible;
  align-items: start;
}

.category-rail {
  position: sticky;
  top: var(--project-sticky-top);
  z-index: 8;
  display: grid;
  align-content: start;
  max-height: none;
  overflow: visible;
  background: #f1f3f5;
  border-right: 1px solid var(--line);
}

.category-rail-item {
  min-height: 64px;
  padding: 10px 12px;
  color: #4b5563;
  background: transparent;
  border: 0;
  border-left: 4px solid transparent;
  border-radius: 0;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
}

.category-rail-item.active {
  color: var(--price-red);
  background: #fff;
  border-left-color: var(--price-red);
}

.project-scroll {
  min-width: 0;
  max-height: none;
  overflow-y: visible;
  overflow-x: clip;
  background: #fff;
}

.project-category-section {
  padding: 16px 18px 4px;
  scroll-margin-top: calc(var(--project-sticky-top) + 10px);
}

.project-category-title {
  position: sticky;
  top: var(--project-sticky-top);
  z-index: 2;
  margin: -16px -18px 12px;
  padding: 14px 18px 10px;
  background: rgba(255, 255, 255, 0.96);
}

.project-browser .option-grid {
  grid-template-columns: 1fr;
  gap: 10px;
}

.package-card,
.option-card {
  position: relative;
  display: grid;
  gap: 10px;
  min-height: 134px;
  padding: 15px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.package-card.selected,
.option-card.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.package-card input,
.option-card input[type="checkbox"] {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 18px;
  min-height: 18px;
}

.option-card {
  grid-template-columns: 92px minmax(0, 1fr) auto;
  align-items: center;
  max-width: 100%;
  overflow: hidden;
  min-height: 118px;
  padding: 12px;
}

.option-card input[type="checkbox"] {
  display: none;
}

.option-thumb {
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  color: #fff;
  background:
    linear-gradient(rgba(20, 20, 20, 0.05), rgba(20, 20, 20, 0.08)),
    linear-gradient(135deg, #f7d774, #f08a65 52%, #3aa99e);
  border-radius: 8px;
  overflow: hidden;
}

.option-thumb span {
  padding: 5px 8px;
  color: #1f2933;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 6px;
  font-size: 15px;
  font-weight: 900;
}

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

.option-thumb.has-image {
  background: #f8fafc;
}

.option-info {
  display: grid;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

.card-title {
  padding-right: 26px;
  font-size: 17px;
  font-weight: 850;
}

.price {
  color: var(--price-red);
  font-size: 22px;
  font-weight: 900;
  white-space: nowrap;
}

.option-info .card-title {
  padding-right: 0;
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.option-info .price {
  font-size: 18px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.option-info .muted {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.items {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.65;
}

.category-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.category-title h3 {
  margin: 0;
}

.qty-control {
  display: grid;
  grid-template-columns: 30px 44px 30px;
  gap: 6px;
  align-items: center;
  width: 116px;
}

.qty-control button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.qty-control input {
  min-height: 32px;
  padding: 4px;
  text-align: center;
}

.summary-panel {
  position: fixed;
  right: max(16px, calc((100vw - 1180px) / 2));
  bottom: 18px;
  left: max(16px, calc((100vw - 1180px) / 2));
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 104px;
  gap: 8px;
  align-items: center;
  padding: 4px 12px 8px;
  box-shadow: 0 16px 40px rgba(31, 41, 51, 0.16);
}

.floating-summary-hint {
  grid-column: 1 / -1;
  margin: -4px -12px 0;
  padding: 3px 12px;
  color: #8a4b00;
  background: #fff4e8;
  font-size: 11px;
  line-height: 1.25;
}

.floating-summary-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.floating-summary-main strong {
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
}

.floating-summary-main span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floating-summary-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.floating-summary-price span {
  color: var(--muted);
  font-size: 11px;
}

.floating-summary-price strong {
  color: var(--price-red);
  font-size: 16px;
  font-weight: 950;
}

.summary-panel .primary-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.settings-preview-logo {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.settings-preview-banner {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.option-admin-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.option-admin-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.status-select {
  min-width: 104px;
  min-height: 34px;
  padding: 5px 8px;
  font-size: 13px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid #edf0f4;
}

.summary-row:last-child {
  border-bottom: none;
}

.total {
  color: var(--accent-dark);
  font-size: 30px;
  font-weight: 950;
}

.summary-list {
  max-height: 260px;
  margin: 12px 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.summary-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  color: var(--muted);
  border-bottom: 1px dashed #dde3ea;
  line-height: 1.45;
}

.detail-card {
  padding: 24px;
}

.detail-toolbar,
.admin-toolbar,
.row-actions,
.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.copy-box {
  width: 100%;
  min-height: 280px;
  margin: 16px 0;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.7;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
}

.tab-btn {
  min-height: 38px;
  padding: 0 14px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 800;
  white-space: nowrap;
}

.tab-btn.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: #344054;
  background: #f1f5f6;
  font-size: 14px;
}

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

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

.compact-item {
  display: grid;
  gap: 6px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.notice {
  padding: 10px 12px;
  color: var(--warn);
  background: #fff8eb;
  border: 1px solid #f3d19c;
  border-radius: 6px;
}

.notice.success {
  color: var(--accent-dark);
  background: var(--surface-soft);
  border-color: #b8d8d1;
}

@media (max-width: 920px) {
  .split-layout,
  .quote-layout,
  .admin-grid,
  .designer-select-panel {
    grid-template-columns: 1fr;
  }

  .package-grid,
  .option-grid {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    grid-template-columns: 1fr;
  }

  .floating-summary-price {
    justify-content: space-between;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 6px 10px;
  }

  .app {
    width: min(100% - 20px, 1180px);
    margin-top: 16px;
    margin-bottom: 120px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .package-grid,
  .option-grid {
    grid-template-columns: 1fr;
  }

  .project-browser {
    grid-template-columns: 92px minmax(0, 1fr);
    min-height: 0;
  }

  .category-rail,
  .project-scroll {
    max-height: none;
  }

  .category-rail {
    top: var(--project-sticky-top);
    align-self: start;
    max-height: calc(100vh - var(--project-sticky-top) - 92px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .category-rail-item {
    min-height: 58px;
    padding: 8px 6px;
    font-size: 13px;
  }

  .project-category-section {
    padding: 12px 10px 2px;
  }

  .project-category-title {
    margin: -12px -10px 10px;
    padding: 10px;
  }

  .project-category-title h3 {
    font-size: 17px;
  }

  .project-browser .option-card {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 10px;
  }

  .project-browser .option-thumb {
    width: 82px;
    height: 82px;
  }

  .project-browser .qty-control {
    grid-column: 2;
    justify-self: end;
    max-width: 100%;
  }

  .project-browser .option-info {
    max-width: 100%;
  }

  .project-browser .option-info .price {
    font-size: 16px;
  }

  .intro-panel {
    min-height: 420px;
    padding: 28px;
  }

  .entry-card,
  .panel,
  .detail-card {
    padding: 16px;
  }

  body.keyboard-open .split-layout {
    min-height: auto;
    display: block;
    padding-bottom: 70vh;
  }

  body.keyboard-open .entry-card {
    margin-top: 10px;
    align-self: start;
  }

  body.keyboard-open .intro-panel {
    display: none;
  }

  .summary-panel {
    right: 10px;
    bottom: 8px;
    left: 10px;
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 6px;
    padding: 5px 8px 8px;
  }

  .floating-summary-main span {
    max-width: 100%;
  }

  .floating-summary-price strong {
    font-size: 16px;
  }

  .floating-summary-hint {
    margin: -5px -8px 0;
    padding: 3px 8px;
    font-size: 11px;
  }

  .summary-panel .primary-btn {
    grid-column: 2;
    grid-row: 2 / span 2;
    min-width: 96px;
    min-height: 34px;
    font-size: 13px;
  }

  .floating-summary-price {
    gap: 5px;
  }
}
