﻿:root {
  color-scheme: light;
  --bg: #fff7d1;
  --paper: #fffdf4;
  --paper-2: #fff9e8;
  --ink: #211b18;
  --muted: #6d6258;
  --line: #211b18;
  --pink: #ff5c8a;
  --mint: #24d6a3;
  --sky: #58b7ff;
  --sun: #ffd447;
  --lavender: #c9b8ff;
  --danger: #b42318;
  --success: #067647;
  --shadow: 6px 6px 0 var(--ink);
  --soft-shadow: 4px 4px 0 var(--ink);
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(33, 27, 24, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(33, 27, 24, 0.05) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0;
}

.page {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 52px;
}

.page-header,
.upload-panel,
.result-panel,
.records-panel,
.status-panel,
.month-board {
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.page-header,
.upload-panel,
.result-panel,
.records-panel,
.status-panel,
.month-board {
  margin-top: 18px;
  padding: 22px 24px;
}

.page-header,
.upload-panel { margin-top: 0; }

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

h1 {
  font-family: "Arial Rounded MT Bold", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 950;
  line-height: 1.08;
}

h2 {
  font-size: 21px;
  font-weight: 950;
}

h3 { font-size: 18px; font-weight: 950; }
h4 { font-size: 17px; font-weight: 950; }

p {
  margin-top: 9px;
  color: var(--muted);
  line-height: 1.58;
  font-weight: 650;
}

button,
a,
select,
input,
textarea {
  font-family: inherit;
}

button {
  min-height: 42px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 16px;
  box-shadow: var(--soft-shadow);
  cursor: pointer;
  font-weight: 900;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

button:hover,
.back-link:hover,
.record-link:hover { transform: translate(-1px, -1px); }

button:active,
.back-link:active,
.record-link:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--ink);
}

button:disabled { cursor: not-allowed; opacity: 0.58; }

select {
  min-height: 38px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font-weight: 850;
}

option { background: #fff; color: var(--ink); }

.hidden { display: none; }

.mini-tag,
.type-badge,
.category-chip,
.expense-category-pill,
.tag-row span {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0;
}

.mini-tag {
  margin-bottom: 12px;
  background: var(--sky);
  transform: rotate(2deg);
}

.type-badge { background: var(--sky); }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #fff;
  transform: rotate(-0.2deg);
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--mint);
  box-shadow: var(--soft-shadow);
  color: var(--ink);
  font-weight: 950;
  text-decoration: none;
  white-space: nowrap;
}

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

.upload-panel {
  display: grid;
  grid-template-columns: minmax(190px, 0.75fr) minmax(280px, 1.5fr);
  gap: 22px;
  align-items: center;
  background: #fff0fb;
  transform: rotate(0.25deg);
}

.panel-copy { padding-right: 4px; }
.voice-actions { display: grid; gap: 14px; }

.voice-settings {
  display: grid;
  grid-template-columns: auto minmax(130px, 1fr);
  align-items: center;
  gap: 8px 10px;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
}

.voice-settings label {
  font-size: 14px;
  font-weight: 950;
}

.voice-settings select { width: 100%; }

.server-info {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.diagnostics-panel {
  margin-top: 18px;
  padding: 14px 18px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #e8f4f1;
  box-shadow: var(--soft-shadow);
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.5;
}

.diagnostics-panel.warning { background: #fff0b8; }
.diagnostics-panel.error { background: #ffe1e1; color: var(--danger); }

.hold-button {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 142px;
  width: 100%;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--sun);
  color: var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 950;
  touch-action: none;
  user-select: none;
  transform: rotate(-1deg);
}

.hold-button:hover { background: #ffe66b; }

.hold-button.recording {
  background: var(--pink);
  color: #fff;
  animation: wobble 650ms infinite alternate ease-in-out;
}

.record-timer {
  color: inherit;
  font-size: 14px;
  font-weight: 900;
}

.status-panel {
  background: #fff;
  color: var(--muted);
  font-weight: 850;
}
.status-panel.error { color: var(--danger); background: #fff0ed; }
.status-panel.success { color: var(--success); background: #ebfff6; }

.result-panel { background: #effdf7; transform: rotate(-0.2deg); }
.records-panel { background: #f1f8ff; transform: rotate(0.15deg); }
.record-page .records-panel { transform: none; }

.summary-list {
  display: grid;
  gap: 14px;
  margin: 0;
}

dt {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 950;
}

dd { margin: 0; line-height: 1.7; }

pre {
  margin: 0;
  padding: 13px;
  overflow: auto;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.6;
}

.record-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.record-link {
  display: grid;
  place-items: center;
  min-height: 72px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--soft-shadow);
  color: var(--ink);
  font-size: 20px;
  font-weight: 950;
  text-decoration: none;
}

.home-page .record-links .diary-link { background: #effdf7; transform: rotate(-1deg); }
.home-page .record-links .expense-link { background: #fff2c7; transform: rotate(0.8deg); }
.home-page .record-links .schedule-link { background: #eef6ff; transform: rotate(-0.4deg); }
.record-link.active { background: var(--pink); color: #fff; }

.records-list {
  display: grid;
  gap: 12px;
}

.record-item,
.timeline-card,
.expense-card {
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 14px;
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.record-item:nth-child(2n),
.expense-card:nth-child(2n) { transform: rotate(0.35deg); }
.record-item:nth-child(2n + 1),
.expense-card:nth-child(2n + 1) { transform: rotate(-0.25deg); }

.record-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-weight: 950;
}

.record-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.record-body {
  margin-top: 8px;
  color: #374151;
  line-height: 1.65;
  font-weight: 600;
}

.record-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 14px;
}

.record-actions button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
  box-shadow: 1px 1px 0 currentColor;
}

.delete-record {
  min-height: 34px;
  padding: 0 12px;
  background: #fff;
  color: #b42318;
  border-color: #b42318;
  box-shadow: 2px 2px 0 #b42318;
}

.schedule-actions {
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.schedule-actions button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
  box-shadow: 1px 1px 0 currentColor;
}

.schedule-done {
  background: #dff7e9;
  color: #16734b;
  border-color: #16734b;
}

.schedule-done-label {
  color: #16734b;
  font-size: 12px;
  font-weight: 900;
}

.schedule-edit {
  background: #eef6ff;
  color: #285b8f;
  border-color: #285b8f;
}

.schedule-edit-dialog {
  width: min(560px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 20px;
}

.schedule-edit-dialog::backdrop { background: rgb(36 29 25 / 35%); }
.schedule-edit-dialog form { display: grid; gap: 14px; }
.schedule-edit-dialog .section-head { margin-bottom: 2px; }
.schedule-edit-dialog label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 950; }
.schedule-edit-dialog input,
.schedule-edit-dialog textarea,
.schedule-edit-dialog select {
  width: 100%;
  box-sizing: border-box;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  font: inherit;
}
.schedule-edit-dialog button { min-height: 36px; padding: 0 13px; }
.schedule-edit-actions { display: flex; justify-content: flex-end; gap: 8px; }

.edit-expense {
  background: #fff2c7;
  color: #8a5a00;
  border-color: #8a5a00;
  box-shadow: 2px 2px 0 #8a5a00;
}

.diary-edit {
  background: #effdf7;
  color: #16734b;
  border-color: #16734b;
  box-shadow: 1px 1px 0 #16734b;
}

.empty {
  color: var(--muted);
  padding: 18px 0;
  font-weight: 850;
}

.diary-page { --page-accent: var(--mint); }
.expense-page { --page-accent: var(--sun); }
.schedule-page { --page-accent: var(--sky); }

.diary-page .page-header,
.diary-board,
.month-board { background: #effdf7; }

.expense-page .page-header,
.expense-board,
.expense-month-board { background: #fff2c7; }

.expense-month-actions,
.expense-filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.expense-month-actions select,
.expense-filter-row select {
  min-height: 38px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
  font-weight: 850;
}

.expense-month-actions button,
.expense-filter-row button {
  min-height: 38px;
  padding: 0 10px;
}

.expense-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.expense-stat-card {
  display: grid;
  gap: 5px;
  min-height: 72px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #fffdf2;
  box-shadow: 3px 3px 0 var(--ink);
  padding: 10px 12px;
}

.expense-stat-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.expense-stat-card strong {
  font-size: 20px;
  line-height: 1.1;
}

.expense-stat-card small {
  font-size: 12px;
}

.expense-analysis {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin: 8px 0 16px;
  padding: 14px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #fffdf2;
  box-shadow: var(--soft-shadow);
}

.expense-pie-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 164px;
  height: 164px;
  margin: auto;
}

.expense-pie-chart {
  position: relative;
  width: 164px;
  height: 164px;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.expense-pie-chart::after {
  content: "";
  position: absolute;
  width: 80px;
  height: 80px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #fffdf2;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.expense-pie-center {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  text-align: center;
}

.expense-pie-center strong { font-size: 16px; }
.expense-pie-center span { color: var(--muted); font-size: 11px; font-weight: 850; }

.expense-category-legend {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.expense-legend-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto 40px;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border: 1px solid var(--ink);
  border-radius: 3px;
}

.legend-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-percent { color: var(--muted); text-align: right; font-weight: 850; }

.expense-filter-row {
  margin-bottom: 14px;
}

.expense-filter-row label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 950;
}

.schedule-page .page-header,
.schedule-board { background: #eef6ff; }

.record-page .mini-tag { background: var(--page-accent); }

.month-board { transform: rotate(0.15deg); }

.week-row,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.week-row {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 950;
  text-align: center;
}

.day-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 54px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  padding: 0;
}

.day-cell.empty-cell {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.day-cell.has-record { background: var(--mint); }
.day-cell.selected { background: var(--pink); color: #fff; }
.day-cell:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
.day-number { font-weight: 950; }
.expense-month-grid .day-cell.has-record { background: var(--sun); }
.expense-month-grid .day-cell.selected { background: var(--pink); color: #fff; }
.day-amount {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
}
.day-dot {
  position: absolute;
  right: 4px;
  bottom: 4px;
  min-width: 20px;
  height: 20px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--sun);
  color: var(--ink);
  font-size: 11px;
  font-weight: 950;
  line-height: 16px;
}

.timeline-list {
  position: relative;
  gap: 18px;
  padding: 8px 0;
}

.timeline-list::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 80px;
  width: 3px;
  border-radius: 3px;
  background: var(--ink);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.timeline-date {
  position: relative;
  z-index: 1;
}

.timeline-date::after {
  content: "";
  position: absolute;
  z-index: 3;
  top: 14px;
  right: -18px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--pink);
}

.timeline-date span {
  display: inline-flex;
  justify-content: center;
  min-width: 64px;
  padding: 8px 6px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--sun);
  box-shadow: 3px 3px 0 var(--ink);
  font-weight: 950;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.tag-row span { background: #fff2c7; }

.expense-summary {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.total-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--soft-shadow);
  padding: 14px 16px;
}

.total-card span {
  color: var(--muted);
  font-weight: 950;
}

.total-card strong {
  font-size: clamp(24px, 4vw, 36px);
  color: #b45309;
}

.category-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-chip { background: #fffdf2; }

.expense-list { gap: 18px; }

.expense-category-group {
  display: grid;
  gap: 10px;
}

.expense-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--sun);
  box-shadow: var(--soft-shadow);
  padding: 10px 13px;
}

.expense-category-head span { font-weight: 950; }

.expense-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.expense-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.expense-card-top h4 { margin-top: 7px; }

.expense-card-top strong {
  color: #b42318;
  font-size: 22px;
  white-space: nowrap;
}

.expense-category-pill { background: #fff2c7; }

.expense-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.expense-note {
  margin-top: 10px;
  line-height: 1.6;
  color: #374151;
  font-weight: 600;
}

@keyframes wobble {
  from { transform: rotate(-1deg) scale(1); }
  to { transform: rotate(1deg) scale(1.015); }
}

@media (max-width: 720px) {
  .page { width: min(100% - 20px, 980px); padding-top: 12px; }
  .page-header, .upload-panel { display: block; transform: none; }
  .voice-actions { margin-top: 16px; }
  .voice-settings { grid-template-columns: 1fr; }
  .server-info { grid-column: auto; }
  .back-link { margin-bottom: 14px; }
  .record-links { grid-template-columns: 1fr; }
  .hold-button { min-height: 138px; transform: none; }
  .section-head { align-items: flex-start; }
  .record-title, .total-card, .expense-category-head, .expense-card-top { display: grid; }
  .result-panel, .records-panel, .month-board { transform: none; }
  .expense-card-grid { grid-template-columns: 1fr; }
  .expense-month-actions { width: 100%; }
  .expense-month-actions select { flex: 1; min-width: 0; }
  .expense-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .expense-analysis { grid-template-columns: 1fr; }
  .expense-pie-wrap { width: 150px; height: 150px; }
  .expense-pie-chart { width: 150px; height: 150px; }
  .timeline-list { padding-left: 26px; }
  .timeline-list::before { left: 10px; }
  .timeline-item { grid-template-columns: 1fr; gap: 6px; }
  .timeline-date::after { left: -22px; right: auto; top: 12px; }
  .timeline-date span { min-width: 0; }
  .day-cell { min-height: 46px; }
}
