:root {
  --ink: #18201c;
  --muted: #6e7772;
  --paper: #f5f1e8;
  --card: #fffdf8;
  --line: #ded8ca;
  --green: #245b45;
  --green-2: #32765a;
  --orange: #d67642;
  --red: #a8443d;
  --shadow: 0 18px 60px rgba(43, 51, 45, .10);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.shell {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}
.shell::before, .shell::after {
  content: "";
  position: fixed;
  border-radius: 999px;
  filter: blur(1px);
  pointer-events: none;
  opacity: .65;
}
.shell::before { width: 440px; height: 440px; background: #dce8d6; left: -180px; top: -180px; }
.shell::after { width: 360px; height: 360px; background: #f1d7bf; right: -160px; bottom: -180px; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  position: relative;
  z-index: 1;
}
.login-card {
  width: min(460px, 100%);
  padding: 38px;
  background: rgba(255, 253, 248, .94);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--orange);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
}
h1 { font-family: Georgia, "STSong", serif; font-size: clamp(30px, 6vw, 44px); line-height: 1.05; margin: 0; }
.lede { margin: 14px 0 28px; color: var(--muted); line-height: 1.7; }

.field { display: grid; gap: 8px; margin-bottom: 17px; }
.field > span { font-size: 13px; font-weight: 700; color: #3c4640; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  border-radius: 13px;
  padding: 13px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(50,118,90,.12); }
textarea { resize: vertical; min-height: 92px; }
.primary, .secondary, .danger, .ghost {
  border: 0;
  border-radius: 13px;
  padding: 12px 17px;
  font-weight: 700;
}
.primary { color: #fff; background: var(--green); box-shadow: 0 8px 20px rgba(36,91,69,.18); }
.primary:hover { background: var(--green-2); }
.primary.full { width: 100%; padding: 14px; }
.secondary { background: #e6eee9; color: var(--green); }
.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.danger { background: #fae7e5; color: var(--red); }
button:disabled { opacity: .55; cursor: wait; }
.error { min-height: 20px; margin: 12px 0 0; color: var(--red); font-size: 13px; }

.app { position: relative; z-index: 1; width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 26px 0 70px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 34px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: var(--green); color: white; font-family: Georgia, serif; font-size: 20px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.who { color: var(--muted); font-size: 14px; }

.hero { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 24px; }
.hero h1 { max-width: 700px; }
.hero .lede { margin-bottom: 0; }
.amount-highlight { text-align: right; white-space: nowrap; }
.amount-highlight small { display: block; color: var(--muted); margin-bottom: 5px; }
.display-amount, .amount, .stat-money {
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif !important;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
}
.display-amount i, .amount i, .stat-money i {
  font-style: normal;
  font-size: .58em;
  font-weight: 650;
  margin-right: .2em;
  vertical-align: .16em;
  letter-spacing: 0;
  opacity: .7;
}
.amount-highlight strong { font-size: 31px; line-height: 1; font-weight: 650; color: var(--green); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: rgba(255,253,248,.8); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.stat span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.stat strong { font: 650 25px/1 Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 14px; }
.toolbar h2 { margin: 0; font-family: Georgia, "STSong", serif; }
.filters { display: flex; gap: 8px; }
.filters select { padding: 10px 34px 10px 12px; }

.expense-list { display: grid; gap: 12px; }
.expense-card {
  display: grid;
  grid-template-columns: 110px minmax(0,1fr) auto;
  gap: 18px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 19px;
  padding: 18px 20px;
  box-shadow: 0 8px 30px rgba(53,58,53,.04);
}
.datebox { font-weight: 800; color: var(--green); }
.datebox small { display: block; color: var(--muted); font-weight: 500; margin-top: 4px; }
.expense-main { min-width: 0; }
.expense-title { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.expense-title h3 { margin: 0; font-size: 17px; }
.meta { color: var(--muted); font-size: 13px; margin: 7px 0 0; line-height: 1.6; overflow-wrap: anywhere; }
.money { text-align: right; }
.money .amount { display: block; font-size: 21px; line-height: 1; font-weight: 650; color: #24342c; }
.money .card-actions { justify-content: flex-end; }
.badge { display: inline-flex; border-radius: 999px; padding: 4px 9px; font-size: 11px; font-weight: 800; }
.badge.pending { background: #faead8; color: #9b541f; }
.badge.reimbursed { background: #dfeee5; color: var(--green); }
.badge.private { background: #ece9e4; color: #665f58; }
.attachments { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.attachment-group { display: inline-flex; align-items: stretch; border-radius: 9px; overflow: hidden; background: #eef2ee; }
.attachment { display: inline-flex; align-items: center; gap: 5px; max-width: 220px; padding: 6px 9px; border-radius: 9px; background: #eef2ee; color: var(--green); font-size: 12px; text-decoration: none; }
.attachment span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.download-link { display: inline-flex; align-items: center; padding: 6px 9px; border-left: 1px solid #d8e2da; color: var(--green); font-size: 12px; font-weight: 800; text-decoration: none; }
.download-link:hover, .attachment:hover { background: #dfe9e2; }
.card-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.card-actions button { border: 0; border-radius: 8px; padding: 6px 9px; font-size: 12px; font-weight: 700; }
.empty { text-align: center; border: 1px dashed #c8c0b1; border-radius: 20px; padding: 48px 20px; color: var(--muted); background: rgba(255,255,255,.35); }

.dialog { border: 0; border-radius: 24px; padding: 0; width: min(660px, calc(100% - 24px)); box-shadow: var(--shadow); background: var(--card); }
.dialog::backdrop { background: rgba(24,32,28,.46); backdrop-filter: blur(5px); }
.dialog-body { padding: 28px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px; }
.dialog h2 { margin: 0; font-family: Georgia, "STSong", serif; font-size: 28px; }
.icon-button { border: 0; width: 35px; height: 35px; border-radius: 50%; background: #ece9e1; color: var(--ink); font-size: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.file-help { color: var(--muted); font-size: 12px; line-height: 1.5; }
.existing-files { display: grid; gap: 8px; padding: 12px; border-radius: 13px; background: #f3f0e9; }
.existing-files > span { font-size: 13px; font-weight: 700; }
.remove-attachment { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }
.remove-attachment input { width: 16px; height: 16px; margin: 0; accent-color: var(--red); }

.people { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 28px; }
.person-pill { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 9px 8px 13px; }
.person-pill small { color: var(--muted); }
.person-pill button { border: 0; border-radius: 999px; background: #eeeae1; color: var(--muted); padding: 4px 8px; font-size: 11px; }
.person-pill.inactive { opacity: .55; }

.toast { position: fixed; z-index: 20; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: white; padding: 11px 16px; border-radius: 12px; transition: .25s; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .login-card { padding: 28px 22px; }
  .app { width: min(100% - 22px, 1180px); padding-top: 16px; }
  .topbar { margin-bottom: 28px; }
  .who { display: none; }
  .hero { display: block; }
  .amount-highlight { text-align: left; margin-top: 22px; }
  .stats { grid-template-columns: 1fr; }
  .toolbar { align-items: flex-end; }
  .filters { max-width: 55%; }
  .expense-card { grid-template-columns: 1fr auto; gap: 11px; padding: 16px; }
  .datebox { grid-column: 1 / -1; }
  .money { align-self: start; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
}
