﻿:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --panel: #fffdf8;
  --ink: #24302d;
  --muted: #6d7772;
  --line: #ded7ca;
  --accent: #266b5e;
  --accent-strong: #174b42;
  --accent-soft: #e3f0ec;
  --warning: #9b3d2d;
  --gold: #bf8b2e;
  --shadow: 0 18px 45px rgba(36, 48, 45, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(38, 107, 94, 0.12), transparent 36%),
    linear-gradient(315deg, rgba(191, 139, 46, 0.14), transparent 34%),
    var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

.admin-link,
.primary-button,
.ghost-button,
.item-button,
.small-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  text-decoration: none;
  font-weight: 800;
}

.admin-link,
.ghost-button {
  background: var(--panel);
  color: var(--accent-strong);
  border: 1px solid var(--line);
}

.primary-button,
.item-button {
  background: var(--accent);
  color: white;
}

.primary-button:hover,
.item-button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.summary > div,
.admin-panel,
.item-card,
.dialog-panel {
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid rgba(222, 215, 202, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary > div {
  padding: 18px;
}

.summary span {
  display: block;
  color: var(--accent-strong);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.summary small {
  color: var(--muted);
  font-weight: 700;
}

.list-section {
  padding-top: 8px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.status,
.message {
  min-height: 24px;
  color: var(--muted);
  font-weight: 700;
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.item-card {
  min-height: 260px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.image-slot {
  aspect-ratio: 4 / 3;
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
  background: #edf0eb;
}

.item-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.placeholder-image {
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  background: linear-gradient(135deg, var(--accent-soft), #f6ecd9);
  font-size: 3rem;
  font-weight: 900;
}

.item-name {
  margin: 0 0 8px;
  font-size: 1.2rem;
  font-weight: 900;
}

.item-count {
  width: fit-content;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 7px 10px;
  font-weight: 900;
}

.empty .item-count {
  background: #f6e4df;
  color: var(--warning);
}

.dialog {
  width: min(440px, calc(100% - 32px));
  border: 0;
  padding: 0;
  background: transparent;
}

.dialog::backdrop {
  background: rgba(22, 32, 29, 0.42);
}

.dialog-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.admin-shell {
  max-width: 1060px;
}

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

.hidden {
  display: none;
}

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

.item-form {
  grid-template-columns: minmax(170px, 1fr) 130px minmax(200px, 1fr) auto;
  align-items: end;
  margin-bottom: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 12px;
}

input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(38, 107, 94, 0.16);
}

.admin-list,
.selection-list {
  display: grid;
  gap: 10px;
}

.admin-row,
.selection-row {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.item-admin-row {
  grid-template-columns: minmax(150px, 1fr) 100px minmax(200px, 1.1fr) auto;
}

.selection-row {
  grid-template-columns: minmax(220px, 1fr) auto auto;
}

.selection-row strong,
.selection-row span,
.selection-row small {
  display: inline-block;
}

.selection-row small {
  color: var(--muted);
  font-weight: 700;
}

.admin-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.small-button {
  min-height: 38px;
  padding: 0 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.small-button.danger {
  background: #f6e4df;
  color: var(--warning);
}

@media (max-width: 860px) {
  .item-form,
  .item-admin-row,
  .selection-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 24px, 1120px);
    padding-top: 22px;
  }

  .topbar,
  .section-title {
    align-items: flex-start;
  }

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

  .admin-actions,
  .dialog-actions {
    justify-content: stretch;
  }

  .admin-actions .small-button,
  .dialog-actions button {
    flex: 1;
  }
}
