:root {
  --bg: #0a0a0c;
  --bg-soft: #101014;
  --panel: #15151a;
  --panel-2: #1c1c22;
  --line: #2b2b33;
  --line-soft: #232329;
  --gold: #c9a227;
  --gold-soft: #e8cc7a;
  --gold-dim: #8c701f;
  --text: #ece9e2;
  --muted: #9a948a;
  --danger: #d9534f;
  --ok: #4caf7d;
  --warn: #d9a441;
  --radius: 10px;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(201, 162, 39, 0.13), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(201, 162, 39, 0.07), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold-soft); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; color: inherit; }

/* ---------------------------------------------------------------- 登录页 */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.login-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(28, 28, 34, 0.96), rgba(16, 16, 20, 0.96));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 42px 36px 34px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(201, 162, 39, 0.5);
  background: linear-gradient(145deg, rgba(201, 162, 39, 0.22), rgba(201, 162, 39, 0.04));
  display: grid;
  place-items: center;
  color: var(--gold-soft);
  font-weight: 700;
  letter-spacing: 1px;
}

.brand-title { font-size: 18px; font-weight: 600; letter-spacing: 2px; }
.brand-sub { font-size: 12px; color: var(--muted); letter-spacing: 1px; }

.login-hint {
  margin: 26px 0 22px;
  color: var(--muted);
  font-size: 13px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 7px;
}

input[type="text"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  background: #0e0e12;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(201, 162, 39, 0.65);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.12);
}

textarea { resize: vertical; min-height: 76px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 16px;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.btn:hover { border-color: rgba(201, 162, 39, 0.55); color: var(--gold-soft); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, #d4ad33, #a9861c);
  border-color: #e2c265;
  color: #17140a;
  font-weight: 600;
}
.btn-primary:hover { color: #17140a; filter: brightness(1.06); }

.btn-ghost { background: transparent; }
.btn-danger { color: #f0a5a3; border-color: rgba(217, 83, 79, 0.4); }
.btn-danger:hover { border-color: var(--danger); color: #ffc9c7; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }

.login-error {
  min-height: 22px;
  color: #f09a98;
  font-size: 13px;
  margin-top: 10px;
}

/* ---------------------------------------------------------------- 布局 */

.shell { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }

.sidebar {
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(21, 21, 26, 0.9), rgba(10, 10, 12, 0.9));
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand { margin-bottom: 26px; padding: 0 6px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.16s ease;
  font-size: 14px;
}
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.03); }
.nav-item.active {
  color: var(--gold-soft);
  background: rgba(201, 162, 39, 0.09);
  border-color: rgba(201, 162, 39, 0.28);
}
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.6; }

.sidebar-foot { margin-top: auto; color: var(--muted); font-size: 12px; padding: 0 8px; }

.main { padding: 26px 32px 60px; min-width: 0; }

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

.page-title { font-size: 20px; font-weight: 600; letter-spacing: 1px; margin: 0; }
.page-sub { color: var(--muted); font-size: 12px; letter-spacing: 0.5px; }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 6px 5px 14px; color: var(--muted); font-size: 12px;
  background: var(--panel);
}

/* ---------------------------------------------------------------- 卡片/表格 */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }

.stat {
  background: linear-gradient(180deg, var(--panel), rgba(21, 21, 26, 0.6));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat .label { color: var(--muted); font-size: 12px; letter-spacing: 1px; }
.stat .value { font-size: 26px; font-weight: 600; color: var(--gold-soft); margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .hint { color: var(--muted); font-size: 12px; margin-top: 2px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
}
.panel-head h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: 0.5px; }
.panel-body { padding: 16px 18px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: 1px; background: rgba(255, 255, 255, 0.015); }
tbody tr:hover { background: rgba(201, 162, 39, 0.035); }
tbody tr:last-child td { border-bottom: none; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--line); color: var(--muted);
}
.tag-gold { color: var(--gold-soft); border-color: rgba(201, 162, 39, 0.35); background: rgba(201, 162, 39, 0.08); }
.tag-ok { color: #8fe0b4; border-color: rgba(76, 175, 125, 0.35); background: rgba(76, 175, 125, 0.08); }
.tag-danger { color: #f0a5a3; border-color: rgba(217, 83, 79, 0.35); background: rgba(217, 83, 79, 0.08); }
.tag-muted { color: var(--muted); }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; letter-spacing: 0.2px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .grow { flex: 1; min-width: 160px; }
.panel-head .toolbar input[type="search"] { width: 300px; }

input[type="search"], input[type="text"] { max-width: 100%; }

/* ---------------------------------------------------------------- 弹层 */

.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0, 0, 0, 0.62);
  display: grid; place-items: center;
  padding: 24px;
}

.modal {
  width: min(680px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: linear-gradient(180deg, #191920, #121216);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; background: #191920; z-index: 1;
}
.modal-head h3 { margin: 0; font-size: 16px; letter-spacing: 0.5px; }
.modal-body { padding: 18px 20px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--line-soft);
  position: sticky; bottom: 0; background: #121216;
}
.icon-btn {
  border: none; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 8px; border-radius: 6px;
}
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; align-items: center; }
  .sidebar .brand { margin: 0 12px 0 0; }
  .sidebar-foot { display: none; }
  .main { padding: 18px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.toast-host {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  background: #1e1e25; border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  padding: 10px 14px; border-radius: 8px; font-size: 13px;
  box-shadow: var(--shadow); max-width: 380px;
  animation: toast-in 0.18s ease;
}
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.progress-bar { height: 6px; border-radius: 999px; background: #26262d; overflow: hidden; min-width: 70px; }
.progress-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold-soft)); }

.subhead { color: var(--muted); font-size: 12px; letter-spacing: 1px; margin: 18px 0 8px; }
.divider { height: 1px; background: var(--line-soft); margin: 16px 0; }
.file-drop {
  border: 1px dashed var(--line); border-radius: 8px; padding: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted);
}
.file-drop input[type="file"] { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
