:root {
  color-scheme: light;
  --paper: #f7f1e7;
  --paper-deep: #ede2d2;
  --surface: #fffdf8;
  --surface-soft: #fbf7ef;
  --ink: #2e2a25;
  --money-in: #8a5a20;
  --money-out: #706158;
  --money-balance: #342d28;
  --money-in-soft: #f3e8d3;
  --money-out-soft: #eee5dd;
  --ink-soft: #766e64;
  --line: #e5dacb;
  --brand: #a61b1b;
  --brand-dark: #741414;
  --brand-soft: #f9e3df;
  --jade: #8b5a12;
  --jade-soft: #f8ecd2;
  --gold: #a66c18;
  --gold-soft: #f8ecd2;
  --danger: #b33832;
  --danger-soft: #f9e6e3;
  --shadow-sm: 0 1px 2px rgba(54, 39, 22, .05), 0 7px 22px rgba(54, 39, 22, .04);
  --shadow-md: 0 16px 40px rgba(54, 39, 22, .10);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --sidebar: 244px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 0; background: var(--paper); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); font-family: var(--font); font-size: 15px; line-height: 1.55; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid rgba(166, 27, 27, .25); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 1000; left: 12px; top: -60px; background: var(--ink); color: white; padding: 10px 14px; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.noscript { padding: 16px; background: var(--danger-soft); color: var(--danger); text-align: center; }

.boot-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; color: var(--ink-soft); }
.boot-mark, .brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px 15px 15px 5px; color: #fffaf2; background: var(--brand); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: 24px; }
.boot-mark { animation: breathe 1.4s ease-in-out infinite; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar); display: flex; flex-direction: column; padding: 26px 18px 20px; background: #332f2a; color: #f9f1e5; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; }
.brand-mark { width: 42px; height: 42px; font-size: 21px; }
.brand-copy strong { display: block; font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: 20px; letter-spacing: .08em; }
.brand-copy span { color: #c9bfb1; font-size: 11px; }
.nav-list { display: grid; gap: 6px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 11px 12px; color: #d9d0c5; border-radius: 12px; transition: background .18s, color .18s; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: #f7efe2; color: var(--ink); font-weight: 650; box-shadow: inset 3px 0 var(--brand); }
.nav-link svg, .tool-link svg, .icon-btn svg, .btn svg { width: 19px; height: 19px; flex: 0 0 auto; }
.sidebar-foot { margin-top: auto; }
.usage-mini { padding: 14px; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: rgba(255,255,255,.04); }
.usage-mini-head { display: flex; justify-content: space-between; font-size: 12px; color: #d8cfc3; }
.progress { height: 7px; overflow: hidden; margin-top: 9px; border-radius: 99px; background: rgba(255,255,255,.14); }
.progress > span { display: block; width: var(--progress, 0%); height: 100%; border-radius: inherit; background: #d9ad6f; transition: width .25s; }
.sidebar-account { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-user { display: flex; align-items: center; flex: 1; min-width: 0; gap: 10px; padding-left: 8px; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--brand-dark); background: #f0d9c8; font-weight: 700; }
.sidebar-user strong, .sidebar-user small { display: block; }
.sidebar-user > span:last-child { min-width: 0; }
.sidebar-user strong, .sidebar-user small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user small { color: #bfb5a8; }
.sidebar-account .sidebar-logout { width: 34px; height: 34px; flex: 0 0 34px; color: #bfb5a8; border-color: transparent; background: transparent; }
.sidebar-account .sidebar-logout:hover, .sidebar-account .sidebar-logout:focus-visible { color: #fff; border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.08); }

.main-wrap { grid-column: 2; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 70px; padding: 12px clamp(20px, 4vw, 54px); border-bottom: 1px solid rgba(157,130,94,.16); background: rgba(247,241,231,.88); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.crumb strong { display: block; font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: 21px; letter-spacing: .03em; }
.crumb span { color: var(--ink-soft); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.demo-pill { display: inline-flex; align-items: center; gap: 7px; margin-right: 6px; padding: 7px 10px; border: 1px solid #e1c995; border-radius: 99px; color: #7b5b24; background: var(--gold-soft); font-size: 12px; }
.demo-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #be832b; }
.demo-pill.service-pill { color: #70450f; border-color: #dfc289; background: var(--jade-soft); }
.demo-pill.service-pill::before { background: var(--jade); }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink-soft); }
.icon-btn:hover { color: var(--brand); border-color: #d7b9ad; }
.content { width: min(1420px, 100%); margin: 0 auto; padding: 30px clamp(20px, 4vw, 54px) 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-head.has-page-back { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: end; }
.page-back-button { display: inline-flex; align-items: center; align-self: center; gap: 5px; min-height: 40px; max-width: 150px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink-soft); background: var(--surface); font-size: 13px; font-weight: 700; white-space: nowrap; }
.page-back-button:hover { color: var(--brand); border-color: #d7b9ad; background: #fff; }
.page-back-button svg { width: 18px; height: 18px; flex: 0 0 auto; transform: rotate(180deg); }
.page-head h1 { margin: 0; font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: clamp(25px, 3vw, 34px); font-weight: 650; letter-spacing: .03em; }
.page-head p { margin: 5px 0 0; color: var(--ink-soft); }
.page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.eyebrow { margin: 0 0 6px; color: var(--brand); font-size: 12px; font-weight: 750; letter-spacing: .16em; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); font-weight: 650; transition: transform .12s, background .16s, border-color .16s; }
.btn:hover { border-color: #cdb9a5; background: #fff; }
.btn:active { transform: translateY(1px); }
.btn-primary { color: #fff; border-color: var(--brand); background: var(--brand); box-shadow: 0 6px 16px rgba(166,27,27,.18); }
.btn-primary:hover { border-color: var(--brand-dark); background: var(--brand-dark); }
.btn-jade { color: #fff; border-color: var(--jade); background: var(--jade); }
.btn-danger { color: var(--danger); border-color: #e8bdb7; background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.btn[disabled] { opacity: .48; cursor: not-allowed; transform: none; }

.notice { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 22px; padding: 13px 15px; border: 1px solid #dfcc9e; border-radius: 12px; color: #6f5425; background: var(--gold-soft); font-size: 13px; }
.notice strong { color: #5d4218; }
.notice-danger { color: #7c2e29; border-color: #edb8b2; background: var(--danger-soft); }
.notice-jade { color: #70450f; border-color: #dfc289; background: var(--jade-soft); }
.notice .notice-action { margin-left: auto; white-space: nowrap; text-decoration: underline; }

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px),1fr)); gap: 14px; margin-bottom: 22px; }
.metric { position: relative; min-height: 132px; overflow: hidden; padding: 19px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.metric::after { content: ""; position: absolute; right: -24px; bottom: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--tint, var(--brand-soft)); opacity: .7; }
.metric-label { display: flex; align-items: center; justify-content: space-between; color: var(--ink-soft); font-size: 13px; }
.metric-value { margin-top: 15px; font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: 27px; font-weight: 700; white-space: nowrap; }
.metric-note { margin-top: 5px; color: var(--ink-soft); font-size: 12px; }
.metric.received { --tint: var(--money-in-soft); }
.metric.given { --tint: var(--money-out-soft); }
.metric.balance { --tint: var(--gold-soft); }
.stats-metric-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
.stats-metric-grid > .metric, .annual-report-metrics > .metric { min-width: 0; }
.stats-metric-grid .metric-value, .annual-report-metrics .metric-value { min-width: 0; font-size: clamp(20px,2.2vw,27px); white-space: normal; overflow-wrap: anywhere; }
.stats-metric-grid .metric-note { white-space: normal; overflow-wrap: anywhere; }
.annual-report-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
.stats-combination-filter > * { min-width: 0; max-width: 100%; }
.stats-combination-filter select { flex: 1 1 170px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .8fr); gap: 20px; }
.grid-equal { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: 18px; }
.card-body { padding: 20px; }
.card + .card { margin-top: 20px; }

.record-list { display: grid; }
.record-row { display: grid; grid-template-columns: minmax(170px,1.35fr) minmax(120px,.9fr) minmax(105px,.7fr) minmax(100px,.7fr) auto; gap: 14px; align-items: center; min-height: 70px; padding: 13px 20px; border-top: 1px solid var(--line); }
.record-row:first-child { border-top: 0; }
.grid-2 > .card { min-width: 0; }
.grid-2 > .card .record-row { grid-template-columns: minmax(0,1fr) auto auto auto auto; gap: 10px; }
.person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.person .avatar { flex: 0 0 auto; width: 39px; height: 39px; font-size: 14px; }
.person strong, .person span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person span, .muted { color: var(--ink-soft); font-size: 12px; }
.amount { font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: 17px; font-weight: 700; }
.amount.in { color: var(--money-in); }
.amount.out { color: var(--money-out); }
.badge { display: inline-flex; align-items: center; width: fit-content; min-height: 25px; padding: 3px 8px; border-radius: 99px; color: #6c6258; background: #f0ebe3; font-size: 12px; white-space: nowrap; }
.badge-jade { color: #70450f; background: var(--jade-soft); }
.badge-red { color: #84362f; background: var(--brand-soft); }
.badge-gold { color: #72501c; background: var(--gold-soft); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }

.quick-list { display: grid; gap: 9px; }
.quick-item { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.quick-item:hover { border-color: #d5b9ad; }
.quick-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 11px; color: var(--brand); background: var(--brand-soft); }
.quick-item strong, .quick-item small { display: block; }
.quick-item small { color: var(--ink-soft); }
.quick-item .chev { margin-left: auto; color: #a59b90; }

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.search { position: relative; flex: 1 1 230px; }
.search input { width: 100%; padding-left: 39px; }
.search svg { position: absolute; left: 13px; top: 50%; width: 17px; height: 17px; color: var(--ink-soft); transform: translateY(-50%); }
.field, .field-row { display: grid; gap: 7px; }
.field label, .field-label { color: #625a51; font-size: 13px; font-weight: 650; }
.required::after { content: " *"; color: var(--brand); }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; outline: none; background: #fff; }
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #bd7c70; box-shadow: 0 0 0 3px rgba(156,63,53,.10); }
input[type="checkbox"], input[type="radio"] { width: 17px; min-height: 17px; accent-color: var(--brand); }
.field-hint, .field-error { margin: 0; color: var(--ink-soft); font-size: 12px; }
.field-error { color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 17px; }
.form-span-2 { grid-column: 1 / -1; }
.form-more { overflow:hidden; border:1px solid var(--line); border-radius:13px; background:#fffaf6; }
.form-more summary { position:relative; display:flex; align-items:center; gap:10px; min-height:46px; padding:10px 14px; cursor:pointer; list-style:none; color:var(--ink); font-weight:700; }
.form-more summary::-webkit-details-marker { display:none; }
.form-more summary small { color:var(--ink-soft); font-size:12px; font-weight:400; }
.form-more summary::after { content:'⌄'; margin-left:auto; color:var(--brand); font-size:18px; transition:transform .18s ease; }
.form-more[open] summary { border-bottom:1px solid var(--line); }
.form-more[open] summary::after { transform:rotate(180deg); }
.advanced-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:17px; padding:16px; }
.segmented { display: grid; grid-template-columns: repeat(2,1fr); gap: 6px; padding: 5px; border-radius: 12px; background: #eee7dd; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 9px; border-radius: 9px; text-align: center; color: var(--ink-soft); font-weight: 650; }
.segmented input:checked + span { color: var(--brand-dark); background: #fff; box-shadow: var(--shadow-sm); }
.checkbox-line { display: flex; align-items: center; gap: 9px; }
.form-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 20px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 14px; color: var(--ink-soft); background: var(--surface-soft); font-size: 12px; text-align: left; white-space: nowrap; }
td { padding: 14px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: #fffaf4; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 13px; }
.pagination-actions { display: flex; gap: 6px; }

.contact-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.contact-card { position: relative; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow-sm); }
.contact-card:hover { border-color: #d4b8ad; }
.contact-directory { overflow: hidden; }
.contact-list { overflow-x: auto; border-top: 1px solid var(--line); }
.contact-list-head,.contact-list-row { display: grid; grid-template-columns: minmax(170px,1.35fr) minmax(84px,.65fr) minmax(120px,.85fr) minmax(92px,.7fr) minmax(92px,.7fr) minmax(94px,.7fr) minmax(140px,1.05fr) 72px 62px; gap: 12px; align-items: center; min-width: 1090px; }
.contact-list-head { min-height: 38px; padding: 7px 16px; color: var(--ink-soft); background: var(--surface-soft); font-size: 11px; font-weight: 700; }
.contact-list-row { min-height: 64px; padding: 10px 16px; color: var(--ink); border-top: 1px solid var(--line); transition: background .15s ease; }
.contact-list-row:first-of-type { border-top: 0; }
.contact-list-row:hover,.contact-list-row:focus-visible { background: #fff7f1; }
.contact-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.contact-person .avatar { width: 36px; height: 36px; flex: 0 0 auto; font-size: 13px; }
.contact-person > span:last-child,.contact-person strong,.contact-person small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-person small { margin-top: 2px; color: var(--ink-soft); font-size: 11px; }
.contact-region,.contact-recent { overflow: hidden; color: var(--ink-soft); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.contact-tags { display: flex; gap: 4px; overflow: hidden; }
.contact-tags i { padding: 3px 6px; border-radius: 99px; color: #82443b; background: #fff0e9; font-size: 10px; font-style: normal; white-space: nowrap; }
.contact-tags small { color: var(--ink-soft); }
.contact-money { font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: 13px; font-weight: 700; white-space: nowrap; }
.contact-balance { font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: 14px; font-weight: 700; white-space: nowrap; }
.contact-balance small { display: block; margin-top: 2px; font-family: inherit; font-size: 10px; font-weight: 500; }
.balance-positive { color: #9c3f35; }
.balance-negative { color: #b16b50; }
.balance-even { color: #786b60; }
.contact-action { display: flex; align-items: center; justify-content: flex-end; gap: 2px; color: var(--brand); font-size: 12px; font-weight: 700; white-space: nowrap; }
.contact-action svg { width: 15px; height: 15px; }
.contact-books { color: var(--ink-soft); font-size: 12px; white-space: nowrap; }
.contact-mobile-meta,.contact-mobile-totals { display: none; }
.contact-detail-metrics { grid-template-columns: repeat(4,minmax(0,1fr)); }
.metric-value-text { overflow-wrap: anywhere; font-size: 22px; }
.contact-profile { display: grid; grid-template-columns: 70px minmax(0,1fr); gap: 12px; margin-top: 16px; }
.contact-profile dt { color: var(--ink-soft); }
.contact-profile dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.entitlement-card { margin-bottom: 20px; }
.entitlement-card .card-head { align-items: center; }
.entitlement-card h2 { margin-top: 3px; }
.entitlement-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.entitlement-item { min-width: 0; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.entitlement-item > span,.entitlement-item > strong { display: block; }
.entitlement-item > span { color: var(--ink-soft); font-size: 12px; }
.entitlement-item > strong { margin-top: 7px; overflow-wrap: anywhere; font-size: 14px; line-height: 1.45; }
.entitlement-item .progress { background: #eadfd7; }
.entitlement-item .progress > span { background: var(--brand); }
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 29px; padding: 4px 10px; border: 1px solid #e8cfc2; border-radius: 99px; color: #7b3a31; background: #fff7f2; font-size: 12px; }
.tag-chip.active { color: #fff; border-color: var(--brand); background: var(--brand); }
.tag-picker { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.tag-picker label { display: flex; align-items: center; gap: 7px; min-height: 38px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; background: #fffaf6; font-size: 13px; }
.entry-name-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 17px; }
.entry-tag-controls { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.entry-tag-picker { display: flex; flex: 1 1 360px; flex-wrap: wrap; gap: 7px; }
.entry-tag-pill,.entry-tag-custom-toggle { min-height: 30px; padding: 5px 10px; border: 1px solid #e4c9bc; border-radius: 99px; color: #75483d; background: #fff9f5; font-size: 12px; font-weight: 650; cursor: pointer; }
.entry-tag-pill:hover,.entry-tag-pill:focus-visible,.entry-tag-custom-toggle:hover,.entry-tag-custom-toggle:focus-visible { border-color: #ca8a7d; background: #fff1ec; }
.entry-tag-pill.selected,.entry-tag-pill[aria-pressed="true"] { color: #fffaf7; border-color: var(--brand); background: var(--brand); box-shadow: 0 3px 9px rgba(156,63,53,.16); }
.entry-tag-custom-toggle[aria-expanded="true"] { color: var(--brand); border-color: #ca8a7d; background: var(--brand-soft); }
.entry-tag-picker input[type="hidden"] { display: none; }
.entry-custom-tag-create { max-width: 520px; }
.entry-custom-tag-create[hidden] { display: none; }
.field-label-row,.lockable-label { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:7px; }
.lockable-label .field-label { margin:0; }
.field-lock { display:inline-flex; align-items:center; cursor:pointer; }
.field-lock input { position:absolute; opacity:0; pointer-events:none; }
.field-lock span { display:inline-flex; align-items:center; gap:4px; padding:4px 8px; border:1px solid var(--line); border-radius:99px; color:var(--ink-soft); background:var(--surface-soft); font-size:11px; }
.field-lock svg { width:13px; height:13px; }
.field-lock input:checked + span { color:var(--brand); border-color:#ca8a7d; background:var(--brand-soft); }
.entry-party-field { align-content: start; }
.entry-tags-field { min-width: 0; }
.entry-tags-field .entry-tag-picker { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }
.entry-tags-field .entry-tag-pill,.entry-tags-field .entry-tag-custom-toggle { flex: 0 0 auto; }
#entry-contact-query,#entry-household-member { height: 42px; min-height: 42px; }
.derived-value { min-height: 42px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink-soft); background: var(--surface-soft); font-size: 12px; line-height: 1.55; }
.gift-books-head { margin-bottom: 22px; }
.gift-book-shelf { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.gift-book-tile { display: flex; min-width: 0; min-height: 280px; flex-direction: column; overflow: hidden; border: 1px solid #ead7ca; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .18s ease,border-color .18s ease,box-shadow .18s ease; }
.gift-book-tile:hover { transform: translateY(-2px); border-color: #dca99a; box-shadow: 0 14px 34px rgba(99,52,34,.11); }
.gift-book-tile-link { display: flex; min-width: 0; flex: 1; flex-direction: column; padding: 18px; color: inherit; }
.gift-book-tile-top { display: flex; align-items: flex-start; justify-content: space-between; }
.gift-book-tile-mark { display: grid; place-items: center; width: 46px; height: 54px; border-radius: 7px 13px 13px 7px; color: #fff9f1; background: linear-gradient(145deg,#ec614b,#b81f2e); box-shadow: inset 4px 0 rgba(255,221,165,.3),0 7px 16px rgba(181,31,45,.15); font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: 17px; }
.gift-book-tile.is-default .gift-book-tile-mark { color: #712b24; background: linear-gradient(145deg,#ffe8a9,#efbd61); box-shadow: inset 4px 0 rgba(255,255,255,.35),0 7px 16px rgba(181,124,31,.13); }
.gift-book-tile.is-funeral { border-color: #d8d0c6; background: #fbfaf7; }
.gift-book-tile.is-funeral .gift-book-tile-mark { color: #fffaf0; background: linear-gradient(145deg,#817a72,#4f4a46); box-shadow: inset 4px 0 rgba(222,203,164,.26),0 7px 16px rgba(52,47,43,.14); }
.gift-book-tile.is-funeral .gift-book-tile-status { color: #5d5650; background: #ede9e3; }
.gift-book-tile.is-archived { box-shadow: none; }
.gift-book-tile-status { padding: 4px 9px; border-radius: 99px; color: #934139; background: #fff0ea; font-size: 11px; font-weight: 700; }
.gift-book-tile-title { margin: 17px 0 15px; }
.gift-book-tile.is-default .gift-book-tile-title > span { display:none; }
.gift-book-tile-title > span { color: var(--ink-soft); font-size: 12px; }
.gift-book-tile-title h2 { overflow: hidden; margin: 4px 0 5px; font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: 21px; text-overflow: ellipsis; white-space: nowrap; }
.gift-book-tile-title p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.gift-book-tile-money { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); margin-top: auto; padding: 13px 0 2px; border-top: 1px solid var(--line); }
.gift-book-tile-money span { min-width: 0; padding: 0 9px; border-left: 1px solid var(--line); }
.gift-book-tile-money span:first-child { padding-left: 0; border-left: 0; }
.gift-book-tile-money small,.gift-book-tile-money strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gift-book-tile-money small { color: var(--ink-soft); font-size: 11px; }
.gift-book-tile-money strong { margin-top: 4px; font-size: 14px; }
.gift-book-tile footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); background: #fffaf6; }
.gift-book-tile footer > span { color: var(--ink-soft); font-size: 12px; white-space: nowrap; }
.gift-book-tile footer > div { display: flex; gap: 7px; }
.record-year-summary { display:flex; flex-wrap:wrap; gap:8px 20px; margin:0 0 14px; padding:12px 16px; border:1px solid #ead7ca; border-radius:14px; background:#fffaf6; color:var(--ink-soft); font-size:13px; }
.record-year-summary strong { color:var(--ink); }
.record-view-switch { width:min(390px,100%); margin:0 0 14px; }
.record-view-switch a { padding:9px 14px; border-radius:9px; color:var(--ink-soft); font-weight:650; text-align:center; }
.record-view-switch a.active { color:var(--brand-dark); background:#fff; box-shadow:var(--shadow-sm); }
.summary-metrics { justify-content:space-between; }
.summary-tags { display:flex !important; flex-wrap:wrap; gap:4px; margin-top:5px; }
.summary-tags .tag { padding:1px 7px; font-size:10px; }
.contact-history { margin-top:18px; overflow:hidden; }
.history-year { padding:18px 20px; border-top:1px solid var(--line); }
.history-year > h3 { margin:0 0 12px; font-size:18px; }
.history-book { margin-top:12px; border:1px solid var(--line); border-radius:14px; overflow:hidden; }
.history-book > header { display:flex; align-items:center; justify-content:space-between; gap:15px; padding:12px 15px; background:#fffaf6; }
.history-book > header div { display:flex; gap:9px; }
.history-book > header span,.history-book > header small { color:var(--ink-soft); }
.history-item { display:grid; grid-template-columns:minmax(0,1fr) auto 110px; align-items:center; gap:14px; padding:13px 15px; border-top:1px solid var(--line); }
.history-item:first-child { border-top:0; }
.history-item > div { display:grid; gap:3px; }
.history-item > div span { color:var(--ink-soft); font-size:12px; }
.history-item > .amount { text-align:right; }
.gift-book-detail-head .eyebrow a { color: var(--brand); }
.gift-book-detail-head .eyebrow span { color: var(--ink-soft); }
.gift-book-detail-layout { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 18px; align-items: start; }
.gift-book-detail-main,.gift-book-detail-side { display: grid; gap: 18px; }
.gift-book-detail-side { position: sticky; top: 86px; }
.gift-book-detail-hero { display: grid; grid-template-columns: 150px minmax(0,1fr); min-height: 220px; overflow: hidden; border: 1px solid #e6cfc2; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-sm); }
.gift-book-detail-mark { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #fff9f0; background: radial-gradient(circle at 25% 20%,rgba(255,221,154,.35),transparent 30%),linear-gradient(155deg,#e95a45,#b51f2d); }
.gift-book-detail-mark span { font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: 29px; }
.gift-book-detail-mark small { padding: 4px 9px; border: 1px solid rgba(255,255,255,.38); border-radius: 99px; }
.gift-book-detail-hero.is-default .gift-book-detail-mark { color: #6f2a20; background: linear-gradient(155deg,#ffe7a0,#edb653); }
.gift-book-detail-hero.is-funeral { border-color: #d8d0c6; background: #fbfaf7; }
.gift-book-detail-hero.is-funeral .gift-book-detail-mark { color: #fffaf0; background: radial-gradient(circle at 25% 20%,rgba(222,203,164,.23),transparent 30%),linear-gradient(155deg,#817a72,#4f4a46); }
.gift-book-detail-summary { display: flex; min-width: 0; flex-direction: column; justify-content: center; padding: 26px; }
.gift-book-money { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
.gift-book-money span { min-width: 0; padding: 4px 20px; border-left: 1px solid var(--line); }
.gift-book-money span:first-child { padding-left: 0; border-left: 0; }
.gift-book-money small,.gift-book-money strong { display: block; }
.gift-book-money small { color: var(--ink-soft); font-size: 12px; }
.gift-book-money strong { margin-top: 8px; font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: 24px; }
.gift-book-money .balance strong { color: var(--brand-dark); }
.gift-book-detail-count { display: flex; align-items: center; gap: 11px; margin-top: 25px; padding-top: 15px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 13px; }
.gift-book-detail-count i { width: 4px; height: 4px; border-radius: 50%; background: #caa99a; }
.gift-project-card .card-head p { margin: 3px 0 0; color: var(--ink-soft); font-size: 12px; }
.gift-project-detail-list { display: grid; gap: 9px; }
.gift-project-detail { display: grid; grid-template-columns: minmax(0,1fr) 170px auto; align-items: center; gap: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #fffaf6; }
.gift-project-copy { min-width: 0; }
.gift-project-copy strong { font-size: 15px; }
.gift-project-copy p { overflow: hidden; margin: 4px 0; color: var(--ink-soft); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.gift-project-copy small { color: #967a6c; font-size: 11px; }
.gift-project-money { display: flex; gap: 12px; color: var(--ink-soft); font-size: 12px; }
.gift-project-actions { display: flex; align-items: center; gap: 6px; }
.book-info-list { display: grid; gap: 0; }
.book-info-list > div { display: grid; grid-template-columns: 76px minmax(0,1fr); gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.book-info-list > div:first-child { padding-top: 0; border-top: 0; }
.book-info-list span { color: var(--ink-soft); font-size: 12px; }
.book-info-list strong { min-width: 0; text-align: right; font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.book-info-list .book-info-notes { display: block; }
.book-info-list .book-info-notes strong { display: block; margin-top: 6px; text-align: left; line-height: 1.7; }
.gift-book-archive { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); }
.gift-book-archive > summary { display: flex; align-items: center; gap: 12px; margin-bottom: 15px; color: var(--ink); cursor: pointer; font-weight: 700; }
.gift-book-archive > summary span { color: var(--ink-soft); font-size: 12px; font-weight: 400; }
.balance-summary { display: grid; grid-template-columns: repeat(2,1fr); gap: 9px; }
.balance-summary span { padding: 12px; border-radius: 11px; background: var(--surface-soft); }
.balance-summary small,.balance-summary strong { display: block; }
.balance-summary small { color: var(--ink-soft); font-size: 11px; }
.balance-summary strong { margin-top: 5px; color: var(--brand-dark); font-size: 17px; }
.balance-help { margin: 12px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.6; }
.gift-book-side-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
.gift-book-overview { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.gift-book-overview > a { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: #fffaf5; }
.gift-book-overview > a:hover { border-color: #d9a99a; }
.gift-book-mini-mark { display: grid; place-items: center; width: 38px; height: 44px; flex: 0 0 auto; border-radius: 5px 10px 10px 5px; color: #fff; background: linear-gradient(145deg,#e95642,#b51f2d); box-shadow: inset 3px 0 rgba(255,220,150,.35); }
.gift-book-overview strong,.gift-book-overview small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gift-book-overview small { color: var(--ink-soft); font-size: 11px; }
.pending-section-label { margin-top: 2px; padding: 7px 2px 3px; color: #7b3a31; font-size: 12px; font-weight: 700; }
.contact-combobox{position:relative}
.contact-suggestions{position:absolute;z-index:20;left:0;right:0;top:72px;max-height:300px;overflow:auto;background:#fffdf9;border:1px solid var(--line);border-radius:14px;box-shadow:0 18px 45px rgba(92,39,25,.16);padding:6px}
.contact-suggestion{display:flex;width:100%;flex-direction:column;align-items:flex-start;gap:3px;padding:11px 12px;border:0;border-radius:10px;background:transparent;text-align:left;color:var(--ink);cursor:pointer}
.contact-suggestion:hover,.contact-suggestion:focus{background:#fff0e8}
.contact-suggestion span{font-size:12px;color:var(--ink-soft)}
.contact-suggestion.create{border-top:1px solid var(--line);border-radius:0 0 10px 10px;color:var(--brand)}
.inline-create{display:flex;gap:8px;align-items:center;margin-top:10px}
.inline-create input{flex:1}
.choice-chips{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:10px}
.choice-chip{border:1px solid #e6cfc1;border-radius:999px;background:#fffaf5;color:#6b483b;padding:7px 12px;cursor:pointer}
.choice-chip:hover,.choice-chip.selected{border-color:var(--brand);background:#fff0ed;color:var(--brand)}
.fixed-value{display:flex;min-height:44px;flex-direction:column;justify-content:center;border:1px solid var(--line);border-radius:12px;background:#f8f3ec;padding:7px 12px;font-weight:700}
.fixed-value small{font-size:12px;font-weight:400;color:var(--ink-soft)}
.attachment-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:10px;margin-top:12px}
.attachment-item{position:relative;margin:0;border:1px solid var(--line);border-radius:12px;overflow:hidden;background:#f8f3ec}
.attachment-item img{display:block;width:100%;height:110px;object-fit:cover}
.attachment-item figcaption{padding:7px 9px;font-size:11px;color:var(--ink-soft);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.attachment-item .icon-btn{position:absolute;right:6px;top:6px;background:rgba(255,255,255,.92)}
.pending-empty { padding: 7px 10px; border-radius: 9px; background: var(--surface-soft); font-size: 12px; }
.contact-card .person { margin-bottom: 15px; }
.contact-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 13px; border-top: 1px solid var(--line); }
.contact-stats span { color: var(--ink-soft); font-size: 12px; }
.contact-stats strong { display: block; color: var(--ink); font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: 16px; }
.timeline { position: relative; display: grid; gap: 18px; margin-left: 8px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; border-left: 1px solid #d9c9b6; }
.timeline-item { position: relative; padding-left: 27px; }
.timeline-item::before { content: ""; position: absolute; left: 0; top: 7px; width: 13px; height: 13px; border: 3px solid var(--surface); border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 1px #cfbca7; }
.timeline-item p { margin: 3px 0 0; color: var(--ink-soft); font-size: 13px; }

.chart { display: grid; min-width: 0; gap: 12px; }
.bar-row { display: grid; min-width: 0; grid-template-columns: 64px minmax(0,1fr) minmax(64px,80px); gap: 10px; align-items: center; font-size: 13px; }
.bar-row > span, .bar-row > strong { min-width: 0; overflow-wrap: anywhere; }
.bar-row > strong { text-align: right; font-size: clamp(11px,2.8vw,13px); }
.bar-track { height: 10px; overflow: hidden; border-radius: 99px; background: #eee7dd; }
.bar-fill { width: var(--w); height: 100%; border-radius: inherit; background: var(--bar, var(--brand)); }
.donut-wrap { display: flex; min-width: 0; align-items: center; justify-content: center; gap: 26px; padding: 10px 0; }
.donut { display: grid; place-items: center; width: 154px; height: 154px; flex: 0 0 auto; border-radius: 50%; background: conic-gradient(#8b5a12 0 48%, var(--brand) 48% 78%, #d2a75f 78% 91%, #cabfb0 91%); }
.donut::after { content: attr(data-center); display: grid; place-items: center; width: 100px; height: 100px; border-radius: 50%; background: var(--surface); font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-weight: 700; }
.legend { display: grid; gap: 9px; }
.legend span { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 13px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }

.empty { display: grid; place-items: center; min-height: 240px; padding: 36px; color: var(--ink-soft); text-align: center; }
.empty-mark { display: grid; place-items: center; width: 62px; height: 62px; margin-bottom: 12px; border-radius: 20px; color: var(--brand); background: var(--brand-soft); font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: 27px; }
.empty h3 { margin: 0; color: var(--ink); }
.empty p { max-width: 360px; margin: 6px 0 16px; }
.skeleton { overflow: hidden; border-radius: 8px; background: #e9e0d5; }
.skeleton::after { content: ""; display: block; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent); animation: shimmer 1.3s infinite; transform: translateX(-100%); }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(37,31,26,.48); animation: fade .14s ease-out; }
.modal { width: min(560px,100%); max-height: min(760px, calc(100vh - 40px)); overflow: auto; border: 1px solid rgba(255,255,255,.35); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-md); animation: rise .18s ease-out; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 19px 21px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: 20px; }
.modal-body { padding: 21px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 15px 21px; border-top: 1px solid var(--line); }
.toast-region { position: fixed; z-index: 200; right: 20px; top: 20px; display: grid; gap: 10px; width: min(380px, calc(100vw - 40px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 13px 15px; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-md); animation: slide .22s ease-out; pointer-events: auto; }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--gold); }
.toast strong, .toast span { display: block; }
.toast span { color: var(--ink-soft); font-size: 13px; }

.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, .9fr) minmax(460px, 1.1fr); background: #fff6eb; }
.auth-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(34px,6vw,80px); color: #fffdf6; background: radial-gradient(circle at 86% 14%,rgba(255,225,151,.48),transparent 25%),radial-gradient(circle at 8% 88%,rgba(255,191,126,.28),transparent 30%),linear-gradient(145deg,#f05a43 0%,#df3734 50%,#bf2431 100%); }
.auth-brand::after { content: "礼"; position: absolute; right: -38px; bottom: -100px; color: rgba(255,232,176,.14); font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: 360px; line-height: 1; }
.auth-brand .brand-mark { color: #8a241d; border: 1px solid rgba(255,250,220,.85); background: linear-gradient(145deg,#fff0bd,#efc15e); box-shadow: 0 8px 24px rgba(126,29,22,.18),inset 0 0 0 1px rgba(255,255,255,.45); }
.auth-brand .brand-copy span { color: #ffe9c5; }
.auth-brand .eyebrow { color: #fff0c9 !important; text-shadow: 0 1px 8px rgba(120,24,21,.16); }
.auth-brand > small { position: relative; z-index: 1; color: #ffe5ca !important; }
.auth-brand h1 { position: relative; z-index: 1; max-width: 420px; margin: auto 0 12px; font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: clamp(38px,5vw,62px); font-weight: 500; line-height: 1.22; text-shadow: 0 2px 12px rgba(128,24,24,.16); }
.auth-brand p { position: relative; z-index: 1; max-width: 420px; color: #ffe9dc; font-size: 16px; }
.auth-panel { display: grid; place-items: center; padding: 32px; background: radial-gradient(circle at 90% 8%,rgba(243,190,91,.16),transparent 28%),linear-gradient(160deg,#fff9f1,#fff2e4); }
.auth-card { width: min(430px,100%); padding: 34px; border: 1px solid #efd3bd; border-radius: 24px; background: rgba(255,253,248,.98); box-shadow: 0 22px 54px rgba(151,55,35,.13),0 4px 14px rgba(166,108,24,.08); }
.auth-card h2 { margin: 0; font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: 28px; }
.auth-card > p { margin: 6px 0 24px; color: var(--ink-soft); }
.auth-card .field { margin-top: 15px; }
.wechat-qr-login { margin-top: 16px; }
.wechat-qr-divider { display: flex; align-items: center; gap: 12px; margin: 2px 0 14px; color: var(--ink-soft); font-size: 12px; }
.wechat-qr-divider::before, .wechat-qr-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.wechat-qr-button { width: 100%; border-color: #9fc7af; color: #187749; background: #f3fbf6; }
.wechat-qr-result { margin-top: 14px; padding: 14px; border: 1px solid #cfe4d7; border-radius: 14px; background: #f7fcf9; text-align: center; }
.wechat-qr-result img { display: block; width: min(220px, 100%); aspect-ratio: 1; object-fit: contain; margin: 0 auto 10px; border-radius: 10px; background: #fff; }
.wechat-qr-result strong { display: block; }
.wechat-qr-result p { margin: 5px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.wechat-qr-result .wechat-qr-error { color: #a33227; }
.auth-submit { width: 100%; margin-top: 20px; }
.auth-switch { margin: 18px 0 0; color: var(--ink-soft); text-align: center; font-size: 13px; }
.auth-switch a { color: var(--brand); font-weight: 650; }
.auth-demo { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.auth-demo .btn-jade { color: #70261d; border-color: #e3ac4d; background: linear-gradient(135deg,#ffe49a,#efbd58); box-shadow: 0 7px 18px rgba(176,102,25,.16); }
.auth-demo .btn-jade:hover { border-color: #d89a34; background: linear-gradient(135deg,#ffdc7b,#eeb044); }
.quick-login { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.quick-login-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.quick-login-head strong { font-size: 13px; }
.quick-login-head span { color: var(--ink-soft); font-size: 11px; }
.quick-role-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.quick-role-grid button { min-height: 64px; padding: 10px 11px; border: 1px solid #e5cfc7; border-radius: 11px; color: var(--ink); background: #fff9f5; text-align: left; }
.quick-role-grid button:hover { border-color: #c98b7e; background: var(--brand-soft); }
.quick-role-grid strong,.quick-role-grid small { display: block; }
.quick-role-grid strong { color: var(--brand-dark); }
.quick-role-grid small { margin-top: 3px; color: var(--ink-soft); font-size: 11px; line-height: 1.35; }

.utility-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.utility-card { min-height: 155px; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.utility-card h3 { margin: 13px 0 4px; font-size: 16px; }
.utility-card p { margin: 0 0 14px; color: var(--ink-soft); font-size: 13px; }
.utility-icon { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 11px; color: var(--brand); background: var(--brand-soft); }
.household-members-card { margin-top: 20px; scroll-margin-top: 82px; }
.household-members-card .card-head p { margin: 3px 0 0; color: var(--ink-soft); font-size: 12px; }
.household-member-note { display: flex; gap: 8px 14px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; padding: 11px 13px; border-radius: 11px; color: #70450f; background: var(--gold-soft); font-size: 12px; }
.household-member-create { display: grid; grid-template-columns: minmax(180px,1fr) auto; gap: 10px; margin-bottom: 14px; }
.household-member-list { display: grid; gap: 9px; }
.household-member-row { display: grid; grid-template-columns: auto 40px minmax(130px,1fr) auto; gap: 11px; align-items: center; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.household-member-order { display: flex; gap: 4px; }
.household-member-order .icon-btn { width: 31px; height: 31px; font-size: 16px; }
.household-member-copy { min-width: 0; }
.household-member-copy strong,.household-member-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.household-member-copy small { margin-top: 2px; color: var(--ink-soft); font-size: 12px; }
.household-member-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }

.daily-project-settings,.quick-template-settings { margin-top:20px; scroll-margin-top:82px; }
.daily-project-settings .card-head p,.quick-template-settings .card-head p { margin:3px 0 0; color:var(--ink-soft); font-size:12px; }
.workflow-inline-form { display:grid; grid-template-columns:minmax(180px,1fr) minmax(150px,.55fr) auto; gap:9px; margin-bottom:15px; }
.workflow-template-form { grid-template-columns:minmax(170px,1fr) minmax(150px,.75fr) minmax(150px,.75fr) auto; }
.workflow-list { display:grid; gap:9px; }
.workflow-row { display:flex; align-items:center; gap:11px; min-width:0; padding:11px 12px; border:1px solid var(--line); border-radius:12px; background:var(--surface-soft); }
.workflow-row.is-hidden { opacity:.68; }
.workflow-order { display:flex; gap:4px; }
.workflow-order .icon-btn { width:30px; height:30px; }
.workflow-copy { min-width:0; flex:1; }
.workflow-copy strong,.workflow-copy small { display:block; }
.workflow-copy small { margin-top:3px; overflow:hidden; color:var(--ink-soft); font-size:11px; text-overflow:ellipsis; white-space:nowrap; }
.workflow-actions { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:6px; }
.quick-template-mark { display:grid; place-items:center; width:34px; height:34px; flex:0 0 auto; border-radius:10px; color:var(--brand); background:var(--brand-soft); font-weight:800; }
.configured-project-list { display:grid; gap:8px; }
.configured-project-row { display:grid; grid-template-columns:24px minmax(0,1fr) auto 36px; align-items:center; gap:8px; }
.configured-project-row > span { color:var(--ink-soft); font-size:12px; text-align:center; }
.workflow-entry-layout { display:grid; grid-template-columns:minmax(0,1.15fr) minmax(300px,.85fr); align-items:start; gap:20px; }
.special-entry-form .entry-tag-picker { flex-basis:auto; }
.special-entry-actions { display:grid; grid-template-columns:1fr 1fr; }
.batch-context-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:11px 13px; border-radius:11px; color:#6f5425; background:var(--gold-soft); font-size:12px; }
.recent-entry-card { position:sticky; top:90px; }
.project-action-list { display:grid; gap:9px; }
.project-action { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:15px; border:1px solid var(--line); border-radius:13px; background:var(--surface-soft); }
.project-action:hover { border-color:#ca8a7d; background:#fff8f2; }
.project-action strong,.project-action small { display:block; }
.project-action small { margin-top:4px; color:var(--ink-soft); }
.project-action svg { width:20px; height:20px; color:var(--brand); }
.gift-return-summary { margin-top:20px; }
.return-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin-bottom:15px; }
.return-metrics span { padding:12px; border-radius:11px; background:var(--surface-soft); }
.return-metrics small,.return-metrics strong { display:block; }
.return-metrics small { color:var(--ink-soft); }
.return-metrics strong { margin-top:5px; font-size:17px; }

.share-management { margin-top: 20px; scroll-margin-top: 82px; }
.share-management .card-head p { margin: 3px 0 0; color: var(--ink-soft); font-size: 12px; }
.share-columns { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; margin-top: 18px; }
.share-columns h3 { margin: 0 0 10px; font-size: 15px; }
.share-list { display: grid; gap: 9px; }
.share-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 96px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.share-row-main { min-width: 0; }
.share-row-main strong,.share-row-main span,.share-row-main small { display: block; overflow-wrap: anywhere; }
.share-row-main span { margin-top: 3px; color: var(--ink); font-size: 13px; }
.share-row-main small { margin-top: 3px; color: var(--ink-soft); font-size: 12px; line-height: 1.45; }
.share-empty { min-height: 96px; padding: 18px; border: 1px dashed var(--line); border-radius: 12px; background: var(--surface-soft); }
.share-empty p { margin: 0; }
.invite-card { display: grid; grid-template-columns: 38px minmax(0,1fr); gap: 11px; margin: 18px 0 4px; padding: 13px; border: 1px solid #bad7cb; border-radius: 13px; background: var(--jade-soft); }
.invite-card.is-error { border-color: #e9b8b3; background: var(--brand-soft); }
.invite-card-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: var(--jade); background: var(--surface); }
.invite-card strong,.invite-card span,.invite-card small,.invite-card b { display: block; }
.invite-card span { margin-top: 3px; color: var(--ink); font-size: 13px; }
.invite-card small { margin-top: 4px; color: var(--ink-soft); font-size: 11px; line-height: 1.45; }
.invite-card b { margin-top: 7px; color: var(--danger); font-size: 12px; }
.invite-auth-links { display: flex; gap: 12px; margin-top: 8px; font-size: 12px; font-weight: 700; }
.invite-auth-links a { color: var(--jade); }

.record-summary-strip { display: grid; grid-template-columns: repeat(5,minmax(120px,1fr)); gap: 1px; overflow: hidden; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--line); }
.record-summary-strip span { padding: 13px 15px; background: var(--surface); }
.record-summary-strip small,.record-summary-strip strong { display: block; }
.record-summary-strip small { color: var(--ink-soft); font-size: 11px; }
.record-summary-strip strong { margin-top: 4px; font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-size: 18px; }
.record-view-switch { display: inline-flex; gap: 4px; margin-bottom: 14px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.record-view-switch a { padding: 8px 16px; border-radius: 8px; color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.record-view-switch a.active { color: var(--brand-dark); background: var(--surface); box-shadow: 0 2px 8px rgba(80,54,33,.08); }
.contact-summary-layout.has-detail { display: grid; grid-template-columns: minmax(640px,1.35fr) minmax(330px,.65fr); border-top: 1px solid var(--line); }
.contact-summary-layout.has-detail .contact-summary-table { min-width: 0; }
.contact-summary-layout.has-detail .contact-summary-head,.contact-summary-layout.has-detail .contact-summary-row { grid-template-columns: minmax(155px,1.1fr) minmax(105px,.75fr) 100px minmax(170px,1.15fr); }
.contact-summary-layout.has-detail .contact-summary-head > :nth-child(3),.contact-summary-layout.has-detail .contact-summary-head > :nth-child(4),.contact-summary-layout.has-detail .contact-summary-head > :nth-child(5),.contact-summary-layout.has-detail .contact-summary-row > :nth-child(3),.contact-summary-layout.has-detail .contact-summary-row > :nth-child(4),.contact-summary-layout.has-detail .contact-summary-row > :nth-child(5) { display: none; }
.contact-summary-master { min-width: 0; overflow-x: auto; }
.contact-summary-table { min-width: 800px; }
.contact-summary-head,.contact-summary-row { display: grid; grid-template-columns: minmax(145px,1.2fr) minmax(95px,.85fr) minmax(82px,.68fr) repeat(3,minmax(86px,.7fr)) minmax(145px,1.15fr); column-gap: clamp(6px,1vw,12px); row-gap: 8px; align-items: center; }
.contact-summary-head { padding: 9px 14px; color: var(--ink-soft); background: var(--surface-soft); font-size: 11px; font-weight: 700; }
.contact-summary-row { min-height: 60px; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--ink); }
.contact-summary-row:hover,.contact-summary-row.selected { background: #fff7ef; }
.contact-summary-row > span { min-width: 0; }
.contact-summary-row span > strong,.contact-summary-row span > small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-summary-row span > small { margin-top: 3px; color: var(--ink-soft); font-size: 11px; }
.contact-summary-person { display: flex; align-items: center; gap: 10px; }
.contact-summary-person > span:last-child { min-width: 0; }
.contact-summary-balance { font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif; font-weight: 700; }
.contact-summary-placeholder { display: none; }
.contact-summary-detail { min-width: 0; max-height: calc(100vh - 235px); overflow: auto; padding: 18px; border-left: 1px solid var(--line); background: #fffaf5; }
.contact-summary-detail > header { display: grid; gap: 12px; margin-bottom: 18px; }
.contact-summary-detail h2,.contact-summary-detail h3,.contact-summary-detail p { margin: 0; }
.contact-summary-detail header p:last-child { margin-top: 4px; color: var(--ink-soft); font-size: 12px; }
.record-year-group { margin-top: 18px; }
.record-year-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.record-year-head span { color: var(--ink-soft); font-size: 11px; text-align: right; }
.record-book-group { margin-top: 9px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.record-book-group summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 13px; cursor: pointer; }
.record-book-group summary span { color: var(--ink-soft); font-size: 11px; }
.contact-detail-record { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 10px; align-items: center; padding: 11px 13px; border-top: 1px solid var(--line); }
.contact-detail-record > div:first-child strong,.contact-detail-record > div:first-child small { display: block; margin-top: 4px; }
.contact-detail-record > div:first-child small { color: var(--ink-soft); font-size: 11px; }

.mobile-nav { display: none; }
.mobile-only { display: none; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(3,minmax(150px,1fr)); }
  .stats-metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .contact-grid, .utility-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .gift-book-shelf { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .gift-book-detail-layout { grid-template-columns: 1fr; }
  .gift-book-detail-side { position: static; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .gift-book-side-actions { grid-column: 1/-1; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .gift-book-overview { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .contact-list-head,.contact-list-row { grid-template-columns: minmax(170px,1.35fr) minmax(84px,.65fr) minmax(92px,.7fr) minmax(92px,.7fr) minmax(94px,.7fr) minmax(140px,1.05fr) 72px 62px; min-width: 940px; }
  .contact-list-head > :nth-child(3),.contact-tags { display: none; }
  .entitlement-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 900px) {
  :root { --sidebar: 82px; }
  .sidebar { padding-inline: 12px; }
  .brand { justify-content: center; padding-inline: 0; }
  .brand-copy, .nav-link span, .sidebar-foot { display: none; }
  .nav-link { justify-content: center; padding: 13px; }
  .nav-link.active { box-shadow: inset 0 -3px var(--brand); }
  .grid-2, .grid-equal { grid-template-columns: 1fr; }
  .share-columns { grid-template-columns: 1fr; }
  .record-row { grid-template-columns: minmax(170px,1fr) 110px 100px auto; }
  .record-row .record-extra { display: none; }
  .contact-list { overflow: visible; }
  .contact-list-head { display: none; }
  .contact-list-row { grid-template-columns: minmax(0,1fr) auto; gap: 6px 12px; min-width: 0; min-height: 76px; padding: 11px 14px; }
  .contact-region,.contact-tags,.contact-money,.contact-recent,.contact-books,.contact-action { display: none; }
  .contact-person { grid-column: 1; grid-row: 1; }
  .contact-balance { grid-column: 2; grid-row: 1; text-align: right; }
  .contact-mobile-meta { display: block; grid-column: 1; grid-row: 2; min-width: 0; overflow: hidden; color: var(--ink-soft); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .contact-mobile-meta small { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .contact-mobile-totals { display: block; grid-column: 2; grid-row: 2; align-self: end; color: #806055; font-size: 10px; text-align: right; white-space: nowrap; }
  .contact-summary-layout.has-detail { grid-template-columns: 1fr; }
  .contact-summary-detail { max-height: none; border-top: 1px solid var(--line); border-left: 0; }
}
@media (max-width: 680px) {
  :root { --sidebar: 0px; }
  body { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .main-wrap { width: 100%; }
  .topbar { min-height: calc(60px + env(safe-area-inset-top)); padding: calc(9px + env(safe-area-inset-top)) 16px 9px; }
  .crumb strong { font-size: 18px; }
  .crumb span, .demo-pill { display: none; }
  .content { padding: 21px 14px 38px; }
  .page-head { align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
  .page-head.has-page-back { grid-template-columns: auto minmax(0,1fr); gap: 10px 12px; }
  .page-head.has-page-back > .page-back-button { grid-column: 1; grid-row: 1; }
  .page-head.has-page-back > div:not(.page-actions) { grid-column: 2; grid-row: 1; }
  .page-head.has-page-back > .page-actions { grid-column: 1 / -1; }
  .page-back-button { min-height: 38px; max-width: 118px; padding: 7px 8px; }
  .page-back-button span { overflow: hidden; text-overflow: ellipsis; }
  .page-head > div { min-width: 0; max-width: 100%; }
  .page-actions, .page-actions .btn { max-width: 100%; }
  .page-head h1 { font-size: 26px; }
  .page-head p { font-size: 13px; }
  .page-actions .btn:not(.btn-primary) { display: none; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .record-summary-strip { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .record-summary-strip span:last-child { grid-column: 1/-1; }
  .record-view-switch { display: flex; }
  .record-view-switch a { flex: 1; text-align: center; }
  .contact-summary-table { min-width: 0; }
  .contact-summary-head { display: none; }
  .contact-summary-row { grid-template-columns: minmax(0,1fr) auto; gap: 6px 12px; min-height: 112px; }
  .contact-summary-row > :nth-child(2),.contact-summary-row > :nth-child(3),.contact-summary-row > :nth-child(4),.contact-summary-row > :nth-child(5) { display: none; }
  .contact-summary-row > :nth-child(6) { grid-column: 2; grid-row: 1; text-align: right; }
  .contact-summary-row > :nth-child(7) { grid-column: 1/-1; }
  .contact-summary-layout.has-detail .contact-summary-master { display: none; }
  .contact-summary-detail { padding: 15px; border-top: 0; background: var(--surface); }
  .contact-detail-record { grid-template-columns: minmax(0,1fr) auto; }
  .contact-detail-record .row-actions { grid-column: 1/-1; justify-content: flex-end; }
  .contact-detail-metrics,.entitlement-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stats-metric-grid, .annual-report-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .metric { min-height: 112px; padding: 15px; }
  .metric-value { margin-top: 10px; font-size: 22px; }
  .grid-2, .grid-equal { gap: 14px; }
  .card-head { padding: 15px; }
  .card-body { padding: 15px; }
  .record-row { grid-template-columns: minmax(0,1fr) auto; min-height: 72px; padding: 12px 15px; }
  .record-row > :not(.person):not(.row-mobile-amount):not(.row-actions) { display: none; }
  .record-row .row-actions { display: none; }
  .row-mobile-amount { display: block !important; text-align: right; }
  .form-grid { grid-template-columns: 1fr; }
  .entry-name-fields { grid-template-columns: 1fr; }
  .entry-tag-picker { flex-basis: 100%; }
  .entry-tag-custom-toggle { width: auto; }
  .entry-custom-tag-create { align-items: stretch; flex-direction: column; }
  .entry-custom-tag-create .btn { width: 100%; }
  .advanced-grid { grid-template-columns:1fr; padding:14px; }
  .form-more summary { align-items:flex-start; flex-direction:column; gap:2px; }
  .form-more summary::after { position:absolute; right:28px; }
  .form-span-2 { grid-column: auto; }
  .toolbar { align-items: stretch; }
  .toolbar select { flex: 1 1 calc(50% - 8px); }
  .contact-grid, .utility-grid { grid-template-columns: 1fr; }
  .household-member-create { grid-template-columns: 1fr; }
  .household-member-row { grid-template-columns: auto 36px minmax(0,1fr); align-items: start; }
  .household-member-order { flex-direction: column; }
  .household-member-actions { grid-column: 2/-1; justify-content: flex-start; }
  .configured-project-row { grid-template-columns: 24px minmax(0,1fr) 36px; }
  .configured-project-row .checkbox-line { grid-column: 2/3; }
  .gift-book-shelf { grid-template-columns: 1fr; }
  .gift-book-overview { grid-template-columns: 1fr; }
  .tag-picker { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .table-wrap table { min-width: 720px; }
  .table-wrap .record-detail-table { display:block; width:100%; min-width:0; }
  .record-detail-table thead { display:none; }
  .record-detail-table tbody { display:grid; }
  .record-detail-table tr { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px 12px; padding:14px 15px; border-top:1px solid var(--line); }
  .record-detail-table tr:first-child { border-top:0; }
  .record-detail-table td { display:block; min-width:0; padding:0; border:0; font-size:12px; }
  .record-detail-table td:first-child { grid-column:1/-1; }
  .record-detail-table td:nth-child(2), .record-detail-table td:nth-child(4) { align-self:center; }
  .record-detail-table td:nth-child(4) { text-align:right; }
  .record-detail-table td:nth-child(5) { grid-column:1/-1; }
  .record-detail-table td:last-child { grid-column:1/-1; }
  .record-detail-table .row-actions { justify-content:flex-start; }
  .contact-summary-table { display:block; width:100%; min-width:0 !important; }
  .contact-summary-table thead { display:none; }
  .contact-summary-table tbody { display:grid; }
  .contact-summary-table tr { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:7px 12px; padding:14px 15px; border-top:1px solid var(--line); }
  .contact-summary-table tr:first-child { border-top:0; }
  .contact-summary-table td { display:block; min-width:0; padding:0; border:0; font-size:12px; }
  .contact-summary-table td:first-child { grid-column:1/-1; }
  .contact-summary-table td:nth-child(2)::before { content:'往来 '; color:var(--ink-soft); }
  .contact-summary-table td:nth-child(3)::before { content:'收礼 '; color:var(--ink-soft); font-weight:400; }
  .contact-summary-table td:nth-child(4)::before { content:'送礼 '; color:var(--ink-soft); font-weight:400; }
  .contact-summary-table td:nth-child(5)::before { content:'余额 '; color:var(--ink-soft); font-weight:400; }
  .contact-summary-table td:nth-child(6)::before { content:'最近 '; color:var(--ink-soft); }
  .contact-summary-table td:nth-child(7)::before { content:'涉及 '; color:var(--ink-soft); }
  .contact-summary-table td:last-child { align-self:end; text-align:right; }
  .contact-summary-table td:last-child .btn { padding:6px 9px; }
  .page-head .page-actions [data-action="export-records"] { display:inline-flex; }
  .entitlement-card .card-head { align-items: flex-start; flex-direction: column; }
  .entitlement-card .card-head .btn { display: inline-flex; width: 100%; }
  .entitlement-item { padding: 11px; }
  .entitlement-item > strong { font-size: 13px; }
  .summary-metrics { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .history-year { padding:15px; }
  .history-book > header { align-items:flex-start; flex-direction:column; gap:5px; }
  .history-item { grid-template-columns:minmax(0,1fr) auto; gap:8px; }
  .history-item > .amount { grid-column:2; }
  .contact-history .section-head { align-items:flex-start; flex-direction:column; }
  .contact-history .page-actions { width:100%; }
  .contact-history .page-actions .btn { display:inline-flex; flex:1; }
  .donut-wrap { flex-direction: column; }
  .bar-row { grid-template-columns: minmax(42px,56px) minmax(0,1fr) minmax(54px,67px); }
  .auth-page { display: block; min-height: 100vh; background: var(--paper); }
  .auth-brand { min-height: 250px; padding: 30px 24px; }
  .auth-brand h1 { margin-top: 60px; font-size: 38px; }
  .auth-brand p { font-size: 14px; }
  .auth-panel { display: block; margin-top: -18px; padding: 0 14px 30px; position: relative; }
  .auth-card { padding: 25px 20px; border-radius: 20px; }
  .quick-role-grid { grid-template-columns: 1fr; }
  .mobile-nav { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(7,1fr); padding: 7px 4px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,253,248,.96); backdrop-filter: blur(14px); }
  .mobile-nav.is-scoped { grid-template-columns: repeat(3,1fr); }
  .share-management .card-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .share-management .card-head .btn { width: 100%; }
  .share-row { align-items: flex-start; flex-direction: column; }
  .share-row .btn { width: 100%; }
  .gift-book-tile { min-height: 196px; border-radius: 15px; }
  .gift-book-tile-link { padding: 13px 14px 10px; }
  .gift-book-tile-mark { width:38px; height:44px; font-size:14px; }
  .gift-book-tile-title { margin:9px 0 8px; }
  .gift-book-tile-title > span { display:none; }
  .gift-book-tile-title h2 { margin:0 0 3px; font-size:18px; }
  .gift-book-tile-money { padding-top:9px; }
  .gift-book-tile-money strong { margin-top:2px; font-size:13px; }
  .gift-book-tile footer { padding:8px 14px; }
  .gift-book-detail-side { grid-template-columns: 1fr; }
  .gift-book-side-actions { grid-column: auto; grid-template-columns: 1fr; }
  .gift-book-detail-hero { grid-template-columns: 82px minmax(0,1fr); min-height: 190px; }
  .gift-book-detail-mark span { font-size: 21px; }
  .gift-book-detail-summary { padding: 18px 15px; }
  .gift-book-money span { padding: 3px 9px; }
  .gift-book-money strong { margin-top: 5px; font-size: 18px; }
  .gift-book-detail-count { margin-top: 18px; padding-top: 12px; }
  .gift-project-detail { grid-template-columns: 1fr auto; gap: 10px; }
  .gift-project-money { grid-column: 1/-1; grid-row: 2; }
  .gift-project-actions { grid-column: 2; grid-row: 1; }
  .workflow-inline-form,.workflow-template-form { grid-template-columns:1fr; }
  .workflow-row { align-items:flex-start; flex-wrap:wrap; }
  .workflow-order { flex-direction:column; }
  .workflow-actions { width:100%; justify-content:flex-start; padding-left:45px; }
  .workflow-entry-layout { grid-template-columns:1fr; }
  .recent-entry-card { position:static; }
  .special-entry-actions { grid-template-columns:1fr; }
  .return-metrics { grid-template-columns:1fr; }
  .batch-context-bar { align-items:flex-start; flex-direction:column; }
  .batch-context-bar .btn { width:100%; }
  .mobile-nav a { display: grid; justify-items: center; gap: 2px; color: var(--ink-soft); font-size: 10px; }
  .mobile-nav a svg { width: 21px; height: 21px; }
  .mobile-nav a.active { color: var(--brand); font-weight: 700; }
  .mobile-only { display: initial; }
  .desktop-only { display: none !important; }
  .toast-region { top: 10px; right: 10px; width: calc(100vw - 20px); }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal { width: 100%; max-height: 88vh; border-radius: 22px 22px 0 0; }
}

@keyframes breathe { 50% { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(166,27,27,.2); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes slide { from { opacity: 0; transform: translateX(18px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; } }

/* Keep space navigation available in scoped shares and on phones. */
.space-switch { min-width:0; max-width:260px; }
.space-switch select { width:100%; max-width:260px; text-overflow:ellipsis; }
@media (max-width:700px) {
  .topbar { flex-wrap:wrap; gap:8px; }
  .top-actions { flex-wrap:wrap; max-width:100%; }
  .space-switch { max-width:min(260px, calc(100vw - 32px)); }
}

/* Consistent, wrapping toolbars across desktop and narrow screens. */
.page-actions { gap:10px; min-width:0; max-width:100%; }
.page-head > .page-actions { margin-left:auto; justify-content:flex-end; }
.page-actions > .btn { flex:0 1 auto; min-width:0; height:auto; line-height:1.5; white-space:normal; text-align:center; }
.page-actions .btn > svg { flex-shrink:0; }
.row-actions { flex-wrap:wrap; gap:8px; align-items:center; }
.row-actions > .btn { max-width:100%; white-space:normal; text-align:center; line-height:1.5; }
.card-head { flex-wrap:wrap; }
@media (max-width:1000px) {
 .page-head { flex-wrap:wrap; }
 .page-head > .page-actions { flex:1 1 100%; justify-content:flex-start; margin-left:0; }
}
@media (max-width:640px) {
 .page-head .page-actions { display:flex; flex-wrap:wrap; width:100%; gap:8px; }
 .page-head .page-actions > .btn { display:inline-flex; flex:1 1 calc(50% - 8px); min-height:44px; padding:10px 12px; }
 .page-head .page-actions > .btn-primary { background:var(--brand); }
 .card-head > .page-actions { width:100%; justify-content:flex-start; }
 .row-actions > .btn { min-height:40px; }
}

.gift-money { font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.gift-money.incoming { color:var(--money-in); }
.gift-money.outgoing { color:var(--money-out); }
.contact-money { text-align:right; }

.gift-book-tile-money .gift-money,.gift-book-money .gift-money { padding:0; border:0; }

#entry-member-picker,#entry-project-picker { display:flex; flex-wrap:wrap; gap:8px; margin:0; }
#entry-member-picker .choice-chip,#entry-project-picker .choice-chip { max-width:100%; white-space:normal; overflow-wrap:anywhere; }

.project-contact-filters { display: flex; flex-wrap: wrap; gap: 16px; }
.project-contact-filters .field { flex: 1 1 200px; max-width: 320px; }
.project-contact-return { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
[data-project-contacts] tr[hidden] { display: none; }

/* Consistent, readable amounts using the device font; long values remain visible. */
.metric-value, .amount, .contact-money, .contact-balance, .gift-book-money strong, .record-summary-strip strong, .contact-stats strong { font-variant-numeric: lining-nums tabular-nums; letter-spacing: 0; }
.metric-value { min-width: 0; font-weight: 600; white-space: normal; overflow-wrap: anywhere; }
.metric { min-width: 0; }

/* Warm ledger palette: directional amounts stay distinct from action/error colors. */
.metric.balance .metric-value, .balance-positive, .balance-negative, .balance-even, .contact-balance, .gift-book-money .balance strong, .balance-summary strong { color: var(--money-balance); }
.record-row .badge-jade, .history-item .badge-jade, .table-wrap .badge-jade { color: var(--money-in); background: var(--money-in-soft); }
.record-row .badge-red, .history-item .badge-red, .table-wrap .badge-red { color: var(--money-out); background: var(--money-out-soft); }

.analysis-tabs { display:flex; flex-wrap:wrap; gap:10px; margin:0 0 22px; }
.analysis-tabs .btn { white-space:nowrap; }
.notebook-identity { display:flex; align-items:flex-start; gap:12px; margin-top:8px; max-width:100%; }
.notebook-id { min-width:0; overflow-wrap:anywhere; word-break:break-all; user-select:text; }
.notebook-identity .btn { flex-shrink:0; }

.member-stats-filter{display:flex;flex-wrap:wrap;align-items:end;gap:12px;margin-bottom:20px}.member-stats-filter label{display:grid;gap:6px}.member-stats-filter select,.member-stats-filter input{min-height:40px}

.member-stats-summary{grid-template-columns:repeat(4,minmax(0,1fr))}.member-stats-summary .amount{padding:0;background:transparent}
@media(max-width:680px){.member-stats-summary{grid-template-columns:repeat(2,minmax(0,1fr))}.member-stats-summary>span:last-child{grid-column:auto}}

.payment-options { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; max-width:440px; }
.payment-options .btn { min-width:0; padding-inline:6px; min-height:44px; white-space:nowrap; }
