:root {
  color-scheme: light;
  --ink: #1b1f24;
  --muted: #7b828a;
  --line: #d7dbe0;
  --soft: #f4f5f7;
  --accent: #0f7b6c;
  --accent-soft: #e8f4f1;
  --warn: #ffd71a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f7f8fa;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

.page {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 18px 14px 44px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(24px, 7vw, 42px);
  line-height: 1.18;
  font-weight: 800;
}

h2 {
  font-size: clamp(26px, 8vw, 42px);
  line-height: 1.15;
  font-weight: 850;
}

.badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #3b424a;
  font-size: 14px;
  font-weight: 700;
  background: #fff;
}

.section {
  margin-top: 30px;
}

.compact-section {
  margin-top: 18px;
}

.section-mark {
  width: 10px;
  height: 10px;
  margin-bottom: 18px;
  background: var(--ink);
}

.rule {
  height: 4px;
  margin: 18px 0 28px;
  background: var(--ink);
}

.info-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.field {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.field:first-child {
  padding-top: 0;
}

.field:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.field span {
  display: block;
  margin-bottom: 8px;
  color: #6f7780;
  font-size: 18px;
  line-height: 1.25;
}

.field strong {
  display: block;
  font-size: clamp(22px, 6vw, 34px);
  line-height: 1.32;
  font-weight: 850;
  word-break: break-word;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 18px;
}

th {
  background: var(--soft);
  color: #555e66;
}

td {
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

.photo,
.empty-photo {
  display: block;
  width: 100%;
  border-radius: 8px;
}

.photo {
  max-height: 620px;
  object-fit: cover;
}

.hero-photo-section {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.material-card {
  display: grid;
  gap: 8px;
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: #fff;
}

.material-card strong {
  font-size: 18px;
  line-height: 1.25;
}

.material-card span {
  color: var(--accent);
  font-size: 24px;
  line-height: 1;
  font-weight: 900;
}

.empty-photo {
  display: grid;
  min-height: 180px;
  place-items: center;
  border: 1px dashed var(--line);
  color: var(--muted);
  background: var(--soft);
  font-size: 18px;
}

.note,
footer {
  margin-top: 18px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.loading,
.error {
  padding: 28px 0;
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
}

.error {
  color: #b42318;
}

.label-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

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

.label-toolbar h1 {
  font-size: 30px;
}

.label-toolbar p {
  margin-top: 6px;
  color: var(--muted);
}

button {
  min-height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.base-url {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
  font-weight: 700;
}

.base-url input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 16px;
}

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

.label {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid #111;
  break-inside: avoid;
  background: var(--warn);
  color: #111;
}

.label-title {
  min-height: 48px;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 22px;
  line-height: 1.18;
  font-weight: 900;
}

.label img {
  width: 168px;
  height: 168px;
  background: #fff;
}

.label-meta {
  font-size: 14px;
  font-weight: 800;
}

.admin-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.admin-header,
.admin-layout,
.panel-title,
.form-actions {
  display: flex;
  gap: 16px;
}

.admin-header,
.panel-title,
.form-actions {
  align-items: center;
  justify-content: space-between;
}

.admin-header {
  margin-bottom: 22px;
}

.admin-header h1 {
  font-size: 34px;
}

.admin-layout {
  align-items: flex-start;
}

.admin-panel,
.shelf-list-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

.photo-field {
  align-content: start;
}

.photo-field small {
  color: var(--muted);
  font-weight: 600;
}

.upload-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.upload-row input[type="file"] {
  padding: 7px;
}

button:disabled {
  cursor: not-allowed;
  opacity: .65;
}

.admin-panel {
  flex: 1;
  min-width: 0;
}

.shelf-list-panel {
  width: 310px;
  flex: 0 0 310px;
}

.admin-panel h2,
.shelf-list-panel h2,
.panel-title h2 {
  font-size: 22px;
  line-height: 1.2;
}

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

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

label {
  display: grid;
  gap: 7px;
  font-weight: 800;
}

label span {
  color: #3b424a;
  font-size: 14px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  font: inherit;
}

input {
  min-height: 42px;
}

textarea {
  resize: vertical;
}

.editor-form {
  display: grid;
  gap: 16px;
}

.shelf-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.shelf-list-item {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 0;
  padding: 11px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  text-align: left;
}

.shelf-list-item span,
.muted,
.form-message {
  color: var(--muted);
  font-size: 14px;
}

.items-title {
  margin-top: 4px;
}

.items-editor {
  display: grid;
  gap: 10px;
}

.item-row {
  display: grid;
  grid-template-columns: 1fr 110px 100px 42px;
  gap: 10px;
}

.danger,
.icon-danger {
  background: #b42318;
}

.icon-danger {
  min-height: 42px;
  padding: 0;
  font-size: 24px;
}

.text-link {
  color: var(--accent);
  font-weight: 850;
  text-decoration: none;
}

.error-text {
  color: #b42318;
}

[hidden] {
  display: none !important;
}

@media (max-width: 520px) {
  .page {
    padding: 12px 10px 36px;
  }

  .topbar,
  .label-toolbar,
  .admin-header,
  .admin-layout,
  .panel-title,
  .form-actions {
    display: grid;
  }

  .shelf-list-panel {
    width: 100%;
    flex-basis: auto;
  }

  .form-grid.two,
  .item-row,
  .upload-row {
    grid-template-columns: 1fr;
  }

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

  .info-card {
    padding: 18px;
  }

  th,
  td {
    font-size: 16px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .label-page {
    max-width: none;
    padding: 0;
  }

  .label-toolbar,
  .base-url {
    display: none;
  }

  .labels {
    grid-template-columns: repeat(3, 1fr);
    gap: 8mm;
  }

  .label {
    page-break-inside: avoid;
  }
}
