:root {
  color-scheme: light;
  --bg: #f7f4ef;
  --surface: #fffdfa;
  --surface-strong: #ffffff;
  --ink: #27231f;
  --muted: #756d64;
  --line: #ded7ce;
  --accent: #2f6f68;
  --accent-dark: #245852;
  --coral: #b85c50;
  --gold: #b2872f;
  --blue: #3d6387;
  --shadow: 0 18px 42px rgba(44, 36, 28, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 15% 0%, rgba(184, 92, 80, 0.14), transparent 28rem),
    linear-gradient(135deg, #f7f4ef 0%, #f3f7f5 52%, #f7f4ef 100%);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

button,
a.secondary {
  min-height: 42px;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 48px);
  background: rgba(247, 244, 239, 0.9);
  border-bottom: 1px solid rgba(222, 215, 206, 0.75);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 1.35rem;
  font-weight: 800;
}

.eyebrow,
.counter,
.gift-note,
.gift-price,
.form-error {
  margin: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.8vw, 2.3rem);
  line-height: 1.05;
}

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

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

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.9);
}

.search-field svg {
  width: 18px;
  color: var(--muted);
}

.search-field input {
  width: 100%;
  height: 44px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.72);
}

.segment {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segment.active {
  background: var(--ink);
  color: white;
}

.counter {
  min-width: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

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

.gift-card {
  overflow: hidden;
  border: 1px solid rgba(222, 215, 206, 0.9);
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.gift-image-link {
  display: block;
  height: 214px;
  background: #ebe6de;
}

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

.gift-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.gift-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  max-width: 100%;
  padding: 5px 9px;
  border-radius: 7px;
  color: var(--muted);
  background: #f1ece5;
  font-size: 0.78rem;
  font-weight: 800;
}

.pill.status {
  color: #245852;
  background: #e3f1ec;
}

.gift-card.is-reserved .pill.status {
  color: #7b3a33;
  background: #f8e5df;
}

.gift-title {
  min-height: 3.25rem;
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.32;
}

.gift-note {
  min-height: 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.gift-price {
  align-self: flex-start;
  padding: 6px 10px;
  border-radius: 7px;
  background: #f5efd9;
  color: #6f5118;
  font-size: 0.92rem;
  font-weight: 900;
}

.reservation-info {
  padding: 10px;
  border: 1px solid #eed4ca;
  border-radius: 8px;
  color: #703a33;
  background: #fff3ef;
  font-size: 0.9rem;
}

.gift-actions,
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.primary,
.secondary,
.ghost,
.danger,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
}

.primary {
  padding: 0 15px;
  background: var(--accent);
  color: white;
}

.primary:hover,
.primary:focus-visible {
  background: var(--accent-dark);
}

.secondary {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.ghost {
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
}

.danger {
  padding: 0 14px;
  background: #f5dfdc;
  color: #7a3029;
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

button svg,
a svg {
  width: 17px;
  height: 17px;
}

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

.admin-panel {
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.88);
}

.admin-form,
.edit-form {
  display: grid;
  gap: 12px;
}

.admin-form {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
}

.wide {
  grid-column: span 2;
}

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

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

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 104, 0.15);
}

.edit-form {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.dialog {
  width: min(440px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: 0 26px 80px rgba(33, 26, 18, 0.25);
}

.dialog::backdrop {
  background: rgba(39, 35, 31, 0.42);
  backdrop-filter: blur(4px);
}

.dialog form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.form-error {
  min-height: 1.25rem;
  color: #8a332c;
  font-size: 0.9rem;
}

.empty {
  padding: 32px 0;
  color: var(--muted);
  text-align: center;
}

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

  .segmented {
    grid-auto-flow: initial;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .counter {
    justify-self: start;
  }

  .admin-form {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 14px 16px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .shell {
    width: min(100% - 24px, 1180px);
    padding-top: 16px;
  }

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

  .gift-image-link {
    height: 200px;
  }
}
