@charset "UTF-8";
:root {
  --bg: #f5f6f2;
  --paper: #ffffff;
  --ink: #243a30;
  --muted: #56664f;
  --line: #e2e7de;
  --accent: #315b48;
  --accent-soft: #e7eee1;
  --sand: #f7efdf;
  --purple: #efedf5;
  --danger: #a84438;
  --radius: 16px;
  --target: 44px;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  border: 0;
  background: transparent;
}
button:disabled {
  cursor: default;
  opacity: 0.45;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid #48764f;
  outline-offset: 3px;
}
.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  vertical-align: middle;
}
.sidebar {
  width: 216px;
  position: fixed;
  inset: 0 auto 0 0;
  background: #edf0e8;
  border-right: 1px solid var(--line);
  padding: 36px 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 650;
  letter-spacing: 1px;
}
.brand:hover {
  text-decoration: none;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #f3f4df;
}
.brand-mark .icon {
  width: 25px;
  height: 25px;
}
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 52px;
}
.nav-link {
  min-height: 48px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 10px;
  text-align: left;
  color: #5b6e5e;
}
.nav-link:hover {
  background: #e4eadd;
}
.nav-link.active {
  background: #dfe8d6;
  color: #31583d;
  font-weight: 600;
}
.nav-link b {
  font-size: 12px;
  font-weight: 500;
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 8px;
  background: #fff;
}
.workspace {
  margin-left: 216px;
  min-height: 100vh;
}
main {
  max-width: 1320px;
  margin: auto;
  padding: 44px 44px 70px;
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
h1 {
  font-size: 28px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: 0.5px;
  margin: 0;
}
h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  line-height: 1.5;
}
h3 {
  font-size: 15px;
  margin: 0;
  line-height: 1.6;
  font-weight: 600;
}
p {
  margin: 8px 0;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.icon-button,
.icon-link {
  min-width: var(--target);
  min-height: var(--target);
  width: var(--target);
  height: var(--target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  border-radius: 12px;
  color: var(--muted);
}
.icon-button:hover,
.icon-link:hover {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}
.icon-button.accent {
  background: var(--accent);
  color: #fff;
}
.icon-button.accent:hover {
  background: #244b37;
}
.icon-button.is-on {
  background: var(--accent-soft);
  color: var(--accent);
  opacity: 1;
}
.icon-button.quiet-action:hover {
  background: #faebe7;
  color: var(--danger);
}
.primary,
.secondary,
.text-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: var(--target);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
}
.primary {
  background: var(--accent);
  color: #fff;
}
.primary:hover {
  background: #244b37;
}
.secondary {
  border: 1px solid var(--line);
  background: #f6f8f1;
  color: #48603e;
}
.secondary:hover,
.text-button:hover {
  background: var(--accent-soft);
}
.text-button {
  color: var(--accent);
}
.primary .icon,
.secondary .icon,
.text-button .icon {
  width: 18px;
  height: 18px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}
.stat {
  text-align: left;
  background: var(--accent-soft);
  border: 1px solid #dce5d4;
  border-radius: var(--radius);
  padding: 20px 22px;
}
.stat.sand {
  background: var(--sand);
  border-color: #eee3cf;
}
.stat.lilac {
  background: var(--purple);
  border-color: #e2deec;
}
.stat:hover {
  filter: brightness(0.98);
}
.stat[aria-pressed="true"] {
  box-shadow: inset 0 0 0 1px #7a9170;
}
.stat-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #52684a;
}
.sand .stat-label {
  color: #7e652f;
}
.lilac .stat-label {
  color: #6c5d88;
}
.stat-label .icon {
  width: 18px;
  height: 18px;
}
.stat strong {
  display: block;
  font-size: 34px;
  line-height: 1.2;
  font-weight: 550;
  margin-top: 14px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.section-head h2 > span {
  font-size: 12px;
  font-weight: 500;
  margin-left: 7px;
  padding: 2px 7px;
  border-radius: 6px;
  background: #e6ebdf;
  color: #5d7150;
}
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 13px;
  border-radius: 11px;
  height: 44px;
  min-width: 280px;
}
.search .icon {
  color: #697d66;
  width: 18px;
  height: 18px;
}
.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 14px;
}
.search input::placeholder {
  color: #70816e;
}
.search:focus-within {
  border-color: #66805c;
  box-shadow: 0 0 0 2px #e5eddd;
}
.category-tabs {
  display: flex;
  align-items: stretch;
  gap: 26px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 16px;
}
.category-tabs button {
  white-space: nowrap;
  font-size: 13px;
  min-width: 44px;
  min-height: 44px;
  padding: 5px 0 12px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.category-tabs button.selected {
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.chip {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 12px;
  color: #546747;
}
.chip.selected {
  background: #e5eddc;
  border-color: #d6e0c9;
  color: #3b5d32;
}
.item-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.item-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 20px 20px 12px;
  min-width: 0;
}
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}
.item-symbol {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 11px;
  background: #edf1e7;
  color: #6a8456;
}
.item-symbol.clean {
  color: #6b8053;
  background: #edf1e4;
}
.item-symbol.care {
  color: #a16a50;
  background: #f8ebe5;
}
.item-symbol.food {
  color: #8e792c;
  background: #f5f0db;
}
.item-symbol.medicine {
  color: #796a9e;
  background: #eeebf6;
}
.item-symbol.other {
  color: #577a8b;
  background: #e9f0f4;
}
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.6;
  border-radius: 6px;
  padding: 3px 8px;
  white-space: nowrap;
  background: #eaf1e2;
  color: #4e6c38;
}
.badge.amber {
  background: #fbf0d9;
  color: #835c1b;
}
.badge.red {
  background: #fae8e3;
  color: #a14636;
}
.badge.purple {
  background: #eeebf7;
  color: #77618d;
}
.card-name {
  padding: 0;
  min-height: 44px;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.card-name:hover {
  color: #56804b;
}
.location {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  font-size: 13px;
  color: var(--muted);
  margin: 7px 0 0;
}
.location .icon {
  width: 14px;
  height: 14px;
  margin-top: 3px;
}
.quantity {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 22px 0 16px;
}
.quantity > strong {
  font-size: 31px;
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: -0.5px;
}
.quantity > strong.status-value {
  font-size: 24px;
  letter-spacing: 0;
}
.quantity > span {
  font-size: 13px;
  color: var(--muted);
}
.card-expiry {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 14px;
}
.card-expiry .icon {
  width: 14px;
  height: 14px;
}
.card-expiry.expired {
  color: var(--danger);
}
.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid #edf0e8;
  padding-top: 8px;
  margin-top: auto;
}
.card-actions .icon-button {
  background: #f4f6ef;
  color: #526a46;
}
.card-actions .icon-button:hover {
  background: #e4ecd9;
}
.card-actions .icon-button.is-on {
  background: #e4edda;
  color: #355e35;
}
.card-actions .icon-button:disabled:not(.is-on) {
  opacity: 0.4;
}
.empty {
  text-align: center;
  padding: 52px 20px;
  color: #728268;
}
.empty > .icon {
  width: 40px;
  height: 40px;
  color: #879d78;
  margin-bottom: 12px;
}
.empty h3 {
  font-size: 17px;
  font-weight: 500;
}
.empty .primary {
  margin-top: 22px;
}
.demo-link {
  display: flex;
  justify-content: center;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  margin-top: 12px;
  font-size: 14px;
}
.demo-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px dashed #bbcbb0;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 22px;
  font-size: 13px;
  color: #4f673e;
  background: #edf3e6;
}
.demo-banner a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
.demo-banner .icon {
  width: 15px;
  height: 15px;
}
.offline-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f4ead8;
  color: #826027;
  padding: 10px 14px;
  margin-bottom: 20px;
  border-radius: 9px;
  font-size: 13px;
}
.shopping-layout {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 22px;
  align-items: start;
}
.shopping-layout.single {
  grid-template-columns: 1fr;
}
.list-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.shopping-row {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}
.shopping-row:last-child {
  border: 0;
}
.shopping-row > div {
  flex: 1;
  min-width: 0;
}
.shopping-row h3 {
  overflow-wrap: anywhere;
}
.shopping-row p {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}
.shopping-row > strong {
  font-size: 20px;
  font-weight: 500;
  white-space: nowrap;
}
.shopping-row strong small {
  font-size: 13px;
  color: var(--muted);
}
.buy-check {
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  border: 1px solid #c7d4bc;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #8da37d;
  background: #f8faf4;
}
.buy-check:hover {
  background: #e6efdc;
  color: #4f793a;
}
.suggest-panel {
  border: 1px solid #dfe8d4;
  background: #edf3e6;
  border-radius: var(--radius);
  padding: 22px;
}
.suggest-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 17px;
  margin-top: 17px;
  border-top: 1px solid #dbe4d0;
}
.suggest-row strong {
  font-size: 14px;
  font-weight: 500;
}
.suggest-row span {
  display: block;
  font-size: 13px;
  color: var(--muted);
}
.suggest-row .icon-button {
  background: #f8faf4;
}
.completed {
  margin-top: 26px;
  border-top: 1px solid var(--line);
}
.completed summary {
  min-height: 48px;
  padding: 14px 5px;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}
.done > .icon {
  color: #6f8f5a;
}
.medicine-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.medicine-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  background: #fff;
  min-width: 0;
}
.medicine-card h2 {
  font-size: 20px;
  margin-bottom: 22px;
}
.medicine-card h3 {
  font-size: 13px;
  color: #59714f;
  margin: 18px 0 5px;
}
.medicine-card p {
  font-size: 14px;
  color: #53674c;
  line-height: 1.85;
  margin: 0;
}
.source {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 14px;
}
.source > a:not(.icon-link) {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  min-height: 44px;
}
.source > a .icon {
  width: 15px;
  height: 15px;
}
.source > time {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}
.reference-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 24px;
  padding: 12px 0;
}
.reference-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 14px;
}
.reference-links .icon {
  width: 16px;
  height: 16px;
}
.segmented {
  display: flex;
  padding: 4px;
  border-radius: 12px;
  background: #e7eddf;
}
.segmented button {
  min-height: 44px;
  padding: 9px 18px;
  border-radius: 9px;
  color: #4f643e;
  font-size: 14px;
}
.segmented button.selected {
  background: #fff;
  color: #3d5c32;
  box-shadow: 0 1px 3px #3e542412;
}
.episode {
  display: flex;
  gap: 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  margin-bottom: 16px;
}
.episode-date {
  font-size: 20px;
  white-space: nowrap;
  color: #587848;
  border-right: 1px solid var(--line);
  padding-right: 22px;
}
.episode-date time {
  display: block;
  font-size: 13px;
  color: var(--muted);
}
.episode-body {
  flex: 1;
  min-width: 0;
}
.episode-body .section-head {
  margin-bottom: 10px;
  align-items: flex-start;
}
.episode-body h3 {
  overflow-wrap: anywhere;
}
.episode-body p {
  font-size: 14px;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.drug-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #47633a !important;
}
.drug-line .icon {
  width: 17px;
  height: 17px;
  margin-top: 3px;
}
.episode-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
}
.timeline {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 24px;
}
.event {
  display: flex;
  gap: 15px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding: 23px 0;
}
.event:last-child {
  border: 0;
}
.event-dot {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: #f0f2e8;
  color: #748267;
}
.event-dot.green {
  background: #e6efdc;
  color: #55783c;
}
.event-dot .icon {
  width: 16px;
  height: 16px;
}
.event > div {
  flex: 1;
  min-width: 0;
}
.event h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.event p {
  font-size: 13px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.event time {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}
.delta {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  color: #876039;
}
.delta.positive {
  color: #4d7936;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 22px;
}
.settings-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.settings-card h2 {
  margin-bottom: 12px;
  font-size: 15px;
  color: #536a4a;
}
.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 10px 0;
  text-align: left;
  border-bottom: 1px solid #edf0e7;
  border-radius: 0;
  color: var(--ink);
  font-size: 14px;
}
.settings-row:last-child {
  border-bottom: 0;
}
.settings-row > .icon:first-child {
  width: 19px;
  height: 19px;
  color: #6c865c;
}
.settings-row > span {
  flex: 1;
}
.settings-row > strong {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}
.settings-row > .icon:last-child:not(:first-child) {
  width: 16px;
  height: 16px;
  color: #86977a;
}
.settings-row:hover {
  color: var(--accent);
  text-decoration: none;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 0;
  border-bottom: 1px solid #edf0e7;
  font-size: 14px;
}
.setting-row > strong {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}
.advanced-settings > summary {
  cursor: pointer;
  min-height: 48px;
  padding: 13px 0 5px;
  color: var(--muted);
  font-size: 13px;
}
.advanced-settings .settings-row {
  padding-left: 8px;
}
.mobile-nav {
  display: none;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 20px;
  width: calc(100% - 32px);
  max-width: 620px;
  max-height: 90dvh;
  padding: 0;
  box-shadow: 0 24px 100px #263a3226;
  color: var(--ink);
  background: #fff;
}
dialog::backdrop {
  background: #22332970;
  backdrop-filter: blur(4px);
}
#dialog-form,
.info-dialog {
  padding: 26px;
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
}
.dialog-head h2 {
  font-size: 22px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  color: #5c7350;
}
.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #dce4d5;
  border-radius: 10px;
  outline: none;
  background: #fafbf7;
  color: var(--ink);
  font-size: 15px;
}
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  border-color: #6e895e;
  box-shadow: 0 0 0 2px #e6eede;
}
.form-grid input::placeholder,
.form-grid textarea::placeholder {
  color: #5f7350;
  font-size: 13px;
}
.form-grid label[hidden] {
  display: none;
}
.wide {
  grid-column: 1 / -1;
}
.form-hint {
  margin: 0;
  padding: 12px;
  font-size: 13px;
  color: #4d633c;
  background: #eff4e8;
  border-radius: 9px;
}
.form-error {
  color: var(--danger);
  font-size: 13px;
  white-space: pre-wrap;
  min-height: 20px;
}
.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.detail-summary > p {
  font-size: 14px;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.detail-summary h3 {
  margin: 22px 0 8px;
  font-size: 14px;
}
.detail-summary small,
.snapshot-row small {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.batch,
.snapshot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 8px;
}
.detail-event {
  padding-bottom: 9px;
  border-bottom: 1px solid #edf0e7;
  font-size: 14px;
}
.checkbox {
  flex-direction: row !important;
  align-items: center;
  min-height: 44px;
}
.checkbox input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--accent);
}
.backup-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin: 22px 0;
  font-size: 15px;
  color: #48623a;
}
.help-content {
  font-size: 15px;
  line-height: 1.85;
  color: #53684a;
}
.help-content p {
  margin: 0 0 16px;
}
.help-content p:last-child {
  margin-bottom: 0;
}
.help-content ol {
  padding-left: 22px;
}
.help-content li {
  margin-bottom: 12px;
}
.loading,
.startup-error {
  max-width: 600px;
  margin: 100px auto;
  padding: 30px;
  text-align: center;
}
.startup-error p {
  color: var(--muted);
}
#toast {
  position: fixed;
  bottom: 30px;
  left: calc(50% + 108px);
  transform: translate(-50%, 16px);
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  border-radius: 12px;
  background: #294d3d;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  font-size: 14px;
  z-index: 1000;
  transition:
    opacity 0.15s,
    transform 0.15s;
  box-shadow: 0 4px 25px #294d3d22;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (max-width: 1150px) {
  .sidebar {
    width: 200px;
    padding: 32px 16px;
  }
  .brand {
    font-size: 20px;
    gap: 10px;
  }
  .workspace {
    margin-left: 200px;
  }
  main {
    padding: 36px 28px 60px;
  }
  .item-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .shopping-layout {
    grid-template-columns: 1fr;
  }
  .category-tabs {
    gap: 22px;
  }
  .stat {
    padding: 18px;
  }
  .stats {
    gap: 12px;
  }
  #toast {
    left: calc(50% + 100px);
  }
}
@media (max-width: 760px) {
  .sidebar {
    display: none;
  }
  .workspace {
    margin-left: 0;
  }
  main {
    padding: calc(24px + env(safe-area-inset-top)) 20px
      calc(108px + env(safe-area-inset-bottom));
  }
  h1 {
    font-size: 26px;
  }
  .page-heading {
    margin-bottom: 24px;
    gap: 12px;
  }
  .page-actions {
    gap: 4px;
  }
  .stats {
    gap: 10px;
    margin-bottom: 26px;
  }
  .stat {
    padding: 15px 12px;
    border-radius: 13px;
  }
  .stat-label {
    font-size: 12px;
    gap: 4px;
  }
  .stat-label .icon {
    width: 14px;
    height: 14px;
  }
  .stat strong {
    font-size: 29px;
    margin-top: 13px;
  }
  .section-head {
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
  }
  .section-head > h2 {
    font-size: 16px;
  }
  .section-head > .search {
    flex: 1;
    min-width: 175px;
  }
  .search {
    min-width: 0;
    padding: 0 11px;
  }
  .search input {
    font-size: 16px;
  }
  .search input::placeholder {
    font-size: 13px;
  }
  .category-tabs {
    gap: 23px;
    margin-bottom: 14px;
  }
  .category-tabs button {
    font-size: 13px;
  }
  .filters {
    gap: 7px;
    margin-bottom: 16px;
  }
  .chip {
    font-size: 12px;
    padding: 8px 11px;
  }
  .item-grid {
    gap: 12px;
  }
  .item-card {
    padding: 16px 14px 10px;
    border-radius: 14px;
  }
  .card-top {
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
  }
  .item-symbol {
    width: 33px;
    height: 33px;
    border-radius: 10px;
  }
  .item-symbol .icon {
    width: 19px;
    height: 19px;
  }
  .badge {
    padding: 3px 6px;
    font-size: 11px;
  }
  .card-name {
    font-size: 15px;
  }
  .location {
    font-size: 12px;
  }
  .quantity {
    margin: 20px 0 15px;
  }
  .quantity > strong {
    font-size: 29px;
  }
  .quantity > strong.status-value {
    font-size: 22px;
  }
  .quantity > span {
    font-size: 12px;
  }
  .card-expiry {
    font-size: 12px;
    gap: 4px;
  }
  .card-expiry .icon {
    width: 12px;
    height: 12px;
  }
  .card-actions {
    gap: 8px;
  }
  .card-actions .icon-button {
    border-radius: 11px;
  }
  .mobile-nav {
    display: flex;
    position: fixed;
    inset: auto 0 0;
    align-items: stretch;
    justify-content: space-around;
    z-index: 20;
    padding: 9px 6px calc(9px + env(safe-area-inset-bottom));
    border-top: 1px solid #dfe5d8;
    background: #f9fbf5f5;
    backdrop-filter: blur(14px);
  }
  .mobile-nav button {
    min-width: 58px;
    min-height: 48px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: #64795a;
    font-size: 11px;
    padding: 4px;
  }
  .mobile-nav button.active {
    color: #2b572d;
    font-weight: 600;
  }
  .mobile-nav .icon {
    width: 22px;
    height: 22px;
  }
  .mobile-nav button.active .icon {
    background: #e4edd9;
    box-shadow: 0 0 0 5px #e4edd9;
    border-radius: 5px;
  }
  .mobile-nav b {
    position: absolute;
    top: -3px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: #4f7340;
    color: #fff;
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    line-height: 16px;
    padding: 0 3px;
  }
  .shopping-row {
    gap: 10px;
    padding: 17px 13px;
  }
  .shopping-row h3 {
    font-size: 14px;
  }
  .shopping-row p {
    font-size: 13px;
  }
  .shopping-row > strong {
    font-size: 19px;
  }
  .shopping-row .quiet-action {
    width: 44px;
  }
  .suggest-panel {
    padding: 21px;
  }
  .medicine-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .medicine-card {
    padding: 22px;
  }
  .medicine-card h2 {
    font-size: 20px;
  }
  .reference-links {
    gap: 8px 20px;
  }
  .episode {
    padding: 20px 15px;
    gap: 14px;
  }
  .episode-date {
    font-size: 17px;
    padding-right: 13px;
  }
  .episode-body h3 {
    font-size: 14px;
  }
  .episode-body .section-head {
    gap: 8px;
  }
  .episode-body p {
    font-size: 14px;
  }
  .timeline {
    padding: 0 16px;
  }
  .event {
    gap: 11px;
    padding: 20px 0;
  }
  .event h3 {
    font-size: 14px;
  }
  .delta {
    font-size: 13px;
  }
  .settings-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .settings-card {
    padding: 20px;
  }
  .settings-row,
  .setting-row {
    font-size: 15px;
  }
  dialog {
    max-height: 88dvh;
    border-radius: 18px;
  }
  #dialog-form,
  .info-dialog {
    padding: 23px 20px;
  }
  .dialog-head h2 {
    font-size: 21px;
  }
  .form-grid {
    gap: 16px;
  }
  .form-grid input,
  .form-grid select,
  .form-grid textarea {
    font-size: 16px;
  }
  .form-grid label {
    font-size: 13px;
  }
  .dialog-footer {
    position: sticky;
    bottom: -23px;
    background: #fff;
    padding-bottom: 4px;
  }
  .detail-summary .button-group button {
    font-size: 13px;
    padding: 9px 12px;
  }
  #toast {
    left: 50%;
    bottom: calc(88px + env(safe-area-inset-bottom));
    font-size: 13px;
    min-width: 220px;
    text-align: center;
  }
  .startup-error {
    margin: 80px 20px;
  }
}
@media (max-width: 359px) {
  main {
    padding-left: 16px;
    padding-right: 16px;
  }
  .item-grid {
    grid-template-columns: 1fr;
  }
  .stat-label .icon {
    display: none;
  }
  .stat {
    padding: 14px 10px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .wide {
    grid-column: 1;
  }
  .section-head > .search {
    min-width: 100%;
  }
  .shopping-row {
    flex-wrap: wrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.demo-link{border:0;background:transparent;cursor:pointer;font:inherit;min-height:44px}.demo-banner button{display:inline-flex;align-items:center;gap:8px;background:transparent;border:0;color:inherit;min-height:44px;font:inherit;cursor:pointer}.lookup-form{display:flex;align-items:end;gap:12px;margin:20px 0}.lookup-form label{flex:1;min-width:0}.lookup-card{border-top:1px solid var(--line,#ddd);padding:20px 0}.lookup-card p{overflow-wrap:anywhere;white-space:pre-line}.lookup-card summary{min-height:44px;cursor:pointer;display:flex;align-items:center}.lookup-actions{display:flex;justify-content:flex-end;align-items:center;gap:12px;margin-top:12px}#lookup-results>p{line-height:1.6}

.label-excerpt summary{min-height:44px;display:flex;align-items:center;cursor:pointer}.label-excerpt p{white-space:pre-line;overflow-wrap:anywhere}
