@import url("https://fonts.googleapis.com/css2?family=Fraunces:wght@400;600&family=Space+Grotesk:wght@400;500&display=swap");

:root {
  --bg: #f8f3ea;
  --bg-accent: #f2e6d5;
  --ink: #1f1b16;
  --muted: #6c5b4e;
  --card: #ffffff;
  --accent: #e0704f;
  --accent-dark: #c75737;
  --shadow: 0 18px 40px rgba(31, 27, 22, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 20%, #fff4e0, transparent 55%),
    radial-gradient(circle at 80% 0%, #f4d9c1, transparent 50%),
    linear-gradient(180deg, var(--bg), #fefaf4 65%);
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

h1,
h2,
h3 {
  font-family: "Fraunces", "Times New Roman", serif;
  margin: 0;
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 6px;
}

.sub {
  margin: 6px 0 0;
  color: var(--muted);
}

.status {
  background: var(--bg-accent);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hero-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.status-text {
  background: var(--bg-accent);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink);
}

.calorie-summary-top {
  background: linear-gradient(135deg, #e0704f 0%, #c75737 100%);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  padding: 10px 14px;
  box-shadow: 0 8px 18px rgba(199, 87, 55, 0.28);
}

.status-text.hidden {
  display: none;
}

.report-button {
  background: var(--card);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  display: inline-block;
  text-decoration: none;
  border: 1px solid rgba(108, 91, 78, 0.2);
  box-shadow: 0 6px 12px rgba(31, 27, 22, 0.08);
}

.report-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.report-footer {
  display: flex;
  justify-content: center;
  margin: 20px 0 40px;
}

.capture {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  margin-top: 28px;
}

.layout {
  display: grid;
  grid-template-columns: 152px minmax(0, 1fr);
  gap: 24px;
  margin-top: 28px;
}

.sidebar {
  position: sticky;
  top: 20px;
  align-self: start;
  background: var(--card);
  border-radius: 18px;
  padding: 14px 12px;
  box-shadow: var(--shadow);
  height: fit-content;
  width: 100%;
}

.sidebar h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

.dates-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.today-link {
  padding: 6px 10px;
  font-size: 12px;
  box-shadow: none;
}

.date-picker {
  display: grid;
  gap: 10px;
}

.date-picker label {
  display: grid;
  gap: 4px;
}

.spin-field {
  gap: 6px;
}

.date-picker span {
  font-size: 12px;
  color: var(--muted);
}

.spinner-control {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 8px;
}

.spin-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 10px;
  font-size: 16px;
  line-height: 1;
}

.spinner-control input {
  width: 100%;
  border: 1px solid #e0d5c7;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}

.date-picker-meta {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.date-strip-wrap {
  margin-top: 10px;
}

.date-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.date-chip {
  text-decoration: none;
  color: var(--ink);
  background: var(--bg-accent);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.date-chip.active {
  background: var(--accent);
  color: #fff;
}

.date-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 0;
  -webkit-overflow-scrolling: touch;
  justify-items: center;
}

.date-link {
  text-decoration: none;
  color: var(--ink);
  background: var(--bg-accent);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  width: 100%;
  max-width: 108px;
  text-align: center;
}

.date-link.active {
  background: var(--accent);
  color: #fff;
}

.content {
  display: grid;
  gap: 28px;
}

.panel {
  background: var(--card);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
}


.controls {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.toggle {
  display: flex;
  gap: 12px;
  font-size: 14px;
}

.toggle label {
  background: var(--bg-accent);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

input[type="text"] {
  border: 1px solid #e0d5c7;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}

.notes-label {
  font-size: 13px;
  color: var(--muted);
}

#notesBlock,
.notes-block {
  width: 100%;
}

#visionPreviewBlock {
  width: 100%;
  display: grid;
  gap: 8px;
}

.predict-preview {
  position: relative;
  width: min(240px, 100%);
  height: 180px;
  border-radius: 16px;
  border: 1px solid #eadfce;
  background: #fff;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.predict-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

textarea#description {
  width: 100%;
  border: 1px solid #e0d5c7;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  min-height: 220px;
  max-height: 500px;
  resize: none;
  overflow-y: auto;
}

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

.capture-submit {
  margin-left: auto;
  margin-top: 0;
  align-self: center;
}

.recent-modal {
  max-width: min(92vw, 820px);
}

.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 10px;
  max-height: 60vh;
  overflow-y: auto;
}

.recent-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.recent-item {
  border: 1px solid #e6d7c5;
  border-radius: 10px;
  background: #fff;
  padding: 6px;
  display: grid;
  gap: 6px;
  text-align: left;
}

.recent-item.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(224, 112, 79, 0.2);
}

.recent-item img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
}

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

button,
.file {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

button:hover,
.file:hover {
  background: var(--accent-dark);
}

.file input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file {
  position: relative;
  overflow: hidden;
}

.datetime {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  max-width: 240px;
}

.datetime input {
  border: 1px solid #e0d5c7;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}

.file.secondary {
  background: #ffe9dc;
  color: var(--accent-dark);
}

.file.secondary:hover {
  background: #ffd9c6;
}

button.secondary {
  background: #ffe9dc;
  color: var(--accent-dark);
}

button.secondary:hover {
  background: #ffd9c6;
}


.timeline {
  margin-top: 36px;
}

.hour {
  margin-top: 24px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--shadow);
  position: relative;
}

.card-top {
  position: relative;
}

.card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 12px;
  cursor: pointer;
}

.delete {
  position: absolute;
  top: -10px;
  right: -10px;
  border: none;
  background: transparent;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 16px;
  cursor: pointer;
  color: #d22026;
}

.edit {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  border: none;
  background: transparent;
  border-radius: 0;
  width: auto;
  height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink);
  padding: 0;
}
.meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.tag {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.calorie-tag {
  background: #ffe8c6;
  color: #8a4f09;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: none;
  letter-spacing: 0.02em;
  font-weight: 600;
  font-size: 14px;
}

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

.hidden {
  display: none;
}

.overlay.hidden {
  display: none;
}

.edit-modal {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  max-width: 640px;
  width: min(94vw, 640px);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  position: relative;
}

.edit-modal h2 {
  margin: 0 0 10px;
}

.edit-form {
  display: grid;
  gap: 12px;
}

.edit-type {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.edit-preview {
  margin-top: 6px;
  position: relative;
}

.edit-preview img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 12px;
}

.edit-textarea {
  width: 100%;
  min-height: 180px;
  max-height: 520px;
  border: 1px solid #e0d5c7;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  overflow-y: auto;
}

.edit-textarea.vision-box {
  min-height: 320px;
  max-height: 700px;
  background: #faf6f0;
  color: #4a3a2c;
}

.edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.inline-toggle input {
  accent-color: var(--accent);
}

.edit-actions .secondary {
  background: var(--bg-accent);
  color: var(--ink);
}

.edit-actions .save {
  background: var(--accent);
  color: #fff;
}

.notes-block {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.notes-edit {
  width: 100%;
  border: 1px solid #e0d5c7;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  min-height: 240px;
  max-height: 520px;
  resize: vertical;
  overflow-y: auto;
}

.activity-options,
.sleep-options {
  margin-top: 6px;
}

.activity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  font-size: 14px;
}

.activity-grid label {
  background: var(--bg-accent);
  padding: 8px 10px;
  border-radius: 10px;
}

.activity-time {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.time-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

#activityStart,
#activityEnd,
#activityDuration,
#sleepStart,
#sleepEnd,
#sleepDuration {
  border: 1px solid #e0d5c7;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.pill {
  background: var(--bg-accent);
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.sleep-hours {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.sleep-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #efe4d6;
  margin-top: 6px;
  overflow: hidden;
}

.sleep-fill {
  display: block;
  height: 100%;
  background: #8fb3a5;
}

.sleep-avg {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 16px;
  background: #d22026;
}

.sleep-range {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.level-high {
  color: #1f7a4d;
}

.level-mid {
  color: #4a9b6a;
}

.level-low {
  color: #c98b1f;
}

.level-very-low {
  color: #b65050;
}

.sleep-bar.level-high {
  background: #dff2e6;
}

.sleep-bar.level-mid {
  background: #e7f3ea;
}

.sleep-bar.level-low {
  background: #f7eed9;
}

.sleep-bar.level-very-low {
  background: #f3dddd;
}

.sleep-bar.level-high .sleep-fill {
  background: #2f9a67;
}

.sleep-bar.level-mid .sleep-fill {
  background: #5db07d;
}

.sleep-bar.level-low .sleep-fill {
  background: #d6a94a;
}

.sleep-bar.level-very-low .sleep-fill {
  background: #d87272;
}

.activity-bar.level-high {
  background: #dff2e6;
}

.activity-bar.level-mid {
  background: #e7f3ea;
}

.activity-bar.level-low {
  background: #f7eed9;
}

.activity-bar.level-very-low {
  background: #f3dddd;
}

.activity-bar.level-high .activity-fill {
  background: #2f9a67;
}

.activity-bar.level-mid .activity-fill {
  background: #5db07d;
}

.activity-bar.level-low .activity-fill {
  background: #d6a94a;
}

.activity-bar.level-very-low .activity-fill {
  background: #d87272;
}

.activity-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #e4efe9;
  margin-top: 6px;
  overflow: hidden;
}

.activity-fill {
  display: block;
  height: 100%;
  background: #7fa7c5;
}

.activity-avg {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 16px;
  background: #d22026;
}

.card-top.no-image {
  display: grid;
  place-items: center;
  height: 90px;
  background: #f4e8da;
  border-radius: 12px;
}

.no-image-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: capitalize;
  display: grid;
  gap: 4px;
  justify-items: center;
}

.no-image-label::first-line {
  font-size: 20px;
}

.activity-options,
.sleep-options {
  margin-top: 6px;
}

.activity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  font-size: 14px;
}

.activity-grid label {
  background: var(--bg-accent);
  padding: 8px 10px;
  border-radius: 10px;
}

#sleepHours {
  border: 1px solid #e0d5c7;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.pill {
  background: var(--bg-accent);
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.sleep-hours {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.card-top.no-image {
  display: grid;
  place-items: center;
  height: 90px;
  background: #f4e8da;
  border-radius: 12px;
}

.no-image-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: capitalize;
  display: grid;
  gap: 4px;
  justify-items: center;
}

.no-image-label::first-line {
  font-size: 20px;
}

.save-notes {
  justify-self: start;
  background: #f2e6d5;
  color: var(--accent-dark);
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.save-notes:hover {
  background: #ead8c7;
}

.save-notes.saved {
  background: #d9efe1;
  color: #24543a;
}

.save-notes:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}


.hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .hero-actions {
    justify-items: start;
  }

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

  .sidebar {
    position: static;
    width: fit-content;
    min-width: 0;
    max-width: 146px;
    margin: 0 auto;
  }

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

  .date-list {
    max-height: 200px;
  }
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 12, 10, 0.4);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  z-index: 50;
}

.image-modal {
  background: #111;
  border-radius: 16px;
  padding: 12px;
  max-width: min(92vw, 900px);
  max-height: 90vh;
  display: grid;
  gap: 10px;
  position: relative;
}

.image-modal img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 12px;
}

.image-modal .close {
  position: absolute;
  top: 6px;
  right: 10px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 26px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  cursor: pointer;
}

.overlay-card {
  background: #fff;
  border-radius: 18px;
  padding: 20px 22px;
  display: grid;
  gap: 12px;
  align-items: center;
  justify-items: center;
  box-shadow: var(--shadow);
  width: min(280px, 80vw);
  text-align: center;
}

.spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 4px solid #f1d7c7;
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 640px) {
  .shell {
    padding: 20px 16px 48px;
  }

  .video-frame {
    display: none;
  }

  .hero {
    padding: 18px;
  }

  .actions {
    flex-direction: column;
  }

  .actions#actionsRow {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .datetime {
    width: 100%;
  }

  .datetime input {
    width: 100%;
  }

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

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

  button,
  .file {
    width: 100%;
    text-align: center;
    padding: 14px 16px;
    font-size: 16px;
  }

  .actions#actionsRow button,
  .actions#actionsRow .file {
    width: auto;
    padding: 10px 12px;
    font-size: 14px;
  }

  .actions#actionsRow .capture-submit {
    margin-left: auto;
    order: 10;
  }

  .sidebar {
    width: fit-content;
    min-width: 0;
    max-width: 156px;
    margin: 0 auto;
    padding: 12px 10px;
  }

  .dates-head {
    justify-content: center;
    flex-wrap: wrap;
  }

  .date-picker-meta {
    text-align: center;
  }

  .date-list {
    max-height: 180px;
  }

  input[type="text"] {
    font-size: 16px;
  }

  textarea#description {
    font-size: 16px;
    min-height: 240px;
    max-height: 560px;
  }

  .notes-edit {
    font-size: 15px;
    min-height: 280px;
    max-height: 560px;
  }
}
