:root {
  color-scheme: light;
  --bg: #eef2ec;
  --paper: #fffdf8;
  --ink: #16211d;
  --muted: #61706a;
  --line: #d9dfd3;
  --brand: #1f755c;
  --brand-strong: #14523f;
  --accent: #d77c3f;
  --wash: #e6ede4;
  --danger: #a53d2d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 8%, rgba(31, 117, 92, 0.14), transparent 30%),
    linear-gradient(145deg, rgba(215, 124, 63, 0.11), transparent 34%),
    var(--bg);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
}

a {
  color: var(--brand-strong);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 28px 0;
}

.login-shell .topbar {
  width: min(420px, 100%);
  justify-content: center;
  text-align: center;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 5vw, 42px);
}

h2 {
  font-size: 20px;
}

.agent-pill {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.78);
  font-weight: 800;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 20px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
}

.nav a,
.nav button,
.link-button,
button {
  min-height: 38px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.nav form {
  margin-left: auto;
}

.nav button:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.primary,
.link-button {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.primary:hover,
.link-button:hover {
  background: var(--brand-strong);
  text-decoration: none;
}

.flash {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(165, 61, 45, 0.3);
  border-radius: 8px;
  color: var(--danger);
  background: #fff4ef;
  font-weight: 800;
}

.panel,
.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.9);
  box-shadow: 0 18px 45px rgba(45, 40, 30, 0.07);
}

.panel {
  margin-bottom: 16px;
  padding: 22px;
}

.login-panel {
  width: min(420px, 100%);
  padding: 28px;
}

.login-brand {
  margin-bottom: 24px;
}

.login-brand p {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.login-brand h2 {
  font-size: 26px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.home-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 28px;
  border: 1px solid rgba(31, 117, 92, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(31, 117, 92, 0.15), rgba(255, 253, 248, 0.82) 45%),
    var(--paper);
}

.home-hero h2 {
  max-width: 620px;
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.18;
}

.stat {
  padding: 18px;
}

.balance-stat {
  background:
    linear-gradient(135deg, rgba(31, 117, 92, 0.12), rgba(255, 253, 248, 0.94)),
    var(--paper);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.stat small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-weight: 700;
}

.action-panel,
.invite-panel {
  background: rgba(255, 253, 248, 0.94);
}

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

.muted {
  color: var(--muted);
  line-height: 1.7;
}

.notice {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid rgba(215, 124, 63, 0.28);
  border-radius: 6px;
  color: #7f4725;
  background: #fff5ed;
  font-weight: 800;
  line-height: 1.6;
}

.tip {
  margin: 10px 0 0;
  color: var(--accent);
  font-weight: 900;
}

.notice + .muted {
  margin-top: 0;
}

.copyline {
  overflow-wrap: anywhere;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #fff;
  font-weight: 800;
}

.form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.money-input {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
}

.money-input span {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 6px 0 0 6px;
  background: var(--wash);
  color: var(--brand-strong);
  font-weight: 900;
}

.money-input input {
  border-radius: 0 6px 6px 0;
}

.search-form {
  display: flex;
  gap: 8px;
  min-width: min(460px, 100%);
}

.search-form input {
  flex: 1;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: normal;
}

.actions form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.actions input,
.actions select {
  min-height: 36px;
  width: auto;
}

.admin-user-actions {
  min-width: 420px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
}

.inline-check input {
  width: auto;
  min-height: auto;
}

.balance-line {
  margin-top: 0;
  font-size: 18px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 13px;
}

.empty {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding-top: 20px;
  }

  .topbar,
  .section-title,
  .home-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .nav form {
    margin-left: 0;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}
