:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --ink: #25231f;
  --muted: #6c665d;
  --panel: #ffffff;
  --line: #ded8cd;
  --brand: #226a5a;
  --brand-strong: #164b40;
  --accent: #b94736;
  --soft: #e8f2ef;
  --shadow: 0 14px 38px rgba(37, 35, 31, .12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(34, 106, 90, .12), transparent 34%),
    linear-gradient(315deg, rgba(185, 71, 54, .10), transparent 38%),
    var(--bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.page {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

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

.brand h1 {
  margin: 0;
  font-size: clamp(1.65rem, 5vw, 3.4rem);
  line-height: 1;
}

.brand p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.logout {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .74);
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}

.grid {
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel,
.gift-card,
.login-card {
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel h2,
.panel h3 {
  margin: 0 0 14px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
}

label {
  color: var(--muted);
  font-size: .92rem;
  font-weight: 750;
}

input,
button,
select {
  font: inherit;
}

input[type="text"],
input[type="password"],
input[type="search"],
input[type="file"],
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 3px solid rgba(34, 106, 90, .18);
  border-color: var(--brand);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 7px;
  padding: 10px 14px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
}

.button:hover {
  background: var(--brand-strong);
}

.button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.button.danger {
  background: var(--accent);
}

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

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

.card-actions form {
  display: contents;
}

.card-actions .button {
  width: 100%;
}

.icon-button {
  font-size: 1.25rem;
  line-height: 1;
}

.notice,
.error {
  margin: 0 0 16px;
  border-radius: 7px;
  padding: 11px 12px;
  font-weight: 700;
}

.notice {
  background: var(--soft);
  color: var(--brand-strong);
}

.error {
  background: #fff0ed;
  color: #8d281b;
}

.preview {
  width: 100%;
  max-height: 230px;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid var(--line);
}

.filters {
  margin-bottom: 18px;
}

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

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

.gift-card {
  overflow: hidden;
}

.gift-card img,
.photo-fallback {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: linear-gradient(135deg, #e8f2ef, #fff5e7);
}

.photo-fallback {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.gift-body {
  padding: 13px;
}

.gift-body h3 {
  margin: 0 0 10px;
  font-size: 1.08rem;
}

.meta {
  display: grid;
  gap: 5px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: .94rem;
}

.meta strong {
  color: var(--ink);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 26px;
  text-align: center;
  color: var(--muted);
  background: rgba(255,255,255,.55);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  padding: 24px;
}

.login-card h1 {
  margin: 0 0 8px;
}

.login-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

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

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

@media (max-width: 560px) {
  .page {
    width: min(100% - 18px, 1180px);
    padding-top: 14px;
  }

  .topbar {
    align-items: flex-start;
  }

  .brand h1 {
    font-size: 2rem;
  }

  .panel {
    padding: 14px;
  }

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

  .gift-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .gift-body {
    padding: 10px;
  }

  .gift-body h3 {
    font-size: .98rem;
    overflow-wrap: anywhere;
  }

  .meta {
    font-size: .84rem;
  }

  .button,
  .logout {
    width: 100%;
  }
}
