:root {
  color-scheme: light;
  --bg: #fff7eb;
  --panel: #fffaf2;
  --ink: #1a1a1a;
  --muted: #6f6257;
  --line: #e8d9c8;
  --accent: #c2542e;
  --accent-dark: #97381f;
  --blue: #0f2233;
  --gold: #d4af37;
  --shadow: 0 12px 28px rgba(15, 34, 51, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(255, 255, 255, 0.92) 0, rgba(255, 255, 255, 0) 36%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button,
.file-action,
.photo-picker {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf2;
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
}

button:hover,
.file-action:hover,
.photo-picker:hover {
  border-color: #c9b9a5;
}

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

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

.danger {
  color: #9d221c;
}

.topbar {
  min-height: 104px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 24px clamp(18px, 5vw, 46px) 18px;
  background: transparent;
  color: var(--ink);
}

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

.brand-block {
  display: grid;
  gap: 5px;
  width: min(315px, 78vw);
}

.brand-logo {
  display: block;
  max-width: 100%;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 500;
  text-transform: none;
}

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

h1 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.15rem, 6vw, 4.2rem);
  line-height: 1;
  letter-spacing: 0;
  color: var(--blue);
}

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto 110px;
}

.mobile-nav,
.mobile-detail-head {
  display: none;
}

.toolbar,
.stats,
.detail-panel,
.list-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.toolbar {
  display: flex;
  align-items: end;
  gap: 14px;
  justify-content: space-between;
  padding: 11px;
  border-radius: 8px;
}

.search {
  flex: 1;
}

label span,
.search span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 252, 247, 0.94);
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(183, 51, 43, 0.13);
}

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

.file-action input,
.photo-picker input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.stats {
  margin-top: 10px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
}

.stats div {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  padding: 6px 10px;
  border-right: 1px solid var(--line);
  min-width: 0;
}

.stats div:last-child {
  border-right: 0;
}

.stats strong {
  display: inline-block;
  color: var(--blue);
  font-size: 1.08rem;
  line-height: 1;
}

.stats span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  margin: 0;
  white-space: nowrap;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 16px;
  margin-top: 14px;
}

.privacy-note {
  margin-top: 14px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.privacy-note p {
  margin: 0;
}

.list-panel,
.detail-panel {
  border-radius: 8px;
  min-width: 0;
}

.list-panel {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  align-self: start;
  max-height: calc(100vh - 230px);
  overflow: auto;
}

.pizza-list {
  display: grid;
  gap: 11px;
}

.pizza-card {
  width: 100%;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 10px;
  background: rgba(255, 250, 242, 0.96);
  box-shadow: var(--shadow);
}

.pizza-card.active {
  border-color: rgba(15, 34, 51, 0.18);
  box-shadow: 0 0 0 2px rgba(15, 34, 51, 0.08), var(--shadow);
}

.thumb {
  width: 112px;
  aspect-ratio: 1;
  border-radius: 8px;
  background: #eef1f2;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--blue);
  font-weight: 900;
}

.thumb img,
.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb.empty-thumb {
  padding: 16px;
  background: linear-gradient(145deg, #fffaf2, #eef1f2);
}

.thumb.empty-thumb img {
  max-width: 100%;
  width: 42px;
  height: auto;
  object-fit: contain;
}

.thumb.empty-thumb span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}

.card-title {
  margin: 0 0 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
  line-height: 1.05;
  color: var(--blue);
}

.card-meta {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.rating-stars-display {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 6px;
}

.rating-star-box {
  position: relative;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 3px;
  background: #e7e7e7;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.78rem;
  line-height: 1;
}

.rating-star-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--fill);
  background: var(--accent);
}

.rating-star-symbol {
  position: relative;
  z-index: 1;
}

.rating-number {
  margin-left: 5px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
}

.tag-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.tag {
  border-radius: 999px;
  background: #f3dfce;
  color: #8a3d24;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 800;
}

.empty-state {
  padding: 28px 16px;
  text-align: center;
}

.empty-symbol {
  display: block;
  max-width: 100%;
  width: 58px;
  height: auto;
  object-fit: contain;
  margin: 0 auto 12px;
}

.empty-state p {
  color: var(--muted);
}

.pizza-form {
  display: grid;
  gap: 15px;
  padding: 16px;
}

.form-head,
.field-grid {
  display: grid;
  gap: 12px;
}

.form-head {
  grid-template-columns: 1fr 180px;
}

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

.photo-preview {
  min-height: 260px;
  border: 1px dashed #c9b9a5;
  border-radius: 8px;
  background: #eee3d6;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.photos-section {
  display: grid;
  gap: 12px;
}

.photo-slot {
  display: grid;
  gap: 8px;
}

.main-photo {
  grid-template-columns: minmax(0, 1fr) 120px;
  align-items: end;
}

.main-photo-tools {
  display: grid;
  gap: 8px;
}

.photo-adjust {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.86);
  overflow: hidden;
}

.photo-adjust summary {
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  color: var(--blue);
  cursor: pointer;
  font-weight: 800;
}

.photo-adjust-grid {
  display: grid;
  gap: 9px;
  padding: 0 10px 10px;
}

.photo-adjust-grid select,
.photo-adjust-grid input {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 0.86rem;
}

.zoom-control span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.zoom-control b {
  color: var(--blue);
}

.zoom-control input {
  padding-inline: 0;
  accent-color: var(--accent);
}

.secondary-photos {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.secondary-photo {
  position: relative;
}

.secondary-photo .photo-preview {
  position: relative;
}

.secondary-photo .photo-preview {
  border-style: solid;
}

.secondary-photo .photo-preview span {
  color: #a7784d;
  font-size: 1.7rem;
}

.icon-picker {
  position: absolute;
  right: 8px;
  bottom: 52px;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 999px;
  background: rgba(33, 25, 20, 0.86);
  border-color: rgba(33, 25, 20, 0.86);
  color: white;
  font-size: 1.25rem;
  line-height: 1;
}

.photo-label-select {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
}

.photo-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  background: rgba(33, 25, 20, 0.78);
  color: white;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 800;
}

.photo-preview.small {
  min-height: 112px;
}

.form-actions {
  display: flex;
  gap: 9px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  pointer-events: none;
  background: #202124;
  color: white;
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  transition: opacity 0.18s ease, transform 0.18s ease;
  max-width: min(520px, calc(100% - 24px));
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 5;
  width: min(420px, calc(100% - 30px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.96);
  box-shadow: 0 16px 36px rgba(15, 34, 51, 0.14);
  backdrop-filter: blur(12px);
}

.bottom-nav button {
  min-height: 54px;
  display: grid;
  gap: 2px;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 700;
}

.bottom-nav button span {
  font-size: 1.35rem;
  line-height: 1;
}

.bottom-nav button.active {
  color: var(--accent);
}

@media (max-width: 820px) {
  body[data-view="list"] .detail-panel,
  body[data-view="detail"] .toolbar,
  body[data-view="detail"] .stats,
  body[data-view="detail"] .list-panel {
    display: none;
  }

  .mobile-nav {
    display: none;
  }

  .mobile-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 2px;
  }

  .mobile-detail-head span {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
  }

  .toolbar,
  .content-grid,
  .form-head,
  .field-grid,
  .main-photo,
  .secondary-photos {
    grid-template-columns: 1fr;
  }

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

  .toolbar {
    display: grid;
  }

  .topbar {
    min-height: 104px;
    align-items: end;
  }

  .topbar .primary {
    display: none;
  }

  .shell {
    width: min(430px, calc(100% - 28px));
  }

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

  .stats div {
    border-right: 1px solid var(--line);
    border-bottom: 0;
    padding: 5px 5px;
  }

  .stats div:last-child {
    border-right: 0;
  }

  .stats strong {
    font-size: 1rem;
  }

  .stats span {
    font-size: 0.72rem;
  }

  .list-panel {
    max-height: none;
  }

  .photo-preview {
    min-height: 220px;
  }

  .main-photo-tools {
    grid-template-columns: 1fr;
  }

  .pizza-card {
    grid-template-columns: 118px minmax(0, 1fr);
    min-height: 0;
  }

  .thumb {
    width: 118px;
    height: 118px;
  }
}

@media (max-width: 430px) {
  .pizza-card {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .thumb {
    width: 104px;
    height: 104px;
  }

  .card-title {
    font-size: 1rem;
  }

  .rating-star-box {
    width: 16px;
    height: 16px;
    font-size: 0.7rem;
  }

  .trust-value,
  .rating-number {
    font-size: 0.78rem;
  }
}
