/* =========================================================
   PackCollect design system
   ========================================================= */
:root {
  --ink: #102a43;
  --ink-soft: #243b53;
  --muted: #627d98;
  --muted-light: #8aa0b5;
  --paper: #f4f1ea;
  --paper-deep: #ece7dc;
  --surface: #fffdfa;
  --white: #ffffff;
  --line: #e4dfd4;
  --line-soft: #eeeae1;
  --orange: #f06430;
  --orange-deep: #d95020;
  --orange-soft: #fdeee6;
  --teal: #1e846a;
  --teal-soft: #e7f4ef;
  --gold: #b6822e;
  --danger: #c34635;
  --danger-soft: #fceae7;
  --blue: #2d6f9e;
  --plum: #7d5a8c;
  --shadow-sm: 0 1px 2px rgba(16, 42, 67, 0.05), 0 4px 14px rgba(16, 42, 67, 0.04);
  --shadow-md: 0 12px 32px rgba(16, 42, 67, 0.09);
  --shadow-lg: 0 24px 70px rgba(16, 42, 67, 0.16);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --font: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB",
    sans-serif;
  --mono: "Cascadia Code", "Consolas", "SFMono-Regular", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-locked {
  overflow: hidden;
}

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

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
}

::selection {
  background: rgba(240, 100, 48, 0.2);
}

:focus-visible {
  outline: 2px solid rgba(240, 100, 48, 0.72);
  outline-offset: 2px;
}

.icon {
  display: block;
  flex: none;
}

/* =========================================================
   Shared primitives
   ========================================================= */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-border: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--btn-border);
  border-radius: 11px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease,
    box-shadow 0.16s ease, opacity 0.16s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.btn-primary {
  --btn-bg: var(--ink);
  --btn-fg: #fff;
  --btn-border: var(--ink);
  box-shadow: 0 8px 20px rgba(16, 42, 67, 0.16);
}

.btn-primary:hover:not(:disabled) {
  --btn-bg: #173b5c;
  --btn-border: #173b5c;
  box-shadow: 0 10px 24px rgba(16, 42, 67, 0.22);
}

.btn-accent {
  --btn-bg: var(--orange);
  --btn-fg: #fff;
  --btn-border: var(--orange);
  box-shadow: 0 8px 22px rgba(240, 100, 48, 0.26);
}

.btn-secondary {
  --btn-bg: var(--white);
  --btn-fg: var(--ink-soft);
  --btn-border: var(--line);
  box-shadow: 0 1px 1px rgba(16, 42, 67, 0.03);
}

.btn-secondary:hover:not(:disabled) {
  --btn-border: #cfc7b8;
  --btn-bg: #fffdf8;
}

.btn-ghost {
  --btn-fg: var(--muted);
  --btn-border: transparent;
}

.btn-ghost:hover:not(:disabled) {
  --btn-bg: rgba(16, 42, 67, 0.06);
  --btn-fg: var(--ink);
}

.btn-danger {
  --btn-bg: var(--danger);
  --btn-fg: #fff;
  --btn-border: var(--danger);
}

.btn-sm {
  min-height: 34px;
  padding: 0 13px;
  border-radius: 9px;
  font-size: 13px;
}

.btn-lg {
  min-height: 50px;
  padding: 0 24px;
  border-radius: 13px;
  font-size: 15px;
}

.btn.is-loading {
  pointer-events: none;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-secondary .spinner {
  border-color: rgba(16, 42, 67, 0.2);
  border-top-color: var(--ink);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.icon-btn:hover {
  background: rgba(16, 42, 67, 0.06);
  color: var(--ink);
}

.link-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-decoration: underline;
  text-decoration-color: rgba(16, 42, 67, 0.25);
  text-underline-offset: 3px;
}

.link-btn:hover {
  text-decoration-color: var(--orange);
}

.mobile-only {
  display: none !important;
}

.step-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--orange);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.eyebrow > span:first-child {
  color: var(--orange);
}

.eyebrow-line {
  width: 44px;
  height: 1px;
  background: rgba(16, 42, 67, 0.2);
}

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

/* =========================================================
   Header / footer
   ========================================================= */
.page-texture {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 4%, rgba(240, 100, 48, 0.085), transparent 29%),
    radial-gradient(circle at 88% 0%, rgba(30, 132, 106, 0.07), transparent 26%),
    linear-gradient(rgba(16, 42, 67, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 42, 67, 0.026) 1px, transparent 1px);
  background-size: auto, auto, 40px 40px, 40px 40px;
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.45) 60%, transparent 100%);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid rgba(16, 42, 67, 0.07);
  background: rgba(250, 248, 243, 0.86);
  backdrop-filter: blur(18px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1420px, calc(100% - 64px));
  height: 78px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  flex: none;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(16, 42, 67, 0.2);
}

.brand-mark-svg {
  display: block;
  border-radius: 12px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}

.brand-copy strong {
  font-family: "Segoe UI", var(--font);
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.brand-copy span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.online-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}

.online-pill i {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(30, 132, 106, 0.1);
}

.online-pill i::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid rgba(30, 132, 106, 0.42);
  animation: pulse 2.2s ease-out infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.7);
    opacity: 0.9;
  }
  70%,
  100% {
    transform: scale(1.7);
    opacity: 0;
  }
}

.header-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 2px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

.header-link:hover {
  color: var(--orange-deep);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1420px, calc(100% - 64px));
  margin: 54px auto 0;
  padding: 26px 0 34px;
  border-top: 1px solid rgba(16, 42, 67, 0.1);
  color: var(--muted);
  font-size: 12px;
}

.site-footer > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-brand {
  color: var(--ink);
  font-weight: 750;
  letter-spacing: -0.01em;
}

/* =========================================================
   Front page
   ========================================================= */
.front-main {
  width: min(1420px, calc(100% - 64px));
  margin: 0 auto;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, 0.75fr);
  align-items: end;
  gap: 48px;
  padding: 52px 4px 38px;
}

.intro h1 {
  max-width: 760px;
  margin: 18px 0 15px;
  color: var(--ink);
  font-size: clamp(36px, 4.2vw, 58px);
  font-weight: 760;
  letter-spacing: -0.045em;
  line-height: 1.13;
}

.intro h1 em {
  position: relative;
  color: var(--orange);
  font-style: normal;
  white-space: nowrap;
}

.intro h1 em::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 4px;
  left: 2px;
  height: 7px;
  border-radius: 4px;
  background: rgba(240, 100, 48, 0.18);
  z-index: -1;
}

.lede {
  max-width: 640px;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.85;
}

.intro-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 8px 0 6px;
  border-top: 1px solid rgba(16, 42, 67, 0.15);
  border-bottom: 1px solid rgba(16, 42, 67, 0.15);
}

.intro-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 18px 14px 16px;
  border-right: 1px solid rgba(16, 42, 67, 0.1);
}

.intro-stat:first-child {
  padding-left: 0;
}

.intro-stat:last-of-type {
  border-right: 0;
}

.intro-stat-label {
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.04em;
}

.intro-stat strong {
  color: var(--ink);
  font-family: "Segoe UI", var(--font);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.intro-note {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 7px;
  padding-top: 12px;
  color: var(--muted);
  font-size: 11.5px;
}

.workspace {
  display: grid;
  grid-template-columns: 386px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 250, 0.92);
  box-shadow: var(--shadow-sm);
}

.material-panel {
  position: sticky;
  top: 102px;
  display: flex;
  flex-direction: column;
  min-height: 520px;
  max-height: calc(100vh - 126px);
  overflow: hidden;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 24px 16px;
}

.panel-heading h2 {
  font-size: 21px;
  font-weight: 720;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  margin: 0 20px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.search-field:focus-within {
  border-color: rgba(240, 100, 48, 0.65);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(240, 100, 48, 0.09);
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
}

.search-field input::placeholder {
  color: #9aabbb;
}

.search-field input::-webkit-search-cancel-button {
  cursor: pointer;
}

.search-field kbd {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--paper);
  color: var(--muted-light);
  font-family: var(--mono);
  font-size: 10px;
}

.category-chips {
  display: flex;
  gap: 7px;
  margin-top: 14px;
  padding: 0 20px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  height: 29px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(16, 42, 67, 0.05);
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.chip:hover {
  background: rgba(16, 42, 67, 0.09);
  color: var(--ink);
}

.chip.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.material-list {
  flex: 1;
  min-height: 140px;
  padding: 0 12px 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(16, 42, 67, 0.15) transparent;
}

.material-card {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  margin-bottom: 7px;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.material-card:hover {
  background: rgba(16, 42, 67, 0.035);
  border-color: rgba(16, 42, 67, 0.06);
}

.material-card.is-selected {
  border-color: rgba(240, 100, 48, 0.45);
  background: var(--orange-soft);
}

.material-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.material-avatar.tone-orange {
  background: #fdeee6;
  color: #c95525;
}

.material-avatar.tone-blue {
  background: #e9f1f7;
  color: var(--blue);
}

.material-avatar.tone-plum {
  background: #f2ecf5;
  color: var(--plum);
}

.material-avatar.tone-gold {
  background: #f8f1df;
  color: #9a6d20;
}

.material-card-body {
  min-width: 0;
}

.material-card-title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}

.material-card-title > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-card-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.material-code {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: -0.02em;
}

.meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #b7c3cd;
}

.material-card-spec {
  overflow: hidden;
  text-overflow: ellipsis;
}

.version-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 5px;
  background: rgba(30, 132, 106, 0.1);
  color: var(--teal);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
}

.version-tag.is-empty {
  background: rgba(16, 42, 67, 0.05);
  color: var(--muted-light);
}

.material-card-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(16, 42, 67, 0.12);
  border-radius: 50%;
  background: transparent;
  color: transparent;
}

.material-card.is-selected .material-card-check {
  border-color: var(--orange);
  background: var(--orange);
  color: #fff;
}

.panel-foot {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-light);
  font-size: 11px;
  line-height: 1.5;
}

.list-empty {
  padding: 34px 22px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.list-empty strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 14px;
}

.list-empty .icon {
  margin: 0 auto 10px;
  color: var(--muted-light);
}

.list-skeleton {
  padding: 4px;
}

.skeleton-line,
.skeleton-card {
  border-radius: 8px;
  background: linear-gradient(90deg, #f0ece3 25%, #faf8f3 50%, #f0ece3 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}

.skeleton-line {
  width: 45%;
  height: 12px;
  margin: 10px 8px 16px;
}

.skeleton-card {
  height: 66px;
  margin-bottom: 8px;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* Form panel */
.form-panel {
  min-height: 760px;
  scroll-margin-top: 88px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.form-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 760px;
  padding: 56px 36px;
  text-align: center;
}

.empty-visual {
  position: relative;
  margin-bottom: 26px;
}

.empty-box {
  width: 178px;
  filter: drop-shadow(0 18px 22px rgba(16, 42, 67, 0.08));
}

.empty-badge {
  position: absolute;
  right: -24px;
  bottom: 12px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.form-empty h2 {
  margin-bottom: 10px;
  font-size: 26px;
  font-weight: 720;
  letter-spacing: -0.03em;
}

.form-empty > p {
  max-width: 450px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.form-empty > .btn {
  margin-top: 24px;
}

.empty-points {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 20px;
  margin-top: 28px;
  color: var(--muted);
  font-size: 11.5px;
}

.empty-points span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.empty-points i {
  color: var(--teal);
}

.form-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 32px 24px;
  border-bottom: 1px solid var(--line-soft);
  background:
    radial-gradient(circle at 100% 0%, rgba(240, 100, 48, 0.07), transparent 42%),
    var(--surface);
}

.form-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 6px;
  background: rgba(16, 42, 67, 0.06);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-light);
}

.status-pill.is-history {
  background: var(--teal-soft);
  color: var(--teal);
}

.status-pill.is-history::before {
  background: var(--teal);
}

.version-chip {
  display: inline-flex;
  align-items: center;
  height: 23px;
  padding: 0 8px;
  border: 1px solid rgba(30, 132, 106, 0.2);
  border-radius: 6px;
  background: #fff;
  color: var(--teal);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
}

.form-head h2 {
  max-width: 760px;
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.selected-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12.5px;
}

.selected-meta code {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 11px;
}

.form-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
  flex: none;
}

.autosave-hint {
  color: var(--muted-light);
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}

.sync-banner {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 22px 32px 0;
  padding: 13px 14px;
  border: 1px solid rgba(30, 132, 106, 0.18);
  border-radius: 12px;
  background: linear-gradient(90deg, var(--teal-soft), rgba(231, 244, 239, 0.35));
}

.sync-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--teal);
  flex: none;
}

.sync-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.sync-copy strong {
  color: #176752;
  font-size: 12.5px;
}

.sync-copy span {
  overflow: hidden;
  color: #4b7d6f;
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-banner .link-btn {
  flex: none;
  color: #176752;
  font-size: 11.5px;
}

#packForm {
  padding: 4px 32px 0;
}

.form-section {
  padding: 27px 0 28px;
  border-bottom: 1px solid var(--line-soft);
}

.form-section:last-of-type {
  border-bottom: 0;
}

.section-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: none;
  border: 1px solid rgba(240, 100, 48, 0.28);
  border-radius: 8px;
  background: var(--orange-soft);
  color: var(--orange-deep);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}

.section-head h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.4;
}

.section-head p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}

.section-optional {
  margin-left: auto;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted-light);
  font-size: 10px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field-span-2 {
  grid-column: span 2;
}

.field-label {
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
}

.field-label b {
  color: var(--orange);
  font-weight: 700;
}

.input-wrap,
.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.input-wrap:focus-within,
.select-wrap:focus-within {
  border-color: rgba(240, 100, 48, 0.7);
  box-shadow: 0 0 0 3px rgba(240, 100, 48, 0.08);
  background: #fff;
}

.input-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  flex: none;
  color: #96a7b6;
  pointer-events: none;
}

.input-wrap input,
.select-wrap select {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 12px 0 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.select-wrap select {
  padding-left: 0;
  padding-right: 34px;
  appearance: none;
  cursor: pointer;
}

.select-wrap::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.6px solid var(--muted);
  border-bottom: 1.6px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.input-wrap input::placeholder,
textarea::placeholder {
  color: #a4b1bd;
}

.input-wrap input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.input-wrap input[type="number"]::-webkit-inner-spin-button,
.input-wrap input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.input-wrap.has-suffix input {
  padding-right: 0;
}

.input-suffix {
  padding-right: 12px;
  color: var(--muted-light);
  font-family: var(--mono);
  font-size: 10.5px;
  white-space: nowrap;
}

textarea {
  width: 100%;
  min-height: 88px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.65;
  resize: vertical;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

textarea:focus {
  border-color: rgba(240, 100, 48, 0.7);
  box-shadow: 0 0 0 3px rgba(240, 100, 48, 0.08);
}

.dims-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.dims-row > i {
  color: #a7b2bc;
  font-size: 13px;
  font-style: normal;
}

.dim-input {
  display: flex;
  align-items: center;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.dim-input:focus-within {
  border-color: rgba(240, 100, 48, 0.7);
  box-shadow: 0 0 0 3px rgba(240, 100, 48, 0.08);
}

.dim-input input {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 4px 0 12px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
}

.dim-input span {
  padding-right: 10px;
  color: var(--muted-light);
  font-family: var(--mono);
  font-size: 10px;
}

.field-error {
  display: none;
  color: var(--danger);
  font-size: 11px;
  font-style: normal;
  line-height: 1.4;
}

.field.has-error .input-wrap,
.field.has-error .select-wrap,
.field.has-error .dim-input,
.field.has-error textarea {
  border-color: rgba(195, 70, 53, 0.65);
  background: #fffafa;
}

.field.has-error .field-error {
  display: block;
}

/* Upload */
.upload-layout {
  display: block;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 174px;
  padding: 22px;
  border: 1.5px dashed #d5cdbf;
  border-radius: 14px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.55)),
    repeating-linear-gradient(135deg, #faf7f0 0 12px, #f5f1e9 12px 24px);
  text-align: center;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: var(--orange);
  background: #fffaf5;
}

.dropzone.is-dragging {
  transform: scale(1.005);
}

.upload-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin-bottom: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--orange);
  box-shadow: var(--shadow-sm);
}

.dropzone-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dropzone-copy strong {
  font-size: 13.5px;
}

.dropzone-copy span {
  color: var(--muted);
  font-size: 11.5px;
}

.upload-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 12px;
}

.upload-tips {
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: #fbf9f4;
}

.upload-tips strong {
  display: block;
  margin-bottom: 9px;
  font-size: 12px;
}

.upload-tips ul {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.upload-tips li {
  position: relative;
  padding-left: 12px;
}

.upload-tips li::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--orange);
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
  margin-top: 13px;
}

.image-tile {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f1ece3;
}

.image-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
  transition: transform 0.25s ease;
}

.image-tile:hover img {
  transform: scale(1.035);
}

.image-tile .image-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  color: var(--muted);
  font-size: 9.5px;
  text-align: center;
  padding: 8px;
}

.image-tile .image-fallback span {
  overflow: hidden;
  width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-tile .image-fallback em {
  color: var(--muted-light);
  font-size: 8.5px;
  font-style: normal;
}

.spin {
  animation: spin 0.8s linear infinite;
}

.image-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(12, 27, 42, 0.76);
  color: #fff;
  opacity: 0;
  transition: opacity 0.16s ease, background 0.16s ease;
}

.image-tile:hover .image-remove,
.image-tile:focus-within .image-remove {
  opacity: 1;
}

.image-remove:hover {
  background: var(--danger);
}

.image-tag {
  position: absolute;
  bottom: 5px;
  left: 5px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(12, 27, 42, 0.7);
  color: #fff;
  font-size: 8.5px;
  backdrop-filter: blur(4px);
}

.upload-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
  color: var(--muted-light);
  font-size: 10.5px;
}

.upload-meta #imageCount {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-weight: 600;
}

.form-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 -32px;
  padding: 18px 32px;
  border-top: 1px solid var(--line-soft);
  background: rgba(255, 253, 250, 0.94);
  backdrop-filter: blur(12px);
}

.form-note {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.form-note .icon {
  color: var(--teal);
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
}

.btn-submit {
  min-height: 46px;
  padding: 0 20px;
  border-radius: 11px;
}

/* =========================================================
   Dialogs, sheet, lightbox, toast
   ========================================================= */
.dialog {
  width: min(540px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 28px;
  overflow: auto;
  border: 0;
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}

.dialog[open] {
  animation: dialogIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dialog::backdrop {
  background: rgba(9, 24, 39, 0.56);
  backdrop-filter: blur(3px);
}

@keyframes dialogIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

.dialog-head h2 {
  font-size: 25px;
  font-weight: 740;
  letter-spacing: -0.03em;
}

.dialog-close {
  margin: -5px -5px 0 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 24px;
}

.help-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.help-step {
  display: flex;
  gap: 13px;
  padding: 13px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #fbf9f4;
}

.help-step > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}

.help-step strong {
  display: block;
  font-size: 13px;
}

.help-step p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.help-note {
  display: flex;
  gap: 9px;
  margin-top: 16px;
  padding: 12px;
  border-radius: 10px;
  background: var(--orange-soft);
  color: #8b4a30;
}

.help-note .icon {
  flex: none;
  margin-top: 1px;
}

.help-note p {
  font-size: 11.5px;
  line-height: 1.65;
}

.confirm-dialog {
  width: min(420px, calc(100vw - 32px));
  text-align: center;
}

.confirm-dialog h2 {
  margin: 14px 0 7px;
  font-size: 21px;
  letter-spacing: -0.02em;
}

.confirm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: var(--orange-soft);
  color: var(--orange-deep);
}

.confirm-icon.is-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.confirm-message {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.confirm-dialog .dialog-actions {
  justify-content: center;
}

.success-dialog {
  width: min(500px, calc(100vw - 32px));
  text-align: center;
}

.success-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  margin-bottom: 15px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  box-shadow: 0 0 0 10px rgba(30, 132, 106, 0.09);
  animation: pop 0.35s cubic-bezier(0.2, 0.9, 0.25, 1.2);
}

@keyframes pop {
  from {
    transform: scale(0.65);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.success-dialog h2 {
  margin: 4px 0 6px;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.success-lead {
  color: var(--muted);
  font-size: 13.5px;
}

.success-lead strong {
  color: var(--ink);
}

.success-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 20px 0 14px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--line-soft);
}

.success-summary > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 8px;
  background: #fbf9f4;
}

.success-summary span {
  color: var(--muted);
  font-size: 10px;
}

.success-summary strong {
  font-size: 13px;
  font-weight: 650;
}

.success-tip {
  color: var(--muted-light);
  font-size: 10.5px;
}

.success-actions {
  justify-content: center;
}

.sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
}

.sheet-scrim {
  position: absolute;
  inset: 0;
  background: rgba(9, 24, 39, 0.52);
  backdrop-filter: blur(3px);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.bottom-sheet {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 88vh;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: var(--surface);
  box-shadow: 0 -20px 60px rgba(9, 24, 39, 0.24);
  animation: sheetUp 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes sheetUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.sheet-handle {
  width: 38px;
  height: 4px;
  margin: 0 auto 10px;
  border-radius: 2px;
  background: #d8d2c7;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 7px 4px 13px;
}

.sheet-head h2 {
  font-size: 23px;
  letter-spacing: -0.03em;
}

.bottom-sheet .search-field {
  margin: 0 0 6px;
}

.bottom-sheet .category-chips {
  padding: 10px 0 8px;
}

.bottom-sheet .material-list {
  min-height: 0;
  max-height: 52vh;
  padding: 0;
}

.bottom-sheet .panel-foot {
  padding: 10px 2px 0;
}

.sheet-foot {
  padding: 10px 4px 0;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-light);
  font-size: 10.5px;
  text-align: center;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background: rgba(8, 19, 31, 0.93);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.18s ease;
}

.lightbox img {
  max-width: min(1100px, 92vw);
  max-height: 78vh;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}

.lightbox p {
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.lightbox-close {
  position: absolute;
  top: 22px;
  right: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

.toast-stack {
  position: fixed;
  top: 94px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 220px;
  max-width: 380px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 253, 250, 0.98);
  color: var(--ink);
  font-size: 12.5px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
  cursor: pointer;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-icon {
  display: inline-flex;
  color: var(--teal);
  flex: none;
}

.toast-error .toast-icon {
  color: var(--danger);
}

.toast-info .toast-icon {
  color: var(--blue);
}

.toast-success {
  border-color: rgba(30, 132, 106, 0.24);
}

.toast-error {
  border-color: rgba(195, 70, 53, 0.25);
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 340px minmax(0, 1fr);
  }

  .intro {
    grid-template-columns: minmax(0, 1.4fr) minmax(330px, 0.8fr);
    gap: 30px;
  }

  .form-head,
  #packForm {
    padding-left: 26px;
    padding-right: 26px;
  }

  .form-actions {
    margin-left: -26px;
    margin-right: -26px;
    padding-left: 26px;
    padding-right: 26px;
  }

  .sync-banner {
    margin-left: 26px;
    margin-right: 26px;
  }
}

@media (max-width: 960px) {
  .workspace {
    grid-template-columns: 310px minmax(0, 1fr);
  }

  .intro {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-top: 42px;
  }

  .intro-stats {
    max-width: 520px;
  }

  .intro-stat strong {
    font-size: 28px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: span 1;
  }

  .upload-layout {
    grid-template-columns: 1fr;
  }

  .upload-tips {
    display: none;
  }

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

  .form-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .form-note {
    justify-content: center;
    text-align: center;
  }

  .action-buttons {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .action-buttons .btn-submit {
    width: 100%;
  }
}

@media (max-width: 860px) {
  body {
    font-size: 14px;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: initial !important;
  }

  button.mobile-only,
  .btn.mobile-only {
    display: inline-flex !important;
  }

  .header-inner {
    width: calc(100% - 32px);
    height: 64px;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark,
  .brand-mark-svg {
    width: 34px !important;
    height: 34px !important;
    border-radius: 9px;
  }

  .brand-copy strong {
    font-size: 15px;
  }

  .brand-copy span {
    font-size: 9.5px;
  }

  .online-pill {
    display: none;
  }

  .header-link {
    gap: 5px;
    font-size: 12px;
  }

  .header-link .icon {
    width: 15px;
    height: 15px;
  }

  .header-actions {
    gap: 10px;
  }

  .front-main,
  .site-footer {
    width: calc(100% - 28px);
  }

  .intro {
    display: block;
    padding: 28px 2px 20px;
  }

  .eyebrow {
    gap: 8px;
    font-size: 9.5px;
  }

  .eyebrow-line {
    width: 26px;
  }

  .intro h1 {
    margin: 12px 0 10px;
    font-size: clamp(30px, 8.6vw, 42px);
    line-height: 1.15;
  }

  .intro h1 em::after {
    bottom: 2px;
    height: 5px;
  }

  .lede {
    font-size: 13px;
    line-height: 1.75;
  }

  .intro-stats {
    display: none;
  }

  .workspace {
    display: block;
  }

  .material-panel {
    display: none;
  }

  .form-panel {
    min-height: 0;
    border-radius: 20px;
  }

  .form-empty {
    min-height: 0;
    padding: 48px 22px 44px;
  }

  .empty-box {
    width: 138px;
  }

  .form-empty h2 {
    font-size: 22px;
  }

  .form-empty > p {
    font-size: 12.5px;
  }

  .empty-points {
    gap: 8px 14px;
    font-size: 10.5px;
  }

  .form-head {
    flex-direction: column;
    gap: 12px;
    padding: 22px 18px 18px;
  }

  .form-head h2 {
    font-size: 23px;
  }

  .form-head-actions {
    width: 100%;
    padding-top: 0;
  }

  .autosave-hint {
    margin-left: auto;
    font-size: 10px;
  }

  .sync-banner {
    flex-wrap: wrap;
    margin: 14px 18px 0;
    padding: 11px 12px;
  }

  .sync-copy {
    flex: 1 1 calc(100% - 50px);
  }

  .sync-copy span {
    white-space: normal;
  }

  .sync-banner .link-btn {
    margin-left: 45px;
  }

  #packForm {
    padding: 0 18px;
  }

  .form-section {
    padding: 22px 0 23px;
  }

  .section-head {
    gap: 10px;
    margin-bottom: 16px;
  }

  .section-num {
    width: 27px;
    height: 27px;
    border-radius: 7px;
    font-size: 10px;
  }

  .section-head h3 {
    font-size: 16px;
  }

  .section-head p {
    font-size: 10.5px;
  }

  .field-grid {
    gap: 14px;
  }

  .field-label {
    font-size: 12px;
  }

  .input-wrap,
  .select-wrap,
  .dim-input {
    min-height: 48px;
  }

  .input-wrap input,
  .select-wrap select {
    height: 46px;
    font-size: 16px; /* avoids iOS auto zoom */
  }

  .dim-input input {
    height: 46px;
    font-size: 16px;
  }

  textarea {
    font-size: 16px;
  }

  .dims-row {
    gap: 5px;
  }

  .dim-input span {
    padding-right: 7px;
    font-size: 9px;
  }

  .dim-input input {
    padding-left: 8px;
  }

  .dropzone {
    min-height: 186px;
    padding: 20px 14px;
  }

  .upload-buttons {
    width: 100%;
  }

  .upload-buttons .btn {
    flex: 1;
    min-width: 0;
  }

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

  .image-remove {
    opacity: 1;
    width: 26px;
    height: 26px;
  }

  .upload-meta {
    flex-direction: column;
    gap: 3px;
  }

  .form-actions {
    margin: 0 -18px;
    padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
    gap: 10px;
  }

  .form-note {
    justify-content: flex-start;
    text-align: left;
    font-size: 10px;
  }

  .action-buttons {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .action-buttons #syncInfoBtn {
    order: 2;
    min-height: 38px;
    border-color: transparent;
    box-shadow: none;
    color: var(--muted);
    font-size: 12px;
  }

  .form-actions .btn-submit {
    min-height: 52px;
    font-size: 15px;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    margin-top: 36px;
    padding-bottom: 26px;
    font-size: 10.5px;
  }

  .site-footer > div {
    gap: 7px;
  }

  .footer-brand {
    font-size: 11px;
  }

  .form-empty > .btn {
    width: 100%;
    max-width: 280px;
  }

  .toast-stack {
    top: 76px;
    right: 14px;
    left: 14px;
    align-items: stretch;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }

  .dialog {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 28px);
    padding: 22px;
    border-radius: 19px;
  }

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

  .success-dialog {
    width: calc(100vw - 24px);
  }

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

  .success-summary > div {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px 13px;
  }

  .success-actions {
    flex-direction: column-reverse;
  }

  .success-actions .btn {
    width: 100%;
  }

  .confirm-dialog .dialog-actions {
    flex-direction: column-reverse;
  }

  .confirm-dialog .dialog-actions .btn {
    width: 100%;
  }

  .bottom-sheet {
    max-height: 90vh;
    padding-left: 14px;
    padding-right: 14px;
  }

  .bottom-sheet .material-list {
    max-height: 48vh;
  }

  .lightbox {
    padding: 16px;
  }

  .lightbox img {
    max-width: 96vw;
    max-height: 74vh;
  }

  .lightbox-close {
    top: 14px;
    right: 14px;
  }
}

@media (max-width: 390px) {
  .form-head h2 {
    font-size: 21px;
  }

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

  .upload-buttons {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* =========================================================
   Admin desktop
   ========================================================= */
.admin-page {
  min-height: 100vh;
  background: #f3f1eb;
}

.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: 252px;
  height: 100vh;
  padding: 24px 16px 16px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 4%, rgba(83, 141, 155, 0.24), transparent 32%),
    linear-gradient(175deg, #142f49 0%, #0b1f33 78%, #081a2b 100%);
  color: rgba(255, 255, 255, 0.82);
}

.admin-sidebar::after {
  content: "";
  position: absolute;
  right: -70px;
  bottom: 120px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  pointer-events: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 26px;
}

.sidebar-brand .brand-mark-svg {
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.sidebar-brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.sidebar-brand-copy strong {
  color: #fff;
  font-family: "Segoe UI", var(--font);
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.sidebar-brand-copy span {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.43);
  font-size: 9.5px;
  letter-spacing: 0.05em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desktop-tag {
  margin-left: auto;
  padding: 3px 5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.35);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.08em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-label {
  padding: 14px 12px 7px;
  color: rgba(255, 255, 255, 0.32);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.nav-label:first-child {
  padding-top: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: 43px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.055);
  color: #fff;
}

.nav-item.is-active {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--orange);
}

.nav-icon {
  display: inline-flex;
  color: rgba(255, 255, 255, 0.5);
}

.nav-item.is-active .nav-icon {
  color: #ffa27b;
}

.nav-count {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.46);
  font-family: var(--mono);
  font-size: 9.5px;
}

.nav-item.is-active .nav-count {
  background: rgba(240, 100, 48, 0.2);
  color: #ffb99d;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-lan-card {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.7);
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.sidebar-lan-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.075);
}

.lan-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: #53c6a8;
  box-shadow: 0 0 0 4px rgba(83, 198, 168, 0.1);
}

.lan-card-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.lan-card-copy strong {
  color: rgba(255, 255, 255, 0.86);
  font-size: 10.5px;
  font-weight: 600;
}

.lan-card-copy span {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.38);
  font-family: var(--mono);
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lan-card-arrow {
  display: inline-flex;
  margin-left: auto;
  color: rgba(255, 255, 255, 0.3);
}

.sidebar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 3px 2px;
  color: rgba(255, 255, 255, 0.28);
  font-size: 8.5px;
}

.secure-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.admin-main {
  display: flex;
  flex-direction: column;
  width: calc(100% - 252px);
  min-width: 0;
  min-height: 100vh;
  margin-left: 252px;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 80px;
  padding: 0 34px;
  border-bottom: 1px solid rgba(16, 42, 67, 0.08);
  background: rgba(243, 241, 235, 0.86);
  backdrop-filter: blur(16px);
}

.topbar-heading {
  min-width: 0;
}

.topbar-eyebrow {
  display: block;
  color: var(--orange-deep);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.topbar-heading h1 {
  margin-top: 2px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 730;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
}

.lan-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(30, 132, 106, 0.2);
  border-radius: 8px;
  background: rgba(231, 244, 239, 0.65);
  color: #176752;
  font-size: 10px;
  font-weight: 600;
}

.lan-pill i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--teal);
}

.lan-pill code {
  max-width: 180px;
  overflow: hidden;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.65);
  color: #256b59;
  font-family: var(--mono);
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-content {
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
  padding: 27px 34px 54px;
}

.admin-page-section {
  animation: adminPageIn 0.28s ease;
}

@keyframes adminPageIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.stat-card {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 42, 67, 0.025);
}

.stat-icon,
.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 11px;
}

.tone-navy {
  background: rgba(16, 42, 67, 0.08);
  color: var(--ink);
}

.tone-teal {
  background: var(--teal-soft);
  color: var(--teal);
}

.tone-orange {
  background: var(--orange-soft);
  color: var(--orange-deep);
}

.tone-blue {
  background: #e9f1f7;
  color: var(--blue);
}

.stat-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-label {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
}

.stat-copy strong {
  color: var(--ink);
  font-family: "Segoe UI", var(--font);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.2;
}

.stat-copy small {
  overflow: hidden;
  color: var(--muted-light);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.content-heading h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.content-heading p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.content-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.table-search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  min-width: 225px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted-light);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.table-search.wide {
  min-width: 280px;
}

.table-search:focus-within {
  border-color: rgba(240, 100, 48, 0.55);
  box-shadow: 0 0 0 3px rgba(240, 100, 48, 0.07);
}

.table-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 11.5px;
}

.table-search input::placeholder {
  color: #9eacb8;
}

.compact-select {
  height: 34px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23627d98' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  color: var(--ink-soft);
  font-size: 11px;
  appearance: none;
  cursor: pointer;
}

.table-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 42, 67, 0.025);
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  height: 38px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: #faf8f3;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.data-table td {
  height: 61px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-soft);
  font-size: 11.5px;
  vertical-align: middle;
}

.data-table tbody tr {
  cursor: pointer;
  transition: background 0.13s ease;
}

.data-table tbody tr:hover {
  background: #fbf9f4;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table .align-center {
  text-align: center;
}

.data-table .align-right {
  text-align: right;
}

.table-material {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
}

.table-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 10px;
  font-weight: 700;
}

.table-avatar.tone-orange {
  background: var(--orange-soft);
  color: var(--orange-deep);
}

.table-avatar.tone-blue {
  background: #e9f1f7;
  color: var(--blue);
}

.table-avatar.tone-plum {
  background: #f2ecf5;
  color: var(--plum);
}

.table-avatar.tone-gold {
  background: #f8f1df;
  color: #9a6d20;
}

.table-material-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.table-material-copy strong {
  overflow: hidden;
  max-width: 225px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-material-copy code {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
}

.spec-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-width: 220px;
}

.spec-cell span {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spec-cell small {
  color: var(--muted-light);
  font-size: 9px;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 7px;
  border-radius: 5px;
  background: rgba(16, 42, 67, 0.05);
  color: var(--muted);
  font-size: 9.5px;
  white-space: nowrap;
}

.version-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.version-number {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 6px;
  border-radius: 5px;
  background: var(--teal-soft);
  color: var(--teal);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
}

.version-number.is-empty {
  background: rgba(16, 42, 67, 0.05);
  color: var(--muted-light);
}

.weight-value {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.version-count {
  color: var(--muted-light);
  font-size: 9px;
}

.image-count-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
}

.image-count-chip .icon {
  color: var(--muted-light);
}

.time-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
  color: var(--ink-soft);
  font-size: 10px;
  white-space: nowrap;
}

.time-cell small {
  color: var(--muted-light);
  font-size: 9px;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.row-actions .icon-btn {
  width: 29px;
  height: 29px;
  border-radius: 7px;
}

.row-actions .icon-btn.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 47px;
  padding: 8px 14px;
  border-top: 1px solid var(--line-soft);
  background: #fdfbf7;
  color: var(--muted);
  font-size: 10px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 27px;
  height: 27px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  transition: all 0.15s ease;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--line);
  background: #fff;
}

.page-btn.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.page-btn:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.table-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 36px;
  text-align: center;
}

.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  margin-bottom: 13px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fbf9f4;
  color: var(--muted-light);
}

.table-empty strong {
  font-size: 14px;
}

.table-empty p {
  max-width: 330px;
  margin: 5px 0 15px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.table-empty > div {
  display: flex;
  gap: 7px;
}

.page-intro {
  margin-bottom: 22px;
}

.page-intro h2 {
  margin: 5px 0 7px;
  font-size: 26px;
  font-weight: 740;
  letter-spacing: -0.035em;
}

.page-intro p {
  max-width: 720px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

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

.feature-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 42, 67, 0.025);
}

.feature-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.feature-head h3 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.feature-head p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
}

.import-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 174px;
  padding: 20px;
  border: 1.5px dashed #d8d0c2;
  border-radius: 13px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.6)),
    repeating-linear-gradient(135deg, #faf7f0 0 12px, #f5f1e9 12px 24px);
  text-align: center;
  transition: border-color 0.16s ease, background 0.16s ease;
  cursor: pointer;
}

.import-dropzone:hover,
.import-dropzone.is-dragging {
  border-color: var(--orange);
  background: #fffaf5;
}

.import-visual {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--orange);
  box-shadow: var(--shadow-sm);
}

.import-dropzone strong {
  font-size: 12.5px;
}

.import-dropzone p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.feature-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.feature-hint {
  color: var(--muted-light);
  font-size: 9.5px;
}

.import-result {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #fbf9f4;
  font-size: 10.5px;
}

.import-result.is-error {
  border-color: rgba(195, 70, 53, 0.22);
  background: var(--danger-soft);
}

.import-result-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 650;
}

.import-result-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.import-result-stats span {
  padding: 2px 7px;
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
}

.import-error-list {
  max-height: 140px;
  margin: 8px 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  color: var(--danger);
}

.import-error-list li {
  padding: 3px 0;
  border-top: 1px dashed rgba(195, 70, 53, 0.18);
  font-size: 9.5px;
}

.export-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-bottom: 15px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--line-soft);
}

.export-summary div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 11px;
  background: #fbf9f4;
}

.export-summary span {
  color: var(--muted);
  font-size: 9px;
}

.export-summary strong {
  color: var(--ink);
  font-family: "Segoe UI", var(--font);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.2;
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 10.5px;
}

.check-list li {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  line-height: 1.5;
}

.check-list .icon {
  color: var(--teal);
  margin-top: 1px;
}

.check-list.spacious {
  gap: 12px;
  margin-bottom: 4px;
}

.storage-card {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-top: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.storage-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.storage-main h3 {
  font-size: 13px;
}

.storage-main p {
  margin: 2px 0 7px;
  color: var(--muted);
  font-size: 10.5px;
}

.storage-main code {
  display: block;
  max-width: 650px;
  overflow: hidden;
  padding: 5px 8px;
  border-radius: 5px;
  background: #f4f1ea;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storage-actions {
  display: flex;
  gap: 7px;
  flex: none;
}

.storage-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 9px;
  width: 100%;
}

.storage-card {
  flex-wrap: wrap;
}

.storage-notes b {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-weight: 600;
}

/* Settings */
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
  gap: 16px;
}

.settings-grid.lower {
  margin-top: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lan-qr-layout {
  display: flex;
  align-items: flex-start;
  gap: 22px;
}

.qr-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 166px;
  height: 166px;
  flex: none;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.qr-frame img {
  width: 100%;
  height: 100%;
  border-radius: 6px;
}

.qr-placeholder {
  color: var(--muted-light);
  font-size: 10px;
}

.lan-detail {
  flex: 1;
  min-width: 0;
}

.lan-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.lan-url-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 7px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbf9f4;
}

.lan-url-row code {
  flex: 1;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lan-url-row .icon-btn {
  width: 29px;
  height: 29px;
}

.lan-other {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.lan-other button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 1px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  text-align: left;
}

.lan-other button:hover {
  color: var(--ink);
}

.lan-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 11px;
  padding: 9px;
  border-radius: 8px;
  background: var(--orange-soft);
  color: #8b4a30;
}

.lan-note .icon {
  margin-top: 1px;
  flex: none;
}

.lan-note p {
  font-size: 9.5px;
  line-height: 1.55;
}

.meta-list {
  margin: 0;
}

.meta-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line-soft);
}

.meta-list > div:last-child {
  border-bottom: 0;
}

.meta-list dt {
  flex: none;
  color: var(--muted);
  font-size: 10px;
}

.meta-list dd {
  margin: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-list code {
  font-family: var(--mono);
  font-size: 9px;
}

/* Material dialog */
.material-dialog {
  width: min(660px, calc(100vw - 40px));
  padding: 26px;
}

.material-dialog .dialog-head {
  margin-bottom: 18px;
}

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

.dialog-hint {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 15px;
  padding: 9px 10px;
  border-radius: 8px;
  background: #f7f3ea;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
}

.dialog-hint .icon {
  margin-top: 1px;
  color: var(--teal);
  flex: none;
}

.form-error {
  margin-top: 12px;
  padding: 9px 11px;
  border: 1px solid rgba(195, 70, 53, 0.2);
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 10.5px;
}

/* Drawer */
.drawer-layer {
  position: fixed;
  inset: 0;
  z-index: 90;
}

.drawer-scrim {
  position: absolute;
  inset: 0;
  background: rgba(9, 24, 39, 0.48);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}

.detail-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(690px, 92vw);
  background: #f7f5ef;
  box-shadow: -20px 0 60px rgba(9, 24, 39, 0.18);
  animation: drawerIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes drawerIn {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.drawer-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.drawer-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 12px;
  background: var(--orange-soft);
  color: var(--orange-deep);
  font-size: 13px;
  font-weight: 700;
}

.drawer-heading h2 {
  max-width: 390px;
  overflow: hidden;
  font-size: 20px;
  font-weight: 730;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-heading p {
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
}

.drawer-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: none;
}

.drawer-body {
  flex: 1;
  padding: 20px 22px 40px;
  overflow-y: auto;
}

.drawer-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--muted);
  font-size: 11px;
}

.drawer-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 14px;
  margin-bottom: 18px;
}

.summary-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}

.summary-panel h3 {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.summary-data > div {
  min-width: 0;
}

.summary-data span {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

.summary-data strong {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-images {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.summary-image {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2eee5;
}

.summary-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}

.summary-no-images {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 85px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted-light);
  font-size: 10px;
}

.drawer-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0 10px;
}

.drawer-section-title h3 {
  font-size: 13px;
  font-weight: 700;
}

.drawer-section-title span {
  color: var(--muted);
  font-size: 9px;
}

.version-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.version-item {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  overflow: hidden;
}

.version-item summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.version-item summary::-webkit-details-marker {
  display: none;
}

.version-item summary::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.version-item[open] summary::after {
  transform: rotate(-135deg);
}

.version-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 7px;
  background: var(--teal-soft);
  color: var(--teal);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
}

.version-summary-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.version-summary-copy strong {
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
}

.version-summary-copy span {
  color: var(--muted);
  font-size: 9px;
}

.version-body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--line-soft);
}

.version-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  padding-top: 12px;
}

.version-field span {
  display: block;
  color: var(--muted);
  font-size: 8.5px;
}

.version-field strong {
  display: block;
  margin-top: 1px;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.version-field.full {
  grid-column: 1 / -1;
}

.version-images {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 11px;
}

.version-images .summary-image {
  aspect-ratio: 4 / 3;
}

.empty-block {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 11px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.empty-block strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-soft);
  font-size: 12px;
}

/* Admin lightbox uses shared styles */
.admin-page .lightbox img {
  max-height: 80vh;
}

/* Admin responsive */
@media (max-width: 1180px) {
  .admin-sidebar {
    width: 228px;
  }

  .admin-main {
    width: calc(100% - 228px);
    margin-left: 228px;
  }

  .admin-topbar,
  .admin-content {
    padding-left: 26px;
    padding-right: 26px;
  }

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

  .content-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .content-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-grid.lower {
    grid-template-columns: 1fr;
  }

  .storage-card {
    flex-direction: column;
  }

  .storage-actions {
    margin-left: 54px;
  }
}

@media (max-width: 1060px) {
  .admin-sidebar {
    width: 205px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .admin-main {
    width: calc(100% - 205px);
    margin-left: 205px;
  }

  .lan-pill code {
    display: none;
  }

  .admin-topbar,
  .admin-content {
    padding-left: 20px;
    padding-right: 20px;
  }

  .data-grid {
    grid-template-columns: 1fr;
  }

  .lan-qr-layout {
    flex-direction: column;
  }

  .table-search {
    min-width: 190px;
  }
}

@media (max-width: 880px) {
  .admin-sidebar {
    display: none;
  }

  .admin-main {
    width: 100%;
    margin-left: 0;
  }

  .admin-topbar {
    height: 72px;
  }

  .lan-pill {
    display: none;
  }

  .admin-content {
    padding-bottom: 30px;
  }

  .dialog-field-grid {
    grid-template-columns: 1fr;
  }

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

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

  .storage-actions {
    margin-left: 0;
  }
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .content-actions {
    align-items: stretch;
  }

  .table-search,
  .table-search.wide {
    width: 100%;
    min-width: 0;
  }

  .material-dialog {
    width: calc(100vw - 20px);
    padding: 18px;
  }

  .detail-drawer {
    width: 100vw;
  }

  .summary-images {
    grid-template-columns: repeat(2, 1fr);
  }
}


/* Readability tuning for desktop admin */
.stat-label { font-size: 11.5px; }
.stat-copy small { font-size: 10px; }
.content-heading p { font-size: 12px; }
.data-table th { font-size: 10px; }
.data-table td { font-size: 12.5px; }
.table-material-copy strong { font-size: 13px; }
.table-material-copy code { font-size: 9.5px; }
.spec-cell span { font-size: 11.5px; }
.spec-cell small { font-size: 10px; }
.category-badge { font-size: 10.5px; }
.version-number { font-size: 10px; }
.version-count { font-size: 10px; }
.image-count-chip { font-size: 10.5px; }
.time-cell { font-size: 11px; }
.time-cell small { font-size: 10px; }
.table-footer { font-size: 10.5px; }
.row-actions .icon-btn { width: 31px; height: 31px; color: #7a8e9f; }
.nav-item { font-size: 13.5px; }

/* =========================================================
   Information collection form update
   ========================================================= */
.input-wrap.is-readonly {
  background: #f7f4ed;
  border-color: #ebe5da;
}

.input-wrap.is-readonly input {
  color: var(--ink-soft);
  cursor: default;
}

.file-input-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.image-tile .image-tag.is-locked {
  background: rgba(30, 132, 106, 0.88);
}

.image-tile .image-tag.is-new {
  background: rgba(16, 42, 67, 0.78);
}

.camera-layer {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: #07131f;
  color: #fff;
  animation: fadeIn 0.2s ease;
}

.camera-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #07131f;
}

.camera-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-stage video.is-mirrored {
  transform: scaleX(-1);
}

.camera-topbar {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 22px;
  background: linear-gradient(rgba(4, 13, 22, 0.78), transparent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.camera-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  backdrop-filter: blur(8px);
}

.camera-icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.camera-controls {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 22px 20px calc(28px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(4, 13, 22, 0.78));
}

.camera-shutter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  padding: 0;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.16);
}

.camera-shutter span {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.12s ease, background 0.12s ease;
}

.camera-shutter:active span {
  background: var(--orange);
  transform: scale(0.9);
}

.camera-controls p {
  color: rgba(255, 255, 255, 0.66);
  font-size: 11px;
}

@media (min-width: 861px) {
  .camera-layer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(4, 13, 22, 0.9);
  }

  .camera-stage {
    width: min(720px, 80vw);
    height: min(80vh, 900px);
    border-radius: 18px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  }
}

/* =========================================================
   Master data and runtime settings
   ========================================================= */
.page-intro.compact {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.category-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.category-default {
  display: inline-flex;
  align-items: center;
  height: 19px;
  margin-left: 7px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--orange-soft);
  color: var(--orange-deep);
  font-size: 8.5px;
}

.category-dialog {
  width: min(430px, calc(100vw - 32px));
}

.category-dialog .dialog-head {
  margin-bottom: 16px;
}

.row-actions .icon-btn:disabled {
  cursor: not-allowed;
  opacity: 0.3;
}

.runtime-settings-card {
  margin-top: 16px;
}

.runtime-settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  gap: 20px;
}

.runtime-setting {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: #fbf9f4;
}

.runtime-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.runtime-setting code {
  display: block;
  overflow: hidden;
  padding: 5px 8px;
  border-radius: 5px;
  background: #fff;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.switch-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #cbd5dc;
  transition: background 0.16s ease;
}

.switch-track span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 42, 67, 0.25);
  transition: transform 0.16s ease;
}

.switch-row input:checked + .switch-track {
  background: var(--teal);
}

.switch-row input:checked + .switch-track span {
  transform: translateX(16px);
}

.switch-row input:focus-visible + .switch-track {
  outline: 2px solid rgba(240, 100, 48, 0.7);
  outline-offset: 2px;
}

.runtime-hint {
  display: block;
  margin-top: 9px;
  color: var(--muted-light);
  font-size: 9.5px;
  line-height: 1.55;
}

@media (max-width: 880px) {
  .runtime-settings-grid {
    grid-template-columns: 1fr;
  }

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

/* =========================================================
   Material header, version subpage and floating actions
   ========================================================= */
.material-title-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: nowrap;
}

.material-title-row h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.version-history-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(16, 42, 67, 0.14);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.version-history-btn:hover:not(:disabled) {
  border-color: var(--orange);
  color: var(--orange-deep);
}

.version-history-btn:disabled {
  cursor: default;
  opacity: 0.45;
}

.version-history-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(16, 42, 67, 0.06);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.material-name-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: color 0.16s ease;
}

.material-name-trigger:hover,
.material-name-trigger:focus-visible {
  color: var(--orange-deep);
}

.name-chevron {
  display: inline-flex;
  color: var(--muted-light);
  transition: transform 0.16s ease, color 0.16s ease;
}

.material-name-trigger:hover .name-chevron {
  color: var(--orange);
  transform: translateY(1px);
}

.image-tag.is-delete {
  background: var(--danger);
}

.image-tile.is-marked {
  border-color: var(--danger);
}

.image-tile.is-marked img {
  opacity: 0.52;
}

.image-tile.is-marked::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid var(--danger);
  border-radius: 10px;
  background: rgba(195, 70, 53, 0.12);
  pointer-events: none;
}

.version-layer {
  position: fixed;
  inset: 0;
  z-index: 95;
}

.version-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(560px, 95vw);
  background: #f7f5ef;
  box-shadow: -20px 0 60px rgba(9, 24, 39, 0.18);
  animation: drawerIn 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.version-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.version-drawer-head h2 {
  font-size: 22px;
  font-weight: 730;
  letter-spacing: -0.03em;
}

.version-drawer-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
}

.version-drawer-body {
  flex: 1;
  padding: 16px 18px 30px;
  overflow-y: auto;
}

.version-public-item {
  margin-bottom: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.version-public-head {
  display: flex;
  align-items: center;
  gap: 9px;
}

.version-public-head strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
}

.version-public-head span {
  color: var(--muted);
  font-size: 10px;
}

.version-public-values {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 9px;
}

.version-public-values div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.version-public-values span {
  color: var(--muted-light);
  font-size: 8.5px;
}

.version-public-values strong {
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
}

.version-public-images {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.version-public-images img {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  cursor: zoom-in;
}

.version-more {
  color: var(--muted-light);
  font-size: 9px;
}

.version-empty {
  padding: 55px 20px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

@media (max-width: 860px) {
  .form-head-actions {
    justify-content: flex-end;
  }

  .material-title-row {
    gap: 8px;
    align-items: flex-start;
  }

  .version-history-btn {
    height: 28px;
    flex: none;
    padding: 0 8px;
    font-size: 10px;
  }

  .version-drawer {
    width: 100vw;
  }

  .version-drawer-head {
    padding: calc(16px + env(safe-area-inset-top)) 16px 14px;
  }

  .version-drawer-body {
    padding: 12px 14px calc(20px + env(safe-area-inset-bottom));
  }

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

/* Compact page intro */
.intro.compact {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 4px 22px;
}

.intro.compact h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.intro.compact .intro-stats {
  display: flex;
  flex: none;
  padding: 0;
  border: 0;
  gap: 24px;
}

.intro.compact .intro-stat {
  padding: 0;
  border: 0;
  flex-direction: row;
  align-items: baseline;
  gap: 7px;
}

.intro.compact .intro-stat-label {
  font-size: 10px;
}

.intro.compact .intro-stat strong {
  font-size: 20px;
}

@media (max-width: 860px) {
  .intro.compact {
    padding: 18px 2px 14px;
  }

  .intro.compact h1 {
    font-size: 24px;
  }

  .intro.compact .intro-stats {
    display: none;
  }
}

/* v1.3 form interactions */
.image-tile[data-existing-id] img {
  cursor: pointer;
}

.material-panel.is-choosing {
  animation: chooserPulse 0.8s ease;
}

@keyframes chooserPulse {
  0% { box-shadow: 0 0 0 0 rgba(240, 100, 48, 0.3); }
  45% { box-shadow: 0 0 0 8px rgba(240, 100, 48, 0.08); }
  100% { box-shadow: 0 0 0 0 rgba(240, 100, 48, 0); }
}

/* =========================================================
   Database table editor (v1.4)
   ========================================================= */
.db-editor {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.db-table-list {
  position: sticky;
  top: 18px;
  padding: 18px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.db-list-head h2 {
  margin-top: 4px;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.db-table-buttons {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 14px 0;
}

.db-table-button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.db-table-button:hover {
  background: #f5f1e9;
}

.db-table-button.is-active {
  border-color: rgba(240, 100, 48, 0.35);
  background: rgba(240, 100, 48, 0.08);
}

.db-table-button-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
}

.db-table-button-copy strong {
  font-size: 12px;
  font-weight: 650;
}

.db-table-button-copy code {
  color: var(--muted-light);
  font-family: var(--mono);
  font-size: 9px;
}

.db-table-count {
  min-width: 22px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(16, 42, 67, 0.07);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  text-align: center;
}

.db-list-note {
  display: flex;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.db-list-note span[data-icon] {
  flex: none;
  margin-top: 1px;
  color: var(--orange);
}

.db-editor-main {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}

.db-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.db-toolbar-info h3 {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.db-toolbar-info p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
}

.db-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.db-search {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf9f5;
  color: var(--muted);
}

.db-search input {
  width: 130px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 11.5px;
  outline: none;
}

.db-readonly-note {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbf6ea;
  color: #8a6b1f;
  font-size: 11px;
}

.db-grid-wrap {
  overflow-x: auto;
}

.db-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  white-space: nowrap;
}

.db-grid th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 9px;
  border-bottom: 1px solid var(--line);
  background: #faf7f1;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  text-align: left;
}

.db-grid td {
  padding: 0;
  border-bottom: 1px solid #f1ece2;
  vertical-align: middle;
}

.db-grid td.db-cell.is-readonly {
  max-width: 220px;
  padding: 7px 9px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
}

.db-grid .db-index {
  width: 38px;
  padding: 7px 8px;
  color: var(--muted-light);
  font-family: var(--mono);
  font-size: 9px;
  text-align: center;
}

.db-grid .db-actions-col {
  width: 46px;
  text-align: center;
}

.db-input {
  width: 100%;
  min-width: 90px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 11.5px;
  outline: none;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.db-input:hover {
  border-color: var(--line);
}

.db-input:focus {
  border-color: var(--accent);
  background: #fff;
}

.db-row.is-dirty .db-input {
  background: #fff7ed;
}

.db-row.is-new .db-input {
  background: #eef8f3;
}

.db-editable-dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--orange);
  opacity: 0.55;
  vertical-align: middle;
}

.db-new-tag {
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(30, 132, 106, 0.14);
  color: #1e846a;
  font-family: var(--mono);
  font-size: 8px;
}

.db-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 46px 20px;
  color: var(--muted);
  text-align: center;
}

.db-empty strong {
  color: var(--ink-soft);
  font-size: 13px;
}

.db-empty p {
  font-size: 10.5px;
}

.db-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: #fbf9f5;
  color: var(--muted);
  font-size: 10.5px;
}

@media (max-width: 1080px) {
  .db-editor {
    grid-template-columns: 1fr;
  }

  .db-table-list {
    position: static;
  }

  .db-table-buttons {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .db-table-button {
    flex: 1 1 150px;
  }
}

/* =========================================================
   Collection / view-only mode switch (v1.4)
   ========================================================= */
.mode-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  cursor: pointer;
  user-select: none;
  transition: color 0.16s ease;
}

.mode-title:hover,
.mode-title:focus-visible {
  color: var(--orange-deep);
}

.mode-title:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 4px;
  border-radius: 6px;
}

.mode-title-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(16, 42, 67, 0.14);
  border-radius: 999px;
  color: var(--muted);
  transition: transform 0.2s ease, border-color 0.16s ease, color 0.16s ease;
}

.mode-title:hover .mode-title-switch {
  border-color: var(--orange);
  color: var(--orange);
}

body.is-viewing .mode-title-switch {
  transform: rotate(180deg);
}

.mode-hint {
  margin-top: 4px;
  color: var(--muted-light);
  font-size: 10.5px;
}

.view-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(30, 132, 106, 0.12);
  color: #1e846a;
  font-size: 9.5px;
  font-weight: 600;
}

body.is-viewing .form-actions,
body.is-viewing .upload-layout {
  display: none !important;
}

body.is-viewing .input-wrap {
  background: #fbf9f4;
}

body.is-viewing .input-wrap input {
  cursor: default;
}

body.is-viewing .image-tile[data-image-key] img {
  cursor: zoom-in;
}

@media (max-width: 860px) {
  .mode-title {
    gap: 7px;
    font-size: 23px;
  }

  .mode-title-switch {
    width: 22px;
    height: 22px;
  }

  .mode-hint {
    font-size: 9.5px;
  }
}

.field-hint {
  margin-top: -2px;
  color: var(--muted-light);
  font-size: 9.5px;
  line-height: 1.4;
}

/* =========================================================
   Material code as primary identity (v1.5)
   ========================================================= */
.form-head h2.material-code-title {
  font-family: var(--mono);
  font-size: clamp(21px, 2.4vw, 28px);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.material-name-line {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
}

.material-name-text {
  overflow-wrap: anywhere;
}

.material-card-code {
  font-family: var(--mono);
  letter-spacing: -0.01em;
}

.material-card-name {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
}

.table-material-copy .material-code-strong {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: -0.01em;
}

.table-material-copy .material-name-sub {
  overflow: hidden;
  max-width: 225px;
  color: var(--muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .form-head h2.material-code-title {
    font-size: 22px;
  }

  .material-name-line {
    font-size: 12.5px;
  }
}

/* =========================================================
   Product wording, notes field and viewport fit (v1.6)
   ========================================================= */
.upload-buttons label.btn {
  cursor: pointer;
  user-select: none;
}

.notes-field {
  margin-top: 16px;
}

.notes-field textarea {
  min-height: 74px;
  background: #fffdf8;
}

.version-public-notes {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f8f4ea;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.version-public-notes span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted-light);
  font-size: 8.5px;
  letter-spacing: 0.04em;
}

body.is-viewing .notes-field textarea {
  background: #fbf9f4;
  cursor: default;
}

/* Keep the sticky product panel within the viewport after zoom fitting. */
.material-panel {
  max-height: var(--panel-max, calc(100vh - 126px));
}

/* =========================================================
   Category Excel tools and WeCom push page (v1.7)
   ========================================================= */
.db-category-tools {
  display: flex;
  gap: 6px;
}

.push-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 16px;
  align-items: start;
}

.push-config-card,
.push-products-card {
  min-width: 0;
}

.push-switch-row {
  margin: 4px 0 16px;
}

.push-url-field {
  margin-bottom: 6px;
}

.push-fields {
  margin: 12px 0 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbf9f5;
}

.push-fields summary {
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

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

.push-field-grid .field-label {
  font-size: 10px;
}

.push-field-grid input {
  font-family: var(--mono);
  font-size: 11px;
}

.push-config-actions {
  margin-top: 14px;
}

.push-hint {
  margin-top: 10px;
  color: var(--muted-light);
  font-size: 10px;
  line-height: 1.6;
}

.push-search {
  margin-bottom: 8px;
  width: 100%;
}

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

.push-select-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
}

.push-product-list {
  max-height: 430px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf9;
}

.push-product-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border-bottom: 1px solid #f2ede4;
  cursor: pointer;
}

.push-product-row:last-child {
  border-bottom: 0;
}

.push-product-row:hover {
  background: #faf6ee;
}

.push-product-row input {
  flex: none;
  width: 15px;
  height: 15px;
  accent-color: var(--orange);
}

.push-product-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
}

.push-product-copy strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11.5px;
}

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

.push-product-meta {
  flex: none;
  color: var(--muted-light);
  font-family: var(--mono);
  font-size: 9px;
}

.push-empty {
  padding: 30px 16px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.push-log-card {
  margin-top: 16px;
}

.push-log-message {
  max-width: 460px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.push-status {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 600;
}

.push-status.is-success {
  background: rgba(30, 132, 106, 0.12);
  color: #1e846a;
}

.push-status.is-error {
  background: rgba(195, 70, 53, 0.12);
  color: #c34635;
}

.push-status.is-info {
  background: rgba(16, 42, 67, 0.08);
  color: var(--muted);
}

.import-result.is-error {
  border-color: rgba(195, 70, 53, 0.35);
  background: #fdf4f2;
}

@media (max-width: 1180px) {
  .push-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .push-field-grid {
    grid-template-columns: 1fr;
  }

  .db-category-tools {
    width: 100%;
  }

  .db-category-tools .btn {
    flex: 1;
  }
}

/* Show every category chip instead of clipping one line. */
.category-chips {
  flex: 0 0 auto;
  flex-wrap: wrap;
  overflow-x: visible;
  row-gap: 7px;
}

.bottom-sheet .category-chips {
  padding-bottom: 8px;
}

/* Custom WeCom field mapping rows */
.push-field-grid {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.push-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 128px 32px;
  gap: 6px;
  align-items: center;
}

.push-field-row input,
.push-field-row select {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  outline: none;
}

.push-field-row input[data-push-field-id] {
  font-family: var(--mono);
}

.push-field-row input:focus,
.push-field-row select:focus {
  border-color: var(--orange);
}

.push-add-field {
  margin-top: 9px;
  font-size: 11px;
}

@media (max-width: 1180px) {
  .push-field-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 110px 32px;
  }
}

@media (max-width: 640px) {
  .push-field-row {
    grid-template-columns: 1fr 1fr;
  }

  .push-field-row select {
    grid-column: 1 / 2;
  }
}

/* Two-column field mapping: local source + remote field id */
.push-field-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted-light);
  font-size: 9px;
}

.push-field-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px;
}

@media (max-width: 640px) {
  .push-field-head {
    display: none;
  }
}

/* Form template designer (v2.0) */
.template-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.template-section-card {
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf9;
}

.template-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.template-section-num {
  color: var(--muted-light);
  font-family: var(--mono);
  font-size: 10px;
}

.template-section-head input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.template-section-actions {
  display: flex;
  gap: 2px;
}

.template-field-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 100px 64px 1.2fr 32px;
  gap: 6px;
  align-items: center;
  margin-bottom: 7px;
}

.template-field-row input,
.template-field-row select {
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
}

.template-field-row input[readonly] {
  background: #f5f1e8;
  color: var(--muted);
}

.template-required {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.template-add-section {
  margin-top: 4px;
}

@media (max-width: 1180px) {
  .template-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .template-field-row {
    grid-template-columns: 1fr 1fr;
  }

  .template-required {
    height: 32px;
  }
}

/* Notes: one line, auto-grow, no manual resize (v2.0) */
.notes-field textarea {
  min-height: 40px;
  height: 40px;
  resize: none;
  overflow-y: hidden;
  line-height: 1.55;
}

body.is-viewing .notes-field textarea {
  height: auto;
}
