:root {
  color-scheme: light;
  --ink: #262720;
  --muted: #6f7167;
  --paper: #f3f1e8;
  --card: #fffef9;
  --line: #d9d6ca;
  --green: #315b3b;
  --green-dark: #24462d;
  --green-soft: #e0eadf;
  --amber: #98690e;
  --amber-soft: #fff1c9;
  --red: #a23b32;
  --red-soft: #f9dfda;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 0 0, #fff 0, transparent 35rem),
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.shell {
  width: min(100% - 2rem, 1040px);
  min-height: 100vh;
  margin: auto;
  display: flex;
  flex-direction: column;
}

.site-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: inherit;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  color: white;
  background: var(--green);
  border-radius: 9px;
  font-family: Georgia, serif;
}

.header-actions,
.language-switcher {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.language-switcher {
  padding: 0.2rem;
  background: rgba(0, 0, 0, 0.035);
  border-radius: 7px;
}

.language-switcher button {
  padding: 0.35rem 0.55rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 700;
}

.language-switcher button.active {
  color: var(--ink);
  background: white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

main {
  flex: 1;
}

.locked-layout {
  min-height: calc(100vh - 150px);
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: clamp(2rem, 8vw, 7rem);
  align-items: center;
}

.intro h1,
.inventory-heading h1 {
  margin: 0 0 0.8rem;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -0.045em;
}

.intro h1 {
  max-width: 600px;
  font-size: clamp(3.4rem, 8vw, 6.6rem);
  line-height: 0.93;
}

.intro > p:last-child {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--green);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: 0 12px 35px rgba(50, 46, 35, 0.045);
}

.secret-card {
  display: grid;
  gap: 0.7rem;
  padding: 1.5rem;
}

label {
  font-size: 0.76rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 42px;
  color: var(--ink);
  background: white;
  border: 1px solid #c7c4b9;
  border-radius: 7px;
  outline: none;
}

input {
  padding: 0 0.75rem;
}

select {
  padding: 0 2rem 0 0.65rem;
}

input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(49, 91, 59, 0.13);
}

.button {
  min-height: 40px;
  padding: 0.55rem 0.9rem;
  border: 0;
  border-radius: 7px;
  font-weight: 800;
}

.button-primary {
  color: white;
  background: var(--green);
}

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

.button-quiet {
  color: var(--muted);
  background: transparent;
}

.message {
  min-height: 1em;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.error {
  color: var(--red);
}

#inventory {
  padding: clamp(3rem, 7vw, 5rem) 0;
}

.inventory-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 1.25rem;
}

.inventory-heading h1 {
  font-size: clamp(2.6rem, 6vw, 4.6rem);
}

.count {
  margin-bottom: 0.65rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.add-form {
  display: grid;
  grid-template-columns: 1.4fr 0.55fr 0.75fr 0.85fr;
  gap: 0.85rem;
  padding: 1rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.form-footer {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.toolbar {
  display: flex;
  gap: 0.7rem;
  justify-content: space-between;
  margin: 1.5rem 0 0.8rem;
}

.search-control {
  position: relative;
  flex: 1;
  max-width: 440px;
}

.search-control svg {
  position: absolute;
  left: 0.72rem;
  top: 50%;
  width: 1rem;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  transform: translateY(-50%);
}

.search-control input {
  padding-left: 2.25rem;
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
}

.sort-control span {
  white-space: nowrap;
}

.items-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.item {
  min-height: 70px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 0.55fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem 1rem;
}

.item-main {
  display: grid;
  gap: 0.2rem;
}

.item-main strong {
  font-size: 0.95rem;
}

.item-quantity {
  color: var(--muted);
  font-size: 0.8rem;
}

.expiry {
  width: fit-content;
  padding: 0.28rem 0.52rem;
  color: var(--muted);
  background: #efeee8;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 750;
}

.expiry-danger {
  color: var(--red);
  background: var(--red-soft);
}

.expiry-warning {
  color: var(--amber);
  background: var(--amber-soft);
}

.expiry-normal {
  color: var(--green);
  background: var(--green-soft);
}

.item-controls {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.quantity-button,
.remove-button {
  min-width: 30px;
  min-height: 30px;
  padding: 0.2rem 0.5rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 750;
}

.quantity-button:hover {
  color: var(--green);
  border-color: var(--green);
}

.remove-button {
  margin-left: 0.3rem;
  border-color: transparent;
  font-size: 0.72rem;
}

.remove-button:hover {
  color: var(--red);
  background: var(--red-soft);
}

.empty-state {
  padding: 3rem 1rem;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 10px;
}

footer {
  min-height: 78px;
  display: flex;
  align-items: center;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
}

.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;
}

[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .locked-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 4rem 0;
  }

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

  .field-name {
    grid-column: 1 / -1;
  }

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

  .expiry {
    justify-self: end;
  }

  .item-controls {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .site-header,
  .header-actions {
    align-items: flex-start;
  }

  .site-header {
    padding: 1rem 0;
  }

  .header-actions {
    flex-direction: column;
  }

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

  .field-name,
  .form-footer {
    grid-column: auto;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .sort-control {
    justify-content: space-between;
  }

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

  .expiry {
    justify-self: start;
  }
}
