:root {
  color-scheme: light;
  --bg: #f7f8f5;
  --surface: #ffffff;
  --ink: #26322c;
  --muted: #66736d;
  --line: #dfe6df;
  --primary: #0f8f72;
  --primary-dark: #08705a;
  --accent: #d96f32;
  --danger: #c34141;
  --shadow: 0 10px 30px rgba(38, 50, 44, 0.08);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

.app-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 40px);
  background: rgba(247, 248, 245, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

main {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 40px) 56px;
}

.eyebrow,
.label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel {
  margin-bottom: 18px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.profile-row,
.section-heading,
.item-title-row,
.toolbar,
.admin-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  background: linear-gradient(135deg, #0f8f72, #f0b35f);
  border-radius: 50%;
}

.profile-name {
  margin-top: 3px;
  font-weight: 700;
}

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

.toolbar {
  justify-content: flex-start;
  margin: 20px 0;
}

.segmented,
.text-button,
.icon-button,
.primary {
  border: 0;
  cursor: pointer;
}

.segmented {
  min-width: 88px;
  padding: 9px 14px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

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

.icon-button {
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
}

.text-button {
  color: var(--primary);
  background: transparent;
  font-weight: 700;
}

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

.primary {
  min-height: 44px;
  padding: 10px 16px;
  color: #fff;
  background: var(--primary);
  border-radius: 8px;
  font-weight: 700;
}

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

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.item-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.item-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e7ece8;
}

.item-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.status {
  flex: 0 0 auto;
  padding: 4px 8px;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 12px;
}

dd {
  margin: 2px 0 0;
  font-weight: 700;
}

.notes {
  min-height: 20px;
  color: var(--muted);
  line-height: 1.55;
}

.form-grid,
.preference-list {
  display: grid;
  gap: 12px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

textarea {
  resize: vertical;
}

.checkbox-label {
  grid-template-columns: auto 1fr;
  align-items: start;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.5;
}

.checkbox-label input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.preference-list {
  margin-top: 8px;
}

.preference-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px 104px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  background: #f9fbf8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.preference-row strong {
  display: block;
  margin-bottom: 4px;
}

.preference-row p {
  color: var(--muted);
  font-size: 13px;
}

.wide {
  grid-column: 1 / -1;
}

.cropper {
  display: grid;
  gap: 12px;
}

.cropper[hidden] {
  display: none;
}

#cropCanvas {
  width: 100%;
  max-height: 360px;
  background: #eef2ee;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.crop-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.admin-panel[hidden] {
  display: none;
}

@media (max-width: 640px) {
  .form-grid,
  .preference-row,
  .crop-controls {
    grid-template-columns: 1fr;
  }

  .app-header {
    padding-top: 14px;
    padding-bottom: 14px;
  }
}
