:root {
  --bg1: #eef2ff;
  --bg2: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #6366f1;
  --danger: #ef4444;
}

body.dark {
  --bg1: #020617;
  --bg2: #020617;
  --card: #0f172a;
  --text: #f8fafc;
  --muted: #94a3b8;
}

* {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background 0.2s ease, color 0.2s ease;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg1), var(--bg2));
  color: var(--text);
}

.app {
  max-width: 900px;
  margin: auto;
  padding: 24px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.top-controls {
  display: flex;
  gap: 10px;
}

h1 {
  font-weight: 700;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 16px;
  margin: 24px 0;
}

.card {
  background: var(--card);
  padding: 22px;
  border-radius: 18px;
  box-shadow: 0 15px 35px rgba(0,0,0,.08);
}

.card p {
  color: var(--muted);
  margin: 0;
}

.card h2 {
  margin: 8px 0 0;
}

.limit {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

#limitWarning {
  color: var(--danger);
  font-weight: 600;
}

.form {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

input, select, button {
  padding: 12px 14px;
  border-radius: 14px;
  border: none;
  outline: none;
}

button {
  background: var(--accent);
  color: white;
  cursor: pointer;
}

#list .item {
  background: var(--card);
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: fadeUp 0.25s ease;
}

#list .item span {
  color: var(--muted);
}

.empty {
  text-align: center;
  color: var(--muted);
  margin-top: 20px;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.charts {
  margin-top: 25px;
  background: var(--card);
  padding: 20px;
  border-radius: 20px;
}

#undoToast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  padding: 14px 22px;
  border-radius: 16px;
  box-shadow: 0 15px 40px rgba(0,0,0,.2);
  display: none;
  gap: 12px;
}
