body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0;
  height: env(safe-area-inset-top, 0px);
  background: var(--cream);
  z-index: 20;
}
body.no-scroll { overflow: hidden; }

.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--cream);
}
.topbar-title { font-weight: 700; font-size: 18px; color: var(--orange); }
.link-btn {
  background: none; border: 0; padding: 8px;
  color: var(--orange-dark); font-weight: 600; cursor: pointer;
}

select, input[type="text"], input[type="number"], input[type="date"] {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 14px 8px;
}
.summary { padding: 0 14px 6px; color: var(--muted); font-size: 14px; }

.list { list-style: none; margin: 0; padding: 0 0 100px; }
.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.item-main { flex: 1; min-width: 0; }
.item-name {
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item-meta {
  font-size: 13px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.badge {
  flex: none;
  min-width: 70px;
  text-align: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.badge.expired { background: var(--red); color: #fff; }
.badge.soon { background: #FDE2E2; color: #B42318; }
.badge.week { background: #FFE8C2; color: #9A5B00; }
.badge.ok { background: #DDF3E1; color: #1E6B34; }
.badge.none { background: #EEE8E0; color: #7A6A5A; }

.empty { text-align: center; color: var(--muted); padding: 48px 24px; }

.fab {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: 56px; height: 56px;
  border: 0; border-radius: 50%;
  background: var(--orange);
  color: #fff;
  font-size: 30px; line-height: 1;
  box-shadow: 0 4px 12px rgba(120, 70, 10, .3);
  cursor: pointer;
  z-index: 10;
}
.fab:active { background: var(--orange-dark); }

.sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
}
.sheet-backdrop { position: absolute; inset: 0; background: rgba(60, 35, 10, .45); }
.sheet-body {
  position: relative;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--cream);
  border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom, 0px));
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { margin: 0; font-size: 20px; color: var(--orange); }
.sheet label { display: block; margin-top: 12px; font-size: 14px; color: var(--muted); }
.sheet label > * { margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  border: 1px solid var(--orange);
  background: #fff;
  color: var(--orange-dark);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.btn.block { width: 100%; margin-top: 16px; }
.sheet .msg { margin: 10px 0 0; text-align: left; }
