:root {
  color-scheme: light dark;
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  line-height: 1.5;
}
body { margin: 0; background: #ffffff; color: #111111; }
main {
  max-width: 480px;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 16px 24px;
}
h1 { font-size: 1.6rem; margin: 0 0 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
label { font-weight: 600; }
input {
  font: inherit;
  min-height: 48px;
  padding: 10px 12px;
  border: 2px solid #6b6b6b;
  border-radius: 10px;
  background: transparent;
  color: inherit;
}
button {
  font: inherit;
  font-weight: 600;
  min-height: 52px;
  border: 0;
  border-radius: 12px;
  background: #005fcc;
  color: #ffffff;
  cursor: pointer;
}
button.secondary { background: transparent; color: inherit; border: 2px solid #6b6b6b; }
input:focus, button:focus, a:focus { outline: 3px solid #005fcc; outline-offset: 2px; }
a { color: #0550ae; }
.alert { border: 2px solid #b00020; border-radius: 10px; padding: 12px; color: #b00020; font-weight: 600; }
@media (prefers-color-scheme: dark) {
  body { background: #111111; color: #f2f2f2; }
  input { border-color: #9a9a9a; }
  button.secondary { border-color: #9a9a9a; }
  a { color: #8ab4f8; }
  .alert { border-color: #ff8a80; color: #ff8a80; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}


.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar h1 { margin: 0; }
.tabs { display: flex; gap: 8px; margin: 16px 0 8px; }
.tabs button { flex: 1; background: transparent; color: inherit; border: 2px solid #6b6b6b; }
.tabs button[aria-selected="true"] { background: #005fcc; border-color: #005fcc; color: #ffffff; }
.sync { font-size: 0.9rem; min-height: 1.4em; margin: 4px 0 12px; }
.sync[data-state="error"], .sync[data-state="offline"] { color: #b00020; font-weight: 600; }
@media (prefers-color-scheme: dark) {
  .sync[data-state="error"], .sync[data-state="offline"] { color: #ff8a80; }
  .tabs button { border-color: #9a9a9a; }
}
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row input { flex: 1 1 160px; }
.card { border: 2px solid #6b6b6b; border-radius: 12px; padding: 12px; margin: 12px 0; }
.hint { color: #555555; font-size: 0.95rem; }
@media (prefers-color-scheme: dark) { .hint { color: #bbbbbb; } }
button.small { min-height: 44px; padding: 6px 12px; font-size: 0.95rem; }
button:disabled { opacity: 0.4; cursor: default; }
select { font: inherit; min-height: 44px; padding: 6px 10px; border: 2px solid #6b6b6b; border-radius: 10px; background: transparent; color: inherit; max-width: 100%; }
.group { margin-top: 20px; }
.group h2 { font-size: 1.1rem; margin: 0 0 6px; border-bottom: 2px solid #6b6b6b; padding-bottom: 4px; }
.items, .aisles { list-style: none; padding: 0; margin: 0; }
.item { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-bottom: 1px solid #6b6b6b55; }
.item-label { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 400; }
.item-name { flex: 1; }
.qty { color: #555555; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .qty { color: #bbbbbb; } }
.item.done .item-name, .item.done .qty { text-decoration: line-through; opacity: 0.6; }
.item-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.check { width: 28px; height: 28px; flex: 0 0 auto; accent-color: #005fcc; }
.aisle-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #6b6b6b55; }
.aisle-row input { flex: 1 1 160px; }
.pos { min-width: 1.6em; text-align: right; color: #555555; }
.manage { margin-top: 24px; }
.manage summary { min-height: 44px; display: flex; align-items: center; font-weight: 600; cursor: pointer; }
.manage form, .manage p, .manage button { margin: 8px 0; }

@media (prefers-color-scheme: dark) {
  select,
  option {
    background-color: #1c1c1e;
    color: #f2f2f2;
  }
}
