/* ============ packer_base Web 后台 · 深色科技感主题 ============ */

:root {
  --bg: #060a13;
  --panel: #0c1322;
  --panel-2: #101a2e;
  --panel-3: #16233c;
  --border: #1d2a45;
  --border-strong: #2a3c5f;
  --text: #e2e9f7;
  --muted: #8b9ac0;
  --accent: #3ee6d0;
  --accent-2: #38bdf8;
  --violet: #8b7cf6;
  --green: #3ddc97;
  --red: #ff6b81;
  --blue: #4da3ff;
  --amber: #fbbf24;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html { scrollbar-color: #223052 transparent; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(900px 500px at 85% -10%, rgba(56, 189, 248, .07), transparent 60%),
    radial-gradient(700px 420px at -10% 30%, rgba(139, 124, 246, .06), transparent 60%);
  background-attachment: fixed;
}

::selection { background: rgba(62, 230, 208, .25); }

::-webkit-scrollbar { height: 10px; width: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #223052; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #2c3f6b; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 13px; word-break: break-all; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0; }
.err { color: var(--red); }

/* ============ 顶栏 ============ */

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  height: 60px; padding: 0 clamp(16px, 4vw, 32px);
  background: rgba(7, 11, 22, .82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .5px; }

.brand .mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121a; font-weight: 800; font-size: 14px;
  box-shadow: 0 0 18px rgba(62, 230, 208, .35);
}

.brand .sub { color: var(--muted); font-weight: 400; font-size: 12px; letter-spacing: 0; }

.topbar nav { display: flex; align-items: center; gap: 6px; }

.topbar nav a {
  color: var(--muted); padding: 8px 14px; border-radius: 8px;
  font-size: 13.5px; transition: color .15s, background .15s;
}
.topbar nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.topbar nav a.active {
  color: var(--accent);
  background: rgba(62, 230, 208, .08);
  box-shadow: inset 0 0 0 1px rgba(62, 230, 208, .2);
}
.topbar nav a.logout { color: var(--red); }
.topbar nav a.logout:hover { color: var(--red); background: rgba(255, 107, 129, .1); }

/* ============ 布局 ============ */

.container { max-width: 1200px; margin: 0 auto; padding: 26px clamp(16px, 4vw, 32px) 60px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin: 6px 0 22px;
}
.page-head h2 { margin: 0; font-size: 22px; letter-spacing: .3px; }
.page-head .hint { margin: 6px 0 0; }
.head-actions { display: flex; gap: 10px; align-items: center; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 18px;
}

.panel-title {
  display: flex; align-items: center; gap: 9px;
  margin: 0 0 16px; font-size: 14px; font-weight: 600; letter-spacing: .5px;
}
.panel-title::before {
  content: ''; width: 3px; height: 14px; border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

/* ============ 按钮 ============ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 9px; border: none; cursor: pointer;
  font-size: 14px; font-weight: 600; font-family: inherit;
  background: linear-gradient(135deg, #2dd4bf, #38bdf8); color: #04121a;
  transition: filter .15s, transform .1s, border-color .15s, color .15s, background .15s;
}
.btn:hover { filter: brightness(1.12); text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border-strong); font-weight: 500;
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); filter: none; }

.btn-danger {
  background: rgba(255, 107, 129, .12); color: var(--red);
  box-shadow: inset 0 0 0 1px rgba(255, 107, 129, .3);
}
.btn-danger:hover { background: rgba(255, 107, 129, .2); filter: none; }

.btn-sm { padding: 5px 12px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { padding: 12px 30px; font-size: 15px; }
.btn-block { width: 100%; }

button.link {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent); font-size: 13.5px; font-family: inherit;
  text-decoration: underline;
}
button.link.danger-link { color: var(--red); }
form.inline { display: inline; }

/* ============ 表单 ============ */

select, input[type=text], input[type=password], input[type=file] {
  background: var(--panel-2); border: 1px solid var(--border-strong); color: var(--text);
  padding: 9px 12px; border-radius: 9px; font-size: 14px; font-family: inherit;
  outline: none; max-width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
select:focus, input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(62, 230, 208, .12);
}
select option { background: var(--panel-2); color: var(--text); }

.field { margin: 18px 0; }
.field > label:first-child {
  display: block; font-size: 13px; font-weight: 600; letter-spacing: .3px;
  color: var(--muted); margin-bottom: 8px;
}
.field .hint { margin: 8px 0 0; font-size: 12.5px; }

/* 表单横排(客户管理创建表单) */
.form-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { flex: 1 1 170px; min-width: 170px; margin: 0; }
.form-row .field-btn { flex: 0 0 auto; }
.form-row .field input, .form-row .field select { width: 100%; }

.alert {
  border-radius: 10px; padding: 12px 16px; font-size: 14px; margin: 0 0 18px;
}
.alert.err {
  background: rgba(255, 107, 129, .1);
  border: 1px solid rgba(255, 107, 129, .35);
  color: #ff8fa3;
}

/* ============ 统计卡 ============ */

.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin: 0 0 20px;
}

.stat {
  display: block; color: inherit;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.stat:hover { border-color: var(--border-strong); transform: translateY(-2px); text-decoration: none; }
.stat .n {
  font-size: 26px; font-weight: 700; line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

.stat.total .n {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat.done .n { color: var(--green); }
.stat.failed .n { color: var(--red); }
.stat.running .n { color: var(--blue); }
.stat.pending .n { color: var(--amber); }

.stat.active {
  border-color: rgba(62, 230, 208, .45);
  box-shadow: 0 0 0 1px rgba(62, 230, 208, .25), 0 10px 34px rgba(62, 230, 208, .07);
}

/* ============ 筛选 / 分页 ============ */

.filter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.pager {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin: 20px 0 0; color: var(--muted); font-size: 13.5px;
}
.pager-stub { width: 78px; }

/* ============ 表格 ============ */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--panel);
}

table { width: 100%; border-collapse: collapse; min-width: 900px; }

th {
  text-align: left; padding: 11px 14px; white-space: nowrap;
  font-size: 12px; font-weight: 600; letter-spacing: .5px;
  color: var(--muted); text-transform: uppercase;
  border-bottom: 1px solid var(--border); background: var(--panel-2);
}

td {
  padding: 11px 14px; white-space: nowrap; font-size: 13.5px;
  border-bottom: 1px solid rgba(29, 42, 69, .5);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: rgba(56, 189, 248, .04); }

.fname {
  max-width: 240px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}

.ops a { margin-right: 14px; }
.ops a:hover { text-decoration: underline; }

/* 详情页键值表 */
.panel-kv { padding: 0; overflow-x: auto; }
.panel-kv .panel-title { padding: 18px 20px 0; }
.panel-kv .kv { min-width: 620px; }
.kv th { width: 150px; text-transform: none; letter-spacing: 0; font-size: 13px; vertical-align: top; }
.kv td { white-space: normal; word-break: break-all; }

/* ============ 状态徽章 ============ */

.badge {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}

.badge.done {
  background: rgba(61, 220, 151, .12); color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(61, 220, 151, .3);
}
.badge.failed {
  background: rgba(255, 107, 129, .12); color: var(--red);
  box-shadow: inset 0 0 0 1px rgba(255, 107, 129, .3);
}
.badge.running {
  background: rgba(77, 163, 255, .12); color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(77, 163, 255, .35);
  animation: pulse 1.6s ease-in-out infinite;
}
.badge.pending {
  background: rgba(139, 154, 192, .12); color: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(139, 154, 192, .25);
}

.badge.tg {
  background: rgba(56, 189, 248, .12); color: var(--accent-2);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, .3);
  margin-left: 6px;
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

/* ============ 终端日志 ============ */

.terminal { border-radius: 12px; overflow: hidden; }

.terminal-head {
  display: flex; align-items: center; gap: 7px;
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-bottom: none;
  padding: 9px 14px;
}
.terminal-head span {
  width: 10px; height: 10px; border-radius: 50%;
}
.terminal-head span:nth-child(1) { background: #ff5f57; }
.terminal-head span:nth-child(2) { background: #febc2e; }
.terminal-head span:nth-child(3) { background: #28c840; }
.terminal-head em {
  font-style: normal; font-size: 11.5px; color: var(--muted);
  font-family: var(--mono); margin-left: 6px;
}

pre.log {
  margin: 0;
  background: #05090f;
  border: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
  padding: 16px;
  color: #9fb6d4;
  font-family: var(--mono);
  font-size: 12px; line-height: 1.65;
  overflow-x: auto; max-height: 460px;
  white-space: pre;
}

/* ============ 上传页 ============ */

.switch-row {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
}
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }

.switch {
  position: relative; flex: none;
  width: 44px; height: 22px; border-radius: 999px;
  background: var(--panel-3);
  border: 1px solid var(--border-strong);
  transition: background .15s, border-color .15s;
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #7d8db0;
  transition: transform .15s, background .15s, box-shadow .15s;
}
.switch-row input:checked + .switch {
  background: rgba(62, 230, 208, .25);
  border-color: var(--accent);
}
.switch-row input:checked + .switch::after {
  transform: translateX(22px);
  background: var(--accent);
  box-shadow: 0 0 10px rgba(62, 230, 208, .6);
}
.switch-label { font-size: 14px; }

.mode-fixed {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(62, 230, 208, .06), rgba(56, 189, 248, .05));
  border: 1px solid rgba(62, 230, 208, .25);
  border-radius: 12px; padding: 14px 18px;
}
.mode-fixed-name {
  font-weight: 700; font-size: 15px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.mode-fixed-desc { color: var(--muted); font-size: 12.5px; }

.mode-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.mode-card { display: block; }
.mode-card input { position: absolute; opacity: 0; pointer-events: none; }

.mode-card .card {
  display: block; height: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.mode-card:hover .card { border-color: var(--border-strong); }
.mode-card input:checked + .card {
  border-color: var(--accent);
  background: rgba(62, 230, 208, .05);
  box-shadow: 0 0 0 1px var(--accent), 0 8px 30px rgba(62, 230, 208, .08);
}
.mode-card .card-name { display: block; font-weight: 600; font-size: 14.5px; }
.mode-card .card-desc { display: block; color: var(--muted); font-size: 12px; line-height: 1.55; margin-top: 4px; }

.dropzone {
  display: block;
  border: 1.5px dashed var(--border-strong); border-radius: 12px;
  padding: 30px 20px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--accent);
  background: rgba(62, 230, 208, .04);
}
.dz-icon { font-size: 26px; color: var(--accent); margin-bottom: 8px; }
.dz-text { margin-bottom: 8px; }
.dz-text span { color: var(--text); }
.dropzone.drag .dz-text span { color: var(--accent); }

/* ============ 登录页 ============ */

.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}

.login-body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(56, 189, 248, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, .05) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 75%);
}

.login-box {
  width: 380px; max-width: 94vw;
  background: rgba(12, 19, 34, .92);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 38px 34px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
  position: relative;
}

.login-brand {
  display: flex; align-items: center; gap: 11px;
  font-size: 18px; font-weight: 700; letter-spacing: .5px;
}
.login-brand .mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121a; font-weight: 800; font-size: 17px;
  box-shadow: 0 0 24px rgba(62, 230, 208, .4);
}

.login-sub { color: var(--muted); font-size: 12.5px; margin: 8px 0 26px; }

.login-box input {
  width: 100%; padding: 11px 13px; margin-bottom: 14px;
}

.login-box .alert { margin-bottom: 14px; }

/* ============ 其他 ============ */

.empty { text-align: center; padding: 30px 0 10px; }
