/* 閽卞寘淇″皝 路 鍏ㄧ珯鏍峰紡
   璁捐鍙橀噺闆嗕腑鍦?:root锛屾闈晶杈规爮 + 绉诲姩搴曢儴鏍囩涓ゅ甯冨眬 */

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #0f172a;
  --sub: #475569;
  --muted: #94a3b8;
  --line: #e6eaf2;
  --radius: 16px;
  --accent: #22c55e;
  --accent-dark: #16a34a;
  --accent-soft: #dcfce7;
  --warn: #f59e0b;
  --warn-soft: #fef3c7;
  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --ok: #22c55e;
  --info: #3b82f6;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04),
    0 8px 24px rgba(15, 23, 42, 0.06);
  --font: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

strong,
.hero-amount,
.list-amount,
.summary-item strong,
.money-input input {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
}

/* ---------- 鎸夐挳 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  transition: background 0.18s ease, border-color 0.18s ease,
    transform 0.18s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--sub);
}

.btn-ghost:hover {
  border-color: #cbd5e1;
}

.btn-danger-ghost {
  background: #fff;
  border-color: #fecaca;
  color: var(--danger);
}

.btn-sm {
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.btn-grow {
  flex: 1;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--sub);
  font-size: 18px;
  line-height: 1;
}

.link-btn {
  border: none;
  background: none;
  color: var(--accent-dark);
  font-weight: 600;
  padding: 4px 0;
}

/* ---------- 琛ㄥ崟 ---------- */

.field {
  display: block;
  margin-bottom: 16px;
}

.field > span {
  display: block;
  margin-bottom: 6px;
  color: var(--sub);
  font-size: 13px;
  font-weight: 600;
}

.field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  outline: none;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16);
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.field-inline > span {
  color: var(--sub);
  font-size: 13px;
  white-space: nowrap;
}

.field-inline input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}

.field-inline input:focus {
  border-color: var(--accent);
}

.input,
.select {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  outline: none;
}

.input:focus,
.select:focus {
  border-color: var(--accent);
}

.input-money {
  width: 120px;
}

.input-day {
  width: 78px;
}

.form-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: #b91c1c;
  font-size: 13px;
}

/* ---------- 寰界珷銆佹爣绛俱€佽繘搴?---------- */

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-ok {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.badge-warn {
  background: var(--warn-soft);
  color: #b45309;
}

.badge-danger {
  background: var(--danger-soft);
  color: #b91c1c;
}

.badge-muted {
  background: #eef2f7;
  color: var(--sub);
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--sub);
  font-size: 12px;
  font-weight: 600;
}

.chip {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--sub);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 12px;
  background: #eef2f7;
}

.seg-btn {
  height: 34px;
  padding: 0 16px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--sub);
  font-size: 13px;
  font-weight: 600;
}

.seg-btn.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.bar {
  height: 7px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.bar-warn .bar-fill {
  background: var(--warn);
}

.bar-over .bar-fill {
  background: var(--danger);
}

/* ---------- 澶栧３甯冨眬 ---------- */

.shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 232px;
  padding: 26px 18px 22px;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}

.brand-mark-lg {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 26px;
}

.brand-text,
.login-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.brand-text strong,
.login-brand-text strong {
  font-size: 16px;
}

.brand-text small,
.login-brand-text small {
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  color: var(--sub);
  font-weight: 600;
}

.nav-item:hover {
  background: #f6f8fc;
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.nav-icon {
  font-size: 17px;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  background: #f6f8fc;
}

.avatar {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  flex: none;
}

.user-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

.user-text strong {
  font-size: 13px;
}

.user-text small {
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main {
  margin-left: 232px;
  min-height: 100vh;
}

.view {
  max-width: 1120px;
  margin: 0 auto;
  padding: 26px 32px 88px;
}

.tabbar {
  display: none;
}

.fab {
  position: fixed;
  right: 34px;
  bottom: 34px;
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  box-shadow: 0 12px 26px rgba(34, 197, 94, 0.36);
  z-index: 30;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fab:hover {
  background: var(--accent-dark);
}

.fab.is-hidden {
  display: none;
}

.fab-plus {
  transform: translateY(-1px);
}

.app-root {
  min-height: 100vh;
}

/* ---------- 椤甸潰閫氱敤 ---------- */

.page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.page-head h1 {
  margin-top: 4px;
  font-size: 26px;
  line-height: 1.25;
}

.head-sub {
  margin-top: 6px;
  color: var(--sub);
  font-size: 13px;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-head h2 {
  font-size: 16px;
}

.card-label {
  color: var(--sub);
  font-size: 13px;
  font-weight: 600;
}

.card-hint {
  color: var(--muted);
  font-size: 12px;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-head h2 {
  font-size: 16px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-note {
  color: var(--muted);
  font-size: 12px;
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.summary-item {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-item small {
  color: var(--muted);
  font-size: 12px;
}

.summary-item strong {
  font-size: 18px;
}

.ink-ok {
  color: var(--accent-dark);
}

.ink-danger {
  color: var(--danger);
}

/* ---------- 棣栭〉 ---------- */

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  padding: 22px 28px;
  background: linear-gradient(120deg, #ffffff 0%, #f3fdf7 100%);
}

.hero-eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.hero-label {
  margin-top: 6px;
  color: var(--sub);
  font-size: 14px;
  font-weight: 600;
}

.hero-amount {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 2px;
  font-size: 54px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--ink);
}

.hero-currency {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-dark);
}

.hero-note {
  margin-top: 6px;
  color: var(--sub);
  font-size: 13px;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.hero-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: none;
}

.ring-number {
  font-size: 26px;
  font-weight: 800;
  fill: var(--ink);
}

.ring-label {
  font-size: 11px;
  fill: var(--muted);
}

.hero-ring-caption {
  color: var(--muted);
  font-size: 12px;
}

.alert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #fff;
  border-left: 4px solid var(--info);
  box-shadow: var(--shadow);
}

.alert-danger {
  border-left-color: var(--danger);
  background: #fff7f7;
}

.alert-warn {
  border-left-color: var(--warn);
  background: #fffaf0;
}

.alert-info {
  border-left-color: var(--info);
  background: #f5f9ff;
}

.alert-icon {
  font-size: 18px;
}

.alert-text {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
}

.alert-foot {
  display: flex;
  justify-content: flex-end;
  padding: 0 8px;
}

.alert-close {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 12px;
  padding: 2px 4px;
}

.alert-close:hover {
  color: var(--sub);
}

.env-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.env-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid transparent;
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.env-card:hover {
  transform: translateY(-2px);
}

.env-over {
  border-color: #fecaca;
  background: #fffafa;
}

.env-warn {
  border-color: #fde68a;
  background: #fffdf5;
}

.env-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.env-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: #f2f5fa;
  font-size: 17px;
  flex: none;
}

.env-icon.xl {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  font-size: 26px;
}

.env-name {
  font-weight: 700;
  flex: 1;
}

.env-amount {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 15px;
}

.env-amount strong {
  font-size: 18px;
}

.env-budget {
  color: var(--muted);
  font-size: 12px;
}

.env-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.env-left.is-over {
  color: var(--danger);
  font-weight: 700;
}

.env-percent {
  font-variant-numeric: tabular-nums;
}

/* ---------- 娴佹按鍒楄〃 ---------- */

.list {
  padding: 6px;
  display: flex;
  flex-direction: column;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: none;
  border-radius: 12px;
  background: transparent;
  text-align: left;
}

.list-item:hover {
  background: #f6f8fc;
}

.list-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 18px;
  flex: none;
}

.list-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

.list-main strong {
  font-size: 14px;
}

.list-main small {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.list-amount.is-income {
  color: var(--accent-dark);
}

.list-action {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
}

.tx-time {
  width: 42px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  flex: none;
}

/* ---------- 鏄庣粏椤?---------- */

.month-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
}

.month-label {
  min-width: 54px;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
}

.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.day-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 600;
}

.day-filter button {
  border: none;
  background: none;
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 12px;
}

.day-groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.day-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 4px 8px;
}

.day-date {
  font-weight: 700;
}

.day-week {
  color: var(--muted);
  font-size: 12px;
}

.day-total {
  margin-left: auto;
  color: var(--sub);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ---------- 棰勭畻椤?---------- */

.budget-total {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.budget-total-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.money-input {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.money-input > span {
  color: var(--muted);
  font-weight: 600;
}

.money-input input {
  width: 116px;
  border: none;
  outline: none;
  text-align: right;
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.money-input-lg {
  height: 56px;
  padding: 0 18px;
}

.money-input-lg input {
  width: 168px;
  font-size: 24px;
}

.money-input input.is-invalid {
  color: var(--danger);
}

.budget-alloc {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.budget-alloc div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.budget-alloc span {
  color: var(--muted);
  font-size: 12px;
}

.budget-alloc strong {
  font-size: 16px;
}

.check-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.check-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.18s ease;
}

.check-bar.is-over .check-fill {
  background: var(--danger);
}

.budget-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
}

.budget-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 12px;
  border-radius: 12px;
}

.budget-row:hover {
  background: #f8fafc;
}

.budget-name {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.budget-name strong {
  display: flex;
  align-items: center;
  gap: 8px;
}

.budget-name small {
  color: var(--muted);
  font-size: 12px;
}

.budget-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
}

.validate-text {
  font-size: 13px;
  color: var(--muted);
}

.validate-text.is-ok {
  color: var(--accent-dark);
}

.validate-text.is-danger {
  color: var(--danger);
  font-weight: 600;
}

/* ---------- 缁熻椤?---------- */

.chart-card {
  padding-bottom: 14px;
}

.chart-wrap {
  width: 100%;
  overflow: hidden;
}

.chart {
  width: 100%;
  height: auto;
  display: block;
}

.chart-grid {
  stroke: #eef2f7;
  stroke-width: 1;
}

.chart-axis,
.chart-label {
  fill: var(--muted);
  font-size: 11px;
}

.chart-value {
  fill: var(--sub);
  font-size: 11px;
  font-weight: 600;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  padding-left: 8px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--sub);
  font-size: 12px;
}

.legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.compare-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.compare-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
  border-radius: 14px;
  background: #f8fafc;
}

.compare-cell small {
  color: var(--muted);
  font-size: 12px;
}

.compare-cell strong {
  font-size: 22px;
}

.compare-cell span {
  color: var(--muted);
  font-size: 12px;
}

.compare-note {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sub);
}

.compare-note.is-up {
  color: #b91c1c;
}

.compare-note.is-down {
  color: var(--accent-dark);
}

.change-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.change-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.change-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--sub);
}

.change-name i {
  width: 8px;
  height: 8px;
  border-radius: 3px;
}

.change-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.change-value.is-up {
  color: #b91c1c;
}

.change-value.is-down {
  color: var(--accent-dark);
}

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rank-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rank-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.rank-name {
  font-weight: 600;
}

.rank-value {
  color: var(--sub);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.rank-bar {
  height: 8px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.rank-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
}

/* ---------- 鏃ュ巻椤?---------- */

.calendar-card {
  padding: 18px 20px 22px;
}

.cal-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.cal-week span {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.cal-blank {
  min-height: 66px;
}

.cal-cell {
  min-height: 66px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.cal-cell:hover {
  border-color: #cbd5e1;
}

.cal-day {
  color: var(--sub);
  font-size: 12px;
  font-weight: 700;
}

.cal-amount {
  color: var(--sub);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cal-cell.has-amount {
  background: #f2fbf6;
}

.cal-cell.has-amount .cal-amount {
  color: var(--accent-dark);
}

.cal-cell.is-income {
  background: #f5f9ff;
}

.cal-cell.is-big {
  background: #fff5f5;
  border-color: #fecaca;
}

.cal-cell.is-big .cal-amount {
  color: #b91c1c;
}

.cal-cell.is-today {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.cal-cell.is-today .cal-day {
  color: var(--accent-dark);
}

/* ---------- 璁剧疆椤?---------- */

.settings-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.setting-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.setting-label strong {
  font-size: 14px;
}

.setting-label small {
  color: var(--muted);
  font-size: 12px;
}

.setting-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 16px;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 50px;
  height: 30px;
  flex: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.switch-track {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.18s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.24);
  transition: transform 0.18s ease;
}

.switch input:checked + .switch-track {
  background: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(20px);
}

.recurring-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.recurring-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
}

.recurring-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.recurring-main small {
  color: var(--muted);
  font-size: 12px;
}

.recurring-side {
  display: flex;
  align-items: center;
  gap: 10px;
}

.recurring-add {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.about-grid div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.about-grid small {
  color: var(--muted);
  font-size: 12px;
}

.about-grid strong {
  font-size: 14px;
}

/* ---------- 鎶藉眽 ---------- */

body.sheet-open {
  overflow: hidden;
}

.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.32);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 24px 24px 0;
  animation: fade-in 0.16s ease;
}

.sheet {
  width: 100%;
  max-width: 760px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.18);
  animation: sheet-up 0.2s ease;
}

.sheet[data-sheet-key="sheet-budget"] {
  max-width: 540px;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--line);
}

.sheet-title h2 {
  font-size: 18px;
}

.sheet-title p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.sheet-body {
  padding: 18px 24px;
  overflow-y: auto;
}

.sheet-foot {
  padding: 14px 24px 20px;
  border-top: 1px solid var(--line);
}

.sheet-foot-row {
  display: flex;
  gap: 12px;
}

.record-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 20px;
}

.record-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.record-amount {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 14px;
  background: #f8fafc;
}

.record-yen {
  color: var(--muted);
  font-size: 20px;
  font-weight: 700;
}

.record-value {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.record-value.is-empty {
  color: var(--muted);
}

.record-kinds {
  display: inline-flex;
  padding: 3px;
  border-radius: 12px;
  background: #eef2f7;
  align-self: flex-start;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cat-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 76px;
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--sub);
}

.cat-btn:hover {
  border-color: #cbd5e1;
}

.cat-btn.is-selected {
  border-color: var(--cat-color, var(--accent));
  background: #f4fbf7;
  box-shadow: inset 0 0 0 1px var(--cat-color, var(--accent));
  color: var(--ink);
}

.cat-icon {
  font-size: 22px;
  line-height: 1;
}

.cat-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.cat-tag {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 700;
}

.record-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.record-keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.key {
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.key:hover {
  background: #f8fafc;
}

.key:active {
  background: var(--accent-soft);
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--sub);
  font-size: 13px;
}

.check-inline input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.sheet-env-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.sheet-env-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sheet-env-text small {
  color: var(--muted);
  font-size: 12px;
}

.sheet-env-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.sheet-env-stats div {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sheet-env-stats small {
  color: var(--muted);
  font-size: 12px;
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.share-hint {
  margin-top: 12px;
  color: var(--sub);
  font-size: 13px;
}

.sheet-tip {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--warn-soft);
  color: #92400e;
  font-size: 12px;
}

.sheet-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: #b91c1c;
  font-size: 12px;
}

/* ---------- 鎻愮ず銆佺‘璁ゆ銆佺┖鐘舵€?---------- */

.toast-root {
  position: fixed;
  top: 22px;
  left: 0;
  right: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: 480px;
  padding: 12px 18px;
  border-radius: 12px;
  background: #0f172a;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.24);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-warn {
  background: #b45309;
}

.toast-danger {
  background: #b91c1c;
}

.toast-ok {
  background: #14532d;
}

.toast-out {
  opacity: 0;
  transform: translateY(-8px);
}

.confirm-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in 0.16s ease;
}

.confirm {
  width: 100%;
  max-width: 400px;
  padding: 24px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.26);
}

.confirm-title {
  font-size: 17px;
}

.confirm-text {
  margin-top: 8px;
  color: var(--sub);
  font-size: 13px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.empty {
  padding: 40px 20px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
}

.empty-icon {
  font-size: 34px;
}

.empty-title {
  margin-top: 10px;
  font-weight: 700;
}

.empty-text {
  margin: 6px 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.view-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 120px 0;
  color: var(--muted);
  font-size: 13px;
}

.view-loading span {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes sheet-up {
  from {
    transform: translateY(24px);
    opacity: 0.6;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ---------- 鐧诲綍椤?---------- */

.login-root {
  min-height: 100vh;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  background: linear-gradient(135deg, #f0fdf4 0%, #f4f6fb 55%, #eef2ff 100%);
}

.login-brand {
  padding: 64px 8vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.login-brand-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-title {
  font-size: 40px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.login-title span {
  display: block;
}

.login-title .accent {
  color: var(--accent-dark);
}

.login-desc {
  max-width: 460px;
  color: var(--sub);
  font-size: 15px;
}

.login-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 460px;
}

.login-points li {
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--sub);
  font-size: 13px;
}

.login-points b {
  display: inline-block;
  min-width: 76px;
  color: var(--ink);
}

.login-meta {
  color: var(--muted);
  font-size: 12px;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 30px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
}

.login-card h2 {
  font-size: 22px;
}

.login-sub {
  margin: 6px 0 22px;
  color: var(--muted);
  font-size: 13px;
}

.login-hint {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* ---------- 鍝嶅簲寮?---------- */

@media (max-width: 1180px) {
  .env-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1023px) {
  .sidebar {
    display: none;
  }

  .main {
    margin-left: 0;
  }

  .view {
    padding: 24px 20px 104px;
  }

  .tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    background: #fff;
    border-top: 1px solid var(--line);
    padding: 6px 4px 8px;
  }

  .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 0;
    color: var(--muted);
    font-size: 11px;
  }

  .tab-item.active {
    color: var(--accent-dark);
  }

  .tab-icon {
    font-size: 18px;
  }

  .fab {
    right: 20px;
    bottom: 84px;
    width: 54px;
    height: 54px;
  }

  .stats-grid,
  .compare-row {
    grid-template-columns: 1fr;
  }

  .about-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .page-head {
    align-items: flex-start;
  }

  .page-head h1 {
    font-size: 22px;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 22px;
  }

  .hero-side {
    align-self: center;
  }

  .hero-amount {
    font-size: 52px;
  }

  .env-grid {
    grid-template-columns: 1fr;
  }

  .summary-row {
    grid-template-columns: 1fr 1fr;
  }

  .budget-total-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .record-layout {
    grid-template-columns: 1fr;
  }

  .sheet {
    max-height: 94vh;
  }

  .login-page {
    grid-template-columns: 1fr;
  }

  .login-brand {
    padding: 40px 24px 12px;
  }

  .login-title {
    font-size: 28px;
  }

  .login-panel {
    padding: 16px 24px 40px;
  }

  .setting-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
