:root {
  --bg: #0f1420;
  --panel: #171e2e;
  --panel2: #1e2637;
  --line: #2a3448;
  --text: #e8ecf4;
  --muted: #93a0b8;
  --accent: #4f8cff;
  --accent-2: #2f6fe0;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang TC", "Noto Sans TC", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 18px 28px; background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 42px; height: 42px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 24px; font-weight: 800;
  display: grid; place-items: center;
}
.brand h1 { font-size: 20px; font-weight: 800; }
.brand .sub { font-size: 13px; color: var(--muted); }
.tabs { display: flex; gap: 6px; }
.tab {
  background: transparent; color: var(--muted);
  border: 1px solid transparent; border-radius: 9px;
  padding: 9px 18px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.tab:hover { color: var(--text); background: var(--panel2); }
.tab.active { color: #fff; background: var(--accent-2); }

main { max-width: 1100px; margin: 0 auto; padding: 26px 20px 60px; }
.panel { display: none; }
.panel.active { display: block; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 780px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; margin-bottom: 18px;
}
.card h2 { font-size: 17px; margin-bottom: 16px; }

/* Dropzone */
.dropzone {
  border: 2px dashed var(--line); border-radius: 11px;
  padding: 34px 18px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone.drag { border-color: var(--accent); background: rgba(79,140,255,.08); }
.dz-main { font-size: 15px; }
.dz-hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.link { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.thumb {
  position: relative; width: 84px; height: 84px; border-radius: 9px;
  overflow: hidden; border: 1px solid var(--line); background: var(--panel2);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .rm {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px;
  border-radius: 50%; border: none; background: rgba(0,0,0,.65); color: #fff;
  cursor: pointer; font-size: 13px; line-height: 20px;
}
.thumb .pg { position: absolute; bottom: 0; left: 0; right: 0; font-size: 10px; text-align: center; background: rgba(0,0,0,.6); }

/* Fields */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea, .reg-editor {
  width: 100%; background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
  font: inherit; resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus, .reg-editor:focus {
  outline: none; border-color: var(--accent);
}

.btn {
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 18px;
  font: inherit; font-weight: 600; cursor: pointer; background: var(--panel2); color: var(--text);
}
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #fff; width: 100%; padding: 12px; font-size: 15px; }
.btn.primary:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--panel2); }
.status { font-size: 13.5px; margin-top: 10px; min-height: 20px; }
.status.err { color: var(--bad); }
.status.ok { color: var(--ok); }
.status.busy { color: var(--accent); }

.hidden { display: none !important; }

/* Report */
.report-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.report-actions { display: flex; align-items: center; gap: 8px; }
.meta { font-size: 12.5px; color: var(--muted); }

.markdown { font-size: 14.5px; }
.markdown h1 { font-size: 20px; margin: 18px 0 10px; }
.markdown h2 { font-size: 17px; margin: 18px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--line); }
.markdown h3 { font-size: 15px; margin: 14px 0 6px; }
.markdown p { margin: 8px 0; }
.markdown ul, .markdown ol { margin: 8px 0 8px 22px; }
.markdown table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13.5px; display: block; overflow-x: auto; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: top; }
.markdown th { background: var(--panel2); }
.markdown blockquote { border-left: 3px solid var(--accent); padding: 4px 12px; margin: 10px 0; color: var(--muted); background: var(--panel2); border-radius: 0 8px 8px 0; }
.markdown code { background: var(--panel2); padding: 1px 6px; border-radius: 5px; font-size: 13px; }
.markdown strong { color: #fff; }

/* History */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.hist-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 9px; cursor: pointer;
}
.hist-item:hover { border-color: var(--accent); }
.hist-item .h-name { font-weight: 600; }
.hist-item .h-sub { font-size: 12.5px; color: var(--muted); }
.pills { display: flex; gap: 6px; flex-shrink: 0; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.pill.bad { background: rgba(248,113,113,.16); color: var(--bad); }
.pill.warn { background: rgba(251,191,36,.16); color: var(--warn); }
.pill.ok { background: rgba(52,211,153,.16); color: var(--ok); }

/* Admin */
.admin-note { font-size: 13.5px; color: var(--muted); margin-bottom: 14px; }
.reg-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.reg-tab { padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--muted); cursor: pointer; font-weight: 600; font-size: 14px; }
.reg-tab.active { background: var(--accent-2); color: #fff; border-color: transparent; }
.reg-editor { font-family: "SF Mono", Menlo, monospace; font-size: 13px; line-height: 1.5; min-height: 380px; }
.reg-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }

.foot { text-align: center; font-size: 12.5px; color: var(--muted); padding: 24px 20px 40px; max-width: 800px; margin: 0 auto; }
