:root {
  --bg: #081120;
  --panel: #10213d;
  --panel-2: #162b4e;
  --border: rgba(124, 196, 255, 0.18);
  --text: #ebf3ff;
  --muted: #b4c4df;
  --blue: #5fb3ff;
  --blue-2: #88c8ff;
  --green: #4ade80;
  --red: #f87171;
  --shadow: 0 16px 42px rgba(0,0,0,0.26);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(180deg, #06101d 0%, #0a1629 100%);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.app-shell, .login-shell {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 10px;
}
.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 10px;
}

/* ---- Header ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.header h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}
.header-muted {
  color: var(--muted);
  font-size: 12px;
}
.manage-toggle {
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: rgba(255,255,255,0.08);
  color: var(--text);
}
.manage-toggle.unlocked {
  background: rgba(74,222,128,0.16);
  color: #d9ffe7;
}
.manage-toggle.locked {
  background: rgba(255,255,255,0.08);
  color: var(--muted);
}

/* ---- Add form ---- */
.add-form {
  display: flex;
  align-items: center;
  gap: 8px;
}
.add-input-wrap {
  flex: 1;
  position: relative;
}
.add-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 12px 14px;
  font-size: 16px;
  outline: none;
}
.add-input:focus {
  border-color: var(--blue);
}
.qty-badge {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 2px;
}
.qty-badge button {
  border: none;
  background: none;
  color: var(--blue-2);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.qty-badge button:hover {
  background: rgba(255,255,255,0.08);
}
.qty-badge span {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  min-width: 20px;
  text-align: center;
}
.add-btn {
  flex-shrink: 0;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #4ea7ff, #2f7ddd);
  color: white;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.who-bar {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.who-btn {
  flex: 1;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 8px;
  cursor: pointer;
  text-align: center;
}
.who-btn.active {
  border-color: var(--blue);
  background: rgba(95,179,255,0.14);
  color: var(--blue-2);
}

/* ---- Banner ---- */
.banner {
  margin-bottom: 10px;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
}
.banner.success { background: rgba(74,222,128,0.12); color: #d9ffe7; }
.banner.error { background: rgba(248,113,113,0.12); color: #ffd7d7; }

/* ---- Section header ---- */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.section-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(95,179,255,0.14);
  color: var(--blue-2);
  font-weight: 700;
  font-size: 13px;
  padding: 0 8px;
}
.count-pill.muted {
  background: rgba(255,255,255,0.08);
  color: var(--muted);
}

/* ---- Items list ---- */
.items {
  display: block;
}
.item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 4px;
  background: transparent;
  border-radius: 0;
}
.item-row + .item-row {
  border-top: 1px solid rgba(255,255,255,0.08);
}
.item-main {
  flex: 1;
  min-width: 0;
}
.item-top {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.item-name {
  font-size: 16px;
  font-weight: 700;
  word-break: break-word;
}
.item-qty {
  font-size: 13px;
  color: var(--blue-2);
  font-weight: 600;
  white-space: nowrap;
}
.item-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}
.check-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.2);
  padding: 0;
  background: transparent;
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.check-btn.complete {
  border-color: var(--green);
  background: rgba(74,222,128,0.14);
  color: #d8ffe6;
}
.row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}
.action-icon {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.action-icon:hover {
  background: rgba(255,255,255,0.06);
}
.action-icon.danger:hover {
  color: var(--red);
}
.inline-form { display: inline; }
.inline-form button { margin: 0; }
.struck { text-decoration: line-through; opacity: 0.6; }
.completed-row { opacity: 0.85; }
.empty-state {
  color: var(--muted);
  font-size: 14px;
  padding: 10px 0;
  text-align: center;
}
.clear-wrap {
  margin-top: 10px;
  text-align: center;
}
.clear-btn {
  border: none;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
}
.clear-btn:hover {
  background: rgba(255,255,255,0.1);
}

/* ---- Completed collapsible ---- */
.completed-toggle {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}
.completed-toggle:hover {
  color: var(--text);
}
.completed-body {
  display: none;
}
.completed-body.open {
  display: block;
}

/* ---- Login/Edit pages ---- */
.login-card h1 {
  margin: 6px 0 4px;
  font-size: 24px;
}
.login-card .muted {
  margin: 0 0 14px;
}
.form-stack {
  display: grid;
  gap: 12px;
}
.form-stack label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.form-stack input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 12px 14px;
  font-size: 16px;
}
.form-stack input:focus {
  outline: none;
  border-color: var(--blue);
}
.primary-btn {
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #4ea7ff, #2f7ddd);
  color: white;
  font-size: 16px;
  font-weight: 700;
  padding: 14px;
  cursor: pointer;
  text-align: center;
}
.secondary-link {
  color: var(--blue-2);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
}
.split-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.split-actions .primary-btn {
  flex: 1;
}
.split-actions .secondary-link {
  padding: 14px 12px;
}

/* ---- Footer ---- */
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 8px;
}

/* ---- Responsive tweaks ---- */
@media (max-width: 480px) {
  .app-shell, .login-shell { padding: 6px; }
  .card { padding: 12px; border-radius: 14px; }
  .item-row { padding: 8px 10px; }
  .header h1 { font-size: 20px; }
}
