:root {
  --bg: #0c0f0d;
  --fg: #f2f4f0;
  --surface: #151a17;
  --surface-2: #1e2621;
  --border: #2f3a33;
  --muted: #9aa39a;
  --accent: #ff5a3c;
  --accent-fg: #120800;
  --sans: "Outfit", system-ui, sans-serif;
  --display: "Space Grotesk", system-ui, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
html[data-theme="light"] {
  --bg: #f3f4f2;
  --fg: #12151a;
  --surface: #ffffff;
  --surface-2: #e9ebe7;
  --border: #d5d8d2;
  --muted: #5f675f;
  --accent: #ff4d2e;
  --accent-fg: #ffffff;
}
html[data-theme="dark"] {
  --bg: #0c0f0d;
  --fg: #f2f4f0;
  --surface: #151a17;
  --surface-2: #1e2621;
  --border: #2f3a33;
  --muted: #9aa39a;
  --accent: #ff5a3c;
  --accent-fg: #120800;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--sans);
  background:
    radial-gradient(ellipse 80% 40% at 10% -10%, rgba(255,90,60,.18), transparent 55%),
    var(--bg);
  color: var(--fg);
  min-height: 100dvh;
}
a { color: inherit; text-decoration: none; }
h1,h2,h3 { font-family: var(--display); margin: 0 0 .5rem; letter-spacing: -.02em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.05rem; }
p { margin: .35rem 0; }
.muted { color: var(--muted); font-size: .9rem; }
.accent, .accent-text { color: var(--accent); }
.eyebrow { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

.shell {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  gap: 1.5rem;
  min-height: 100dvh;
  padding: 1.5rem 1rem 6rem;
}
.sidebar {
  display: none;
  position: sticky;
  top: 1.5rem;
  width: 14rem;
  flex-shrink: 0;
  height: calc(100dvh - 3rem);
  flex-direction: column;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 1rem;
  padding: .75rem;
}
.brand { padding: .5rem .5rem 1rem; }
.brand .logo, .mobile-brand .logo {
  font-family: var(--display); font-weight: 700; font-size: 1.5rem; letter-spacing: -.02em;
}
.brand .baseline, .mobile-brand .baseline { color: var(--muted); font-size: .75rem; }
.clock { font-size: .75rem; color: var(--muted); margin-top: .5rem; }
.clock strong { display: block; color: var(--fg); font-family: var(--display); font-size: 1rem; }
.clock.compact strong { font-size: .95rem; }
.side-nav { display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .75rem;
  border-radius: .75rem;
  color: var(--muted);
  font-size: .9rem;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--fg); }
a.nav-link.active,
.side-nav a.active {
  background: #ff5a3c !important;
  color: #120800 !important;
}
.nav-icon { flex-shrink: 0; width: 1rem; height: 1rem; }
.main { flex: 1; min-width: 0; padding-bottom: 1rem; }
.mobile-brand {
  display: flex; justify-content: space-between; align-items: end;
  margin-bottom: .75rem;
}
.mobile-tools { display: flex; align-items: center; gap: .5rem; }
.icon-btn {
  width: 2.25rem; height: 2.25rem; border-radius: .75rem;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--fg); display: grid; place-items: center; cursor: pointer;
}
.theme-toggle { margin-top: auto; padding-top: .5rem; }
.theme-btn { width: 100%; border: 0; background: transparent; cursor: pointer; font: inherit; }
.food-table-wrap { overflow-x: auto; }
.food-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.food-table th, .food-table td { text-align: left; padding: .55rem .35rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.food-table th { color: var(--muted); font-weight: 500; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  margin: .85rem 0;
}
.card.highlight { border-color: var(--accent); }
.card.center { text-align: center; }
.weight { font-size: 2.2rem; font-weight: 600; letter-spacing: -.03em; }
.bar, .progress-line {
  height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: .6rem;
}
.bar > i, .progress-line > i { display: block; height: 100%; background: var(--accent); }

.btn, button.quick, .quick-grid form button, .food-grid button, .habit {
  font: 500 .9rem var(--sans);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--fg);
  padding: .7rem .9rem;
}
.btn.primary, .quick-grid form button { background: var(--accent); color: var(--accent-fg); }
.btn.secondary { background: var(--surface-2); }
.btn.ghost, .linkish { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn.block { width: 100%; justify-content: center; }
.pill {
  display: inline-block; margin-top: .4rem; margin-right: .35rem;
  padding: .3rem .55rem; border-radius: 8px; font-size: .75rem;
  background: rgba(255,90,60,.15); color: var(--accent);
}
.pill.warn { background: rgba(255,180,0,.15); color: #ffb400; }

.quick-grid, .food-grid, .remain, .badges, .photo-grid {
  display: grid; gap: .6rem;
}
.quick-grid { grid-template-columns: repeat(4, 1fr); }
.food-grid { grid-template-columns: repeat(2, 1fr); }
.remain { grid-template-columns: 1fr 1fr; }
.remain .n { font-size: 1.25rem; font-weight: 600; }
.badges { grid-template-columns: repeat(2, 1fr); }
.badge { background: var(--surface-2); border-radius: 12px; padding: .75rem; opacity: .45; }
.badge.on { opacity: 1; border: 1px solid var(--accent); }
.photo-grid { grid-template-columns: repeat(3, 1fr); }
.photo-grid img { width: 100%; border-radius: 10px; aspect-ratio: 1; object-fit: cover; }

.actions-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.actions-row.wrap { flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.stack { display: grid; gap: .65rem; }
.stack label, form label { display: grid; gap: .3rem; font-size: .85rem; color: var(--muted); }
input, select, textarea {
  width: 100%; padding: .65rem .75rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--fg);
  font: inherit;
}
.habits { display: flex; flex-wrap: wrap; gap: .4rem; }
.habit.on { background: rgba(255,90,60,.2); color: var(--accent); }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.check-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .75rem;
  text-align: left;
  padding: .75rem .85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  font: 500 .92rem var(--sans);
  cursor: pointer;
}
.check-row:hover { background: var(--surface-2); }
.check-row.on { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.check-box {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: .4rem;
  border: 1.5px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1;
}
.check-row.on .check-box {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.meal-item {
  display: flex; justify-content: space-between; gap: .75rem; align-items: center;
  padding: .65rem 0; border-bottom: 1px solid var(--border);
}
.meal-item:last-child { border-bottom: 0; }
.ex-list { list-style: none; padding: 0; margin: .75rem 0 0; }
.ex-list li {
  display: flex; justify-content: space-between; gap: .5rem;
  padding: .45rem 0; border-bottom: 1px solid var(--border); font-size: .92rem;
}
.prog-day { font-size: 1.15rem; margin: 0 0 .15rem; }
.ex-rich-list { list-style: none; padding: 0; margin: .85rem 0 0; }
.ex-rich-list li {
  display: flex; gap: .75rem; align-items: flex-start;
  padding: .65rem 0; border-bottom: 1px solid var(--border);
}
.ex-rich-list li:last-child { border-bottom: 0; }
.ex-rich-body { min-width: 0; flex: 1; }
.ex-cue { margin-top: .25rem; font-size: .78rem; color: var(--muted); }
.ex-visual {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: .75rem;
  overflow: hidden;
  color: var(--fg);
}
.ex-visual svg { display: block; width: 100%; height: 100%; padding: .2rem; box-sizing: border-box; }
.ex-visual.sm { width: 3.5rem; height: 3.5rem; }
.ex-visual.md { width: 5rem; height: 5rem; }
.ex-visual.lg { width: 10rem; height: 10rem; }
.badminton-note {
  margin-top: .85rem;
  background: var(--surface-2);
  border-radius: .75rem;
  padding: .65rem .85rem;
  font-size: .9rem;
}
.meal-plan-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin-top: .75rem;
}
@media (min-width: 640px) {
  .meal-plan-grid { grid-template-columns: 1fr 1fr; }
}
.muted-list { list-style: none; padding: 0; margin: .35rem 0 0; color: var(--muted); font-size: .9rem; }
.muted-list li { padding: .15rem 0; }
.flash { padding: .75rem 1rem; border-radius: 12px; margin-bottom: .75rem; }
.flash-success { background: #14301f; color: #9dffc2; }
.flash-error { background: #3b1510; color: #ffb4a8; }
html[data-theme="light"] .flash-success { background: #d9f5e4; color: #0d5c32; }
html[data-theme="light"] .flash-error { background: #ffe0da; color: #8a2414; }

.bottom-nav {
  display: grid;
  position: fixed; left: 0; right: 0; bottom: 0;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  backdrop-filter: blur(8px);
  grid-template-columns: repeat(5, 1fr);
  padding: .35rem .25rem calc(.35rem + var(--safe-bottom));
  text-align: center; font-size: .62rem; color: var(--muted); z-index: 20;
  max-width: 32rem; margin: 0 auto;
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  padding: .35rem .15rem; color: var(--muted);
}
.bottom-nav a .nav-icon { width: 1.25rem; height: 1.25rem; }
.bottom-nav .on { color: var(--accent); }

.ring {
  --p: 0;
  width: 120px; height: 120px; margin: .5rem auto;
  border-radius: 50%;
  background:
    conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0);
  display: grid; place-items: center;
  position: relative;
}
.ring::before {
  content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--surface);
}
.ring strong, .ring span { position: relative; z-index: 1; }
.ring strong { font-size: 1.3rem; font-family: var(--display); }

.seance-top {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .9rem; color: var(--muted); margin-bottom: .5rem;
}
.seance-center { text-align: center; padding: 1.5rem 0; }
.thumb {
  width: 110px; height: 110px; margin: .75rem auto; border-radius: 20px;
  background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 2.5rem; font-family: var(--display);
}
.stepper { display: flex; align-items: center; justify-content: center; gap: .75rem; }
.stepper button {
  width: 56px; height: 56px; border-radius: 12px; font-size: 1.4rem;
  background: var(--surface-2); border: 0; color: var(--fg);
}
.stepper input { width: 6rem; text-align: center; font-size: 1.8rem; font-weight: 700; font-family: var(--display); }
.rest-banner {
  background: var(--accent); color: var(--accent-fg);
  text-align: center; padding: .85rem; font-size: 1.4rem; font-weight: 700;
  font-family: var(--display); display: flex; gap: 1rem; justify-content: center; align-items: center;
  margin: .5rem -1.25rem 0;
}
.rest-banner.hidden { display: none; }
.rest-banner button { background: transparent; border: 1px solid var(--accent-fg); border-radius: 8px; padding: .3rem .6rem; }

dialog {
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--fg);
  padding: 1rem; width: min(92vw, 360px);
}
dialog::backdrop { background: rgba(0,0,0,.55); }

@media (min-width: 768px) {
  .sidebar { display: flex; }
  .bottom-nav { display: none; }
  .mobile-brand { display: none; }
  .shell { padding-bottom: 2rem; }
}
@media (max-width: 767px) {
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .shell { padding-top: 1rem; }
}
