:root {
  color-scheme: light;
  --ink: #173326;
  --muted: #596d61;
  --line: #c9dacf;
  --paper: #f3f8f4;
  --panel: #ffffff;
  --navy: #277447;
  --navy-2: #185b37;
  --leaf: #277447;
  --leaf-dark: #185b37;
  --leaf-soft: #e5f3e9;
  --sun: #d7a63f;
  --used: #dc2626;
  --used-soft: #fee2e2;
  --shadow: 0 12px 28px rgba(23, 51, 38, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #eaf5ed 0%, #f8fbf8 42%, #f3f8f4 100%);
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(39, 116, 71, 0.26);
  outline-offset: 2px;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.75fr);
  min-height: 100vh;
  background: #f7fbf8;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: clamp(40px, 8vw, 120px);
  color: #ffffff;
  background: #216b40;
}

.auth-brand img {
  width: 72px;
  height: 72px;
  margin-bottom: 22px;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(9, 52, 29, 0.24);
}

.brand-kicker {
  margin: 0 0 14px;
  color: #c9efd4;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
}

.auth-brand h1 {
  max-width: 680px;
  margin: 0;
  font-size: 4rem;
  line-height: 1.02;
  letter-spacing: 0;
}

.auth-brand > p:last-child {
  max-width: 590px;
  margin: 24px 0 0;
  color: #e0f4e6;
  font-size: 1.08rem;
  line-height: 1.6;
}

.auth-panel {
  width: min(440px, calc(100% - 40px));
  margin: auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 50px rgba(23, 51, 38, 0.12);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 24px;
  padding: 4px;
  border-radius: 8px;
  background: var(--leaf-soft);
}

.auth-tab {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  color: #315f45;
  background: transparent;
  font-weight: 850;
}

.auth-tab[aria-selected="true"] {
  color: var(--leaf-dark);
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(23, 51, 38, 0.1);
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form small {
  color: var(--muted);
}

.auth-submit {
  width: 100%;
  min-height: 44px;
}

.form-message {
  min-height: 1.25em;
  margin: 0;
  color: #a12323;
  font-size: 0.86rem;
  font-weight: 750;
}

.app-shell {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(39, 116, 71, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.topbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-controls {
  display: grid;
  grid-template-columns: minmax(240px, 0.42fr) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding-top: 10px;
  border-top: 1px solid #dce8df;
}

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

.brand-lockup img {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 8px;
}

.topbar h1 {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.search-box {
  width: 100%;
}

.search-input {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #b7cdbd;
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  font-weight: 750;
}

.search-input:focus {
  outline: 2px solid rgba(39, 116, 71, 0.25);
  border-color: var(--navy);
}

.header-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #b7cdbd;
  border-radius: 8px;
  color: #254b35;
  background: #ffffff;
  white-space: nowrap;
  font-weight: 800;
}

.user-menu-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #9fc7ad;
  border-radius: 50%;
  color: #ffffff;
  background: var(--leaf-dark);
}

.user-menu-button[aria-expanded="true"] {
  box-shadow: 0 0 0 4px rgba(39, 116, 71, 0.14);
}

.drawer-avatar {
  font-size: 0.78rem;
  font-weight: 900;
}

.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.menu-icon {
  position: relative;
}

.menu-icon::before,
.menu-icon::after {
  position: absolute;
  left: 0;
  content: "";
}

.menu-icon::before {
  top: -6px;
}

.menu-icon::after {
  top: 6px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(16, 38, 25, 0.34);
}

.user-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 80;
  display: flex;
  width: min(380px, 92vw);
  height: 100dvh;
  flex-direction: column;
  padding: 20px;
  border-left: 1px solid #bad0c0;
  background: #ffffff;
  box-shadow: -18px 0 48px rgba(18, 54, 32, 0.16);
  transform: translateX(102%);
  transition: transform 180ms ease;
}

.user-drawer[aria-hidden="false"] {
  transform: translateX(0);
}

.drawer-open {
  overflow: hidden;
}

.drawer-header,
.drawer-profile {
  display: flex;
  align-items: center;
}

.drawer-header {
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-profile {
  min-width: 0;
  gap: 11px;
}

.drawer-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #ffffff;
  background: var(--leaf);
}

.drawer-profile strong,
.drawer-profile span {
  display: block;
  max-width: 245px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-profile span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.drawer-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid #c7d8cc;
  border-radius: 50%;
  color: #315443;
  background: #f5faf6;
  font-weight: 900;
}

.drawer-section {
  display: grid;
  gap: 8px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.drawer-section label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.drawer-section select,
.drawer-secondary-action {
  width: 100%;
  min-height: 42px;
  border: 1px solid #b5cbbd;
  border-radius: 8px;
  color: var(--leaf-dark);
  background: #f7fbf8;
  font-weight: 800;
}

.drawer-section select {
  padding: 0 36px 0 11px;
}

.drawer-nav {
  display: grid;
  gap: 6px;
  padding: 18px 0;
}

.drawer-nav .header-action,
.drawer-logout {
  justify-content: flex-start;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border-color: transparent;
  background: transparent;
  text-align: left;
}

.drawer-nav .header-action:hover,
.drawer-nav .header-action[aria-pressed="true"] {
  color: var(--leaf-dark);
  border-color: #d4e4d8;
  background: #edf7f0;
}

.drawer-logout {
  margin-top: auto;
  border: 1px solid #e3b6b6;
  border-radius: 8px;
  color: #9f2424;
  background: #fff7f7;
  font-weight: 850;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.header-action[aria-pressed="true"] {
  color: #ffffff;
  border-color: var(--navy);
  background: var(--navy);
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid #b4d4bf;
  border-radius: 999px;
  color: #1e633b;
  background: #e9f6ed;
  font-size: 0.86rem;
  font-weight: 700;
}

.primary-button {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--leaf-dark);
  border-radius: 8px;
  color: #ffffff;
  background: var(--leaf);
  font-weight: 850;
  transition: background 180ms ease, border-color 180ms ease;
}

.primary-button:hover {
  border-color: #10472b;
  background: var(--leaf-dark);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #9eb1cb;
  border-radius: 8px;
  color: #ffffff;
  background: var(--navy);
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1;
}

.tabs {
  position: sticky;
  top: 96px;
  z-index: 19;
  display: flex;
  gap: 8px;
  margin: 12px 0;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
}

.topbar .tabs {
  position: static;
  top: auto;
  z-index: auto;
}

.page-tabs {
  align-self: center;
  flex-wrap: wrap;
  margin: 0;
  overflow-x: visible;
  padding: 0;
}

.mobile-header-tabs {
  display: none;
}

.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid #b7cdbd;
  border-radius: 8px;
  color: #254b35;
  background: #ffffff;
  white-space: nowrap;
  font-weight: 700;
}

.tab-button[aria-selected="true"] {
  color: #ffffff;
  border-color: var(--navy);
  background: var(--navy);
}

.tab-count {
  margin-left: 7px;
  color: inherit;
  opacity: 0.75;
  font-size: 0.82rem;
}

.main-panel {
  min-height: calc(100vh - 150px);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-title {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.section-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.compact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.text-button,
.danger-button,
.ghost-button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  font-weight: 800;
}

.text-button {
  border: 1px solid #185b37;
  color: #ffffff;
  background: #185b37;
}

.ghost-button {
  border: 1px solid #b7cdbd;
  color: #254b35;
  background: #ffffff;
}

.danger-button {
  border: 1px solid #b91c1c;
  color: #ffffff;
  background: #b91c1c;
}

.meal-delete-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  transition: background-color 180ms ease, border-color 180ms ease;
}

.meal-delete-button:hover {
  border-color: #991b1b;
  background: #991b1b;
}

.meal-delete-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.content {
  padding-bottom: 24px;
}

.food-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  align-items: start;
  gap: 10px;
}

.food-card {
  position: relative;
  display: flex;
  height: 136px;
  align-self: start;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 38px 12px 12px;
  border: 1px solid var(--accent);
  border-left-width: 7px;
  border-radius: 8px;
  color: #132033;
  background: var(--bg);
  box-shadow: 0 4px 12px rgba(23, 51, 38, 0.07);
  text-align: center;
  transition: transform 150ms ease, box-shadow 150ms ease;
  contain: layout paint style;
}

.show-more-row {
  display: flex;
  grid-column: 1 / -1;
  justify-content: center;
  width: 100%;
  padding: 12px 0 4px;
}

.food-card.group-card {
  height: 136px;
}

.food-card[role="button"] {
  cursor: pointer;
}

.food-card:focus-visible,
.food-card:hover {
  outline: 2px solid rgba(39, 116, 71, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(23, 51, 38, 0.11);
}

.food-card.used-card {
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.18), 0 4px 12px rgba(23, 51, 38, 0.07);
}

.food-name {
  width: 100%;
  font-weight: 900;
  line-height: 1.18;
  overflow-wrap: break-word;
}

.food-meta {
  display: grid;
  gap: 2px;
  color: #31425c;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.12;
  text-transform: uppercase;
}

.food-timer {
  color: #7f1d1d;
}

.option-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  width: 100%;
}

.option-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid rgba(19, 32, 51, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  font-size: 0.75rem;
  font-weight: 750;
  line-height: 1;
}

.card-options-button {
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid rgba(19, 32, 51, 0.18);
  border-radius: 999px;
  color: #172033;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 900;
}

.delete-mini,
.reset-mini,
.restart-mini,
.detail-mini {
  position: absolute;
  top: 8px;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(23, 32, 51, 0.2);
  border-radius: 8px;
  color: #24364c;
  background: rgba(255, 255, 255, 0.75);
  font-size: 0.9rem;
  font-weight: 900;
}

.delete-mini,
.reset-mini {
  right: 8px;
}

.detail-mini {
  left: 8px;
}

.reset-mini {
  color: #b91c1c;
}

.restart-mini {
  right: 40px;
  color: var(--leaf-dark);
}

.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.45);
}

.detail-modal {
  width: min(540px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid #c4d1e2;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid #d8e1ec;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.modal-close {
  width: 34px;
  height: 34px;
  font-size: 1rem;
}

.modal-body {
  padding: 14px;
}

.modal-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
}

.detail-options-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--preview-accent);
  border-left-width: 7px;
  border-radius: 8px;
  background: var(--preview-bg);
}

.detail-option-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--preview-accent);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.84rem;
  font-weight: 900;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 28px;
  border: 1px dashed #a8b8ce;
  border-radius: 8px;
  color: #526177;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 14px;
}

.panel {
  border: 1px solid #c4d1e2;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 22px rgba(23, 32, 51, 0.06);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid #d8e1ec;
}

.panel-header h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.panel-body {
  padding: 12px;
}

.statistics-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  width: 100%;
  min-width: 0;
}

.statistics-dashboard > *,
.statistics-ranking-grid > * {
  min-width: 0;
}

.statistics-period-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #bfd2c5;
  border-radius: 8px;
  background: #ffffff;
}

.statistics-period-bar > strong {
  color: var(--leaf-dark);
  font-size: 0.86rem;
}

.statistics-period-control {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  border-radius: 8px;
  background: #edf4ef;
}

.statistics-period-button {
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  color: #355744;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.statistics-period-button[aria-pressed="true"] {
  color: #ffffff;
  background: var(--leaf);
}

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

.statistics-kpi {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 92px;
  align-content: center;
  padding: 12px;
  border: 1px solid #cad8ce;
  border-top: 4px solid var(--leaf);
  border-radius: 8px;
  background: #ffffff;
}

.statistics-kpi:nth-child(2) {
  border-top-color: #1d4ed8;
}

.statistics-kpi:nth-child(3) {
  border-top-color: #c2410c;
}

.statistics-kpi:nth-child(4) {
  border-top-color: #7c3aed;
}

.statistics-kpi:nth-child(5) {
  border-top-color: #0e7490;
}

.statistics-kpi strong {
  font-size: 1.55rem;
  line-height: 1;
  overflow-wrap: anywhere;
}

.statistics-kpi span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
}

.statistics-panel-total {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.statistics-week-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 9px;
}

.statistics-week-category-grid > .empty-inline {
  grid-column: 1 / -1;
}

.statistics-week-category-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--week-category-accent);
  border-left-width: 5px;
  border-radius: 7px;
  background: var(--week-category-bg);
}

.statistics-week-category-card > span {
  min-width: 0;
  align-self: end;
  font-size: 0.8rem;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.statistics-week-category-card > strong {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  color: var(--week-category-accent);
  font-size: 1.5rem;
  line-height: 1;
}

.statistics-week-category-card > small {
  color: #405448;
  font-size: 0.67rem;
  font-weight: 750;
}

.statistics-chart-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 8px;
}

.statistics-timeline-panel {
  min-width: 0;
  overflow: hidden;
}

.statistics-timeline-chart {
  display: grid;
  grid-template-columns: repeat(var(--timeline-columns), minmax(14px, 1fr));
  gap: 4px;
  align-items: end;
  height: 220px;
  padding: 8px 4px 0;
  border-bottom: 1px solid #cbd8cf;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 48px,
    #e5ece7 49px,
    transparent 50px
  );
}

.statistics-timeline-column {
  display: grid;
  grid-template-rows: 18px minmax(0, 1fr) 30px;
  gap: 4px;
  align-items: end;
  min-width: 0;
  height: 100%;
}

.statistics-timeline-value {
  min-height: 18px;
  color: #3c5546;
  font-size: 0.7rem;
  font-weight: 900;
  text-align: center;
}

.statistics-timeline-track {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: flex-end;
  justify-content: center;
}

.statistics-timeline-bar {
  width: min(74%, 30px);
  min-height: 0;
  border-radius: 4px 4px 0 0;
  background: #277447;
}

.statistics-timeline-bar.has-value {
  min-height: 4px;
}

.statistics-timeline-label {
  min-width: 0;
  color: #607067;
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  overflow-wrap: anywhere;
}

.statistics-ranking-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}

.statistics-ranking-list {
  display: grid;
  gap: 11px;
}

.statistics-ranking-row {
  display: grid;
  gap: 5px;
}

.statistics-ranking-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.statistics-ranking-heading strong {
  min-width: 0;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.statistics-ranking-heading span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.statistics-ranking-track {
  height: 8px;
  overflow: hidden;
  border-radius: 5px;
  background: #e9efeb;
}

.statistics-ranking-bar {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
}

.statistics-category-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}

.statistics-donut {
  position: relative;
  display: grid;
  place-items: center;
  width: 176px;
  height: 176px;
  margin: 2px auto;
  border-radius: 50%;
}

.statistics-donut::after {
  position: absolute;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: #ffffff;
  content: "";
}

.statistics-donut > span {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 2px;
  text-align: center;
}

.statistics-donut strong {
  font-size: 1.45rem;
}

.statistics-donut small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.statistics-category-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
}

.statistics-category-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 7px 0;
  border-bottom: 1px solid #e1e9e3;
  font-size: 0.82rem;
}

.statistics-category-row > span:nth-child(2) {
  min-width: 0;
  overflow-wrap: anywhere;
}

.statistics-category-row strong {
  color: #405448;
  font-size: 0.76rem;
}

.statistics-category-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

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

.weekday {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.day-cell {
  min-height: 86px;
  padding: 7px;
  border: 1px solid #d3deeb;
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  text-align: left;
}

.day-cell.is-muted {
  opacity: 0.42;
}

.day-cell.is-selected {
  border-color: #185b37;
  box-shadow: inset 0 0 0 2px #185b37;
}

.day-number {
  display: block;
  margin-bottom: 5px;
  font-weight: 900;
}

.day-food {
  display: block;
  margin-top: 3px;
  padding: 2px 5px;
  border-left: 3px solid var(--calendar-category-accent, #64748b);
  border-radius: 5px;
  color: var(--calendar-category-accent, var(--ink));
  background: var(--calendar-category-bg, #e7f0f8);
  font-size: 0.73rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-food-more {
  border-left-color: #94a3b8;
  color: #405448;
  background: #e7edf1;
}

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

.history-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid #d2ddea;
  border-radius: 8px;
  background: #f8fafc;
}

.history-list li.history-entry {
  border-left: 6px solid var(--calendar-category-accent, #64748b);
  background: var(--calendar-category-bg, #f8fafc);
}

.history-list li.history-entry strong,
.history-list li.history-entry span {
  color: var(--calendar-category-accent, var(--ink));
}

.history-entry-details {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
  gap: 3px;
}

.history-entry-note {
  margin: 0;
  color: #405448;
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.history-entry-time {
  flex: 0 0 auto;
  font-weight: 800;
}

.history-entry-meta {
  display: grid;
  flex: 0 0 auto;
  justify-items: end;
  gap: 7px;
}

.calendar-entry-actions {
  display: flex;
  gap: 5px;
}

.calendar-entry-action {
  display: grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid rgba(49, 84, 67, 0.32);
  border-radius: 7px;
  color: #315443;
  background: rgba(255, 255, 255, 0.82);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.calendar-entry-delete {
  border-color: rgba(185, 28, 28, 0.32);
  color: #b91c1c;
}

.calendar-entry-action:focus-visible,
.calendar-entry-action:hover {
  outline: 2px solid rgba(39, 116, 71, 0.28);
  outline-offset: 1px;
}

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

.form-card {
  padding: 14px;
  border: 1px solid #c4d1e2;
  border-radius: 8px;
  background: #ffffff;
}

.form-card h2 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.field-grid {
  display: grid;
  gap: 10px;
}

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

.field label {
  color: #263b55;
  font-size: 0.82rem;
  font-weight: 900;
}

.optional-label {
  color: var(--muted);
  font-weight: 700;
}

.field > small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid #b8c6d8;
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
}

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

.category-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 7px;
  max-height: 170px;
  overflow: auto;
  padding: 8px;
  border: 1px solid #b8c6d8;
  border-radius: 8px;
  background: #f8fafc;
}

.category-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid var(--swatch-accent);
  border-radius: 8px;
  color: #172033;
  background: var(--swatch-bg);
  font-size: 0.82rem;
  font-weight: 900;
  text-align: left;
}

.category-swatch[aria-pressed="true"] {
  box-shadow: inset 0 0 0 2px var(--swatch-accent);
}

.swatch-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border: 2px solid var(--swatch-accent);
  border-radius: 999px;
  background: #ffffff;
}

.meals-layout {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.meal-form-disclosure {
  padding: 0;
  overflow: hidden;
}

.meal-form-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 12px 14px;
  color: var(--leaf-dark);
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.meal-form-summary::-webkit-details-marker {
  display: none;
}

.meal-form-summary::after {
  width: 9px;
  height: 9px;
  margin-left: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: "";
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.meal-form-summary:hover {
  background: #f1f8f3;
}

.meal-form-summary:focus-visible {
  outline: 3px solid rgba(39, 116, 71, 0.24);
  outline-offset: -3px;
}

.meal-form-disclosure[open] .meal-form-summary {
  border-bottom: 1px solid #c4d1e2;
}

.meal-form-disclosure[open] .meal-form-summary::after {
  transform: rotate(225deg);
}

.meal-form-summary-icon {
  position: relative;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 7px;
  background: #e2f2e7;
}

.meal-form-summary-icon::before,
.meal-form-summary-icon::after {
  position: absolute;
  top: 12px;
  left: 7px;
  width: 12px;
  height: 2px;
  border-radius: 2px;
  background: var(--leaf);
  content: "";
}

.meal-form-summary-icon::after {
  transform: rotate(90deg);
}

.meal-form-disclosure[open] .meal-form-summary-icon::after {
  display: none;
}

.meal-form-disclosure .field-grid {
  padding: 14px;
}

.ingredient-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 7px;
  max-height: 360px;
  overflow: auto;
  padding: 8px;
  border: 1px solid #b8c6d8;
  border-radius: 8px;
  background: #f8fafc;
}

.ingredient-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 52px;
  padding: 8px;
  border: 1px solid var(--ingredient-accent);
  border-left-width: 5px;
  border-radius: 8px;
  background: var(--ingredient-bg);
}

.ingredient-option[aria-selected="true"] {
  box-shadow: inset 0 0 0 2px var(--ingredient-accent);
}

.ingredient-option input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.ingredient-option strong,
.ingredient-option small {
  display: block;
  overflow-wrap: anywhere;
}

.ingredient-option strong {
  font-size: 0.88rem;
  line-height: 1.12;
}

.ingredient-option small {
  margin-top: 3px;
  color: #31425c;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

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

.meal-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #c4d1e2;
  border-left: 7px solid #277447;
  border-radius: 8px;
  background: #f8fafc;
}

.meal-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.meal-card-header > div:first-child {
  min-width: 0;
}

.meal-card h3 {
  margin: 0;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.meal-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.meal-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.meal-actions button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.meal-ingredients {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.meal-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 27px;
  padding: 4px 8px;
  border: 1px solid #b6c6da;
  border-radius: 999px;
  background: #ffffff;
  font-size: 0.83rem;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.weekly-menu-layout {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.weekly-menu-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid #c9d9cd;
  border-bottom: 1px solid #c9d9cd;
}

.weekly-menu-controls > div:first-child {
  display: grid;
  gap: 3px;
}

.weekly-menu-controls span {
  color: var(--muted);
  font-size: 0.84rem;
}

.menu-status-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 3px;
}

.menu-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 2px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.2;
}

.menu-status-chip::before {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.menu-status-summary .is-available {
  border-color: #b7dbc2;
  color: #24643b;
  background: #edf8f0;
}

.menu-status-summary .is-waiting {
  border-color: #ead293;
  color: #765916;
  background: #fff8dc;
}

button.menu-status-chip.is-waiting:not(:disabled) {
  cursor: pointer;
}

button.menu-status-chip.is-waiting:not(:disabled):hover,
button.menu-status-chip.is-waiting:not(:disabled):focus-visible {
  border-color: #b98516;
  box-shadow: 0 0 0 2px rgba(201, 148, 32, 0.17);
}

button.menu-status-chip:disabled {
  cursor: default;
  opacity: 0.62;
}

.menu-status-summary .is-blocked {
  border-color: #efb6b6;
  color: #9e2727;
  background: #fff0f0;
}

.menu-availability-notice {
  margin: -12px 0 0;
  padding: 10px 12px;
  border-left: 5px solid #d7a72d;
  color: #654d14;
  background: #fff8dc;
  font-size: 0.88rem;
  font-weight: 700;
}

.menu-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(148px, 1fr));
  gap: 9px;
  min-width: 0;
  padding-bottom: 8px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

.menu-day {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 148px;
  padding: 10px;
  border: 1px solid #b7cdbd;
  border-top: 5px solid #277447;
  border-radius: 8px;
  background: #f8fbf8;
}

.menu-day-header {
  display: grid;
  gap: 2px;
  min-height: 45px;
  padding-bottom: 7px;
  border-bottom: 1px solid #d6e2d9;
  text-transform: capitalize;
}

.menu-day-header strong {
  font-size: 0.93rem;
}

.menu-day-header span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.menu-slot {
  display: grid;
  gap: 5px;
}

.menu-slot > span {
  color: #355843;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.menu-meal-trigger {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 12px;
  grid-template-areas:
    "name chevron"
    "status chevron";
  gap: 2px 7px;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 56px;
  padding: 7px 8px 7px 11px;
  border: 1px solid #afc5b5;
  border-left: 5px solid #8da598;
  border-radius: 7px;
  color: #183525;
  background: #ffffff;
  text-align: left;
}

.menu-meal-trigger[data-status="available"] {
  border-left-color: #3a8b55;
  background: #f4fbf6;
}

.menu-meal-trigger[data-status="waiting"] {
  border-left-color: #c99420;
  background: #fffaf0;
}

.menu-meal-trigger[data-status="blocked"],
.menu-meal-trigger[data-status="incomplete"] {
  border-left-color: #c94949;
  background: #fff5f5;
}

.menu-meal-trigger-name {
  grid-area: name;
  min-width: 0;
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-meal-trigger-status {
  grid-area: status;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 750;
}

.menu-meal-trigger-chevron {
  grid-area: chevron;
  width: 8px;
  height: 8px;
  border-right: 2px solid #557262;
  border-bottom: 2px solid #557262;
  transform: rotate(45deg) translateY(-2px);
}

.menu-meal-trigger:hover {
  border-color: #6ea17e;
  box-shadow: 0 3px 10px rgba(23, 51, 38, 0.09);
}

.menu-meal-trigger:disabled {
  opacity: 0.65;
}

.menu-consume-button {
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid #8ab79a;
  border-radius: 6px;
  color: #174a2d;
  background: #e5f5e9;
  font-size: 0.72rem;
  font-weight: 900;
}

.menu-consume-button:hover {
  border-color: #277447;
  background: #d4efdc;
}

.menu-consume-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.menu-picker-modal {
  width: min(640px, 100%);
  overflow: hidden;
}

.menu-picker-body {
  display: grid;
  min-height: 0;
}

.menu-picker-search {
  padding: 12px 14px;
  border-bottom: 1px solid #d8e4db;
  background: #f7fbf8;
}

.menu-picker-search input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #abc4b3;
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
}

.menu-recipe-options {
  display: grid;
  gap: 7px;
  max-height: min(58vh, 570px);
  overflow-y: auto;
  padding: 10px 14px;
  background: #f4f8f5;
  overscroll-behavior: contain;
}

.menu-recipe-option {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto 24px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 64px;
  padding: 8px 10px;
  border: 1px solid #c5d6ca;
  border-left: 5px solid #8da598;
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  text-align: left;
}

.menu-recipe-option[data-status="available"] {
  border-left-color: #3a8b55;
}

.menu-recipe-option[data-status="waiting"] {
  border-left-color: #c99420;
  background: #fffdf7;
}

.menu-recipe-option[data-status="blocked"],
.menu-recipe-option[data-status="incomplete"] {
  border-left-color: #c94949;
  background: #fff7f7;
}

.menu-recipe-option:hover:not(:disabled),
.menu-recipe-option[aria-checked="true"] {
  border-color: var(--leaf);
  box-shadow: inset 0 0 0 1px var(--leaf);
}

.menu-recipe-option:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.menu-recipe-palette {
  display: flex;
  align-items: center;
  width: 42px;
  min-width: 42px;
}

.menu-recipe-palette > span {
  width: 17px;
  height: 32px;
  margin-right: -9px;
  border: 2px solid var(--recipe-accent);
  border-radius: 999px;
  background: var(--recipe-color);
  box-shadow: 0 0 0 2px #ffffff;
}

.menu-recipe-palette.is-empty::before {
  width: 32px;
  height: 32px;
  border: 2px dashed #91a69a;
  border-radius: 50%;
  background: #f5f8f6;
  content: "";
}

.menu-recipe-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.menu-recipe-copy strong,
.menu-recipe-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-recipe-copy strong {
  font-size: 0.92rem;
}

.menu-recipe-copy small {
  color: var(--muted);
  font-size: 0.73rem;
}

.menu-used-ingredients {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  margin-top: 2px;
}

.menu-used-ingredient {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 23px;
  padding: 3px 7px;
  border: 1px solid var(--used-ingredient-accent);
  border-left-width: 4px;
  border-radius: 6px;
  color: #283d32;
  background: var(--used-ingredient-bg);
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.menu-recipe-status {
  min-height: 25px;
  padding: 4px 8px;
  border: 1px solid #bfd9c7;
  border-radius: 999px;
  color: #27633c;
  background: #edf8f0;
  font-size: 0.68rem;
  font-weight: 850;
  white-space: nowrap;
}

.menu-recipe-option[data-status="waiting"] .menu-recipe-status {
  border-color: #ead293;
  color: #765916;
  background: #fff5d4;
}

.menu-recipe-option[data-status="blocked"] .menu-recipe-status,
.menu-recipe-option[data-status="incomplete"] .menu-recipe-status {
  border-color: #efb6b6;
  color: #9e2727;
  background: #ffe9e9;
}

.menu-recipe-option[data-status="empty"] .menu-recipe-status {
  border-color: #cbd7cf;
  color: #607168;
  background: #f2f5f3;
}

.menu-recipe-check {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 2px solid #9bb0a2;
  border-radius: 50%;
}

.menu-recipe-option[aria-checked="true"] .menu-recipe-check {
  border-color: var(--leaf);
  background: var(--leaf);
}

.menu-recipe-option[aria-checked="true"] .menu-recipe-check::after {
  width: 8px;
  height: 4px;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  content: "";
  transform: rotate(-45deg) translateY(-1px);
}

.menu-picker-empty {
  margin: 0;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.menu-picker-footer {
  display: flex;
  justify-content: flex-end;
  padding: 10px 14px;
  border-top: 1px solid #d8e4db;
  background: #ffffff;
}

.waiting-meals-modal {
  width: min(640px, 100%);
  overflow: hidden;
}

.waiting-meals-list {
  display: grid;
  gap: 9px;
  max-height: min(68vh, 620px);
  overflow-y: auto;
  padding: 12px 14px 14px;
  background: #fffaf0;
  overscroll-behavior: contain;
}

.waiting-meal-card {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid #e3c77c;
  border-left: 5px solid #c99420;
  border-radius: 8px;
  background: #ffffff;
}

.waiting-meal-card:hover {
  border-color: #b78314;
  box-shadow: 0 3px 12px rgba(96, 70, 13, 0.12);
}

.waiting-meal-summary {
  display: grid;
  gap: 9px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.waiting-meal-summary:focus-visible {
  border-radius: 5px;
  outline: 3px solid rgba(39, 116, 71, 0.3);
  outline-offset: 3px;
}

.waiting-meal-header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.waiting-meal-header > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.waiting-meal-header strong {
  overflow-wrap: anywhere;
  font-size: 0.94rem;
}

.waiting-meal-header > div > span {
  color: #765916;
  font-size: 0.73rem;
  font-weight: 750;
}

.waiting-meal-summary > .menu-used-ingredients::before {
  align-self: center;
  margin-right: 2px;
  color: #765916;
  content: "Usados:";
  font-size: 0.7rem;
  font-weight: 900;
}

.waiting-meal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.waiting-meal-actions .compact-button {
  width: 100%;
  min-height: 34px;
}

.recipe-detail-modal {
  width: min(700px, 100%);
}

.modal-eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--leaf);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.recipe-detail-section {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #d3e0d7;
  border-radius: 8px;
  background: #f8fbf9;
}

.recipe-detail-section + .recipe-detail-section,
.recipe-steps-editor {
  margin-top: 14px;
}

.recipe-detail-section h3 {
  margin: 0;
  font-size: 0.95rem;
}

.recipe-detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.recipe-step-count,
.recipe-ingredient-count {
  padding: 4px 8px;
  border-radius: 999px;
  color: #315443;
  background: var(--leaf-soft);
  font-size: 0.72rem;
  font-weight: 900;
}

.recipe-ingredients-editor {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.recipe-detail-picker {
  max-height: 210px;
}

.recipe-detail-picker .ingredient-option {
  min-height: 48px;
}

.recipe-empty-ingredients {
  color: var(--muted);
  line-height: 1.45;
}

.recipe-ingredient-error {
  min-height: 0;
  margin: 0;
}

.recipe-ingredient-error:empty {
  display: none;
}

.recipe-step-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 28px;
}

.recipe-step-list li {
  padding-left: 4px;
  color: #263b31;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.recipe-step-list li::marker {
  color: var(--leaf);
  font-weight: 900;
}

.recipe-empty-steps {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.recipe-steps-editor textarea {
  min-height: 180px;
  line-height: 1.45;
}

.empty-inline {
  padding: 12px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  text-align: center;
}

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

.forbidden-layout {
  grid-template-columns: minmax(280px, 0.75fr) minmax(0, 1.25fr);
  align-items: start;
}

.forbidden-form-card {
  position: sticky;
  top: 258px;
}

.forbidden-manage-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid var(--forbidden-accent);
  border-left: 7px solid var(--forbidden-accent);
  border-radius: 8px;
  background: var(--forbidden-bg);
}

.forbidden-manage-row strong,
.forbidden-manage-row span {
  display: block;
  overflow-wrap: anywhere;
}

.forbidden-manage-row strong {
  font-size: 0.94rem;
}

.forbidden-manage-row span {
  margin-top: 3px;
  color: #314b3c;
  font-size: 0.78rem;
  font-weight: 800;
}

.manage-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.manage-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid #d4dfec;
  border-radius: 8px;
  background: #f8fafc;
}

.manage-row strong,
.manage-row span {
  display: block;
  overflow-wrap: anywhere;
}

.small-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.diet-management {
  grid-column: 1 / -1;
}

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

.diet-management-header h2,
.diet-management-header .small-note {
  margin: 0;
}

.diet-management-header .small-note {
  margin-top: 4px;
}

.diet-header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid #b6d5c1;
  border-radius: 999px;
  color: #1f633c;
  background: #e9f6ed;
  font-size: 0.74rem;
  font-weight: 850;
  white-space: nowrap;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) auto;
  gap: 10px;
  align-items: end;
  max-width: 720px;
  margin-top: 14px;
}

.invite-form {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.invite-result {
  max-width: 720px;
  margin-top: 12px;
}

.openclaw-management {
  grid-column: 1 / -1;
}

.openclaw-token-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(140px, 190px) auto;
  gap: 10px;
  align-items: end;
  max-width: 840px;
}

.openclaw-token-result {
  max-width: 840px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.openclaw-token-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.openclaw-token-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #c9dfd0;
  border-radius: 8px;
  background: #f5faf6;
}

.openclaw-token-row strong,
.openclaw-token-row span {
  display: block;
  overflow-wrap: anywhere;
}

.openclaw-token-row > div > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.invite-result > label {
  display: block;
  margin-bottom: 5px;
  color: #315443;
  font-size: 0.82rem;
  font-weight: 850;
}

.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.copy-row input {
  min-width: 0;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid #b5cbbd;
  border-radius: 8px;
  color: #315443;
  background: #f5faf6;
}

.member-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.member-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 7px 9px;
  border: 1px solid #d3e0d7;
  border-radius: 8px;
  background: #f8fbf9;
}

.member-row strong,
.member-row span {
  display: block;
  overflow-wrap: anywhere;
}

.member-row > div:nth-child(2) span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.member-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #ffffff;
  background: var(--leaf);
  font-size: 0.75rem;
  font-weight: 900;
}

.pending-member .member-avatar {
  color: #38634a;
  background: #d9e9dd;
}

.compact-button {
  min-height: 32px;
  padding: 0 9px;
  font-size: 0.78rem;
}

.compact-modal-actions {
  display: flex;
  justify-content: flex-end;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  max-width: min(380px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid #9fc8ac;
  border-radius: 8px;
  color: #164f30;
  background: #eff9f2;
  box-shadow: 0 14px 34px rgba(23, 51, 38, 0.18);
  font-weight: 800;
}

.assistant-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.3fr) minmax(0, 1fr);
  gap: 14px;
  min-height: 620px;
}

.assistant-sidebar,
.assistant-chat {
  min-height: 0;
  overflow: hidden;
}

.assistant-sidebar {
  display: flex;
  flex-direction: column;
}

.assistant-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.assistant-status {
  margin: 10px 12px 4px;
  padding: 7px 9px;
  border: 1px solid #d6e0d9;
  border-radius: 7px;
  color: var(--muted);
  background: #f7faf8;
  font-size: 0.76rem;
  font-weight: 850;
}

.assistant-status.is-online {
  border-color: #a7d6b5;
  color: #176136;
  background: #ebf8ef;
}

.assistant-status.is-offline {
  border-color: #efb4b4;
  color: #9f2626;
  background: #fff1f1;
}

.assistant-thread-list {
  display: grid;
  align-content: start;
  gap: 7px;
  overflow: auto;
  padding: 8px 10px 12px;
}

.assistant-thread-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 4px;
  align-items: center;
  border: 1px solid #d4e0d8;
  border-radius: 7px;
  background: #f9fbfa;
}

.assistant-thread-row.is-active {
  border-color: var(--leaf);
  background: var(--leaf-soft);
}

.assistant-thread-select,
.assistant-thread-delete {
  border: 0;
  color: var(--ink);
  background: transparent;
}

.assistant-thread-select {
  display: block;
  min-width: 0;
  padding: 9px;
  text-align: left;
}

.assistant-thread-select strong,
.assistant-thread-select span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-thread-select span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
}

.assistant-thread-delete {
  width: 28px;
  height: 28px;
  color: #9d2c2c;
  font-size: 1.15rem;
}

.assistant-chat {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #ffffff;
}

.assistant-notice {
  padding: 9px 12px;
  border-bottom: 1px solid #e5ddd0;
  color: #6b572d;
  background: #fff9e9;
  font-size: 0.78rem;
  font-weight: 750;
}

.assistant-messages {
  display: flex;
  min-height: 470px;
  max-height: 64vh;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 18px;
  scroll-behavior: smooth;
}

.assistant-message {
  display: flex;
}

.assistant-message-user {
  justify-content: flex-end;
}

.assistant-bubble {
  max-width: min(700px, 88%);
  padding: 11px 13px;
  border-radius: 10px;
  line-height: 1.45;
}

.assistant-bubble > p {
  margin: 0;
  white-space: pre-wrap;
}

.assistant-bubble-user {
  color: #ffffff;
  background: var(--leaf-dark);
}

.assistant-bubble-ai {
  border: 1px solid #d2e0d6;
  color: var(--ink);
  background: #f5faf6;
}

.assistant-typing {
  color: var(--muted);
  font-style: italic;
}

.assistant-empty {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 360px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.assistant-empty h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.35rem;
}

.assistant-empty p {
  max-width: 590px;
  margin: 9px 0 18px;
  line-height: 1.5;
}

.assistant-prompts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.assistant-prompts button {
  min-height: 38px;
  padding: 7px 10px;
  border-radius: 8px;
}

.assistant-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.assistant-form textarea {
  width: 100%;
  min-height: 48px;
  max-height: 150px;
  padding: 10px 11px;
  resize: vertical;
  border: 1px solid #aec7b5;
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
}

.assistant-composer {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.assistant-form-actions {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}

.assistant-form-actions button {
  min-height: 42px;
}

.assistant-image-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.assistant-image-previews {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 7px;
  min-width: 0;
}

.assistant-image-preview {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 6px;
  border: 1px solid #b8d0bf;
  border-radius: 7px;
  background: #f4faf5;
}

.assistant-image-preview img {
  width: 52px;
  height: 42px;
  object-fit: cover;
  border-radius: 5px;
}

.assistant-image-preview span {
  overflow: hidden;
  color: #315443;
  font-size: 0.78rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-image-remove {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid #c4d5c8;
  border-radius: 6px;
  color: #7f1d1d;
  background: #ffffff;
  font-size: 1.1rem;
  line-height: 1;
}

.assistant-result-card {
  display: grid;
  gap: 9px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #add0b8;
  border-left: 6px solid var(--leaf);
  border-radius: 8px;
  background: #ffffff;
}

.assistant-result-card h4,
.assistant-result-card p,
.assistant-result-card ol {
  margin: 0;
}

.assistant-result-card ol {
  display: grid;
  gap: 4px;
  padding-left: 22px;
}

.assistant-result-ingredients {
  color: #315443;
  font-weight: 750;
}

.assistant-result-card button {
  justify-self: start;
}

.assistant-product-card {
  gap: 11px;
}

.assistant-product-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.assistant-product-eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--leaf-dark);
  font-size: 0.7rem;
  font-weight: 850;
  text-transform: uppercase;
}

.assistant-source-link {
  flex: 0 0 auto;
  color: var(--leaf-dark);
  font-size: 0.76rem;
  font-weight: 750;
}

.assistant-confidence {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid #adc9b5;
  border-radius: 6px;
  color: #28583a;
  background: #edf8f0;
  font-size: 0.7rem;
  font-weight: 800;
}

.assistant-confidence.is-medium {
  border-color: #d6bb78;
  color: #785313;
  background: #fff8df;
}

.assistant-confidence.is-low {
  border-color: #dc9b9b;
  color: #8a2424;
  background: #fff0f0;
}

.assistant-product-summary {
  color: var(--muted);
  font-size: 0.84rem;
}

.assistant-product-ingredients {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 7px;
}

.assistant-product-ingredient {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding: 7px 8px;
  border: 1px solid var(--ingredient-accent);
  border-left-width: 5px;
  border-radius: 6px;
  background: var(--ingredient-bg);
}

.assistant-product-ingredient strong,
.assistant-product-ingredient small {
  overflow-wrap: anywhere;
}

.assistant-product-ingredient strong {
  font-size: 0.8rem;
}

.assistant-product-ingredient small {
  color: #34483b;
  font-size: 0.66rem;
  font-weight: 750;
}

.assistant-product-ingredient.is-existing {
  border-style: dashed;
}

.assistant-product-ingredient.is-forbidden {
  border-color: #b91c1c;
  color: #7f1d1d;
  background: #fee2e2;
}

.assistant-product-ingredient.is-selectable {
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  cursor: pointer;
  transition: opacity 120ms ease, background-color 120ms ease;
}

.assistant-product-ingredient.is-selectable input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--leaf);
}

.assistant-product-ingredient.is-selectable span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.assistant-product-ingredient.is-selectable.is-unselected {
  opacity: 0.55;
  background: #f3f5f4;
}

.assistant-product-ingredient.is-selectable.is-forbidden {
  cursor: not-allowed;
}

.assistant-product-label {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faf8;
  font-size: 0.78rem;
}

.assistant-product-label summary {
  color: var(--leaf-dark);
  cursor: pointer;
  font-weight: 750;
}

.assistant-product-label p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.assistant-image-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.assistant-image-actions button {
  width: 100%;
  min-height: 38px;
  white-space: normal;
}

.assistant-list-recipe-name {
  display: grid;
  gap: 5px;
  color: var(--leaf-dark);
  font-size: 0.76rem;
  font-weight: 800;
}

.assistant-list-recipe-name input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 7px 9px;
  border: 1px solid #afc8b5;
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  font-weight: 650;
}

.assistant-list-recipe-name input:focus {
  border-color: var(--leaf);
  outline: 2px solid rgba(47, 125, 76, 0.18);
  outline-offset: 1px;
}

.assistant-list-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.assistant-list-actions button {
  width: 100%;
  min-height: 38px;
  white-space: normal;
}

.assistant-image-check-result {
  margin: 0;
  padding: 8px 9px;
  border-left: 4px solid #2f7d4c;
  color: #245438;
  background: #edf8f0;
  font-size: 0.8rem;
  line-height: 1.4;
}

.assistant-image-check-result.is-blocked {
  border-left-color: #b91c1c;
  color: #7f1d1d;
  background: #feecec;
}

.assistant-suggestion-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.assistant-suggestion-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid #d2e0d6;
  border-radius: 8px;
  background: #ffffff;
}

.assistant-suggestion-card strong,
.assistant-suggestion-card span {
  display: block;
}

.assistant-suggestion-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
}

.assistant-warnings {
  margin: 10px 0 0;
  padding: 9px 9px 9px 28px;
  border-radius: 7px;
  color: #7b4f16;
  background: #fff6dd;
  font-size: 0.82rem;
}

.assistant-response-meta {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.7rem;
}

.assistant-fab {
  position: fixed;
  right: max(22px, calc((100vw - 1180px) / 2 + 22px));
  bottom: 22px;
  z-index: 55;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  padding: 0;
  border: 2px solid #ffffff;
  border-radius: 50%;
  color: #ffffff;
  background: var(--leaf-dark);
  box-shadow: 0 12px 30px rgba(18, 74, 42, 0.32);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.assistant-fab::after {
  position: absolute;
  right: 3px;
  bottom: 2px;
  width: 13px;
  height: 13px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #5bc57a;
  content: "";
}

.assistant-fab svg {
  width: 31px;
  height: 31px;
  fill: currentColor;
}

.assistant-fab:hover,
.assistant-fab:focus-visible {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 16px 34px rgba(18, 74, 42, 0.38);
}

.assistant-fab-tooltip {
  position: absolute;
  right: calc(100% + 10px);
  width: max-content;
  max-width: 180px;
  padding: 7px 10px;
  border-radius: 7px;
  color: #ffffff;
  background: #173326;
  font-size: 0.78rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateX(5px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.assistant-fab:hover .assistant-fab-tooltip,
.assistant-fab:focus-visible .assistant-fab-tooltip {
  opacity: 1;
  transform: translateX(0);
}

.medication-nav-action {
  gap: 8px;
}

.medication-nav-count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  margin-left: auto;
  padding: 0 6px;
  border-radius: 12px;
  color: #713754;
  background: #f3dce8;
  font-size: 0.75rem;
  font-weight: 900;
}

.drawer-nav .medication-nav-action[aria-pressed="true"] {
  color: #5d3f77;
  border-color: #d7c9e8;
  background: #f2edf8;
}

.medication-dashboard {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.medication-notification-band,
.medication-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 12px;
  border: 1px solid #d9cde7;
  border-radius: 8px;
  background: #fbf9fd;
}

.medication-notification-band > div {
  display: grid;
  gap: 3px;
}

.medication-notification-band strong,
.medication-filter-bar > strong {
  color: #58456e;
  font-size: 0.88rem;
}

.medication-notification-band span {
  color: #6d6278;
  font-size: 0.8rem;
}

.switch-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #58456e;
  font-size: 0.82rem;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}

.switch-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  width: 42px;
  height: 24px;
  border: 1px solid #ac9bbb;
  border-radius: 12px;
  background: #e5ddeb;
  transition: background-color 160ms ease;
}

.switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(56, 38, 72, 0.24);
  content: "";
  transition: transform 160ms ease;
}

.switch-control input:checked + .switch-track {
  border-color: #67558c;
  background: #67558c;
}

.switch-control input:checked + .switch-track::after {
  transform: translateX(18px);
}

.switch-control input:focus-visible + .switch-track {
  outline: 3px solid rgba(103, 85, 140, 0.24);
  outline-offset: 2px;
}

.medication-filter-control,
.medication-mode-control {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 3px;
  border-radius: 8px;
  background: #eee8f4;
}

.medication-filter-button,
.medication-mode-control button {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: #665575;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 850;
  white-space: nowrap;
}

.medication-filter-button[aria-pressed="true"],
.medication-mode-control button[aria-pressed="true"] {
  color: #ffffff;
  background: #67558c;
}

.medication-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.medication-empty-state {
  grid-column: 1 / -1;
}

.medication-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 248px;
  padding: 13px;
  border: 1px solid var(--medication-accent);
  border-left-width: 7px;
  border-radius: 8px;
  background: var(--medication-bg);
  box-shadow: 0 7px 18px rgba(56, 38, 72, 0.08);
}

.medication-card.is-due {
  box-shadow: inset 0 0 0 2px rgba(152, 79, 114, 0.2), 0 7px 18px rgba(56, 38, 72, 0.1);
}

.medication-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.medication-category-label,
.medication-status-label {
  color: var(--medication-accent);
  font-size: 0.7rem;
  font-weight: 900;
}

.medication-category-label {
  text-transform: uppercase;
}

.medication-status-label {
  max-width: 58%;
  text-align: right;
}

.medication-card h3 {
  margin: 15px 0 4px;
  color: #2f2936;
  font-size: 1rem;
  line-height: 1.2;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.medication-dose,
.medication-schedule,
.medication-notes {
  margin: 4px 0 0;
  color: #554c5f;
  font-size: 0.82rem;
  line-height: 1.35;
}

.medication-dose {
  color: var(--medication-accent);
  font-weight: 900;
}

.medication-notes {
  margin-top: 10px;
}

.medication-card-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 38px;
  gap: 7px;
  margin-top: auto;
  padding-top: 14px;
}

.medication-primary-button,
.medication-take-button,
.medication-secondary-button,
.medication-delete-button {
  min-height: 38px;
  padding: 0 11px;
  border-radius: 8px;
  font-weight: 850;
}

.medication-primary-button,
.medication-take-button {
  border: 1px solid #67558c;
  color: #ffffff;
  background: #67558c;
}

.medication-secondary-button {
  border: 1px solid #a99aba;
  color: #58456e;
  background: rgba(255, 255, 255, 0.78);
}

.medication-delete-button {
  width: 38px;
  padding: 0;
  border: 1px solid #c9a6b6;
  color: #8a3d60;
  background: rgba(255, 255, 255, 0.78);
}

.medication-editor-modal {
  width: min(680px, 100%);
}

.medication-editor-form {
  display: grid;
  gap: 14px;
}

.medication-main-fields,
.medication-interval-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.medication-fieldset {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  border: 0;
}

.medication-fieldset legend {
  margin-bottom: 7px;
  color: #3f3549;
  font-size: 0.84rem;
  font-weight: 850;
}

.medication-category-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.medication-category-option {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 6px 9px;
  border: 1px solid var(--medication-accent);
  border-radius: 8px;
  color: var(--medication-accent);
  background: var(--medication-bg);
  font-size: 0.76rem;
  font-weight: 850;
  text-align: left;
}

.medication-category-option > span {
  width: 12px;
  height: 12px;
  border: 3px solid var(--medication-accent);
  border-radius: 50%;
  background: #ffffff;
}

.medication-category-option[aria-pressed="true"] {
  box-shadow: inset 0 0 0 2px var(--medication-accent);
}

.medication-category-option[aria-pressed="true"] > span {
  background: var(--medication-accent);
}

.medication-active-control {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  color: #4f435a;
  font-size: 0.84rem;
  font-weight: 800;
}

.medication-active-control input {
  width: 18px;
  height: 18px;
  accent-color: #67558c;
}

.day-medication,
.history-list li.medication-history-entry {
  border-left-style: dashed;
}

.day-medication::before,
.medication-history-entry strong::before {
  color: var(--calendar-category-accent);
  content: "+ ";
  font-weight: 950;
}

.calendar-detail-header {
  align-items: flex-start;
  flex-direction: column;
  min-height: 58px;
}

.calendar-detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 7px;
  width: 100%;
}

.food-history-add-button,
.food-history-save-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #185b37;
  border-radius: 8px;
  color: #ffffff;
  background: #277447;
  font-weight: 900;
}

.medication-history-add-button,
.medication-history-save-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #514174;
  border-radius: 8px;
  color: #ffffff;
  background: #67558c;
  font-weight: 900;
}

.symptom-add-button,
.symptom-save-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #c70040;
  border-radius: 8px;
  color: #ffffff;
  background: #d50045;
  font-weight: 900;
}

.bowel-movement-add-button,
.bowel-movement-save-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #0e5e74;
  border-radius: 8px;
  color: #ffffff;
  background: #126b83;
  font-weight: 900;
}

.day-cell.has-bowel-movement {
  border-color: #5ba8ba;
  background: #f3fbfc;
  box-shadow: inset 0 -4px 0 #126b83;
}

.day-cell.has-bowel-movement.is-selected {
  border-color: #185b37;
  box-shadow: inset 0 -4px 0 #126b83, inset 0 0 0 2px #185b37;
}

.day-cell.has-symptom {
  border-color: #ed4777;
  background: #fff7fa;
  box-shadow: inset 0 4px 0 #d50045;
}

.day-cell.has-symptom.is-selected {
  border-color: #185b37;
  box-shadow: inset 0 4px 0 #d50045, inset 0 0 0 2px #185b37;
}

.day-cell.has-symptom.has-bowel-movement {
  box-shadow: inset 0 4px 0 #d50045, inset 0 -4px 0 #126b83;
}

.day-cell.has-symptom.has-bowel-movement.is-selected {
  box-shadow: inset 0 4px 0 #d50045, inset 0 -4px 0 #126b83, inset 0 0 0 2px #185b37;
}

.day-symptom,
.history-list li.symptom-history-entry {
  border-left-style: solid;
  border-left-width: 6px;
}

.day-symptom::before,
.symptom-history-entry strong::before {
  color: #d50045;
  content: "! ";
  font-weight: 950;
}

.day-bowel-movement,
.history-list li.bowel-movement-history-entry {
  border-left-style: solid;
  border-left-width: 6px;
}

.day-bowel-movement::before,
.bowel-movement-history-entry strong::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: #126b83;
  content: "";
  vertical-align: 1px;
}

.symptom-editor-modal {
  width: min(700px, 100%);
  border-color: #ef88a6;
}

.symptom-editor-form {
  display: grid;
  gap: 14px;
}

.bowel-movement-editor-modal {
  width: min(540px, 100%);
  border-color: #7eb8c6;
}

.bowel-movement-editor-form {
  display: grid;
  gap: 14px;
}

.food-history-editor-modal {
  width: min(740px, 100%);
  border-color: #8fbea0;
}

.food-history-editor-form {
  display: grid;
  gap: 14px;
}

.medication-history-editor-modal {
  width: min(740px, 100%);
  border-color: #b4a8d0;
}

.medication-history-editor-form {
  display: grid;
  gap: 14px;
}

.calendar-entry-editor-modal {
  width: min(560px, 100%);
  border-color: #8fbea0;
}

.calendar-entry-editor-form {
  display: grid;
  gap: 14px;
}

.calendar-entry-editor-summary {
  display: grid;
  gap: 3px;
  padding: 8px 0 8px 11px;
  border-left: 5px solid #277447;
  color: #173326;
  background: #f2f8f4;
}

.calendar-entry-editor-summary span {
  color: #526d5d;
  font-size: 0.78rem;
  font-weight: 800;
}

.calendar-entry-date-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.food-history-fieldset {
  display: grid;
  gap: 9px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.medication-history-fieldset {
  display: grid;
  gap: 9px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.food-history-fieldset legend {
  margin-bottom: 7px;
  color: #174c2f;
  font-size: 0.84rem;
  font-weight: 900;
}

.medication-history-fieldset legend {
  margin-bottom: 7px;
  color: #3f3549;
  font-size: 0.84rem;
  font-weight: 900;
}

.food-history-selection-summary {
  min-height: 18px;
  color: #315443;
  font-size: 0.78rem;
  font-weight: 850;
}

.medication-history-selection-summary {
  min-height: 18px;
  color: #4f435a;
  font-size: 0.78rem;
  font-weight: 850;
}

.food-history-picker {
  max-height: 330px;
}

.medication-history-picker {
  max-height: 330px;
}

.medication-history-option {
  align-items: flex-start;
}

.medication-history-option > span {
  min-width: 0;
}

.food-history-picker .empty-inline {
  grid-column: 1 / -1;
}

.food-history-date-fields,
.medication-history-date-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 520px) {
  .medication-history-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(118px, auto);
  }

  .medication-history-option {
    min-height: 118px;
    padding: 8px 6px;
  }

  .medication-history-option strong {
    font-size: 0.8rem;
    line-height: 1.08;
  }

  .medication-history-option small {
    font-size: 0.66rem;
    line-height: 1.12;
  }
}

.calendar-event-note textarea {
  min-height: 88px;
}

.symptom-fieldset {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  border: 0;
}

.symptom-fieldset legend {
  margin-bottom: 7px;
  color: #68142f;
  font-size: 0.84rem;
  font-weight: 900;
}

.symptom-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.symptom-option {
  min-height: 44px;
  padding: 7px 9px;
  border: 1px solid #e38aa5;
  border-radius: 8px;
  color: #7e2340;
  background: #fff3f7;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.2;
}

.symptom-option[aria-pressed="true"] {
  border-color: #c70040;
  color: #ffffff;
  background: #d50045;
  box-shadow: inset 0 0 0 1px #ffffff;
}

.symptom-date-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 761px) and (max-width: 1050px) {
  .auth-brand {
    padding: 40px;
  }

  .auth-brand h1 {
    font-size: 3rem;
  }
}

@media (max-width: 760px) {
  .auth-shell {
    display: block;
    min-height: 100vh;
    padding-bottom: 30px;
  }

  .auth-brand {
    min-height: auto;
    padding: 34px 24px 66px;
  }

  .auth-brand img {
    width: 56px;
    height: 56px;
    margin-bottom: 14px;
  }

  .auth-brand h1 {
    font-size: 2rem;
  }

  .auth-brand > p:last-child {
    margin-top: 14px;
    font-size: 0.96rem;
  }

  .auth-panel {
    margin: -38px auto 0;
    padding: 22px;
  }

  .app-shell {
    padding: 9px;
  }

  .topbar {
    gap: 10px;
    padding: 10px;
    background: #ffffff;
    backdrop-filter: none;
  }

  .header-controls {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-top: 8px;
  }

  .page-tabs {
    display: none;
  }

  .mobile-header-tabs {
    position: static;
    z-index: auto;
    display: flex;
    width: 100%;
    margin: 0;
    padding: 0 0 2px;
  }

  .mobile-header-tabs .tab-button {
    min-height: 34px;
    padding: 0 11px;
  }

  .food-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .food-card,
  .food-card.group-card {
    height: 126px;
    gap: 6px;
    padding: 34px 7px 9px;
    border-left-width: 6px;
  }

  .food-name {
    font-size: 0.88rem;
    line-height: 1.12;
  }

  .food-meta {
    font-size: 0.68rem;
    line-height: 1.05;
  }

  .card-options-button {
    min-height: 24px;
    padding: 3px 7px;
    font-size: 0.7rem;
  }

  .delete-mini,
  .reset-mini,
  .restart-mini,
  .detail-mini {
    top: 6px;
    width: 24px;
    height: 24px;
    font-size: 0.82rem;
  }

  .delete-mini,
  .reset-mini {
    right: 6px;
  }

  .detail-mini {
    left: 6px;
  }

  .restart-mini {
    right: 36px;
  }

  .split-layout,
  .meals-layout,
  .forbidden-layout,
  .forms-grid,
  .assistant-layout {
    grid-template-columns: 1fr;
  }

  .medication-notification-band,
  .medication-filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .switch-control {
    align-self: flex-start;
  }

  .medication-filter-control {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .medication-main-fields,
  .medication-interval-fields,
  .medication-category-picker {
    grid-template-columns: 1fr;
  }

  .symptom-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-detail-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .calendar-detail-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .assistant-layout {
    min-height: auto;
  }

  .assistant-sidebar {
    max-height: 230px;
  }

  .assistant-messages {
    min-height: 430px;
    max-height: 58vh;
    padding: 12px;
  }

  .assistant-bubble {
    max-width: 94%;
  }

  .statistics-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .statistics-period-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .statistics-period-control {
    width: 100%;
  }

  .statistics-ranking-grid,
  .statistics-category-layout {
    grid-template-columns: 1fr;
  }

  .statistics-category-legend {
    grid-template-columns: 1fr;
  }

  .assistant-product-header {
    align-items: stretch;
    flex-direction: column;
    gap: 7px;
  }

  .assistant-source-link {
    align-self: flex-start;
  }

  .assistant-product-ingredients {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .assistant-form {
    grid-template-columns: 1fr;
  }

  .assistant-form-actions {
    justify-content: flex-end;
  }

  .assistant-image-actions {
    grid-template-columns: 1fr;
  }

  .assistant-list-actions {
    grid-template-columns: 1fr;
  }

  .assistant-fab {
    right: 14px;
    bottom: 14px;
    width: 56px;
    height: 56px;
  }

  .assistant-fab svg {
    width: 28px;
    height: 28px;
  }

  .forbidden-form-card {
    position: static;
  }

  .forbidden-manage-row {
    grid-template-columns: 1fr;
  }

  .forbidden-manage-row .compact-actions {
    justify-content: flex-start;
  }

  .calendar {
    gap: 4px;
  }

  .day-cell {
    min-height: 68px;
    padding: 5px;
  }

  .day-food {
    font-size: 0.68rem;
  }

  .meal-card-header {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .meal-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .weekly-menu-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .weekly-menu-controls .compact-actions {
    width: 100%;
  }

  .weekly-menu-controls .compact-actions button {
    flex: 1 1 110px;
  }

  .menu-week-grid {
    grid-template-columns: repeat(7, 210px);
    margin-right: -9px;
  }

  .menu-picker-backdrop {
    align-items: end;
    padding: 0;
  }

  .menu-picker-modal {
    width: 100%;
    max-height: min(86dvh, 760px);
    border-radius: 8px 8px 0 0;
  }

  .waiting-meals-modal {
    width: 100%;
    max-height: min(86dvh, 760px);
    border-radius: 8px 8px 0 0;
  }

  .menu-recipe-options {
    max-height: min(58dvh, 520px);
    padding: 9px;
  }

  .menu-recipe-option {
    grid-template-columns: 34px minmax(0, 1fr) 22px;
    gap: 8px;
    padding: 8px;
  }

  .menu-recipe-palette {
    width: 34px;
    min-width: 34px;
  }

  .menu-recipe-palette > span {
    width: 15px;
    height: 30px;
    margin-right: -9px;
  }

  .menu-recipe-status {
    grid-column: 2;
    justify-self: start;
    margin-top: -1px;
  }

  .menu-recipe-check {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .waiting-meals-list {
    max-height: min(70dvh, 600px);
    padding: 9px;
  }

  .waiting-meal-header {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
  }

  .waiting-meal-header .menu-recipe-palette {
    width: 34px;
    min-width: 34px;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .openclaw-token-form {
    grid-template-columns: 1fr;
  }

  .openclaw-token-form .primary-button {
    justify-self: stretch;
  }

  .openclaw-token-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .openclaw-token-row .danger-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .member-row {
    grid-template-columns: 36px minmax(0, 1fr) auto;
  }

  .member-row .compact-button {
    grid-column: 2 / -1;
    justify-self: start;
  }
}

@media (hover: none) {
  .food-card {
    box-shadow: none;
    transition: none;
  }

  .food-card:focus-visible,
  .food-card:hover {
    transform: none;
    box-shadow: none;
  }

  .food-card.used-card {
    box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.18);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 420px) {
  .auth-panel {
    width: calc(100% - 20px);
  }

  .brand-lockup img {
    width: 38px;
    height: 38px;
  }

  .user-name {
    display: none;
  }

  .copy-row {
    grid-template-columns: 1fr;
  }

  .meal-actions {
    gap: 6px;
  }

  .meal-actions .text-button,
  .meal-actions .ghost-button {
    min-width: 0;
    min-height: 44px;
    padding-inline: 9px;
    font-size: 0.82rem;
  }

  .food-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .food-card,
  .food-card.group-card {
    height: 118px;
    gap: 4px;
    padding: 30px 4px 7px;
    border-left-width: 5px;
  }

  .food-name {
    font-size: 0.76rem;
    line-height: 1.1;
  }

  .food-meta {
    font-size: 0.58rem;
  }

  .card-options-button {
    min-height: 22px;
    padding: 2px 5px;
    font-size: 0.61rem;
  }

  .delete-mini,
  .reset-mini,
  .restart-mini,
  .detail-mini {
    top: 5px;
    width: 22px;
    height: 22px;
    font-size: 0.76rem;
  }

  .delete-mini,
  .reset-mini {
    right: 5px;
  }

  .detail-mini {
    left: 5px;
  }

  .restart-mini {
    right: 33px;
  }

  .topbar h1 {
    font-size: 1.08rem;
  }
}
