/* ==========================================================================
   日常账本 · 样式
   暖纸底色 + 墨色文字 + 朱砂/黛绿/赭石三色语义
   ========================================================================== */

:root {
  --bg: #F5F2EB;
  --bg-tint: #EFEAE0;
  --surface: #FFFFFF;
  --surface-soft: #FBF9F4;
  --ink: #23211E;
  --ink-2: #55504A;
  --ink-3: #8C8579;
  --ink-4: #A79E90;
  --line: #E9E3D8;
  --line-soft: #F1EBE1;
  --line-strong: #D5CBBB;

  --expense: #BF6540;
  --income: #4A7C59;
  --refund: #A9822F;

  --danger: #B94A3C;

  --shadow-sm: 0 1px 2px rgba(35, 33, 30, .05);
  --shadow-md: 0 1px 2px rgba(35, 33, 30, .04), 0 18px 40px -26px rgba(35, 33, 30, .35);
  --shadow-lg: 0 24px 60px -28px rgba(35, 33, 30, .40);

  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 9px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --font-serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "Iowan Old Style",
    Georgia, "Times New Roman", serif;

  --ease: cubic-bezier(.2, .7, .3, 1);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 620px at 12% -12%, #FDFBF6 0%, rgba(253, 251, 246, 0) 62%),
    radial-gradient(900px 520px at 92% 4%, #F7F1E6 0%, rgba(247, 241, 230, 0) 58%),
    radial-gradient(700px 700px at 50% 108%, #F1EDE3 0%, rgba(241, 237, 227, 0) 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: .01em; }
p { margin: 0; }
button { font-family: inherit; }
code { font-size: .92em; }

/* ---------------------------------------------------------------- 品牌 */

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(160deg, #33302B, #1F1D1A);
  color: #F7F3EA;
  font-family: var(--font-serif);
  font-size: 19px;
  letter-spacing: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 6px 14px -8px rgba(35, 33, 30, .7);
}

.brand-mark--lg { width: 52px; height: 52px; border-radius: 15px; font-size: 24px; margin: 0 auto 18px; }

.brand-text h1 { font-family: var(--font-serif); font-size: 19px; letter-spacing: .04em; }
.brand-text p {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .22em;
  color: var(--ink-4);
  margin-top: 1px;
}

/* ---------------------------------------------------------------- 布局 */

.shell {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 28px 72px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.topbar-tools { display: flex; align-items: center; gap: 10px; }

.month-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: rgba(255, 255, 255, .7);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(6px);
}

.month-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.month-btn:hover { background: var(--bg-tint); color: var(--ink); }
.month-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.month-label {
  min-width: 108px;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 14px;
  letter-spacing: .05em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .7);
  color: var(--ink-3);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: color .16s var(--ease), border-color .16s var(--ease), transform .16s var(--ease);
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-btn:active { transform: scale(.96); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 20px;
}

.stat { padding: 20px 22px 18px; position: relative; }
.stat + .stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20px;
  bottom: 20px;
  width: 1px;
  background: var(--line-soft);
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  letter-spacing: .12em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.stat-label i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .55; }
.stat--expense .stat-label i { background: var(--expense); opacity: .8; }
.stat--income .stat-label i { background: var(--income); opacity: .8; }
.stat--today .stat-label i { background: var(--expense); opacity: .45; }
.stat--balance .stat-label i { background: var(--ink-4); opacity: 1; }

.stat-value {
  margin-top: 8px;
  font-family: var(--font-serif);
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -.005em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}
.stat-value .cur { font-size: 15px; color: var(--ink-4); margin-right: 2px; }
.stat-value .dec { font-size: 16px; color: var(--ink-3); }

.stat--expense .stat-value { color: var(--expense); }
.stat--income .stat-value { color: var(--income); }
.stat--balance .stat-value { color: var(--ink); }
.stat--balance.is-negative .stat-value { color: var(--danger); }
.stat--today .stat-value { color: var(--ink-2); font-size: 22px; }

.stat-meta { margin-top: 4px; font-size: 11.5px; color: var(--ink-4); min-height: 17px; }

.layout {
  display: grid;
  grid-template-columns: 368px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.col-form { position: sticky; top: 24px; }
.col-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
}

/* ---------------------------------------------------------------- 记一笔 */

.entry { padding: 20px 20px 22px; }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.card-title { font-family: var(--font-serif); font-size: 16px; letter-spacing: .06em; }
.card-hint { font-size: 11px; color: var(--ink-4); letter-spacing: .02em; }

.segmented {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 6px;
}

.seg-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc((100% - 8px) / 3);
  height: calc(100% - 8px);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(35, 33, 30, .10), 0 0 0 1px rgba(35, 33, 30, .03);
  transition: transform .26s var(--ease), background-color .26s var(--ease);
  pointer-events: none;
}

.segmented[data-type="income"] .seg-thumb { transform: translateX(100%); background: #F2F7F2; }
.segmented[data-type="refund"] .seg-thumb { transform: translateX(200%); background: #FBF5E9; }

.segmented button {
  position: relative;
  z-index: 1;
  padding: 8px 0;
  border: 0;
  background: transparent;
  font-size: 13px;
  letter-spacing: .08em;
  color: var(--ink-3);
  cursor: pointer;
  border-radius: 9px;
  transition: color .18s var(--ease);
}
.segmented button[aria-selected="true"] { font-weight: 600; }
.segmented button[data-type="expense"][aria-selected="true"] { color: var(--expense); }
.segmented button[data-type="income"][aria-selected="true"] { color: var(--income); }
.segmented button[data-type="refund"][aria-selected="true"] { color: var(--refund); }

.entry { --type-color: var(--expense); }
.entry[data-type="income"] { --type-color: var(--income); }
.entry[data-type="refund"] { --type-color: var(--refund); }

.amount-field {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 18px 2px 12px;
  border-bottom: 1.5px solid var(--line);
  transition: border-color .2s var(--ease);
}
.amount-field:focus-within { border-color: var(--type-color); }
.amount-field.is-error { border-color: var(--danger); animation: shake .34s var(--ease); }

.amount-cur {
  font-family: var(--font-serif);
  font-size: 21px;
  color: var(--ink-4);
  transition: color .2s var(--ease);
}
.amount-field:focus-within .amount-cur { color: var(--type-color); }

#amount {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--font-serif);
  font-size: 40px;
  line-height: 1.15;
  letter-spacing: -.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
#amount::placeholder { color: #D5CDBF; }

.block { margin-top: 18px; }
.block[hidden] { display: none; }

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.block-title { font-size: 11.5px; letter-spacing: .14em; color: var(--ink-3); }
.block-note { font-size: 11.5px; color: var(--ink-4); }

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  font-size: 11.5px;
  color: var(--ink-3);
  cursor: pointer;
  letter-spacing: .02em;
  transition: color .16s var(--ease);
}
.link-btn:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color .16s var(--ease), background .16s var(--ease), color .16s var(--ease), transform .12s var(--ease);
}
.chip:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.chip:active { transform: scale(.97); }
.chip .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .8; }

.quick-dates { display: flex; gap: 6px; }

.chip-mini {
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 11px;
  color: var(--ink-3);
  cursor: pointer;
  transition: all .16s var(--ease);
}
.chip-mini:hover { border-color: var(--line-strong); color: var(--ink); background: var(--surface-soft); }

.input, .select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-soft);
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  outline: 0;
  transition: border-color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
}
.input::placeholder { color: var(--ink-4); }
.input:focus, .select:focus {
  border-color: var(--ink-4);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(140, 133, 121, .10);
}
.input[type="date"] { appearance: none; min-height: 39px; }
.input[type="date"]::-webkit-calendar-picker-indicator { opacity: .45; cursor: pointer; }

.select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238C8579' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
}

.entry-actions { display: flex; gap: 8px; margin-top: 22px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #fff;
  font-size: 13px;
  letter-spacing: .04em;
  color: var(--ink);
  cursor: pointer;
  transition: transform .14s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease), opacity .18s var(--ease);
}
.btn:hover { background: var(--surface-soft); }
.btn:active { transform: translateY(1px); }
.btn--block { flex: 1; }
.btn--primary {
  border-color: #26231F;
  background: linear-gradient(170deg, #322E29, #211F1B);
  color: #F8F4EB;
  box-shadow: 0 10px 20px -14px rgba(35, 33, 30, .9), inset 0 1px 0 rgba(255, 255, 255, .10);
}
.btn--primary:hover { background: linear-gradient(170deg, #3B3630, #26231F); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--ink-3); }
.btn--ghost:hover { background: var(--bg-tint); color: var(--ink); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 12px; border-radius: 9px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------------------------------------------------------------- 概览 */

.overview { padding: 20px 22px 18px; }

.overview-grid {
  display: grid;
  grid-template-columns: 186px minmax(0, 1fr);
  gap: 26px;
  align-items: center;
}

.donut-wrap { position: relative; display: grid; place-items: center; }
.donut { width: 168px; height: 168px; transform: rotate(-90deg); overflow: visible; }
.donut circle { fill: none; transition: stroke-dasharray .5s var(--ease), stroke-dashoffset .5s var(--ease); }
.donut .seg { stroke-linecap: butt; }
.donut .track { stroke: var(--line-soft); }

.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 2px;
}
.donut-center .k { font-size: 10.5px; letter-spacing: .16em; color: var(--ink-4); text-transform: uppercase; }
.donut-center .v {
  font-family: var(--font-serif);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}
.donut-center .v small { font-size: 13px; color: var(--ink-4); }

.rank { display: flex; flex-direction: column; gap: 11px; }

.rank-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) 88px;
  gap: 12px;
  align-items: center;
  font-size: 12.5px;
}
.rank-name { display: flex; align-items: center; gap: 7px; color: var(--ink-2); white-space: nowrap; }
.rank-name i { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.rank-bar { height: 6px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.rank-bar span { display: block; height: 100%; border-radius: 99px; transition: width .5s var(--ease); }
.rank-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-size: 12.5px;
}
.rank-val em { font-style: normal; color: var(--ink-4); font-size: 11px; margin-left: 5px; }

.empty-note {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 28px 10px;
  color: var(--ink-4);
  font-size: 12.5px;
  text-align: center;
}
.empty-note svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.2; opacity: .8; }

/* ---------------------------------------------------------------- 流水 */

.ledger { padding: 0; overflow: hidden; }

.ledger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px 14px;
  flex-wrap: wrap;
}

.seg-tabs { display: flex; gap: 4px; padding: 3px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; }
.seg-tabs button {
  padding: 5px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 12px;
  color: var(--ink-3);
  cursor: pointer;
  transition: all .16s var(--ease);
}
.seg-tabs button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

.filters { display: flex; gap: 8px; align-items: center; }
.filters .select { width: auto; min-width: 92px; padding: 6px 30px 6px 10px; font-size: 12px; border-radius: 9px; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px; fill: none; stroke: var(--ink-4); stroke-width: 1.8; stroke-linecap: round; }
.search input {
  width: 148px;
  padding: 6px 10px 6px 29px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  font-family: inherit;
  font-size: 12px;
  color: var(--ink);
  outline: 0;
  transition: all .18s var(--ease);
}
.search input::placeholder { color: var(--ink-4); }
.search input:focus { background: #fff; border-color: var(--ink-4); width: 176px; }

.day { border-top: 1px solid var(--line-soft); }

.day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 22px 7px;
  background: linear-gradient(to bottom, rgba(251, 249, 244, .7), rgba(255, 255, 255, 0));
}
.day-date { display: flex; align-items: baseline; gap: 8px; }
.day-date b { font-family: var(--font-serif); font-size: 13.5px; font-weight: 600; letter-spacing: .03em; }
.day-date span { font-size: 11px; color: var(--ink-4); }
.day-sum { display: flex; gap: 10px; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--ink-4); }
.day-sum .out { color: rgba(191, 101, 64, .85); }
.day-sum .in { color: rgba(74, 124, 89, .85); }
.day-sum .back { color: rgba(169, 130, 47, .9); }

.tx {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 9px 22px;
  transition: background .15s var(--ease);
}
.tx:hover { background: var(--surface-soft); }

.tx-badge {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 12px;
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: 0;
  flex: none;
}

.tx-main { min-width: 0; }
.tx-note {
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tx-note.is-muted { color: var(--ink-3); }
.tx-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-4);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tx-tag {
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 10px;
  line-height: 15px;
  color: var(--ink-3);
}

.tx-amount {
  font-family: var(--font-serif);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
  white-space: nowrap;
}
.tx-amount.is-expense { color: var(--expense); }
.tx-amount.is-income { color: var(--income); }
.tx-amount.is-refund { color: var(--refund); }

.tx-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.tx:hover .tx-actions, .tx:focus-within .tx-actions { opacity: 1; transform: none; }
.tx-actions button {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-4);
  cursor: pointer;
  transition: all .15s var(--ease);
}
.tx-actions button:hover { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.tx-actions button[data-act="del"]:hover { color: var(--danger); }
.tx-actions svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.ledger-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--ink-4);
}

/* ---------------------------------------------------------------- 页脚 */

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--ink-4);
  letter-spacing: .02em;
}
.foot code { font-family: "SFMono-Regular", Consolas, monospace; font-size: 10.5px; color: var(--ink-3); }

/* ---------------------------------------------------------------- 登录 */

.auth {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
}

.auth-card {
  width: 100%;
  max-width: 344px;
  padding: 34px 30px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: rise .5s var(--ease) both;
}

.auth-title { font-family: var(--font-serif); font-size: 21px; letter-spacing: .1em; }
.auth-sub { margin-top: 5px; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-4); }

.field { display: block; margin-top: 26px; text-align: left; }
.field-label { display: block; font-size: 11.5px; letter-spacing: .1em; color: var(--ink-3); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  font-family: inherit;
  font-size: 14px;
  letter-spacing: .06em;
  color: var(--ink);
  outline: 0;
  transition: all .18s var(--ease);
}
.field input:focus { background: #fff; border-color: var(--ink-4); box-shadow: 0 0 0 3px rgba(140, 133, 121, .1); }

.auth .btn { margin-top: 16px; }
.auth .btn--block { width: 100%; }
.auth-error { margin-top: 10px; font-size: 12px; color: var(--danger); }
.auth-foot { margin-top: 18px; font-size: 10.5px; color: var(--ink-4); letter-spacing: .04em; }

/* ---------------------------------------------------------------- 弹窗 */

.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: 84vh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.dialog::backdrop { background: rgba(35, 33, 30, .32); backdrop-filter: blur(3px); }
.dialog[open] { animation: rise .3s var(--ease) both; }

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.dialog-head h2 { font-family: var(--font-serif); font-size: 16px; letter-spacing: .08em; }
.dialog-body { padding: 6px 20px 22px; max-height: calc(84vh - 60px); overflow: auto; }

.dialog-section { padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.dialog-section:last-child { border-bottom: 0; }
.dialog-section h3 { font-size: 12.5px; letter-spacing: .1em; color: var(--ink-2); margin-bottom: 4px; }
.dialog-desc { font-size: 11.5px; color: var(--ink-4); margin-bottom: 12px; }

.cat-manage { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.cat-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.cat-line i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.cat-line .kind { margin-left: auto; font-size: 10.5px; color: var(--ink-4); letter-spacing: .06em; }
.cat-line button {
  width: 22px; height: 22px; display: grid; place-items: center;
  border: 0; border-radius: 6px; background: transparent; color: var(--ink-4); cursor: pointer;
}
.cat-line button:hover { background: var(--bg-tint); color: var(--danger); }
.cat-line svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.cat-add { display: grid; grid-template-columns: 108px minmax(0, 1fr) auto; gap: 8px; }
.input--sm, .select--sm { padding: 7px 10px; font-size: 12px; border-radius: 8px; }
.select--sm { padding-right: 28px; }

.row-btns { display: flex; gap: 8px; }
.pw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.dialog-msg { margin-top: 8px; font-size: 11.5px; color: var(--income); }
.dialog-msg.is-error { color: var(--danger); }

/* ---------------------------------------------------------------- 提示 */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 90;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #26231F;
  color: #F6F1E7;
  font-size: 12.5px;
  letter-spacing: .02em;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn .3s var(--ease) both;
}
.toast.is-out { animation: toastOut .25s var(--ease) forwards; }
.toast b { font-variant-numeric: tabular-nums; }
.toast button {
  border: 0;
  background: none;
  padding: 0 0 0 4px;
  color: #E2C99B;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ---------------------------------------------------------------- 响应式 */

@media (max-width: 1040px) {
  .layout { grid-template-columns: 330px minmax(0, 1fr); }
  .overview-grid { grid-template-columns: 150px minmax(0, 1fr); gap: 18px; }
  .donut { width: 146px; height: 146px; }
  .rank-row { grid-template-columns: 60px minmax(0, 1fr) 78px; }
}

@media (max-width: 880px) {
  .shell { padding: 22px 16px 56px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .col-form { position: static; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3)::before { display: none; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line-soft); }
  .stat { padding: 16px 18px; }
  .stat-value { font-size: 22px; }
  .stat--today .stat-value { font-size: 20px; }
  .topbar { margin-bottom: 18px; }
  .ledger-head { padding: 16px 16px 12px; }
  .tx { padding: 9px 16px; }
  .day-head { padding: 12px 16px 6px; }
  .ledger-foot { padding: 12px 16px; }
  .entry { padding: 18px 16px 20px; }
  .overview { padding: 18px 16px 16px; }
  .filters { width: 100%; }
  .search { flex: 1; }
  .search input, .search input:focus { width: 100%; }
  .tx-actions { opacity: 1; transform: none; }
}

@media (max-width: 520px) {
  .card-hint { display: none; }
  .brand-text h1 { font-size: 17px; }
  .brand-text p { display: none; }
  .month-label { min-width: 92px; font-size: 13px; }
  .overview-grid { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 14px; }
  .rank { width: 100%; }
  .seg-tabs { flex: 1; }
  .seg-tabs button { flex: 1; }
  .tx { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; }
  .tx-actions { grid-column: 3; grid-row: 1; }
  .tx-amount { grid-column: 3; grid-row: 2; text-align: right; }
  .tx { grid-template-rows: auto auto; row-gap: 0; }
  .pw-grid, .cat-add { grid-template-columns: 1fr; }
  .cat-add .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
