:root {
  color-scheme: dark;
  --ink: #f1f6f2;
  --muted: #b7c6bf;
  --cream: #0c1714;
  --card: rgba(244, 250, 247, .085);
  --line: rgba(235, 248, 240, .16);
  --gold: #f0c96b;
  --green: #bce5d1;
  --red: #ff9b8c;
  --glass: rgba(15, 30, 26, .68);
  --glass-strong: rgba(18, 36, 31, .86);
  --glow: 0 18px 55px rgba(0, 0, 0, .24);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #0b1713; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 8% 0%, rgba(66, 127, 100, .28), transparent 36rem),
    radial-gradient(ellipse at 92% 14%, rgba(123, 115, 170, .17), transparent 34rem),
    radial-gradient(ellipse at 56% 92%, rgba(210, 160, 72, .10), transparent 45rem),
    linear-gradient(145deg, #09120f 0%, #11201b 48%, #10191a 100%);
  background-attachment: fixed;
  font: 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
body, button, input, textarea, select { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: #d7ebde; text-underline-offset: .2em; }
a:hover { color: #fff1c7; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 12px clamp(18px, 3vw, 44px);
  color: var(--ink);
  background: rgba(8, 20, 16, .76);
  border-bottom: 1px solid rgba(231, 246, 237, .14);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .14);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
}
.brand { color: #f5f8f4; font-weight: 750; letter-spacing: .015em; text-decoration: none; white-space: nowrap; }
.brand span { color: var(--gold); margin-left: 6px; }
.topbar nav { display: flex; align-items: center; justify-content: flex-end; gap: 5px; flex-wrap: wrap; }
.topbar nav a {
  color: #d0dbd5;
  text-decoration: none;
  font-size: 13px;
  font-weight: 580;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}
.topbar nav a:hover, .topbar nav a[aria-current="page"] {
  color: #fff5dc;
  background: rgba(255, 255, 255, .09);
  border-color: rgba(240, 201, 107, .28);
}

.container { width: min(1320px, calc(100% - 40px)); margin: 36px auto 72px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 25px; }
.eyebrow { color: var(--gold); font-size: 11px; font-weight: 760; letter-spacing: .16em; text-transform: uppercase; margin: 0 0 7px; }
.page-head h1 { margin: 0; font-size: clamp(30px, 4vw, 46px); line-height: 1.04; letter-spacing: -.035em; font-weight: 720; }
h1, h2, h3 { color: #f4f7f4; }
h2 { margin: 0 0 15px; font-size: 20px; letter-spacing: -.015em; }
.muted { color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.card, .panel, .auth-card {
  color: var(--ink);
  background: linear-gradient(145deg, rgba(247, 251, 248, .12), rgba(235, 247, 241, .055));
  border: 1px solid rgba(236, 248, 241, .16);
  border-radius: 18px;
  box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, .10);
  backdrop-filter: blur(20px) saturate(135%);
  -webkit-backdrop-filter: blur(20px) saturate(135%);
}
.card { position: relative; min-height: 112px; padding: 19px 20px; overflow: hidden; }
.card::after { content: ""; position: absolute; right: -26px; top: -38px; width: 96px; height: 96px; border-radius: 50%; background: radial-gradient(circle, rgba(240, 201, 107, .13), transparent 70%); pointer-events: none; }
.card span { color: #c2d0c9; display: block; font-size: 12px; font-weight: 560; letter-spacing: .025em; }
.card strong { display: block; color: #f7faf7; font-size: clamp(28px, 3vw, 36px); line-height: 1.08; letter-spacing: -.035em; margin-top: 10px; }
.card.warning { border-color: rgba(255, 165, 135, .26); background: linear-gradient(145deg, rgba(121, 54, 42, .23), rgba(236, 247, 240, .055)); }
.card.warning strong { color: #ffb19f; }
.grid-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.panel { padding: 23px; margin-bottom: 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.section-head h2 { margin-bottom: 0; }
.action { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 2px; color: #f0f6f2; text-decoration: none; border-top: 1px solid rgba(235, 248, 240, .12); }
.action:last-child { border-bottom: 1px solid rgba(235, 248, 240, .12); }
.action:hover { color: #fff2c8; }
.action strong { color: #f6f8f5; margin-right: .35rem; }
.action small { color: #b8c8c0; }

.button, button {
  display: inline-block;
  padding: 10px 16px;
  color: #f0f6f2;
  font: inherit;
  font-weight: 640;
  text-decoration: none;
  cursor: pointer;
  background: rgba(255, 255, 255, .075);
  border: 1px solid rgba(230, 245, 236, .22);
  border-radius: 11px;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.button:hover, button:hover { color: #fff; background: rgba(255, 255, 255, .13); border-color: rgba(245, 214, 143, .45); transform: translateY(-1px); }
.primary { color: #172018 !important; background: linear-gradient(135deg, #f0cf7e, #e6b84c) !important; border-color: rgba(255, 228, 163, .75) !important; box-shadow: 0 8px 22px rgba(201, 151, 52, .18); }
.primary:hover { color: #101813 !important; background: #ffdc8b !important; }
.danger { color: #ffb2a6 !important; }
.flash { padding: 12px 15px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 18px; background: var(--glass); backdrop-filter: blur(12px); }
.flash.error { color: #ffd0c8; background: rgba(107, 39, 37, .42); border-color: rgba(255, 149, 134, .25); }
.flash.success { color: #d6f5df; background: rgba(35, 105, 64, .35); border-color: rgba(146, 225, 171, .23); }

.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: end; }
label { display: block; color: #e2eae5; font-size: 12px; font-weight: 650; letter-spacing: .02em; }
input, textarea, select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  color: #f1f6f2;
  background: rgba(4, 15, 11, .34);
  border: 1px solid rgba(224, 240, 230, .22);
  border-radius: 10px;
  font: inherit;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, .12);
}
input::placeholder, textarea::placeholder { color: #9cac9f; }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(240, 201, 107, .45);
  outline-offset: 2px;
  border-color: rgba(240, 201, 107, .65);
}
select option { color: #f1f6f2; background: #17231f; }
textarea { min-height: 100px; resize: vertical; }
table { width: 100%; border-collapse: collapse; color: #e8efeb; }
th, td { padding: 12px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid rgba(235, 248, 240, .12); }
th { color: #bac9c1; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
tbody tr:hover { background: rgba(255, 255, 255, .035); }
td small { display: block; color: #b7c6bf; font-size: 12px; }
.pill, .status { color: #d9f1e3; font-size: 11px; font-weight: 650; padding: 4px 9px; border: 1px solid rgba(154, 224, 181, .2); border-radius: 999px; background: rgba(56, 129, 86, .22); }
.status.needs { color: #ffd0c8; background: rgba(159, 61, 50, .24); border-color: rgba(255, 153, 136, .2); }
.empty { color: #b9c8c1; text-align: center; padding: 34px 18px; }
.auth-card { max-width: 460px; margin: clamp(32px, 9vh, 90px) auto; padding: clamp(23px, 4vw, 34px); }
.auth-card h1 { margin-top: 0; }
.auth-card form { display: grid; gap: 16px; }
.auth-card button { width: 100%; margin-top: 5px; }
.edit-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.edit-form button { grid-column: span 2; }
.link { padding: 0; background: none; border: 0; }
.footer { color: #aabbb2; text-align: center; font-size: 12px; padding: 20px; }
.shopping-group table { margin-top: 8px; }
.recipe-line { display: grid; grid-template-columns: minmax(220px, 2fr) 120px 150px minmax(160px, 1fr) auto; gap: 9px; align-items: center; padding: 10px 0; border-top: 1px solid rgba(235, 248, 240, .13); }
.recipe-line select, .recipe-line input { margin-top: 0; }
.wide-field { grid-column: 1 / -1; }
.table-wrap { overflow-x: auto; border-radius: 12px; }

@media (max-width: 1100px) {
  .topbar { align-items: flex-start; flex-direction: column; gap: 8px; }
  .topbar nav { width: 100%; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { flex: 0 0 auto; }
}
@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recipe-line { grid-template-columns: 1fr 1fr; }
  .recipe-line select:first-child, .recipe-line input:nth-child(4) { grid-column: span 2; }
}
@media (max-width: 760px) {
  .container { width: min(100% - 24px, 600px); margin: 24px auto 48px; }
  .topbar { padding: 10px 14px; }
  .topbar nav { gap: 2px; }
  .topbar nav a { padding: 7px 9px; font-size: 12px; }
  .cards, .grid-two { grid-template-columns: 1fr; gap: 11px; }
  .card { min-height: 92px; }
  .card strong { font-size: 30px; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 14px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .table-wrap { overflow-x: auto; }
  table { min-width: 720px; }
  .panel { padding: 18px; }
  .auth-card { margin: 30px auto; }
  .edit-form { grid-template-columns: 1fr; }
  .edit-form button { grid-column: span 1; }
}
@media (max-width: 420px) {
  .form-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 31px; }
  .panel { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
