:root {
  --ink: #12151c;
  --sidebar: #161a22;
  --sidebar-2: #1d2330;
  --line: rgba(255, 255, 255, 0.08);
  --gold: #d7b98a;
  --gold-2: #f0e2c8;
  --text: #1c2130;
  --muted: #7b8496;
  --bg: #eef1f6;
  --card: #ffffff;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 12px 32px rgba(18, 21, 28, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: inherit; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px;
  flex: 0 0 248px;
  background: linear-gradient(180deg, var(--sidebar) 0%, #10141b 100%);
  color: #d5dbe6;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  padding: 28px 22px 18px;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #f3e6cf, #c6a36a);
  color: #2a2116;
  font-weight: 700;
  margin-bottom: 14px;
}
.brand h1 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.08em;
  color: #fff;
  font-weight: 600;
}
.brand p {
  margin: 6px 0 0;
  color: #8d96a8;
  font-size: 12px;
  letter-spacing: 0.12em;
}
.menu { padding: 18px 12px; overflow: auto; flex: 1; }
.menu-label {
  margin: 16px 12px 8px;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: #6e7789;
}
.menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #c5ccd8;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 2px;
}
.menu a svg { width: 18px; height: 18px; flex: 0 0 18px; }
.menu a:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.menu a.on {
  background: rgba(215, 185, 138, 0.16);
  color: var(--gold-2);
}
.side-foot {
  padding: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.side-foot .name { font-size: 13px; color: #fff; }
.side-foot .role { font-size: 12px; color: #8d96a8; margin-top: 2px; }
.side-foot a {
  color: var(--gold);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid rgba(215, 185, 138, 0.35);
  border-radius: 999px;
}

.workspace { flex: 1; min-width: 0; }
.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e6e9f0;
  position: sticky;
  top: 0;
  z-index: 2;
}
.topbar h2 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: 0.02em; }
.topbar .crumb { margin-top: 4px; color: var(--muted); font-size: 12px; }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--gold-2);
  font-size: 13px;
}
main { padding: 24px 28px 40px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.stat {
  background: var(--card);
  border-radius: 16px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -20px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(215, 185, 138, 0.35), transparent 70%);
}
.stat span { display: block; color: var(--muted); font-size: 13px; }
.stat strong { display: block; margin-top: 10px; font-size: 28px; letter-spacing: -0.03em; }
.stat em { font-style: normal; color: var(--gold); font-size: 12px; }

.card, .panel {
  background: var(--card);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.muted { color: var(--muted); font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }

.table-wrap { overflow-x: auto; border-radius: 16px; box-shadow: var(--shadow); }
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.table-wrap table { box-shadow: none; margin: 0; }
.user-list { display: flex; flex-direction: column; gap: 12px; }
.user-card { background: #fff; border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); }
.user-main { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.user-main .who { display: flex; align-items: baseline; gap: 8px; }
.user-main b { font-size: 14px; }
.user-main span { font-weight: 600; }
.user-main code { color: var(--muted); font-size: 12px; font-family: inherit; word-break: break-all; }
.user-card dl { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 14px 0; }
.user-card dl > div { min-width: 120px; }
.user-card dt { color: var(--muted); font-size: 12px; }
.user-card dd { margin: 4px 0 0; word-break: break-all; }
form.user-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding-top: 12px; border-top: 1px solid #eef1f5; }
form.user-edit label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
form.user-edit input[name="user_name"] { width: 140px; }
form.user-edit select { width: 88px; }
form.user-edit input[type="number"] { width: 72px; }
form.user-edit button { flex: 0 0 auto; white-space: nowrap; }
th, td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
  border-bottom: 1px solid #eef1f5;
}
th {
  background: #f8f6f2;
  color: #5d6575;
  font-weight: 600;
  letter-spacing: 0.04em;
}
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fbfaf8; }

input, select, textarea {
  padding: 9px 11px;
  border: 1px solid #e3e6ee;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #c6a36a; box-shadow: 0 0 0 3px rgba(215, 185, 138, 0.25); }
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 4px;
  accent-color: #12151c;
  vertical-align: -2px;
}
.card h3 { margin: 18px 0 8px; font-size: 16px; }
.card h3:first-child { margin-top: 0; }
.card form p.help { display: block; max-width: 720px; line-height: 1.7; white-space: normal; }
.stack { display: block; max-width: 520px; margin: 0 0 12px; }
.stack input, .stack textarea { width: 100%; margin-top: 6px; display: block; }
button, .btn {
  background: var(--ink);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font: inherit;
  font-size: 13px;
}
button:hover, .btn:hover { background: #2a3142; }
.btn.on, a.btn.on { background: linear-gradient(180deg, #2a241c, #16130f); color: var(--gold-2); }
td form, .card form p { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
td form { margin: 0; }
label { font-size: 14px; }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs .btn { background: #fff; color: var(--text); border: 1px solid #e6e9f0; box-shadow: none; }
.tabs .btn.on { background: var(--ink); color: var(--gold-2); border-color: var(--ink); }

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  background: #10141b;
}
.login-hero {
  padding: 64px;
  color: #fff;
  background:
    radial-gradient(800px 400px at 20% 20%, rgba(215, 185, 138, 0.22), transparent 60%),
    linear-gradient(160deg, #1b2130, #10141b 60%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-hero h2 { font-size: 42px; margin: 18px 0 10px; letter-spacing: 0.04em; font-weight: 600; }
.login-hero p { color: #b7c0d0; max-width: 420px; line-height: 1.7; }
.login-panel {
  background: #f6f4f0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.login-card { width: 380px; }
.login-card h3 { margin: 0 0 6px; font-size: 26px; }
.login-card .muted { margin-bottom: 22px; }
.login-card input { width: 100%; margin: 0 0 12px; padding: 12px 14px; }
.login-card button { width: 100%; padding: 12px; margin-top: 6px; }
.err {
  background: #fff1f0;
  color: var(--danger);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 13px;
}

.asset-form input[type="text"] { width: min(640px, 100%); }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.asset-card { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.asset-card .preview { height: 128px; background: #f6f3ee; display: flex; align-items: center; justify-content: center; }
.asset-card img { width: 100%; height: 128px; object-fit: contain; background: #f6f3ee; display: block; }
.asset-card audio { width: calc(100% - 16px); }
.asset-card .meta { padding: 10px 12px 12px; }
.asset-card .meta b { display: block; font-size: 12px; word-break: break-all; }
.asset-card .meta span { display: block; color: var(--muted); font-size: 11px; line-height: 1.45; word-break: break-all; margin: 4px 0 8px; }
.asset-card form { display: flex; gap: 6px; align-items: center; }
.asset-card input[type="file"] { font-size: 11px; max-width: 118px; }
.group-title { margin: 18px 0 10px; font-size: 15px; }

@media (max-width: 980px) {
  .shell { display: block; }
  .sidebar { width: auto; height: auto; position: relative; }
  .stats, .grid-2, .login-page, .user-card dl { grid-template-columns: 1fr 1fr; }
  .login-hero { display: none; }
}
