/* Vultr 控制台 —— 深空任务控制台方向：精确、冷静、仪器感
   一条石墨蓝黑中性 ramp + 单一冰青强调，状态灯是唯一允许的发光
   状态色（ok/warn/danger）刻意低饱和，呈仪表盘指示气质，不与强调色争抢
   签名细节：HUD 角标 + 实时状态点，贯穿概览、实例、账号健康
   对齐 DESIGN.md：Geist 字体 / 4px 间距网格 / 圆角 8-40px / 标题 18px 600 / 留白 1.5 倍 */

@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/geist.woff2') format('woff2-variations');
}

/* 深色（默认） */
:root {
  --bg: #0b1015;
  --surface: #121920;
  --surface-2: #18212a;
  --input-bg: #0e151b;
  --text: #e8eef4;
  --muted: #93a1ad;
  --line: rgba(147, 161, 173, 0.16);
  --grid: rgba(79, 214, 220, 0.022);
  --accent: #4fd6dc;
  --accent-strong: #7fe8ec;
  --accent-ink: #04191c;
  --accent-soft: rgba(79, 214, 220, 0.1);
  --ok: #56a87c;
  --warn: #c9a15e;
  --danger: #d4716b;
  --danger-soft: rgba(212, 113, 107, 0.12);
  --side-bg: #080d12;
  --side-text: #dde7ef;
  --side-muted: #8796a3;
  --side-hover: #101821;
  --side-active: #16212b;
  --side-line: rgba(255, 255, 255, 0.06);
  --overlay-bg: rgba(4, 7, 10, .72);
  --shadow: rgba(0, 0, 0, .5);
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 16px;
  --font: 'Geist', -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
}

/* 白天模式：中性石墨 + 同一冰青强调，凹面靠表面层级而非阴影 */
:root[data-theme="light"] {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --input-bg: #ffffff;
  --text: #181818;
  --muted: #6A6A6A;
  --line: rgba(27, 36, 48, 0.12);
  --grid: rgba(27, 36, 48, 0.035);
  --accent: #0f8b91;
  --accent-strong: #0b7479;
  --accent-ink: #ffffff;
  --accent-soft: rgba(15, 139, 145, 0.1);
  --ok: #3d8f63;
  --warn: #8a6a2f;
  --danger: #b05347;
  --danger-soft: rgba(176, 83, 71, 0.1);
  --side-bg: #ffffff;
  --side-text: #181818;
  --side-muted: #6A6A6A;
  --side-hover: #f0f3f5;
  --side-active: #e7ecef;
  --side-line: rgba(27, 36, 48, 0.1);
  --overlay-bg: rgba(27, 36, 48, .4);
  --shadow: rgba(27, 36, 48, .14);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: 14px; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::placeholder { color: var(--muted); opacity: .75; }

/* ---------- 工作台骨架：左侧导航 + 内容区 ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 248px;
  background: var(--side-bg); color: var(--side-text);
  border-right: 1px solid var(--side-line);
  display: flex; flex-direction: column; z-index: 20;
}
.side-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 32px 24px; margin-bottom: 16px;
  border-bottom: 1px solid var(--side-line);
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
}
.side-nav { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.side-nav a {
  position: relative;
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 16px;
  border-radius: var(--radius-s); color: var(--side-muted); font-size: 14px;
  transition: background .14s ease, color .14s ease;
}
.side-nav a svg { flex: none; opacity: .9; }
.side-nav a:hover { background: var(--side-hover); color: var(--side-text); }
.side-nav a.active {
  background: var(--side-active); color: var(--side-text);
  box-shadow: inset 0 0 0 1px var(--accent-soft);
}
.side-nav a.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 2px; border-radius: 2px; background: var(--accent);
}
.side-foot {
  margin-top: auto; padding: 24px 32px 32px;
  border-top: 1px solid var(--side-line);
  font-size: 12px; color: var(--side-muted);
}
.side-foot .who { color: var(--side-text); font-size: 14px; margin-bottom: 16px; }
.side-foot .who span { color: var(--side-muted); }
.side-foot button { background: none; border: none; color: var(--side-muted); padding: 0; font-size: 12px; margin-right: 16px; }
.side-foot button:hover { color: var(--accent); }

.main { margin-left: 248px; min-width: 0; }
.page { max-width: none; margin: 0 auto; padding: 48px 48px 96px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.page-head h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.page-actions { display: flex; gap: 8px; }
.subtle { color: var(--muted); font-size: 12px; }

/* ---------- 签名细节：实时状态点（唯一允许的发光） ---------- */
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none;
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 10px var(--accent-soft);
  animation: live 6s ease-in-out infinite;
}
@keyframes live { 0%, 100% { opacity: 1 } 50% { opacity: .55 } }
.st { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.st::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: currentColor; flex: none; box-shadow: 0 0 7px currentColor;
}
.st.ok { color: var(--ok); }
.st.warn { color: var(--warn); }
.st.bad { color: var(--danger); }
.st.accent { color: var(--accent); }

/* ---------- 数字概览：HUD 面板 ---------- */
.stats {
  position: relative; display: flex; margin-bottom: 32px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-m); padding: 24px 0;
}
.stats::before, .stats::after {
  content: ''; position: absolute; width: 14px; height: 14px; pointer-events: none;
}
.stats::before { left: -1px; top: -1px; border-left: 2px solid var(--accent); border-top: 2px solid var(--accent); border-radius: var(--radius-m) 0 0 0; }
.stats::after { right: -1px; bottom: -1px; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); border-radius: 0 0 var(--radius-m) 0; }
.stat { flex: 1; padding: 0 32px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: none; }
.stat-num { font-family: var(--mono); font-size: 26px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: var(--radius-s); padding: 12px 20px; font-weight: 500;
  transition: border-color .14s ease, background .14s ease, color .14s ease;
}
.btn:hover { border-color: var(--muted); background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn-danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn-sm { padding: 8px 12px; font-size: 12px; border-color: transparent; background: transparent; color: var(--muted); }
.btn-sm:hover { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.btn-link { border: none; background: none; padding: 0; color: var(--accent); }

/* ---------- 工具条 ---------- */
.toolbar { display: flex; gap: 12px; margin-bottom: 32px; }
.toolbar .input { max-width: 360px; }
.toolbar .select { max-width: 160px; }

/* ---------- 表格 ---------- */
.group { margin-bottom: 48px; }
.group-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.group-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.group-count { color: var(--muted); font-size: 12px; font-family: var(--mono); font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--muted);
  padding: 0 16px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 16px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .14s ease; }
tbody tr:hover { background: var(--surface); }
.cell-main { font-weight: 500; }
.cell-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.mono { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity .14s ease; white-space: nowrap; }
tbody tr:hover .row-actions, tbody tr:focus-within .row-actions { opacity: 1; }

/* ---------- 标签 ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500;
  padding: 4px 12px; border-radius: var(--radius-s); background: var(--surface-2);
  color: var(--muted); border: 1px solid var(--line);
}
.pill.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 24%, transparent); }
.pill.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 24%, transparent); }
.pill.bad { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 24%, transparent); }
.pill.accent { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 24%, transparent); }

.notice {
  position: relative; padding: 16px 24px; border-radius: var(--radius-m);
  background: var(--surface); border: 1px solid var(--line);
  border-left: 2px solid var(--muted); margin-bottom: 32px; font-size: 14px; color: var(--muted);
}
.notice strong { color: var(--text); font-weight: 600; }
.notice.accent { border-left-color: var(--accent); color: var(--text); }
.notice.danger { border-left-color: var(--danger); color: var(--text); }
.empty { padding: 96px 0; text-align: center; color: var(--muted); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 32px; }
.field label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 12px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 8px; }
.input, .select, .textarea {
  width: 100%; padding: 12px 16px; border: 1px solid var(--line);
  border-radius: var(--radius-s); background: var(--input-bg); color: var(--text); outline: none;
  transition: border-color .14s ease, box-shadow .14s ease;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
/* 浏览器自动填充的黄色高亮盖在深墨主题上非常刺眼，覆盖成主题色 */
.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus,
.input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-out;
}
.input:autofill {
  background-color: var(--input-bg);
  color: var(--text);
}
/* autofill 时保持与常态一致的边框，避免浏览器默认的黄色描边 */
.input:-webkit-autofill:not(:focus) { border-color: var(--line); }
.textarea { min-height: 160px; resize: vertical; font-family: var(--mono); font-size: 12px; line-height: 1.6; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.check { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; font-size: 14px; }
.check input { margin-top: 4px; accent-color: var(--accent); }
.check .hint { display: block; color: var(--muted); font-size: 12px; }

/* ---------- 弹窗 ---------- */
.overlay {
  position: fixed; inset: 0; background: var(--overlay-bg);
  backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 64px 24px; z-index: 50; overflow-y: auto;
}
.modal {
  position: relative;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-l); width: 100%; max-width: 640px; padding: 48px;
  box-shadow: 0 24px 64px var(--shadow);
}
.modal::before {
  content: ''; position: absolute; left: -1px; top: -1px; width: 18px; height: 18px;
  border-left: 2px solid var(--accent); border-top: 2px solid var(--accent);
  border-radius: var(--radius-l) 0 0 0; pointer-events: none;
}
.modal.wide { max-width: 760px; }
.modal h2 { margin: 0 0 32px; font-size: 18px; font-weight: 600; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 32px; }

/* ---------- 登录页：左控制台 / 右舷窗 ---------- */
.login-wrap { display: flex; min-height: 100vh; background: var(--bg); }
.login-left {
  width: 44%; min-width: 420px; display: flex; flex-direction: column; justify-content: center;
  padding: 64px 72px;
}
.login-brand { display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 600; margin-bottom: 64px; }
.login-left h1 { margin: 0 0 16px; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; }
.login-left .field label { font-size: 14px; }
.login-left .input { height: 48px; }
.login-left .btn-primary { height: 48px; width: 100%; margin-top: 12px; }
.login-note {
  margin-top: 32px; padding-left: 16px; border-left: 2px solid var(--line);
  color: var(--muted); font-size: 12px; line-height: 1.8;
}
.theme-link { align-self: flex-start; margin-top: 24px; font-size: 12px; color: var(--muted); }
.theme-link:hover { color: var(--accent); }
.login-right {
  position: relative; flex: 1; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px;
  padding: 48px 48px 80px;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
}
/* HUD 定位角：四角细线，纯装饰但只在此处出现 */
.login-right::before, .login-right::after {
  content: ''; position: absolute; width: 28px; height: 28px; pointer-events: none;
  opacity: .4;
}
.login-right::before { left: 24px; top: 24px; border-left: 1px solid var(--accent); border-top: 1px solid var(--accent); }
.login-right::after { right: 24px; bottom: 24px; border-right: 1px solid var(--accent); border-bottom: 1px solid var(--accent); }

/* 用代码画的控制台预览：展示真实产品内容，不依赖图片 */
.login-console {
  width: 100%; max-width: 620px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-m); box-shadow: 0 32px 80px var(--shadow);
  overflow: hidden;
}
.lc-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 24px; border-bottom: 1px solid var(--line);
  font-size: 14px; font-weight: 600;
}
.lc-tag {
  margin-left: auto; font-family: var(--mono); font-size: 12px; font-weight: 400;
  color: var(--accent); border: 1px solid var(--line);
  border-radius: var(--radius-s); padding: 4px 8px; background: var(--accent-soft);
}
.lc-table { padding: 8px 0; }
.lc-row {
  display: grid; grid-template-columns: 1.3fr .7fr .8fr 1fr;
  align-items: center; gap: 12px; padding: 16px 24px;
  font-size: 14px; border-bottom: 1px solid var(--line);
}
.lc-row:last-child { border-bottom: none; }
.lc-th {
  padding-top: 8px; padding-bottom: 8px;
  font-size: 12px; color: var(--muted);
}
.lc-row .mono { text-align: right; color: var(--muted); }
.lc-foot {
  display: flex; border-top: 1px solid var(--line); background: var(--surface-2);
}
.lc-foot > div { flex: 1; padding: 16px 24px; border-right: 1px solid var(--line); }
.lc-foot > div:last-child { border-right: none; }
.lc-foot b { display: block; font-family: var(--mono); font-size: 20px; font-weight: 500; line-height: 1.2; }
.lc-foot b.mono { color: var(--accent); }
.lc-foot span { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

.login-caption {
  display: flex; align-items: center; gap: 12px;
  color: var(--text); font-size: 14px;
}
.login-caption span { color: var(--muted); font-size: 12px; }

/* ---------- 任务步骤 ---------- */
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.steps li:last-child { border-bottom: none; }
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); opacity: .5; margin-top: 8px; flex: none; }
.step-dot.ok { background: var(--ok); }
.step-dot.running { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.step-dot.fail { background: var(--danger); }
.step-detail { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---------- 行式列表（账号/事件/用户） ---------- */
.rows { display: flex; flex-direction: column; }
.row-item { display: flex; align-items: center; gap: 24px; padding: 32px 0; border-bottom: 1px solid var(--line); }
.row-item:last-child { border-bottom: none; }
.row-item .grow { flex: 1; min-width: 0; }
.row-item .row-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .14s ease; }
.row-item:hover .row-actions, .row-item:focus-within .row-actions { opacity: 1; }
@media (hover: none) { .row-item .row-actions { opacity: 1 } }
.row-item .title { font-weight: 500; }
.row-item .meta { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---------- toast ---------- */
#toast-root { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  padding: 12px 20px; border-radius: var(--radius-s); font-size: 14px; max-width: 420px;
  box-shadow: 0 8px 24px var(--shadow);
}
.toast.bad { border-color: var(--danger); color: var(--danger); }

@media (max-width: 1100px) {
  .login-left { min-width: 0; width: 100%; padding: 48px 32px; }
  .login-right { display: none; }
  .stats { flex-wrap: wrap; }
  .stat { flex: 1 1 40%; padding: 16px 24px; }
}
@media (max-width: 900px) {
  .sidebar { position: static; width: 100%; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { border-top: none; margin-top: 0; }
  .main { margin-left: 0; }
  .page { padding: 32px 24px 64px; }
  .grid-2 { grid-template-columns: 1fr; }
  .modal { padding: 32px; }
  table { display: block; overflow-x: auto; }
  .toolbar { flex-direction: column; }
  .toolbar .input, .toolbar .select { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
  * { transition-duration: .01ms !important; }
}
