/* Coach Parush — Nutrition Calculator */

.nut-tool-page .resource-main {
  position: relative;
  z-index: 1;
}

@media (max-width: 768px) {
  body.resource-page.nut-tool-page .resource-main {
    padding-top: calc(var(--nav-h) + 0.65rem);
  }

  .nut-tool-page .section-head {
    margin-bottom: 1rem;
  }

  .nut-tool-page .nut-legal-banner,
  .nut-tool-page .nut-howto-bar {
    margin-bottom: 0.85rem;
  }
}

.nut-tool-page .nut-page-wrap {
  width: min(56rem, var(--container));
  margin-inline: auto;
}

.nut-calculator {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-bottom: 2rem;
}

.nut-calculator__stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Cards & forms ── */
.nut-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.35rem 1.5rem;
}

.nut-card--results {
  padding: 1.5rem;
}

.nut-card__title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--white);
  margin: 0 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.nut-card__head .nut-card__title,
.nut-kpi-head .nut-card__title {
  margin: 0;
  padding: 0;
  border-bottom: none;
}

.nut-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.nut-card__head-text {
  flex: 1;
  min-width: 0;
}

.nut-section-lead {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
}

.nut-section-lead--sm {
  font-size: 0.76rem;
  margin-top: 0.25rem;
}

.nut-field-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
}

.nut-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--blue-bright);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.nut-info-btn--sm {
  width: 1.35rem;
  height: 1.35rem;
}

.nut-info-btn__icon {
  width: 1rem;
  height: 1rem;
}

.nut-info-btn--sm .nut-info-btn__icon {
  width: 0.8rem;
  height: 0.8rem;
}

.nut-info-btn:hover,
.nut-info-btn:focus-visible {
  border-color: rgba(13, 173, 242, 0.45);
  background: var(--blue-dim);
  color: var(--white);
  outline: none;
}

.nut-legal-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(251, 191, 36, 0.25);
  background: rgba(251, 191, 36, 0.08);
}

.nut-legal-banner__text {
  margin: 0;
  flex: 1 1 12rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #fcd34d;
}

.nut-legal-banner__link {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--white);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.nut-howto-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(13, 173, 242, 0.06);
}

.nut-howto-bar__text {
  margin: 0;
  flex: 1 1 14rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
}

.nut-subcard__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.nut-export-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.5rem;
  margin-bottom: 0.35rem;
}

.nut-modal--help,
.nut-modal--legal,
.nut-modal--tooltip {
  width: min(32rem, calc(100vw - 1.5rem));
  max-width: min(32rem, calc(100vw - 1.5rem));
  max-height: min(85dvh, calc(100dvh - 1.5rem));
}

.nut-modal--tooltip .nut-modal__body {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.nut-modal--tooltip .nut-help-body .tooltip-title {
  font-weight: 700;
  display: block;
  color: var(--white);
  margin-bottom: 0.35rem;
}

.nut-modal--tooltip .nut-help-body .tooltip-subline {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

[dir="rtl"] .nut-modal-overlay {
  padding-inline: max(0.75rem, env(safe-area-inset-left)) max(0.75rem, env(safe-area-inset-right));
}

.nut-modal--legal {
  max-width: min(36rem, calc(100vw - 2rem));
}

.nut-help-body {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--muted);
}

.nut-help-prose {
  white-space: pre-line;
}

.nut-legal-body {
  color: var(--muted);
}

.nut-heading--sm {
  font-size: 0.95rem;
}

body.nut-modal-open {
  overflow: hidden;
}

.cursor-help {
  cursor: help;
  -webkit-tap-highlight-color: transparent;
}

[data-tooltip] {
  text-decoration: underline dotted transparent;
  text-underline-offset: 0.2em;
  transition: text-decoration-color 0.15s ease;
}

[data-tooltip]:hover,
[data-tooltip]:focus-visible {
  text-decoration-color: rgba(13, 173, 242, 0.55);
}

@media (hover: none), (pointer: coarse) {
  [data-tooltip] {
    cursor: pointer;
    touch-action: manipulation;
    text-decoration-color: rgba(13, 173, 242, 0.35);
  }
}

.nut-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

@media (min-width: 768px) {
  .nut-form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.nut-field label,
.nut-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.nut-input,
.nut-field select {
  width: 100%;
  font-family: inherit;
  font-size: max(1rem, 16px);
  color: var(--white);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  min-height: 44px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.nut-input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.nut-input[type="number"]::-webkit-outer-spin-button,
.nut-input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.nut-input:focus,
.nut-field select:not(.custom-select__native):focus {
  outline: none;
  border-color: rgba(13, 173, 242, 0.45);
  box-shadow: 0 0 0 3px rgba(13, 173, 242, 0.1);
}

.nut-field select:not(.custom-select__native) {
  cursor: pointer;
  appearance: none;
  padding-inline: 1rem 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c4c3bc' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 1rem center;
}

html[dir="ltr"] .nut-field select:not(.custom-select__native) {
  background-position: right 1rem center;
}

/* Custom selects — sex, activity, trainee level */
.nut-field .custom-select {
  position: relative;
  width: 100%;
}

.nut-field .custom-select__native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
  opacity: 0;
}

.nut-field .custom-select__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 44px;
  font-family: inherit;
  font-size: max(1rem, 16px);
  font-weight: 400;
  color: var(--white);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  cursor: pointer;
  text-align: start;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.nut-field .custom-select__value {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nut-field .custom-select.is-open .custom-select__trigger,
.nut-field .custom-select__trigger:focus-visible {
  outline: none;
  border-color: rgba(13, 173, 242, 0.45);
  box-shadow: 0 0 0 3px rgba(13, 173, 242, 0.1);
}

.nut-field .custom-select__chevron {
  flex-shrink: 0;
  width: 0.75rem;
  height: 0.75rem;
  color: var(--muted-2);
  transition: transform 0.2s;
}

.nut-field .custom-select.is-open .custom-select__chevron {
  transform: rotate(180deg);
}

.nut-field .custom-select__list {
  position: absolute;
  top: calc(100% + 0.35rem);
  inset-inline: 0;
  z-index: 250;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: rgba(12, 12, 12, 0.98);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  max-height: min(16rem, 50vh);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(13, 173, 242, 0.4) transparent;
}

.nut-field .custom-select__list--fixed {
  inset-inline: auto;
}

.nut-field .custom-select__list::-webkit-scrollbar {
  width: 4px;
}

.nut-field .custom-select__list::-webkit-scrollbar-thumb {
  background: rgba(13, 173, 242, 0.4);
  border-radius: 999px;
}

.nut-field .custom-select.is-flip-up .custom-select__list {
  top: auto;
  bottom: calc(100% + 0.35rem);
}

.nut-field .custom-select__option {
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.45;
  white-space: normal;
  word-wrap: break-word;
  transition: background 0.15s, color 0.15s;
}

.nut-field .custom-select__option:hover,
.nut-field .custom-select__option.is-focused {
  background: rgba(13, 173, 242, 0.12);
  color: var(--white);
}

.nut-field .custom-select__option.is-selected {
  background: rgba(13, 173, 242, 0.16);
  color: var(--blue-bright);
  font-weight: 600;
}

.nut-field .custom-select--rich .custom-select__list {
  max-height: min(22rem, 65vh);
}

.nut-field .custom-select__list--fixed.custom-select__list {
  max-height: none;
}

.nut-field .custom-select__option--rich {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
}

.nut-field .custom-select__option-label {
  font-weight: 600;
  line-height: 1.35;
}

.nut-field .custom-select__option-hint {
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--muted-2);
}

.nut-field .custom-select__option--rich:hover .custom-select__option-hint,
.nut-field .custom-select__option--rich.is-focused .custom-select__option-hint {
  color: var(--muted);
}

.nut-field .custom-select__option--rich.is-selected .custom-select__option-label {
  color: var(--blue-bright);
}

.nut-field .custom-select__option--rich.is-selected .custom-select__option-hint {
  color: var(--muted);
}

/* ── Goal buttons ── */
.nut-goal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

@media (min-width: 900px) {
  .nut-goal-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.nut-goal-btn,
.goal-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.65rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.2s;
}

.nut-goal-btn:hover,
.goal-btn:hover {
  border-color: rgba(13, 173, 242, 0.35);
  color: var(--white);
}

.nut-goal-btn.active,
.goal-btn.active {
  border-color: rgba(13, 173, 242, 0.55);
  background: var(--blue-dim);
  color: var(--blue-bright);
  box-shadow: 0 0 0 1px rgba(13, 173, 242, 0.15);
}

/* ── Sliders ── */
.nut-slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.nut-slider-label {
  flex: 1 1 12rem;
  min-width: 0;
}

.nut-value,
.nut-slider-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--blue-bright);
  white-space: nowrap;
}

.nut-calculator input[type="range"] {
  width: 100%;
  min-height: 32px;
  margin: 0.25rem 0 0.5rem;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
}

.nut-calculator input[type="range"]:focus-visible {
  outline: 2px solid rgba(13, 173, 242, 0.45);
  outline-offset: 3px;
  border-radius: 999px;
}

.nut-calculator input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.nut-calculator input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--blue-bright);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 3px rgba(13, 173, 242, 0.22);
}

.nut-calculator input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.nut-calculator input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue-bright);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 3px rgba(13, 173, 242, 0.22);
}

.is-muted input[type="range"]::-webkit-slider-thumb,
.is-muted input[type="range"]::-moz-range-thumb {
  background: var(--muted-2);
  box-shadow: none;
  border-color: rgba(255, 255, 255, 0.35);
}

.nut-calculator input[type="range"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.nut-calculator input[type="range"]:disabled::-webkit-slider-thumb,
.nut-calculator input[type="range"]:disabled::-moz-range-thumb {
  background: var(--muted-2);
  box-shadow: none;
  border-color: rgba(255, 255, 255, 0.35);
}

.nut-calculator input[type="range"]:not(:disabled) {
  opacity: 1;
}

.nut-calculator input[type="checkbox"],
.nut-checkbox {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--blue);
  flex-shrink: 0;
}

.nut-section-divider {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.nut-modifier-wrap.is-muted {
  opacity: 0.55;
  pointer-events: none;
}

.nut-meal-value {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--blue-bright);
  margin: 0.35rem 0;
}

.nut-meal-split {
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}

.nut-details__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  list-style: none;
  color: var(--muted);
  transition: color 0.2s;
}

.nut-details__summary::-webkit-details-marker {
  display: none;
}

.nut-details__summary:hover {
  color: var(--white);
}

.nut-breakdown {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.55;
}

.nut-results-body,
.nut-results-block {
  display: block;
}

.nut-results-block {
  margin-bottom: 1.25rem;
}

.is-muted {
  opacity: 0.45;
  pointer-events: none;
}

.nut-hint {
  font-size: 0.75rem;
  color: var(--muted-2);
  margin: 0.35rem 0 0;
}

.nut-hint--success {
  color: #6ee7a0;
}

.nut-proj-box {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--blue-dim);
  border: 1px solid rgba(13, 173, 242, 0.2);
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nut-proj-label {
  font-size: 0.82rem;
  color: var(--muted);
}

/* Collapsible optional advanced panel */
.nut-advanced-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.nut-advanced-panel__summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  transition: background 0.2s, border-color 0.2s;
}

.nut-advanced-panel__summary::-webkit-details-marker {
  display: none;
}

.nut-advanced-panel__summary:hover {
  background: rgba(255, 255, 255, 0.03);
}

.nut-advanced-panel[open] .nut-advanced-panel__summary {
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
}

.nut-advanced-panel__summary-inner {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  flex: 1;
  min-width: 0;
}

.nut-advanced-panel__titles {
  flex: 1;
  min-width: 0;
}

.nut-advanced-panel__title {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--white);
  line-height: 1.35;
}

.nut-advanced-panel__lead {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted-2);
}

.nut-optional-badge {
  flex-shrink: 0;
  margin-top: 0.15rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.18rem 0.45rem;
}

.nut-advanced-panel__chevron {
  flex-shrink: 0;
  color: var(--muted-2);
  font-size: 0.7rem;
  transition: transform 0.2s;
}

.nut-advanced-panel[open] .nut-advanced-panel__chevron {
  transform: rotate(180deg);
}

.nut-advanced-panel__body {
  padding: 1rem;
}

.nut-advanced-panel:not([open]) .nut-advanced-panel__body {
  display: none;
}

.nut-advanced-panel__intro {
  margin: 0 0 1rem;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── Sub-cards (meals, refeed, stall) ── */
.nut-advanced-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 768px) {
  .nut-advanced-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.nut-subcard {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nut-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--white);
  margin: 0 0 0.35rem;
}

.nut-meal-value {
  text-align: center;
  font-weight: 700;
  color: var(--white);
}

.nut-meal-split {
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.nut-stall-btn {
  flex: 1;
  min-width: 6rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
  color: #fca5a5;
  transition: background 0.2s;
}

.nut-stall-btn:hover {
  background: rgba(248, 113, 113, 0.16);
}

#nut-stall-wrap.is-disabled .nut-stall-btn {
  opacity: 0.4;
  cursor: not-allowed;
}

.nut-stall-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
}

.nut-btn-full {
  width: 100%;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  font-weight: 800;
}

.nut-plan-cta {
  margin-top: 0.5rem;
}

/* ── KPI dashboard ── */
.nut-kpi-dashboard {
  background: linear-gradient(145deg, var(--surface-2) 0%, var(--surface-3) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1.35rem 1.5rem;
  box-shadow: var(--shadow-glow);
}

.nut-kpi-header {
  margin-bottom: 1.15rem;
}

.nut-kpi-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--white);
  margin: 0;
}

.nut-kpi-subtitle {
  font-size: 0.82rem;
  color: var(--muted-2);
  margin: 0.25rem 0 0;
}

.nut-kpi-hero {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 640px) {
  .nut-kpi-hero {
    grid-template-columns: 1fr 1.4fr;
  }
}

.nut-kpi-hero-card {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
}

.nut-kpi-hero-card--cals {
  border-color: rgba(13, 173, 242, 0.25);
  background: linear-gradient(135deg, rgba(13, 173, 242, 0.08), rgba(0, 0, 0, 0.2));
}

.nut-kpi-hero-card__label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.nut-kpi-hero-card__value {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.nut-kpi-hero-card__number {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 900;
  color: var(--blue-bright);
  line-height: 1;
}

.nut-kpi-hero-card__unit {
  font-size: 0.82rem;
  color: var(--muted-2);
}

.nut-kpi-card__value--pending {
  color: var(--muted-2) !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
}

.nut-kpi-macros__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
}

.nut-kpi-macros__item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
}

.nut-kpi-macros__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
}

.nut-kpi-macros__item--p .nut-kpi-macros__dot { background: #60a5fa; }
.nut-kpi-macros__item--c .nut-kpi-macros__dot { background: #fbbf24; }
.nut-kpi-macros__item--f .nut-kpi-macros__dot { background: #f472b6; }

.nut-kpi-macros__num {
  font-weight: 800;
  color: var(--white);
}

.nut-kpi-macros__suffix {
  color: var(--muted-2);
  font-size: 0.78rem;
}

.nut-kpi-macros__bar {
  display: flex;
  height: 0.35rem;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.65rem;
  background: rgba(255, 255, 255, 0.06);
}

.nut-kpi-macros__seg--p { background: #60a5fa; }
.nut-kpi-macros__seg--c { background: #fbbf24; }
.nut-kpi-macros__seg--f { background: #f472b6; }

.nut-kpi-section__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.nut-kpi-section__title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.nut-kpi-section__line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Journey table — layout ported from Split Planner (subgrid) */
.nut-kpi-dashboard .nut-journey-weeks-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(251, 191, 36, 0.92);
  text-transform: none;
  letter-spacing: normal;
  white-space: nowrap;
  line-height: 1.3;
  background: none;
  padding: 0;
  border-radius: 0;
}

.nut-kpi-dashboard .nut-journey-col-title {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  line-height: 1.3;
}

.nut-kpi-dashboard .nut-journey-col-date {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: normal;
  color: var(--white);
  line-height: 1.25;
}

.nut-kpi-dashboard .nut-kpi-journey-table {
  display: grid;
  grid-template-columns:
    minmax(7.5rem, 12rem)
    minmax(0.5rem, 1fr)
    minmax(6.5rem, 9rem)
    3.25rem
    minmax(6.5rem, 9rem)
    minmax(0.5rem, 1fr);
  column-gap: 0.85rem;
  row-gap: 0.35rem;
  align-items: center;
  width: 100%;
}

.nut-kpi-dashboard .nut-kpi-journey-table__head,
.nut-kpi-dashboard .nut-kpi-journey-table__row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: center;
}

.nut-kpi-dashboard .nut-kpi-journey-table__cell--gutter {
  display: block;
  min-width: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.nut-kpi-dashboard .nut-kpi-journey-table__head {
  padding: 0 0.65rem 0.55rem;
}

.nut-kpi-dashboard .nut-kpi-journey-table__head .nut-kpi-journey-table__cell--col {
  text-align: center;
  align-self: end;
}

.nut-kpi-dashboard .nut-kpi-journey-table__head .nut-kpi-journey-table__cell--label {
  align-self: end;
  text-align: start;
}

.nut-kpi-dashboard .nut-kpi-journey-table__head .nut-kpi-journey-table__cell--trend-head {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  text-align: center;
  align-self: end;
  min-width: 3.25rem;
}

.nut-kpi-dashboard .nut-kpi-journey-table__row {
  padding: 0.6rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.nut-kpi-dashboard .nut-kpi-journey-table__cell--label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-align: start;
  line-height: 1.35;
  padding-inline-end: 0.5rem;
  text-wrap: balance;
}

.nut-kpi-dashboard .nut-kpi-journey-table__cell--col {
  text-align: center;
}

.nut-kpi-dashboard .nut-kpi-journey-table__value {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--white);
  text-align: center;
  justify-self: center;
  width: 100%;
  min-height: 1.25em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.nut-kpi-dashboard .nut-kpi-journey-table__value.ltr-value {
  display: block;
  direction: ltr;
  unicode-bidi: isolate;
  text-align: center;
}

.nut-kpi-dashboard .nut-kpi-journey-table__value.nut-kpi-card__value--pending {
  font-size: 0.82rem;
  font-weight: 600;
}

.nut-kpi-dashboard .nut-kpi-journey-table__cell--trend {
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  width: 3.25rem;
}

.nut-kpi-dashboard .nut-journey-trend {
  color: var(--muted-2);
}

.nut-kpi-dashboard .nut-journey-trend--empty {
  visibility: hidden;
}

.nut-kpi-dashboard .nut-journey-trend-icon {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

.nut-kpi-dashboard .nut-journey-trend--positive {
  color: rgba(110, 231, 160, 0.95);
}

.nut-kpi-dashboard .nut-journey-trend--negative {
  color: rgba(252, 165, 165, 0.95);
}

.nut-kpi-dashboard .nut-journey-trend--neutral {
  color: rgba(13, 173, 242, 0.85);
}

.nut-kpi-dashboard .nut-journey-trend--flat {
  color: var(--muted-2);
}

@media (max-width: 479px) {
  .nut-kpi-dashboard .nut-kpi-journey-table {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    width: 100%;
  }

  .nut-kpi-dashboard .nut-kpi-journey-table__cell--gutter {
    display: none;
  }

  .nut-kpi-dashboard .nut-kpi-journey-table__head,
  .nut-kpi-dashboard .nut-kpi-journey-table__row {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    grid-column: auto;
    grid-template-columns: minmax(0, 1fr) minmax(2.25rem, auto) minmax(0, 1fr);
    column-gap: 0.45rem;
    box-sizing: border-box;
  }

  .nut-kpi-dashboard .nut-kpi-journey-table__head {
    padding-inline: 0.5rem;
  }

  .nut-kpi-dashboard .nut-kpi-journey-table__cell--label {
    grid-column: 1 / -1;
    margin-bottom: 0.1rem;
    padding-inline-end: 0;
  }

  .nut-kpi-dashboard .nut-kpi-journey-table__head .nut-kpi-journey-table__cell--label[aria-hidden="true"] {
    display: none;
  }

  .nut-kpi-dashboard .nut-kpi-journey-table__head .nut-kpi-journey-table__cell--trend-head {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nut-kpi-dashboard .nut-kpi-journey-table__cell--trend {
    width: auto;
    min-width: 2.25rem;
  }

  .nut-kpi-dashboard .nut-kpi-journey-table__value {
    font-size: 0.88rem;
    min-width: 0;
  }

  .nut-kpi-dashboard .nut-journey-col-title {
    font-size: 0.65rem;
  }

  .nut-kpi-dashboard .nut-journey-col-date {
    font-size: 0.72rem;
  }

  .nut-kpi-dashboard .nut-journey-weeks-badge {
    font-size: 0.65rem;
  }
}

.nut-kpi-journey-ratio-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.nut-kpi-journey-note {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted-2);
  flex: 1;
}

.composition-cheat-info-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--blue-bright);
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.composition-cheat-info-btn__icon {
  width: 1.1rem;
  height: 1.1rem;
}

/* ── Results / WhatsApp ── */
.nut-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.nut-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
  margin: 0;
}

.nut-wa-copy {
  color: #25d366 !important;
  border-color: rgba(37, 211, 102, 0.25) !important;
}

.nut-wa-copy:hover {
  border-color: rgba(37, 211, 102, 0.45) !important;
  color: #4ade80 !important;
}

.nut-wa-preview {
  width: 100%;
  min-height: 10rem;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--white);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  resize: vertical;
}

.nut-details {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

.nut-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nut-details summary::-webkit-details-marker {
  display: none;
}

.nut-details[open] summary {
  color: var(--blue-bright);
  margin-bottom: 0.75rem;
}

.nut-details__chevron {
  color: var(--muted-2);
  transition: transform 0.2s;
}

.nut-details[open] .nut-details__chevron {
  transform: rotate(180deg);
}

#nut-math-breakdown {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Modal (cheat sheet) ── */
.nut-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
}

.nut-modal-overlay:not(.hidden) {
  display: flex;
}

.nut-modal-overlay.hidden {
  display: none !important;
}

.nut-modal {
  width: min(56rem, 100%);
  max-height: min(92vh, 54rem);
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.nut-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--border);
}

.nut-modal__close {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--muted);
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.nut-modal__close:hover {
  color: var(--white);
}

.nut-modal__body {
  overflow-y: auto;
  padding: 1.15rem 1.35rem 1.5rem;
  font-size: 0.88rem;
  line-height: 1.55;
}

.composition-cheat-intro {
  color: var(--muted);
  margin: 0 0 1rem;
}

.composition-cheat-heading {
  font-size: 1rem;
  font-weight: 800;
  color: var(--white);
  margin: 1.25rem 0 0.5rem;
}

.composition-cheat-lead {
  color: var(--muted-2);
  font-size: 0.82rem;
  margin: 0 0 0.75rem;
}

.composition-cheat-table-wrap {
  overflow-x: auto;
  margin-bottom: 0.5rem;
}

.composition-cheat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.composition-cheat-table th,
.composition-cheat-table td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.55rem;
  text-align: center;
}

.composition-cheat-table__row-label {
  text-align: start !important;
  font-weight: 600;
  color: var(--muted);
}

.composition-cheat-table__row--current {
  background: var(--blue-dim);
}

.composition-cheat-table__cell--current {
  color: var(--blue-bright);
  font-weight: 700;
}

.composition-cheat-your {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-sm);
  background: var(--blue-dim);
  border: 1px solid rgba(13, 173, 242, 0.2);
}

.composition-cheat-chip {
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--surface-3);
}

.composition-cheat-level-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .composition-cheat-level-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.composition-cheat-level-card {
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-3);
  text-align: center;
}

.composition-cheat-bf-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .composition-cheat-bf-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.composition-cheat-bf-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.composition-cheat-bf-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.composition-cheat-disclaimer {
  margin-top: 1.25rem;
  font-size: 0.75rem;
  color: var(--muted-2);
}

/* ── Tooltip (hover, Split Planner style) ── */
#global-tooltip,
.nut-global-tooltip {
  position: fixed;
  z-index: 10050;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  max-width: min(20rem, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-md);
  background: rgba(12, 12, 12, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.55);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--white);
}

#global-tooltip .tooltip-title,
.nut-global-tooltip .tooltip-title {
  font-weight: 700;
  display: block;
  color: var(--white);
}

#global-tooltip .tooltip-subline,
.nut-global-tooltip .tooltip-subline {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

[dir="rtl"] .nut-kpi-dashboard .nut-kpi-journey-table__cell--label {
  text-align: start;
}

/* ── Toast ── */
.nut-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 6000;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--white);
  box-shadow: var(--shadow-soft);
}

.nut-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Utilities ── */
.hidden {
  display: none !important;
}

.ltr-value {
  direction: ltr;
  unicode-bidi: isolate;
}

.nut-meta {
  font-size: 0.78rem;
  color: var(--muted-2);
}

.nut-body {
  font-size: 0.88rem;
  color: var(--white);
}

.nut-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.nut-stack--sm {
  gap: 0.85rem;
}

.nut-check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.35rem;
}

.nut-amber {
  color: #fcd34d;
}

@media (max-width: 640px) {
  .nut-kpi-journey-table__head,
  .nut-kpi-journey-table__row {
    grid-template-columns: minmax(3.5rem, 1fr) 0.25rem 1fr 2rem 1fr 0.25rem;
    font-size: 0.75rem;
  }

  .nut-goal-grid {
    grid-template-columns: 1fr 1fr;
  }
}
