:root {
  color-scheme: dark;
  --bg: #06101f;
  --panel: rgba(12, 26, 47, 0.94);
  --panel-2: #11213a;
  --line: rgba(155, 190, 224, 0.2);
  --text: #eef7ff;
  --muted: #9db0c7;
  --cyan: #67d7f5;
  --green: #62e0b4;
  --danger: #ff7896;
  --warning: #ffd273;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 4%, rgba(63, 188, 208, 0.18), transparent 30%),
    radial-gradient(circle at 92% 20%, rgba(93, 76, 219, 0.17), transparent 33%),
    linear-gradient(145deg, #071528, var(--bg) 60%, #091728);
}
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.page-shell { width: min(1440px, calc(100% - 32px)); margin: 0 auto 72px; }
.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center;
  color: #052033; font-size: 13px; font-weight: 900;
  background: linear-gradient(135deg, var(--cyan), var(--green));
}
.brand strong, .brand small { display: block; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.top-actions, .gate-actions, .form-actions, .list-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.identity { color: var(--muted); font-size: 13px; }

.button {
  min-height: 40px; padding: 0 17px; border-radius: 12px;
  border: 1px solid var(--line); color: var(--text); cursor: pointer;
  background: rgba(255,255,255,.055); font-weight: 700;
}
.button:hover { border-color: rgba(103,215,245,.55); transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button.primary { color: #062031; border-color: transparent; background: linear-gradient(110deg, var(--cyan), var(--green)); }
.button.danger { color: #ffdbe4; border-color: rgba(255,120,150,.4); background: rgba(122,30,55,.25); }
.button.small { min-height: 34px; padding: 0 11px; font-size: 12px; }

.gate-panel {
  width: min(560px, 100%); margin: 12vh auto 0; padding: 42px;
  text-align: center; border: 1px solid var(--line); border-radius: 24px;
  background: var(--panel); box-shadow: 0 32px 90px rgba(0,0,0,.34);
}
.gate-icon { font-size: 44px; }
.gate-panel h1 { margin: 8px 0 10px; font-size: clamp(28px, 5vw, 42px); }
.gate-panel p:not(.eyebrow) { color: var(--muted); line-height: 1.7; }
.gate-actions { justify-content: center; margin-top: 24px; }
.eyebrow { margin: 0 0 7px; color: var(--cyan); font-weight: 900; letter-spacing: .15em; font-size: 11px; }

.hero { display: flex; justify-content: space-between; gap: 30px; padding: 46px 0 28px; }
.hero h1 { margin: 0 0 10px; font-size: clamp(30px, 4vw, 52px); }
.hero > div > p:last-child { margin: 0; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(110px, 1fr)); gap: 10px; min-width: 390px; }
.metrics div { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.04); }
.metrics strong, .metrics span { display: block; }
.metrics strong { font-size: 25px; }
.metrics span { margin-top: 5px; color: var(--muted); font-size: 12px; }

.panel { margin-top: 18px; padding: 25px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 20px; }
.panel-heading h2 { margin: 0; font-size: 24px; }
.alert { margin: 6px 0 18px; padding: 13px 16px; border-radius: 13px; border: 1px solid rgba(103,215,245,.35); background: rgba(42,128,160,.2); }
.alert.error { color: #ffdbe4; border-color: rgba(255,120,150,.45); background: rgba(130,31,58,.22); }
.alert.success { color: #cffff0; border-color: rgba(98,224,180,.42); background: rgba(27,113,87,.22); }

.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
label { display: flex; flex-direction: column; gap: 7px; color: #c8d7e8; font-size: 13px; font-weight: 700; }
label.wide { grid-column: span 2; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); background: #091426; outline: none; padding: 12px 13px;
}
input, select { min-height: 46px; }
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(103,215,245,.12); }
.file-field span, .muted { color: var(--muted); font-size: 12px; font-weight: 400; }
.publish-toggle { flex-direction: row; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.025); }
.publish-toggle input { width: 20px; min-height: 20px; }
.publish-toggle span, .publish-toggle strong, .publish-toggle small { display: block; }
.publish-toggle small { margin-top: 4px; color: var(--muted); font-weight: 400; }
.form-actions { margin-top: 18px; }
.upload-progress { margin-top: 18px; }
.upload-progress > div { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 13px; }
progress { width: 100%; height: 10px; accent-color: var(--green); }

.list-tools input { width: min(330px, 65vw); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 960px; }
th, td { padding: 14px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 11px; letter-spacing: .08em; }
td { font-size: 13px; }
.program-cell { display: flex; align-items: center; gap: 11px; min-width: 230px; }
.program-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--panel-2); font-size: 19px; }
.program-cell strong, .program-cell small { display: block; }
.program-cell small, .file-meta { margin-top: 3px; color: var(--muted); }
.code { color: #bceeff; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.status.live { color: #bfffe9; background: rgba(32,146,105,.25); }
.status.draft { color: #ffe4a6; background: rgba(145,103,25,.24); }
.status.missing { color: #ffd0db; background: rgba(145,39,69,.25); }
.row-actions { display: flex; gap: 7px; white-space: nowrap; }
.empty-message { text-align: center; color: var(--muted); padding: 28px; }

.audit-list { display: grid; gap: 9px; }
.audit-item { display: grid; grid-template-columns: 150px 1fr auto; gap: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); font-size: 12px; }
.audit-item time, .audit-item span:last-child { color: var(--muted); }

@media (max-width: 920px) {
  .hero { display: block; }
  .metrics { min-width: 0; margin-top: 22px; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { align-items: flex-start; padding: 16px 0; }
  .top-actions { justify-content: flex-end; }
}
@media (max-width: 620px) {
  .page-shell { width: min(100% - 20px, 1440px); }
  .topbar, .panel-heading, .list-heading { display: block; }
  .top-actions, .list-tools { margin-top: 13px; }
  .identity { width: 100%; }
  .gate-panel, .panel { padding: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  label.wide { grid-column: auto; }
  .metrics { grid-template-columns: 1fr; }
  .audit-item { grid-template-columns: 1fr; }
}
