:root {
  --bg: #070b08;
  --bg-soft: #0b110d;
  --surface: #101712;
  --surface-2: #161f19;
  --surface-3: #1d2921;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f3f7f1;
  --text-2: rgba(243, 247, 241, 0.72);
  --muted: rgba(243, 247, 241, 0.46);
  --accent: #c8ff3d;
  --accent-ink: #0c1407;
  --accent-soft: rgba(200, 255, 61, 0.12);
  --danger: #ff6a5a;
  --warn: #ffcf4d;
  --ok: #59e08c;
  --radius: 18px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }

.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  color: var(--muted);
}
.boot-logo {
  width: 64px; height: 64px; border-radius: 18px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 900; font-size: 22px;
  animation: pulse 1.4s ease infinite;
}
@keyframes pulse { 50% { transform: scale(0.92); opacity: 0.7; } }

/* 登录 */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(80% 60% at 15% 0%, rgba(200, 255, 61, 0.1), transparent 60%),
    radial-gradient(60% 60% at 100% 100%, rgba(107, 214, 255, 0.07), transparent 60%),
    var(--bg);
}
.login-card {
  width: min(400px, 100%);
  padding: 34px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 900; font-size: 17px; letter-spacing: -0.5px;
  flex-shrink: 0;
}
.brand h1 { margin: 0; font-size: 26px; letter-spacing: -0.6px; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.brand.small .brand-mark { width: 38px; height: 38px; border-radius: 11px; font-size: 14px; }
.brand.small strong { display: block; font-size: 15px; line-height: 1.2; }
.brand.small small { color: var(--muted); font-size: 11px; }

.field { display: block; margin: 18px 0; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 7px; }
input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: var(--surface-3); }
textarea { resize: vertical; min-height: 90px; font-family: Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.6; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: var(--surface-3);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.btn:hover { opacity: 0.86; }
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: var(--line-strong); }
.btn.danger { background: rgba(255, 106, 90, 0.12); color: var(--danger); }
.btn.tiny { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 9px; }
.btn.block { width: 100%; height: 44px; margin-top: 8px; }

.hint { color: var(--muted); font-size: 12px; margin: 12px 0 0; }

/* 框架 */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 22px;
  padding: 12px 24px;
  background: rgba(7, 11, 8, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  height: 34px; padding: 0 13px;
  border: none; border-radius: 9px;
  background: transparent; color: var(--text-2);
  font-size: 13px; cursor: pointer; white-space: nowrap;
}
.tabs button:hover { background: var(--surface-2); color: var(--text); }
.tabs button.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.userbox { display: flex; align-items: center; gap: 10px; }
.who { font-size: 12px; color: var(--muted); }

.main { padding: 26px 24px 60px; max-width: 1240px; width: 100%; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

/* 通用 */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 24px; letter-spacing: -0.5px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.card h3 { margin: 0 0 4px; font-size: 15px; }
.card > p.sub { margin: 0 0 18px; color: var(--muted); font-size: 12px; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 30px; font-weight: 800; letter-spacing: -1px; margin-top: 6px; line-height: 1.1; }
.stat .s { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.stat.accent .v { color: var(--accent); }

.section-gap { margin-top: 18px; }

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; }
tr:last-child td { border-bottom: none; }
table .mono { font-family: Menlo, Consolas, monospace; font-size: 11.5px; }

.badge {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 9px; border-radius: 7px;
  font-size: 11px; font-weight: 700;
  background: var(--surface-3); color: var(--text-2);
}
.badge.ok { background: rgba(89, 224, 140, 0.12); color: var(--ok); }
.badge.warn { background: rgba(255, 207, 77, 0.12); color: var(--warn); }
.badge.danger { background: rgba(255, 106, 90, 0.12); color: var(--danger); }
.badge.acc { background: var(--accent-soft); color: var(--accent); }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: Menlo, Consolas, monospace; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 16px; }
.form-grid .field { margin: 6px 0; }
.switch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.switch-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 14px; border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12.5px;
}
.param-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }

.action-row {
  display: grid;
  grid-template-columns: 1.1fr 1.6fr 0.8fr 0.6fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.action-row:last-child { border-bottom: none; }
.action-row .nm { font-weight: 600; font-size: 13px; }
.action-row .ky { font-family: Menlo, Consolas, monospace; font-size: 11px; color: var(--muted); }
.action-row input, .action-row select { padding: 8px 10px; font-size: 12.5px; }

.version-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.version-item:last-child { border-bottom: none; }

.inline-note {
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%; bottom: 32px;
  transform: translate(-50%, 20px);
  padding: 11px 20px;
  border-radius: 12px;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s ease;
  z-index: 100;
  max-width: min(560px, 90vw);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(255, 106, 90, 0.5); color: var(--danger); }

.empty { padding: 34px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* 素材库 */
.mat-filters { gap: 14px; margin-bottom: 16px; align-items: flex-end; }
.inline-field { margin: 0; min-width: 150px; }
.inline-field > span { margin-bottom: 5px; }
.mat-search { width: 240px; }
.mat-count { margin-left: auto; padding-bottom: 10px; }
.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.mat-item { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.mat-item.pending { border-style: dashed; }
.mat-thumb { position: relative; aspect-ratio: 1 / 1; background: #0a0f0b; display: grid; place-items: center; }
.mat-thumb img, .mat-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mat-tag { position: absolute; top: 8px; left: 8px; }
.mat-meta { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.mat-meta strong { font-size: 12.5px; line-height: 1.35; }
.mat-meta .mono { font-size: 10.5px; }
.mat-missing { display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--warn); font-size: 12px; text-align: center; padding: 12px; }
.mat-missing small { color: var(--muted); font-size: 10.5px; line-height: 1.4; }
.mat-pager { margin-top: 16px; justify-content: center; }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .tabs { order: 3; width: 100%; }
  .main { padding: 18px 14px 50px; }
  .action-row { grid-template-columns: 1fr 1fr; }
  .action-row .actions { grid-column: 1 / -1; }
  .mat-search { width: 100%; }
  .mat-count { margin-left: 0; }
}
