:root {
  /* Curated Warm Botanical HSL Palette */
  --bg-page: hsl(38, 33%, 96%);
  --bg-shell: hsl(40, 40%, 99%);
  --bg-surface: hsl(0, 0%, 100%);
  --bg-subtle: hsl(38, 25%, 94%);
  --bg-highlight: hsl(152, 42%, 95%);

  --text-primary: hsl(160, 25%, 12%);
  --text-secondary: hsl(160, 12%, 38%);
  --text-muted: hsl(160, 8%, 54%);

  --brand-primary: hsl(154, 48%, 26%);
  --brand-primary-hover: hsl(154, 52%, 21%);
  --brand-accent: hsl(152, 45%, 38%);
  --brand-soft: hsl(152, 38%, 91%);

  --symptom-amber: hsl(28, 84%, 52%);
  --symptom-soft: hsl(32, 90%, 94%);
  --danger: hsl(4, 74%, 49%);
  --danger-soft: hsl(4, 80%, 95%);

  --border-light: hsl(36, 18%, 88%);
  --border-focus: hsl(154, 48%, 32%);

  --shadow-xs: 0 1px 2px rgba(20, 36, 28, 0.05);
  --shadow-sm: 0 4px 12px rgba(20, 36, 28, 0.06);
  --shadow-md: 0 10px 28px rgba(20, 36, 28, 0.1);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html,
body {
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
}

.app-shell {
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  background-color: var(--bg-shell);
  box-shadow: 0 0 40px rgba(20, 36, 28, 0.08);
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(253, 252, 249, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark-img {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  object-fit: cover;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

.brand-mark-img-lg {
  width: 80px;
  height: 80px;
  border-radius: 22px;
  object-fit: cover;
  margin-bottom: 12px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--brand-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.app-subtitle {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-pill {
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--brand-soft);
  color: var(--brand-primary);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

/* Toast Banner */
.toast-banner {
  position: fixed;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  background: var(--text-primary);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  max-width: 90vw;
  text-align: center;
}

/* Views */
.view-container {
  flex: 1;
  padding: 16px;
}

.auth-view {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px 18px;
}

.auth-portal-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 22px;
}

.brand-mark-lg {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.portal-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.portal-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  box-shadow: var(--shadow-sm);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}

.auth-tab {
  min-height: 42px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-tab.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

.section-heading {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.section-heading-sm {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-subtext {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

/* Forms & Inputs */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 390px) {
  .form-row-2col {
    grid-template-columns: 1fr;
  }
}

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

.field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.field-input,
.field-textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s ease;
}

.field-textarea {
  min-height: 88px;
  resize: vertical;
}

.field-input:focus,
.field-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

.error-box {
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.verify-email-banner {
  background: var(--bg-highlight);
  border: 1px solid hsl(152, 35%, 78%);
  color: var(--text-primary);
  font-size: 0.84rem;
  line-height: 1.45;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
}

.verify-code-input {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-align: center;
  min-height: 54px;
}

.verify-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.btn-ghost-sm:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Buttons */
.btn-primary {
  min-height: 48px;
  padding: 0 18px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--brand-primary);
  color: #fff;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover {
  background: var(--brand-primary-hover);
}

.btn-primary:active {
  transform: scale(0.99);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--brand-primary);
  border-radius: var(--radius-sm);
  background: var(--bg-highlight);
  color: var(--brand-primary);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-full {
  width: 100%;
}

.btn-ghost-sm {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-chip {
  min-height: 34px;
  padding: 4px 11px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-chip:hover {
  background: var(--bg-highlight);
  border-color: var(--brand-accent);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Date Strip */
.date-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  margin-bottom: 14px;
}

.date-strip-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.date-picker-native {
  border: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

.date-human-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* Quick Log Action Cards */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.action-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.action-card:hover {
  border-color: var(--brand-accent);
  transform: translateY(-1px);
}

.action-photo {
  background: linear-gradient(180deg, hsl(152, 42%, 96%) 0%, hsl(0, 0%, 100%) 100%);
}

.action-symptom {
  background: linear-gradient(180deg, hsl(32, 85%, 96%) 0%, hsl(0, 0%, 100%) 100%);
}

.action-icon {
  font-size: 1.4rem;
}

.action-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
}

.action-caption {
  font-size: 0.66rem;
  color: var(--text-secondary);
  line-height: 1.25;
}

/* Day Stats Bar */
.day-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-meal {
  background: var(--brand-primary);
}

.dot-item {
  background: hsl(172, 55%, 36%);
}

.dot-symptom {
  background: var(--symptom-amber);
}

/* Timeline Feed */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-state {
  background: var(--bg-surface);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
  padding: 28px 18px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.timeline-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-xs);
}

.timeline-card.symptom-entry {
  border-left: 4px solid var(--symptom-amber);
  background: hsl(34, 65%, 99%);
}

.timeline-card.meal-entry {
  border-left: 4px solid var(--brand-primary);
}

.entry-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.entry-badge-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-meal-type {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--brand-soft);
  color: var(--brand-primary);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}

.badge-symptom {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--symptom-soft);
  color: hsl(24, 80%, 36%);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}

.entry-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.entry-photo-thumb {
  width: 100%;
  max-height: 210px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  border: 1px solid var(--border-light);
}

.entry-summary {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.food-items-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.food-item-row {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.food-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.food-item-title-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.food-item-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.food-item-portion {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--text-secondary);
}

.components-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.comp-tag {
  font-size: 0.69rem;
  font-weight: 500;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 1px 7px;
  border-radius: var(--radius-pill);
}

.entry-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.entry-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-edit-sm {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  color: var(--brand-primary);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  padding: 3px 9px;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.btn-edit-sm:hover {
  background: var(--bg-highlight);
  border-color: var(--brand-accent);
}

.items-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-delete-sm {
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
}

/* Calendar View */
.calendar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.calendar-title {
  font-size: 1rem;
  font-weight: 700;
}

.calendar-legend {
  display: flex;
  gap: 14px;
  justify-content: center;
  font-size: 0.73rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day-btn {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.cal-day-btn.selected {
  border-color: var(--brand-primary);
  background: var(--brand-soft);
}

.cal-day-btn.empty {
  background: transparent;
  cursor: default;
}

.cal-dots {
  display: flex;
  gap: 3px;
  height: 6px;
}

.detail-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

/* Analytics View */
.analytics-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.window-selector {
  display: flex;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-sm);
}

.window-btn {
  border: none;
  background: transparent;
  padding: 5px 9px;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 7px;
  cursor: pointer;
}

.window-btn.active {
  background: var(--bg-surface);
  color: var(--brand-primary);
  box-shadow: var(--shadow-xs);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  text-align: center;
}

.kpi-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--brand-primary);
}

.kpi-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.analytics-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
}

.card-title {
  font-size: 0.96rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.card-subtitle {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.quick-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.bar-chart-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bar-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.bar-label-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
}

.bar-track {
  width: 100%;
  height: 8px;
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--brand-primary);
  border-radius: var(--radius-pill);
}

.bar-fill.comp-fill {
  background: hsl(172, 50%, 34%);
}

/* SIGHI 0-3 Histamine Scoring Badges & Bars */
.sighi-legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.sighi-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  line-height: 1.3;
  white-space: nowrap;
}

.sighi-0 {
  background: hsl(148, 52%, 92%);
  color: hsl(152, 65%, 24%);
  border-color: hsl(148, 45%, 78%);
}

.sighi-1 {
  background: hsl(44, 92%, 90%);
  color: hsl(34, 85%, 28%);
  border-color: hsl(42, 80%, 72%);
}

.sighi-2 {
  background: hsl(24, 95%, 91%);
  color: hsl(18, 84%, 34%);
  border-color: hsl(22, 85%, 75%);
}

.sighi-3 {
  background: hsl(0, 86%, 92%);
  color: hsl(356, 75%, 36%);
  border-color: hsl(0, 75%, 78%);
}

.comp-tag.sighi-comp-0 {
  background: hsl(148, 45%, 95%);
  color: hsl(152, 58%, 25%);
  border-color: hsl(148, 40%, 80%);
}

.comp-tag.sighi-comp-1 {
  background: hsl(44, 88%, 93%);
  color: hsl(34, 82%, 28%);
  border-color: hsl(42, 75%, 75%);
}

.comp-tag.sighi-comp-2 {
  background: hsl(24, 92%, 93%);
  color: hsl(18, 82%, 34%);
  border-color: hsl(22, 80%, 78%);
}

.comp-tag.sighi-comp-3 {
  background: hsl(0, 85%, 94%);
  color: hsl(356, 74%, 36%);
  border-color: hsl(0, 72%, 80%);
}

.comp-sighi-num {
  font-family: var(--font-mono);
  font-size: 0.64rem;
}

.bar-fill.sighi-bar-0 {
  background: hsl(152, 55%, 36%);
}

.bar-fill.sighi-bar-1 {
  background: hsl(40, 88%, 46%);
}

.bar-fill.sighi-bar-2 {
  background: hsl(22, 88%, 50%);
}

.bar-fill.sighi-bar-3 {
  background: hsl(358, 76%, 48%);
}

.bar-item-title-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.bar-count-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.histamine-bar-row {
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border-light);
}

.histamine-bar-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.histamine-sub-header {
  margin-top: 16px;
  margin-bottom: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.occurrence-mini-list {
  margin-top: 10px;
  border-top: 1px solid var(--border-light);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.occurrence-item {
  font-size: 0.76rem;
  display: flex;
  justify-content: space-between;
  background: var(--bg-subtle);
  padding: 6px 8px;
  border-radius: 8px;
}

/* Agent Panel */
.agent-intro-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
}

.agent-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--brand-soft);
  color: var(--brand-primary);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  margin-bottom: 6px;
}

.agent-prompts-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prompt-suggestion-btn {
  text-align: left;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
}

.prompt-suggestion-btn:hover {
  background: var(--bg-highlight);
  border-color: var(--brand-accent);
}

.agent-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  min-height: 180px;
}

.chat-bubble {
  padding: 11px 13px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--brand-primary);
  color: #fff;
  max-width: 85%;
}

.chat-bubble.agent {
  align-self: stretch;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

.tool-trace-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--brand-primary);
  background: var(--brand-soft);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  display: inline-block;
  margin-bottom: 6px;
}

.agent-input-bar {
  display: flex;
  gap: 8px;
}

/* Floating Action Button & Bottom Nav */
.fab-agent {
  position: fixed;
  right: max(16px, calc(50vw - 224px));
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  z-index: 35;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--text-primary);
  color: #fff;
  padding: 11px 16px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-light);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
}

.nav-item {
  border: none;
  background: transparent;
  min-height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
}

.nav-item.active {
  color: var(--brand-primary);
  background: var(--bg-highlight);
}

.nav-icon {
  font-size: 1.15rem;
}

/* Modals / Bottom Sheets */
.sheet-modal {
  border: none;
  border-radius: 22px 22px 0 0;
  width: 100%;
  max-width: 480px;
  margin: auto auto 0 auto;
  background: var(--bg-surface);
  color: var(--text-primary);
  padding: 0;
  box-shadow: var(--shadow-md);
  max-height: 92dvh;
  overflow-y: auto;
}

.sheet-modal::backdrop {
  background: rgba(15, 25, 20, 0.48);
  backdrop-filter: blur(2px);
}

.modal-inner {
  padding: 18px 16px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.mode-btn {
  min-height: 40px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.mode-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

.modal-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.photo-source-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-photo-source {
  min-height: 52px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, hsl(152, 42%, 96%) 0%, hsl(0, 0%, 100%) 100%);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.btn-photo-source:hover,
.btn-photo-source:active {
  border-color: var(--brand-primary);
  transform: translateY(-1px);
}

.photo-source-icon {
  font-size: 1.2rem;
}

.camera-dropzone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  min-height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px;
  cursor: pointer;
  overflow: hidden;
}

.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.camera-big-icon {
  font-size: 2rem;
}

.camera-prompt-title {
  font-size: 0.88rem;
  font-weight: 700;
}

.camera-prompt-sub {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.photo-preview-wrap img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 10px;
}

.loading-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-highlight);
  color: var(--brand-primary);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--brand-soft);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

.clarification-box {
  background: var(--symptom-soft);
  border: 1px solid hsl(32, 70%, 80%);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.clarify-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: hsl(24, 80%, 30%);
}

.clarify-list {
  padding-left: 18px;
  font-size: 0.8rem;
  color: var(--text-primary);
}

.clarify-input-row {
  display: flex;
  gap: 6px;
}

.items-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.extracted-items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.editable-item-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.editable-item-top {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Symptom Options Grid */
.symptom-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.symptom-option-btn {
  text-align: left;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s ease;
}

.symptom-option-btn.selected {
  border-color: var(--symptom-amber);
  background: var(--symptom-soft);
}

.sym-opt-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sym-opt-desc {
  display: block;
  font-size: 0.68rem;
  color: var(--text-secondary);
  line-height: 1.25;
  margin-top: 2px;
}

.range-slider {
  width: 100%;
  accent-color: var(--symptom-amber);
  height: 36px;
}
