:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-alt: #273449;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --border: #334155;
  --danger: #ef4444;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 { font-size: 1.25rem; margin: 0; }
.topbar-actions { display: flex; gap: 0.5rem; }

main#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.view { display: flex; flex-direction: column; gap: 1rem; }
.hidden { display: none !important; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.centered-card { max-width: 360px; margin: 3rem auto; }

h2 { margin-top: 0; font-size: 1.05rem; }

label { display: block; font-size: 0.85rem; color: var(--text-dim); margin: 0.5rem 0 0.25rem; }

input[type="text"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 1rem;
}

textarea { resize: vertical; font-family: inherit; }

.btn {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
}

.btn.primary { background: var(--primary); border-color: var(--primary); color: white; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; margin-top: 0.75rem; }
.btn.danger { color: var(--danger); }

.inline-form { display: flex; gap: 0.5rem; margin: 0.5rem 0; flex-wrap: wrap; }
.inline-form input, .inline-form select { flex: 1; min-width: 140px; }

.chips { list-style: none; padding: 0; margin: 0.5rem 0 0; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.chips li {
  background: var(--surface-alt);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.chips li button { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 0.9rem; }

.lists { list-style: none; padding: 0; margin: 0.5rem 0 0; display: flex; flex-direction: column; gap: 0.5rem; }
.lists li {
  background: var(--surface-alt);
  border-radius: 8px;
  padding: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.lists li:hover { outline: 1px solid var(--primary); }
.lists li small { color: var(--text-dim); display: block; }

.strategy-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  background: var(--surface-alt);
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}
.strategy-picker label { display: flex; align-items: center; gap: 0.3rem; margin: 0; color: var(--text); }

.items { list-style: none; padding: 0; margin: 0.75rem 0; display: flex; flex-direction: column; gap: 0.4rem; }
.items li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface-alt);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
}
.items li .name { flex: 1; }
.items li .qty { color: var(--text-dim); font-size: 0.85rem; min-width: 2.5rem; }
.items li button { background: none; border: none; color: var(--danger); cursor: pointer; }
.items li.checked .name { text-decoration: line-through; color: var(--text-dim); }

.results { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.results li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface-alt);
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
}
.results li .name { flex: 1; }
.results li a.btn { text-decoration: none; }

.hint { font-size: 0.85rem; color: var(--text-dim); }
.error { color: var(--danger); font-size: 0.85rem; }
