:root {
  --ink: #17342e;
  --ink-soft: #4d645f;
  --jade: #185f54;
  --jade-deep: #10473f;
  --mint: #dbe9df;
  --mint-soft: #edf4ef;
  --paper: #f3efe3;
  --paper-light: #fbfaf5;
  --gold: #cf9b37;
  --coral: #df6b4f;
  --line: rgba(23, 52, 46, .13);
  --shadow: 0 22px 60px rgba(30, 61, 53, .10);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(207, 155, 55, .35); outline-offset: 2px; }

.app-body, .login-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 88% 8%, rgba(207, 155, 55, .16), transparent 28rem),
    radial-gradient(circle at 10% 80%, rgba(24, 95, 84, .12), transparent 32rem),
    linear-gradient(rgba(23, 52, 46, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 52, 46, .025) 1px, transparent 1px),
    var(--paper);
  background-size: auto, auto, 26px 26px, 26px 26px, auto;
}

.eyebrow { margin: 0 0 6px; color: var(--jade); font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.muted { color: var(--ink-soft); }
.grow { flex: 1; min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 20px 20px 20px 6px; color: #fff; background: var(--jade); font-family: STKaiti, KaiTi, serif; font-size: 34px; box-shadow: 0 15px 35px rgba(24, 95, 84, .25); }
.brand-mark.small { width: 44px; height: 44px; border-radius: 15px 15px 15px 5px; font-size: 24px; box-shadow: none; }

.primary-button, .outline-button, .quiet-button, .text-button, .icon-button { border: 0; border-radius: 14px; transition: transform .18s ease, background .18s ease, color .18s ease; }
.primary-button { padding: 13px 20px; color: white; background: var(--jade); font-weight: 800; box-shadow: 0 10px 25px rgba(24, 95, 84, .20); }
.primary-button:hover { transform: translateY(-2px); background: var(--jade-deep); }
.primary-button.compact { padding: 10px 16px; }
.outline-button { padding: 11px 18px; color: var(--jade); background: transparent; border: 1px solid rgba(24, 95, 84, .35); font-weight: 800; }
.outline-button:hover { background: var(--mint-soft); }
.quiet-button { padding: 10px 14px; color: var(--ink-soft); background: rgba(255,255,255,.45); }
.text-button { padding: 6px 0; color: var(--jade); background: transparent; font-weight: 800; }
.icon-button { width: 38px; height: 38px; background: var(--paper); font-size: 24px; }
.text-link { color: var(--jade); text-decoration: none; font-weight: 700; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; max-width: 1180px; margin: auto; padding: 48px; align-items: center; gap: 80px; }
.login-story h1 { margin: 24px 0; font-family: STKaiti, KaiTi, serif; font-size: clamp(48px, 6vw, 78px); font-weight: 700; line-height: 1.08; letter-spacing: -.04em; }
.login-story > p:not(.eyebrow) { max-width: 560px; color: var(--ink-soft); font-size: 18px; line-height: 1.8; }
.login-proof { display: flex; gap: 10px; margin-top: 28px; flex-wrap: wrap; }
.login-proof span { padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.42); font-size: 13px; font-weight: 700; }
.login-card { padding: 40px; border: 1px solid rgba(255,255,255,.65); border-radius: 32px 32px 32px 10px; background: rgba(251,250,245,.84); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.login-card h2 { margin: 0; font-family: STKaiti, KaiTi, serif; font-size: 38px; }
.login-footnote { margin: 20px 0 0; color: var(--ink-soft); font-size: 12px; text-align: center; }
.form-alert { margin: 20px 0; padding: 12px 14px; border-radius: 12px; color: #8a2d20; background: #fde8e2; }

.stack-form { display: grid; gap: 18px; margin-top: 28px; }
label { display: grid; gap: 8px; color: var(--ink-soft); font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 13px; padding: 12px 13px; color: var(--ink); background: rgba(255,255,255,.72); }
textarea { resize: vertical; }

.app-frame { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 18px; border-right: 1px solid var(--line); background: rgba(244, 241, 230, .86); backdrop-filter: blur(18px); z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; padding: 4px 8px 28px; }
.brand strong, .brand small { display: block; }
.brand small { margin-top: 3px; color: var(--ink-soft); font-size: 11px; }
.side-nav { display: grid; gap: 7px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border: 0; border-radius: 14px; color: var(--ink-soft); background: transparent; font-weight: 700; text-align: left; }
.nav-item span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; color: var(--jade); background: rgba(24,95,84,.08); font-family: STKaiti, KaiTi, serif; font-size: 17px; }
.nav-item.active, .nav-item:hover { color: var(--ink); background: rgba(255,255,255,.65); box-shadow: 0 8px 22px rgba(23,52,46,.06); }
.nav-item.active span { color: white; background: var(--jade); }
.sidebar-footer { margin-top: auto; display: grid; gap: 10px; padding: 10px 8px; }

.main-stage { width: min(1400px, 100%); padding: 0 34px 80px; overflow: hidden; }
.topbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; min-height: 102px; padding: 20px 0; background: linear-gradient(var(--paper) 72%, rgba(243,239,227,0)); }
.topbar h1 { margin: 0; font-family: STKaiti, KaiTi, serif; font-size: 32px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.user-chip { padding: 9px 13px; border-radius: 999px; background: rgba(255,255,255,.55); font-size: 13px; font-weight: 800; }
.view { display: none; animation: rise .42s ease both; }
.view.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.metric-grid { display: grid; grid-template-columns: 1.25fr repeat(3, 1fr); gap: 14px; }
.metric-card { position: relative; min-height: 150px; padding: 22px; border: 1px solid rgba(255,255,255,.6); border-radius: 24px 24px 24px 8px; background: rgba(251,250,245,.74); box-shadow: 0 12px 35px rgba(23,52,46,.07); overflow: hidden; }
.metric-card::after { content: ''; position: absolute; width: 100px; height: 100px; border-radius: 50%; right: -38px; bottom: -48px; background: rgba(207,155,55,.12); }
.metric-card span, .metric-card small { display: block; color: var(--ink-soft); font-size: 13px; }
.metric-card strong { display: block; margin: 18px 0 6px; font-family: STKaiti, KaiTi, serif; font-size: clamp(28px, 3.2vw, 46px); line-height: 1; }
.hero-metric { color: white; background: var(--jade); }
.hero-metric span, .hero-metric small { color: rgba(255,255,255,.72); }
.hero-metric::after { width: 160px; height: 160px; right: -35px; bottom: -78px; background: rgba(255,255,255,.08); }

.settlement-strip { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 16px; padding: 24px 28px; border: 1px solid rgba(207,155,55,.3); border-radius: 20px; background: linear-gradient(110deg, rgba(255,250,230,.9), rgba(235,243,237,.82)); }
.settlement-strip h2 { margin: 0 0 6px; font-size: 22px; }
.settlement-strip p:last-child { margin: 0; color: var(--ink-soft); }

.dashboard-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 16px; margin-top: 16px; }
.panel { border: 1px solid rgba(255,255,255,.65); border-radius: var(--radius); background: rgba(251,250,245,.76); box-shadow: 0 14px 42px rgba(23,52,46,.07); }
.dashboard-grid .panel { padding: 24px; }
.section-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 20px; }
.section-heading h2, .page-intro h2 { margin: 0; font-family: STKaiti, KaiTi, serif; font-size: 28px; }
.asset-group-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.asset-group-cards.wide { margin: 20px 0; grid-template-columns: repeat(6, 1fr); }
.asset-group-card { min-height: 112px; padding: 15px; border: 0; border-radius: 18px 18px 18px 6px; color: var(--ink); background: var(--mint-soft); text-align: left; }
.asset-group-card span, .asset-group-card em { display: block; font-size: 12px; font-style: normal; }
.asset-group-card strong { display: block; margin: 8px 0 5px; font-family: STKaiti, KaiTi, serif; font-size: 30px; }
.asset-group-card strong small { margin-left: 2px; font-size: 13px; }
.asset-group-card:hover { transform: translateY(-2px); }
.tone-1 { background: #f5e8cf; }.tone-2 { background: #e7e4d8; }.tone-3 { background: #e9ddd5; }
.phone-snapshot { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 14px; }
.snapshot-title, .snapshot-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 18px; padding: 10px 4px; }
.snapshot-title { color: var(--ink-soft); font-size: 13px; }
.snapshot-row { border-top: 1px solid rgba(23,52,46,.07); }
.snapshot-row span b, .snapshot-row span small { display: block; }
.snapshot-row span small { color: var(--ink-soft); font-size: 12px; margin-top: 2px; }
.snapshot-row em { min-width: 92px; text-align: right; font-style: normal; font-weight: 800; }

.compact-list { display: grid; }
.compact-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(23,52,46,.08); }
.compact-row:last-child { border-bottom: 0; }
.compact-row strong, .compact-row small { display: block; }
.compact-row small { margin-top: 3px; color: var(--ink-soft); font-size: 11px; }
.mini-icon { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 11px; color: var(--jade); background: var(--mint); font-family: STKaiti, KaiTi, serif; }

.page-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin: 8px 0 20px; }
.page-intro p:last-child { margin: 7px 0 0; color: var(--ink-soft); }
.form-panel { padding: 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 20px; }
.form-status { color: var(--coral); font-size: 13px; font-weight: 700; }
.upload-field { position: relative; padding: 16px; border: 1px dashed rgba(24,95,84,.35); border-radius: 16px; background: var(--mint-soft); }
.upload-field input { padding: 0; border: 0; background: transparent; }
.upload-field span { color: var(--ink-soft); font-weight: 500; }
.check-row { display: flex; align-items: center; gap: 10px; margin: 18px 0; padding: 14px; border-radius: 14px; background: rgba(207,155,55,.10); }
.check-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--jade); }
.asset-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; padding: 18px; margin-bottom: 18px; border-radius: 18px; background: var(--mint-soft); }
.table-panel { margin-top: 18px; padding: 24px; }
.data-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 12px; color: var(--ink-soft); font-size: 12px; text-align: left; border-bottom: 1px solid var(--line); }
td { padding: 13px 12px; border-bottom: 1px solid rgba(23,52,46,.07); font-size: 13px; }
td strong, td small { display: block; }
td small { margin-top: 3px; color: var(--ink-soft); font-size: 11px; }
.money-cell { font-weight: 900; text-align: right; }

.status-pill { display: inline-flex; align-items: center; width: fit-content; padding: 5px 9px; border-radius: 999px; color: #7d5b13; background: #f7e7b9; font-size: 11px; font-weight: 800; white-space: nowrap; }
.status-pill.good, .status-pill.settled { color: #276044; background: #dceede; }
.status-pill.warn, .status-pill.current { color: #8a4b18; background: #f8dfc2; }
.status-pill.danger { color: #8a2d20; background: #fde0d8; }
.status-pill.muted { color: #626762; background: #e6e8e4; }

.filter-row { display: grid; grid-template-columns: 1fr 180px; gap: 12px; margin: 18px 0; }
.asset-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.asset-card { position: relative; min-height: 350px; padding: 20px; border: 1px solid rgba(255,255,255,.65); border-radius: 22px 22px 22px 7px; background: rgba(251,250,245,.78); box-shadow: 0 12px 34px rgba(23,52,46,.07); overflow: hidden; }
.asset-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ink-soft); font-size: 12px; }
.asset-code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 800; }
.asset-glyph { position: absolute; top: 58px; right: 16px; color: rgba(24,95,84,.09); font-family: serif; font-size: 100px; line-height: 1; }
.asset-category { margin: 34px 0 4px; color: var(--jade); font-size: 12px; font-weight: 900; }
.asset-card h3, .account-card h3, .recurring-card h3 { margin: 0; font-size: 20px; }
.asset-card h3 + p, .account-card h3 + p, .recurring-card h3 + p { margin: 5px 0; color: var(--ink-soft); }
dl { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 14px; margin: 24px 0 16px; }
dl div { min-width: 0; }
dt { color: var(--ink-soft); font-size: 11px; }
dd { margin: 3px 0 0; overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 800; }

.warning-banner { display: flex; gap: 14px; margin-bottom: 16px; padding: 15px 18px; border-left: 4px solid var(--gold); border-radius: 8px 16px 16px 8px; background: rgba(255,248,224,.8); }
.warning-banner span { color: var(--ink-soft); }
.account-grid, .recurring-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 18px; }
.account-card { display: flex; gap: 16px; padding: 20px; border: 1px solid rgba(255,255,255,.65); border-radius: 22px 22px 22px 7px; background: rgba(251,250,245,.78); }
.account-avatar { display: grid; place-items: center; flex: 0 0 48px; height: 48px; border-radius: 16px; color: white; background: var(--jade); font-family: STKaiti, KaiTi, serif; font-size: 24px; }
.recurring-card { display: flex; align-items: center; gap: 16px; padding: 18px; border: 1px solid rgba(255,255,255,.65); border-radius: 20px; background: rgba(251,250,245,.78); }
.recurring-date { display: grid; place-items: center; flex: 0 0 54px; height: 58px; border-radius: 15px 15px 15px 5px; color: white; background: var(--jade); }
.recurring-date strong, .recurring-date span { display: block; line-height: 1; }
.recurring-date strong { font-size: 20px; }.recurring-date span { margin-top: 4px; font-size: 10px; }
.empty-state { display: grid; gap: 7px; place-items: center; min-height: 120px; color: var(--ink-soft); text-align: center; }
.empty-state.panel { padding: 30px; }

.edit-dialog { width: min(520px, calc(100% - 28px)); border: 0; border-radius: 26px 26px 26px 8px; padding: 26px; color: var(--ink); background: var(--paper-light); box-shadow: 0 30px 100px rgba(15,40,34,.28); }
.edit-dialog::backdrop { background: rgba(13,35,30,.48); backdrop-filter: blur(4px); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; }
.dialog-head h2 { margin: 0; font-family: STKaiti, KaiTi, serif; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; transform: translateY(18px); opacity: 0; pointer-events: none; padding: 13px 18px; border-radius: 14px; color: white; background: var(--jade); box-shadow: var(--shadow); transition: .22s ease; }
.toast.show { transform: none; opacity: 1; }
.toast[data-kind="error"] { background: #9b3e2d; }
.mobile-nav { display: none; }

@media (max-width: 1080px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .asset-group-cards.wide { grid-template-columns: repeat(3, 1fr); }
  .asset-card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; padding: 24px 18px 40px; gap: 28px; }
  .login-story { padding: 12px 6px 0; }
  .login-story h1 { font-size: 44px; }
  .login-story > p:not(.eyebrow) { font-size: 15px; }
  .login-card { padding: 26px 20px; border-radius: 26px 26px 26px 8px; }
  .app-frame { display: block; }
  .sidebar { display: none; }
  .main-stage { padding: 0 14px 92px; }
  .topbar { min-height: 80px; padding: 12px 2px; }
  .topbar h1 { font-size: 26px; }
  .topbar .user-chip { display: none; }
  .primary-button.compact { padding: 9px 12px; font-size: 13px; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 126px; padding: 17px; border-radius: 20px 20px 20px 7px; }
  .metric-card strong { margin-top: 16px; font-size: 29px; }
  .hero-metric { grid-column: span 2; }
  .settlement-strip { align-items: flex-start; flex-direction: column; padding: 20px; }
  .dashboard-grid .panel, .panel, .form-panel, .table-panel { border-radius: 20px 20px 20px 7px; }
  .dashboard-grid .panel, .form-panel, .table-panel { padding: 18px; }
  .asset-group-cards, .asset-group-cards.wide { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
  .asset-group-card { flex: 0 0 130px; scroll-snap-align: start; }
  .page-intro { align-items: flex-start; flex-direction: column; }
  .form-grid, .asset-fields { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .asset-card-grid, .account-grid, .recurring-grid { grid-template-columns: 1fr; }
  .asset-card { min-height: 330px; }
  .filter-row { grid-template-columns: 1fr 130px; }
  .snapshot-row { gap: 10px; }
  .snapshot-row em { min-width: 80px; }
  .table-panel { margin-left: -14px; margin-right: -14px; border-radius: 0; }
  th, td { white-space: nowrap; }
  .mobile-nav { position: fixed; display: grid; grid-template-columns: repeat(5, 1fr); left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 50; padding: 7px; border: 1px solid rgba(255,255,255,.65); border-radius: 20px; background: rgba(248,246,238,.93); box-shadow: 0 20px 60px rgba(20,45,39,.22); backdrop-filter: blur(18px); }
  .mobile-nav button { display: grid; justify-items: center; gap: 2px; padding: 4px 0; border: 0; color: var(--ink-soft); background: transparent; font-size: 10px; font-weight: 800; }
  .mobile-nav span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; font-family: STKaiti, KaiTi, serif; font-size: 17px; }
  .mobile-nav button.active { color: var(--jade); }
  .mobile-nav button.active span { color: white; background: var(--jade); }
  .toast { left: 14px; right: 14px; bottom: 92px; text-align: center; }
}

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