/* ========================================================
   UI refresh (18 Nov 2026) — loaded last, so it only restyles; no behaviour changes.
   App bar on every screen, clearer page titles, one button style, styled chips,
   jar list as cards on phones, calmer colours.
   ======================================================== */

:root {
  --bg-dark: #f4f5f7;
  --bg-card: #ffffff;
  --border-color: #e6e8ec;
  --border-color-hover: #cfd4dc;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff4ff;
  --primary-glow: rgba(37, 99, 235, 0.14);
  --accent-teal: #0d9488;          /* used by app.js but was never defined */
  --text-color: var(--text-main);  /* same */
  --text-main: #111827;
  --text-muted: #4b5563;
  --text-dark: #6b7280;
  --radius-card: 16px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.04);
  --appbar-h: 60px;
}

/* every control uses the app font (buttons fell back to Arial) */
button, input, select, textarea { font-family: inherit; }

/* ── App bar ── */
.app-bar {
  position: sticky; top: 0; z-index: 150;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border-color);
}
.app-bar-inner {
  max-width: 480px; margin: 0 auto; height: var(--appbar-h);
  padding: 0 16px; display: flex; align-items: center; gap: 12px;
}
.app-bar-logo {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: linear-gradient(145deg, #2563eb, #1e40af);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.app-bar-logo .material-icons { color: #fff; font-size: 22px; }
.app-bar-brand { flex: 1; min-width: 0; line-height: 1.15; }
.app-bar-brand small {
  display: block; font-size: 10.5px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--text-dark);
}
.app-bar-brand strong { display: block; font-size: 17px; font-weight: 800; color: var(--text-main); letter-spacing: -0.2px; }
.app-bar .profile-pill {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--primary-soft); border: 1px solid #c7d7fe;
  color: var(--primary); font-weight: 800; font-size: 16px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.app-bar .profile-pill:active { transform: scale(0.95); }
/* no app bar on the login screen; the old in-page profile icon is replaced by the app bar's */
.app-frame:has(#login-screen.active) .app-bar { display: none; }
.screen .profile-pill { display: none; }

.screen-viewport { padding-top: 18px; }

/* ── Page titles: title big, description small ── */
.home-header { margin-bottom: 18px; align-items: flex-start; }
.home-header .greeting {
  font-size: 22px; font-weight: 800; color: var(--text-main); letter-spacing: -0.4px; line-height: 1.2;
}
.home-header .name {
  font-size: 13px !important; font-weight: 500 !important; color: var(--text-dark) !important;
  margin-top: 4px !important; letter-spacing: 0; line-height: 1.4;
}

/* ── Cards (the screens use inline white cards) ── */
.screen > div[style*="border-radius: 16px"],
.screen > div[style*="border-radius:16px"],
.stat-card {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow-card) !important;
}
.screen h3 { font-size: 15.5px !important; font-weight: 750; letter-spacing: -0.1px; }

/* ── Stat tiles ── */
.stat-card { border-radius: var(--radius-card); }
.stat-number { letter-spacing: -0.5px; }

/* ── Buttons ── */
.login-btn {
  background: var(--primary);
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
  font-size: 15px;
}
.login-btn:hover { background: var(--primary-hover); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3); }
.btn-action-secondary { border-radius: 12px; background: #fff; }
.btn-action-secondary:hover { background: #f9fafb; }

/* ── Inputs ── */
.login-input, .screen select, .screen textarea, .screen input[type="text"], .screen input[type="number"] {
  border-radius: 10px !important;
  border-color: var(--border-color) !important;
  background: #fff !important;
}
.login-input:focus, .screen select:focus, .screen textarea:focus, .screen input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--primary-glow);
  outline: none;
}
#login-screen .login-input { background: #fff !important; border-radius: 14px !important; }

/* ── Filter chips (were plain browser buttons) ── */
.filter-chip {
  flex: none; white-space: nowrap;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--border-color); background: #fff;
  color: var(--text-muted); font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.filter-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
#recipe-category-chips { scrollbar-width: none; }
#recipe-category-chips::-webkit-scrollbar { display: none; }

/* ── Home (18 Nov): greeting, scan cards, numbers, fermenting jars ── */
.home-hero { margin: 2px 0 16px; }
.home-hello { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; color: var(--text-main); line-height: 1.2; }
.home-date { font-size: 13px; color: var(--text-dark); margin-top: 3px; font-weight: 500; }

.scan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.scan-card {
  position: relative; overflow: hidden; text-align: left;
  display: flex; flex-direction: column; align-items: flex-start;
  min-height: 150px; padding: 16px 14px 14px; border: none; border-radius: 20px;
  color: #fff; cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease;
}
.scan-card::after {           /* soft circle in the corner */
  content: ''; position: absolute; right: -28px; top: -28px; width: 110px; height: 110px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.12);
}
.scan-card:active { transform: scale(0.97); }
.scan-new { background: linear-gradient(150deg, #22c55e 0%, #15803d 100%); box-shadow: 0 8px 20px rgba(22, 163, 74, 0.28); }
.scan-old { background: linear-gradient(150deg, #fb923c 0%, #c2410c 100%); box-shadow: 0 8px 20px rgba(234, 88, 12, 0.28); }
.scan-ic {
  width: 42px; height: 42px; border-radius: 13px; background: rgba(255, 255, 255, 0.22);
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.scan-ic .material-icons { font-size: 26px; color: #fff; }
.scan-title { font-size: 18px; font-weight: 800; letter-spacing: -0.2px; }
.scan-sub { font-size: 12.5px; opacity: 0.92; margin-top: 2px; font-weight: 500; }
.scan-cta {
  margin-top: auto; padding-top: 12px; display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 800;
}
.scan-cta .material-icons { font-size: 17px; }

.home-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: #fff; border: 1px solid var(--border-color); border-radius: 16px;
  box-shadow: var(--shadow-card); margin-bottom: 20px;
}
.hstat {
  background: none; border: none; cursor: pointer; padding: 12px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.hstat + .hstat { border-left: 1px solid var(--border-color); }
.hstat-num { font-size: 22px; font-weight: 800; color: var(--text-main); letter-spacing: -0.5px; }
.hstat-lbl { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--text-dark); }
.hstat-lbl .material-icons { font-size: 14px; }
.hstat:active { background: #f9fafb; }

.home-section { margin-bottom: 8px; scroll-margin-top: calc(var(--appbar-h) + 10px); }
.home-section-head { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 10px; }
.home-section-head h3 { font-size: 16px !important; font-weight: 800; margin: 0; }
.home-link {
  display: inline-flex; align-items: center; gap: 3px; text-decoration: none;
  font-size: 12.5px; font-weight: 700; color: var(--primary);
}
.home-link .material-icons { font-size: 15px; }

.jar-list { display: flex; flex-direction: column; gap: 10px; }
.jar-card {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  background: #fff; border: 1px solid var(--border-color); border-radius: 16px;
  padding: 12px 14px; box-shadow: var(--shadow-card);
}
.jar-card:active { background: #f8fafc; }
.jar-num {
  flex: none; width: 52px; height: 52px; border-radius: 14px;
  background: var(--primary-soft); color: var(--primary);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800; line-height: 1;
}
.jar-num small { font-size: 9px; font-weight: 800; letter-spacing: 0.8px; opacity: 0.75; margin-bottom: 3px; }
.jar-main { flex: 1; min-width: 0; }
.jar-prod { font-size: 15px; font-weight: 750; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jar-meta { font-size: 12.5px; color: var(--text-dark); margin-top: 2px; }
.jar-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.jar-pill {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: #ecfdf5; color: #047857;
}
.jar-pill.warn { background: #fffbeb; color: #b45309; }
.jar-pill.bad { background: #fef2f2; color: #b91c1c; }
.jar-pill.ok { background: #eff6ff; color: #1d4ed8; }
.jar-empty {
  text-align: center; padding: 26px 16px; color: var(--text-dark); font-size: 13.5px; line-height: 1.6;
  background: #fff; border: 1px dashed var(--border-color-hover); border-radius: 16px;
}
.jar-empty .material-icons { display: block; font-size: 30px; color: #9ca3af; margin-bottom: 4px; }
.home-note { text-align: center; font-size: 12px; color: var(--text-dark); margin-top: 12px; }

/* ── QA feed items (were grey boxes) ── */
#qa-inquiries-list > div { background: #f9fafb !important; border-color: var(--border-color) !important; }

/* ── Bottom tab bar: floating rounded bar ── */
.tab-bar {
  left: 50%; transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  width: calc(100% - 20px); max-width: 460px;
  padding: 6px;
  border: 1px solid var(--border-color);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  box-shadow: 0 8px 28px rgba(16, 24, 40, 0.12), 0 1px 3px rgba(16, 24, 40, 0.06);
}
.tab-item {
  gap: 2px; padding: 6px 0 5px; border-radius: 16px; min-width: 0;
  color: #6b7280; transition: color 0.2s, background 0.2s;
}
.tab-item .material-icons {
  font-size: 23px; transform: none !important;
  font-variation-settings: normal;
}
.tab-item.active { color: var(--primary); background: var(--primary-soft); }
.tab-item:active { background: #f3f4f6; }
.tab-item.active:active { background: #e3ecff; }
.tab-item span:last-child {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tab-item.active span:last-child { font-weight: 800; }

/* room for the floating bar + voice button at the end of every screen */
.screen-viewport { padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }

/* ── Voice button: brand colour, smaller, no constant pulse; sits above the floating bar ── */
.voice-fab {
  width: 52px; height: 52px; right: max(16px, calc(50% - 224px));
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  background: var(--primary);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
  animation: none;
}

/* ── The hidden "Speaking…" toast left a shadow at the top of every screen ── */
.tts-toast:not(.show) { box-shadow: none !important; opacity: 0; pointer-events: none; }

/* ── Login ── */
.login-logo { background: linear-gradient(145deg, #2563eb, #1e40af); box-shadow: 0 10px 24px rgba(37, 99, 235, 0.25); }
.login-header h1 { background: none; -webkit-text-fill-color: var(--text-main); color: var(--text-main); }

/* ── 21 Nov 2026: inside the phone app (html.in-app, set in index.html) ──
   The app already keeps the page above the phone's buttons, and Android 15's WebView adds the same
   safe-area again, which lifted the tab bar far above the bottom. Here the safe-area is not added again
   and the bar sits close to the bottom edge. */
html.in-app .tab-bar { bottom: 6px; }
html.in-app .screen-viewport { padding-bottom: 140px; }
html.in-app .voice-fab { bottom: 86px; }
.jar-pill.nf { background: #f1f5f9; color: #475569; }   /* (21 Nov) no fermentation */
