:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1a1d26;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #c45c26;
  --accent-soft: #fef3ee;
  --green: #0d7a4f;
  --green-soft: #e8f7f0;
  --blue: #1d4ed8;
  --blue-soft: #eff4ff;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.04);
  --radius: 14px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body {
  padding: 0;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, #fde8d8 0%, transparent 60%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 32px 28px 28px;
  border: 1px solid var(--border);
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: linear-gradient(145deg, #d46a2e, #a8481a);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.02em;
}

.login-brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.login-brand .en {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.login-brand .sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 10px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: #fafbfc;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 92, 38, 0.15);
  background: #fff;
}

.btn {
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: linear-gradient(145deg, #d46a2e, #b8521c);
  color: #fff;
  transition: opacity 0.15s, transform 0.1s;
}

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

.login-error {
  color: #b91c1c;
  font-size: 0.85rem;
  margin-top: 12px;
  text-align: center;
  min-height: 1.2em;
}

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

/* ---------- Dashboard ---------- */
.app-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.header-logo {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(145deg, #d46a2e, #a8481a);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-titles { min-width: 0; }

.header-titles .cn {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-titles .en {
  font-size: 0.7rem;
  color: var(--muted);
}

.btn-logout {
  flex-shrink: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
}

.btn-logout:active { background: var(--bg); }

.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

.banner-sample {
  background: #fff8e6;
  border: 1px solid #f5d78e;
  color: #92400e;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 16px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 18px;
  font-size: 0.875rem;
  color: var(--muted);
}

.meta-row strong {
  color: var(--text);
  font-weight: 600;
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 22px;
}

@media (min-width: 520px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

.kpi-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.kpi-card .label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 6px;
}

.kpi-card .value {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kpi-card.revenue .value { color: var(--blue); }
.kpi-card.expense .value { color: var(--accent); }
.kpi-card.profit .value { color: var(--green); }

.kpi-card.revenue { border-top: 3px solid var(--blue); }
.kpi-card.expense { border-top: 3px solid var(--accent); }
.kpi-card.profit { border-top: 3px solid var(--green); }

.section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.section-title .hint {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.sales-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sales-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.sales-row:last-child { border-bottom: none; }

.rank {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rank.top1 { background: #fef3c7; color: #b45309; }
.rank.top2 { background: #f3f4f6; color: #4b5563; }
.rank.top3 { background: #ffedd5; color: #c2410c; }

.sales-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.sales-orders {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

.sales-amt {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

.bar-wrap {
  grid-column: 1 / -1;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin-top: -4px;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #d46a2e, #e8955a);
  transition: width 0.4s ease;
}

.footer-note {
  margin-top: 24px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}
