:root {
  --bg: #0e1512; --panel: #16201b; --panel2: #1c2823; --line: #2a3a32;
  --text: #e7efe9; --muted: #93a89b; --accent: #4ade80; --accent2: #38bdf8;
  --warn: #fbbf24; --bad: #f87171; --radius: 12px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent2); text-decoration: none; }

.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 700; font-size: 17px; }
.topbar nav { display: flex; gap: 2px; flex-wrap: wrap; }
.topbar nav a {
  color: var(--muted); padding: 6px 11px; border-radius: 8px; font-weight: 500;
}
.topbar nav a.active, .topbar nav a:hover { color: var(--text); background: var(--panel2); }
.topbar nav a.logout { margin-left: 6px; }

main { max-width: 1180px; margin: 0 auto; padding: 18px; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 12px 40px; }

h1 { font-size: 22px; margin: 6px 0 14px; }
h2 { font-size: 17px; margin: 26px 0 10px; }
h3 { font-size: 15px; margin: 14px 0 8px; }
.sub { color: var(--muted); font-size: 13px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px;
}
.tile .label { color: var(--muted); font-size: 12.5px; }
.tile .value { font-size: 22px; font-weight: 700; margin-top: 2px; }
.tile .value small { font-size: 13px; font-weight: 500; color: var(--muted); }
.tile .delta { font-size: 12px; margin-top: 2px; }
.up { color: var(--bad); } .down { color: var(--accent); } .neutral { color: var(--muted); }
.good { color: var(--accent); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin: 0 0 14px;
}
.card h2, .card h3 { margin-top: 0; }
.chartbox { position: relative; height: 260px; }
.chartbox.small { height: 200px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; }

.badge {
  display: inline-block; background: var(--panel2); border: 1px solid var(--line);
  padding: 2px 9px; border-radius: 999px; font-size: 12px; color: var(--muted);
}
.badge.green { color: var(--accent); border-color: var(--accent); }
.badge.amber { color: var(--warn); border-color: var(--warn); }

.phasebox { border-left: 3px solid var(--accent); }
.phasebox ul { margin: 8px 0 0; padding-left: 20px; }

ul.clean { padding-left: 20px; margin: 8px 0; }
ul.clean li { margin: 4px 0; }

button, .btn {
  background: var(--accent); color: #06280f; border: 0; border-radius: 8px;
  padding: 8px 14px; font-weight: 700; font-size: 14px; cursor: pointer;
}
button.ghost, .btn.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
button.tiny { padding: 3px 9px; font-size: 12px; }
button.danger { background: transparent; color: var(--bad); border: 1px solid var(--line); }

input, select, textarea {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 14px; width: 100%;
}
input:focus, select:focus { outline: 1px solid var(--accent); }
.formrow { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.formrow > * { flex: 1 1 120px; }
.formrow > .narrow { flex: 0 1 90px; }

.searchresults { max-height: 320px; overflow-y: auto; margin-top: 8px; }
.sr-item {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.sr-item:hover { background: var(--panel2); }
.sr-item .meta { color: var(--muted); font-size: 12.5px; }

.recipe { border-left: 3px solid var(--accent2); }
.recipe .yield { color: var(--muted); font-size: 13px; }
.recipe .macros { color: var(--accent); font-size: 13px; font-weight: 600; }

.notes { font-size: 13px; color: var(--muted); }
.notes li { margin: 3px 0; }

.login-wrap { display: grid; place-items: center; min-height: 70vh; }
.login-card { width: min(360px, 92vw); }
.error { color: var(--bad); font-size: 14px; margin: 8px 0; }

.daynav { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.progress { background: var(--panel2); border-radius: 999px; height: 10px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); }
