:root {
  --sider: #12352f;
  --sider-text: #e7f3ef;
  --sider-muted: #9fc4ba;
  --accent: #c4622d;
  --accent-ink: #fff8f3;
  --paper: #f6f3ec;
  --card: #fffdf8;
  --ink: #1f2430;
  --line: #e4ddd0;
  --warn: #8a5a12;
  --warn-bg: #f8ead3;
  --danger: #8d2f2f;
  --danger-bg: #f8e4e1;
  --ok: #1f6b45;
  --ok-bg: #e5f4ec;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 14px/1.5 "Segoe UI", "PingFang SC", sans-serif; }
body.locked { overflow: hidden; }
body.locked .shell { display: none; }
body:not(.locked) .login-page { display: none; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 232px 1fr; }
.sider { background: var(--sider); color: var(--sider-text); padding: 18px 12px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; }
.brand strong { display: block; font-size: 16px; }
.brand small { color: var(--sider-muted); }
.mark { width: 36px; height: 36px; border-radius: 10px; display: block; flex: 0 0 auto; }
.group { margin: 14px 8px 6px; color: var(--sider-muted); font-size: 12px; }
.sider button { width: 100%; text-align: left; border: 0; background: transparent; color: var(--sider-text); padding: 9px 10px; border-radius: 8px; }
.sider button.active, .sider button:hover { background: rgba(255, 255, 255, 0.08); }
.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; background: var(--card); border-bottom: 1px solid var(--line); }
.login-page { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: var(--paper); }
.login-card { width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.login-card h1 { font-size: 22px; }
.login-card .mark { width: 48px; height: 48px; margin-bottom: 12px; }
.login-hint { color: #667085; font-size: 12px; }
.login-card button { width: 100%; }
main { padding: 22px; flex: 1; }
h1 { margin: 0 0 4px; font-size: 22px; }
.desc { margin: 0 0 16px; color: #667085; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stats { display: flex; gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; min-width: 96px; }
.stat b { display: block; font-size: 20px; }
.toolbar { display: flex; gap: 8px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.toolbar input { width: auto; min-width: 220px; margin: 0; }
.ops { display: flex; flex-wrap: wrap; gap: 4px; }
.ops button { padding: 4px 8px; white-space: nowrap; }
button.running { opacity: 0.8; }
button.running::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1s infinite;
}
@keyframes pulse { 50% { opacity: 0.25; } }
button.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 8px 12px; }
button.ghost { background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.check input { width: auto; }
textarea, input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; margin: 6px 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { color: #667085; font-weight: 600; font-size: 12px; }
.badge { display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.danger { color: var(--danger); background: var(--danger-bg); }
.badge.ok { color: var(--ok); background: var(--ok-bg); }
.badge.auth-label { margin-left: 6px; vertical-align: 1px; }
button.badge { border: 0; cursor: pointer; font: inherit; }
.logdock { height: 180px; border-top: 1px solid var(--line); background: #10211e; color: #d7ebe4; display: flex; flex-direction: column; }
.logdock header { padding: 8px 16px; color: #9fc4ba; font-size: 12px; }
#log { overflow: auto; padding: 0 16px 12px; font-family: Consolas, monospace; font-size: 12px; }
#log .warn { color: #f0c27a; }
.empty { color: #667085; padding: 18px 0; }
.step { margin-bottom: 14px; }
.step h2 { margin: 0; font-size: 16px; }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.step-num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; }
.source-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.proxy-choice { display: flex; flex-wrap: wrap; gap: 16px; margin: 4px 0 12px; }
.proxy-fields { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; }
.proxy-fields[hidden] { display: none !important; }
.proxy-fields label { display: grid; gap: 4px; color: #667085; font-size: 12px; }
.proxy-fields input[type="number"] { width: 96px; min-width: 0; margin: 0; }
.proxy-fields select { min-width: 220px; margin: 0; }
.source-bar input, .source-bar select, .create-row input, .create-row select { width: auto; min-width: 140px; margin: 0; }
.source-bar .check { margin: 0; white-space: nowrap; }
table input[type="checkbox"] { width: auto; margin: 0; }
#push-model-list[hidden] { display: none; }
.table-scroll { max-height: 320px; overflow: auto; }
.table-scroll.wide table { min-width: 1080px; }
.rebind-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rebind-fields label { display: grid; gap: 4px; color: #667085; font-size: 12px; }
.rebind-fields input { margin: 0; }
.field-hint { margin: 0 0 10px; color: #667085; font-size: 12px; }
@media (max-width: 720px) {
  .rebind-fields { grid-template-columns: 1fr; }
}
.rebind-log { max-height: 220px; overflow: auto; background: #10211e; color: #d7ebe4; border-radius: 8px; padding: 10px 12px; font-family: Consolas, monospace; font-size: 12px; }
.rebind-log .error { color: #f0b4ae; }
.rebind-log .empty { color: #9fc4ba; padding: 0; }
.warn { color: var(--warn); }
#rebind-count { width: 72px; min-width: 72px; }
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .sider { padding-bottom: 8px; }
  main { padding: 16px; }
  .source-bar input, .source-bar select { min-width: 0; flex: 1 1 140px; }
}
