@import url('https://api.fontshare.com/v2/css?f[]=satoshi@400,500,600,700&display=swap');

:root {
  --teal: #01696f;
  --teal-light: #e8f4f4;
  --teal-dark: #015256;
  --bg: #f9f7f4;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #888;
  --border: #ebebeb;
  --warn: #e65100;
  --warn-light: #fff3e0;
  --good: #1b6b3a;
  --good-light: #e8f5e9;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(0,0,0,0.07);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111;
    --card: #1c1c1e;
    --text: #f2f2f7;
    --muted: #888;
    --border: #2c2c2e;
    --teal-light: #0a2e30;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Satoshi', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  padding-bottom: 80px; /* space for sticky action bar */
}

/* ── Nav ───────────────────────────────────────────────────────── */
.nav {
  background: var(--teal);
  color: white;
  padding: 14px 20px 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-title { font-size: 17px; font-weight: 700; flex: 1; }
.nav-day { font-size: 13px; opacity: 0.8; background: rgba(255,255,255,0.15); border-radius: 20px; padding: 3px 12px; }
.nav-links { display: flex; gap: 4px; overflow-x: auto; padding: 0 16px 10px; background: var(--teal-dark); }
.nav-link { color: rgba(255,255,255,0.75); text-decoration: none; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 20px; white-space: nowrap; transition: background 0.15s; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.18); color: white; }

/* ── Layout ─────────────────────────────────────────────────────── */
.page { max-width: 480px; margin: 0 auto; padding: 16px; }

/* ── Cards ─────────────────────────────────────────────────────── */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
.card-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 12px; }

/* ── KPI row ─────────────────────────────────────────────────────── */
.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 12px; text-align: center; }
.kpi-value { font-size: 22px; font-weight: 700; color: var(--teal); line-height: 1.1; }
.kpi-label { font-size: 11px; color: var(--muted); margin-top: 3px; font-weight: 500; }

/* ── Medications ─────────────────────────────────────────────────── */
.med-list { display: flex; flex-direction: column; gap: 10px; }
.med-row { display: flex; align-items: flex-start; gap: 10px; }
.med-icon { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; }
.med-name { font-size: 15px; font-weight: 600; }
.med-meta { font-size: 12px; color: var(--muted); }

/* ── Meal slots ─────────────────────────────────────────────────── */
.meal-list { display: flex; flex-direction: column; gap: 12px; }
.meal-item { border-left: 3px solid var(--teal); padding-left: 12px; }
.meal-slot-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--teal); margin-bottom: 2px; }
.meal-dish { font-size: 15px; font-weight: 600; color: var(--text); }
.meal-note { font-size: 12px; color: var(--muted); font-style: italic; margin-top: 1px; }
.sequence-badge { display: inline-block; font-size: 10px; background: var(--teal-light); color: var(--teal); border-radius: 4px; padding: 2px 7px; margin-top: 3px; font-weight: 600; }

/* ── Empty state ─────────────────────────────────────────────────── */
.empty { text-align: center; padding: 32px 20px; color: var(--muted); }
.empty-icon { font-size: 32px; margin-bottom: 10px; }
.empty-text { font-size: 14px; }

/* ── Sticky action bar ─────────────────────────────────────────────── */
.action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  padding: 10px 16px 18px;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}
.action-btn {
  flex: 1;
  background: var(--teal);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s;
}
.action-btn:hover { background: var(--teal-dark); }
.action-btn.secondary { background: var(--teal-light); color: var(--teal); }
.action-btn.secondary:hover { background: #c8e8e8; }

/* ── Week plan table ─────────────────────────────────────────────── */
.week-table { width: 100%; border-collapse: collapse; }
.week-table th { background: var(--teal); color: white; padding: 8px 10px; font-size: 12px; text-align: left; }
.week-table td { padding: 10px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: top; }
.week-table tr:hover td { background: var(--teal-light); }
.meal-td-label { font-size: 10px; font-weight: 700; color: var(--teal); text-transform: uppercase; }
.meal-td-name { font-weight: 600; }

/* ── Upload ─────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.drop-zone.dragover { border-color: var(--teal); background: var(--teal-light); }
.drop-zone-icon { font-size: 36px; margin-bottom: 10px; }
.drop-zone-text { font-size: 15px; font-weight: 600; color: var(--text); }
.drop-zone-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ── Verdict card ─────────────────────────────────────────────────── */
.verdict-good { border-left: 4px solid #1b6b3a; background: var(--good-light); }
.verdict-caution { border-left: 4px solid #e65100; background: var(--warn-light); }
.verdict-avoid { border-left: 4px solid #c62828; background: #ffebee; }
.verdict-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.verdict-line { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.verdict-list { font-size: 13px; color: #444; padding-left: 16px; }
.verdict-list li { margin-bottom: 4px; }
.allergen-alert { background: #ffebee; border: 1px solid #ef9a9a; border-radius: 8px; padding: 10px 14px; font-size: 14px; font-weight: 600; color: #c62828; margin-bottom: 12px; }

/* ── Reports charts ─────────────────────────────────────────────── */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chart-card { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 14px; }
.chart-card-title { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.chart-value-row { display: flex; align-items: baseline; gap: 6px; margin-bottom: 6px; }
.chart-value { font-size: 20px; font-weight: 700; }
.chart-unit { font-size: 12px; color: var(--muted); }
.chart-change { font-size: 12px; font-weight: 600; }
.good { color: var(--good); }
.warn { color: var(--warn); }

/* ── Loading ─────────────────────────────────────────────────────── */
.spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid rgba(1,105,111,0.2); border-top-color: var(--teal); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 999; display: none; }
.loading-card { background: white; border-radius: 16px; padding: 28px 32px; text-align: center; }
.loading-card .spinner { width: 36px; height: 36px; border-width: 4px; margin-bottom: 14px; }
.loading-card p { font-size: 15px; font-weight: 600; color: var(--text); }

/* ── Misc ─────────────────────────────────────────────────────── */
.badge { display: inline-block; border-radius: 20px; padding: 3px 12px; font-size: 12px; font-weight: 600; }
.badge-teal { background: var(--teal); color: white; }
.badge-light { background: var(--teal-light); color: var(--teal); }
.btn { display: inline-block; border-radius: 10px; padding: 11px 20px; font-size: 14px; font-weight: 700; cursor: pointer; border: none; text-decoration: none; transition: background 0.15s; }
.btn-primary { background: var(--teal); color: white; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-ghost { background: var(--teal-light); color: var(--teal); }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
input[type=file] { display: none; }
img.preview-img { max-width: 100%; border-radius: 10px; margin-top: 12px; }
