/* 今天吃什么 —— 全局外壳样式
   配色靠 CSS 变量，切换主题只改 html[data-theme]。 */

:root {
  --radius: 14px;
  --radius-sm: 10px;
  --gap: 12px;
  --topbar-h: 58px;
  --sidebar-w: 180px;
  --shadow: 0 8px 24px rgba(15, 23, 42, .12);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, .08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --like: #e0342b;
  --dislike: #8a8f98;
  --warn: #d97706;
  --danger: #dc2626;
  --ok: #0f9d58;
}

html[data-theme="light"] {
  --bg: #f5f6f8;
  --bg-soft: #ffffff;
  --panel: #ffffff;
  --panel-2: #f2f4f7;
  --border: #e3e6eb;
  --text: #1d2530;
  --text-soft: #64707f;
  --text-mute: #93a0ae;
  --accent: #2f7ce0;
  --accent-soft: #e8f1fd;
  --accent-text: #ffffff;
  --top-bg: #ffffff;
  --overlay: rgba(15, 23, 42, .42);
}

html[data-theme="sky"] {
  --bg: #0f172a;
  --bg-soft: #141f38;
  --panel: #18233c;
  --panel-2: #1e2a46;
  --border: #2a3859;
  --text: #e8eefc;
  --text-soft: #a3b1cc;
  --text-mute: #7c8aa8;
  --accent: #4c9aff;
  --accent-soft: #1d3358;
  --accent-text: #06162c;
  --top-bg: #131c31;
  --overlay: rgba(3, 8, 20, .62);
}

html[data-theme="dark"] {
  --bg: #101114;
  --bg-soft: #16181c;
  --panel: #1b1d22;
  --panel-2: #23262c;
  --border: #2e323a;
  --text: #e9ebef;
  --text-soft: #a4abb7;
  --text-mute: #767d89;
  --accent: #7cb4ff;
  --accent-soft: #23304a;
  --accent-text: #0a1220;
  --top-bg: #16181c;
  --overlay: rgba(0, 0, 0, .62);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
}

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

/* ---------------------------------------------------------------- 顶栏 */

.topbar {
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--top-bg);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, #ff8a3d, #ff5252);
  box-shadow: 0 0 0 4px rgba(255, 138, 61, .16);
  flex: none;
}
.brand-text {
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-title {
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-soft);
  white-space: nowrap;
}

.top-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  font-size: 13px;
  color: var(--text-soft);
}
.top-date { white-space: nowrap; }
.top-identity {
  max-width: 9em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* ---------------------------------------------------------------- 布局 */

.layout {
  display: flex;
  height: calc(100% - var(--topbar-h));
}

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.nav-spacer { flex: 1 1 auto; min-height: 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-icon { font-size: 16px; line-height: 1; flex: none; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }

.main {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  padding: 18px;
  outline: none;
  -webkit-overflow-scrolling: touch;
}

/* ---------------------------------------------------------------- 通用控件 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-size: 13.5px;
  line-height: 1.2;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .06s;
}
.btn:hover { background: var(--panel-2); }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 8px; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.06); background: var(--accent); }

.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 34%, var(--border)); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }

.btn.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.btn.like.is-on {
  background: color-mix(in srgb, var(--like) 14%, transparent);
  border-color: color-mix(in srgb, var(--like) 46%, var(--border));
  color: var(--like);
}
.btn.dislike.is-on {
  background: color-mix(in srgb, var(--dislike) 16%, transparent);
  border-color: color-mix(in srgb, var(--dislike) 46%, var(--border));
  color: var(--dislike);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-soft);
  font-size: 12px;
  white-space: nowrap;
}
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.like { background: color-mix(in srgb, var(--like) 13%, transparent); color: var(--like); }
.chip.dislike { background: color-mix(in srgb, var(--dislike) 16%, transparent); color: var(--dislike); }
.chip.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.chip.danger { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }

.input, .select, .textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.textarea { resize: vertical; min-height: 88px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; color: var(--text-soft); font-weight: 600; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.page-title { font-size: 17px; font-weight: 700; }
.page-sub { font-size: 13px; color: var(--text-soft); }
.spacer { flex: 1 1 auto; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-soft);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.empty h3 { margin: 0 0 8px; font-size: 16px; color: var(--text); }
.empty p { margin: 0 0 14px; font-size: 13.5px; }

.muted { color: var(--text-mute); font-size: 12.5px; }

.thumb {
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 12px;
  object-fit: cover;
  background: var(--panel-2);
  display: block;
}
.thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mute);
  font-size: 18px;
}

/* ---------------------------------------------------------------- 菜单 */

.day-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.day-date { font-size: 18px; font-weight: 700; }
.day-relation { font-size: 12.5px; color: var(--accent); background: var(--accent-soft); padding: 2px 9px; border-radius: 999px; }

.meals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  align-items: start;
}

.meal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.meal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
}
.meal-count { font-size: 12px; font-weight: 500; color: var(--text-mute); }
.meal-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.meal-body .muted { padding: 6px 3px; }

.dish-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.dish-item.is-refused { border-color: color-mix(in srgb, var(--danger) 42%, var(--border)); }
.dish-item.is-mine { box-shadow: inset 3px 0 0 var(--accent); }

.dish-item-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.dish-name-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.dish-name {
  font-weight: 600;
  font-size: 14.5px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--text);
  text-align: left;
}
.dish-name:hover { color: var(--accent); text-decoration: underline; }

.people { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-soft); }
.person { display: inline-flex; align-items: center; gap: 3px; }
.person .heart { color: var(--like); font-size: 11px; }

.dish-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; grid-column: 1 / -1; }
.dish-actions .spacer { flex: 1 1 auto; }

.notice {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border-radius: 9px;
  font-size: 12.5px;
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  color: var(--warn);
}
.notice.danger { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); font-weight: 600; }

.stats {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.stats-head { padding: 10px 13px; background: var(--panel-2); border-bottom: 1px solid var(--border); font-weight: 600; }
.stats-body { padding: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  min-width: 0;
}
.stat-item .stat-name { font-weight: 600; font-size: 13.5px; }
.stat-item .stat-sub { font-size: 11.5px; color: var(--text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- 库列表 */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  margin-bottom: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.search { position: relative; flex: 1 1 220px; min-width: 180px; }
.search .input { padding-left: 32px; }
.search::before {
  content: "🔍";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: .6;
  pointer-events: none;
}

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

.lib-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 11px;
  padding: 11px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color .15s, transform .08s;
}
.lib-card:hover { border-color: color-mix(in srgb, var(--accent) 46%, var(--border)); }
.lib-card:active { transform: scale(.995); }
.lib-card .thumb { width: 64px; height: 64px; }
.lib-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.lib-name { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tags { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.lib-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; grid-column: 1 / -1; }

/* ---------------------------------------------------------------- 弹窗 / 浮窗 */

.layer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--overlay);
  backdrop-filter: blur(2px);
}
.layer.is-sub { z-index: 50; }

.modal {
  width: min(720px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: pop .16s ease-out;
}
.modal.narrow { width: min(520px, 100%); }
.modal.wide { width: min(960px, 100%); }
@keyframes pop { from { transform: scale(.97); opacity: .6; } to { transform: scale(1); opacity: 1; } }

.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  flex: none;
}
.modal-title { font-weight: 700; font-size: 15px; }
.modal-head .spacer { flex: 1 1 auto; }
.modal-body { padding: 16px; overflow-y: auto; flex: 1 1 auto; }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
  flex: none;
}
.modal-foot .spacer { flex: 1 1 auto; }

.close-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  cursor: pointer;
  line-height: 1;
  font-size: 15px;
  color: var(--text-soft);
}
.close-btn:hover { color: var(--danger); border-color: var(--danger); }

.detail-top { display: grid; grid-template-columns: 132px 1fr; gap: 16px; }
.detail-image {
  width: 132px;
  height: 132px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--panel-2);
  display: block;
}
.detail-image-empty {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-mute); font-size: 30px;
}
.image-tools { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.image-tools .btn { width: 100%; }

.section { margin-top: 18px; }
.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-soft);
}
.section-head .spacer { flex: 1 1 auto; }

.kv { display: grid; grid-template-columns: 76px 1fr; gap: 8px 10px; align-items: center; font-size: 13.5px; }
.kv > .k { color: var(--text-soft); font-size: 12.5px; }

.recipe-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  margin-bottom: 9px;
  overflow: hidden;
}
.recipe-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--panel-2);
  font-size: 13px;
  font-weight: 600;
}
.recipe-head .spacer { flex: 1 1 auto; }
.recipe-body { padding: 10px; font-size: 13px; }
.recipe-link { color: var(--accent); word-break: break-all; }

.rich {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  padding: 10px;
  min-height: 90px;
  max-height: 340px;
  overflow-y: auto;
  line-height: 1.65;
  word-break: break-word;
}
.rich:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.rich img { max-width: 100%; border-radius: 10px; display: block; margin: 8px 0; }
.rich h1, .rich h2, .rich h3 { margin: 10px 0 6px; font-size: 15px; }
.rich p { margin: 6px 0; }
.rich ul, .rich ol { margin: 6px 0; padding-left: 22px; }
.rich[data-empty="1"]::before { content: "在这里写做法……"; color: var(--text-mute); }

.rich-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }

.picker { position: relative; }
.picker-list {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 4px);
  z-index: 5;
  max-height: 190px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 4px;
}
.picker-item {
  display: flex; align-items: center; gap: 7px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
}
.picker-item:hover { background: var(--panel-2); }
.picker-empty { padding: 8px; font-size: 12.5px; color: var(--text-mute); }
.picker-create { color: var(--accent); font-weight: 600; }

.chip-list { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip-item {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 4px 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
}
.chip-item button {
  border: 0; background: none; cursor: pointer;
  color: inherit; opacity: .7; line-height: 1; padding: 0 4px;
}
.chip-item button:hover { opacity: 1; }

.nutrition-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; align-items: center; }

/* 悬浮按钮 / 悬浮窗（菜单预览） */
.float-btn {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 35;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  background: var(--accent);
  color: var(--accent-text);
  font-size: 20px;
  cursor: grab;
  box-shadow: var(--shadow);
  touch-action: none;
  user-select: none;
}
.float-btn:active { cursor: grabbing; }

.float-win {
  position: fixed;
  z-index: 35;
  width: min(320px, calc(100vw - 28px));
  max-height: min(58vh, 480px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  touch-action: none;
}
.float-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  cursor: grab;
  font-size: 13px;
  font-weight: 600;
  flex: none;
}
.float-head:active { cursor: grabbing; }
.float-head .spacer { flex: 1 1 auto; }
.float-body { overflow-y: auto; padding: 10px; font-size: 13px; display: flex; flex-direction: column; gap: 8px; }
.float-meal { display: flex; flex-direction: column; gap: 4px; }
.float-meal-name { font-size: 12px; font-weight: 600; color: var(--text-soft); }
.float-dish { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.float-dish .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex: none; }

/* toast */
.toasts {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 9px 16px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 88%, transparent);
  color: var(--bg);
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toast-in .18s ease-out;
  max-width: min(88vw, 420px);
  text-align: center;
}
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 日期选择器 */
.datepick { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; }
.datepick .select { text-align: center; }

.loading { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 36px; color: var(--text-soft); font-size: 13.5px; }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 关于 */
.ver-list { display: flex; flex-direction: column; gap: 7px; }
.ver-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  font-size: 13px;
}
.ver-path { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ver-tag { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--text-soft); }
.ver-warn { color: var(--warn); font-weight: 600; }
.log-box {
  background: #0b0f16;
  color: #cfd8e3;
  border-radius: var(--radius-sm);
  padding: 10px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.5;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 8px;
}

/* ---------------------------------------------------------------- 响应式 */

@media (max-width: 820px) {
  :root { --topbar-h: 52px; }
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 0 12px;
    row-gap: 0;
  }
  .view-title {
    grid-column: 1 / -1;
    order: 3;
    display: none;
  }
  .top-date { display: none; }
  .layout { flex-direction: column; }
  .sidebar {
    width: auto;
    flex: none;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .nav-item { flex: none; padding: 7px 11px; font-size: 13px; }
  .nav-icon { font-size: 14px; }
  .nav-spacer { display: none; }
  .main { padding: 12px; }
  .meals { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }

  .layer { padding: 0; align-items: stretch; }
  .modal, .modal.narrow, .modal.wide {
    width: 100%;
    max-height: none;
    height: 100%;
    border-radius: 0;
    border: 0;
    animation: none;
  }
  .detail-top { grid-template-columns: 108px 1fr; }
  .detail-image { width: 108px; height: 108px; }
  .toasts { bottom: 96px; }
  .float-btn { right: 14px; bottom: 14px; width: 50px; height: 50px; }
}