:root {
  --bg: #090909;
  --panel: #151412;
  --panel-2: #201d17;
  --line: #514327;
  --text: #f4f0e6;
  --muted: #b9ad92;
  --accent: #d6b354;
  --accent-2: #9f7d2e;
  --danger: #e18478;
  --warn: #e0bd65;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1100px 560px at 80% -10%, #292316 0%, var(--bg) 63%);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 9, 9, 0.94);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(6px);
}

.brand { font-size: 26px; letter-spacing: 2px; color: var(--accent); font-weight: 800; }
.brand b { color: var(--text); font-size: 15px; letter-spacing: 1px; margin-left: 7px; vertical-align: 2px; }

.account { display: flex; align-items: center; gap: 10px; }
.badge { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--muted); }
.badge.cny { color: #ffe08a; border-color: #5a4a1d; }
.badge.hall { color: #e7cf8b; border-color: #715c2b; }
.link { background: none; border: none; color: var(--muted); cursor: pointer; text-decoration: underline; font-size: 13px; }

main { max-width: 1320px; margin: 0 auto; padding: 16px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.login-card { max-width: 420px; margin: 8vh auto; }

h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 0 0 4px; }
h3 { font-size: 15px; margin: 22px 0 8px; color: var(--muted); font-weight: 600; }
.sub { color: var(--muted); font-size: 13px; margin: 4px 0 16px; }

.stack { display: grid; gap: 12px; }
.stack label, .grid-form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }

input, select {
  background: #0a1c2b;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
}
input:focus, select:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

button.primary {
  background: linear-gradient(180deg, #e0c46e, #b28b36);
  color: #17130a;
  border: none;
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
button.primary:disabled { opacity: 0.6; cursor: default; }
button.ghost { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px 14px; cursor: pointer; }

.message { margin-top: 12px; font-size: 13px; }
.message.error { color: var(--danger); }
.message.ok { color: var(--accent); }
[hidden] { display: none !important; }

.tabs { display: flex; flex-wrap: nowrap; gap: 6px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 4px; }
.tab { flex: 0 0 auto; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); border-radius: 7px; padding: 7px 12px; cursor: pointer; font-size: 12px; }
.tab.active { color: #17130a; background: #d6b354; border-color: #f0d987; font-weight: 700; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 14px 0; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 6px; }
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 26px; font-weight: 700; }
.cny-inline { font-size: 12px; color: #ffe08a; }

table.grid { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 12px; }
table.grid th, table.grid td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--panel); }
table.grid tbody tr:hover { background: var(--panel-2); }

.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.grid-form button { height: 42px; }

.tree { margin-top: 10px; }
.tree ul { list-style: none; margin: 4px 0 4px 18px; padding: 0; border-left: 1px dashed var(--line); }
.tree li { margin: 4px 0; }
.tree .node { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tree .tag { font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; color: var(--muted); }
.tree .ratio { color: #ffe08a; }

.table-scroll { width: 100%; overflow: auto; overscroll-behavior-x: contain; border: 1px solid var(--line); border-radius: 7px; }
.table-scroll table.grid { min-width: 640px; margin: 0; }
.report-filter { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 8px; align-items: end; padding: 10px; margin: 10px 0; border: 1px solid var(--line); border-radius: 8px; background: rgba(32, 29, 23, 0.72); }
.report-filter label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.report-filter input, .report-filter select { padding: 7px 9px; border-radius: 6px; font-size: 13px; min-height: 36px; }
.report-filter button { min-height: 36px; padding: 7px 12px; }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.report-section { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(25, 23, 19, 0.78); }
.report-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; }
.report-heading h3 { margin: 0; color: var(--text); font-size: 13px; }
.report-heading .ghost { padding: 5px 9px; border-radius: 6px; font-size: 11px; white-space: nowrap; }

@media (max-width: 760px) {
  .report-grid { grid-template-columns: minmax(0, 1fr); }
  .report-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .topbar { padding: 9px 12px; gap: 8px; flex-wrap: wrap; }
  .brand { font-size: 22px; }
  .brand b { font-size: 13px; }
  .account { margin-left: auto; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
  .badge { padding: 2px 7px; font-size: 11px; }
  main { padding: 10px; }
  .card { padding: 11px; border-radius: 9px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .stat { padding: 9px; gap: 3px; border-radius: 8px; }
  .stat .value { font-size: 20px; }
  .grid-form { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .report-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 8px; }
  .report-filter button { grid-column: 1 / -1; }
  .report-section { padding: 8px; }
  .tabs { margin-left: -2px; margin-right: -2px; }
  .tab { padding: 7px 10px; }
  h1 { font-size: 20px; }
  h2 { font-size: 16px; }
  .login-card { margin: 5vh auto; }
}
