:root {
  --bg: #0a0a0f;
  --surface: #13131a;
  --border: #1e1e2e;
  --text: #e8e8f0;
  --text-dim: #6b6b8a;
  --accent: #7c6af7;
  --accent-hover: #9580ff;
  --danger: #e05260;
  --success: #4caf82;
  --offer: #f0a030;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.screen { min-height: 100vh; }
.hidden { display: none !important; }

/* ── Login ── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-box {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.logo { font-size: 3.5rem; margin-bottom: 1rem; }

.login-box h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.subtitle {
  color: var(--text-dim);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 0.75rem;
  outline: none;
  transition: border-color 0.2s;
}

input:focus { border-color: var(--accent); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0.9rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
}

.btn-primary:hover { background: var(--accent-hover); }

.error {
  color: var(--danger);
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

/* ── App Header ── */
#app-screen {
  display: flex;
  flex-direction: column;
  max-width: 600px;
  margin: 0 auto;
  padding: 0 0 2rem;
}

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

header h1 { font-size: 1.4rem; font-weight: 700; }

/* ── Add Bar ── */
.add-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.add-bar input {
  flex: 1;
  margin: 0;
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
}

.btn-icon {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 1.2rem;
  width: 2.8rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s;
}

.btn-icon:hover { border-color: var(--accent); }

.add-bar .btn-primary {
  width: 2.8rem;
  padding: 0;
  font-size: 1.4rem;
  flex-shrink: 0;
}

/* ── Scanner ── */
#scanner-container {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#scanner-video {
  width: 100%;
  max-width: 480px;
  object-fit: cover;
}

.scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scan-line {
  width: 70%;
  max-width: 300px;
  height: 2px;
  background: var(--accent);
  animation: scan 2s ease-in-out infinite;
  box-shadow: 0 0 8px var(--accent);
}

@keyframes scan {
  0%, 100% { transform: translateY(-60px); }
  50%       { transform: translateY(60px); }
}

.btn-close {
  position: absolute;
  bottom: 2rem;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 0.8rem 2rem;
  border-radius: 30px;
  font-size: 1rem;
  cursor: pointer;
}

/* ── List ── */
#list-container { padding: 0.5rem 1rem; }

.center-msg {
  text-align: center;
  color: var(--text-dim);
  padding: 3rem 1rem;
  font-size: 0.95rem;
}

#item-list { list-style: none; }

.item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
  transition: opacity 0.2s;
}

.item.checked { opacity: 0.4; }

.item-check {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--border);
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.15rem;
  transition: background 0.2s, border-color 0.2s;
}

.item-check.done {
  background: var(--success);
  border-color: var(--success);
}

.item-check.done::after { content: '✓'; color: #fff; font-size: 0.8rem; }

.item-body { flex: 1; min-width: 0; }

.item-name {
  font-size: 1rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item.checked .item-name { text-decoration: line-through; }

.item-meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

.item-offer {
  font-size: 0.8rem;
  color: var(--offer);
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.item-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.3rem;
  border-radius: 6px;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.item-delete:hover { opacity: 1; color: var(--danger); }
