:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --panel: #fffdf8;
  --panel-strong: #ffffff;
  --ink: #1d2420;
  --muted: #68736d;
  --line: #ded8cc;
  --accent: #24766a;
  --accent-dark: #15584f;
  --amber: #b66b18;
  --red: #b4483d;
  --shadow: 0 18px 60px rgba(43, 38, 30, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(36, 118, 106, 0.12), transparent 34rem),
    linear-gradient(135deg, #f7f4ee 0%, #eef3ef 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: rgba(255, 253, 248, 0.84);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px;
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  align-items: center;
  background: var(--accent);
  border-radius: 8px;
  color: white;
  display: grid;
  font-weight: 800;
  height: 42px;
  place-items: center;
  width: 42px;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.eyebrow,
.hint,
.item-main p,
.shopping-item p,
.item-meta small {
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav a,
.logout button {
  border-radius: 8px;
  color: var(--muted);
  padding: 12px 14px;
}

.nav a:hover,
.logout button:hover {
  background: #edf3ee;
  color: var(--accent-dark);
}

.logout {
  margin-top: auto;
}

.logout button,
.ghost {
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.main {
  padding: 36px;
}

.page-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 0 auto 24px;
  max-width: 1120px;
}

.page-header.compact {
  justify-content: flex-start;
}

.eyebrow {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
  margin-bottom: 0;
}

h2 {
  font-size: 1rem;
  margin-bottom: 5px;
}

.primary,
.secondary,
.filters button,
.link-button {
  align-items: center;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
}

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

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

.secondary {
  background: #e7eee8;
  color: var(--accent-dark);
}

.stats-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 auto 18px;
  max-width: 1120px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.stat span {
  display: block;
  font-size: 2rem;
  font-weight: 900;
}

.stat small {
  color: var(--muted);
}

.stat.warn span {
  color: var(--accent);
}

.stat.amber span {
  color: var(--amber);
}

.stat.danger span {
  color: var(--red);
}

.filters {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(180px, 1fr) 180px 180px 110px;
  margin: 0 auto 18px;
  max-width: 1120px;
}

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

textarea {
  resize: vertical;
}

.filters button {
  background: #1f2d29;
  color: white;
}

.inventory-list,
.shopping-list {
  display: grid;
  gap: 10px;
  margin: 0 auto;
  max-width: 1120px;
}

.item-row,
.shopping-item,
.empty-state,
.login-card,
.item-form {
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.item-row {
  align-items: center;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 180px 184px;
  padding: 16px;
}

.item-row.low {
  border-left: 5px solid var(--accent);
}

.item-row.soon {
  border-left: 5px solid var(--amber);
}

.item-row.expired {
  border-left: 5px solid var(--red);
}

.item-main {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 5px 9px;
}

.badge.low {
  background: #dfefe9;
  color: var(--accent-dark);
}

.badge.soon {
  background: #f8ead8;
  color: #804910;
}

.badge.expired {
  background: #fae1df;
  color: #8f2f27;
}

.item-meta {
  display: grid;
  gap: 4px;
}

.quantity-actions {
  display: grid;
  gap: 6px;
  grid-template-columns: 42px 42px 1fr;
}

.quantity-actions button,
.quantity-actions a {
  align-items: center;
  background: #eef3ef;
  border: 0;
  border-radius: 8px;
  color: var(--accent-dark);
  cursor: pointer;
  display: flex;
  font-weight: 900;
  justify-content: center;
  min-height: 40px;
}

.quantity-actions a {
  font-size: 0.9rem;
}

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

.login-card {
  align-items: center;
  display: grid;
  gap: 38px;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  max-width: 980px;
  padding: 42px;
}

.login-copy h1 {
  font-size: clamp(2.8rem, 7vw, 5.4rem);
  margin: 12px 0 16px;
  max-width: 7.5ch;
}

.login-copy p {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 520px;
}

.form {
  display: grid;
  gap: 16px;
}

.form.stacked {
  align-content: center;
}

.form label {
  color: var(--muted);
  display: grid;
  font-size: 0.88rem;
  font-weight: 800;
  gap: 7px;
}

.item-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 auto;
  max-width: 860px;
  padding: 22px;
}

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

.form-actions {
  align-items: center;
  display: flex;
  gap: 12px;
}

.danger-button {
  color: var(--red);
  margin-left: auto;
  width: auto;
}

.shopping-item {
  align-items: center;
  display: flex;
  justify-content: space-between;
  padding: 18px;
}

.empty-state {
  padding: 36px;
  text-align: center;
}

.messages {
  display: grid;
  gap: 8px;
  margin: 0 auto 18px;
  max-width: 1120px;
}

.message {
  background: #edf3ee;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-dark);
  padding: 12px 14px;
}

.message.error {
  background: #fae1df;
  color: #8f2f27;
}

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

  .sidebar {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    padding: 18px;
  }

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

  .logout {
    margin-top: 0;
  }

  .main {
    padding: 22px;
  }

  .stats-grid,
  .filters,
  .item-row,
  .login-card {
    grid-template-columns: 1fr;
  }

  .login-card {
    gap: 28px;
  }

  .login-copy h1 {
    font-size: clamp(2.4rem, 9vw, 4rem);
    max-width: 10ch;
  }

  .page-header {
    align-items: flex-start;
    gap: 16px;
  }
}

@media (max-width: 560px) {
  .page-header,
  .item-main,
  .shopping-item,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

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

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

  .login-view {
    align-items: start;
    padding: 16px;
  }

  .login-card {
    gap: 22px;
    padding: 28px 22px;
  }

  .login-copy h1 {
    font-size: clamp(2.1rem, 13vw, 3.35rem);
    line-height: 0.96;
    max-width: 8ch;
  }

  .login-copy p {
    font-size: 1rem;
    line-height: 1.35;
  }
}
