:root {
  --bg: #12211c;
  --bg-2: #183028;
  --card: #1c3a31;
  --line: #2d5648;
  --text: #e8f2ec;
  --muted: #9bb5a8;
  --gold: #d7b36a;
  --up: #e85d4c;
  --down: #3db37a;
  --warn: #e0a14a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, #245445 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.top, main, .summary { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: end;
  padding: 28px 0 16px;
}
.eyebrow { margin: 0; color: var(--gold); letter-spacing: 0.08em; font-size: 12px; }
h1 { margin: 4px 0 0; font-size: 28px; font-weight: 650; }
h2 { margin: 0 0 12px; font-size: 18px; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 13px; }

.top-actions, .panel-head { display: flex; gap: 8px; align-items: center; }
.panel-head { justify-content: space-between; margin-bottom: 8px; }

button, select, input {
  font: inherit;
  color: var(--text);
  background: #10261f;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
}
button { cursor: pointer; background: var(--gold); color: #1a1408; border: 0; font-weight: 650; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button:hover { filter: brightness(1.05); }

.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
.stat b { display: block; font-size: 22px; margin-top: 6px; }
.up { color: var(--up); }
.down { color: var(--down); }

.tabs {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tab {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
}
.tab.active {
  color: var(--gold);
  border-color: var(--gold);
  background: #16342b;
}

.panel {
  background: rgba(28, 58, 49, 0.72);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 32px;
}
.hidden { display: none; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; }
td input { width: 100%; min-width: 72px; }

.grid-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.grid-form .wide, .grid-form button { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }

.ai-list { display: grid; gap: 8px; }
.ai-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.ai-item:hover { border-color: var(--gold); }
.ai-detail {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.ai-detail h3 { margin: 16px 0 8px; }
.chart { height: 360px; }
.chart-sm { height: 200px; }

#toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: #0e1f1a;
  border: 1px solid var(--gold);
  padding: 10px 14px;
  border-radius: 10px;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login-card {
  width: min(420px, calc(100% - 32px));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
}
.login-card form { display: grid; gap: 12px; margin-top: 18px; }
.error { color: var(--up); }

@media (max-width: 800px) {
  .summary { grid-template-columns: 1fr 1fr; }
  .grid-form { grid-template-columns: 1fr; }
  .top { align-items: start; flex-direction: column; gap: 12px; }
}
