/* 星核后台 · Stellar Core 设计系统
   令牌 → 布局 → 组件 → 页面。修改配色只需改 :root。 */
:root {
  color-scheme: dark;
  --void: #060913;
  --deep: #0b1120;
  --panel: #0f1628;
  --panel-hi: #151e36;
  --orbit: #222c49;
  --orbit-hi: #34416a;
  --fg: #eef2ff;
  --muted: #8b96b8;
  --core: #ffb454;
  --core-hot: #fff1c9;
  --core-ember: #ff7a3d;
  --core-grad: linear-gradient(135deg, #fff1c9 0%, #ffb454 45%, #ff7a3d 100%);
  --ion: #7fa2ff;
  --ok: #4fe3c1;
  --danger: #ff6b7a;
  --radius: 14px;
  --font: "Bahnschrift", "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-family: var(--font);
  line-height: 1.55;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; color: var(--fg);
  background:
    radial-gradient(900px 520px at 100% -10%, rgba(255, 150, 70, .10), transparent 60%),
    radial-gradient(700px 480px at 0% 110%, rgba(110, 140, 255, .10), transparent 60%),
    var(--void);
  background-attachment: fixed;
}
a { color: var(--core); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--core); outline-offset: 3px; border-radius: 6px; }
code { font-family: var(--mono); font-size: .92em; overflow-wrap: anywhere; color: var(--core-hot); }
p { margin: 12px 0; }
h1 { font-size: clamp(26px, 3.6vw, 38px); line-height: 1.15; margin: 0; letter-spacing: -.02em; font-weight: 700; overflow-wrap: anywhere; }
h2 { margin: 0 0 4px; font-size: 18px; font-weight: 650; letter-spacing: .01em; }

/* ── 外壳:左侧导轨 ───────────────────────── */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; padding: 26px 18px;
  display: flex; flex-direction: column; gap: 28px;
  background: linear-gradient(180deg, rgba(15, 22, 40, .92), rgba(8, 12, 24, .92));
  border-right: 1px solid var(--orbit);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--fg); padding: 0 6px; }
.brand-mark { width: 38px; height: 38px; flex: none; filter: drop-shadow(0 0 10px rgba(255, 170, 80, .45)); }
.brand strong { display: block; font-size: 20px; letter-spacing: .08em; line-height: 1.1; }
.brand small { color: var(--muted); font-size: 12px; }
.rail-nav { display: grid; gap: 4px; }
.rail-nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 550; font-size: 14px;
  border: 1px solid transparent; transition: color .15s, background .15s;
}
.rail-nav a:hover { color: var(--fg); background: var(--panel); }
.rail-nav a[aria-current=page] { color: var(--core-hot); background: var(--panel-hi); border-color: var(--orbit-hi); }
.rail-nav svg { width: 18px; height: 18px; flex: none; }
.rail-foot { margin-top: auto; }
.content { padding: 40px clamp(20px, 4vw, 56px) 72px; max-width: 1180px; width: 100%; }

/* ── 表单控件 ─────────────────────────────── */
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 600; }
input:not([type=hidden]), select, button { min-height: 42px; border: 1px solid var(--orbit); border-radius: 10px; padding: 8px 12px; font: inherit; }
input:not([type=hidden]), select {
  width: 100%; min-width: 0; font-size: 15px; color: var(--fg); background: var(--void);
  transition: border-color .15s, box-shadow .15s;
}
input:not([type=hidden]):hover, select:hover { border-color: var(--orbit-hi); }
input:not([type=hidden]):focus, select:focus { outline: none; border-color: var(--core); box-shadow: 0 0 0 3px rgba(255, 180, 84, .18); }
input::placeholder { color: #566086; }
input:disabled, select:disabled { opacity: .5; cursor: not-allowed; }
input[type=number] { width: 110px; }
input[type=file] { padding: 5px 8px; border-style: dashed; }
input[type=file]::file-selector-button { border: 0; border-radius: 7px; padding: 6px 12px; margin-right: 10px; color: var(--fg); background: var(--panel-hi); cursor: pointer; font: inherit; font-size: 13px; }
button {
  color: #2a1604; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; border: 0;
  background: var(--core-grad); box-shadow: 0 0 0 1px rgba(255, 220, 160, .35) inset, 0 6px 18px -8px rgba(255, 140, 60, .8);
  transition: transform .12s, box-shadow .15s, filter .15s;
}
button:hover { filter: brightness(1.07); box-shadow: 0 0 0 1px rgba(255, 220, 160, .5) inset, 0 8px 22px -6px rgba(255, 140, 60, .9); }
button:active { transform: translateY(1px); }
button.quiet { color: var(--fg); background: var(--panel-hi); border: 1px solid var(--orbit-hi); box-shadow: none; font-weight: 600; }
button.quiet:hover { border-color: var(--core); }
button.danger { color: var(--danger); background: transparent; border: 1px solid rgba(255, 107, 122, .4); box-shadow: none; padding: 3px 11px; min-height: 32px; font-weight: 600; }
button.danger:hover { background: rgba(255, 107, 122, .12); border-color: var(--danger); }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.grow { flex: 1 1 12rem; }

/* ── 通用组件 ─────────────────────────────── */
.panel {
  position: relative; padding: 24px; margin-bottom: 18px; border-radius: 18px;
  background: linear-gradient(180deg, var(--panel), var(--deep));
  border: 1px solid var(--orbit);
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.muted, .empty { color: var(--muted); font-size: 13px; }
.empty { padding: 22px; text-align: center; border: 1px dashed var(--orbit-hi); border-radius: var(--radius); }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--orbit-hi); border-radius: 20px; padding: 3px 10px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .6; }
.pill.on { color: var(--core-hot); border-color: rgba(255, 180, 84, .5); background: rgba(255, 180, 84, .10); }
.pill.on::before { opacity: 1; background: var(--core); box-shadow: 0 0 8px var(--core); }
.notice {
  display: flex; gap: 10px; align-items: center; padding: 12px 16px; margin: 0 0 20px; font-size: 14px;
  background: var(--panel); border: 1px solid var(--orbit-hi); border-left-width: 3px; border-radius: 12px; color: var(--fg);
}
.notice.error { border-left-color: var(--danger); }
.notice.success { border-left-color: var(--ok); }
.notice.success::before { content: "✓"; color: var(--ok); font-weight: 700; }
.notice.error::before { content: "!"; color: var(--danger); font-weight: 700; }

/* ── 页面标题与统计 ───────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.heading { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 10px 0 24px; }
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); text-decoration: none; font-size: 14px; }
.back:hover { color: var(--core-hot); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 30px; }
.stat { padding: 16px 18px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--orbit); }
.stat b { display: block; font-size: 30px; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--core-hot); }
.stat span { color: var(--muted); font-size: 13px; }

/* ── 项目列表 ─────────────────────────────── */
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 34px 0 14px; }
.section-title h2 { margin: 0; font-size: 20px; }
.section-title h2 small { color: var(--muted); font-size: 13px; font-weight: 500; margin-left: 8px; }
.create { position: relative; }
.create summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 14px; border-radius: 10px; border: 1px solid var(--orbit-hi); background: var(--panel-hi); font-size: 14px; font-weight: 600; }
.create summary::-webkit-details-marker { display: none; }
.create summary:hover, .create[open] summary { border-color: var(--core); color: var(--core-hot); }
.create form { margin-top: 12px; padding: 18px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--orbit-hi); }
.project-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 14px; }
.project-card {
  display: grid; grid-template-columns: 54px 1fr; gap: 14px; align-items: center; margin: 0; padding: 18px;
  color: var(--fg); text-decoration: none; overflow: hidden;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.project-card:hover { border-color: rgba(255, 180, 84, .6); transform: translateY(-2px); box-shadow: 0 14px 34px -18px rgba(255, 140, 60, .6); }
.ring { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(from 210deg, var(--orbit-hi), var(--orbit) 70%, var(--orbit-hi)); }
.ring::after { content: ""; width: 46px; height: 46px; border-radius: 50%; background: var(--void); grid-area: 1 / 1; }
.ring i { grid-area: 1 / 1; z-index: 1; width: 12px; height: 12px; border-radius: 50%; background: var(--orbit-hi); }
.ring.on { background: var(--core-grad); box-shadow: 0 0 22px -4px rgba(255, 150, 60, .7); }
.ring.on i { background: var(--core-hot); box-shadow: 0 0 12px var(--core); }
.project-body { min-width: 0; display: grid; gap: 4px; }
.project-name { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.project-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px; }

/* ── 标签页(无 JS 时全部展开) ─────────────── */
.tabs { display: flex; gap: 4px; margin: 0 0 20px; padding: 4px; width: fit-content; max-width: 100%; overflow-x: auto; border-radius: 12px; background: var(--deep); border: 1px solid var(--orbit); }
.tabs a { padding: 8px 18px; border-radius: 9px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; white-space: nowrap; }
.tabs a:hover { color: var(--fg); }
.tabs a[aria-selected=true] { color: #2a1604; background: var(--core-grad); }
.brand-defs { position: absolute; }
.tab-panel[hidden] { display: none; }

/* ── 表格 ─────────────────────────────────── */
.scroll { overflow-x: auto; margin-top: 18px; border: 1px solid var(--orbit); border-radius: var(--radius); }
.scroll table { min-width: 560px; width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
th, td { border-bottom: 1px solid var(--orbit); padding: 12px 14px; overflow-wrap: anywhere; max-width: 240px; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; background: var(--deep); font-size: 12px; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(127, 162, 255, .05); }
tr.live td:first-child { box-shadow: 3px 0 0 var(--core) inset; }
td form.row { gap: 8px; flex-wrap: nowrap; }
.hash { cursor: copy; border-bottom: 1px dotted var(--muted); }
.hash.copied { color: var(--ok); }
.filter { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--orbit); }
.pager { display: flex; gap: 16px; font-size: 13px; align-items: center; padding-top: 16px; }
details > summary { cursor: pointer; color: var(--muted); font-size: 13px; padding-top: 18px; }
.danger-zone { margin-top: 26px; padding: 18px; border: 1px dashed rgba(255, 107, 122, .4); border-radius: var(--radius); }
.danger-zone h2 { color: var(--danger); font-size: 16px; }

/* ── 登录页:核心与轨道 ───────────────────── */
body.is-login { display: grid; place-items: center; overflow: hidden; }
.stage { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; }
.stage .orbit { position: absolute; border-radius: 50%; border: 1px solid var(--orbit); animation: spin 90s linear infinite; }
.stage .orbit::after { content: ""; position: absolute; top: -4px; left: 50%; width: 7px; height: 7px; border-radius: 50%; background: var(--core-hot); box-shadow: 0 0 14px 2px var(--core); }
.stage .o1 { width: 420px; height: 420px; }
.stage .o2 { width: 680px; height: 680px; animation-duration: 140s; animation-direction: reverse; border-color: rgba(34, 44, 73, .7); }
.stage .o2::after { background: var(--ion); box-shadow: 0 0 12px 2px var(--ion); left: 14%; top: 14%; }
.stage .o3 { width: 980px; height: 980px; animation-duration: 220s; border-color: rgba(34, 44, 73, .4); }
.stage .o3::after { display: none; }
.stage .glow { position: absolute; width: 340px; height: 340px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 180, 84, .38), rgba(255, 122, 61, .10) 45%, transparent 70%); animation: ignite 2.4s ease-out both; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ignite { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }
.login-card { position: relative; width: min(400px, calc(100vw - 32px)); padding: 34px 30px 30px; border-radius: 22px; background: rgba(11, 17, 32, .82); backdrop-filter: blur(14px); border: 1px solid var(--orbit-hi); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9); }
.login-card .brand-mark { width: 52px; height: 52px; margin-bottom: 18px; }
.login-card h1 { font-size: 26px; margin-bottom: 6px; }
.login-card .notice { margin-bottom: 16px; }

/* ── 响应式与动效偏好 ─────────────────────── */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; padding: 12px 16px; gap: 12px; border-right: 0; border-bottom: 1px solid var(--orbit); }
  .brand small, .rail-nav a span { display: none; }
  .rail-nav { display: flex; margin-left: auto; }
  .rail-foot { margin: 0; }
  .content { padding: 24px 16px 56px; }
}
@media (max-width: 560px) {
  .panel { padding: 18px; }
  td form.row { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .stage .orbit, .stage .glow { animation: none; }
  .project-card, button { transition: none; }
}
