:root {
  --paper: #f7f1e5;
  --paper-deep: #eee2cf;
  --ink: #17130f;
  --muted: #71675a;
  --line: rgba(35, 27, 17, 0.12);
  --income: #2e7555;
  --income-soft: #dceade;
  --expense: #aa3c2f;
  --expense-soft: #f1ddd8;
  --black: #17130f;
  --white: #fffaf1;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

#app {
  width: min(100%, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.screen {
  min-height: calc(100vh - 36px);
}

.login-screen {
  display: grid;
  place-items: center;
  gap: 28px;
  align-content: center;
}

.brand {
  text-align: center;
}

.seal-mark {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  border: 3px solid var(--expense);
  border-radius: 18px;
  color: var(--expense);
  font-size: 38px;
  font-weight: 900;
  transform: rotate(-4deg);
}

.brand h1,
.topbar h1 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: clamp(42px, 8vw, 68px);
  line-height: 1;
}

.brand p,
.topbar p,
.muted {
  color: var(--muted);
}

.login-box,
.command-panel,
.summary-card,
.chart-box,
.parse-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.84);
  box-shadow: 0 18px 45px rgba(63, 48, 28, 0.09);
}

.login-box {
  display: grid;
  gap: 12px;
  width: min(100%, 360px);
  padding: 22px;
}

label {
  font-size: 14px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(23, 19, 15, 0.22);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  outline: none;
}

input {
  height: 46px;
  padding: 0 14px;
}

textarea {
  resize: vertical;
  min-height: 132px;
  padding: 16px;
  font-size: 20px;
  line-height: 1.45;
}

input:focus,
textarea:focus {
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(23, 19, 15, 0.08);
}

.login-box button,
.parse-actions button {
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--black);
  color: var(--white);
  font-weight: 800;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 6px auto 22px;
}

.topbar h1 {
  font-size: 32px;
}

.topbar p {
  margin: 4px 0 0;
}

.ghost {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.6);
  color: var(--ink);
  min-height: 38px;
  padding: 0 12px;
}

.home-view {
  width: min(100%, 620px);
  margin: 0 auto;
}

.command-panel {
  padding: 18px;
}

.command-actions {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 14px;
  margin-top: 14px;
}

.voice-button {
  display: grid;
  place-items: center;
  align-content: center;
  height: 112px;
  border: 3px solid #8f2f25;
  border-radius: 50%;
  background: var(--expense);
  color: #fff7eb;
  box-shadow: 0 12px 0 #7d2a21, 0 18px 35px rgba(170, 60, 47, 0.22);
}

.voice-button span {
  font-size: 42px;
  font-weight: 950;
  line-height: 1;
}

.voice-button small {
  margin-top: 4px;
  font-size: 12px;
}

.voice-button.listening {
  filter: brightness(1.06);
  transform: translateY(4px);
  box-shadow: 0 8px 0 #7d2a21, 0 14px 26px rgba(170, 60, 47, 0.24);
}

.type-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.big-action {
  border: 0;
  border-radius: 8px;
  color: var(--white);
  font-weight: 900;
}

.big-action {
  min-height: 112px;
  font-size: 25px;
}

.big-action span {
  display: block;
  font-size: 34px;
  line-height: 1;
}

.income {
  background: var(--income);
}

.expense {
  background: var(--expense);
}

.parse-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding: 14px;
}

.parse-card strong,
.parse-card small {
  display: block;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.parse-card strong {
  font-size: 18px;
}

.parse-card small {
  margin-top: 5px;
  color: var(--muted);
}

.parse-actions {
  display: flex;
  gap: 8px;
}

.parse-actions .ghost {
  background: transparent;
  color: var(--ink);
}

.analysis-view {
  display: grid;
  gap: 14px;
}

.summary-card {
  padding: 20px;
}

.summary-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 700;
}

.summary-card strong {
  font-size: clamp(38px, 8vw, 64px);
  line-height: 1;
}

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

.chart-box {
  padding: 16px;
}

.chart-box h2,
.records-section h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 14px;
  align-items: center;
}

.donut {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: conic-gradient(var(--income) 0 100%);
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 30px;
  border-radius: 50%;
  background: var(--white);
}

#categoryLegend {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#categoryLegend li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.bars {
  display: flex;
  align-items: end;
  gap: 8px;
  height: 150px;
  border-bottom: 1px solid var(--line);
}

.bar {
  flex: 1;
  min-width: 24px;
  border-radius: 6px 6px 0 0;
  background: var(--income);
  position: relative;
}

.bar span {
  position: absolute;
  left: 50%;
  bottom: -24px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 12px;
}

.records-section {
  margin-top: 4px;
}

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

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

.record-row strong {
  font-size: 17px;
}

.record-row p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.record-row span {
  font-weight: 900;
  white-space: nowrap;
}

.empty {
  color: var(--muted);
  padding: 20px 0;
}

@media (max-width: 720px) {
  #app {
    padding: 14px;
  }

  .command-actions,
  .charts,
  .donut-wrap {
    grid-template-columns: 1fr;
  }

  .voice-button {
    width: 128px;
    height: 128px;
    justify-self: center;
  }

  .topbar h1 {
    font-size: 26px;
  }

  .topbar {
    align-items: start;
  }

  .ghost {
    padding: 0 10px;
  }
}
