:root {
  --paper: #f4f6ef;
  --app-bg: #d8ded9;
  --surface: #ffffff;
  --surface-soft: #eef4ee;
  --ink: #1b2420;
  --muted: #63706a;
  --line: #dbe2dc;
  --green: #2f7d5b;
  --green-dark: #1f5d43;
  --mint: #d9eadf;
  --coral: #c85a45;
  --amber: #c9902e;
  --blue: #3f6f87;
  --teal: #24847a;
  --plum: #6f5b8e;
  --rose: #d06b7a;
  --lime: #86a64c;
  --peach: #e5a35a;
  --danger: #b5413a;
  --shadow: 0 20px 60px rgba(7, 14, 11, 0.2);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 18px),
    linear-gradient(180deg, #273630 0%, #17231f 44%, #0f1815 100%);
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sprite {
  display: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px) 18px;
}

.topbar h1,
.admin-header h2,
.context-panel h2,
.map-column h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  color: #f8fbf4;
}

.topbar .eyebrow {
  color: #b8ddc6;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mode-switch {
  display: flex;
  gap: 6px;
  padding: 5px;
  background: rgba(12, 20, 17, 0.64);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(5, 10, 8, 0.18);
}

.mode-button {
  min-width: 92px;
  padding: 10px 14px;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 750;
}

.mode-button.is-active {
  background: #f8fbf4;
  color: var(--ink);
}

.workspace {
  display: none;
  min-height: calc(100vh - 110px);
  padding: 10px clamp(18px, 4vw, 48px) 42px;
}

.workspace.is-active {
  display: grid;
}

#mode-user {
  grid-template-columns: minmax(240px, 360px) minmax(330px, 430px);
  justify-content: center;
  align-items: start;
  gap: clamp(22px, 5vw, 78px);
}

.context-panel {
  margin-top: 42px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.context-panel::before {
  display: block;
  width: 46px;
  height: 5px;
  margin-bottom: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--coral), var(--blue));
  content: "";
}

.context-panel h2 {
  max-width: 320px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
}

.context-panel p {
  color: var(--muted);
  line-height: 1.6;
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.metric-row span,
.muted,
.label,
.screen-title span,
.task-card span,
.suggestion-item span,
.score-result span,
.insight-box span,
.stat-block span,
.panel-title span,
.alert-item span,
.control-list span,
.meal-log span,
.rules-grid span,
.mini-metrics span {
  color: var(--muted);
  font-size: 13px;
}

.metric-row:nth-of-type(1) strong {
  color: var(--green-dark);
}

.metric-row:nth-of-type(2) strong {
  color: var(--blue);
}

.metric-row:nth-of-type(3) strong {
  color: var(--coral);
}

.install-panel {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding: 15px;
  border: 1px solid rgba(47, 125, 91, 0.24);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #edf7f1);
}

.install-panel span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.install-panel strong {
  color: var(--green-dark);
  line-height: 1.35;
}

.install-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.install-button {
  min-height: 42px;
  border-radius: 6px;
  background: var(--green);
  color: white;
  font-weight: 850;
}

.install-download {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--green-dark);
  font-weight: 850;
  text-decoration: none;
}

.install-button.is-muted {
  background: var(--paper);
  color: var(--green-dark);
  border: 1px solid var(--line);
}

.apk-home-button {
  display: grid;
  gap: 5px;
  padding: 15px 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--green), var(--teal));
  color: white;
  text-decoration: none;
  box-shadow: 0 14px 28px rgba(47, 125, 91, 0.24);
}

.apk-home-button strong {
  font-size: 17px;
}

.apk-home-button span {
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
}

.phone-shell {
  overflow: hidden;
  width: min(100%, 420px);
  min-height: 760px;
  margin: 0 auto;
  background: #101915;
  border: 10px solid #101915;
  border-radius: 34px;
  box-shadow: 0 30px 90px rgba(16, 25, 21, 0.25);
}

.phone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 12px;
  color: white;
}

.phone-header div {
  display: grid;
  gap: 3px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--green-dark);
}

.phone-content {
  height: 614px;
  padding: 14px;
  overflow-y: auto;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0 1px, transparent 1px 18px),
    var(--app-bg);
  border-radius: 24px 24px 0 0;
  scrollbar-width: thin;
}

.mobile-screen {
  display: none;
}

.mobile-screen.is-active {
  display: grid;
  gap: 14px;
}

.onboarding-screen {
  padding-bottom: 10px;
}

.login-panel,
.onboarding-card,
.consent-panel,
.onboarding-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
  color: white;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent 42%),
    linear-gradient(135deg, #1d5c44, #2d7f73 58%, #4b7190);
  box-shadow: 0 18px 34px rgba(31, 93, 67, 0.22);
}

.login-panel .eyebrow {
  color: rgba(255, 255, 255, 0.78);
}

.login-panel h3,
.login-panel p {
  margin: 0;
}

.login-panel p {
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.45;
}

.login-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.login-actions button,
.primary-cta,
.secondary-cta {
  min-height: 42px;
  border-radius: 6px;
  font-weight: 850;
}

.login-actions button {
  background: rgba(255, 255, 255, 0.18);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.secondary-cta {
  background: var(--paper);
  color: var(--green-dark);
  border: 1px solid var(--line);
}

.step-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.step-strip span {
  display: grid;
  place-items: center;
  min-height: 34px;
  padding: 6px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-align: center;
}

.step-strip .is-current {
  background: var(--ink);
  color: white;
}

.onboarding-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
}

.screen-title.compact h3 {
  font-size: 18px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.input-shell {
  min-height: 42px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  font-weight: 850;
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.choice-pill {
  min-height: 40px;
  padding: 9px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 850;
}

.choice-pill.is-selected {
  background: #eaf2df;
  color: var(--green-dark);
  border-color: rgba(47, 125, 91, 0.35);
}

.shift-section {
  display: grid;
  gap: 8px;
}

.section-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.shift-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.shift-pill {
  min-height: 38px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.shift-pill.is-selected {
  background: #e7edf1;
  color: var(--blue);
  border-color: rgba(63, 111, 135, 0.28);
}

.onboarding-times span {
  font-size: 13px;
}

.shift-preview {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-left: 4px solid var(--plum);
  border-radius: 8px;
  background: #eee8f3;
}

.shift-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.shift-preview strong {
  line-height: 1.35;
}

.habit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.habit-tags span {
  padding: 7px 9px;
  border-radius: 999px;
  background: #f6ead9;
  color: #77531e;
  font-size: 12px;
  font-weight: 800;
}

.habit-tags span:nth-child(2) {
  background: #f7e5e2;
  color: var(--danger);
}

.habit-tags span:nth-child(3) {
  background: #e7edf1;
  color: var(--blue);
}

.habit-tags span:nth-child(n + 4) {
  background: #eaf2df;
  color: var(--green-dark);
}

.consent-panel {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: #eee8f3;
  border-color: rgba(111, 91, 142, 0.28);
}

.consent-panel p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--line);
}

.toggle span {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 4px 10px rgba(20, 36, 29, 0.15);
}

.toggle.is-on {
  background: var(--green);
}

.toggle.is-on span {
  left: 22px;
}

.onboarding-summary {
  display: grid;
  gap: 5px;
  padding: 14px;
  background: #eaf2df;
  border-left: 4px solid var(--green);
}

.onboarding-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.primary-cta {
  width: 100%;
  background: var(--ink);
  color: white;
}

.visual-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #ffffff, #edf4ec);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.visual-card > div {
  padding: 14px 14px 0;
}

.visual-card strong {
  display: block;
  line-height: 1.35;
}

.analytics-hero {
  background: linear-gradient(135deg, #ffffff, #edf1f5);
}

.feature-illustration {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.ill-shadow {
  fill: rgba(27, 36, 32, 0.08);
}

.ill-plate,
.ill-card,
.ill-center {
  fill: #fffaf1;
  stroke: #22342c;
  stroke-width: 3;
}

.ill-veg {
  fill: #86a64c;
}

.ill-protein {
  fill: #d06b7a;
}

.ill-carb,
.ill-bread {
  fill: #e5a35a;
}

.ill-scale-base {
  fill: #3f6f87;
}

.ill-scale-top {
  fill: #f4f6ef;
  stroke: #22342c;
  stroke-width: 3;
}

.ill-line,
.ill-progress-line {
  fill: none;
  stroke: #22342c;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ill-line.dark {
  stroke-width: 3;
}

.ill-dot {
  stroke: #22342c;
  stroke-width: 2;
}

.ill-dot.green {
  fill: var(--green);
}

.ill-dot.amber {
  fill: var(--amber);
}

.ill-dot.blue {
  fill: var(--blue);
}

.status-band {
  display: grid;
  gap: 7px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent 44%),
    linear-gradient(135deg, var(--green-dark), var(--teal) 54%, var(--blue));
  color: white;
  border-radius: 8px;
  box-shadow: 0 18px 34px rgba(31, 93, 67, 0.24);
}

.status-band span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.progress-block {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 14px;
  align-items: center;
  padding: 22px 18px 20px;
  text-align: center;
  background: linear-gradient(180deg, #ffffff, #f6f8f2);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(20, 36, 29, 0.08);
}

.progress-block h3,
.screen-title h3,
.panel-title h3 {
  margin: 0;
  letter-spacing: 0;
}

.progress-block p {
  max-width: 290px;
  margin: 6px auto 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.ring {
  display: grid;
  place-items: center;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, transparent 56%, rgba(255, 255, 255, 0.72) 57% 60%, transparent 61%),
    conic-gradient(from -90deg, var(--green) 0, var(--teal) calc(var(--value) * 1%), #e3e7dd 0);
  color: var(--green-dark);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72), 0 18px 35px rgba(47, 125, 91, 0.2);
  font-weight: 900;
}

.ring span {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(20, 36, 29, 0.1);
  font-size: 27px;
}

.task-card,
.rule-strip,
.insight-box {
  display: grid;
  gap: 5px;
  padding: 15px;
  background: #eaf2df;
  border-left: 4px solid var(--green);
  border-radius: 8px;
}

.task-card {
  background: #f7ead9;
  border-left-color: var(--peach);
}

.home-plan-card,
.daily-meals,
.analytics-card,
.portion-note,
.text-entry-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(38, 50, 44, 0.1);
}

.compact-plan {
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.compact-plan div {
  min-width: 0;
  padding: 10px;
}

.compact-plan strong {
  font-size: 16px;
}

.home-rule {
  padding: 12px;
}

.section-heading {
  display: grid;
  gap: 2px;
}

.section-heading h3 {
  margin: 0;
  font-size: 18px;
}

.meal-review {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 8px 18px rgba(38, 50, 44, 0.07);
}

.meal-review.good {
  border-left: 4px solid var(--green);
  background: #eef6e9;
}

.meal-review.warning {
  border-left: 4px solid var(--amber);
  background: #fbf0df;
}

.meal-review.neutral {
  border-left: 4px solid var(--blue);
  background: #e7edf1;
}

.meal-review-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.meal-review-head div {
  display: grid;
  gap: 3px;
}

.meal-review-head span,
.meal-feedback span,
.meal-fix span,
.portion-note span,
.text-entry-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.meal-review-head b {
  flex: 0 0 auto;
  padding: 6px 8px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
}

.meal-review p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.meal-feedback,
.meal-fix {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.62);
}

.meal-fix {
  background: rgba(255, 255, 255, 0.82);
}

.agent-home-card,
.agent-result-card,
.agent-rules-card,
.agent-status-line {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(38, 50, 44, 0.1);
}

.agent-home-card {
  border-left: 4px solid var(--teal);
  background: linear-gradient(135deg, #ffffff, #eef8f3);
}

.agent-home-head,
.entry-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.agent-home-head h3,
.entry-card-head strong {
  margin: 0;
  font-size: 18px;
}

.agent-home-head b,
.entry-card-head b {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  background: #e1f0e8;
  color: var(--green-dark);
  font-size: 12px;
}

.agent-home-card p,
.agent-result-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.agent-home-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.agent-home-meta span {
  min-width: 0;
  padding: 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.agent-status-line {
  grid-template-columns: auto 1fr;
  align-items: center;
  background: #e7edf1;
  border-left: 4px solid var(--blue);
  box-shadow: none;
}

.agent-status-line span {
  padding: 7px 9px;
  border-radius: 999px;
  background: var(--blue);
  color: white;
  font-size: 12px;
  font-weight: 850;
}

.agent-status-line strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.text-entry-card {
  border-top: 4px solid var(--blue);
}

.agent-entry-card {
  border-top-color: var(--teal);
}

.portion-note {
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-left: 4px solid var(--peach);
  background: #fbf0df;
}

.portion-note > div {
  padding: 14px;
}

.portion-note p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.text-entry-box {
  min-height: 132px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--muted);
  line-height: 1.45;
}

.meal-type-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.meal-type-button {
  min-height: 36px;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.meal-type-button.is-active {
  background: var(--green-dark);
  color: white;
  border-color: var(--green-dark);
}

.meal-textarea {
  width: 100%;
  min-height: 126px;
  resize: vertical;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
}

.meal-textarea:focus {
  outline: 2px solid rgba(47, 125, 91, 0.22);
  border-color: var(--green);
}

.agent-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 8px;
}

.agent-result-card {
  border-top: 4px solid var(--green);
  background: linear-gradient(180deg, #ffffff, #f4f8f1);
}

.agent-result-card.is-warning {
  border-top-color: var(--amber);
}

.agent-result-card.is-danger {
  border-top-color: var(--coral);
}

.agent-result-top,
.agent-insight-grid {
  display: grid;
  gap: 8px;
}

.agent-result-top {
  grid-template-columns: 1fr 1fr;
}

.agent-insight-grid {
  grid-template-columns: 1fr;
}

.agent-result-top div,
.agent-insight-grid div {
  display: grid;
  gap: 5px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.agent-result-top span,
.agent-insight-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.agent-result-top strong {
  color: var(--green-dark);
  font-size: 19px;
}

.agent-insight-grid strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.agent-warning {
  padding: 10px;
  border-radius: 6px;
  background: #fbf0df;
  color: #76521d;
  font-size: 12px;
  line-height: 1.4;
}

.agent-rules-card {
  border-left: 4px solid var(--green);
}

.analytics-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.analytics-summary div {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.analytics-summary div:first-child {
  border-top: 4px solid var(--green);
  background: #eef6e9;
}

.analytics-summary div:nth-child(2) {
  border-top: 4px solid var(--amber);
  background: #fbf0df;
}

.analytics-summary span,
.analytics-summary small,
.analytics-note span {
  color: var(--muted);
  font-size: 12px;
}

.analytics-summary span,
.analytics-note span {
  font-weight: 850;
  text-transform: uppercase;
}

.analytics-summary strong {
  font-size: 22px;
}

.analytics-card {
  overflow: hidden;
}

.analytics-note {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-radius: 8px;
}

.analytics-note.good {
  background: #eaf2df;
  border-left: 4px solid var(--green);
}

.analytics-note.warning {
  background: #fbf0df;
  border-left: 4px solid var(--amber);
}

.analytics-note.neutral {
  background: #e7edf1;
  border-left: 4px solid var(--blue);
}

.axis-chart {
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: 168px auto auto;
  gap: 8px;
}

.y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: end;
  height: 168px;
  color: var(--muted);
  font-size: 11px;
}

.axis-plot {
  position: relative;
  height: 168px;
  border-left: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  background:
    linear-gradient(to bottom, rgba(99, 112, 106, 0.14) 1px, transparent 1px) 0 0 / 100% 25%,
    linear-gradient(180deg, #ffffff, #f7f8f2);
  border-radius: 8px 8px 4px 4px;
  overflow: hidden;
}

.chart-bars {
  position: absolute;
  inset: 20px 10px 0 10px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 6px;
}

.chart-bars span {
  position: relative;
  display: block;
  height: var(--height);
  min-height: 16px;
  border-radius: 7px 7px 0 0;
  background: linear-gradient(180deg, var(--green), var(--blue));
}

.chart-bars b {
  position: absolute;
  right: 50%;
  bottom: calc(100% + 4px);
  color: var(--muted);
  font-size: 10px;
  transform: translateX(50%);
}

.x-axis {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.axis-caption {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.line-chart {
  width: 100%;
  height: auto;
  padding: 10px;
  background: linear-gradient(180deg, #ffffff, #f7f8f2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.chart-axis {
  stroke: var(--ink);
  stroke-width: 2.6;
}

.chart-grid {
  stroke: rgba(99, 112, 106, 0.22);
  stroke-width: 1.4;
}

.chart-line {
  fill: none;
  stroke: var(--green);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-point {
  fill: var(--coral);
  stroke: var(--ink);
  stroke-width: 2;
}

.chart-label,
.chart-unit {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.trend-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.focus-list {
  display: grid;
  gap: 8px;
}

.focus-list div {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.focus-list span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 12px;
  font-weight: 900;
}

.meal-timeline {
  display: grid;
  gap: 9px;
}

.meal-timeline div,
.suggestion-item,
.alert-item,
.control-list div,
.meal-log div,
.rules-grid div {
  display: grid;
  gap: 5px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.meal-timeline span,
.suggestion-item small,
.meal-log em,
.control-list em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.screen-title {
  display: grid;
  gap: 2px;
  padding: 4px 2px 0;
}

.voice-box {
  display: grid;
  place-items: center;
  gap: 18px;
  min-height: 210px;
  padding: 22px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.voice-box p {
  max-width: 260px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.mic-button {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--coral);
  color: white;
  box-shadow: 0 16px 30px rgba(200, 90, 69, 0.24);
}

.mic-button svg {
  width: 34px;
  height: 34px;
}

.score-result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.score-result div,
.plan-grid div,
.stat-block,
.mini-metrics div {
  display: grid;
  gap: 6px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.score-result div:nth-child(1) {
  border-top: 4px solid var(--green);
  background: #eef6e9;
}

.score-result div:nth-child(2) {
  border-top: 4px solid var(--amber);
  background: #fbf0df;
}

.plan-grid div:nth-child(1) {
  border-top: 4px solid var(--blue);
}

.plan-grid div:nth-child(2) {
  border-top: 4px solid var(--green);
}

.plan-grid div:nth-child(3) {
  border-top: 4px solid var(--lime);
}

.plan-grid div:nth-child(4) {
  border-top: 4px solid var(--peach);
}

.score-result strong {
  color: var(--green-dark);
  font-size: 20px;
}

.check-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}

.plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.plan-grid strong,
.stat-block strong {
  font-size: 24px;
}

.time-windows {
  display: grid;
  gap: 9px;
}

.time-windows span {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 750;
}

.suggestion-list {
  display: grid;
  gap: 10px;
}

.suggestion-item.primary {
  border-color: rgba(47, 125, 91, 0.35);
  background: var(--mint);
}

.suggestion-item:nth-child(2) {
  border-left: 4px solid var(--blue);
}

.suggestion-item:nth-child(3) {
  border-left: 4px solid var(--peach);
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 8px;
  height: 210px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.bar-chart span {
  min-height: 18px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--green), var(--blue));
}

.insight-box.success {
  border-left-color: var(--blue);
  background: #e4eef2;
}

.chat-thread {
  display: grid;
  gap: 10px;
}

.bubble {
  max-width: 86%;
  padding: 12px 14px;
  border-radius: 8px;
  line-height: 1.45;
}

.bubble.support {
  justify-self: start;
  background: var(--surface);
  border: 1px solid var(--line);
}

.bubble.user {
  justify-self: end;
  background: var(--green);
  color: white;
}

.message-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 9px 10px 9px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px 12px 14px;
  background: var(--app-bg);
}

.mobile-nav {
  display: grid;
  place-items: center;
  min-height: 44px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.34);
  color: var(--muted);
}

.mobile-nav.is-active {
  background: var(--ink);
  color: white;
}

#mode-admin {
  grid-template-columns: 86px minmax(0, 1180px);
  justify-content: center;
  gap: 18px;
}

.admin-sidebar {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 9px;
  align-self: start;
  padding: 12px;
  background: #14201b;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 10px;
  border-radius: 8px;
  background: var(--mint);
  color: var(--green-dark);
  font-weight: 900;
}

.side-item {
  display: grid;
  place-items: center;
  gap: 3px;
  width: 56px;
  min-height: 56px;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.64);
  font-size: 10px;
}

.side-item.is-active {
  background: var(--green);
  color: white;
}

.side-item svg {
  width: 19px;
  height: 19px;
}

.admin-shell {
  overflow: hidden;
  min-height: 760px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.admin-page {
  display: none;
  padding: 22px;
}

.admin-page.is-active {
  display: grid;
  gap: 18px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 14px;
}

.admin-stats .stat-block {
  border-top: 4px solid var(--green);
}

.admin-stats .stat-block:nth-child(2) {
  border-top-color: var(--amber);
}

.admin-stats .stat-block:nth-child(3) {
  border-top-color: var(--blue);
}

.admin-stats .stat-block:nth-child(4) {
  border-top-color: var(--danger);
}

.stat-block.warning strong,
.pill.warning {
  color: var(--amber);
}

.stat-block.danger strong,
.pill.danger {
  color: var(--danger);
}

.stat-block small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.status-overview {
  border-top: 5px solid var(--blue);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.status-tile {
  display: grid;
  gap: 7px;
  min-height: 132px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.status-tile strong {
  font-size: 15px;
}

.status-tile span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.status-tile.good {
  background: #eaf2df;
  border-color: rgba(134, 166, 76, 0.35);
}

.status-tile.support {
  background: #f6ead9;
  border-color: rgba(201, 144, 46, 0.36);
}

.status-tile.danger {
  background: #f7e5e2;
  border-color: rgba(181, 65, 58, 0.35);
}

.status-tile.inactive {
  background: #e7edf1;
  border-color: rgba(63, 111, 135, 0.28);
}

.status-tile.plateau {
  background: #eee8f3;
  border-color: rgba(111, 91, 142, 0.28);
}

.command-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
  gap: 18px;
}

.admin-grid,
.profile-layout {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 18px;
}

.admin-panel {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-panel.wide {
  min-width: 0;
}

.panel-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.user-table {
  display: grid;
}

.table-row {
  display: grid;
  grid-template-columns: 1fr 110px 1.4fr 72px;
  gap: 12px;
  align-items: center;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.table-row.header {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.table-row button {
  min-height: 34px;
  border-radius: 6px;
  background: var(--ink);
  color: white;
  font-weight: 800;
}

.pill {
  font-weight: 900;
}

.priority-list {
  display: grid;
  gap: 12px;
}

.priority-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.priority-card.danger {
  border-left: 4px solid var(--danger);
}

.priority-card.warning {
  border-left: 4px solid var(--amber);
}

.priority-rank {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-weight: 900;
}

.priority-main {
  display: grid;
  gap: 8px;
}

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

.priority-card p,
.focus-person p,
.profile-module p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.priority-tags,
.profile-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.priority-tags span,
.flag {
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.flag.danger {
  border-color: rgba(181, 65, 58, 0.28);
  background: #f7e5e2;
  color: var(--danger);
}

.priority-actions,
.quick-actions,
.action-stack,
.template-row {
  display: grid;
  gap: 8px;
}

.priority-actions button,
.quick-actions button,
.action-stack button,
.template-row button,
.triage-column button,
.control-list button {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--ink);
  color: white;
  font-size: 13px;
  font-weight: 850;
}

.priority-actions button:nth-child(2),
.quick-actions button:nth-child(2),
.action-stack button:nth-child(n + 3),
.template-row button,
.triage-column button,
.control-list button {
  background: var(--surface-soft);
  color: var(--green-dark);
}

.focus-card {
  display: grid;
  align-content: start;
  gap: 14px;
}

.focus-person {
  display: flex;
  align-items: center;
  gap: 14px;
}

.coach-brief,
.next-step,
.admin-note,
.profile-module,
.message-context div {
  display: grid;
  gap: 6px;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.coach-brief span,
.next-step span,
.admin-note span,
.profile-module span,
.message-context span,
.habit-board span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.coach-brief p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.next-step {
  border-left: 4px solid var(--green);
  background: var(--mint);
}

.habit-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.habit-board div {
  display: grid;
  gap: 5px;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.habit-board div:nth-child(1) {
  border-top: 4px solid var(--peach);
  background: #fbf0df;
}

.habit-board div:nth-child(2) {
  border-top: 4px solid var(--blue);
  background: #e7edf1;
}

.habit-board div:nth-child(3) {
  border-top: 4px solid var(--green);
  background: #eaf2df;
}

.habit-board div:nth-child(4) {
  border-top: 4px solid var(--rose);
  background: #f7e7ea;
}

.habit-board strong {
  font-size: 28px;
}

.habit-board em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.big-signal {
  padding: 18px;
  background: #f6ead9;
  border-left: 4px solid var(--amber);
  border-radius: 8px;
}

.big-signal p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.profile-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.profile-top p {
  margin: 5px 0 0;
  color: var(--muted);
}

.avatar {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-weight: 900;
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.profile-flags,
.admin-note {
  margin-top: 14px;
}

.profile-dashboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
}

.profile-layout.lower {
  margin-top: 18px;
}

.meal-log,
.alert-list,
.control-list,
.rules-grid {
  display: grid;
  gap: 10px;
}

.meal-log.detailed div,
.control-list.detailed div {
  grid-template-columns: 120px minmax(0, 1fr) minmax(170px, auto);
  align-items: center;
}

.control-list.detailed div {
  grid-template-columns: 120px minmax(0, 1fr) minmax(160px, auto) auto;
}

.triage-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.triage-column {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 320px;
  padding: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.triage-column h4 {
  margin: 0 0 4px;
}

.triage-column .alert-item {
  background: var(--surface);
}

.alert-item.danger {
  border-left: 4px solid var(--danger);
}

.alert-item.warning {
  border-left: 4px solid var(--amber);
}

.inbox-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}

.inbox-list {
  display: grid;
  gap: 8px;
  align-content: start;
}

.inbox-item {
  display: grid;
  gap: 5px;
  padding: 13px;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.inbox-item.is-active {
  border-color: rgba(47, 125, 91, 0.45);
  background: var(--mint);
}

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

.reply-panel {
  display: grid;
  align-content: space-between;
  gap: 18px;
  min-height: 250px;
}

.message-context {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.template-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-summary {
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ai-summary p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.admin-message {
  border-radius: 8px;
}

.rules-grid {
  grid-template-columns: repeat(3, 1fr);
}

#mode-map {
  align-items: start;
  justify-content: center;
}

.map-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 310px));
  gap: 18px;
  width: min(100%, 1040px);
}

.map-column {
  display: grid;
  gap: 10px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.map-column h2 {
  margin-bottom: 8px;
}

.map-card {
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.map-card.accent {
  background: var(--mint);
  border-color: rgba(47, 125, 91, 0.35);
}

@media (max-width: 980px) {
  .topbar,
  .admin-header {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-switch {
    width: 100%;
  }

  .mode-button {
    flex: 1;
    min-width: 0;
  }

  #mode-user,
  #mode-admin,
  .command-grid,
  .admin-grid,
  .profile-layout,
  .triage-board,
  .map-board {
    grid-template-columns: 1fr;
  }

  .context-panel {
    margin-top: 0;
  }

  .admin-sidebar {
    position: static;
    grid-template-columns: repeat(6, 1fr);
    width: 100%;
  }

  .brand-mark {
    display: none;
  }

  .side-item {
    width: auto;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding-inline: 12px;
  }

  .admin-stats,
  .status-grid,
  .habit-board,
  .profile-dashboard,
  .message-context,
  .rules-grid,
  .template-row,
  .inbox-layout {
    grid-template-columns: 1fr;
  }

  .priority-card {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .priority-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .meal-log.detailed div,
  .control-list.detailed div {
    grid-template-columns: 1fr;
  }

  .visual-card,
  .portion-note,
  .agent-status-line,
  .agent-home-meta,
  .agent-result-top,
  .agent-actions {
    grid-template-columns: 1fr;
  }

  .meal-type-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .table-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .table-row.header {
    display: none;
  }

  .search-field {
    min-width: 0;
  }

  .phone-shell {
    min-height: 720px;
    border-width: 7px;
    border-radius: 26px;
  }

  .phone-content {
    min-height: 590px;
  }

  .progress-block {
    grid-template-columns: 1fr;
  }
}
