:root {
  --teal: #2bbfb3;
  --teal-d: #1a9e93;
  --teal-l: #e6faf9;
  --navy: #0d3b52;
  --navy-m: #1a5270;
  --navy-l: #e8f2f8;
  --bg: #f4fafa;
  --surf: #fff;
  --bord: #dff0ee;
  --text: #0d2d3a;
  --sub: #3a6472;
  --muted: #5a8a99;
  --grad: linear-gradient(135deg, #2bbfb3 0%, #1a7fa8 55%, #0d3b52 100%);
  font-family: "Plus Jakarta Sans", "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
  color: var(--text);
  background: #eaf6f6;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: calc(21px + 2pt); line-height: 1.38; font-weight: 900; letter-spacing: 0; }
h2 { font-size: calc(18px + 2pt); font-weight: 900; color: var(--text); }
h3 { font-size: calc(15px + 2pt); font-weight: 900; }

.appShell {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: 86px;
  box-shadow: 0 0 0 1px rgba(13, 59, 82, .05);
}

header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 18px 12px;
  background: rgba(255,255,255,.94);
  border-bottom: 1.5px solid var(--bord);
  backdrop-filter: blur(16px);
  box-shadow: 0 2px 16px rgba(43,191,179,.1);
}

.langToggle {
  width: 38px;
  height: 34px;
  border: 1.5px solid rgba(43,191,179,.5);
  border-radius: 14px;
  background: var(--teal-l);
  color: var(--teal-d);
  font-size: calc(11px + 2pt);
  font-weight: 900;
  flex: 0 0 auto;
}

.logoLockup { display: flex; align-items: center; gap: 10px; }
.brandLogoImage {
  display: block;
  width: min(236px, 58vw);
  height: auto;
  object-fit: contain;
}
.authPanel .brandLogoImage {
  width: min(300px, 72vw);
}
header .brandLogoImage {
  width: min(210px, 52vw);
}
.logoLockup small {
  display: block;
  margin-top: 1px;
  font-size: calc(10px + 2pt);
  line-height: 1;
  color: var(--sub);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 800;
}
.logo { font-size: calc(20px + 2pt); font-weight: 900; letter-spacing: 0; line-height: 1; }
.logo span { color: var(--teal); }
.logo b { color: var(--navy); }

.logoMark {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  overflow: visible;
}
.logoMark ellipse {
  fill: none;
  stroke: rgba(43,191,179,.25);
  stroke-width: 2;
}
.logoMark path:nth-of-type(1) { fill: var(--teal); stroke: none; }
.logoMark path:nth-of-type(2) { fill: var(--navy); stroke: none; }
.logoMark line {
  stroke: rgba(255,255,255,.55);
  stroke-width: 2.5;
}
.logoMark path:nth-of-type(3) {
  fill: none;
  stroke: #fff;
  stroke-width: 6.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.logoMark.onDark ellipse { stroke: transparent; }

.pillCount, .iconButton {
  border: 1.5px solid rgba(43,191,179,.5);
  background: var(--teal-l);
  border-radius: 20px;
  padding: 5px 12px;
  color: var(--teal-d);
  font-size: calc(11px + 2pt);
  font-weight: 900;
}

.screen {
  padding: 16px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeUp .28s ease;
}

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(145deg, var(--teal-l) 0%, #e0f4f8 52%, var(--navy-l) 100%);
}
.authPanel {
  position: relative;
  width: min(440px, 100%);
  background: rgba(255,255,255,.96);
  border: 1.5px solid rgba(43,191,179,.38);
  border-radius: 26px;
  padding: 26px 22px;
  box-shadow: 0 12px 42px rgba(43,191,179,.18), 0 2px 8px rgba(13,59,82,.08);
}
.authPanel .langToggle {
  position: absolute;
  top: 18px;
  left: 18px;
}
.authPanel .logoLockup {
  padding-left: 48px;
}
.authPanel .logoLockup { margin-bottom: 18px; }
.authPanel h1 { font-size: calc(24px + 2pt); color: var(--text); }
.authPanel p { margin: 10px 0 20px; color: var(--sub); line-height: 1.7; font-size: calc(13px + 2pt); }
.form { display: grid; gap: 10px; }
.signupForm .row { margin-top: 4px; }
.stepHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--teal-l);
  border: 1.5px solid rgba(43,191,179,.32);
  border-radius: 14px;
  padding: 10px 12px;
}
.stepHeader strong { color: var(--navy); font-size: calc(13px + 2pt); font-weight: 900; }
.stepHeader span { color: var(--teal-d); font-size: calc(12px + 2pt); font-weight: 900; }
.checkLine {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--sub);
  font-size: calc(13px + 2pt);
  font-weight: 800;
}
.checkLine input { width: auto; }
.idleOverlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(13, 59, 82, .42);
  backdrop-filter: blur(5px);
}
.idleModal {
  width: min(420px, 100%);
  border: 1.5px solid var(--bord);
  border-radius: 18px;
  background: #fff;
  padding: 22px;
  box-shadow: 0 18px 50px rgba(13, 59, 82, .22);
}
.idleModal h2 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: calc(20px + 2pt);
}
.idleModal p {
  margin: 0 0 10px;
  color: var(--sub);
  line-height: 1.65;
  font-size: calc(13px + 2pt);
}
.idleModal small {
  display: block;
  margin-bottom: 18px;
  color: #d35400;
  font-weight: 800;
  font-size: calc(11px + 2pt);
}
.guardianChoice {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1.5px solid var(--bord);
  border-radius: 14px;
  padding: 10px 12px;
}
.guardianChoice span { color: var(--sub); font-size: calc(13px + 2pt); font-weight: 900; }
.activeChoice {
  border-color: rgba(43,191,179,.55);
  background: var(--teal-l);
  color: var(--teal-d);
}

input, select, textarea {
  width: 100%;
  border: 1.5px solid var(--bord);
  border-radius: 13px;
  padding: 11px 14px;
  background: #f8fcfc;
  color: var(--text);
  outline: none;
  font-size: calc(13px + 2pt);
}
textarea { line-height: 1.65; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: rgba(43,191,179,.7);
  box-shadow: 0 0 0 4px rgba(43,191,179,.1);
  background: #fff;
}

.primary, .secondary, .linkButton {
  border: 0;
  border-radius: 15px;
  padding: 12px 16px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: calc(13px + 2pt);
  font-weight: 900;
}
.primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 4px 18px rgba(43,191,179,.38);
}
.secondary {
  background: #fff;
  border: 1.5px solid var(--bord);
  color: var(--navy);
}
.secondary.glass {
  background: rgba(255,255,255,.86);
  border-color: rgba(43,191,179,.45);
}
.linkButton { margin-top: 12px; width: 100%; background: transparent; color: var(--teal-d); }
.small { padding: 7px 12px; font-size: calc(11px + 2pt); border-radius: 11px; }
.wide { width: 100%; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > button { flex: 1; min-width: 0; }

.adRail {
  width: 100%;
  overflow: hidden;
  border: 1.5px solid var(--bord);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 6px 22px rgba(13,59,82,.1);
}
.adTrack {
  display: flex;
  width: max-content;
  animation: adSlideLeft 20s ease-in-out infinite;
}
.adRail:hover .adTrack { animation-play-state: paused; }
.adSlide {
  position: relative;
  flex: 0 0 calc(min(480px, 100vw) - 32px);
  aspect-ratio: 6 / 1;
  overflow: hidden;
  color: var(--navy);
  text-decoration: none;
}
.adSlide img { width: 100%; height: 100%; display: block; object-fit: cover; }
.adCopy {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 8px 46% 8px 16px;
  background: linear-gradient(90deg, rgba(255,255,255,.97) 0%, rgba(255,255,255,.82) 55%, transparent 76%);
}
.adCopy small { color: var(--teal-d); font-size: calc(10px + 2pt); font-weight: 900; }
.adCopy strong { font-size: calc(13px + 2pt); line-height: 1.2; }
.adCopy em { color: var(--sub); font-size: calc(9px + 2pt); line-height: 1.2; font-style: normal; }

.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, var(--teal-l) 0%, #e0f4f8 50%, var(--navy-l) 100%);
  border: 1.5px solid rgba(43,191,179,.4);
  border-radius: 26px;
  padding: 26px 22px 24px;
  display: grid;
  gap: 14px;
  box-shadow: 0 8px 32px rgba(43,191,179,.14);
}
.hero::before {
  content: "";
  position: absolute;
  top: -42px;
  right: -42px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(43,191,179,.16), transparent 68%);
}
.hero::after {
  content: "";
  position: absolute;
  bottom: -34px;
  left: 8px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(13,59,82,.08), transparent 70%);
}
.hero > * { position: relative; z-index: 1; }
.hero .logoLockup { margin-bottom: 2px; }
.hero h1 { color: var(--text); }
.hero p {
  max-width: 310px;
  color: var(--sub);
  font-size: calc(13px + 2pt);
  line-height: 1.7;
}

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.stats div {
  background: var(--teal-l);
  border: 1.5px solid rgba(43,191,179,.25);
  border-radius: 18px;
  padding: 15px 8px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(13,59,82,.06);
}
.stats div:nth-child(2) { background: var(--navy-l); border-color: rgba(13,59,82,.14); }
.stats div:nth-child(3) { background: #fef9e7; border-color: #fad7a0; }
.stats em { display: block; font-style: normal; font-size: calc(22px + 2pt); margin-bottom: 4px; }
.stats b { display: block; color: var(--teal-d); font-size: calc(24px + 2pt); line-height: 1; font-weight: 900; }
.stats div:nth-child(2) b { color: var(--navy-m); }
.stats div:nth-child(3) b { color: #d68910; font-size: calc(17px + 2pt); padding-top: 4px; }
.stats span { color: var(--muted); font-size: calc(10px + 2pt); font-weight: 800; margin-top: 5px; display: block; }

.empty {
  border: 1.5px solid var(--bord);
  border-radius: 20px;
  padding: 44px 20px;
  text-align: center;
  display: grid;
  gap: 7px;
  justify-items: center;
  color: var(--sub);
  background: #fff;
  box-shadow: 0 1px 5px rgba(13,59,82,.05);
}
.empty::before { content: "📭"; font-size: calc(42px + 2pt); line-height: 1; margin-bottom: 4px; }
.empty strong { font-size: calc(15px + 2pt); font-weight: 900; }
.empty span, .recordCard span, .infoCard p, .medCard span, .profile span, .profile small, .notice span {
  color: var(--muted);
  line-height: 1.65;
  font-size: calc(12px + 2pt);
}

.notice, .manualCard, .rawText, .analysis, .profile {
  background: #fff;
  border: 1.5px solid var(--bord);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: 0 1px 5px rgba(13,59,82,.05);
}
.notice { background: var(--navy-l); border-color: rgba(13,59,82,.14); }
.notice b { display: block; color: var(--navy); font-size: calc(13px + 2pt); margin-bottom: 5px; }

.quickGrid {
  background: #fff;
  border: 1.5px solid var(--bord);
  border-radius: 20px;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 11px;
  box-shadow: 0 6px 28px rgba(43,191,179,.1), 0 1px 4px rgba(13,59,82,.06);
}
.quickGrid button {
  border: 1.5px solid rgba(43,191,179,.25);
  border-radius: 16px;
  background: var(--teal-l);
  padding: 14px 12px;
  text-align: left;
}
.quickGrid button:nth-child(2) { background: var(--navy-l); border-color: rgba(13,59,82,.18); }
.quickGrid button:nth-child(3) { background: #ebf5fc; border-color: #b3d9f2; }
.quickGrid button:nth-child(4) { background: #fef9e7; border-color: #fad7a0; }
.quickGrid b { display: block; font-size: calc(24px + 2pt); margin-bottom: 8px; }
.quickGrid strong { display: block; font-size: calc(13px + 2pt); color: var(--text); margin-bottom: 3px; }
.quickGrid span { display: block; color: var(--muted); font-size: calc(11px + 2pt); }

.scanTypeGrid { display: grid; gap: 13px; }
.scanType {
  background: var(--teal-l);
  border: 1.5px solid #a8e8e4;
  border-radius: 20px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  box-shadow: 0 2px 14px rgba(43,191,179,.08);
}
.scanType:nth-child(2) { background: #ebf5fc; border-color: #b3d9f2; }
.scanType:nth-child(3) { background: var(--navy-l); border-color: #b3d0df; }
.scanType:nth-child(4) { background: #eafaef; border-color: #a9dfbf; }
.scanType b {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: calc(22px + 2pt);
  background: rgba(255,255,255,.55);
  border: 1.5px solid rgba(255,255,255,.7);
}
.scanType strong { display: block; color: var(--navy); font-size: calc(14px + 2pt); font-weight: 900; }
.scanType small { display: block; color: var(--muted); font-size: calc(11px + 2pt); margin-top: 2px; font-weight: 700; }
.scanType.active { box-shadow: 0 0 0 3px rgba(43,191,179,.14), 0 2px 14px rgba(43,191,179,.14); transform: translateY(-1px); }

.scanBox {
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--teal-d);
  background: var(--teal-l);
  border: 2px dashed rgba(43,191,179,.45);
  border-radius: 20px;
  padding: 24px 16px;
  text-align: center;
  box-shadow: 0 2px 14px rgba(43,191,179,.08);
}
.scanBox b { font-size: calc(34px + 2pt); line-height: 1; }
.scanBox strong { font-size: calc(13px + 2pt); font-weight: 900; }
.scanBox img {
  width: 100%;
  max-height: 240px;
  border-radius: 14px;
  object-fit: contain;
  background: #fff;
}
.scanBox span { color: var(--muted); font-size: calc(11px + 2pt); font-weight: 700; }

.sectionHead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.list { display: grid; gap: 10px; }
.editRow {
  display: grid;
  grid-template-columns: auto 1.1fr 1fr .7fr .7fr auto;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1.5px solid var(--bord);
  border-radius: 16px;
  padding: 10px;
  box-shadow: 0 1px 5px rgba(13,59,82,.05);
}
.categoryBadge {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--teal-l);
  border: 1.5px solid #a8e8e4;
}
.editRow button, .medCard button {
  border: 1.5px solid #f5b7b1;
  color: #c0392b;
  background: #fef0ee;
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 900;
  font-size: calc(12px + 2pt);
}

.searchBar { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.sourceSummary {
  background: #fff;
  border: 1.5px solid var(--bord);
  border-radius: 16px;
  padding: 13px 15px;
  display: grid;
  gap: 6px;
  box-shadow: 0 1px 5px rgba(13,59,82,.05);
}
.sourceSummary b { font-size: calc(13px + 2pt); color: var(--navy); }
.sourceSummary span { color: var(--muted); font-size: calc(12px + 2pt); line-height: 1.5; }
.loading { text-align: center; color: var(--teal-d); font-weight: 900; }

.infoCard, .medCard, .recordCard {
  background: #fff;
  border: 1.5px solid var(--bord);
  border-radius: 20px;
  padding: 15px 16px;
  text-align: left;
  width: 100%;
  box-shadow: 0 2px 12px rgba(13,59,82,.06);
}
.recordCard { display: block; }
.recentAnalysis {
  display: grid;
  gap: 12px;
}
.recentActions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.riskTransition {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--teal-l);
  border: 1px solid #a8e8e4;
  border-radius: 20px;
  padding: 5px 10px;
}
.riskTransition b {
  color: var(--teal-d);
  font-size: calc(11px + 2pt);
  font-weight: 900;
}
.riskTransition span {
  color: var(--navy);
  font-size: calc(11px + 2pt);
  font-weight: 900;
}
.recordCard strong, .infoCard strong, .medCard strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: calc(14px + 2pt);
  font-weight: 900;
}
.historyGroups {
  display: grid;
  gap: 16px;
}
.historyDay {
  display: grid;
  gap: 10px;
}
.historyDayHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}
.historyDayHead strong {
  color: var(--text);
  font-size: calc(14px + 2pt);
  font-weight: 900;
}
.historyDayHead span {
  background: rgba(43,191,179,.12);
  border: 1px solid rgba(43,191,179,.28);
  border-radius: 20px;
  color: var(--teal-d);
  font-size: calc(11px + 2pt);
  font-weight: 900;
  padding: 3px 10px;
}
.historyRecord {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.historyRecord i {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--teal-l);
  border: 1.5px solid #a8e8e4;
  font-style: normal;
  font-size: calc(20px + 2pt);
}
.historyRecord > span {
  flex: 1;
  min-width: 0;
}
.historyRecord small {
  display: block;
  color: var(--muted);
  font-size: calc(12px + 2pt);
  line-height: 1.6;
}
.historyRecord em {
  display: inline-block;
  margin: 2px 0 5px;
  background: var(--teal-l);
  border: 1px solid #a8e8e4;
  border-radius: 20px;
  color: var(--teal-d);
  font-size: calc(11px + 2pt);
  font-style: normal;
  font-weight: 900;
  padding: 2px 9px;
}
.infoCard {
  display: grid;
  gap: 9px;
  border-left: 5px solid var(--teal);
}
.infoCard.supplement { border-left-color: #8e44ad; }
.infoCard.herbal { border-left-color: #27ae60; }
.infoCard.otc { border-left-color: #2d9cdb; }
.infoCard footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}
.dataMeta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}
.dataMeta span {
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid #cfe5e3;
  border-radius: 6px;
  background: #f4fbfa;
  color: #315a64;
  font-size: calc(10px + 2pt);
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.analysisMeta { margin-top: -4px; }
.medCard {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 11px;
  background: #fff;
}
.medCard i {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-style: normal;
  background: var(--teal-l);
  border: 1.5px solid #a8e8e4;
  font-size: calc(20px + 2pt);
  flex: 0 0 auto;
}
.medCard div { flex: 1; min-width: 0; }
.medEditFields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 7px;
}
.medEditFields input {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: calc(12px + 2pt);
}
.medCard.otc i { background: #ebf5fc; border-color: #b3d9f2; }
.medCard.supplement i { background: #f5eef8; border-color: #d2b4de; }
.medCard.herbal i { background: #eafaef; border-color: #a9dfbf; }
.manualCard { display: grid; gap: 9px; }

.analysis {
  display: grid;
  gap: 13px;
  border: 2px solid #a8e8e4;
  background: var(--teal-l);
  box-shadow: 0 4px 20px rgba(43,191,179,.12);
}
.analysis.risk-HIGH { border-color: #f5b7b1; background: #fef0ee; }
.analysis.risk-MEDIUM { border-color: #fad7a0; background: #fef9e7; }
.riskHead { display: flex; gap: 13px; align-items: center; }
.riskHead b { font-size: calc(34px + 2pt); line-height: 1; }
.riskHead strong { display: block; font-size: calc(18px + 2pt); color: var(--navy); font-weight: 900; }
.riskHead small { display: block; margin-top: 3px; color: var(--muted); font-size: calc(11px + 2pt); font-weight: 800; }
.analysis p { color: var(--sub); font-size: calc(13px + 2pt); line-height: 1.75; }
.finding {
  background: rgba(255,255,255,.78);
  border: 1.5px solid rgba(13,59,82,.08);
  border-left: 4px solid var(--teal);
  border-radius: 16px;
  padding: 12px 14px;
  display: grid;
  gap: 4px;
}
.finding b { color: var(--text); font-size: calc(13px + 2pt); }
.qualityWarning { border-left-color: #d39b2a; background: #fffaf0; }
.doseWarning { border-left-color: #c0392b; background: #fff3f0; }
.finding span, .analysis footer { color: var(--sub); line-height: 1.6; font-size: calc(12px + 2pt); }
.finding small { color: #9a554c; font-size: calc(10px + 2pt); line-height: 1.5; }
.sideEffectList {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1.5px solid rgba(13,59,82,.08);
  border-radius: 16px;
  background: rgba(255,255,255,.72);
}
.sideEffectList h3 { font-size: calc(13px + 2pt); color: var(--navy); }
.sideEffectList div { display: grid; gap: 3px; padding-top: 8px; border-top: 1px solid rgba(13,59,82,.08); }
.sideEffectList div:first-of-type { border-top: 0; padding-top: 0; }
.sideEffectList b { font-size: calc(12px + 2pt); color: var(--text); }
.sideEffectList span { color: var(--sub); font-size: calc(11px + 2pt); line-height: 1.55; }
.analysis footer {
  background: rgba(255,255,255,.58);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
}

.profile { display: flex; align-items: center; gap: 14px; background: linear-gradient(145deg, var(--teal-l), var(--navy-l)); }
.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--grad);
  box-shadow: 0 3px 12px rgba(43,191,179,.35);
}
.avatar .logoMark { width: 40px; height: 40px; }
.profile h2 { margin-bottom: 3px; }
.profile small { display: block; margin-top: 2px; }

nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 30;
  transform: translateX(-50%);
  width: min(480px, 100%);
  display: grid;
  grid-template-columns: 1fr 3fr 3fr;
  background: rgba(255,255,255,.96);
  border-top: 1.5px solid var(--bord);
  padding: 8px 0 14px;
  backdrop-filter: blur(16px);
  box-shadow: 0 -2px 16px rgba(43,191,179,.08);
}
.navGroup {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  position: relative;
}
.navGroup-1 { grid-template-columns: 1fr; }
.navGroup + .navGroup { border-left: 1px solid var(--bord); }
nav button {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 4px 0;
  font-size: calc(10px + 2pt);
  font-weight: 800;
}
nav .navIcon {
  font-size: calc(20px + 2pt);
  line-height: 1;
  filter: grayscale(1) opacity(.42);
  transition: .18s ease;
}

.chatScreen {
  padding: 16px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeUp .28s ease;
}
.aiBadge {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 15px;
  background: var(--teal-l);
  border: 1.5px solid rgba(43,191,179,.4);
  border-radius: 16px;
}
.aiAvatar, .bubbleAvatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--grad);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  box-shadow: 0 3px 12px rgba(43,191,179,.35);
}
.aiAvatar .logoMark { width: 30px; height: 30px; }
.bubbleAvatar {
  width: 32px;
  height: 32px;
  align-self: flex-end;
}
.bubbleAvatar .logoMark { width: 22px; height: 22px; }
.aiBadge div:nth-child(2) { flex: 1; min-width: 0; }
.aiBadge strong { display: block; color: var(--navy); font-size: calc(13px + 2pt); font-weight: 900; }
.aiBadge span { display: block; color: var(--muted); font-size: calc(11px + 2pt); margin-top: 2px; font-weight: 700; }
.aiBadge small {
  color: #27ae60;
  font-size: calc(10px + 2pt);
  font-weight: 900;
}
.chatMessages {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.chatBubble {
  display: flex;
  gap: 9px;
  align-items: flex-end;
  animation: fadeUp .24s ease;
}
.chatBubble.user {
  flex-direction: row-reverse;
}
.bubbleBody {
  max-width: 86%;
  display: grid;
  gap: 10px;
}
.bubbleBody > p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.75;
  font-size: calc(13px + 2pt);
  color: var(--text);
  background: #fff;
  border: 1.5px solid var(--bord);
  border-radius: 18px 18px 18px 4px;
  padding: 12px 16px;
  box-shadow: 0 1px 6px rgba(13,59,82,.07);
}
.chatBubble.user .bubbleBody > p {
  color: #fff;
  background: var(--grad);
  border-color: transparent;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 4px 16px rgba(43,191,179,.32);
}
.suggestionList {
  display: grid;
  gap: 9px;
}
.consultModePicker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  border: 1.5px solid var(--bord);
  border-radius: 18px;
  background: #fff;
}
.consultModePicker button {
  border-color: transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--sub);
  font-size: calc(12px + 2pt);
}
.consultModePicker button.active {
  color: #fff;
  background: var(--grad);
  box-shadow: 0 4px 14px rgba(43,191,179,.22);
}
.suggestionCard {
  background: #fff;
  border: 1.5px solid var(--bord);
  border-left: 5px solid var(--teal);
  border-radius: 16px;
  padding: 13px;
  display: grid;
  gap: 8px;
  box-shadow: 0 1px 6px rgba(13,59,82,.06);
}
.suggestionCard.otc { border-left-color: #2d9cdb; }
.suggestionCard.supplement { border-left-color: #8e44ad; }
.suggestionCard.herbal { border-left-color: #27ae60; }
.suggestionCard strong {
  display: block;
  color: var(--text);
  font-size: calc(13px + 2pt);
  font-weight: 900;
}
.suggestionCard span, .suggestionCard p {
  color: var(--muted);
  font-size: calc(12px + 2pt);
  line-height: 1.6;
}
.suggestionCard small {
  display: block;
  margin-top: 3px;
  color: var(--teal-deep);
  font-size: calc(11px + 2pt);
  font-weight: 800;
}
.suggestionCard p { margin: 0; color: var(--sub); }
.suggestionCard .suggestionEvidence {
  border-radius: 12px;
  background: #f1fbfa;
  padding: 8px 10px;
  color: var(--teal-deep);
}
.suggestionCard button { justify-self: end; }
.suggestionActions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.dangerSoft {
  border-color: #f5b7b1;
  color: #c0392b;
  background: #fef0ee;
}
.chatInputBar {
  position: sticky;
  bottom: 72px;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  align-items: end;
  background: rgba(255,255,255,.96);
  border: 1.5px solid var(--bord);
  border-radius: 18px;
  padding: 10px;
  backdrop-filter: blur(16px);
  box-shadow: 0 4px 18px rgba(13,59,82,.08);
}
.chatInputBar textarea {
  min-height: 48px;
  max-height: 110px;
}
nav button.active { color: var(--teal-d); }
nav button.active .navIcon { filter: none; transform: scale(1.12); }
nav button.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  width: 26px;
  height: 3px;
  border-radius: 2px;
  background: var(--grad);
  box-shadow: 0 1px 6px rgba(43,191,179,.5);
}

.reportHeader {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 14px;
  border-bottom: 2px solid var(--navy);
}
.reportHeader small { display: block; color: var(--muted); font-size: calc(11px + 2pt); margin-bottom: 4px; }
.reportHeader h2 { margin: 0; }
.reportStatus { flex: 0 0 auto; border: 1px solid var(--bord); border-radius: 6px; padding: 7px 9px; font-size: calc(11px + 2pt); font-weight: 900; background: #fff; }
.reportStatus.risk-HIGH { color: #b93636; background: #fff3f3; }
.reportStatus.risk-MEDIUM { color: #9a6415; background: #fff9e9; }
.reportStatus.risk-LOW { color: #25658a; background: #f0f8fc; }
.reportStatus.risk-SAFE { color: var(--teal-d); background: var(--teal-l); }
.reportActions {
  display: grid;
  gap: 7px;
  padding: 12px 0 2px;
}
.reportActions p {
  margin: 0;
  color: var(--muted);
  font-size: calc(10px + 2pt);
  line-height: 1.5;
}
.reportSection { padding: 15px 0; border-bottom: 1px solid var(--bord); }
.sectionHeading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.sectionHeading h3 { margin: 0; font-size: calc(15px + 2pt); color: var(--navy); }
.textAction { border: 0; background: transparent; color: var(--teal-d); padding: 3px 0; font-size: calc(11px + 2pt); font-weight: 900; }
.reportMetrics { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--bord); border-radius: 6px; overflow: hidden; }
.reportMetrics div { min-width: 0; padding: 11px 6px; text-align: center; background: #fff; }
.reportMetrics div + div { border-left: 1px solid var(--bord); }
.reportMetrics b { display: block; color: var(--navy); font-size: calc(20px + 2pt); }
.reportMetrics span { color: var(--sub); font-size: calc(10px + 2pt); }
.latestRiskLine { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.latestRiskLine b { color: var(--navy); }
.latestRiskLine time { color: var(--muted); font-size: calc(10px + 2pt); }
.latestReport > p { margin: 8px 0 0; color: var(--sub); line-height: 1.55; font-size: calc(12px + 2pt); }
.reportTrust, .categorySummary { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.reportTrust span, .categorySummary span { border: 1px solid var(--bord); border-radius: 5px; padding: 5px 7px; color: var(--sub); font-size: calc(10px + 2pt); background: #fff; }
.reportTrust b, .categorySummary b { color: var(--navy); }
.reportRows { border-top: 1px solid var(--bord); }
.reportRows > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--bord); }
.reportRows span { min-width: 0; display: grid; gap: 2px; }
.reportRows b { font-size: calc(12px + 2pt); color: var(--text); }
.reportRows small { color: var(--muted); font-size: calc(10px + 2pt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reportRows em { color: var(--sub); font-size: calc(11px + 2pt); font-style: normal; }
.reportHistory { display: grid; border-top: 1px solid var(--bord); }
.reportHistory button { display: grid; grid-template-columns: auto 1fr auto; gap: 9px; align-items: start; padding: 10px 2px; text-align: left; border: 0; border-bottom: 1px solid var(--bord); background: transparent; }
.reportHistory button > span { font-size: calc(17px + 2pt); }
.reportHistory button div { min-width: 0; }
.reportHistory b { font-size: calc(12px + 2pt); color: var(--navy); }
.reportHistory small { margin-left: 6px; color: var(--muted); font-size: calc(9px + 2pt); }
.reportHistory p { margin: 3px 0 0; color: var(--sub); font-size: calc(10px + 2pt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reportHistory em { color: var(--teal-d); font-size: calc(20px + 2pt); font-style: normal; }
.reportEmpty { color: var(--muted); font-size: calc(12px + 2pt); margin: 0; }
.healthSummary dl { margin: 0; display: grid; gap: 8px; }
.healthSummary dl div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; }
.healthSummary dt { color: var(--muted); font-size: calc(10px + 2pt); }
.healthSummary dd { margin: 0; color: var(--text); font-size: calc(11px + 2pt); }
.healthEditForm {
  display: grid;
  gap: 9px;
}
.healthEditForm input,
.healthEditForm select,
.healthEditForm textarea {
  width: 100%;
  border: 1.5px solid var(--bord);
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
}
.healthEditForm textarea {
  resize: vertical;
  line-height: 1.5;
}
.healthEditActions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 100;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 28px));
  background: var(--navy);
  color: #fff;
  border-radius: 14px;
  padding: 12px 16px;
  text-align: center;
  font-size: calc(13px + 2pt);
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(13,59,82,.22);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes adSlideLeft {
  0%, 18% { transform: translateX(0); }
  25%, 43% { transform: translateX(-12.5%); }
  50%, 68% { transform: translateX(-25%); }
  75%, 93% { transform: translateX(-37.5%); }
  100% { transform: translateX(-50%); }
}

@media (max-width: 560px) {
  .appShell { max-width: none; box-shadow: none; }
  h1 { font-size: calc(20px + 2pt); }
  .searchBar { grid-template-columns: 1fr; }
  .editRow { grid-template-columns: auto 1fr; }
  .editRow input, .editRow button { grid-column: 2; }
  .categoryBadge { grid-row: 1 / span 5; align-self: start; }
  .quickGrid { grid-template-columns: 1fr 1fr; }
  nav button { font-size: calc(9px + 2pt); }
  .reportMetrics { grid-template-columns: repeat(2, 1fr); }
  .reportMetrics div:nth-child(3) { border-left: 0; border-top: 1px solid var(--bord); }
  .reportMetrics div:nth-child(4) { border-top: 1px solid var(--bord); }
  .healthSummary dl div { grid-template-columns: 1fr; gap: 3px; }
  .chatInputBar { grid-template-columns: 1fr; }
  .bubbleBody { max-width: 90%; }
  .guardianChoice { grid-template-columns: 1fr; }
  .medEditFields { grid-template-columns: 1fr; }
}
