:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #242424;
  --border: #333;
  --text: #e8e8e8;
  --text2: #999;
  --accent: #4ade80;
  --accent-dim: #22543d;
  --danger: #f87171;
  --danger-dim: #7f1d1d;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

[data-theme="light"] {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface2: #f0f0f0;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --text2: #666;
  --accent: #16a34a;
  --accent-dim: #dcfce7;
  --danger: #dc2626;
  --danger-dim: #fee2e2;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

h1 { font-size: 1.6rem; font-weight: 700; }

.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s;
}
.theme-toggle:hover { border-color: var(--accent); }

.add-category form {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

input[type="text"] {
  flex: 1;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
input[type="text"]:focus { border-color: var(--accent); }
input[type="text"]::placeholder { color: var(--text2); }

button {
  padding: 10px 16px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}
button:hover { opacity: 0.85; }

.category {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.category-header h2 {
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
}
.category-header h2:hover { color: var(--accent); }

.category-actions {
  display: flex;
  gap: 6px;
}

.btn-icon {
  background: none;
  border: none;
  padding: 4px 8px;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 6px;
  color: var(--text2);
  transition: all 0.2s;
}
.btn-icon:hover { background: var(--surface2); color: var(--text); }
.btn-icon.danger:hover { background: var(--danger-dim); color: var(--danger); }

.category-items { padding: 8px 0; }

.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  transition: background 0.15s;
}
.item:hover { background: var(--surface2); }

.item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.item-name {
  flex: 1;
  font-size: 0.95rem;
  cursor: pointer;
}
.item-name.checked {
  text-decoration: line-through;
  color: var(--text2);
}

.add-item {
  display: flex;
  gap: 6px;
  padding: 8px 12px 12px;
}
.add-item input { font-size: 0.9rem; padding: 8px 12px; }
.add-item button { padding: 8px 12px; font-size: 0.85rem; }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text2);
}
.empty-state .emoji { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.95rem; }

footer {
  text-align: center;
  padding: 32px 0 16px;
  color: var(--text2);
  font-size: 0.8rem;
}

/* Edit input inline */
.edit-input {
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--text);
  padding: 4px 8px;
  font-size: inherit;
  font-family: inherit;
  outline: none;
  width: 100%;
}

@media (max-width: 480px) {
  .app { padding: 16px 12px; }
  h1 { font-size: 1.3rem; }
  .add-category form { flex-direction: column; }
  .add-category button { width: 100%; }
}
