/* NutriWise — Pahami Gizi, Sehatkan Hidup
   Design tokens derived from the NutriWise website mockup. */

:root {
  --cream: #faf7ee;
  --cream-panel: #fbf9f2;
  --cream-content: #faf6ec;
  --white: #ffffff;
  --ink: #16352a;
  --ink-soft: #3f4a41;
  --muted: #74746a;
  --muted-soft: #8c8c7f;
  --line: #e9e3d3;
  --line-soft: #f0ebde;
  --green: #2e6b45;
  --green-dark: #245738;
  --green-ink: #1e4a31;
  --green-soft: #e4eedb;
  --green-soft-2: #edf3e3;
  --green-soft-3: #f4f8ee;
  --tan: #f7e9ce;
  --tan-soft: #f9f0de;
  --shadow-sm: 0 1px 2px rgba(23, 57, 42, 0.04);
  --display: "Poppins", "Segoe UI", system-ui, sans-serif;
  --sans: "Inter", "Segoe UI", system-ui, sans-serif;
  --radius-card: 32px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  line-height: 1.2;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

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

button {
  cursor: pointer;
}

svg {
  display: block;
}

::selection {
  background: var(--green-soft);
  color: var(--green-ink);
}

/* ------------------------------------------------------------
   Brand, buttons, small utilities
   ------------------------------------------------------------ */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.brand svg {
  width: 34px;
  height: 34px;
  flex: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 26px;
  border: 0;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.btn:hover {
  background: var(--green-dark);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 3px solid rgba(46, 107, 69, 0.35);
  outline-offset: 2px;
}

.btn .arrow {
  font-size: 15px;
  transition: transform 0.16s ease;
}

.btn:hover .arrow {
  transform: translateX(3px);
}

.btn--block {
  width: 100%;
}

.btn--sm {
  padding: 11px 18px;
  font-size: 13px;
  border-radius: 10px;
}

.btn--ghost {
  background: #fff;
  color: var(--green-ink);
  border: 1px solid var(--line);
}

.btn--ghost:hover {
  background: var(--green-soft-3);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
  line-height: 1.65;
}

.note {
  color: var(--muted-soft);
  font-size: 11.5px;
  line-height: 1.6;
  font-style: italic;
}

.kicker {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: #5c6b5e;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #dce7d2;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
}

.badge--tan {
  background: var(--tan-soft);
  border-color: #eeddbd;
  color: #7a5a24;
}

.badge--clay {
  background: #f7e6dc;
  border-color: #eed4c6;
  color: #8a4d33;
}

/* ------------------------------------------------------------
   Home page
   ------------------------------------------------------------ */

.home {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.home-nav {
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 20px 58px 18px;
}

.home-nav .nav-links {
  display: flex;
  gap: 46px;
  margin: 0 auto;
  font-size: 14px;
  color: #63645a;
}

.home-nav .nav-links a {
  transition: color 0.15s ease;
}

.home-nav .nav-links a:hover {
  color: var(--green);
}

.home-nav .nav-links a.is-active {
  color: var(--ink);
  font-weight: 600;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  align-items: center;
  gap: 40px;
  margin: 8px 32px 0;
  padding: 48px 54px;
  border-radius: 56px;
  background: var(--green-soft-2);
}

.hero h1 {
  margin-top: 20px;
  font-size: clamp(36px, 3.8vw, 52px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.hero .lead {
  margin: 24px 0 32px;
  max-width: 440px;
  color: #7c7d70;
  font-size: 15.5px;
  line-height: 1.78;
}

.hero-media img {
  width: 100%;
  max-width: 460px;
  margin-left: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 140px 28px 140px 28px;
}

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
  padding: 34px 40px 0;
}

.feature {
  padding: 32px 30px 42px;
  border: 1px solid #f0ebdd;
  border-radius: 30px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.feature h3 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.feature p {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13.5px;
}

.about {
  padding: 72px 40px 0;
  scroll-margin-top: 24px;
}

.about-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  gap: 56px;
  padding: 48px 52px;
  border-radius: 40px;
  background: #fff;
  border: 1px solid #f0ebdd;
}

.about-card h2 {
  margin-top: 14px;
  font-size: 30px;
  letter-spacing: -0.025em;
}

.about-card .about-copy p {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.about-steps {
  display: grid;
  gap: 10px;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
}

.about-steps li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--ink-soft);
}

.about-steps span {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--green-soft-2);
  color: var(--green);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.refs h3 {
  font-size: 16px;
  letter-spacing: -0.01em;
}

.refs ol {
  margin: 16px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.refs li {
  margin-bottom: 11px;
}

.refs li span {
  color: var(--ink-soft);
}

.refs .disclaimer {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--tan-soft);
  color: #7a5a24;
  font-size: 11.5px;
  line-height: 1.6;
}

.home-footer {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: auto;
  padding: 54px 58px 28px;
  color: #5d6b60;
  font-size: 11.5px;
}

.home-footer .sep {
  margin: 0 8px;
}

.home-footer .footer-links {
  margin-left: auto;
  display: flex;
  gap: 20px;
  color: var(--muted-soft);
}

/* ------------------------------------------------------------
   App shell (sidebar + topbar + content)
   ------------------------------------------------------------ */

.app {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  background: var(--cream-panel);
}

.sidebar {
  position: sticky;
  top: 0;
  flex: 0 0 252px;
  width: 252px;
  height: 100vh;
  padding: 26px 20px 24px;
  background: var(--cream-panel);
  display: flex;
  flex-direction: column;
}

.sidebar .brand {
  padding: 0 8px;
}

.sidebar .tagline {
  margin: 12px 8px 0;
  color: var(--muted-soft);
  font-size: 11.5px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 34px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 15px;
  border-radius: 12px;
  color: #60615a;
  font-size: 13.5px;
  transition: background 0.15s ease, color 0.15s ease;
}

.side-nav a svg {
  width: 19px;
  height: 19px;
  flex: none;
  opacity: 0.75;
}

.side-nav a:hover {
  background: var(--green-soft-3);
  color: var(--green-ink);
}

.side-nav a.is-active {
  background: var(--green-soft-2);
  color: var(--green-ink);
  font-weight: 600;
}

.side-nav a.is-active svg {
  opacity: 1;
}

.side-nav .nav-group {
  margin: 16px 15px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #a9a99a;
}

.sidebar-foot {
  margin-top: auto;
  padding: 0 10px;
}

.sidebar-foot svg {
  width: 46px;
  height: 46px;
}

.sidebar-foot p {
  margin-top: 16px;
  color: var(--muted-soft);
  font-size: 11.5px;
  font-style: italic;
  line-height: 1.65;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 0 24px 24px 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 14px 18px 34px;
}

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #8b8a7d;
  min-width: 0;
}

.crumb .crumb-sep {
  color: #b9b8ab;
}

.crumb strong {
  font-weight: 500;
  color: #6a6b60;
}

.search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 192px;
  padding: 10px 14px;
  border: 1px solid #eee8d9;
  border-radius: 10px;
  background: #fdfbf5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search:focus-within {
  border-color: #c9d9bd;
  box-shadow: 0 0 0 3px rgba(46, 107, 69, 0.08);
}

.search svg {
  width: 14px;
  height: 14px;
  flex: none;
  color: #a3a396;
}

.search input {
  width: 100%;
  border: 0;
  background: transparent;
  font-size: 12.5px;
  outline: none;
  color: var(--ink-soft);
}

.search input::placeholder {
  color: #a9a99c;
}

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #cfe0bf;
  background: var(--green-soft-2);
  color: var(--green-ink);
  font-family: var(--display);
  font-size: 10.5px;
  font-weight: 600;
}

.content {
  flex: 1;
  padding: 40px 44px 64px;
  border-radius: 28px 0 0 0;
  background: var(--cream-content);
}

.page-head {
  max-width: 860px;
}

.page-head h1 {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-head p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13.5px;
  max-width: 720px;
}

.page-head .head-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

/* ------------------------------------------------------------
   Panels, forms
   ------------------------------------------------------------ */

.layout-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 342px;
  gap: 28px;
  margin-top: 32px;
  align-items: start;
}

.layout-2--wide {
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr);
}

.panel {
  padding: 34px 38px 38px;
  border: 1px solid var(--line-soft);
  border-radius: 42px;
  background: #fff;
}

.panel--green {
  background: var(--green-soft-2);
  border-color: transparent;
}

.panel--tan {
  background: var(--tan-soft);
  border-color: transparent;
}

.panel--soft {
  background: var(--cream);
  border-color: transparent;
}

.panel h2 {
  font-size: 22px;
  letter-spacing: -0.025em;
}

.panel .panel-sub {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12.5px;
}

.panel--reminder {
  min-height: 100%;
  padding: 32px 32px 30px;
  border-radius: 42px;
  display: flex;
  flex-direction: column;
}

.panel--reminder h2 {
  font-size: 20px;
}

.panel--reminder p {
  margin-top: 20px;
  font-size: 13.5px;
  line-height: 1.8;
  color: #48574b;
  max-width: 250px;
}

.panel--reminder .note {
  margin-top: auto;
  padding-top: 40px;
  color: #7c8a7b;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 24px;
  margin-top: 26px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field--full {
  grid-column: 1 / -1;
}

.field label {
  font-family: var(--display);
  font-size: 12.5px;
  font-weight: 600;
  color: #3b463c;
}

.field .hint {
  font-size: 11px;
  color: var(--muted-soft);
  font-weight: 400;
}

.control {
  position: relative;
}

.control input,
.control select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #e9e3d3;
  border-radius: 10px;
  background: #fdfbf5;
  font-size: 13.5px;
  color: #4a4a40;
  outline: none;
  appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.control input::placeholder {
  color: #a9a99c;
}

.control input:focus,
.control select:focus {
  border-color: #b9cfab;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(46, 107, 69, 0.08);
}

.control input[aria-invalid="true"] {
  border-color: #cf8f78;
  background: #fdf6f3;
}

.control select {
  cursor: pointer;
  padding-right: 38px;
}

.control--select::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.6px solid #8d8d7e;
  border-bottom: 1.6px solid #8d8d7e;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.control--suffix input {
  padding-right: 52px;
}

.control--suffix .suffix {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #a0a093;
  font-size: 12.5px;
  pointer-events: none;
}

.field-error {
  font-size: 11px;
  color: #a8553a;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 4px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--cream);
  font-size: 12px;
  line-height: 1.6;
  color: #5c6357;
  cursor: pointer;
}

.check input {
  margin: 2px 0 0;
  width: 15px;
  height: 15px;
  accent-color: var(--green);
  flex: none;
}

.form-foot {
  margin-top: 26px;
}

.form-foot .note {
  margin-top: 14px;
}

.alert {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  margin-top: 20px;
  border-radius: 12px;
  background: #fdf3ea;
  border: 1px solid #f0ddcc;
  color: #8a5636;
  font-size: 12.5px;
  line-height: 1.6;
}

.alert strong {
  font-weight: 600;
}

[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------
   Result page
   ------------------------------------------------------------ */

.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr);
  gap: 26px;
  margin-top: 30px;
  align-items: stretch;
}

.energy-card {
  display: flex;
  flex-direction: column;
  min-height: 262px;
  padding: 30px 34px 28px;
  border-radius: var(--radius-card);
  background: var(--green-soft);
}

.energy-card .energy-label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #3f7050;
}

.energy-card .energy-value {
  margin-top: 30px;
  font-family: var(--display);
  font-size: 60px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--green-ink);
}

.energy-card .energy-unit {
  margin-top: 14px;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 500;
  color: #3c6a4c;
}

.energy-card .energy-note {
  margin-top: auto;
  padding-top: 26px;
  color: #77866f;
  font-size: 11.5px;
}

.energy-card .energy-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.macro-list {
  margin-top: 10px;
}

.macro-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px dashed #efe9d9;
}

.macro-row:last-child {
  border-bottom: 0;
}

.macro-ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--tan-soft);
  font-size: 16px;
  line-height: 1;
}

.macro-row .macro-name {
  font-size: 13.5px;
  color: var(--ink-soft);
}

.macro-row .macro-val {
  margin-left: auto;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
  color: var(--green-ink);
  white-space: nowrap;
}

.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  margin-top: 26px;
}

.stat-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px dashed #efe9d9;
  font-size: 13px;
}

.stat-line:last-child {
  border-bottom: 0;
}

.stat-line span:first-child {
  color: var(--muted);
}

.stat-line b {
  font-family: var(--display);
  font-weight: 600;
  color: var(--green-ink);
}

.advice-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.advice-list li {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.65;
}

.advice-list li::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--green);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.chip {
  padding: 7px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e6ecdd;
  font-size: 11.5px;
  color: #4a604e;
}

.ggl-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.ggl-item {
  padding: 16px;
  border-radius: 14px;
  background: #fff;
}

.ggl-item .ggl-label {
  font-size: 11px;
  color: var(--muted);
}

.ggl-item .ggl-val {
  margin-top: 6px;
  font-family: var(--display);
  font-size: 19px;
  font-weight: 600;
  color: #7a5a24;
}

.ggl-item .ggl-unit {
  font-size: 10.5px;
  color: var(--muted-soft);
  margin-top: 2px;
}

.conclusion-card {
  margin-top: 26px;
  padding: 30px 34px;
  border-radius: var(--radius-card);
  background: #fff;
  border: 1px solid var(--line-soft);
}

.conclusion-card h2 {
  font-size: 21px;
}

.conclusion-card p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
  max-width: 800px;
}

.conclusion-card .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.active-rules {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.active-rule {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fff;
  font-size: 12.5px;
  color: #445246;
}

.active-rule .code {
  flex: none;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  background: var(--green-soft-2);
  padding: 2px 8px;
  border-radius: 6px;
}

.empty-state {
  margin-top: 30px;
  padding: 52px 40px;
  border-radius: var(--radius-card);
  background: #fff;
  border: 1px dashed #e3ddca;
  text-align: center;
}

.empty-state .empty-ico {
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--green-soft-2);
  font-size: 22px;
}

.empty-state h2 {
  font-size: 20px;
}

.empty-state p {
  margin: 10px auto 22px;
  max-width: 400px;
  color: var(--muted);
  font-size: 13px;
}

/* ------------------------------------------------------------
   Expert system page
   ------------------------------------------------------------ */

.expert-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: 30px;
}

.expert-card {
  display: flex;
  flex-direction: column;
  min-height: 300px;
  padding: 26px 28px 30px;
  border-radius: var(--radius-card);
  background: #fff;
  border: 1px solid var(--line-soft);
}

.expert-card .kicker {
  display: flex;
  align-items: center;
  gap: 8px;
}

.expert-card .kicker b {
  color: #a9b7a4;
  font-weight: 600;
}

.expert-card--rules {
  background: var(--tan);
  border-color: transparent;
}

.expert-card--conclusion {
  background: var(--green-soft);
  border-color: transparent;
}

.expert-body {
  flex: 1;
  margin-top: 26px;
}

.fact + .fact {
  margin-top: 18px;
}

.fact dt {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 600;
  color: #3b463c;
}

.fact dd {
  margin: 2px 0 0;
  font-size: 14px;
  color: #4d5a4f;
}

.expert-body .rule-lines {
  font-family: var(--display);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.9;
  color: #6b5127;
}

.expert-body .conclusion-title {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: var(--green-ink);
}

.expert-body .conclusion-note {
  margin-top: auto;
  padding-top: 26px;
  font-size: 11.5px;
  color: #7b8a77;
}

.why-card {
  margin-top: 24px;
  padding: 20px 26px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--line-soft);
  font-size: 12.5px;
  color: var(--muted);
}

.why-card b {
  color: var(--ink-soft);
  font-weight: 600;
}

.rules-section {
  margin-top: 30px;
}

.rules-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  justify-content: space-between;
}

.rules-head h2 {
  font-size: 21px;
}

.legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 11.5px;
  color: var(--muted);
}

.legend .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 3px;
  background: var(--green-soft);
  vertical-align: middle;
}

.rules-table-wrap {
  margin-top: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  background: #fff;
  overflow: auto;
}

.rules-table {
  width: 100%;
  min-width: 660px;
  border-collapse: collapse;
  font-size: 12.5px;
}

.rules-table th {
  position: sticky;
  top: 0;
  padding: 13px 16px;
  background: #fdfbf5;
  border-bottom: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #83837a;
  text-align: left;
}

.rules-table td {
  padding: 13px 16px;
  border-bottom: 1px solid #f3eee1;
  color: #4b534b;
  vertical-align: top;
  line-height: 1.55;
}

.rules-table tr:last-child td {
  border-bottom: 0;
}

.rules-table .layer-row td {
  padding: 10px 16px;
  background: #f8f4e8;
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7c8678;
}

.rules-table tr.is-active td {
  background: #edf3e3;
  color: #31463a;
}

.rules-table tr.is-active td:first-child {
  box-shadow: inset 3px 0 0 var(--green);
  font-weight: 600;
}

.rules-table .code {
  font-family: var(--display);
  font-weight: 600;
  color: var(--green);
  white-space: nowrap;
}

.rules-table .src {
  color: var(--muted-soft);
  font-size: 11px;
}

/* ------------------------------------------------------------
   Menu page
   ------------------------------------------------------------ */

.menu-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 26px;
}

.menu-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 6px;
  border-radius: 12px;
  background: #f2eddd;
}

.menu-tabs button {
  padding: 10px 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #5f6055;
  font-family: var(--display);
  font-size: 12.5px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.menu-tabs button:hover {
  color: var(--green-ink);
}

.menu-tabs button.is-active {
  background: var(--green);
  color: #fff;
  font-weight: 600;
}

.filter-note {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.filter-note button {
  border: 0;
  background: none;
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
  margin-top: 30px;
}

.menu-card {
  display: flex;
  flex-direction: column;
  padding: 12px 12px 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-card);
  background: #fff;
  overflow: hidden;
}

.menu-media {
  position: relative;
}

.menu-media img {
  width: 100%;
  height: 196px;
  object-fit: cover;
  border-radius: 24px;
  background: var(--cream);
}

.fav-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #8a8a7d;
  font-size: 15px;
  line-height: 1;
  backdrop-filter: blur(4px);
  transition: color 0.15s ease, transform 0.15s ease;
}

.fav-toggle:hover {
  transform: scale(1.06);
}

.fav-toggle.is-fav {
  color: #b45f4b;
}

.menu-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 18px 16px 22px;
}

.menu-time {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #4c7a5c;
}

.menu-body h3 {
  margin-top: 10px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.menu-body p {
  margin: 10px 0 20px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.65;
}

.link-arrow {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--green);
  font-family: var(--display);
  font-size: 12.5px;
  font-weight: 600;
}

.link-arrow span {
  transition: transform 0.15s ease;
}

.link-arrow:hover span {
  transform: translateX(3px);
}

.menu-foot-note {
  margin-top: 26px;
}

.weekly {
  margin-top: 30px;
  padding: 30px 34px 34px;
  border-radius: var(--radius-card);
  border: 1px solid var(--line-soft);
  background: #fff;
}

.weekly-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
}

.weekly-head h2 {
  font-size: 20px;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.week-day {
  padding: 18px;
  border-radius: 16px;
  background: var(--cream);
}

.week-day h4 {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--green);
}

.week-day ul {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: #55604f;
  line-height: 1.7;
}

.week-day li + li {
  margin-top: 6px;
}

.week-day li b {
  display: block;
  font-family: var(--display);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #a0a094;
}

/* Modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(20, 44, 32, 0.42);
  backdrop-filter: blur(2px);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 600px;
  max-height: 88vh;
  overflow: auto;
  padding: 34px 34px 30px;
  border-radius: 30px;
  background: #fff;
  box-shadow: 0 30px 70px rgba(16, 42, 29, 0.25);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}

.modal-close:focus-visible,
.fav-toggle:focus-visible,
.link-arrow:focus-visible,
.menu-tabs button:focus-visible,
.search input:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(46, 107, 69, 0.5);
  outline-offset: 2px;
}

.modal-card h3 {
  margin-top: 10px;
  font-size: 24px;
  letter-spacing: -0.025em;
}

.modal-card .modal-sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12.5px;
}

.modal-card h4 {
  margin-top: 24px;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7f8b7c;
}

.modal-card ul {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.8;
}

.modal-macros {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.modal-macro {
  padding: 12px;
  border-radius: 12px;
  background: var(--cream);
}

.modal-macro b {
  display: block;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  color: var(--green-ink);
}

.modal-macro span {
  font-size: 10.5px;
  color: var(--muted);
}

/* ------------------------------------------------------------
   History
   ------------------------------------------------------------ */

.history-card {
  margin-top: 30px;
  padding: 30px 34px 34px;
  border-radius: var(--radius-card);
  background: #fff;
  border: 1px solid var(--line-soft);
}

.history-head {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: baseline;
  justify-content: space-between;
}

.history-head h2 {
  font-size: 21px;
}

.history-head .count {
  font-size: 12px;
  color: var(--muted-soft);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 22px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  border-radius: 16px;
  background: var(--green-soft-2);
}

.history-date {
  font-family: var(--display);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--green-ink);
}

.history-meta {
  margin-top: 4px;
  font-size: 11.5px;
  color: #6e7e6c;
}

.history-kcal {
  margin-left: auto;
  font-family: var(--display);
  font-size: 14.5px;
  font-weight: 600;
  color: #22412f;
  white-space: nowrap;
}

.history-status {
  flex: none;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  font-size: 10.5px;
  font-weight: 600;
  color: #4a7157;
  white-space: nowrap;
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */

@media (max-width: 1180px) {
  .content {
    padding: 34px 32px 56px;
  }
  .layout-2 {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
  .hero {
    padding: 48px 46px;
    gap: 36px;
  }
  .features {
    padding: 28px 30px 0;
  }
  .about {
    padding: 60px 30px 0;
  }
  .home-nav {
    padding: 18px 34px;
  }
}

@media (max-width: 980px) {
  .app {
    flex-direction: column;
  }
  .sidebar {
    position: static;
    flex: none;
    width: 100%;
    height: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 12px 14px 8px;
    overflow: visible;
  }
  .sidebar .brand {
    padding: 0 2px;
  }
  .sidebar .tagline,
  .sidebar-foot,
  .side-nav .nav-group {
    display: none;
  }
  .side-nav {
    flex-direction: row;
    gap: 2px;
    margin: 2px 0 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .side-nav::-webkit-scrollbar {
    display: none;
  }
  .side-nav a {
    padding: 9px 12px;
    font-size: 12px;
    white-space: nowrap;
  }
  .side-nav a svg {
    width: 16px;
    height: 16px;
  }
  .main {
    padding: 0;
  }
  .topbar {
    padding: 12px 18px;
  }
  .content {
    border-radius: 0;
    padding: 26px 20px 56px;
  }
  .layout-2,
  .layout-2--wide,
  .result-grid,
  .split-2 {
    grid-template-columns: 1fr;
  }
  .panel--reminder {
    min-height: 0;
  }
  .panel--reminder .note {
    padding-top: 22px;
  }
  .expert-grid,
  .menu-grid {
    grid-template-columns: 1fr 1fr;
  }
  .hero {
    grid-template-columns: 1fr;
    margin: 6px 18px 0;
    padding: 34px 28px 28px;
    border-radius: 34px;
  }
  .hero-media {
    order: -1;
  }
  .hero-media img {
    aspect-ratio: 16 / 10;
    border-radius: 40px 40px 120px 40px;
  }
  .hero h1 {
    font-size: clamp(32px, 7vw, 44px);
  }
  .features,
  .about {
    padding: 22px 18px 0;
  }
  .features {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .about-card {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 32px 26px;
    border-radius: 30px;
  }
  .home-nav {
    padding: 14px 20px;
    gap: 16px;
    flex-wrap: wrap;
  }
  .home-nav .nav-links {
    order: 3;
    width: 100%;
    gap: 22px;
    margin: 0;
    font-size: 12.5px;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .home-footer {
    padding: 34px 20px 22px;
    flex-wrap: wrap;
  }
  .home-footer .footer-links {
    margin-left: 0;
  }
}

@media (max-width: 680px) {
  .page-head h1 {
    font-size: 27px;
  }
  .panel {
    padding: 26px 22px 28px;
    border-radius: 30px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .energy-card {
    padding: 24px 24px 22px;
    min-height: 220px;
  }
  .energy-card .energy-value {
    font-size: 48px;
    margin-top: 22px;
  }
  .expert-grid,
  .menu-grid {
    grid-template-columns: 1fr;
  }
  .expert-card {
    min-height: 0;
  }
  .ggl-grid,
  .split-2 {
    grid-template-columns: 1fr;
  }
  .modal-macros {
    grid-template-columns: 1fr 1fr;
  }
  .search {
    display: none;
  }
  .topbar {
    padding-right: 14px;
  }
  .content {
    padding: 22px 14px 48px;
  }
  .menu-tabs button {
    padding: 9px 18px;
  }
  .history-item {
    flex-wrap: wrap;
    gap: 8px 14px;
  }
  .history-status {
    order: 3;
  }
}
