:root {
  --bg: #0f1216;
  --panel: #171c22;
  --panel-2: #1f262e;
  --line: #2a333d;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #d9a13b;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
}

* { box-sizing: border-box; }

/* hidden 属性必须压过组件自身的 display，否则未登录时会露出控制台 */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
}

h1, h2, h3 { margin: 0 0 8px; font-weight: 600; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; color: var(--muted); }

.muted { color: var(--muted); }
.msg { min-height: 18px; color: var(--err); font-size: 13px; }

.login {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.login-card { width: 320px; padding: 28px; }
.login-card h1 { color: var(--accent); }
.login-card label { display: block; margin: 14px 0; font-size: 13px; color: var(--muted); }
.login-card input { width: 100%; margin-top: 6px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}

input, select, textarea, button {
  font: inherit; color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
button { cursor: pointer; }
button:hover { border-color: var(--accent); }

button.primary {
  background: var(--accent); color: #1a1400; border-color: var(--accent);
  font-weight: 600; width: 100%; padding: 9px;
}
button.link { background: none; border: none; color: var(--muted); padding: 0; }
button.link:hover { color: var(--accent); }
button.mini { padding: 3px 8px; font-size: 12px; }

.app { display: flex; min-height: 100vh; }

.side {
  width: 168px; flex: 0 0 168px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 16px 10px;
  position: sticky; top: 0; height: 100vh;
}
.brand { color: var(--accent); font-weight: 700; padding: 0 8px 16px; letter-spacing: 1px; }
#nav { display: flex; flex-direction: column; gap: 4px; }
#nav button {
  background: none; border: none; text-align: left;
  padding: 9px 10px; border-radius: 6px; color: var(--muted);
}
#nav button.active { background: var(--panel-2); color: var(--text); }
.side-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; font-size: 12px; padding: 0 8px; }

.main { flex: 1; padding: 20px 24px 60px; min-width: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 24px; font-weight: 700; margin-top: 4px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tr:hover td { background: #1b2229; }

.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.form-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }

.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 12px; border: 1px solid var(--line); color: var(--muted); }
.tag.ok { color: var(--ok); border-color: #1f5b2c; }
.tag.warn { color: var(--warn); border-color: #5b4a1f; }
.tag.err { color: var(--err); border-color: #5b1f1f; }

.empty { color: var(--muted); padding: 16px 0; text-align: center; }

.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, .72);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal[hidden] { display: none; }
.modal-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px; max-width: 92vw; max-height: 90vh; overflow: auto;
}
.shot { display: block; max-width: 100%; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 6px; }
.log-line { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.log-line .t { color: var(--muted); margin-right: 8px; }
.log-line.err { color: var(--err); }
.log-line.warn { color: var(--warn); }

.adb-box { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }

/* ---------- 特勤处（仿游戏工位卡片） ---------- */
.spec-account { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--muted); }
.spec-account b { color: var(--text); }
.spec-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.spec-card {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, #1c232b, #141920);
  border: 1px solid #303a45; border-radius: 10px; padding: 12px 14px;
}
.spec-card.busy { border-color: #4a3c1d; }
.spec-card.busy::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 100% 0, rgba(217, 161, 59, .12), transparent 62%);
}
.spec-head { display: flex; align-items: center; gap: 10px; }
.spec-icon { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; }
.spec-title b { font-size: 16px; }
.spec-title span { display: block; color: var(--muted); font-size: 12px; }
.spec-live { margin-left: auto; color: var(--accent); font-size: 12px; white-space: nowrap; }
.spec-idle { margin-left: auto; color: var(--muted); font-size: 12px; }
.spec-preview {
  margin-top: 10px; display: flex; align-items: center; gap: 12px;
  min-height: 92px; padding: 8px 10px; border-radius: 8px;
  background: rgba(0, 0, 0, .28); border: 1px solid rgba(255, 255, 255, .05);
}
.spec-preview img { max-width: 132px; max-height: 76px; object-fit: contain; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .5)); }
.spec-empty {
  width: 84px; height: 62px; display: flex; align-items: center; justify-content: center;
  color: var(--muted); border: 1px dashed var(--line); border-radius: 6px;
}
.spec-item .n { font-size: 14px; }
.spec-item .t { color: var(--accent); font-size: 20px; font-variant-numeric: tabular-nums; }
.spec-bar { height: 3px; margin: 10px 0 8px; background: #2a333d; border-radius: 2px; overflow: hidden; }
.spec-bar i {
  display: block; height: 100%; width: 40%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: specflow 2.2s linear infinite;
}
.spec-bar.idle { opacity: .25; }
.spec-bar.idle i { animation: none; width: 0; }
@keyframes specflow {
  from { transform: translateX(-100%); }
  to { transform: translateX(350%); }
}

/* 下达任务：部门 / 物品 / 账号 选择 */
.spec-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.spec-tab {
  display: flex; align-items: center; gap: 9px; padding: 10px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2);
}
.spec-tab img { width: 28px; height: 28px; border-radius: 5px; object-fit: cover; }
.spec-tab b { display: block; font-size: 14px; }
.spec-tab span { display: block; color: var(--muted); font-size: 11px; }
.spec-tab.active { border-color: var(--accent); background: rgba(217, 161, 59, .08); }
.spec-items {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px;
  max-height: 420px; overflow-y: auto; padding-right: 4px;
}
.spec-item-card {
  padding: 10px; text-align: center; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2);
}
.spec-item-card img { height: 66px; max-width: 100%; object-fit: contain; }
.spec-item-card .n { margin-top: 6px; font-size: 13px; }
.spec-item-card.active {
  border-color: var(--accent); background: rgba(217, 161, 59, .07);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.spec-item-card { position: relative; }
.spec-plan-badge {
  position: absolute; top: 6px; left: 6px; padding: 1px 7px; border-radius: 10px;
  background: var(--accent); color: #1a1a1a; font-size: 11px; font-weight: 700;
}
.spec-plan { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.plan-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px;
  border: 1px solid var(--accent); border-radius: 18px; background: rgba(217, 161, 59, .08);
  font-size: 13px;
}
.plan-chip b { color: var(--accent); font-weight: 700; }
.plan-chip i {
  font-style: normal; cursor: pointer; padding: 0 3px; color: var(--muted);
}
.plan-chip i:hover { color: #e05b5b; }
.plan-mini {
  display: inline-block; margin: 2px 4px 2px 0; padding: 1px 7px; border-radius: 10px;
  border: 1px solid var(--line); font-size: 11px; color: var(--muted);
}
.plan-mini.now { border-color: var(--accent); color: var(--accent); }
.acc-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.acc-chip {
  display: inline-flex; flex-direction: column; gap: 2px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2);
  color: var(--text); font-size: 13px; text-align: left; cursor: pointer;
}
.acc-chip span { color: var(--muted); font-size: 11px; }
.acc-chip.on { border-color: var(--accent); background: rgba(217, 161, 59, .10); }
.task-mini {
  display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center;
  padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px;
}
.task-mini:last-child { border-bottom: none; }
.spec-cta:disabled { background: #343a41; color: #8a9098; cursor: not-allowed; box-shadow: none; }
button.mini:disabled { opacity: .45; cursor: not-allowed; }
.spec-auto { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.spec-auto .auto-clear { font-style: normal; color: #e05b5b; cursor: pointer; margin-left: 6px; }
.spec-acc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.spec-acc {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2);
}
.spec-acc b { font-size: 13px; }
.spec-acc span { display: block; color: var(--muted); font-size: 11px; }
.spec-acc.on { border-color: var(--accent); }
.spec-all { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.spec-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.spec-opt { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.spec-cta {
  margin-left: auto; padding: 12px 32px; border: none; border-radius: 8px;
  background: var(--accent); color: #1a1400; font-size: 15px; font-weight: 700;
}
.spec-cta:hover { filter: brightness(1.06); }

/* ---------- 多账号列表：工具条 / 筛选 / 分页 / 批量选择 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.toolbar input { min-width: 180px; flex: 1 1 200px; max-width: 340px; }
.toolbar select { flex: 0 0 auto; }
.table-wrap { overflow-x: auto; }
.cell { vertical-align: top; }
.cell-stack { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; font-size: 12px; }
.cell-stack .plan-mini { margin: 0; }
.acc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.acc-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2);
}
.acc-row .chk {
  width: 18px; height: 18px; flex: 0 0 18px; border: 1px solid var(--line); border-radius: 4px;
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--accent);
}
.acc-row.on { border-color: var(--accent); background: rgba(217, 161, 59, .08); }
.acc-row.focus { box-shadow: inset 2px 0 0 var(--accent); }
.acc-main { min-width: 0; flex: 1; }
.acc-main b, .acc-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-main b { font-size: 13px; }
.acc-main span { color: var(--muted); font-size: 11px; }
.acc-row .tag { margin-left: auto; white-space: nowrap; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 14px; color: var(--muted); }
.tabs button.on { color: var(--text); border-color: var(--accent); background: rgba(217, 161, 59, .08); }

details.fold { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; margin-bottom: 18px; }
details.fold summary { cursor: pointer; color: var(--muted); list-style: none; }
details.fold summary::-webkit-details-marker { display: none; }
details.fold summary::before { content: '+ '; color: var(--accent); font-weight: 700; }
details.fold[open] summary::before { content: '- '; }
details.fold[open] summary { margin-bottom: 12px; color: var(--text); }

@media (max-width: 720px) {
  .spec-grid { grid-template-columns: 1fr; }
  .spec-preview img { max-width: 110px; }
  .spec-item .t { font-size: 18px; }
  .spec-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spec-items { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 330px; }
  .spec-acc-list { grid-template-columns: 1fr; }
  .spec-cta { margin-left: 0; width: 100%; }
  .spec-foot { gap: 10px; }
  .app { flex-direction: column; }

  /* 底部导航：4 列均分，7 个入口 + 退出正好两行 */
  .side {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 40;
    width: auto; height: auto; margin: 0;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: var(--panel); border-right: none; border-top: 1px solid var(--line);
  }
  .brand { display: none; }
  #nav { display: contents; }
  #nav button {
    background: none; border: none; border-radius: 8px;
    padding: 8px 2px; font-size: 12px; line-height: 1.2;
    text-align: center; white-space: nowrap; color: var(--muted);
  }
  #nav button.active { background: var(--panel-2); color: var(--accent); font-weight: 600; }
  .side-foot {
    margin: 0; align-self: center; padding: 0 2px 0 6px;
    flex-direction: column; justify-content: center; gap: 2px; font-size: 12px;
  }
  .side-foot #who { display: none; }
  .side-foot .link { padding: 8px 4px; font-size: 13px; }

  .main { padding: 12px 12px calc(124px + env(safe-area-inset-bottom, 0px)); }
  h1 { font-size: 18px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .k { font-size: 12px; }
  .stat .v { font-size: 22px; }
  .panel { padding: 12px 14px; }
  .panel-head { gap: 8px; margin-bottom: 10px; }
  .panel-head h2 { font-size: 16px; }

  /* 表格改成一张张卡片：每格带字段名，彻底避免横向挤压 */
  table { display: block; min-width: 0; }
  table thead { display: none; }
  table tbody { display: block; }
  table tr {
    display: block; margin-bottom: 10px; padding: 4px 12px;
    background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  }
  tr:hover td { background: transparent; }
  table tr.is-empty { border: none; background: none; padding: 0; }
  table td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    flex-wrap: wrap; padding: 6px 0; border-bottom: 1px dashed var(--line);
    font-size: 13px; white-space: normal; text-align: right;
  }
  table tr td:last-child { border-bottom: none; }
  table td::before {
    content: attr(data-label); flex: 0 0 auto;
    color: var(--muted); font-size: 12px; text-align: left;
  }
  table td.empty { display: block; text-align: center; padding: 10px 0; }
  table td.empty::before { content: none; }
  td .mini { margin: 2px 0 2px 6px; padding: 7px 12px; font-size: 12.5px; }

  /* 表单一行一个，输入框占满，点击区域更大 */
  .form-row { gap: 10px; }
  .form-row > label { flex: 1 1 100%; font-size: 13px; }
  .form-row > label > span { font-size: 13px; }
  .form-row > label input:not([type="checkbox"]),
  .form-row > label select,
  .form-row > label textarea { width: 100% !important; }
  .form-row > button { flex: 1 1 100%; }

  /* 工具条：输入框占满一行，按钮自动换行；账号列表单列 */
  .toolbar input, .toolbar select { flex: 1 1 100%; max-width: none; width: 100%; }
  .toolbar > button { flex: 0 1 auto; }
  .acc-list { grid-template-columns: 1fr; }
  .tabs button { flex: 1 1 auto; text-align: center; }
  input, select, textarea { font-size: 16px; padding: 10px 12px; }
  input[type="checkbox"] { width: 22px; height: 22px; }
  button.mini { padding: 7px 12px; font-size: 13px; }

  .log-line { overflow-wrap: anywhere; }
  .modal-box { width: 100%; padding: 14px; }
  .login { padding: 16px; }
  .login-card { width: 100%; max-width: 360px; padding: 22px; }
}
