:root {
  --bg: #0f1115;
  --card: #171a21;
  --card-2: #1e222b;
  --text: #eef0f3;
  --muted: #9aa3af;
  --accent: #4ade80;
  --accent-2: #22c55e;
  --warn: #f59e0b;
  --danger: #f87171;
  --border: #262b35;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

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

header h1 {
  font-size: 22px;
  margin: 0;
  letter-spacing: -0.01em;
}

.date {
  color: var(--muted);
  font-size: 13px;
}

section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.budget-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.budget-row label {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.budget-edit {
  display: flex;
  gap: 8px;
}

input[type="number"], input[type="text"] {
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  width: 100%;
}

#maxCalories {
  width: 110px;
  text-align: right;
}

button {
  background: var(--accent-2);
  color: #06210f;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.06s ease, opacity 0.15s ease;
}

button:active {
  transform: scale(0.97);
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  font-weight: 500;
  padding: 6px 12px;
  font-size: 13px;
}

.ring-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ring-wrap {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 8px 0 12px;
}

.ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--card-2);
  stroke-width: 14;
}

.ring-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 552.9;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.4s ease, stroke 0.4s ease;
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.remaining {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.remaining-label {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.stats-row {
  display: flex;
  width: 100%;
  justify-content: space-between;
  margin-top: 8px;
}

.stat {
  flex: 1;
  text-align: center;
}

.stat-value {
  font-size: 18px;
  font-weight: 600;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.add-row {
  display: flex;
  gap: 8px;
}

.add-row #calorieInput {
  width: 100px;
  flex: 0 0 100px;
}

.add-row #labelInput {
  flex: 1;
}

.quick-add {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.quick-add button {
  background: var(--card-2);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 500;
  padding: 6px 12px;
  font-size: 13px;
}

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

.log-header h2 {
  font-size: 15px;
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
}

.log-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.log-item:last-child {
  border-bottom: none;
}

.log-item-info {
  display: flex;
  flex-direction: column;
}

.log-item-label {
  font-size: 14px;
}

.log-item-time {
  font-size: 12px;
  color: var(--muted);
}

.log-item-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.log-item-cals {
  font-weight: 600;
  font-size: 15px;
}

.delete-btn {
  background: transparent;
  color: var(--muted);
  border: none;
  font-size: 18px;
  padding: 0 4px;
  line-height: 1;
}

.empty-state {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 16px 0 4px;
  display: none;
}

.over-budget .ring-progress {
  stroke: var(--danger);
}
