* { box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
body {
  margin: 0;
  background: #0f172a;
  color: #e5e7eb;
}
.container {
  background: #020617;
  padding: 24px;
  border-radius: 12px;
  width: min(520px, 92vw);
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  box-sizing: border-box;
}
h1 { margin: 0; font-size: 1.6rem; }
.subtitle { color: #94a3b8; margin-bottom: 16px; }
.form {
  display: grid;
  grid-template-columns: 1.2fr 0.7fr 1fr auto;
  gap: 10px;
  margin-bottom: 16px;
  width: 100%;
  box-sizing: border-box;
}
.form input,
.form button {
  width: 100%;
  box-sizing: border-box;
}
input { flex: 1; padding: 8px; border-radius: 6px; border: none; }
button { background: #38bdf8; border: none; border-radius: 6px; padding: 8px 12px; font-weight: bold; cursor: pointer; }
button:hover { background: #0ea5e9; }
/* Expired look */
li.expired {
  opacity: 0.65;
}

li.expired .item-text {
  text-decoration: none; /* keep name readable */
}

.bar.expired {
  background: #777 !important;
}

/* little urgent badge */
.badge-expired {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.15);
  margin-left: 8px;
}

.badge-expired .warn {
  font-size: 14px;
}

ul { list-style: none; padding: 0; margin: 0; }
li { background: #020617; border: 1px solid #1e293b; border-radius: 6px; padding: 8px; margin-bottom: 8px; }

.item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.item-text {
  flex: 1;
  margin-right: 10px;
}

.bar {
  height: 6px;
  border-radius: 4px;
  margin-top: 4px;
  width: 100%;
}

.bar.good {
  background: linear-gradient(90deg, #2ecc71, #27ae60);
}

.bar.warn {
  background: linear-gradient(90deg, #f1c40f, #e67e22);
}

.bar.bad {
  background: linear-gradient(90deg, #e74c3c, #c0392b);
}

button.del {
  background: #e74c3c;
  border: none;
  color: white;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
}
@media (max-width: 520px) {
  .form {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "name name"
      "qty date"
      "btn btn";
  }

  #itemName { grid-area: name; }
  #itemQty  { grid-area: qty; }
  #itemExp  { grid-area: date; }
  #addBtn   { grid-area: btn; }
}

/* ===== EXPIRED (urgent) styling ===== */

/* do NOT dim the whole row */
li.expired {
  opacity: 1;
  filter: none;
}

/* dim ONLY the bar (so the "dead bar" look stays) */
li.expired .bar {
  opacity: 0.30;
  filter: grayscale(1);
}

/* make the main label text bright + bold */
li.expired .item-text,
li.expired .item-text * {
  color: #ffffff !important;
  font-weight: 900 !important;
  opacity: 1 !important;
}

/* make the badge bright + clean */
li.expired .badge-expired {
  color: #ffffff !important;
  font-weight: 900 !important;
  opacity: 1 !important;
  background: rgba(255,255,255,0.22) !important;
  border: 1px solid rgba(255,255,255,0.60) !important;
}

/* make the emoji pop */
li.expired .badge-expired .warn {
  filter: brightness(1.8) contrast(1.2);
}

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.hidden { display: none !important; }

.card { width: 100%; max-width: 420px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px; padding: 18px; backdrop-filter: blur(10px); }

.input { width: 100%; padding: 12px 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.2); color: #fff; outline: none; }

.primary, .secondary { width: 100%; padding: 12px; border-radius: 12px; border: 0; cursor: pointer; font-weight: 700; }
.primary { background: #ffffff; color: #111; }
.secondary { background: rgba(255,255,255,0.14); color: #fff; border: 1px solid rgba(255,255,255,0.18); }

/* Mobile-safe layout improvements */
.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.card {
  width: 100%;
  max-width: 420px;
}

#appRoot .container {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

@media (max-width: 480px) {
  .form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .form input,
  .form button {
    width: 100%;
  }
}

@media (max-width: 430px) {
  .container {
    padding: 18px;
    border-radius: 14px;
  }

  h1 {
    font-size: 1.4rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }
}
/* ===== Fridge Code Display ===== */
.code-box {
  width: 100%;
  text-align: center;
  font-size: 28px;
  letter-spacing: 2px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255,255,255,0.18);
  margin: 10px 0 16px;
  font-weight: 900;
}

/* ===== Fridge Code Display ===== */
.code-box {
  width: 100%;
  text-align: center;
  font-size: 28px;
  letter-spacing: 2px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255,255,255,0.18);
  margin: 10px 0 16px;
  font-weight: 900;
}
