/* 海外站工作台（门户皮）—— 颜色全部走内核 tokens，换肤只改 themes/*.css */
:root {
  --ok: #0f6e56; --ok-bg: #e1f5ee;
  --warn: #854f0b; --warn-bg: #faeeda;
  --bad: #a32d2d; --bad-bg: #fcebeb;
  --mono: ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }
.muted { color: var(--text-muted); }
.err { color: var(--danger); font-size: 13px; }

/* login */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-card { background: var(--surface); padding: 32px; border-radius: var(--radius); box-shadow: var(--shadow);
  width: 340px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login-logo { width: 44px; height: 44px; border-radius: 11px; background: var(--accent); color: var(--accent-contrast);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; margin: 0 auto; }
.login-card h1 { font-size: 19px; }
.login-card input { padding: 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--text); font-size: 14px; }
.btn { font-size: 12.5px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font-weight: 500; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.btn.sm { padding: 5px 11px; font-size: 12px; }
.ghost { background: transparent; color: var(--sidebar-text); border: 1px solid rgba(255,255,255,.2);
  padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; }

/* layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: var(--sidebar-bg); color: var(--sidebar-text);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 3px; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 16px; }
.brand .logo { width: 34px; height: 34px; border-radius: 9px; background: #fff; color: var(--sidebar-bg);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; }
.brand .nm { font-size: 15px; font-weight: 600; color: #fff; }
.brand .sb { font-size: 11px; color: #8fa6c0; }
.nav-label { font-size: 11px; letter-spacing: .08em; color: #7f95ad; padding: 12px 8px 5px; text-transform: uppercase; display: flex; align-items: center; }
.nav-label .tool-btn { width: 20px; height: 20px; border-radius: 6px; background: rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center; font-size: 13px; line-height: 1; cursor: pointer; letter-spacing: 0; color: #cfe0f5; }
.nav-label .tool-btn:first-of-type { margin-left: auto; }
.nav-label .tool-btn:hover { background: var(--accent); color: var(--accent-contrast); }
.nav-label .sort-btn.active { background: var(--accent); color: var(--accent-contrast); }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 9px;
  color: var(--sidebar-text); cursor: pointer; font-size: 13.5px; transition: .15s; }
.nav-item:hover { background: rgba(255,255,255,.08); }
.nav-item .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: #5f7a99; }
.nav-item .dot.ok { background: #43d19e; }
.nav-item .dot.warn { background: #f4b740; }
.nav-item .dot.bad { background: #f0736f; }
.nav-item.tool { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); }
.nav-item.tool.alt { background: rgba(56,173,221,.2); border-color: rgba(56,173,221,.45); color: #fff; }
.nav-sep { height: 1px; background: rgba(255,255,255,.12); margin: 12px 4px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 12px; }

/* main */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 62px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 26px; }
.topbar h1 { font-size: 17px; font-weight: 600; }
.topbar .env { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--text-muted); }
.pill { padding: 4px 11px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-contrast);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.content { padding: 24px 26px; overflow: auto; flex: 1; }
.tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.tab { padding: 8px 16px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; font-size: 13px; color: var(--text-muted); font-weight: 500; }
.tab:hover { border-color: var(--text-muted); }
.tab.active { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }

/* stats + cards */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); }
.stat .k { font-size: 12px; color: var(--text-muted); }
.stat .v { font-size: 30px; font-weight: 700; margin-top: 4px; }
.stat .v.ok { color: var(--ok); }
.stat .v.warn { color: var(--warn); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card h3 { font-size: 14.5px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.tag { font-size: 11px; font-weight: 600; color: var(--accent); background: var(--surface-2);
  border: 1px solid var(--border); padding: 2px 8px; border-radius: 6px; }
.act-row { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; }

/* site grid */
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.site { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); transition: .15s; }
.site:hover { border-color: var(--accent); transform: translateY(-2px); }
.site .row1 { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.site .title { font-weight: 600; font-size: 14.5px; }
.site .domain { font-size: 12px; color: var(--text-muted); font-family: var(--mono); }
.site .meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.badge { font-size: 11px; padding: 3px 9px; border-radius: 6px; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text-muted); }
.badge.live { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.pending { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.site .acts { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.field input, .field select { height: 40px; border: 1px solid var(--border); border-radius: 9px;
  padding: 0 12px; font-size: 13.5px; background: var(--surface); color: var(--text); outline: none; }
.field input:focus, .field select:focus { border-color: var(--accent); }
.hint { font-size: 11.5px; color: var(--text-muted); }
.foot { margin-top: 18px; }

/* steps */
.steps { display: flex; flex-wrap: wrap; }
.step { flex: 1; min-width: 118px; padding: 13px 12px; border: 1px solid var(--border);
  border-right: none; background: var(--surface-2); }
.step:first-child { border-radius: 9px 0 0 9px; }
.step:last-child { border-right: 1px solid var(--border); border-radius: 0 9px 9px 0; }
.step .n { width: 22px; height: 22px; border-radius: 50%; background: var(--text-muted); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.step.done .n { background: var(--ok); }
.step.run .n { background: var(--accent); }
.step .t { font-size: 13px; font-weight: 500; }
.step .s { font-size: 11px; color: var(--text-muted); }

/* settings */
.set-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.set { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.set .l { font-size: 13px; font-weight: 500; }
.set .d { font-size: 11px; color: var(--text-muted); }
.switch { width: 40px; height: 22px; border-radius: 20px; background: var(--border); position: relative; cursor: pointer; flex-shrink: 0; }
.switch.on { background: var(--ok); }
.switch::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: .15s; }
.switch.on::after { left: 20px; }

/* db */
.db-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.db-opt { border: 2px solid var(--border); border-radius: 12px; padding: 16px; cursor: pointer; }
.db-opt.sel { border-color: var(--accent); background: var(--surface-2); }
.db-opt .h { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.db-opt .p { font-size: 12px; color: var(--text-muted); }
.flow-note { background: var(--ok-bg); border: 1px solid #9fe1cb; border-radius: 10px;
  padding: 13px 15px; font-size: 12.5px; color: var(--ok); margin-top: 14px; }

/* toast */
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--accent); color: var(--accent-contrast);
  padding: 11px 18px; border-radius: 9px; font-size: 13px; opacity: 0; transform: translateY(8px);
  transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }

/* nav groups + collapse */
.nav-group { display: flex; align-items: center; gap: 7px; padding: 9px 10px 4px;
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #7f95ad;
  cursor: pointer; user-select: none; }
.nav-group:hover { color: #a9c2e6; }
.nav-group .caret { font-size: 10px; width: 10px; display: inline-block; }
.nav-group .cnt { margin-left: auto; font-size: 10px; background: rgba(255,255,255,.12); padding: 1px 6px; border-radius: 8px; }
.nav-item .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .ops { display: flex; gap: 2px; opacity: 0; transition: .15s; flex-shrink: 0; }
.nav-item:hover .ops { opacity: 1; }
.nav-item .ops.show { opacity: 1; }
.nav-item.sorting { background: rgba(255,255,255,.06); }
.nav-item.sorting .op { color: #dbe7f6; }
.nav-item .op { width: 20px; height: 20px; border-radius: 5px; display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #b9cbe4; cursor: pointer; }
.nav-item .op:hover { background: rgba(255,255,255,.18); color: #fff; }
.nav-item .op.danger:hover { background: var(--bad); color: #fff; }
.nav-item.dim { opacity: .45; }

/* 一级 / 二级 导航树（仅"含二级的一级项"出现展开箭头，其余样式不变） */
.nav-item .caret2 { width: 13px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; line-height: 1; color: #9fb6d4; cursor: pointer; }
.nav-item .caret2:hover { color: #fff; }
.nav-item.child { padding-left: 27px; font-size: 13px; color: var(--sidebar-subtext, #9badc4); }
.nav-item.child:hover { color: var(--sidebar-text); }
.nav-item.child .dot { width: 6px; height: 6px; opacity: 1; background: var(--sidebar-dot2, #6ea8fe); }
.sidebar.collapsed .nav-item.child { padding-left: 0; }
.sidebar.collapsed .nav-item .caret2 { display: none; }

.collapse-btn { margin-left: auto; background: rgba(255,255,255,.1); color: #cfe0f5; border: none;
  width: 24px; height: 24px; border-radius: 7px; cursor: pointer; font-size: 13px; line-height: 1; }
.collapse-btn:hover { background: rgba(255,255,255,.2); }
.sidebar.collapsed { width: 66px; padding: 18px 8px; }
.sidebar.collapsed .brand { justify-content: center; padding: 2px 0 14px; }
.sidebar.collapsed .brand .txt,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-group,
.sidebar.collapsed .nav-item .lbl,
.sidebar.collapsed .nav-item .ops,
.sidebar.collapsed .nav-item.tool,
.sidebar.collapsed .ghost { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 11px 0; }
.sidebar.collapsed .collapse-btn { margin: 8px auto 0; display: block; }
.sidebar.collapsed .side-foot { align-items: center; }

/* inline editor */
.ie { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.ie input, .ie select { height: 34px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px;
  font-size: 13px; background: var(--bg); color: var(--text); }
.ie .r { display: flex; gap: 8px; }
.badge.hiddenb { background: var(--surface-2); color: var(--text-muted); border-style: dashed; }

/* 导航项 新增/编辑 模态框 */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center;
  justify-content: center; z-index: 100; padding: 20px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px; width: 620px; max-width: 100%; max-height: 90vh; overflow: auto; }
.modal h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.modal .foot.full { display: flex; gap: 10px; }
.chk { display: flex; align-items: center; gap: 7px; height: 40px; font-size: 13px; color: var(--text); cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--accent); }

/* 凭据中心 */
.cred-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.cred { border: 1px solid var(--border); border-radius: 10px; padding: 12px 13px; background: var(--surface-2); }
.cred .cn { font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.cred .cd { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.cred .cf { display: flex; gap: 8px; margin-top: 10px; }
.cred .cf input { flex: 1; min-width: 0; height: 34px; border: 1px solid var(--border); border-radius: 8px;
  padding: 0 10px; font-size: 13px; background: var(--surface); color: var(--text); }
.cred .cr { margin-top: 7px; font-size: 12px; min-height: 16px; color: var(--text-muted); }
.cred .cr.ok { color: var(--ok); }
.cred .cr.bad { color: var(--bad); }
.cst { font-size: 11px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--border); color: var(--text-muted); }
.cst.on { color: var(--ok); border-color: var(--ok); background: var(--ok-bg); }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

/* 部署步骤的失败 / 跳过态 + 真实执行日志 */
.step.bad { border-color: var(--bad); background: var(--bad-bg); }
.step.bad .n { background: var(--bad); }
.step.bad .t { color: var(--bad); }
.step.skip { background: var(--warn-bg); }
.step.skip .n { background: var(--warn); }
.step.skip .t { color: var(--warn); }
.deploy-log { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.dl { font-size: 12.5px; padding: 8px 11px; border-radius: 8px; background: var(--surface-2);
  border-left: 3px solid var(--text-muted); display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.dl b { font-weight: 500; }
.dl .st { font-size: 11px; padding: 1px 7px; border-radius: 20px; background: var(--surface); color: var(--text-muted); }
.dl.done { border-left-color: var(--ok); }
.dl.skipped { border-left-color: var(--warn); }
.dl.failed { border-left-color: var(--bad); background: var(--bad-bg); }
.dl.running { border-left-color: var(--accent); }
