:root {
  --bg: #060911;
  --panel: #0b1120;
  --panel-2: #0e1628;
  --line: rgba(148, 168, 210, 0.16);
  --ink: #eef2fb;
  --muted: #8f9bb7;
  --gold: #d8b273;
  --gold-2: #f0d29a;
  --ok: #5fd68a;
  --err: #ff7a8a;
  --radius: 14px;
  --font: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(122,107,255,.18), transparent 60%),
    radial-gradient(700px 500px at 10% 0%, rgba(77,124,255,.12), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

/* login */
.login-wrap { min-height: 100svh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(100%, 420px);
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.015));
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand div { display: flex; flex-direction: column; line-height: 1.15; }
.login-brand strong { letter-spacing: .22em; font-size: 1rem; }
.login-brand span { color: var(--muted); font-size: .72rem; letter-spacing: .08em; margin-top: 3px; }
.login-card h1 { margin: 0 0 8px; font-size: 1.5rem; }
.login-sub { color: var(--muted); font-size: .86rem; margin: 0 0 24px; }
.lbl { display: block; font-size: .8rem; color: var(--muted); margin: 14px 0 6px; }
.login-card input {
  width: 100%; height: 46px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--line);
  background: rgba(5,7,15,.7); color: var(--ink);
}
.login-card input:focus { outline: none; border-color: rgba(216,178,115,.6); box-shadow: 0 0 0 3px rgba(216,178,115,.12); }
.btn-primary {
  width: 100%; height: 48px; margin-top: 22px; border: 0; border-radius: 999px;
  background: linear-gradient(120deg, var(--gold-2), var(--gold));
  color: #14100a; font-weight: 700; cursor: pointer;
}
.btn-primary:disabled { opacity: .6; cursor: wait; }
.login-msg { min-height: 20px; margin-top: 12px; font-size: .82rem; color: var(--err); }

/* app shell */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: 64px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: rgba(6,9,17,.85);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(14px);
}
.top-brand { display: flex; align-items: center; gap: 10px; }
.top-brand span { display: flex; flex-direction: column; line-height: 1.1; }
.top-brand strong { letter-spacing: .2em; font-size: .92rem; }
.top-brand em { font-style: normal; color: var(--muted); font-size: .68rem; margin-top: 2px; }
.top-actions { display: flex; gap: 10px; }
.ghost {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: transparent;
  color: var(--muted); cursor: pointer; font-size: .8rem;
}
.ghost:hover { color: #fff; border-color: rgba(216,178,115,.4); }

.layout { display: grid; grid-template-columns: 210px minmax(0,1fr); min-height: calc(100svh - 64px); }
.side { padding: 22px 14px; border-right: 1px solid var(--line); background: rgba(255,255,255,.015); }
.side-btn {
  display: block; width: 100%; text-align: left; padding: 11px 14px; margin-bottom: 4px;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted);
  cursor: pointer; font-size: .88rem;
}
.side-btn:hover { background: rgba(255,255,255,.04); color: #fff; }
.side-btn.is-active { background: rgba(216,178,115,.12); color: var(--gold-2); font-weight: 600; }

.main { padding: 30px 32px 70px; max-width: 1180px; }
.main h2 { margin: 0 0 6px; font-size: 1.35rem; }
.main .sub { color: var(--muted); font-size: .84rem; margin: 0 0 24px; }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.btn-save {
  height: 40px; padding: 0 22px; border: 0; border-radius: 999px;
  background: var(--gold); color: #14100a; font-weight: 700; cursor: pointer;
}
.btn-save:disabled { opacity: .6; cursor: wait; }

.card {
  padding: 22px; margin-bottom: 18px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(255,255,255,.022);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head strong { font-size: .95rem; }
.card-head .mini { color: var(--muted); font-size: .74rem; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .76rem; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 9px;
  border: 1px solid var(--line); background: rgba(5,7,15,.6); color: var(--ink);
}
.field textarea { min-height: 90px; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: rgba(216,178,115,.55); box-shadow: 0 0 0 3px rgba(216,178,115,.1);
}
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mini-btn {
  height: 32px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  cursor: pointer; font-size: .76rem;
}
.mini-btn:hover { color: #fff; border-color: rgba(216,178,115,.4); }
.mini-btn.danger:hover { color: var(--err); border-color: rgba(255,122,138,.5); }
.mini-btn.upload { color: var(--gold-2); border-color: rgba(216,178,115,.35); }

.preview { margin-top: 8px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #05070f; }
.preview img { display: block; width: 100%; max-height: 180px; object-fit: cover; }
.preview video { display: block; width: 100%; max-height: 240px; background: #000; }

.empty { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.apps-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.apps-table th, .apps-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.apps-table th { color: var(--muted); font-weight: 500; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  padding: 11px 20px; border-radius: 999px; background: #111a2e; border: 1px solid var(--line);
  color: var(--ink); font-size: .82rem; opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border-color: rgba(95,214,138,.4); }
.toast.err { border-color: rgba(255,122,138,.5); }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .side {
    display: flex; gap: 6px; overflow-x: auto; padding: 12px;
    border-right: 0; border-bottom: 1px solid var(--line); position: sticky; top: 64px; z-index: 15;
    background: rgba(6,9,17,.95);
  }
  .side-btn { width: auto; white-space: nowrap; margin: 0; }
  .main { padding: 22px 16px 60px; }
  .grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .top-actions .ghost:first-child { display: none; }
}
