/* ==========================================================================
   VitalScale Standalone PWA Design System (Zero External Dependencies)
   Warm botanical-clinical Light & Deep Slate Dark themes
   ========================================================================== */

:root {
  --background: #f5f7f4;
  --content: #edf1ec;
  --card: #ffffff;
  --border: #d7dfd5;
  --card-border: #e4ebe2;
  --foreground: #18231c;
  --muted-foreground: #546459;
  --primary: #1f7a5c;
  --primary-foreground: #ffffff;
  --secondary: #e7efe9;
  --secondary-foreground: #1a3328;
  --link: #186a4f;
  --success: #218358;
  --warning: #c87a19;
  --error: #c43c3c;
  --chart-1: #1f7a5c;
  --chart-2: #d18a2a;
  --chart-3: #3c6ea8;
}

:root.dark {
  --background: #101613;
  --content: #17201c;
  --card: #1b2520;
  --border: #2c3b33;
  --card-border: #25332c;
  --foreground: #edf3ef;
  --muted-foreground: #9fb0a5;
  --primary: #3bb085;
  --primary-foreground: #091812;
  --secondary: #223029;
  --secondary-foreground: #dce8e1;
  --link: #56c99d;
  --success: #3bb085;
  --warning: #e3a241;
  --error: #e06363;
  --chart-1: #3bb085;
  --chart-2: #e3a241;
  --chart-3: #649bd8;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, p { margin: 0; }
table { border-spacing: 0; }

.tabular-nums { font-variant-numeric: tabular-nums; }
.antialiased { -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
.block { display: block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-baseline { align-items: baseline; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.min-w-0 { min-width: 0; }
.min-w-\[400px\] { min-width: 400px; }
.min-w-\[460px\] { min-width: 460px; }
.max-w-6xl { max-width: 72rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mx-1 { margin-left: 0.25rem; margin-right: 0.25rem; }
.ml-1 { margin-left: 0.25rem; }
.mt-0\.5 { margin-top: 0.125rem; }
.mt-3 { margin-top: 0.75rem; }
.mb-1 { margin-bottom: 0.25rem; }

.w-full { width: 100%; }
.w-2\.5 { width: 0.625rem; }
.w-5 { width: 1.25rem; }
.w-6 { width: 1.5rem; }
.w-7 { width: 1.75rem; }
.w-10 { width: 2.5rem; }
.w-20 { width: 5rem; }
.h-full { height: 100%; }
.h-auto { height: auto; }
.h-2\.5 { height: 0.625rem; }
.h-5 { height: 1.25rem; }
.h-8 { height: 2rem; }
.h-10 { height: 2.5rem; }
.h-\[34px\] { height: 34px; }

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.col-span-2 { grid-column: span 2 / span 2; }

.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-2\.5 { gap: 0.625rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

.space-y-0\.5 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.125rem; }
.space-y-1 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.25rem; }
.space-y-1\.5 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.375rem; }
.space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.5rem; }
.space-y-2\.5 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.625rem; }
.space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.75rem; }
.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem; }
.space-y-5 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.25rem; }

.p-0\.5 { padding: 0.125rem; }
.p-2 { padding: 0.5rem; }
.p-2\.5 { padding: 0.625rem; }
.p-3 { padding: 0.75rem; }
.p-3\.5 { padding: 0.875rem; }
.p-4 { padding: 1rem; }
.px-1\.5 { padding-left: 0.375rem; padding-right: 0.375rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-2\.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-3\.5 { padding-left: 0.875rem; padding-right: 0.875rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.pt-1 { padding-top: 0.25rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-3 { padding-top: 0.75rem; }
.pt-4 { padding-top: 1rem; }
.pb-1 { padding-bottom: 0.25rem; }
.pb-1\.5 { padding-bottom: 0.375rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-4 { padding-bottom: 1rem; }
.pl-2 { padding-left: 0.5rem; }
.pr-2 { padding-right: 0.5rem; }

.rounded { border-radius: 0.25rem; }
.rounded-sm { border-radius: 0.125rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }

.border { border: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-b-2 { border-bottom: 2px solid transparent; }
.border-transparent { border-color: transparent; }
.border-\[var\(--border\)\] { border-color: var(--border); }
.border-\[var\(--card-border\)\] { border-color: var(--card-border); }
.border-\[var\(--primary\)\] { border-color: var(--primary); }
.border-\[var\(--success\)\] { border-color: var(--success); }
.border-collapse { border-collapse: collapse; }
.divide-y > :not([hidden]) ~ :not([hidden]) { border-top: 1px solid var(--card-border); }
.last\:border-b-0:last-child { border-bottom: 0; }

.bg-\[var\(--background\)\] { background-color: var(--background); }
.bg-\[var\(--content\)\] { background-color: var(--content); }
.bg-\[var\(--card\)\] { background-color: var(--card); }
.bg-\[var\(--primary\)\] { background-color: var(--primary); }
.bg-\[var\(--secondary\)\] { background-color: var(--secondary); }
.bg-\[var\(--success\)\] { background-color: var(--success); }

.text-\[var\(--foreground\)\] { color: var(--foreground); }
.text-\[var\(--muted-foreground\)\] { color: var(--muted-foreground); }
.text-\[var\(--primary\)\] { color: var(--primary); }
.text-\[var\(--primary-foreground\)\] { color: var(--primary-foreground); }
.text-\[var\(--secondary-foreground\)\] { color: var(--secondary-foreground); }
.text-\[var\(--link\)\] { color: var(--link); }
.accent-\[var\(--primary\)\] { accent-color: var(--primary); }

.text-xs { font-size: 0.75rem; line-height: 1.1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.6rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.uppercase { text-transform: uppercase; }
.tracking-tight { letter-spacing: -0.02em; }
.tracking-wider { letter-spacing: 0.05em; }
.leading-relaxed { line-height: 1.6; }
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.line-through { text-decoration: line-through; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-nowrap { white-space: nowrap; }
.list-disc { list-style-type: disc; }
.list-inside { list-style-position: inside; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.opacity-85 { opacity: 0.85; }
.cursor-pointer { cursor: pointer; }
.transition { transition: all 0.15s ease; }
.transition-all { transition: all 0.25s ease; }
.duration-300 { transition-duration: 300ms; }

.hover\:opacity-90:hover { opacity: 0.9; }
.hover\:underline:hover { text-decoration: underline; }
.hover\:bg-\[var\(--content\)\]:hover { background-color: var(--content); }
.hover\:bg-\[var\(--secondary\)\]:hover { background-color: var(--secondary); }
.hover\:border-\[var\(--primary\)\]:hover { border-color: var(--primary); }
.hover\:text-\[var\(--foreground\)\]:hover { color: var(--foreground); }
.focus\:outline-none:focus { outline: none; }
.focus\:border-\[var\(--primary\)\]:focus { border-color: var(--primary); }

@media (min-width: 640px) {
  .sm\:flex-row { flex-direction: row; }
  .sm\:items-center { align-items: center; }
  .sm\:justify-between { justify-content: space-between; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sm\:col-span-1 { grid-column: span 1 / span 1; }
  .sm\:p-5 { padding: 1.25rem; }
  .sm\:px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
  .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
  .sm\:py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
  .sm\:text-sm { font-size: 0.875rem; line-height: 1.25rem; }
  .sm\:text-base { font-size: 1rem; line-height: 1.5rem; }
  .sm\:text-xl { font-size: 1.25rem; line-height: 1.75rem; }
  .sm\:text-right { text-align: right; }
}
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .lg\:col-span-2 { grid-column: span 2 / span 2; }
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.tint-primary { background-color: color-mix(in srgb, var(--primary) 12%, transparent); }
.tint-success { background-color: color-mix(in srgb, var(--success) 14%, transparent); }
.tint-warning { background-color: color-mix(in srgb, var(--warning) 14%, transparent); }
.tint-chart-1 { background-color: color-mix(in srgb, var(--chart-1) 14%, transparent); }
.tint-chart-2 { background-color: color-mix(in srgb, var(--chart-2) 14%, transparent); }
.tint-chart-3 { background-color: color-mix(in srgb, var(--chart-3) 14%, transparent); }

.amt-chip {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
  background-color: color-mix(in srgb, var(--primary) 12%, transparent);
  padding: 0 4px;
  border-radius: 4px;
  white-space: nowrap;
}

.fade-in { animation: fadeIn 0.2s ease-out; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ==========================================================================
   Diet4U additions: safety check, consent, legal footer
   ========================================================================== */
.text-\[var\(--warning\)\] { color: var(--warning); }
.d4-home-link { color: var(--primary); text-decoration: none; }
.d4-home-link:hover { text-decoration: underline; }
.d4-linkbtn { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; font-size: inherit; }
.d4-danger { color: var(--error); }
.d4-danger:hover { background: color-mix(in srgb, var(--error) 10%, transparent); }
.d4-consent { display: flex; gap: 0.5rem; align-items: flex-start; color: var(--muted-foreground); line-height: 1.45; }
.d4-consent input { margin-top: 0.15rem; accent-color: var(--primary); flex-shrink: 0; }
.d4-consent a, .d4-check a, .d4-disclaimer a { color: var(--link); }
.d4-disclaimer { line-height: 1.5; }
.d4-footlink { color: var(--link); text-decoration: none; }
.d4-footlink:hover { text-decoration: underline; }

body.gate-open { overflow: hidden; }
.d4-gate { position: fixed; inset: 0; z-index: 50; background: rgba(8, 16, 12, 0.62); display: flex; align-items: flex-start; justify-content: center; padding: 1rem; overflow-y: auto; }
.d4-gate-card { background: var(--card); color: var(--foreground); border: 1px solid var(--border); border-radius: 1rem; max-width: 36rem; width: 100%; margin: 2vh auto; padding: 1.4rem 1.4rem 1.2rem; display: flex; flex-direction: column; gap: 0.85rem; box-shadow: 0 24px 60px rgba(0,0,0,0.28); }
.d4-gate-card h2 { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.01em; }
.d4-muted { color: var(--muted-foreground); font-size: 0.85rem; }
.d4-gate-card fieldset { border: 1px solid var(--card-border); border-radius: 0.75rem; padding: 0.7rem 0.85rem 0.8rem; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.d4-gate-card legend { font-size: 0.8rem; font-weight: 600; padding: 0 0.3rem; }
.d4-check { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.85rem; line-height: 1.45; cursor: pointer; }
.d4-check input { width: 1.05rem; height: 1.05rem; margin-top: 0.12rem; accent-color: var(--primary); flex-shrink: 0; }
.d4-check-strong { font-weight: 550; }
.d4-advice { background: color-mix(in srgb, var(--warning) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--border)); border-radius: 0.75rem; padding: 0.7rem 0.85rem; font-size: 0.82rem; line-height: 1.5; }
.d4-advice ul { list-style: disc; padding-left: 1.1rem; margin-top: 0.35rem; display: flex; flex-direction: column; gap: 0.35rem; }
.d4-error { color: var(--error); font-size: 0.82rem; min-height: 1em; }
.d4-gate-actions { display: flex; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.d4-btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.6rem 1rem; border-radius: 0.6rem; font-weight: 600; font-size: 0.85rem; text-decoration: none; cursor: pointer; border: 1px solid transparent; }
.d4-btn-primary { background: var(--primary); color: var(--primary-foreground); }
.d4-btn-primary:hover { opacity: 0.92; }
.d4-btn-ghost { background: transparent; color: var(--foreground); border-color: var(--border); }
.d4-btn-ghost:hover { background: var(--secondary); }
