/* 婚礼预实看板 · 莫奈花园
 * 取景:站在日本桥上往下看睡莲池——没有地平线,只有倒影和浮光。
 * 左栏是深水/桥影,右栏是漂在水面上的睡莲台,数字用旧式衬线体。
 */

/* ── 池水的颜色,取自吉维尼的不同时刻 ────────────── */
:root {
  --pony-deep: #24463f;   /* 桥影,最深的池水 */
  --pony: #3d7a6d;        /* 池水 */
  --pony-lit: #7ba79c;    /* 被光照亮的水 */
  --lily: #d98ba6;        /* 睡莲粉 */
  --lily-lit: #f0b9c8;
  --lily-wash: #f7e2e8;
  --willow: #8fae6b;      /* 垂柳 */
  --wisteria: #7d7aa6;    /* 紫藤 */
  --sun: #fdf6e4;         /* 叶隙漏下的光 */
  --paper: #f7f5ee;       /* 睡莲台的纸面 */
  --ink: #1d3830;
  --ink-soft: #56756b;
  --ink-faint: #8aa198;
  --line: rgba(36, 70, 63, 0.16);
  --line-soft: rgba(36, 70, 63, 0.09);
  --glass: linear-gradient(180deg, rgba(250, 251, 246, 0.78), rgba(234, 243, 238, 0.6));
  --bar-h: 52px;
  --rail-w: 226px;
  --rail-w-off: 54px;
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --shadow: 0 14px 34px rgba(28, 62, 55, 0.1), 0 2px 6px rgba(28, 62, 55, 0.05);
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", Georgia, serif;
  --num: "Iowan Old Style", "Palatino Linotype", Palatino, "Hoefler Text", Georgia, "Songti SC", serif;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  background:
    radial-gradient(1200px 520px at 68% -8%, rgba(123, 167, 156, 0.3), transparent 62%),
    radial-gradient(1100px 520px at -8% -12%, rgba(255, 253, 246, 0.92), transparent 58%),
    radial-gradient(760px 460px at 108% 6%, rgba(240, 185, 200, 0.38), transparent 54%),
    radial-gradient(900px 560px at 84% 104%, rgba(143, 174, 107, 0.34), transparent 58%),
    linear-gradient(168deg, #eef3e6 0%, #dde9e1 44%, #d2e1dd 100%);
}

/* 纸纹:一整层极淡的纤维噪点。所有平面共用,页面就不再是纯色的网页感。 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  opacity: 0.055;
  mix-blend-mode: multiply;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--pony); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.24; margin: 0; }

:focus-visible {
  outline: 2px solid var(--lily);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── 背景:一片真的池子 ─────────────────────────── */
.garden { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
#app { position: relative; z-index: 1; }

.pond { position: absolute; inset: -10% -6%; }
.sheen {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(253, 246, 228, 0.5), rgba(253, 246, 228, 0) 70%);
  filter: blur(18px);
  animation: drift var(--dur, 44s) ease-in-out infinite alternate;
  animation-delay: var(--t, 0s);
}
.s1 { --dur: 46s; --t: 0s;   width: 60vw; height: 34vh; left: -8%;  top: 8%; }
.s2 { --dur: 58s; --t: -12s; width: 46vw; height: 30vh; right: -6%; top: 30%; }
.s3 { --dur: 64s; --t: -26s; width: 72vw; height: 26vh; left: 12%;  bottom: 2%; }
.s4 { --dur: 52s; --t: -38s; width: 34vw; height: 40vh; right: 22%; top: 58%; }

.dab {
  position: absolute;
  left: var(--x); top: var(--y);
  width: var(--w); height: var(--h);
  margin: calc(var(--h) / -2) 0 0 calc(var(--w) / -2);
  border-radius: 50%;
  opacity: var(--o);
  filter: blur(34px);
  animation: sway var(--dur2, 120s) ease-in-out infinite alternate;
}
.dab.lily { background: radial-gradient(circle at 44% 40%, var(--lily-lit), rgba(217, 139, 166, 0) 68%); --dur2: 132s; }
.dab.willow { background: radial-gradient(circle at 50% 50%, var(--willow), rgba(143, 174, 107, 0) 70%); --dur2: 108s; }
.dab.wisteria { background: radial-gradient(circle at 52% 46%, var(--wisteria), rgba(125, 122, 166, 0) 70%); --dur2: 150s; }
.dab.water { background: radial-gradient(circle at 48% 52%, var(--pony-lit), rgba(123, 167, 156, 0) 72%); --dur2: 118s; }

.shaft {
  position: absolute;
  top: -14%; left: 6%;
  width: 46vw; height: 96vh;
  background: linear-gradient(102deg, rgba(255, 250, 235, 0.62), rgba(255, 250, 235, 0) 62%);
  transform: rotate(7deg);
  filter: blur(26px);
  animation: breathe 28s ease-in-out infinite alternate;
}

.bank {
  position: absolute;
  top: -1%; right: -4%;
  width: min(1180px, 96vw);
  height: min(520px, 68vh);
  opacity: 0.92;
  mask-image: linear-gradient(102deg, transparent 0%, #000 20%, #000 78%, transparent 100%);
  -webkit-mask-image: linear-gradient(102deg, transparent 0%, #000 20%, #000 78%, transparent 100%);
}
.bank .bridge, .bank .lilies { transform-box: fill-box; transform-origin: center; animation: breathe 22s ease-in-out infinite alternate; }
.bank .petals { animation: sway 90s ease-in-out infinite alternate; }

.vignette {
  position: absolute; inset: 0;
  background: radial-gradient(120% 88% at 50% 34%, transparent 52%, rgba(36, 70, 63, 0.13));
}

/* 两片一直陪着你的浮叶:上半身可见,滚到账目区就沉到水下,不去干扰数字 */
.pad-cluster {
  position: absolute;
  pointer-events: none;
  mask-image: linear-gradient(180deg, #000 0 52%, transparent 94%);
  -webkit-mask-image: linear-gradient(180deg, #000 0 52%, transparent 94%);
  animation: sway 86s ease-in-out infinite alternate;
}
.pad-cluster.a { left: calc(var(--rail-w) + 0.5%); bottom: 4vh; width: 290px; opacity: 0.36; }
.pad-cluster.b { right: 1.5%; bottom: 24vh; width: 230px; opacity: 0.26; animation-duration: 108s; animation-delay: -30s; }

@keyframes drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(2.4%, 3%, 0) scale(1.08); } }
@keyframes sway { from { transform: translate3d(0, 0, 0) rotate(0deg); } to { transform: translate3d(-3%, 4%, 0) rotate(3deg); } }
@keyframes breathe { from { opacity: 0.62; transform: rotate(7deg) scale(1); } to { opacity: 0.95; transform: rotate(4deg) scale(1.04); } }

/* ── 骨架:深水栏 + 睡莲台 ─────────────────────── */
.shell {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
  align-items: start;
}

.sidenav {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 20px 14px 72px;
  color: #e9f1ec;
  background:
    radial-gradient(120% 40% at 50% -6%, rgba(143, 174, 107, 0.22), transparent 62%),
    linear-gradient(180deg, #2b5049 0%, #234640 46%, #1b3833 100%);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.07);
  z-index: 6;
}
.sidenav::-webkit-scrollbar { width: 6px; }
.sidenav::-webkit-scrollbar-thumb { background: rgba(233, 241, 236, 0.22); border-radius: 999px; }

.sidenav .brand { font-family: var(--serif); font-size: 20px; line-height: 1.22; color: #f6f3e8; }
.sidenav .brand-kicker { font-size: 11px; letter-spacing: 0.14em; color: rgba(233, 241, 236, 0.6); margin-top: 4px; }

.side-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.fold-nav {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(233, 241, 236, 0.28);
  background: rgba(255, 255, 255, 0.07);
  color: #e9f1ec;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  transition: background 0.18s, border-color 0.18s;
}
.fold-nav:hover { background: rgba(240, 185, 200, 0.2); border-color: rgba(240, 185, 200, 0.5); }

.nav-block { margin: 0 0 6px; }
.nav-block summary {
  cursor: pointer;
  list-style: none;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: rgba(233, 241, 236, 0.55);
  padding: 10px 10px 6px;
  user-select: none;
}
.nav-block summary::-webkit-details-marker { display: none; }
.nav-block summary::after { content: " ▾"; font-size: 9px; opacity: 0.7; }
.nav-block:not([open]) summary::after { content: " ▸"; }

.sidenav a, .sidenav button.navbtn {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: rgba(233, 241, 236, 0.88);
  text-decoration: none;
  padding: 7px 10px 7px 12px;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  cursor: pointer;
  font-size: 14px;
  border-left: 2px solid transparent;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.sidenav a:hover, .sidenav button.navbtn:hover { background: rgba(255, 255, 255, 0.09); color: #fff; }
.sidenav a.on { background: rgba(240, 185, 200, 0.16); border-left-color: var(--lily); color: #fff; }
.sidenav .sub a { font-size: 12.5px; padding: 5px 10px 5px 16px; color: rgba(233, 241, 236, 0.66); }
.sidenav .save-state { display: block; font-size: 11px; color: rgba(233, 241, 236, 0.55); margin: 8px 2px; }
.sidenav .filebtn { margin-top: 6px; }
.sidenav .hint { color: rgba(233, 241, 236, 0.6); border-left-color: rgba(233, 241, 236, 0.2); }

.shell.nav-off { grid-template-columns: var(--rail-w-off) minmax(0, 1fr); }
.shell.nav-off .sidenav { padding: 14px 8px 24px; overflow: hidden; }
.shell.nav-off .sidenav .brand,
.shell.nav-off .sidenav .brand-kicker,
.shell.nav-off .sidenav .nav-body { display: none; }
.shell.nav-off .side-head { margin: 0; justify-content: center; }
.shell.nav-off .fold-nav { width: 34px; }

.stage { min-width: 0; padding-bottom: 32px; }

.toolbar {
  position: sticky;
  top: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: var(--bar-h);
  padding: 8px 0;
  background: linear-gradient(180deg, rgba(244, 247, 240, 0.9), rgba(238, 244, 238, 0.74));
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  box-shadow: 0 1px 0 rgba(36, 70, 63, 0.1), 0 10px 24px rgba(36, 70, 63, 0.05);
}
.toolbar .spacer { flex: 1; min-width: 8px; }
.toolbar .save-state { font-size: 12px; color: var(--ink-faint); letter-spacing: 0.04em; }

.nav {
  position: sticky; top: 0; z-index: 6;
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  padding: 8px 16px;
  background: rgba(244, 247, 240, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.nav a, .nav button {
  border: 0; background: transparent; color: var(--pony);
  text-decoration: none; padding: 6px 10px;
  border-radius: 999px; cursor: pointer;
}
.nav a:hover, .nav button:hover { background: rgba(255, 255, 255, 0.8); }
.nav .spacer { flex: 1; }
.nav .save-state { font-size: 12px; color: var(--ink-soft); }

/* 模块切换带:只在触屏/窄屏出现,桌面有侧栏就够了 */
.modulebar { display: none; }
.mchip {
  flex: none;
  min-height: 36px;
  padding: 5px 15px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: linear-gradient(180deg, rgba(253, 252, 247, 0.88), rgba(238, 245, 240, 0.8));
  box-shadow: 0 2px 8px rgba(28, 62, 55, 0.08);
  color: var(--pony);
  font-size: 13.5px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.16s, color 0.16s;
}
.mchip.on {
  background: linear-gradient(180deg, var(--pony), var(--pony-deep));
  color: #f4faf6;
  border-color: var(--pony-deep);
  box-shadow: 0 4px 12px rgba(28, 62, 55, 0.2);
}
.swiped { animation: swipeIn 0.4s ease-out; }
@keyframes swipeIn { from { opacity: 0.28; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* 右下角模块坞:手机上常驻,拖出是一排弧形胶囊 */
.dock { display: none; }
.dock-veil { position: fixed; inset: 0; z-index: 8; background: rgba(29, 56, 48, 0.18); backdrop-filter: blur(2px); }
/* 扇形底纹:三道同心弧 + 辐条,和胶囊同一套圆心 */
.dock-fan {
  position: fixed;
  right: 12px;
  bottom: calc(var(--dock-bottom, 118px) - 10px);
  width: 920px; height: 920px;
  margin: -432px -432px 0 0;
  z-index: 9;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.28s ease;
}
.dock.open .dock-fan { opacity: 1; }
.dock-fan .fan-arc {
  fill: none;
  stroke: rgba(61, 122, 109, 0.2);
  stroke-width: 1;
  stroke-dasharray: 2 9;
  stroke-linecap: round;
  animation: fanDraw 0.5s ease-out both;
  animation-delay: var(--d, 0s);
}
.dock-fan .fan-spoke { stroke: rgba(217, 139, 166, 0.13); stroke-width: 1; stroke-dasharray: 1 10; }
@keyframes fanDraw { from { opacity: 0; } to { opacity: 1; } }

/* 胶囊按右边缘定位,要让它的「中心」落在按钮中心上:
   按钮中心 = 右 12 + 宽 60 的一半;胶囊半宽 34,容器 right 归零、胶囊 right 给 8。 */
.dock-items { position: fixed; right: 0; bottom: calc(var(--dock-bottom, 118px) + 20px); z-index: 10; pointer-events: none; }
.dock-item {
  position: absolute;
  right: 8px; bottom: 0;
  display: inline-flex; align-items: center; justify-content: center;
  /* 拇指要戳得中:至少 68×48 */
  min-width: 68px; min-height: 48px;
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: linear-gradient(180deg, rgba(253, 251, 245, 0.97), rgba(234, 243, 237, 0.95));
  color: var(--pony-deep);
  font-size: 14px;
  box-shadow: 0 8px 22px rgba(28, 62, 55, 0.2);
  white-space: nowrap;
  opacity: 0;
  transform: translate(0, 0) scale(0.4);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.25, 1.1), opacity 0.18s ease;
  transition-delay: calc(var(--ring, 0) * 0.05s);
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.dock.open .dock-item { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 1; }
.dock.open .dock-item.armed {
  background: linear-gradient(180deg, var(--pony), var(--pony-deep));
  color: #f4faf6;
  border-color: var(--pony-deep);
  transform: translate(var(--dx), var(--dy)) scale(1.14);
  box-shadow: 0 14px 30px rgba(28, 62, 55, 0.32);
  transition-delay: 0s;
}
.dock-handle {
  position: fixed;
  right: 12px;
  bottom: calc(var(--dock-bottom, 118px) - 10px);
  z-index: 11;
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: radial-gradient(circle at 36% 30%, #5b9b8b, var(--pony-deep) 72%);
  box-shadow: 0 10px 26px rgba(28, 62, 55, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  cursor: grab;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.dock-handle.dragging { cursor: grabbing; box-shadow: 0 16px 34px rgba(28, 62, 55, 0.38); }
.dock-ring { position: absolute; inset: -6px; border-radius: 50%; border: 1px dashed rgba(217, 139, 166, 0.75); animation: spin 22s linear infinite; }
.dock.open .dock-ring { animation-duration: 6s; }
.dock-glyph { position: absolute; inset: 0; }
.dock-glyph::before, .dock-glyph::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 18px; height: 2px;
  border-radius: 2px;
  background: rgba(246, 251, 248, 0.92);
  transform: translate(-50%, -50%);
  transition: transform 0.24s ease, opacity 0.2s;
}
.dock-glyph::after { transform: translate(-50%, -50%) rotate(90deg); }
.dock.open .dock-glyph::before { transform: translate(-50%, -50%) rotate(45deg); }
.dock.open .dock-glyph::after { transform: translate(-50%, -50%) rotate(-45deg); }
@keyframes spin { to { transform: rotate(360deg); } }

.wrap { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.quotesec { padding-top: 6px; }
.quotesec .quote { margin-top: 0; }
/* 分页以后每个视图自己起头,不再靠滚动衔接 */
body[data-view] .stage > .wrap { padding-bottom: 8px; }
section[id], .grouphead { scroll-margin-top: 14px; }
.grouphead { scroll-margin-top: calc(var(--bar-h) + 46px); }

/* ── 页头:唯一一处用力气的地方 ─────────────────── */
.top { padding: 30px 0 10px; display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; }
.kicker {
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--lily);
  margin-bottom: 10px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}
.top h1 { font-size: clamp(34px, 4.4vw, 46px); letter-spacing: 0.04em; color: var(--pony-deep); }
.top p { margin: 10px 0 0; max-width: 44em; color: var(--ink-soft); }

.seal {
  width: 96px; height: 96px; flex: none;
  display: grid; place-items: center; text-align: center;
  color: #b0405a;
  transform: rotate(-7deg);
  border: 2px solid rgba(176, 64, 90, 0.72);
  border-radius: 46% 54% 50% 50% / 52% 48% 52% 48%;
  box-shadow: inset 0 0 0 3px rgba(176, 64, 90, 0.18), 0 6px 18px rgba(176, 64, 90, 0.12);
  background:
    repeating-linear-gradient(38deg, rgba(176, 64, 90, 0.06) 0 3px, transparent 3px 7px),
    rgba(253, 246, 240, 0.72);
  font-family: var(--serif);
  line-height: 1.2;
}
.seal b { display: block; font-size: 17px; letter-spacing: 0.08em; }
.seal span { font-size: 11px; opacity: 0.8; letter-spacing: 0.04em; }

/* ── 玻璃水面:所有卡片共用 ───────────────────── */
.panel {
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  border-radius: var(--r-lg);
  backdrop-filter: blur(9px) saturate(1.05);
  -webkit-backdrop-filter: blur(9px) saturate(1.05);
}

/* ── 三板切换 ────────────────────────────────── */
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px auto 0; }
.mode {
  text-align: left;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: var(--glass);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  box-shadow: var(--shadow);
  padding: 16px 16px 14px;
  border-radius: 20px 24px 20px 24px / 24px 20px 24px 20px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.mode:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(28, 62, 55, 0.14); }
.mode small { display: block; letter-spacing: 0.2em; color: var(--lily); font-size: 11px; }
.mode strong { display: block; margin: 5px 0 2px; font-family: var(--serif); font-size: 19px; color: var(--pony-deep); }
.mode em {
  font-style: normal; font-family: var(--num); font-size: 27px;
  color: var(--pony); font-variant-numeric: tabular-nums; letter-spacing: 0.01em;
}
.mode p { margin: 7px 0 0; color: var(--ink-soft); font-size: 12.5px; line-height: 1.5; }
.mode.on {
  border-color: rgba(240, 185, 200, 0.9);
  background: linear-gradient(180deg, rgba(253, 250, 250, 0.94), rgba(247, 226, 232, 0.6));
  box-shadow: 0 0 0 1px rgba(217, 139, 166, 0.5), 0 18px 42px rgba(150, 84, 106, 0.16);
}
.mode.on em { color: #a5405a; }

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(143, 174, 107, 0.2);
  color: #56713f;
  font-size: 11.5px;
  font-weight: 600;
}

/* ── 条件栏与表单 ─────────────────────────────── */
.controls { margin: 12px auto; padding: 16px 18px; display: grid; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.field { display: grid; gap: 4px; min-width: 116px; flex: 1 1 116px; }
.field span, .lbl { font-size: 12px; color: var(--ink-soft); letter-spacing: 0.06em; }
.field .date-pair { display: flex; align-items: center; gap: 6px; }
.field .date-text { flex: 1; min-width: 0; }
.hint { margin: 0; color: var(--ink-soft); font-size: 13px; }
.hint a { color: var(--pony); text-decoration-color: rgba(61, 122, 109, 0.4); }

/* ── 录入模式:预算 / 实际 ─────────────────────── */
.entrybar {
  display: flex; align-items: center; gap: 6px;
  margin: 4px 0 10px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 3px rgba(28, 62, 55, 0.06);
  width: fit-content;
  max-width: 100%;
}
.seg {
  border: 0; background: transparent;
  border-radius: 999px;
  padding: 9px 20px;
  min-height: 40px;
  font-size: 14.5px;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.seg.on {
  background: linear-gradient(180deg, var(--pony), var(--pony-deep));
  color: #f4faf6;
  box-shadow: 0 4px 12px rgba(28, 62, 55, 0.22);
}
.entrybar-tip { font-size: 12px; color: var(--ink-faint); padding: 0 12px 0 4px; }

/* 按模式决定哪些字段出现(桌面与手机通用,逻辑只有一份) */
body[data-entry="budget"] [data-for="actual"] { display: none !important; }
body[data-entry="actual"] [data-for="budget"] { display: none !important; }

/* 摘要格:窄屏才出现,是收起态的核心信息 */
td.sum { display: none; }
td.sum .sum-in { display: flex; align-items: baseline; gap: 8px; justify-content: flex-end; }
td.sum i { font-style: normal; font-family: var(--num); font-size: 17px; color: var(--pony-deep); }
td.sum b { font-family: var(--num); font-size: 17px; color: #a5405a; }
td.sum em { font-style: normal; font-size: 11.5px; }
td.sum em.up { color: #a5405a; }
td.sum em.down { color: var(--pony); }
.row-expand { display: none; }
.today { min-height: 34px; padding: 4px 12px; font-size: 13px; white-space: nowrap; }
.when-row.now { grid-template-columns: 1fr auto; gap: 6px; }
.when-row.now .date-text { width: 100%; }

/* 数据搬家 */
.carry { margin: 14px auto 0; padding: 16px 18px; }
.carry .section-title { margin-top: 0; }
.carry-empty {
  display: inline-flex; align-items: center;
  min-height: 32px; padding: 2px 12px;
  border-radius: 999px;
  background: rgba(197, 160, 88, 0.18);
  color: #7a5f1e; font-size: 12.5px;
}
.carry-box { display: flex; gap: 8px; align-items: center; margin-top: 8px; }

/* 云端同步条 */
.syncbox {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 10px; padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.6);
  font-size: 12.5px;
}
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.sync-text { color: var(--ink-soft); flex: 1; min-width: 8em; }
.sync-auto { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-soft); cursor: pointer; }
.sync-auto input { width: auto; margin: 0; }
.syncbox button { min-height: 32px; padding: 4px 12px; font-size: 12.5px; }
.syncbox[data-state="synced"] .sync-dot { background: #6f9a5a; }
.syncbox[data-state="sending"] .sync-dot,
.syncbox[data-state="checking"] .sync-dot { background: var(--lily); animation: blink 1s ease-in-out infinite; }
.syncbox[data-state="conflict"] { border-color: rgba(197, 160, 88, 0.5); background: rgba(245, 236, 210, 0.6); }
.syncbox[data-state="conflict"] .sync-dot { background: #c9a05a; }
.syncbox[data-state="error"] { border-color: rgba(165, 64, 90, 0.4); }
.syncbox[data-state="error"] .sync-dot { background: #a5405a; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.carry-box input {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
  overflow: hidden; text-overflow: ellipsis;
}
.carry-box button { flex: none; white-space: nowrap; }

.hint.warnline {
  margin-top: 4px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(197, 160, 88, 0.45);
  background: rgba(245, 236, 210, 0.7);
  color: #6d5320;
  line-height: 1.6;
}
.hint.warnline button.text { color: #8a4a12; }

input, select, textarea {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  width: 100%;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
input:hover, select:hover, textarea:hover { border-color: rgba(61, 122, 109, 0.4); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--lily);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(217, 139, 166, 0.22);
}
textarea { min-height: 36px; resize: vertical; }
input[type="number"] { font-variant-numeric: tabular-nums; }

button.chip, button.ghost, button.text { border-radius: 999px; cursor: pointer; }
button.chip, button.ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  padding: 8px 15px;
  color: var(--pony);
  transition: transform 0.14s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}
button.chip:hover, button.ghost:hover {
  background: #fff;
  border-color: rgba(61, 122, 109, 0.4);
  box-shadow: 0 6px 16px rgba(28, 62, 55, 0.1);
}
button.chip:active, button.ghost:active { transform: translateY(1px); }
button.chip[aria-pressed="true"] {
  background: linear-gradient(180deg, var(--pony), var(--pony-deep));
  color: #f4faf6;
  border-color: var(--pony-deep);
}
button.ghost.danger { color: #a5405a; }
button.text {
  border: 0; background: transparent; color: var(--pony);
  padding: 0; text-decoration: underline; width: auto;
  text-decoration-color: rgba(217, 139, 166, 0.7);
  text-underline-offset: 3px;
}
button.text:hover { color: #a5405a; text-decoration-color: currentColor; }
.chip.save-now {
  background: linear-gradient(180deg, var(--pony), var(--pony-deep));
  color: #f6fbf8;
  border-color: var(--pony-deep);
  box-shadow: 0 6px 18px rgba(28, 62, 55, 0.2);
}
.chip.save-now:hover { background: linear-gradient(180deg, #47897b, #2a534a); }

/* ── 数字:账目感靠字重和字距,不靠花色 ─────────── */
.kpis { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 12px; margin: 14px auto; }
.kpi { padding: 18px 18px 16px; }
.kpi .eyebrow { color: var(--ink-soft); font-size: 12px; letter-spacing: 0.08em; }
.money {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 40px;
  color: var(--pony-deep);
  line-height: 1.06;
  margin: 8px 0 6px;
  letter-spacing: -0.01em;
}
.kpi.main { background: linear-gradient(165deg, rgba(253, 250, 246, 0.94), rgba(240, 247, 242, 0.78)); }
.kpi.main .money { font-size: 50px; }
.kpi p { margin: 0; color: var(--ink-soft); font-size: 12.5px; }
.delta.up { color: #a5405a; }
.delta.down, .delta.flat { color: var(--pony); }

/* ── 章节标题:一条会淡出的水线 ─────────────────── */
.section-title {
  margin: 30px 0 10px;
  font-size: 27px;
  color: var(--pony-deep);
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title::before {
  content: "";
  flex: none;
  width: 20px; height: 20px;
  border-radius: 50% 42% 52% 46%;
  background: radial-gradient(circle at 40% 36%, var(--lily-lit), var(--lily) 70%);
  box-shadow: 0 0 0 4px rgba(247, 226, 232, 0.8);
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(36, 70, 63, 0.22), transparent);
}
.lead { color: var(--ink-soft); margin: 0 0 12px; max-width: 60em; }

/* ── 分析 ────────────────────────────────────── */
.analysis { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 12px; }
.block { padding: 16px 18px 18px; }
.block h2 { font-size: 21px; margin-bottom: 10px; color: var(--pony-deep); }

.cmp { display: grid; grid-template-columns: 112px 1fr auto; gap: 10px; align-items: center; margin: 8px 0; font-size: 13px; }
.cmp > div:first-child { color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp b { font-weight: 600; font-variant-numeric: tabular-nums; font-family: var(--num); color: var(--pony-deep); }

.track {
  height: 15px;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 0 0 1px rgba(36, 70, 63, 0.08);
}
.track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
/* 核定预算:一道虚线,像铅笔画的靶 */
.track .budget {
  background: repeating-linear-gradient(90deg, rgba(197, 160, 88, 0.55) 0 5px, rgba(197, 160, 88, 0) 5px 10px);
  box-shadow: inset 0 -1px 0 rgba(197, 160, 88, 0.6);
}
/* 滚动预测:实打实的一笔 */
.track .forecast { background: linear-gradient(90deg, var(--pony-lit), var(--pony)); }
/* 已发生实际:贴着顶的一条细线 */
.track .actual { background: #c2607a; height: 3px; top: 2px; border-radius: 999px; }

.legend-dot { display: flex; gap: 14px; font-size: 12px; color: var(--ink-soft); margin-bottom: 10px; flex-wrap: wrap; }
.sw { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 5px; vertical-align: -1px; }

.months { display: flex; align-items: flex-end; gap: 7px; height: 128px; margin-top: 10px; }
.months div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; min-width: 0; }
.months i {
  display: block; width: 100%;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #a9cfc2, var(--pony));
  min-height: 2px;
  box-shadow: 0 3px 8px rgba(61, 122, 109, 0.18);
}
.months span { font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

.subhead { margin: 14px 0 6px; font-size: 13px; color: var(--ink-soft); letter-spacing: 0.06em; }
.list { margin: 0; padding: 0; list-style: none; }
.list li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px;
}
.list li:last-child { border-bottom: 0; }
.list time { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.list b { font-family: var(--num); font-weight: 600; color: var(--pony-deep); white-space: nowrap; }
.overdue { color: #a5405a; }

/* ── 甘特:横条是时间跨度,圆点是花钱时点 ─────── */
.gantt-panel { padding: 16px 18px 20px; margin: 12px auto; }
.gantt-panel h2 { font-size: 21px; color: var(--pony-deep); }
.axis { position: relative; height: 26px; margin: 0 0 12px 168px; }
.axis b { position: absolute; top: 0; font-size: 11px; color: var(--ink-faint); font-weight: 500; transform: translateX(-50%); white-space: nowrap; }
.today-flag { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed rgba(165, 64, 90, 0.65); }
.g-row { display: grid; grid-template-columns: 160px 1fr; gap: 10px; align-items: center; min-height: 28px; }
.g-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-soft); }
.g-name.cat { font-weight: 700; color: var(--pony-deep); font-family: var(--serif); font-size: 14px; }
.track-g { position: relative; height: 18px; }
.g-bar { position: absolute; top: 3px; height: 12px; border-radius: 999px; min-width: 8px; }
.g-dot {
  position: absolute; top: 3px; width: 12px; height: 12px; border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 2px 5px rgba(28, 62, 55, 0.18);
}
.g-span { position: absolute; top: 8px; height: 3px; border-radius: 999px; opacity: 0.45; }
.done { background: #c98ea0; }
.future { background: #6f9474; }
.late { background: #c47c4a; }

/* ── 明细账:一张浮在水面上的纸 ─────────────────── */
.ledger-bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ledger-bar .lead { flex: 1; }
.dim td, tr.dim { color: var(--ink-faint); }
.quote-book th { top: 0; }
.srcrow td { background: rgba(247, 249, 243, 0.6); color: var(--ink-soft); font-size: 12.5px; line-height: 1.6; }
.book th { top: 0; }
.ver { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }

.bookwrap { overflow-x: auto; margin: 10px 0 28px; padding: 10px; }
table.book { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 1180px; font-size: 13px; line-height: 1.25; }
.book th {
  text-align: left; font-size: 12px; color: var(--ink-soft); font-weight: 600;
  letter-spacing: 0.06em;
  padding: 5px 6px; position: sticky; top: var(--bar-h);
  background: rgba(244, 247, 240, 0.97);
  box-shadow: inset 0 -1px 0 var(--line);
}
.book td { padding: 3px 5px; vertical-align: middle; border-top: 1px solid var(--line-soft); }
.book tbody tr:hover td { background: rgba(247, 226, 232, 0.28); }
.book input, .book select { padding: 3px 5px; line-height: 1.3; }
.book textarea { min-height: 26px; padding: 3px 5px; }
.book .num { width: 78px; font-variant-numeric: tabular-nums; }
.book td.when { min-width: 248px; }

.date-pair { display: flex; align-items: center; gap: 5px; min-width: 0; }
.date-text { width: 7.8em; flex: none; font-variant-numeric: tabular-nums; }
.book .date-text { width: 7.6em; }
.cal {
  position: relative;
  width: 27px; height: 27px;
  flex: none;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background:
    rgba(255, 255, 255, 0.9)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%233d7a6d' stroke-width='2'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E")
    center / 14px 14px no-repeat;
  overflow: hidden;
}
.cal .date-pick { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; border: 0; color: transparent; background: transparent; }
.cal .date-pick::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; }

.row-acts { white-space: nowrap; }
.row-acts .text { margin-right: 8px; }
.row-copy { font-size: 12px; color: var(--pony); }
.row-wipe { font-size: 12px; color: #a5405a; white-space: nowrap; }
.row-restore { font-size: 12px; color: var(--pony); white-space: nowrap; }
/* 被「清空」的行:数量和金额归零,整行留个淡印,一眼能挑出来 */
.book tbody tr.wiped td { background: rgba(247, 226, 232, 0.3); }
.book tbody tr.wiped td.out { color: var(--ink-faint); }
.book .name-in { width: 11.5em; font-weight: 600; margin-right: 4px; }
.row-del { font-size: 12px; color: #a5405a; }
.book .nameb .text { margin-left: 4px; font-size: 12px; line-height: 1; }
.book td.fc { white-space: nowrap; }
.modeflag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 7px;
  height: 20px; line-height: 18px;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  color: #56713f;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  width: auto;
}
.modeflag.hand { color: #a5405a; border-color: rgba(165, 64, 90, 0.4); background: rgba(247, 226, 232, 0.5); }

.when-row { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; gap: 5px; margin: 2px 0; }
.when-lbl { font-size: 11px; color: var(--ink-faint); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.when-row em { font-style: normal; font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 分类标题做成睡莲叶的一条带子 */
.grouphead td {
  background: linear-gradient(90deg, rgba(169, 196, 137, 0.34), rgba(169, 196, 137, 0.06) 70%, transparent);
  font-family: var(--serif);
  font-size: 15px;
  color: var(--pony-deep);
  padding: 7px 6px 4px;
  border-top: 1px solid rgba(36, 70, 63, 0.14);
}
.grouphead .head-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.grouphead .add-item, .grouphead .paste-item { padding: 4px 11px; font-size: 12px; }
.grouphead .head-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.grouphead .paste-item:disabled { opacity: 0.42; cursor: not-allowed; }
.cathead td {
  background: rgba(214, 232, 224, 0.7);
  font-weight: 700;
  border-top: 0;
  padding-top: 12px;
}
.cathead span { font-weight: 500; color: var(--ink-soft); margin-left: 8px; }

.out { font-variant-numeric: tabular-nums; white-space: nowrap; font-family: var(--num); }
.up { color: #a5405a; }
.down { color: var(--pony); }
.src { display: block; color: var(--ink-faint); font-size: 12px; max-width: 220px; }
.src a { color: var(--pony); text-decoration-color: rgba(61, 122, 109, 0.4); }
.footer { color: var(--ink-soft); font-size: 13px; padding: 6px 0 28px; max-width: 60em; }
.ver-line { margin: 10px 0 0; font-size: 12px; color: var(--ink-faint); letter-spacing: 0.04em; }
.updatebar {
  position: fixed;
  left: 50%; bottom: 84px;
  transform: translateX(-50%);
  z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 8px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--pony), var(--pony-deep));
  color: #f4faf6;
  font-size: 13.5px;
  box-shadow: 0 12px 30px rgba(28, 62, 55, 0.3);
}
.updatebar button {
  min-height: 32px; padding: 4px 14px;
  border-radius: 999px; border: 0;
  background: rgba(255, 255, 255, 0.22);
  color: #fff; font-size: 13.5px; cursor: pointer;
}
.ok { color: var(--pony); }

/* ── 报价汇总与分组跳转 ───────────────────────── */
.subnav { display: none; }
.subnav a {
  font-size: 12px;
  line-height: 1.2;
  padding: 5px 10px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--pony);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}
.quote { margin-top: 0; }
.quote h2 { font-size: 21px; margin: 4px 4px 6px; color: var(--pony-deep); }
table.book.quote-book { min-width: 560px; }
.quote-total { margin: 8px 4px 2px; }
.quote-total b { color: var(--pony-deep); font-size: 22px; font-variant-numeric: tabular-nums; font-family: var(--num); }

/* ── 浮层 ────────────────────────────────────── */
.dialog {
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--r-lg);
  padding: 20px;
  width: min(640px, calc(100% - 24px));
  background: #faf8f1;
  color: var(--ink);
  box-shadow: 0 30px 70px rgba(28, 62, 55, 0.28);
}
.dialog h3 { font-size: 20px; color: var(--pony-deep); margin-bottom: 4px; }
.dialog textarea { width: 100%; min-height: 240px; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 12.5px; }
.dialog::backdrop { background: rgba(29, 56, 48, 0.42); backdrop-filter: blur(3px); }

.toast {
  position: fixed;
  bottom: 74px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, var(--pony), var(--pony-deep));
  color: #f4faf6;
  padding: 9px 16px;
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(28, 62, 55, 0.3);
  z-index: 9;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.toast.show { opacity: 1; }

/* ── 水位线:永远看得见的当前滚动预测 ─────────── */
.sticky {
  position: sticky;
  bottom: 0;
  z-index: 4;
  background: linear-gradient(180deg, rgba(233, 243, 238, 0.92), rgba(224, 237, 231, 0.97));
  border-top: 1px solid rgba(36, 70, 63, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 -8px 24px rgba(36, 70, 63, 0.08);
  padding: 9px 0;
  overflow: hidden;
}
.sticky::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 34%, rgba(253, 246, 228, 0.55) 50%, transparent 66%);
  transform: translateX(-40%);
  animation: caustic 13s ease-in-out infinite;
  pointer-events: none;
}
.sticky .wrap { display: flex; justify-content: space-between; align-items: center; gap: 12px; position: relative; }
.sticky span { color: var(--ink-soft); font-size: 12.5px; letter-spacing: 0.08em; }
.sticky b { color: var(--pony-deep); font-size: 21px; font-variant-numeric: tabular-nums; font-family: var(--num); }
@keyframes caustic { 0%, 100% { transform: translateX(-40%); opacity: 0.35; } 50% { transform: translateX(40%); opacity: 0.8; } }

/* ── 窄屏 ────────────────────────────────────── */
@media (max-width: 1080px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi.main { grid-column: 1 / -1; }
  .kpi.main .money { font-size: 44px; }
}
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidenav {
    position: relative;
    height: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 12px 12px 14px;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.07);
  }
  .shell.nav-off { grid-template-columns: 1fr; }
  .shell.nav-off .sidenav { height: auto; padding: 8px 12px; overflow: visible; }
  .sidenav .side-head, .sidenav .nav-body { flex-basis: 100%; }
  .sidenav a, .sidenav button.navbtn { width: auto; border-radius: 999px; border-left: 0; }
  /* 窄屏上导航压成一条横滑的胶囊带,不再吃掉半屏。
     注意:<details> 的内容在浏览器里会进 ::details-content 盒子,
     所以外层 flex 管不到里面的链接,只能靠 nowrap 内联流把它们压成一行。 */
  .sidenav .nav-body {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .sidenav .nav-body::-webkit-scrollbar { display: none; }
  /* 窄屏上「页面」块和模块带重复了,收掉,把高度让给内容 */
  .sidenav .nav-block:first-child { display: none; }
  .sidenav .nav-block { flex: 0 0 auto; width: max-content; white-space: nowrap; margin: 0; }
  .sidenav .nav-block > a { display: inline-block; vertical-align: middle; }
  .sidenav .nav-block summary { padding: 6px 4px; white-space: nowrap; }
  .sidenav .sub { display: flex; flex-wrap: nowrap; gap: 2px; }
  .sidenav .sub a, .sidenav button.navbtn { white-space: nowrap; padding: 5px 10px; font-size: 13px; }
  .sidenav .hint { display: none; }
  .shell.nav-off .sidenav .nav-body { display: none; }
  .top { flex-direction: column; align-items: flex-start; }
  .seal { display: none; }
  .kpis, .analysis, .modes { grid-template-columns: 1fr; }
  .kpi.main { grid-column: auto; }
  .kpi.main .money, .money { font-size: 38px; }
  .book th { position: static; }
  .axis { margin-left: 100px; }
  .g-row { grid-template-columns: 92px 1fr; }
  .bank { width: 132vw; height: 40vh; opacity: 0.5; }
  .pad-cluster.a { width: 220px; bottom: 12vh; opacity: 0.34; }
  .pad-cluster.b { display: none; }
  .shaft { width: 80vw; }
  body { padding-bottom: 76px; }
}
@media (max-width: 900px) {
  .wrap { width: calc(100% - 20px); }
  .field { min-width: 92px; }

  :root { --bar-h: 58px; --dock-bottom: 74px; }   /* 注意:@media 里只能放规则,裸声明会把后面的规则一起吞掉 */
  .dock { display: block; }

  .modulebar {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 7px 0;
    position: sticky;
    top: var(--bar-h);
    z-index: 6;
    overflow-x: auto;
    scrollbar-width: none;
    background: linear-gradient(180deg, rgba(243, 247, 242, 0.97), rgba(235, 243, 238, 0.93));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 1px 0 var(--line-soft), 0 8px 18px rgba(36, 70, 63, 0.05);
  }
  .modulebar::-webkit-scrollbar { display: none; }
  #board, #analysis, #gantt, #quote-mount, #ledger-book, #versions { scroll-margin-top: calc(var(--bar-h) + 50px); }

  .entrybar-tip { display: none; }      /* 提示语在下面那段 lead 里,手机上不挤 */
  .entrybar { width: 100%; }
  .seg { flex: 1; }

  /* 顶栏在窄屏压成一条横滑的行,把 110px 的常驻高度还给内容 */
  .toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 6px; min-height: 0; }
  .toolbar::-webkit-scrollbar { display: none; }
  .toolbar .spacer, .toolbar #btn-nav-fold, .toolbar .save-state { display: none; }
  .toolbar button { flex: none; }

  /* 输入框 16px:iOS 聚焦小于这个值会自动放大整页,手写很烦 */
  input, select, textarea { font-size: 16px; }
  .hint a, .footer a, .lead a { display: inline-block; padding: 4px 0; min-height: 28px; }
  button.chip, a.chip, button.ghost, .text, .modeflag, .row-acts .text { min-height: 40px; }
  button.chip, a.chip, button.ghost { padding: 9px 16px; }
  a.chip { display: inline-flex; align-items: center; text-decoration: none; }
  .sidenav a, .sidenav button.navbtn, .subnav a { min-height: 38px; display: inline-flex; align-items: center; }

  /* 12 列的账目表在窄屏没法用,每一行改成一张卡片 */
  .bookwrap { overflow-x: visible; padding: 0; background: none; border: 0; box-shadow: none; backdrop-filter: none; }
  table.book { min-width: 0; display: block; }
  table.book.quote-book { min-width: 0; }   /* 桌面那 560px 在窄屏必须让位给卡片流 */
  table.book thead { display: none; }
  table.book tbody { display: block; }
  table.book tr { display: block; border: 0; }
  table.book td {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    border: 0;
    padding: 5px 0;
  }
  table.book td::before {
    content: attr(data-label);
    font-size: 12.5px;
    color: var(--ink-soft);
  }
  table.book td.nameb, table.book td.when, table.book td.row-acts, table.book td.srcrow { grid-template-columns: 1fr; }
  table.book td.nameb::before, table.book td.when::before, table.book td.row-acts::before { content: none; }
  table.book td.nameb { padding-bottom: 8px; }
  table.book td.when { border-top: 1px solid var(--line-soft); margin-top: 4px; padding-top: 9px; }
  table.book td.row-acts {
    display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap;
    gap: 20px; border-top: 1px solid var(--line-soft); margin-top: 4px; padding-top: 8px;
  }
  table.book td.row-acts .text { min-height: 40px; display: inline-flex; align-items: center; }
  table.book td.fc { grid-template-columns: 76px 1fr auto; }
  table.book td.fc::before { grid-row: 1; }
  table.book td.out { text-align: left; }
  table.book tbody tr:not(.grouphead):not(.srcrow) {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 6px 18px rgba(28, 62, 55, 0.07);
    border-radius: var(--r-md);
    padding: 8px 12px;
    margin-bottom: 8px;
  }
  /* 收起态:名称 + 核心金额 + 展开按钮,一行搞定 */
  table.book tbody tr:not(.grouphead):not(.srcrow) td.nameb,
  table.book tbody tr:not(.grouphead):not(.srcrow) td.sum,
  table.book tbody tr:not(.grouphead):not(.srcrow) td.row-acts { margin-bottom: 0; }
  table.book tbody tr:not(.grouphead):not(.srcrow) td.nameb {
    display: flex; align-items: center; gap: 6px;
    border-bottom: 1px solid var(--line-soft);
    padding-bottom: 7px;
  }
  table.book tbody tr:not(.grouphead):not(.srcrow) td.nameb::before { content: none; }
  table.book tbody tr:not(.grouphead):not(.srcrow) td.nameb .name-in {
    flex: 1; min-width: 0; width: auto; font-size: 15px;
  }
  table.book tbody tr:not(.grouphead):not(.srcrow) td.sum { display: block; padding-top: 6px; }
  table.book tbody tr:not(.grouphead):not(.srcrow) td.sum::before { content: none; }
  /* 收起时把复制/清空/删除藏起来,只留名称行里的「展开」 */
  table.book tbody tr:not(.grouphead):not(.srcrow):not(.open) > td.row-acts { display: none !important; }
  table.book tbody tr:not(.grouphead):not(.srcrow).open > td.row-acts {
    display: flex; justify-content: space-between; gap: 10px;
    border-top: 1px solid var(--line-soft); margin-top: 4px; padding-top: 8px;
  }
  .row-expand { display: inline-block; flex: none; margin-left: 2px; }
  /* 摘要格:预算模式看核定预算,实际模式看差额(金额旁边就有输入框) */
  body[data-entry="budget"] td.sum b, body[data-entry="actual"] td.sum em { display: none; }
  body[data-entry="actual"] td.sum i { color: var(--ink-faint); font-size: 13px; }
  body[data-entry="actual"] td.sum i::before { content: "预算 "; }
  body[data-entry="actual"] td.sum .sum-in { justify-content: flex-end; }
  /* 展开后才铺字段;带 .keep 的(实付金额 / 实付日期)是实际模式的主角,收起时也留着。
     只用一条规则,避免两条同特异性规则互相打架。 */
  table.book tbody tr:not(.grouphead):not(.srcrow):not(.open) > td[data-for]:not(.keep),
  table.book tbody tr:not(.grouphead):not(.srcrow):not(.open) > td:not(.nameb):not(.sum):not(.row-acts):not(.keep) { display: none !important; }
  table.book tbody tr.open { box-shadow: 0 10px 26px rgba(28, 62, 55, 0.12); border-color: rgba(217, 139, 166, 0.45); }
  table.book tbody tr.open > td[data-for] { border-top: 1px solid var(--line-soft); margin-top: 4px; padding-top: 7px; }
  table.book tbody tr.wiped { border-color: rgba(217, 139, 166, 0.5); }
  table.book tr.grouphead { display: table-row; margin: 14px 0 6px; }
  table.book tr.grouphead td { display: table-cell; padding: 8px 4px; }
  table.book tr.grouphead td::before { content: none; }
  table.book tr.srcrow td { display: block; padding: 8px 4px; }
  table.book tr.srcrow td::before { content: none; }
  table.book .name-in { width: 100%; }
  table.book .num { width: 100%; }
  .book .quote-book { min-width: 0; }
  .quote .bookwrap { padding: 0; }
}

@media (max-width: 560px) {
  .wrap { width: calc(100% - 24px); }
  .field { min-width: 96px; }
  .section-title { font-size: 23px; }
  .sticky b { font-size: 18px; }
  .cmp { grid-template-columns: 88px 1fr auto; }
}

/* ── 打印:纸上只要账 ─────────────────────────── */
@page { margin: 12mm; }
@media print {
  .garden, .controls, .sticky, .no-print, .sidenav, .toolbar, .nav, .subnav,
  .modulebar, .dock, .tabbar, .subbar { display: none !important; }
  /* 纸纹是 fixed 的,不清掉的话每一页都重画一遍,PDF 直接膨胀到几十兆 */
  body::after { display: none !important; }
  .shell { display: block; }
  body { background: #fff; padding: 0; }
  .panel, .mode, .kpi { box-shadow: none; background: #fff; border-color: #ccc; backdrop-filter: none; }
  .wrap { width: 100%; }
  .section-title::after { display: none; }
  /* 文字阴影会在纸面上叠出第二层字,PDF 提取时会变成同一行出现两次 */
  .kicker, .top h1, .top p, h1, h2, h3 { text-shadow: none; }
}

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