:root {
  color-scheme: dark;
  --bs-primary: #2563ff;
  --bs-primary-rgb: 37, 99, 255;
  --bs-info: #39e6ff;
  --bs-info-rgb: 57, 230, 255;
  --bs-body-bg: #020817;
  --bs-body-color: #eef7ff;
  --bs-border-color: #1d3d68;
  --bs-border-radius: 8px;
  --bs-border-radius-sm: 6px;
  --bs-border-radius-lg: 8px;
  --bg: #020817;
  --surface: #071328;
  --surface-2: #0d1f3d;
  --ink: #eef7ff;
  --muted: #91a9c8;
  --line: #1d3d68;
  --green: #22d3ee;
  --blue: #2563ff;
  --coral: #39e6ff;
  --yellow: #8fdcff;
  --shadow: 0 18px 48px rgba(0, 10, 32, 0.48);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 70% 8%, rgba(37, 99, 255, 0.22), transparent 34%),
    radial-gradient(circle at 18% 18%, rgba(34, 211, 238, 0.12), transparent 30%),
    var(--bg);
  color: var(--ink);
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.btn {
  --bs-btn-border-radius: 8px;
  --bs-btn-font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  --bs-btn-bg: #2563ff;
  --bs-btn-border-color: #2563ff;
  --bs-btn-hover-bg: #39bff4;
  --bs-btn-hover-border-color: #39bff4;
  --bs-btn-hover-color: #021022;
}

.card {
  --bs-card-bg: var(--surface);
  --bs-card-border-color: rgba(57, 230, 255, 0.16);
  --bs-card-border-radius: 8px;
}

.form-control,
.form-select {
  border-color: var(--line);
  background-color: #061226;
  color: var(--ink);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 0.2rem rgba(34, 211, 238, 0.18);
  background-color: #061226;
  color: var(--ink);
}

.bi {
  display: inline-block;
  line-height: 1;
  flex: 0 0 auto;
}

.nav-button .bi,
.icon-text-button .bi,
.primary-button .bi,
.icon-button .bi {
  width: 18px;
  font-size: 18px;
  text-align: center;
}

body.auth-mode {
  overflow-y: auto;
}

body.auth-mode .app-shell {
  display: none;
}

.auth-screen {
  display: none;
}

body.auth-mode .auth-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(24px, 5vw, 72px);
}

body.auth-mode::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(2, 8, 23, 0.22), rgba(2, 8, 23, 0.08) 48%, rgba(2, 8, 23, 0.38)),
    url("./icons/login-background.png") center / cover no-repeat;
  filter: saturate(1.06) contrast(1.02) brightness(1.04);
  z-index: 0;
}

.auth-card {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 430px);
  align-items: center;
  gap: clamp(30px, 7vw, 100px);
}

.auth-brand-panel {
  min-height: 500px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 32px;
  text-shadow: 0 3px 22px rgba(0, 4, 16, 0.7);
}

.auth-form-panel {
  display: grid;
  align-content: center;
  gap: 20px;
  padding: clamp(24px, 4vw, 36px);
  border: 1px solid rgba(126, 196, 230, 0.18);
  border-radius: 8px;
  background: rgba(3, 12, 28, 0.76);
  box-shadow: 0 24px 70px rgba(0, 6, 24, 0.42);
  backdrop-filter: blur(18px);
}

.auth-logo {
  width: 176px;
  border-radius: 8px;
  box-shadow: 0 0 28px rgba(37, 115, 255, 0.34);
}

.auth-copy {
  display: grid;
  gap: 6px;
}

.auth-copy h1 {
  margin: 0;
  max-width: 580px;
  font-size: clamp(2.4rem, 5vw, 4.5rem);
  line-height: 1.05;
}

.auth-copy span {
  max-width: 520px;
  color: #b9d0ec;
  font-size: 1.03rem;
  line-height: 1.45;
}

.auth-benefits {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
}

.auth-benefits div,
.auth-local-note {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-benefits div {
  min-height: 32px;
  padding: 0;
  color: #c5ddf7;
  background: transparent;
}

.auth-benefits svg,
.auth-local-note svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--green);
}

.auth-form-heading {
  display: grid;
  gap: 5px;
}

.auth-form-heading strong {
  font-size: 1.6rem;
}

.auth-form-heading span,
.auth-local-note {
  color: var(--muted);
  line-height: 1.4;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: rgba(13, 31, 61, 0.86);
}

.auth-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.auth-tabs button.active {
  color: var(--ink);
  background: linear-gradient(135deg, #12396d, #0b55a5);
  box-shadow: 0 4px 16px rgba(37, 99, 255, 0.2);
}

.auth-tabs.nav-pills .nav-link {
  width: 100%;
}

.auth-form {
  display: none;
  gap: 14px;
}

.auth-form.active {
  display: grid;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  width: 100%;
  padding-right: 48px;
}

.password-field button {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.password-field button:hover,
.password-field button:focus-visible {
  color: var(--ink);
  background: var(--surface-2);
}

.password-field svg {
  width: 18px;
  height: 18px;
}

.auth-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
}

.auth-local-note {
  font-size: 0.78rem;
}

.auth-form-panel label {
  gap: 7px;
}

.auth-form-panel input {
  min-height: 48px;
  border-color: rgba(57, 230, 255, 0.18);
  background: rgba(2, 8, 23, 0.7);
}

.auth-form-panel input:focus {
  border-color: rgba(57, 230, 255, 0.68);
  box-shadow: 0 0 0 3px rgba(57, 230, 255, 0.1);
  outline: none;
}

.auth-form-panel .remember-login {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
  width: fit-content;
  color: var(--muted);
  font-size: 0.86rem;
  cursor: pointer;
}

.auth-form-panel .remember-login input {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  accent-color: var(--blue);
  cursor: pointer;
}

.auth-form-panel .remember-login:has(input:checked) {
  color: var(--ink);
}

.auth-status {
  min-height: 20px;
  margin: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

body.home-mode:not(.auth-mode) .app-shell {
  display: block;
}

body.home-mode:not(.auth-mode) .sidebar,
body.home-mode:not(.auth-mode) .topbar {
  display: none;
}

body.home-mode:not(.auth-mode) .content {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 46px);
  position: relative;
  z-index: 1;
}

body.home-mode:not(.auth-mode) .home-options {
  margin-bottom: 0;
}

body.home-mode:not(.auth-mode)::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(2, 8, 23, 0.34), rgba(2, 8, 23, 0.6)),
    radial-gradient(circle at 50% 18%, rgba(57, 230, 255, 0.2), transparent 38%),
    url("./icons/home-background.png") center / cover no-repeat;
  filter: saturate(1.25) contrast(1.12) brightness(1.18);
  z-index: 0;
}

body.home-mode:not(.auth-mode)::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 72% 16%, rgba(37, 99, 255, 0.16), transparent 28%),
    linear-gradient(90deg, rgba(2, 8, 23, 0.62), rgba(2, 8, 23, 0.12), rgba(2, 8, 23, 0.66));
  pointer-events: none;
  z-index: 0;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  background: #010715;
  color: #eef7ff;
  border-right: 1px solid rgba(34, 211, 238, 0.16);
}

.account-box {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(57, 230, 255, 0.14);
  border-radius: 8px;
  background: rgba(7, 19, 40, 0.82);
}

.account-box div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.account-box span {
  color: var(--muted);
  font-size: 0.78rem;
}

.account-box strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.brand-logo {
  width: min(100%, 210px);
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  object-fit: cover;
  background: #071024;
  box-shadow: 0 0 28px rgba(37, 115, 255, 0.34);
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong,
.brand-copy span {
  display: block;
}

.brand-copy span {
  margin-top: 2px;
  color: #82a8d7;
  font-size: 0.88rem;
}

.nav-tabs {
  display: grid;
  gap: 8px;
  border-bottom: 0;
  flex-wrap: nowrap;
}

.more-menu {
  position: absolute;
  z-index: 40;
  left: 18px;
  right: 18px;
  bottom: 92px;
  padding: 10px;
  display: grid;
  gap: 5px;
  border: 1px solid rgba(57, 230, 255, 0.2);
  border-radius: 8px;
  background: #071328;
  box-shadow: 0 18px 42px rgba(0, 5, 18, 0.62);
}

.more-menu-heading {
  padding: 5px 8px 10px;
  display: grid;
  gap: 2px;
  border-bottom: 1px solid var(--line);
}

.more-menu-heading span {
  color: var(--muted);
  font-size: 0.76rem;
}

.more-menu-item {
  min-height: 44px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.more-menu-item:hover {
  background: #0b2145;
}

.more-menu-item .bi:last-child {
  color: var(--muted);
  font-size: 0.85rem;
}

.more-menu-logout {
  color: #f0a6b2;
  border-top: 1px solid var(--line);
}

.nav-button,
.icon-text-button,
.primary-button,
.secondary-button,
.icon-button,
.segmented button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: transparent;
  color: #9db7dc;
  text-align: left;
}

.nav-button.active,
.nav-button:hover {
  background: #0b2145;
  color: #ffffff;
  box-shadow: inset 3px 0 0 var(--green);
}

.nav-button.btn-link {
  text-decoration: none;
}

.nav-button svg,
.icon-text-button svg,
.primary-button svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.sidebar-actions {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.icon-text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 14px;
  color: #021022;
  background: linear-gradient(135deg, #39e6ff, #2563ff);
}

.icon-text-button.quiet {
  color: #d7ecff;
  background: #0b2145;
}

.content {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 26px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.76rem;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 1;
  letter-spacing: 0;
  max-width: 780px;
}

h2 {
  margin-bottom: 0;
  font-size: 1.55rem;
}

h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.date-control {
  display: grid;
  gap: 6px;
  min-width: 170px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #061226;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
}

textarea {
  resize: vertical;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-heading,
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.section-heading {
  margin-bottom: 16px;
}

.section-heading span,
.panel-header span {
  color: var(--muted);
  font-size: 0.9rem;
}

.diet-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric-card,
.panel {
  background: var(--surface);
  border: 1px solid rgba(57, 230, 255, 0.16);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel.card {
  color: var(--ink);
}

.panel-header.card-header {
  padding: 0 0 14px;
  border-bottom-color: rgba(57, 230, 255, 0.12);
}

.metric-card {
  min-height: 158px;
  padding: 18px;
  display: grid;
  align-content: space-between;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  margin: 6px 0;
  font-size: 2rem;
  line-height: 1;
}

.accent-green { border-top: 5px solid var(--green); }
.accent-blue { border-top: 5px solid var(--blue); }
.accent-water { border-top: 5px solid var(--blue); }
.accent-coral { border-top: 5px solid var(--coral); }
.accent-ink { border-top: 5px solid #8fdcff; }

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.progress-track div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
  transition: width 180ms ease;
}

.accent-green .progress-track div { color: var(--green); }
.accent-blue .progress-track div { color: var(--blue); }
.accent-water .progress-track div { color: var(--blue); }

.home-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 170px;
  padding: 22px;
  margin-bottom: 16px;
  background: radial-gradient(circle at 18% 18%, rgba(57, 230, 255, 0.16), transparent 34%), linear-gradient(145deg, rgba(9, 24, 48, 0.98), rgba(2, 8, 23, 0.98));
  border: 1px solid rgba(57, 230, 255, 0.22);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

body.home-mode .home-hero {
  min-height: clamp(220px, 34vh, 360px);
  margin-bottom: 18px;
  background: rgba(3, 12, 28, 0.56);
  backdrop-filter: blur(6px);
}

.home-hero img {
  width: clamp(120px, 18vw, 220px);
  height: auto;
  filter: drop-shadow(0 0 18px rgba(57, 230, 255, 0.24));
}

.home-hero div {
  display: grid;
  gap: 8px;
}

.home-hero strong {
  font-size: clamp(1.4rem, 3vw, 2.4rem);
  line-height: 1.05;
}

.home-hero span {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
  max-width: 680px;
}

.home-options {
  margin-bottom: 14px;
}

.home-options-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.home-options-header h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.home-options-header span {
  color: var(--muted);
  font-size: 0.9rem;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.option-card {
  display: grid;
  gap: 8px;
  min-height: 156px;
  padding: 16px;
  text-align: left;
  color: var(--ink);
  background: linear-gradient(145deg, rgba(9, 24, 48, 0.86), rgba(3, 11, 27, 0.82));
  border: 1px solid rgba(57, 230, 255, 0.24);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.option-card:hover,
.option-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(57, 230, 255, 0.48);
  box-shadow: 0 16px 36px rgba(0, 194, 255, 0.16);
  outline: none;
}

.option-card svg {
  width: 24px;
  height: 24px;
  color: var(--blue);
  filter: drop-shadow(0 0 8px rgba(57, 230, 255, 0.38));
}

.option-card strong {
  font-size: 1rem;
}

.option-card span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.home-welcome {
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.home-welcome h2 {
  margin: 2px 0 5px;
  font-size: clamp(1.7rem, 4vw, 2.7rem);
}

.home-welcome h2 span {
  color: #9eeeff;
}

.home-welcome p {
  margin: 0;
  color: var(--muted);
}

.home-focus {
  min-height: 250px;
  margin-bottom: 14px;
  padding: clamp(20px, 4vw, 34px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  border: 1px solid rgba(57, 230, 255, 0.26);
  border-radius: 8px;
  background: rgba(3, 13, 31, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.home-focus-copy {
  display: grid;
  gap: 11px;
}

.home-focus-kicker {
  width: fit-content;
  padding: 6px 9px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(57, 230, 255, 0.28);
  border-radius: 6px;
  color: #baf5ff;
  background: rgba(7, 37, 65, 0.8);
  font-size: 0.78rem;
  font-weight: 700;
}

.home-focus h3 {
  max-width: 650px;
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
}

.home-focus p {
  max-width: 660px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.home-focus-actions {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.home-score {
  --score: 0deg;
  width: 158px;
  aspect-ratio: 1;
  padding: 12px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(#39e6ff var(--score), rgba(46, 86, 130, 0.42) 0);
  box-shadow: 0 0 34px rgba(57, 230, 255, 0.2);
}

.home-score > div {
  width: 100%;
  height: 100%;
  display: grid;
  place-content: center;
  text-align: center;
  border-radius: 50%;
  background: #061226;
}

.home-score strong {
  font-size: 2rem;
}

.home-score span {
  color: var(--muted);
  font-size: 0.8rem;
}

.home-progress-grid {
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.home-progress-card {
  min-width: 0;
  padding: 15px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px 11px;
  border: 1px solid rgba(57, 230, 255, 0.16);
  border-radius: 8px;
  background: rgba(7, 19, 40, 0.88);
  color: var(--ink);
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease;
}

.home-progress-card:hover {
  transform: translateY(-2px);
  border-color: rgba(57, 230, 255, 0.44);
}

.home-progress-card > .bi {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #071328;
  background: #39e6ff;
  font-size: 1.1rem;
}

.progress-protein > .bi { background: #8cb7ff; }
.progress-water > .bi { background: #77e0c0; }

.home-progress-card div:nth-of-type(1) {
  display: grid;
  gap: 2px;
}

.home-progress-card span,
.home-progress-card small {
  color: var(--muted);
}

.home-progress-card .progress-track {
  grid-column: 1 / -1;
  margin: 2px 0 0;
}

.home-progress-card small {
  grid-column: 1 / -1;
  font-size: 0.76rem;
}

.home-main-grid {
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 14px;
}

.home-today-panel,
.home-weight-panel,
.home-shortcuts {
  padding: 18px;
  border: 1px solid rgba(57, 230, 255, 0.16);
  border-radius: 8px;
  background: rgba(7, 19, 40, 0.9);
  box-shadow: var(--shadow);
}

.home-section-title {
  margin-bottom: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.home-section-title span {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.home-section-title h3 {
  margin: 2px 0 0;
  font-size: 1.05rem;
}

.home-section-title > .bi {
  color: #39e6ff;
  font-size: 1.3rem;
}

.home-today-list {
  display: grid;
  gap: 7px;
}

.home-today-list button {
  min-height: 64px;
  padding: 10px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #091a34;
  color: var(--ink);
  text-align: left;
}

.home-today-list button:hover {
  border-color: rgba(57, 230, 255, 0.35);
}

.home-today-list button > .bi:first-child {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #102c50;
  color: #8eefff;
}

.home-today-list button > .bi:last-child {
  color: var(--muted);
}

.home-today-list button div {
  display: grid;
  gap: 2px;
}

.home-today-list button span {
  color: var(--muted);
  font-size: 0.78rem;
}

.home-weight-panel {
  display: grid;
  align-content: start;
}

.home-weight-numbers {
  padding: 14px 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  border-block: 1px solid var(--line);
}

.home-weight-numbers div {
  display: grid;
  gap: 3px;
}

.home-weight-numbers div:last-child {
  text-align: right;
}

.home-weight-numbers span,
.home-weight-panel p {
  color: var(--muted);
}

.home-weight-numbers strong {
  font-size: 1.35rem;
}

.home-weight-panel p {
  min-height: 44px;
  margin: 14px 0;
  line-height: 1.4;
}

.home-shortcuts {
  margin-bottom: 0;
}

.home-shortcut-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.home-shortcut-grid button {
  min-height: 76px;
  padding: 9px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #091a34;
  color: var(--ink);
}

.home-shortcut-grid button:hover {
  border-color: rgba(57, 230, 255, 0.48);
  background: #0d2445;
}

.home-shortcut-grid .bi {
  color: #63e8ff;
  font-size: 1.15rem;
}

.home-shortcut-grid span {
  font-size: 0.78rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 14px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 14px;
}

.split-layout.tools-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.weight-main-stack {
  display: grid;
  gap: 14px;
}

.bmi-panel {
  display: grid;
  gap: 14px;
}

.bmi-result {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid rgba(57, 230, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 17, 36, 0.72);
}

.bmi-result span,
.bmi-result small {
  color: var(--muted);
}

.bmi-result strong {
  font-size: 2.4rem;
  line-height: 1;
  color: var(--green);
}

.bmi-table-wrap {
  overflow-x: auto;
}

.bmi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.bmi-table th,
.bmi-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(57, 230, 255, 0.12);
  text-align: left;
}

.bmi-table th {
  color: var(--ink);
  background: rgba(13, 31, 61, 0.82);
}

.bmi-table td {
  color: var(--muted);
}

.week-picker {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  box-shadow: none;
}

.week-day-button {
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #071328;
  color: var(--ink);
}

.week-day-button strong {
  font-size: 0.82rem;
  line-height: 1;
}

.week-day-button span {
  color: var(--muted);
  font-size: 0.78rem;
}

.week-day-button.active {
  border-color: var(--green);
  background: #0b2f55;
  color: #ffffff;
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.14);
}

.side-stack {
  display: grid;
  gap: 14px;
  align-content: start;
}

.side-stack.hidden {
  display: none;
}

.panel {
  padding: 18px;
  min-width: 0;
}

.form-panel,
.goals-form {
  display: grid;
  gap: 14px;
  align-content: start;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid,
.goals-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.goals-form h3,
.goals-form .primary-button {
  grid-column: 1 / -1;
}

.primary-button {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  background: linear-gradient(135deg, #39e6ff, #2563ff);
  color: #ffffff;
  font-weight: 800;
}

.secondary-button {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  background: #0d2a52;
  color: #dff7ff;
  border: 1px solid rgba(57, 230, 255, 0.18);
  font-weight: 800;
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.compact-button {
  min-height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

.icon-button {
  width: 42px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--surface-2);
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  padding: 3px;
  border-radius: 8px;
  background: var(--surface-2);
}

.segmented button {
  min-height: 34px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segmented button.active {
  background: #12396d;
  color: var(--ink);
  box-shadow: 0 2px 10px rgba(34, 211, 238, 0.18);
}

.chart-wrap {
  margin-top: 14px;
  width: 100%;
  height: clamp(300px, 38vw, 420px);
  overflow: hidden;
  border: 1px solid rgba(57, 230, 255, 0.14);
  border-radius: 8px;
  background: #041022;
}

.chart-wrap.compact {
  height: clamp(250px, 28vw, 320px);
}

.chart-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.chart-summary strong {
  color: var(--ink);
  text-align: right;
}

.water-alert,
.goal-alert {
  display: none;
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: #0b2b4e;
  color: #b9f3ff;
  font-weight: 800;
}

.water-alert.active,
.goal-alert.near {
  display: block;
}

.goal-alert.near {
  background: #18355b;
  color: #8fdcff;
}

.goal-alert.done {
  display: block;
  background: #06304b;
  color: var(--green);
}

.water-alert.done {
  display: block;
  background: #06304b;
  color: var(--green);
}

.water-actions,
.calorie-actions,
.protein-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tracker-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.tracker-stack {
  display: grid;
  gap: 12px;
}

.tracker-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(57, 230, 255, 0.14);
  border-radius: 8px;
  background: rgba(5, 17, 36, 0.72);
}

.tracker-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tracker-card-header svg {
  width: 22px;
  height: 22px;
  color: var(--blue);
}

.tracker-card-header div {
  display: grid;
  gap: 2px;
}

.tracker-card-header strong {
  font-size: 1rem;
}

.tracker-card-header span {
  color: var(--muted);
  font-size: 0.85rem;
}

.tracker-card .calorie-actions,
.tracker-card .protein-actions,
.tracker-card .water-actions {
  margin-top: 0;
}

.tracker-card .inline-number-field {
  flex: 1 1 140px;
  max-width: none;
}

.tracker-card .secondary-button {
  background: #0d1f3d;
}

.routine-day-panel {
  align-self: start;
}

.routine-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.routine-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 10px;
  min-height: 74px;
  padding: 12px;
  border: 1px solid rgba(57, 230, 255, 0.14);
  border-radius: 8px;
  background: rgba(5, 17, 36, 0.72);
}

.routine-item.done {
  border-color: rgba(34, 211, 238, 0.32);
  background: rgba(6, 48, 75, 0.42);
}

.routine-check {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-2);
}

.routine-item.done .routine-check {
  color: var(--green);
}

.routine-check svg {
  width: 21px;
  height: 21px;
}

.routine-item-copy {
  min-width: 0;
}

.routine-item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.routine-item-title span {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 8px;
  color: #b9f3ff;
  background: #0b2b4e;
  font-size: 0.74rem;
  font-weight: 800;
}

.routine-item.done strong {
  color: var(--muted);
  text-decoration: line-through;
}

.routine-item-copy p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.inline-number-field {
  min-width: 128px;
  max-width: 160px;
  gap: 4px;
}

.inline-number-field input {
  min-height: 36px;
  padding: 7px 10px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.legend-dot.current {
  background: var(--green);
}

.legend-dot.target {
  background: #fbbf24;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.item-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.item-list.tight {
  max-height: 240px;
  overflow: auto;
}

.list-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #08172e;
}

.list-item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.list-item strong {
  overflow-wrap: anywhere;
}

.item-description {
  margin: 3px 0 5px;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.list-item small {
  color: var(--muted);
}

.delete-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: #301528;
  color: #ff88b2;
}

.delete-button svg {
  width: 16px;
  height: 16px;
}

.import-panel {
  display: grid;
  gap: 14px;
}

.import-panel .panel-header svg {
  width: 20px;
  height: 20px;
  color: var(--green);
}

.import-format {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.86rem;
}

.import-format strong {
  color: var(--ink);
}

.status-text {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-text.success {
  color: var(--green);
  font-weight: 700;
}

.status-text.error {
  color: #9d3f34;
  font-weight: 700;
}

.empty-state {
  margin-top: 14px;
  min-height: 130px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 16px;
}

.install-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(1, 7, 21, 0.78);
  backdrop-filter: blur(10px);
}

.install-modal.open {
  display: flex;
}

.install-dialog {
  position: relative;
  width: min(100%, 420px);
  padding: 22px;
  border: 1px solid rgba(57, 230, 255, 0.2);
  border-radius: 8px;
  background: #071328;
  color: var(--ink);
  box-shadow: 0 22px 60px rgba(0, 10, 32, 0.62);
}

.install-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: #0d2a52;
  color: #dff7ff;
}

.install-close svg {
  width: 18px;
  height: 18px;
}

.install-logo {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 0 28px rgba(37, 115, 255, 0.34);
}

.install-dialog h2 {
  margin: 14px 0 10px;
}

.install-dialog p {
  margin: 14px 0 0;
  color: var(--muted);
}

.install-steps {
  margin: 0;
  padding-left: 22px;
  color: #dff7ff;
}

.install-steps li + li {
  margin-top: 8px;
}

@media (max-width: 960px) {
  body.auth-mode .auth-screen {
    place-items: start center;
    padding: 20px;
  }

  .auth-card {
    width: min(560px, 100%);
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .auth-brand-panel {
    min-height: 0;
    gap: 14px;
  }

  .auth-logo {
    width: 112px;
  }

  .auth-copy h1 {
    font-size: clamp(1.8rem, 7vw, 2.6rem);
  }

  .auth-benefits {
    display: none;
  }
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  body.home-mode:not(.auth-mode) .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-button {
    justify-content: center;
  }

  .nav-button span {
    display: none;
  }

  .sidebar-actions {
    margin-top: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .option-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-main-grid {
    grid-template-columns: 1fr;
  }

  .home-shortcut-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

}

@media (max-width: 780px) {
  body.auth-mode .auth-screen {
    place-items: start center;
    padding: 14px;
  }

  .auth-card {
    grid-template-columns: 1fr;
  }

  .auth-brand-panel {
    min-height: 0;
    gap: 14px;
    align-items: center;
    text-align: center;
  }

  .auth-logo {
    width: 104px;
  }

  .auth-copy h1 {
    font-size: 1.65rem;
  }

  .auth-benefits {
    display: none;
  }

  .auth-form-panel {
    padding: 20px;
  }

  .content {
    padding: 18px 14px calc(98px + env(safe-area-inset-bottom));
  }

  .chart-wrap,
  .chart-wrap.compact {
    height: 280px;
  }

  .topbar,
  .section-heading,
  .panel-header,
  .chart-summary,
  .diet-actions,
  .list-item-row {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    gap: 14px;
    margin-bottom: 20px;
  }

  .topbar h1 {
    font-size: 1.75rem;
    line-height: 1.1;
  }

  .date-control {
    width: 100%;
    min-width: 0;
  }

  .chart-summary strong {
    text-align: left;
  }

  .dashboard-grid,
  .split-layout,
  .form-grid,
  .goals-form,
  .option-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .metric-card {
    min-height: 130px;
    padding: 14px;
  }

  .metric-card strong {
    font-size: 1.55rem;
  }

  .panel,
  .form-panel {
    padding: 14px;
  }

  .week-picker {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .week-picker::-webkit-scrollbar {
    display: none;
  }

  .week-day-button {
    flex: 0 0 92px;
    scroll-snap-align: start;
  }

  .primary-button,
  .secondary-button {
    min-height: 46px;
  }

  .form-panel > .primary-button,
  .goals-form > .primary-button {
    width: 100%;
  }

  .home-hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .home-hero img {
    width: min(180px, 70vw);
  }

  .home-focus {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .home-score {
    width: 132px;
    grid-row: 1;
    justify-self: end;
  }

  .home-focus-copy {
    grid-row: 2;
  }

  .home-progress-grid {
    grid-template-columns: 1fr;
  }

  .home-progress-card {
    grid-template-columns: 38px minmax(0, 1fr) minmax(90px, 0.7fr);
  }

  .home-progress-card .progress-track {
    grid-column: 3;
    grid-row: 1;
  }

  .home-progress-card small {
    grid-column: 2 / -1;
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0;
    z-index: 30;
    height: auto;
    display: block;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(57, 230, 255, 0.22);
    border-right: 0;
    background: rgba(1, 7, 21, 0.96);
    backdrop-filter: blur(16px);
  }

  .sidebar .brand,
  .sidebar .account-box {
    display: none;
  }

  .nav-tabs {
    display: flex;
    gap: 4px;
    overflow: visible;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-button {
    flex: 1 1 0;
    min-height: 58px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    padding: 6px 4px;
    scroll-snap-align: center;
    font-size: 0.68rem;
  }

  .more-menu {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    max-height: min(420px, 70vh);
    overflow-y: auto;
  }

  .nav-button span {
    display: block;
  }

  .nav-button.active,
  .nav-button:hover {
    box-shadow: inset 0 3px 0 var(--green);
  }
}

@media (max-width: 460px) {
  .content {
    padding: 14px 10px calc(96px + env(safe-area-inset-bottom));
  }

  .routine-item {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    padding: 10px 8px;
  }

  .routine-item-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .home-hero {
    padding: 16px;
  }

  .home-welcome h2 {
    font-size: 1.55rem;
  }

  .home-focus {
    padding: 16px;
  }

  .home-focus-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .home-score {
    width: 108px;
  }

  .home-score strong {
    font-size: 1.5rem;
  }

  .home-today-panel,
  .home-weight-panel,
  .home-shortcuts {
    padding: 13px;
  }

  .home-hero img {
    width: min(130px, 55vw);
  }

  .option-card {
    min-height: 132px;
    padding: 14px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}
