/* Calories tile */
.tile-calories .tile-header { cursor: pointer; user-select: none; transition: background 0.15s; }
.tile-calories .tile-header:hover { background: var(--surface2); }
.tile-calories .tile-header h2 { color: var(--orange); }

.calories-detail { display: none; }
.calories-detail.open { display: block; }

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.cal-header .cal-title {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cal-header .cal-nums {
  font-size: 0.75rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.cal-header .cal-nums .cal-remaining { font-weight: 600; }
.cal-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.6rem;
}
.cal-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}
.cal-add-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}
.cal-add-row input {
  width: 80px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
}
.cal-add-row input:focus { outline: none; border-color: var(--orange); }
.cal-add-row input.cal-desc { width: 110px; }
.cal-add-row button:not(.date-nav-btn) {
  background: var(--orange-bg);
  border: 1px solid var(--orange);
  color: var(--orange);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
}
.cal-add-row button.cal-burn-btn {
  background: var(--green-bg);
  border: 1px solid var(--green);
  color: var(--green);
}
.cal-log {
  margin-top: 0.5rem;
  max-height: 120px;
  overflow-y: auto;
}
.cal-log-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  padding: 0.2rem 0;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.cal-log-item:last-child { border-bottom: none; }
.cal-log-item .cal-del {
  background: none; border: none; color: var(--red); cursor: pointer;
  font-size: 0.65rem; padding: 0 0.3rem; opacity: 0.5;
}
.cal-log-item .cal-del:hover { opacity: 1; }
.cal-goal-btn {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 0.6rem; padding: 0; text-decoration: underline;
}
.cal-goal-btn:hover { color: var(--orange); }

/* TDEE Calculator */
.cal-calc-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.cal-calc-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.cal-calc-field.full-width { grid-column: 1 / -1; }
.cal-calc-field label {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-weight: 600;
}
.cal-calc-field input,
.cal-calc-field select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.3rem 0.5rem;
  font-size: 0.75rem;
}
.cal-calc-field input:focus,
.cal-calc-field select:focus {
  outline: none;
  border-color: var(--orange);
}
.cal-calc-gender {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.cal-calc-gender-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.cal-calc-gender-btn.active {
  background: var(--orange-bg);
  color: var(--orange);
}
.cal-calc-activity {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.cal-calc-activity-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.65rem;
  font-weight: 600;
  transition: all 0.2s;
}
.cal-calc-activity-btn:hover { border-color: var(--orange); color: var(--orange); }
.cal-calc-activity-btn.active {
  background: var(--orange-bg);
  border-color: var(--orange);
  color: var(--orange);
}
.cal-calc-result {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  margin-top: 0.3rem;
}
.cal-calc-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.75rem;
}
.cal-calc-result-row + .cal-calc-result-row { margin-top: 0.35rem; }
.cal-calc-result-label {
  color: var(--text);
  font-weight: 600;
}
.cal-calc-result-val {
  color: var(--orange);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.cal-calc-apply {
  background: var(--orange-bg);
  border: 1px solid var(--orange);
  color: var(--orange);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.65rem;
  font-weight: 600;
  white-space: nowrap;
}
.cal-calc-apply:hover { background: var(--orange); color: var(--bg); }
.cal-calc-hint {
  font-size: 0.6rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
}

/* Food search */
.cal-food-search {
  margin-bottom: 0.5rem;
}
.cal-food-search input {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.5rem 0.4rem 1.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
}
.cal-food-search input:focus { outline: none; border-color: var(--orange); }
.cal-food-search::before {
  content: '\1F50D';
  position: absolute;
  left: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  pointer-events: none;
  z-index: 1;
}
.cal-food-results {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 240px;
  overflow-y: auto;
  margin-top: 0.25rem;
}
.cal-food-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.5rem;
  font-size: 0.7rem;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.cal-food-item:last-child { border-bottom: none; }
.cal-food-item:hover { background: var(--surface2); }
.cal-food-item .food-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 0.5rem; }
.cal-food-item .food-kcal { white-space: nowrap; color: var(--orange); font-weight: 600; font-size: 0.65rem; }
.cal-food-selected {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.5rem;
  font-size: 0.7rem;
}
.cal-food-selected .food-sel-name { flex: 1; color: var(--text); font-weight: 600; }
.cal-food-selected .food-sel-kcal { color: var(--orange); font-size: 0.65rem; }
.cal-food-selected .food-sel-close {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 0.8rem; padding: 0; line-height: 1;
}
.cal-food-selected .food-sel-close:hover { color: var(--red); }
.cal-food-calc {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  font-size: 0.7rem;
}
.cal-food-calc input {
  width: 70px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
}
.cal-food-calc input:focus { outline: none; border-color: var(--orange); }
.cal-food-calc .food-calc-result { color: var(--orange); font-weight: 600; }
.cal-food-calc button {
  background: var(--orange-bg);
  border: 1px solid var(--orange);
  color: var(--orange);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
}
.cal-food-serving { font-size: 0.6rem; color: var(--text-dim); }
.cal-food-quickfilters {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.35rem;
}
.cal-food-qf {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.6rem;
  white-space: nowrap;
}
.cal-food-qf:hover { border-color: var(--orange); color: var(--orange); }
.cal-food-qf.active { background: var(--orange-bg); border-color: var(--orange); color: var(--orange); font-weight: 600; }
.cal-food-attribution {
  font-size: 0.55rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
  text-align: right;
}
.cal-food-attribution a { color: var(--text-dim); text-decoration: underline; }
.cal-food-attribution a:hover { color: var(--orange); }
.cal-food-status {
  padding: 0.35rem 0.5rem;
  font-size: 0.65rem;
  color: var(--text-dim);
  text-align: center;
}

/* Tab bar (football-tab pattern, orange accent) */
.cal-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.cal-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  transition: all 0.2s;
}
.cal-tab:hover { color: var(--text); }
.cal-tab.active {
  color: var(--orange);
  border-bottom-color: var(--orange);
}

/* Period navigation (week + month) */
.cal-period-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.cal-period-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  min-width: 140px;
  text-align: center;
}

/* Week bar chart */
.cal-week-chart {
  position: relative;
  height: 90px;
  margin-bottom: 0.5rem;
}
.cal-week-goal-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1.5px dashed var(--text-dim);
  opacity: 0.5;
  pointer-events: none;
  z-index: 1;
}
.cal-week-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100%;
}
.cal-week-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  cursor: pointer;
}
.cal-week-col:hover { opacity: 0.8; }
.cal-week-bar-wrap {
  flex: 1;
  display: flex;
  align-items: flex-end;
  width: 100%;
  justify-content: center;
}
.cal-week-bar {
  width: 70%;
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: height 0.3s;
}
.cal-week-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  margin-top: 2px;
  font-weight: 500;
}
.cal-week-label.today {
  color: var(--orange);
  font-weight: 700;
}

/* Period summary (week + month) */
.cal-period-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.cal-period-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 60px;
}
.cal-period-stat-label {
  font-size: 0.55rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.cal-period-stat-val {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Month calendar heatmap */
.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 0.5rem;
}
.cal-month-dow {
  font-size: 0.5rem;
  color: var(--text-dim);
  text-align: center;
  font-weight: 600;
  padding-bottom: 1px;
}
.cal-month-cell {
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.2rem 0;
  cursor: pointer;
  background: var(--surface2);
  border: 1px solid transparent;
  transition: opacity 0.15s;
}
.cal-month-cell:hover { opacity: 0.8; }
.cal-month-cell.ok { background: var(--green-bg); border-color: var(--green); }
.cal-month-cell.warn { background: var(--orange-bg); border-color: var(--orange); }
.cal-month-cell.over { background: var(--red-bg); border-color: var(--red); }
.cal-month-cell.today { outline: 1.5px solid var(--orange); outline-offset: -1px; }
.cal-month-empty {
  padding: 1.2rem 0;
  background: transparent;
  pointer-events: none;
}
.cal-month-cell-day {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}
.cal-month-cell-kcal {
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1;
  margin-top: 1px;
}
