/* Pages 控制台样式。单文件、无构建、无外部依赖——CSP 禁止加载任何外部资源。 */
:root {
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1c2430;
  --border: #2a3441;
  --text: #e4e8ee;
  --muted: #8b97a8;
  --accent: #4d9fff;
  --accent-hover: #6bb0ff;
  --danger: #ff6b6b;
  --ok: #47c97e;
  --warn: #f0b849;
  --radius: 8px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }
.pad { padding: 12px 16px; }
.spacer { flex: 1; }
.error { color: var(--danger); }
.ok { color: var(--ok); }

/* ---------- 登录 ---------- */
.centered { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.narrow { width: 100%; max-width: 360px; }
.card h1 { margin: 0 0 4px; font-size: 22px; }
.card > p { margin: 0 0 20px; }

label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }

input[type=text], input[type=password] {
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

button {
  font: inherit;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: var(--accent); color: #06121f; font-weight: 600; }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.ghost:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }
.danger { background: transparent; color: var(--danger); border-color: #4a2626; }
.danger:hover:not(:disabled) { background: #2a1618; }
.small { padding: 5px 12px; font-size: 13px; }
#login-form button { width: 100%; }

/* ---------- 布局 ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px; height: 52px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.brand { font-weight: 700; font-size: 16px; letter-spacing: -.2px; }
.brand .dot { color: var(--accent); }

.layout { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - 52px); }
.sidebar { border-right: 1px solid var(--border); background: var(--surface); }
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
}
.sidebar-head h2 { margin: 0; font-size: 13px; text-transform: uppercase; color: var(--muted); letter-spacing: .6px; }

.project-list { list-style: none; margin: 0; padding: 0 8px 16px; }
.project-list li { margin-bottom: 2px; }
.project-list button {
  width: 100%; text-align: left; background: transparent; color: var(--text);
  border: none; padding: 8px 10px; border-radius: 6px; display: block;
}
.project-list button:hover { background: var(--surface-2); }
.project-list button.active { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--accent); }
.project-list .name { font-weight: 500; }
.project-list .sub { font-size: 11px; color: var(--muted); font-family: var(--mono); }

.detail { padding: 24px 28px; overflow-x: auto; }
.placeholder { display: grid; place-items: center; height: 60vh; }

/* ---------- 详情 ---------- */
.detail h2 { margin: 0 0 2px; font-size: 20px; }
.site-url { font-family: var(--mono); font-size: 13px; color: var(--accent); text-decoration: none; }
.site-url:hover { text-decoration: underline; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 18px;
}
.panel h3 { margin: 0 0 12px; font-size: 14px; }
.panel-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* 拖拽上传区 */
.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  transition: border-color .15s, background .15s;
}
.dropzone.over { border-color: var(--accent); background: rgba(77,159,255,.06); color: var(--text); }
.dropzone strong { color: var(--text); display: block; margin-bottom: 4px; }

.progress { height: 4px; background: var(--surface-2); border-radius: 2px; margin-top: 14px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .15s; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tbody tr:last-child td { border-bottom: none; }
td.mono, th.mono { font-family: var(--mono); font-size: 12px; }
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 10px;
  font-size: 11px; background: var(--surface-2); color: var(--muted);
}
.badge.live { background: rgba(71,201,126,.14); color: var(--ok); }

/* 代码块 */
pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  margin: 0;
}
.token-box {
  display: flex; gap: 8px; align-items: center;
  background: var(--bg); border: 1px solid var(--warn);
  border-radius: 6px; padding: 10px 12px; margin: 10px 0;
}
.token-box code { font-family: var(--mono); font-size: 12px; word-break: break-all; flex: 1; }

/* ---------- 弹窗 / 提示 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: grid; place-items: center; padding: 24px; z-index: 20;
}
.modal-box { width: 100%; max-width: 460px; }
.modal-box h3 { margin: 0 0 14px; font-size: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 10px 18px; border-radius: 20px; z-index: 30;
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
.toast.bad { border-color: var(--danger); color: var(--danger); }

@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--border); }
  .detail { padding: 18px 16px; }
}
