/* calTrack */
:root {
  --bg: #f6f8f7;
  --card: #ffffff;
  --text: #0f1f17;
  --muted: #6b7a72;
  --border: #e3e9e5;
  --brand: #ffa07a; /* light salmon: fills */
  --brand-h: #ff8a65; /* fill hover */
  --brand-d: #c4553a; /* readable text/icons */
  --brand-2: #ff7f50;
  --on-brand: #4a1d0f; /* text on salmon fills */
  --soft: #fff3ee;
  --red: #dc2626;
  --p: #6366f1;
  --c: #0d9488;
  --f: #ec4899;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 20, 0.04), 0 8px 24px rgba(16, 24, 20, 0.06);
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family:
    "Plus Jakarta Sans",
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}
main.wrap {
  flex: 1;
  padding-top: 32px;
  padding-bottom: 110px;
}
a {
  color: var(--brand-d);
}
h1 {
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.2;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
h2 {
  font-size: 18px;
  margin: 0 0 14px;
}
h3 {
  font-size: 16px;
  margin: 0;
}
code {
  background: var(--soft);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}
.wrap {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 13.5px;
}
.row {
  display: flex;
  align-items: center;
}
.between {
  justify-content: space-between;
}
.end {
  justify-content: flex-end;
  margin-top: 16px;
}
.center {
  justify-content: center;
}
.gap {
  gap: 10px;
  flex-wrap: wrap;
}
.neg {
  color: var(--red) !important;
}

/* Nav */
.nav {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 19px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14.5px;
  padding: 8px 12px;
  border-radius: 10px;
}
.nav-links a:hover {
  background: var(--soft);
  color: var(--text);
}
.nav-links a.active {
  background: var(--soft);
  color: var(--brand-d);
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.guest-bar {
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  color: #92400e;
  text-align: center;
  font-size: 14px;
  padding: 8px 16px;
}
.guest-bar a {
  color: #92400e;
  font-weight: 700;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background 0.15s,
    box-shadow 0.15s,
    transform 0.05s;
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: 0 4px 14px rgba(255, 160, 122, 0.35);
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-h);
}
.btn-ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--soft);
}
.btn-danger {
  background: #fff;
  color: var(--red);
  border-color: #fecaca;
}
.btn-danger:hover {
  background: #fef2f2;
}
.btn-sm {
  padding: 7px 12px;
  font-size: 14px;
  border-radius: 10px;
}
.btn-lg {
  padding: 14px 24px;
  font-size: 16px;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.card.no-pad {
  padding: 0;
  overflow: hidden;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.grid-2 > .card {
  margin-bottom: 0;
}
.grid-2 + .card {
  margin-top: 18px;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head p {
  margin: 0;
}
.back {
  display: inline-block;
  margin-bottom: 14px;
  text-decoration: none;
  font-weight: 600;
}

/* Alerts */
.alert {
  border-radius: 12px;
  padding: 12px 16px;
  margin: 0 0 18px;
  font-size: 14.5px;
}
.alert-ok {
  background: #ecfdf3;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}
.alert-err {
  background: #fef2f2;
  color: var(--red);
  border: 1px solid #fecaca;
}
.alert[hidden] {
  display: none;
}
main > .alert,
.wrap > .alert {
  margin-top: 18px;
}

/* Landing */
.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 40px;
  align-items: center;
  padding: 30px 0 40px;
}
.pill {
  display: inline-block;
  background: var(--soft);
  color: var(--brand-d);
  font-weight: 700;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
}
.hero h1 {
  font-size: clamp(34px, 6vw, 56px);
  margin: 16px 0;
}
.grad {
  background: linear-gradient(90deg, var(--brand-d), var(--brand-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lead {
  font-size: 18px;
  color: var(--muted);
  max-width: 540px;
  margin: 0 0 24px;
}
.hero-card {
  padding: 0;
  overflow: hidden;
  transform: rotate(1.5deg);
}
.mock-photo {
  height: 200px;
  display: grid;
  place-items: center;
  font-size: 90px;
  background: linear-gradient(135deg, #ffe4d6, #fff1e8);
  overflow: hidden;
}
.mock-photo {
  position: relative;
}
.mock-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.mock-photo img.on {
  opacity: 1;
}
.dish-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
}
.dish-dots button {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: var(--border);
  cursor: pointer;
  transition: width 0.3s, background 0.3s;
}
.dish-dots button.on {
  width: 18px;
  background: var(--brand);
}
@media (prefers-reduced-motion: reduce) {
  .mock-photo img,
  .dish-dots button {
    transition: none;
  }
}
.mock-photo svg {
  width: 80px;
  height: 80px;
  stroke-width: 1.25;
  color: var(--brand-d);
}
.mock-body {
  padding: 18px;
}
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.step p {
  color: var(--muted);
  margin: 6px 0 0;
  font-size: 14.5px;
}
.step-n {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--soft);
  color: var(--brand-d);
  font-weight: 800;
  margin-bottom: 10px;
}

/* Macros & chips */
.kcal {
  font-weight: 800;
  color: var(--brand-d);
  white-space: nowrap;
}
.macro-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.chip {
  font-size: 13px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
}
.chip.p {
  background: #eef2ff;
  color: var(--p);
}
.chip.c {
  background: #f0fdfa;
  color: #0f766e;
}
.chip.f {
  background: #fdf2f8;
  color: #be185d;
}
.chip.fib {
  background: #f5f5f4;
  color: #57534e;
}
.tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--soft);
  border: 1px solid #ffd5c2;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14.5px;
  margin-top: 16px;
}
.tip svg {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 2px;
  color: var(--brand-d);
}
.macro {
  margin-bottom: 14px;
}
.bar {
  height: 10px;
  background: #eef2f0;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}
.bar span {
  display: block;
  height: 100%;
  border-radius: 99px;
}
.bar .p {
  background: var(--p);
}
.bar .c {
  background: var(--c);
}
.bar .f {
  background: var(--f);
}

/* Ring */
.ring-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ring {
  width: 200px;
  height: 200px;
}
.ring-bg {
  fill: none;
  stroke: #eef2f0;
  stroke-width: 14;
}
.ring-fg {
  fill: none;
  stroke: url(#none);
  stroke: var(--brand);
  stroke-width: 14;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
}
.ring-fg.over {
  stroke: var(--red);
}
.ring-num {
  font-size: 36px;
  font-weight: 800;
  text-anchor: middle;
  fill: var(--text);
}
.ring-sub {
  font-size: 13px;
  text-anchor: middle;
  fill: var(--muted);
}
.ring-left {
  font-weight: 700;
  margin: 6px 0 0;
  color: var(--brand-d);
}

/* Meal list */
.count {
  background: var(--soft);
  color: var(--brand-d);
  font-weight: 800;
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 99px;
}
.meal-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.meal-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
}
.meal-row:hover {
  background: var(--bg);
}
.meal-row img,
.thumb-ph {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  object-fit: cover;
  flex: none;
  background: var(--soft);
  display: grid;
  place-items: center;
  font-size: 24px;
}
.thumb-ph svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.75;
  color: var(--brand-d);
}
.meal-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.meal-info strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.empty {
  text-align: center;
  padding: 26px 10px;
  color: var(--muted);
}
.empty p {
  margin: 0 0 14px;
}

/* Snap */
.snap-card {
  max-width: 640px;
  margin: 0 auto;
}
.drop {
  display: grid;
  place-items: center;
  min-height: 300px;
  border: 2px dashed #c7d6cd;
  border-radius: 16px;
  background: var(--bg);
  cursor: pointer;
  text-align: center;
  overflow: hidden;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.drop:hover,
.drop.drag {
  border-color: var(--brand);
  background: var(--soft);
}
.drop span#drop-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
}
.drop-icon {
  font-size: 44px;
}
.drop-icon svg {
  width: 44px;
  height: 44px;
  stroke-width: 1.5;
  color: var(--brand-d);
}
.drop img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  display: block;
}
.progress {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: grid;
  gap: 8px;
}
.progress li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14.5px;
}
.progress li::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex: none;
}
.progress li.active {
  color: var(--text);
}
.progress li.active::before {
  border-color: var(--brand);
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
}
.progress li.done {
  color: var(--brand-d);
}
.progress li.done::before {
  content: "✓";
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
  font-size: 11px;
  display: grid;
  place-items: center;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Meal detail */
.meal-photo {
  width: 100%;
  height: 100%;
  max-height: 420px;
  object-fit: cover;
  display: block;
}
.big-kcal {
  font-size: 44px;
  font-weight: 800;
  color: var(--brand-d);
  letter-spacing: -0.02em;
}
.big-kcal span {
  font-size: 18px;
  color: var(--muted);
  font-weight: 600;
}
.table-wrap {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
.table th,
.table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}
.table th {
  color: var(--muted);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.table .num {
  text-align: right;
}
.table tfoot td {
  font-weight: 800;
  border-bottom: none;
}

/* History */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.stat {
  display: flex;
  flex-direction: column;
}
.stat strong {
  font-size: 30px;
  letter-spacing: -0.02em;
}
.chart {
  position: relative;
  height: 220px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 0 0 26px;
}
.col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
}
.col-bar {
  width: 100%;
  max-width: 56px;
  background: linear-gradient(180deg, #ffc3a8, var(--brand));
  border-radius: 10px 10px 4px 4px;
  min-height: 2px;
  position: relative;
}
.col-bar.over {
  background: linear-gradient(180deg, #f87171, var(--red));
}
.col-bar span {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.col-label {
  position: absolute;
  bottom: -24px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}
.goal-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 2px dashed #94a3b8;
  margin-bottom: 26px;
  z-index: 1;
  pointer-events: none;
}
.goal-line span {
  position: absolute;
  right: 0;
  top: -20px;
  font-size: 11.5px;
  color: var(--muted);
  background: #fff;
  padding: 0 4px;
}
.day h3 {
  margin-bottom: 6px;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
}
.form input,
.form select {
  font: inherit;
  font-weight: 500;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.form input:focus,
.form select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--soft);
}
.form input:disabled {
  background: var(--bg);
  color: var(--muted);
}

/* About */
.arch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.arch.sub {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
}
.node {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
  min-width: 120px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 24px;
}
.node strong {
  font-size: 15px;
}
.node span {
  font-size: 12.5px;
  color: var(--muted);
}
.node.aws {
  border-color: #fed7aa;
  background: #fff7ed;
}
.node svg {
  width: 26px;
  height: 26px;
  stroke-width: 1.75;
  margin-bottom: 6px;
  color: var(--muted);
}
.node.aws svg {
  color: #ea580c;
}
.arrow {
  font-size: 22px;
  color: var(--muted);
}
.authors {
  margin-top: 18px;
}
.authors-list {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
}
.authors-list div {
  display: flex;
  flex-direction: column;
}

/* Guest dashboard */
.save-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--soft);
  border: 1px solid #ffd5c2;
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.save-banner strong {
  display: block;
}
.guest-empty {
  max-width: 560px;
  margin: 10px auto;
  text-align: center;
  padding: 36px 28px;
}
.guest-empty p {
  margin: 0 0 20px;
}
.center-text {
  text-align: center;
}

/* Login / sign up */
.auth-wrap {
  display: flex;
  justify-content: center;
  padding: 12px 0 24px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 32px 28px;
}
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.auth-tabs a {
  flex: 1;
  text-align: center;
  padding: 10px;
  margin-bottom: -1px;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.auth-tabs a:hover {
  color: var(--text);
}
.auth-tabs a.active {
  color: var(--brand-d);
  border-bottom-color: var(--brand);
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-form .btn {
  width: 100%;
  margin-top: 4px;
}
.form .auth-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}
.form .auth-check input {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--brand-d);
}
.auth-hint {
  margin: -6px 0 0;
}

/* Locked / error */
.locked {
  max-width: 560px;
  margin: 30px auto;
  text-align: center;
  padding: 40px 28px;
}
.lock {
  font-size: 48px;
}
.lock svg {
  width: 48px;
  height: 48px;
  stroke-width: 1.5;
  color: var(--muted);
}

/* Floating snap button */
.fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--brand);
  color: var(--on-brand);
  text-decoration: none;
  font-weight: 800;
  padding: 15px 20px;
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(255, 127, 80, 0.4);
}
.fab:hover {
  background: var(--brand-h);
}

.footer {
  border-top: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  padding: 18px 0;
  text-align: center;
}

@media (max-width: 760px) {
  .hide-sm {
    display: none !important;
  }
  .nav-inner {
    gap: 8px;
  }
  .nav-links a {
    padding: 7px 8px;
    font-size: 14px;
  }
  .brand {
    font-size: 0;
    gap: 0;
  }
  .hero,
  .grid-2,
  .steps,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .hero {
    gap: 24px;
    padding-top: 10px;
  }
  .hero-card {
    transform: none;
  }
  .stats {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
  }
  .stat {
    padding: 14px;
  }
  .stat strong {
    font-size: 22px;
  }
  .chart {
    gap: 6px;
  }
  .col-bar span {
    display: none;
  }
  .fab {
    padding: 16px;
  }
}
