:root {
  --ink: #18231f;
  --muted: #63736b;
  --panel: #ffffff;
  --line: #dde7e0;
  --field: #f7faf8;
  --green: #2f8f6b;
  --green-dark: #1e674d;
  --mint: #dff4ea;
  --gold: #f8d06b;
  --coral: #ee7a66;
  --shadow: 0 24px 80px rgba(20, 43, 34, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", Arial, sans-serif;
  color: var(--ink);
  background: #eef5f0;
}

button,
input {
  font: inherit;
}

a {
  color: var(--green-dark);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.login-shell {
  display: grid;
  height: 100vh;
  min-height: 100vh;
  grid-template-columns: minmax(420px, 0.95fr) minmax(420px, 1.05fr);
}

.brand-panel {
  position: relative;
  display: flex;
  height: 100vh;
  min-height: 0;
  align-items: center;
  overflow: hidden;
  padding: 48px;
  color: #fff;
  background:
    linear-gradient(rgba(25, 70, 52, 0.88), rgba(25, 70, 52, 0.78)),
    url("https://images.unsplash.com/photo-1490645935967-10de6ba17061?auto=format&fit=crop&w=1400&q=80")
      center/cover;
}

.brand-panel__content {
  width: min(520px, 100%);
}

.brand-mark {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  margin-bottom: 32px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(12px);
}

.brand-mark svg {
  width: 52px;
  height: 52px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-panel .eyebrow {
  color: var(--gold);
}

.brand-panel h1 {
  max-width: 11ch;
  margin: 0;
  font-size: clamp(3rem, 7vw, 5.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.brand-copy {
  max-width: 34rem;
  margin: 26px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.05rem;
  line-height: 1.7;
}

.nutrition-preview {
  display: grid;
  max-width: 410px;
  margin-top: 42px;
  grid-template-columns: 1fr 136px;
  gap: 14px;
  align-items: end;
}

.preview-card {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.17);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(16px);
}

.preview-card--main {
  padding: 20px;
}

.preview-card--small {
  padding: 18px;
}

.preview-card span {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.8rem;
  font-weight: 700;
}

.preview-card strong {
  display: block;
  margin-top: 8px;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
}

.preview-card--small strong {
  color: var(--gold);
}

.macro-row {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.macro-row span {
  position: relative;
  overflow: hidden;
  height: 28px;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.macro-row span::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--size);
  border-radius: inherit;
  background: rgba(248, 208, 107, 0.72);
  content: "";
}

.macro-row span {
  isolation: isolate;
}

.macro-row span::after {
  position: absolute;
  inset: 7px 10px;
  z-index: -1;
  content: "";
}

.login-panel {
  display: grid;
  height: 100vh;
  min-height: 0;
  overflow: auto;
  place-items: center;
  padding: 48px 28px;
}

.mobile-brand {
  display: none;
}

.login-card {
  width: min(448px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-heading h2 {
  margin: 0;
  font-size: 1.9rem;
  line-height: 1.12;
}

.login-heading p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.social-button,
.primary-button {
  display: inline-flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.social-button {
  margin-top: 22px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.social-button svg {
  width: 20px;
  height: 20px;
}

.social-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.social-button:hover {
  border-color: #bfd4c9;
  box-shadow: 0 12px 24px rgba(37, 91, 68, 0.1);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: #7f9088;
  font-size: 0.82rem;
  font-weight: 700;
}

.divider::before,
.divider::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.login-form {
  display: grid;
  gap: 8px;
}

.login-form[hidden] {
  display: none;
}

.login-form label {
  color: #34473f;
  font-size: 0.9rem;
  font-weight: 800;
}

.login-form input[type="email"],
.login-form input[type="password"],
.login-form input[type="text"] {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--field);
  outline: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.login-form input:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(47, 143, 107, 0.12);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 54px;
}

.icon-button {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--green-dark);
  background: var(--mint);
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 2px 0 0;
  font-size: 0.9rem;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.check-row input {
  width: 17px;
  height: 17px;
  accent-color: var(--green);
}

.form-message {
  min-height: 20px;
  margin: 2px 0 0;
  color: var(--coral);
  font-size: 0.86rem;
  font-weight: 700;
}

.form-message.is-success {
  color: var(--green-dark);
}

.primary-button {
  margin-top: 2px;
  color: #fff;
  background: var(--green);
  box-shadow: 0 15px 30px rgba(47, 143, 107, 0.26);
}

.primary-button:hover {
  background: var(--green-dark);
  box-shadow: 0 16px 32px rgba(30, 103, 77, 0.3);
}

.signup-copy {
  margin: 20px 0 0;
  color: var(--muted);
  text-align: center;
}

.terms-row {
  margin-top: 4px;
  line-height: 1.35;
}

@media (max-width: 920px) {
  .login-shell {
    height: auto;
    grid-template-columns: 1fr;
  }

  .brand-panel {
    display: none;
  }

  .login-panel {
    height: auto;
    min-height: 100vh;
    align-content: center;
    gap: 22px;
    padding: 28px 18px;
  }

  .mobile-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 900;
  }

  .mini-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: var(--green);
  }

  .login-card {
    padding: 30px 22px;
  }
}

@media (max-height: 780px) and (min-width: 921px) {
  .brand-mark {
    margin-bottom: 24px;
  }

  .brand-panel h1 {
    max-width: 12ch;
    font-size: clamp(3rem, 6vw, 4.8rem);
  }

  .brand-copy {
    margin-top: 20px;
  }

  .nutrition-preview {
    display: none;
  }
}

@media (max-width: 420px) {
  .login-panel {
    padding: 18px 14px;
  }

  .login-card {
    padding: 24px 18px;
  }

  .login-heading h2 {
    font-size: 1.65rem;
  }

  .form-options {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
}

.app-body {
  min-height: 100vh;
  background: #f5f8f3;
}

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

.app-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  border-right: 1px solid var(--line);
  padding: 26px 18px;
  background: #ffffff;
}

.app-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 900;
  text-decoration: none;
}

.app-logo:hover {
  text-decoration: none;
}

.app-logo__mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
  box-shadow: 0 12px 24px rgba(47, 143, 107, 0.22);
}

.side-nav {
  display: grid;
  gap: 8px;
  margin-top: 34px;
}

.side-nav__item {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
}

.side-nav__item:hover {
  background: #f1f6f3;
  text-decoration: none;
}

.side-nav__item.is-active {
  color: var(--green-dark);
  background: var(--mint);
}

.side-nav__item svg,
.search-box svg,
.icon-only svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.logout-button {
  min-height: 42px;
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.logout-button:hover {
  color: var(--green-dark);
  border-color: #bfd4c9;
  background: #f7fbf9;
}

.app-main {
  min-width: 0;
  padding: 32px;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.app-topbar h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.65rem);
  line-height: 1.05;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  display: flex;
  width: min(300px, 34vw);
  height: 46px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  background: #fff;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.compact-button {
  width: auto;
  min-height: 46px;
  padding: 0 18px;
  white-space: nowrap;
}

.daily-strip {
  display: grid;
  grid-template-columns: minmax(280px, 1.4fr) repeat(3, minmax(160px, 0.65fr));
  gap: 14px;
  margin-top: 28px;
}

.daily-strip__main,
.metric-card,
.panel-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(28, 57, 45, 0.08);
}

.daily-strip__main {
  padding: 22px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(30, 103, 77, 0.96), rgba(47, 143, 107, 0.88)),
    url("https://images.unsplash.com/photo-1543362906-acfc16c67564?auto=format&fit=crop&w=1200&q=80")
      center/cover;
}

.daily-strip__main strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
}

.daily-strip__main p {
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.5;
}

.metric-label {
  display: block;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.82rem;
  font-weight: 800;
}

.metric-card .metric-label {
  color: var(--muted);
}

.progress-track {
  overflow: hidden;
  height: 10px;
  margin-top: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
}

.metric-card {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 154px;
  padding: 20px;
}

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

.metric-card small {
  color: var(--muted);
  font-weight: 700;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.4fr) minmax(260px, 0.8fr);
  gap: 16px;
  margin-top: 16px;
}

.panel-card {
  padding: 22px;
}

.meals-panel {
  grid-row: span 2;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.18rem;
}

.icon-only {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green-dark);
  background: #fff;
  cursor: pointer;
}

.icon-only:hover {
  background: var(--mint);
}

.meal-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.meal-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid #e8efe9;
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfb;
}

.meal-time {
  display: grid;
  min-height: 34px;
  place-items: center;
  border-radius: 8px;
  color: var(--green-dark);
  background: var(--mint);
  font-size: 0.82rem;
  font-weight: 900;
}

.meal-item strong {
  display: block;
  margin-bottom: 3px;
}

.meal-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.meal-item b {
  color: var(--green-dark);
  white-space: nowrap;
}

.macro-donut {
  display: grid;
  width: 188px;
  height: 188px;
  place-items: center;
  margin: 24px auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 0 56%, transparent 57%),
    conic-gradient(var(--green) 0 42%, var(--gold) 42% 76%, var(--coral) 76% 100%);
}

.macro-donut span {
  font-size: 1.8rem;
  font-weight: 900;
}

.macro-legend {
  display: grid;
  gap: 10px;
}

.macro-legend span,
.goal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

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

.legend-dot.carb {
  background: var(--gold);
}

.legend-dot.fat {
  background: var(--coral);
}

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

.goal-row {
  min-height: 42px;
  border-bottom: 1px solid #edf2ee;
}

.goal-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 28, 23, 0.46);
}

.modal-backdrop[hidden] {
  display: none;
}

.meal-modal {
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.24);
}

.meal-form {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.meal-form label {
  color: #34473f;
  font-size: 0.9rem;
  font-weight: 800;
}

.meal-form input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--field);
  outline: 0;
}

.meal-form input:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(47, 143, 107, 0.12);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.has-modal {
  overflow: hidden;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .app-sidebar {
    align-items: center;
    padding: 22px 12px;
  }

  .app-logo span:last-child,
  .side-nav__item {
    font-size: 0;
  }

  .side-nav__item {
    justify-content: center;
    width: 48px;
    padding: 0;
  }

  .logout-button {
    width: 48px;
    font-size: 0;
  }

  .logout-button::before {
    content: "S";
    font-size: 0.95rem;
  }

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

  .daily-strip__main {
    grid-column: span 2;
  }
}

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

  .app-sidebar {
    position: fixed;
    inset: auto 12px 12px;
    z-index: 10;
    display: grid;
    height: 64px;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 16px 42px rgba(28, 57, 45, 0.14);
  }

  .app-logo {
    display: none;
  }

  .side-nav {
    display: flex;
    justify-content: center;
    margin: 0;
  }

  .logout-button {
    margin: 0;
  }

  .app-main {
    padding: 24px 16px 96px;
  }

  .app-topbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box,
  .compact-button {
    width: 100%;
  }

  .daily-strip,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .daily-strip__main,
  .meals-panel {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 520px) {
  .daily-strip {
    gap: 10px;
  }

  .metric-card {
    min-height: 124px;
  }

  .meal-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .meal-time {
    width: 62px;
  }

  .meal-item b {
    justify-self: start;
  }

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