:root {
  --ink: #173b40;
  --ink-soft: #507075;
  --pine: #123f46;
  --pine-2: #0b2f35;
  --cream: #f5f0e6;
  --paper: #fffdf8;
  --gold: #efb64b;
  --coral: #e7785c;
  --mint: #dff0df;
  --line: #dce1d6;
  --red: #b85047;
  --shadow: 0 14px 34px rgba(18, 63, 70, .10);
  font-family: "Noto Sans SC", system-ui, sans-serif;
  color: var(--ink);
  background: #f7f4ec;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 7% 0%, #fffdf6 0 19%, transparent 35%), #f7f4ec; }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.loading-shell, .login-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.loading-shell { align-content: center; color: var(--ink-soft); }
.loading-mark { width: 38px; height: 38px; border: 3px solid #d8e4d9; border-top-color: var(--pine); border-radius: 50%; animation: loading-spin .8s linear infinite; }
.login-gate { background: radial-gradient(circle at 10% 5%, #fffdf6 0 18%, transparent 38%), #f7f4ec; }
.login-card { width: min(410px, 100%); padding: 32px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); }
.login-card h1 { margin: 8px 0 6px; color: var(--pine); font-size: 28px; letter-spacing: -.04em; }
.login-card > p:not(.form-error) { margin: 0 0 24px; color: var(--ink-soft); font-size: 14px; }
.login-card label { display: grid; gap: 7px; margin-top: 15px; color: #45655f; font-size: 13px; font-weight: 700; }
.login-card input { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid #cbd8ce; border-radius: 9px; outline: none; color: var(--ink); background: #fffefa; font-size: 16px; }
.login-card input:focus { border-color: #5f9585; box-shadow: 0 0 0 3px rgba(95,149,133,.13); }
.login-card .button { width: 100%; min-height: 46px; margin-top: 4px; }
.page-error { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 14px; padding: 12px 15px; border: 1px solid #e5bdb2; border-radius: 11px; color: #843e36; background: #fff1ec; font-size: 13px; }
.page-error .text-button { flex: 0 0 auto; color: #843e36; }
.button:focus-visible, .icon-button:focus-visible, .edit-button:focus-visible, .delete-button:focus-visible, .dialog-close:focus-visible, .text-button:focus-visible { outline: 3px solid rgba(239,182,75,.7); outline-offset: 2px; }
.app-shell { width: min(1180px, calc(100% - 40px)); margin: 30px auto 48px; }

.hero { position: relative; isolation: isolate; min-height: 220px; overflow: hidden; border-radius: 24px; padding: 34px 38px; color: #fffdf8; background: linear-gradient(115deg, var(--pine-2), var(--pine)); box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; z-index: -1; width: 460px; height: 460px; right: -146px; top: -248px; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; box-shadow: 0 0 0 38px rgba(255,255,255,.035), 0 0 0 78px rgba(255,255,255,.03); }
.hero-copy { position: relative; z-index: 2; }
.eyebrow, .section-kicker { display: block; font-family: "DM Mono", monospace; letter-spacing: .08em; font-size: 11px; font-weight: 500; }
.eyebrow { color: #bcd6c4; }
.eyebrow span { display: inline-block; width: 7px; height: 7px; margin: 0 8px 1px 0; border-radius: 50%; background: var(--gold); }
.hero h1, .panel h2, .modal h2 { margin: 8px 0 4px; font-size: clamp(29px, 4vw, 38px); line-height: 1.1; letter-spacing: -.045em; }
.hero p { margin: 0; color: #c5d8d3; font-size: 15px; }
.hero-actions { position: absolute; z-index: 3; top: 34px; right: 34px; display: flex; gap: 9px; }
.hero-art { position: absolute; right: 68px; bottom: 0; width: 260px; height: 170px; opacity: .9; }
.sun { position: absolute; width: 56px; height: 56px; right: 51px; top: 20px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 10px rgba(239,182,75,.12); }
.hill { position: absolute; bottom: -44px; transform: rotate(45deg); border-radius: 20px 0 0; }
.hill-back { width: 160px; height: 160px; right: 14px; background: #2b6b67; }
.hill-front { width: 138px; height: 138px; right: 93px; background: #1d5557; }
.tent { position: absolute; bottom: 19px; right: 112px; width: 0; height: 0; border-right: 38px solid transparent; border-left: 38px solid transparent; border-bottom: 58px solid #e7785c; filter: drop-shadow(0 6px 3px rgba(0,0,0,.18)); }
.tent::after { content: ""; position: absolute; left: -8px; top: 26px; border-right: 8px solid transparent; border-left: 8px solid transparent; border-bottom: 18px solid #f9d071; }

.button { border: 0; border-radius: 11px; min-height: 38px; padding: 0 14px; font-size: 13px; font-weight: 700; transition: transform .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--pine); box-shadow: 0 5px 10px rgba(18,63,70,.17); }
.button-primary span { font-size: 17px; line-height: 0; margin-left: 5px; }
.button-quiet { color: var(--ink); background: #edf0e7; }
.hero .button-quiet { color: #d8e6df; background: rgba(255,255,255,.10); }
.button-light { color: var(--pine); background: #fffdf8; }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: -29px 22px 24px; position: relative; z-index: 4; }
.stat-card { min-height: 111px; padding: 18px 20px; border: 1px solid rgba(220,225,214,.9); border-radius: 16px; background: rgba(255,253,248,.96); box-shadow: 0 8px 18px rgba(18,63,70,.08); }
.stat-card span, .stat-card small { display: block; color: var(--ink-soft); font-size: 12px; }
.stat-card strong { display: block; margin: 2px 0; font-family: "DM Mono", monospace; font-size: 25px; letter-spacing: -.06em; color: var(--pine); }

.workbench { display: grid; grid-template-columns: .9fr 1.4fr; gap: 18px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 7px 20px rgba(18,63,70,.045); }
.families-panel, .expenses-panel { min-height: 320px; padding: 22px; }
.panel-heading, .settlement-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.expense-create-actions { display: flex; gap: 8px; align-items: center; }.ai-thumbnails { display: flex; gap: 10px; overflow-x: auto; }.ai-thumbnails img { width: 88px; height: 88px; object-fit: cover; border-radius: 12px; }.ai-warning { color: #854d0e; background: #fef3c7; border-radius: 8px; padding: 10px 12px; }
.section-kicker { color: #8c9d8e; font-size: 10px; }
.panel h2, .modal h2 { font-size: 21px; letter-spacing: -.04em; }
.icon-button { width: 34px; height: 34px; border: 1px solid #bfd1c7; border-radius: 10px; color: var(--pine); background: #eff5ed; font-size: 23px; line-height: 1; }

.family-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.family-table th { padding: 0 8px 10px; border-bottom: 1px solid var(--line); color: #81908b; text-align: right; font-family: "DM Mono", monospace; font-size: 10px; font-weight: 400; letter-spacing: .03em; }
.family-table th:first-child, .family-table td:first-child { text-align: left; }
.family-table td { padding: 13px 8px; border-bottom: 1px solid #eef0ea; text-align: right; }
.family-table tr:last-child td { border-bottom: 0; }
.family-name { font-weight: 700; }.people-badge { display: inline-flex; align-items: center; gap: 3px; color: var(--pine); font-family: "DM Mono", monospace; }.people-badge::before { content: "●"; font-size: 7px; color: var(--gold); }
.row-actions { white-space: nowrap; }.edit-button, .delete-button { width: 32px; height: 32px; border: 0; border-radius: 6px; color: #78918a; background: transparent; font-size: 16px; line-height: 1; }.edit-button:hover { color: var(--pine); background: #e9f1eb; }.delete-button:hover { color: var(--red); background: #faece7; }

.expense-list { display: grid; gap: 10px; }.expense-item { display: grid; grid-template-columns: minmax(0, 1fr) auto 52px; gap: 12px; align-items: center; padding: 13px 10px 13px 14px; border: 1px solid #e6eae2; border-radius: 12px; background: #fffefa; }.expense-actions { display: flex; gap: 3px; }
.expense-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 700; }.expense-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }.chip { padding: 2px 6px; border-radius: 5px; color: #557169; background: #edf3eb; font-size: 10px; }.expense-paid { text-align: right; }.expense-paid strong { display: block; color: var(--pine); font-family: "DM Mono", monospace; font-size: 15px; }.expense-paid span { color: #89958d; font-size: 10px; }

.settlement-panel { grid-column: 1 / -1; padding: 25px; background: linear-gradient(135deg, #fffdf8, #f2f6ef); }.settlement-heading { margin-bottom: 17px; }.settlement-note { padding: 6px 9px; border-radius: 20px; color: #497065; background: var(--mint); font-size: 11px; }.balance-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }.balance-card { min-width: 0; padding: 13px; border: 1px solid #dde5dc; border-radius: 11px; background: rgba(255,255,255,.68); }.balance-card span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); font-size: 12px; }.balance-card strong { display: block; margin: 5px 0 2px; font-family: "DM Mono", monospace; font-size: 17px; letter-spacing: -.045em; }.balance-card small { color: #84918b; font-size: 10px; }.balance-card.receive strong { color: #167560; }.balance-card.pay strong { color: var(--coral); }
.transfer-section { margin-top: 19px; padding-top: 16px; border-top: 1px dashed #c9d6c8; }.transfer-header { display: flex; justify-content: space-between; margin-bottom: 10px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }.transfer-header span:last-child { font-family: "DM Mono", monospace; font-weight: 400; }.transfer-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }.transfer-card { display: flex; align-items: center; gap: 8px; padding: 11px 13px; border-radius: 10px; color: #30554d; background: #eaf4e8; font-size: 13px; }.transfer-card .arrow { color: #78a17c; font-size: 17px; }.transfer-card strong { margin-left: auto; color: var(--pine); font-family: "DM Mono", monospace; font-size: 14px; }.settled { display: flex; align-items: center; gap: 8px; padding: 14px; border-radius: 10px; color: #5b756b; background: #edf4ed; font-size: 13px; }.settled::before { content: "✓"; display: grid; width: 20px; height: 20px; place-items: center; border-radius: 50%; color: #fff; background: #6ca577; font-weight: 800; }

.empty-state { display: grid; justify-items: start; padding: 28px 6px 8px; color: var(--ink-soft); }.empty-icon { color: var(--gold); font-size: 22px; }.empty-state p { margin: 5px 0 8px; font-size: 13px; }.text-button { padding: 0; border: 0; color: var(--pine); background: none; font-weight: 700; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.how-it-works { display: flex; align-items: center; gap: 13px; margin: 18px 0 0; padding: 13px 17px; border-left: 3px solid var(--gold); color: #6a7f77; font-size: 12px; }.how-it-works p { margin: 0; }.how-it-works strong { color: var(--pine); }.how-number { display: grid; flex: 0 0 22px; width: 22px; height: 22px; place-items: center; border-radius: 50%; color: #fff; background: var(--pine); font-family: "DM Mono", monospace; }

.modal { width: min(460px, calc(100% - 30px)); padding: 0; border: 0; border-radius: 17px; background: transparent; box-shadow: 0 20px 65px rgba(0,0,0,.28); }.modal::backdrop { background: rgba(15,42,43,.52); backdrop-filter: blur(3px); }.modal-wide { width: min(570px, calc(100% - 30px)); }.modal-card { padding: 25px; background: var(--paper); }.modal-heading { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 20px; }.dialog-close { width: 30px; height: 30px; border: 0; border-radius: 9px; color: #5b7471; background: #edf1eb; font-size: 22px; line-height: 1; }.modal label { display: grid; gap: 6px; margin: 0 0 15px; color: #45655f; font-size: 12px; font-weight: 700; }.modal input, .modal select { width: 100%; min-height: 42px; padding: 0 11px; border: 1px solid #cbd8ce; border-radius: 9px; outline: none; color: var(--ink); background: #fffefa; font-size: 14px; }.modal input[lang="zh-CN"] { ime-mode: active; }.modal input:focus, .modal select:focus { border-color: #5f9585; box-shadow: 0 0 0 3px rgba(95,149,133,.13); }.form-grid { display: grid; grid-template-columns: 1.5fr .8fr; gap: 14px; }.modal fieldset { margin: 2px 0 0; padding: 12px; border: 1px solid #d9e2d8; border-radius: 10px; }.modal legend { padding: 0 5px; color: #45655f; font-size: 12px; font-weight: 700; }.fieldset-help { margin: -2px 0 10px; color: #86938c; font-size: 11px; }.participant-options { display: grid; gap: 8px; }.participant-option { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 9px; border: 1px solid #d5dfd5; border-radius: 8px; color: #48645e; background: #f8faf5; font-size: 12px; }.modal .participant-check { display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0; }.participant-option .participant-check input { width: 15px; min-width: 15px; min-height: 15px; height: 15px; padding: 0; accent-color: var(--pine); }.participant-option small { color: #84938a; }.split-mode-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }.modal .split-mode-option { display: grid; grid-template-columns: 16px 1fr; column-gap: 6px; align-items: center; margin: 0; padding: 8px; border: 1px solid #d5dfd5; border-radius: 8px; color: #48645e; background: #f8faf5; cursor: pointer; }.split-mode-option input { width: 15px; min-height: 15px; height: 15px; margin: 0; padding: 0; accent-color: var(--pine); }.split-mode-option span { font-size: 12px; }.split-mode-option small { grid-column: 2; color: #84938a; font-size: 10px; font-weight: 400; }.modal .attendee-entry { display: none; grid-template-columns: auto 52px; align-items: center; gap: 5px; margin: 0; color: #607971; font-size: 10px; white-space: nowrap; }.participant-option.uses-attendance .attendee-entry { display: grid; }.attendee-entry input { width: 52px; min-height: 30px; height: 30px; padding: 0 6px; font-size: 12px; }.attendee-entry input:disabled { color: #a6b2ac; background: #edf0eb; }.form-error { min-height: 18px; margin: 10px 0 0; color: var(--red); font-size: 12px; }.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 8px; }

@keyframes loading-spin { to { transform: rotate(360deg); } }
.import-replace-notice { padding: 12px; border: 1px solid #e5bdb2; border-radius: 9px; color: #843e36; background: #fff1ec; font-size: 13px; font-weight: 700; }.import-warning { color: var(--red); font-size: 12px; }
@media (max-width: 760px) { .app-shell { width: min(100% - 24px, 560px); margin-top: 12px; }.hero { min-height: 210px; padding: 27px 22px; }.hero-actions { position: relative; top: auto; right: auto; flex-wrap: wrap; margin-top: 20px; }.hero-art { right: -66px; opacity: .55; }.stats { grid-template-columns: 1fr; gap: 8px; margin: -18px 10px 18px; }.stat-card { min-height: auto; padding: 13px 16px; }.stat-card small { display: none; }.workbench { grid-template-columns: 1fr; gap: 12px; }.families-panel, .expenses-panel { min-height: auto; padding: 19px; }.balance-summary { grid-template-columns: repeat(2, 1fr); }.transfer-list { grid-template-columns: 1fr; }.settlement-panel { padding: 20px; }.family-table th:nth-child(3), .family-table td:nth-child(3), .family-table th:nth-child(4), .family-table td:nth-child(4) { display: none; }.edit-button, .delete-button { width: 44px; height: 44px; }.icon-button, .button { min-height: 44px; }.modal input, .modal select { min-height: 44px; font-size: 16px; }.page-error { align-items: flex-start; } }
@media (max-width: 400px) { .hero h1 { font-size: 31px; }.hero-actions { gap: 6px; }.button { padding: 0 10px; }.form-grid { grid-template-columns: 1fr; gap: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
