:root {
  --ink: #17251f;
  --muted: #66736c;
  --paper: #f5f3ec;
  --surface: #fffdf8;
  --line: #dedbd0;
  --green: #225d46;
  --green-dark: #174534;
  --green-soft: #e3eee8;
  --rust: #b35331;
  --rust-soft: #f6e6de;
  --gold: #b6842e;
  --gold-soft: #f5ecd8;
  --blue: #376987;
  --blue-soft: #e4edf2;
  --shadow: 0 18px 45px rgba(42, 55, 47, 0.08);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 6%, rgba(182, 132, 46, 0.14), transparent 24rem),
    linear-gradient(180deg, #f8f6f0 0%, var(--paper) 100%);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.shell { width: min(1440px, 100%); margin: 0 auto; padding: 0 28px 36px; }
.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, "Songti SC", serif; font-size: 19px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.sync-state { color: var(--muted); font-size: 13px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 48px;
  align-items: end;
  padding: 62px 0 34px;
}
.eyebrow { margin: 0 0 9px; color: var(--rust); font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
h1, h2 { font-family: Georgia, "Songti SC", serif; letter-spacing: -.025em; }
h1 { max-width: 720px; margin: 0; font-size: clamp(35px, 5vw, 64px); line-height: 1.02; font-weight: 600; }
h2 { margin: 0; font-size: 26px; font-weight: 600; }
.hero-copy { max-width: 700px; margin: 20px 0 0; color: var(--muted); font-size: 15px; line-height: 1.8; }
.date-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 248, .72);
  box-shadow: var(--shadow);
}
.date-control label { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
input, select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 11px;
  outline: none;
}
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(34, 93, 70, .12); }

.button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 15px;
  font-weight: 700;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--green); color: #fff; }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { border-color: var(--line); background: var(--surface); color: var(--ink); }
.button.secondary:hover { border-color: #bdb9aa; background: #faf8f1; }
.button.full { width: 100%; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 158px;
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(42, 55, 47, .05);
  animation: reveal .45s ease both;
}
.metric-card::after { content: ""; position: absolute; inset: auto 0 0; height: 5px; }
.metric-card.daily::after { background: var(--green); }
.metric-card.weekly::after { background: var(--rust); }
.metric-card.monthly::after { background: var(--gold); }
.metric-card.deals::after { background: var(--blue); }
.metric-label { display: block; color: var(--muted); font-size: 13px; }
.metric-card strong { display: block; margin: 13px 0 8px; font-family: Georgia, serif; font-size: 44px; line-height: 1; font-weight: 600; }
.metric-card small { color: var(--muted); font-size: 12px; }

.panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 25px 25px 18px; }
.section-heading > p { max-width: 520px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; text-align: right; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 880px; }
th, td { padding: 13px 16px; border-top: 1px solid var(--line); font-size: 13px; text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #faf8f2; font-size: 11px; letter-spacing: .04em; white-space: nowrap; }
td.number, th.number { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #fbfaf6; }
.person { font-weight: 700; }
.store { color: var(--muted); }
.rate { font-variant-numeric: tabular-nums; font-weight: 700; }
.rate.good { color: var(--green); }
.rate.mid { color: var(--gold); }
.rate.low { color: var(--rust); }

.filters { display: grid; grid-template-columns: 1.35fr repeat(4, 1fr) auto; gap: 10px; padding: 0 25px 20px; }
.filters label, .login-form label { color: var(--muted); font-size: 11px; }
.filters input, .filters select, .login-form input { width: 100%; margin-top: 6px; }
.filter-button { align-self: end; }
.warning-box { margin: 0 25px 18px; padding: 12px 14px; border: 1px solid #d7ad63; border-radius: 10px; background: var(--gold-soft); color: #725218; font-size: 12px; }
.badge { display: inline-flex; align-items: center; min-height: 25px; padding: 3px 8px; border-radius: 999px; font-size: 11px; white-space: nowrap; }
.badge.deal { color: var(--green-dark); background: var(--green-soft); }
.badge.open { color: #6c5e46; background: #eeeae0; }
.badge.replied { color: #315b72; background: var(--blue-soft); }
.badge.unreplied { color: #934126; background: var(--rust-soft); }
.deal-button { min-height: 32px; padding: 5px 9px; font-size: 11px; }
.deal-button.cancel { color: var(--rust); }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 17px 25px 22px; color: var(--muted); font-size: 12px; }
.pagination button:disabled { cursor: not-allowed; opacity: .45; transform: none; }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 25px 4px 0; color: var(--muted); font-size: 11px; }
dialog { width: min(420px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 90px rgba(13, 30, 21, .28); }
dialog::backdrop { background: rgba(17, 31, 24, .52); backdrop-filter: blur(3px); }
.login-form { position: relative; padding: 31px; }
.login-form h2 { margin-bottom: 10px; }
.login-form > p:not(.eyebrow):not(.form-error) { margin: 0 0 22px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.dialog-close { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #efede5; color: var(--muted); font-size: 20px; }
.form-error { min-height: 20px; margin: 8px 0; color: var(--rust); font-size: 12px; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: min(390px, calc(100% - 48px)); padding: 12px 16px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 13px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.empty { padding: 42px; color: var(--muted); text-align: center; }

@keyframes reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .date-control { width: min(100%, 430px); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .shell { padding: 0 14px 25px; }
  .topbar { align-items: flex-start; gap: 12px; padding: 15px 0; }
  .brand small, .sync-state { display: none; }
  .top-actions { align-self: center; }
  .hero { padding: 40px 0 25px; }
  h1 { font-size: 39px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 132px; padding: 18px; }
  .metric-card strong { font-size: 35px; }
  .section-heading { display: block; padding: 21px 18px 15px; }
  .section-heading > p { margin-top: 8px; text-align: left; }
  .filters { grid-template-columns: 1fr 1fr; padding: 0 18px 18px; }
  .filters label:first-child { grid-column: 1 / -1; }
  .filter-button { width: 100%; }
  th, td { padding: 12px; }
  footer { display: block; line-height: 1.8; }
}
