:root {
  --ink: #241c1d;
  --cream: #fff9ef;
  --paper: #fffdf8;
  --pink: #f8c5d8;
  --hot-pink: #d84f91;
  --coral: #cf613b;
  --orange: #ff7a1a;
  --yellow: #ffc928;
  --mint: #9ddccb;
  --blue: #91a8ee;
  --line: #241c1d;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--cream);
  background-image: radial-gradient(rgba(36, 28, 29, .09) 1px, transparent 1px);
  background-size: 20px 20px;
  color: var(--ink);
  font-family: "Rubik", sans-serif;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.shell {
  width: min(100%, 1420px);
  margin: auto;
  padding: 24px 38px 90px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px 24px;
}

.wordmark {
  color: var(--ink);
  font-family: "Secular One", sans-serif;
  font-size: 22px;
  text-decoration: none;
}

.top-actions { display: flex; align-items: center; gap: 18px; }
.private-label { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 12px; font-weight: 600; }
.private-label span { width: 9px; height: 9px; border: 2px solid var(--ink); border-radius: 50%; background: var(--mint); }
.login-button { padding: 7px 11px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); box-shadow: 2px 2px 0 var(--ink); cursor: pointer; font-size: 12px; font-weight: 700; }
.login-button:hover { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }

.hero {
  position: relative;
  isolation: isolate;
  min-height: 390px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 32px;
  overflow: hidden;
  padding: 48px 55px;
  border: 3px solid var(--ink);
  border-radius: 32px;
  background: var(--pink);
  box-shadow: 9px 9px 0 var(--ink);
}

.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 330px;
  height: 330px;
  left: -85px;
  bottom: -145px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--blue);
}

.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 180px;
  height: 70px;
  left: 25%;
  top: -24px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  transform: rotate(-9deg);
}

.hero-copy { position: relative; z-index: 1; }
.eyebrow { display: inline-block; margin: 0 0 18px; padding: 7px 13px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); box-shadow: 3px 3px 0 var(--ink); font-size: 13px; font-weight: 700; }
h1, h2 { margin: 0; font-family: "Secular One", sans-serif; letter-spacing: -.055em; }
h1 { max-width: 1000px; font-size: clamp(58px, 8.4vw, 122px); line-height: .83; font-weight: 400; }
h1 em { display: inline-block; color: var(--coral); font-style: normal; text-shadow: 2px 2px 0 var(--ink); transform: rotate(-1deg); }
.hero-doodle { position: absolute; z-index: 0; font-family: "Secular One", sans-serif; line-height: 1; }
.doodle-one { left: 9%; top: 50px; color: var(--orange); font-size: 72px; transform: rotate(12deg); }
.doodle-two { left: 42%; bottom: 25px; color: var(--hot-pink); font-size: 58px; transform: rotate(-10deg); }

.add-button, .save {
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--yellow);
  box-shadow: 5px 5px 0 var(--ink);
  cursor: pointer;
  font-weight: 800;
  transition: transform .15s, box-shadow .15s;
}
.add-button { z-index: 2; padding: 15px 20px; white-space: nowrap; }
.save { width: 100%; margin-top: 28px; padding: 14px 20px; }
.add-button:hover, .save:hover { transform: translate(2px, 2px); box-shadow: 3px 3px 0 var(--ink); }
.add-button:disabled, .save:disabled { opacity: .55; cursor: wait; }

.controls {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 28px;
  margin: 38px 0 28px;
  padding: 20px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 5px 5px 0 var(--ink);
}

.filter-groups { display: grid; gap: 14px; }
.filter-group { display: flex; align-items: center; gap: 12px; }
.filter-label { min-width: 70px; font-size: 12px; font-weight: 800; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter {
  padding: 8px 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--cream);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: transform .15s, background .15s;
}
.filter:hover { transform: rotate(-1deg) translateY(-1px); }
#action-filters .filter.active { background: var(--orange); color: #fff; }
#recipient-filters .filter.active { background: var(--mint); }

.control-tools { display: grid; justify-items: end; gap: 10px; }
.view-toggle { display: flex; gap: 2px; padding: 3px; border: 2px solid var(--ink); border-radius: 10px; background: var(--cream); }
.view-button { padding: 7px 10px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; font-size: 11px; font-weight: 700; }
.view-button.active { background: var(--ink); color: #fff; }
.search { width: 235px; display: flex; align-items: center; gap: 7px; padding: 0 11px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; }
.search input { min-width: 0; width: 100%; padding: 10px 0; border: 0; outline: 0; background: transparent; }

.inventory { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 22px; }
.card { min-width: 0; padding: 9px 9px 15px; border: 2px solid var(--ink); border-radius: 18px; background: var(--paper); box-shadow: 5px 5px 0 var(--ink); transition: transform .2s, box-shadow .2s; }
.card:nth-child(6n + 2), .card:nth-child(6n + 5) { transform: rotate(.35deg); }
.card:nth-child(6n + 3) { transform: rotate(-.3deg); }
.card:hover { z-index: 2; transform: translateY(-5px) rotate(0); box-shadow: 8px 9px 0 var(--ink); }
.image { position: relative; aspect-ratio: 4/3; overflow: hidden; border: 2px solid var(--ink); border-radius: 11px; background: var(--mint); }
.image img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s; }
.card:hover .image img { transform: scale(1.035); }
.placeholder { height: 100%; display: grid; place-items: center; font-weight: 700; }
.tag { position: absolute; top: 11px; left: 11px; padding: 6px 10px; border: 2px solid var(--ink); border-radius: 7px; background: var(--yellow); box-shadow: 2px 2px 0 var(--ink); font-size: 11px; font-weight: 800; }
.tag.gift { background: var(--pink); }
.tag.keep { background: var(--mint); }
.card-actions { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; opacity: 0; transition: opacity .15s; }
.card:hover .card-actions, .card-actions:focus-within { opacity: 1; }
.edit-item, .remove-item { min-height: 30px; border: 2px solid var(--ink); background: #fff; box-shadow: 2px 2px 0 var(--ink); cursor: pointer; font-weight: 700; }
.edit-item { padding: 3px 10px; border-radius: 7px; font-size: 11px; }
.remove-item { width: 30px; border-radius: 50%; font-size: 19px; line-height: 1; }
.edit-item:hover { background: var(--yellow); }
.remove-item:hover { background: var(--hot-pink); color: #fff; }
.card-info { padding: 14px 4px 0; }
.item-row { display: flex; justify-content: space-between; align-items: baseline; gap: 9px; }
.item-row h3 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.price { padding: 3px 7px; border: 1.5px solid var(--ink); border-radius: 6px; background: var(--yellow); white-space: nowrap; font-size: 12px; font-weight: 800; }
.card-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 9px; font-size: 12px; }
.availability { padding: 4px 7px; border: 1.5px solid var(--ink); border-radius: 999px; background: var(--mint); font-size: 10px; font-weight: 700; white-space: nowrap; }
.availability.delivered { background: var(--pink); }
.availability.saved { background: var(--blue); }
.category { margin: 7px 0 0; color: #776d6e; font-size: 11px; }
.details { margin: 8px 0 0; color: #62595a; font-size: 12px; line-height: 1.45; }
.empty { margin: 45px 0; text-align: center; font-size: 18px; font-weight: 700; }

.inventory.table-view { display: block; }
.table-wrap { overflow: auto; border: 2px solid var(--ink); border-radius: 16px; background: var(--paper); box-shadow: 5px 5px 0 var(--ink); }
.product-table { width: 100%; border-collapse: collapse; text-align: right; }
.product-table th { padding: 12px 14px; border-bottom: 2px solid var(--ink); background: var(--pink); font-size: 11px; white-space: nowrap; }
.product-table td { padding: 11px 14px; border-bottom: 1.5px solid var(--ink); font-size: 13px; vertical-align: middle; }
.product-table tbody tr:last-child td { border-bottom: 0; }
.product-table tbody tr:nth-child(even) { background: #fff4e5; }
.product-table tbody tr:hover { background: #fff0a9; }
.product-table small { display: block; margin-top: 3px; color: #766e6f; }
.table-image { width: 70px; height: 52px; border: 1.5px solid var(--ink); border-radius: 7px; object-fit: cover; display: block; }
.table-actions { display: flex; justify-content: flex-end; gap: 7px; }
.table-actions .edit-item, .table-actions .remove-item { opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

dialog { width: min(640px, calc(100% - 28px)); max-height: calc(100vh - 30px); overflow: auto; padding: 0; border: 3px solid var(--ink); border-radius: 20px; background: var(--cream); box-shadow: 9px 9px 0 var(--ink); }
dialog::backdrop { background: rgba(36, 28, 29, .58); backdrop-filter: blur(3px); }
form { padding: 32px; }
.form-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 26px; }
.form-heading .eyebrow { margin-bottom: 10px; background: var(--yellow); box-shadow: none; }
.form-heading h2 { font-size: 42px; line-height: .95; }
.close { width: 38px; height: 38px; padding: 0; border: 2px solid var(--ink); border-radius: 50%; background: #fff; box-shadow: 2px 2px 0 var(--ink); cursor: pointer; font-size: 27px; line-height: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.form-grid label, .login-fields label { display: grid; gap: 7px; font-size: 12px; font-weight: 700; }
.optional-label { display: inline; margin-right: 4px; color: #766e6f; font-size: 10px; font-weight: 500; }
.form-grid input, .form-grid select, .form-grid textarea, .login-fields input { width: 100%; padding: 11px; border: 2px solid var(--ink); border-radius: 8px; outline: 0; background: #fff; color: var(--ink); }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .login-fields input:focus { box-shadow: 3px 3px 0 var(--hot-pink); }
.wide { grid-column: 1 / -1; }
.photo-input span { color: #766e6f; font-size: 10px; font-weight: 400; }
.photo-input input { padding: 8px; }
.login-fields { display: grid; gap: 16px; }
.form-error { margin: 0; color: #a32d42; font-size: 13px; font-weight: 700; }

@media (max-width: 900px) {
  .shell { padding-inline: 22px; }
  .hero { min-height: 340px; padding: 38px 32px; }
  .controls { align-items: stretch; flex-direction: column; }
  .control-tools { grid-template-columns: auto 1fr; align-items: center; justify-items: stretch; }
  .search { width: 100%; }
  .inventory { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .shell { padding: 14px 13px 60px; }
  .topbar { padding: 0 2px 18px; }
  .wordmark { font-size: 19px; }
  .private-label { display: none; }
  .hero { min-height: 330px; grid-template-columns: 1fr; padding: 31px 22px; border-radius: 23px; box-shadow: 6px 6px 0 var(--ink); }
  h1 { font-size: clamp(50px, 16vw, 76px); }
  .hero::before { width: 230px; height: 230px; }
  .doodle-one { left: 4%; top: 28px; font-size: 54px; }
  .doodle-two { display: none; }
  .add-button { width: max-content; }
  .controls { margin-top: 28px; padding: 15px; box-shadow: 4px 4px 0 var(--ink); }
  .filter-group { display: block; }
  .filter-label { display: block; margin-bottom: 8px; }
  .filter { padding: 7px 11px; }
  .control-tools { grid-template-columns: 1fr; }
  .view-toggle { width: max-content; }
  .inventory { grid-template-columns: 1fr; gap: 24px; }
  .card { transform: none !important; }
  .card-actions { opacity: 1; }
  .product-table { min-width: 700px; }
  form { padding: 23px 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .form-heading h2 { font-size: 36px; }
}
