/* app.css —— 只补 art-kit 没覆盖的「本项目特有结构」：登录页、导航态、表格密度。
   原则：颜色/字号/圆角/阴影一律用 tokens.css 的 var()，不新增任何字面色值。
   凡是 ui.css 已有的组件（btn/card/table/badge/stat）都不在这里重画。 */

/* ------------------------------------------------------------------ 登录页 */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.login-wrap { width: 100%; max-width: 380px; }
.login-card { border-radius: var(--radius); }
.login-brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 4px 0 2px;
  letter-spacing: .5px;
}
.login-sub {
  margin: 0 0 18px;
  font-size: var(--fs-xs);
  color: var(--ink-4);
}
.login-hint {
  margin: 14px 0 0;
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--ink-4);
}
.login-err {
  margin: 0 0 12px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
}

/* 登录页表单：ui.css 的 .field 需要一点垂直节奏 */
.login-card .field { display: block; margin-bottom: 12px; }
.login-card .field > span {
  display: block;
  font-size: var(--fs-xs);
  color: var(--ink-3);
  margin-bottom: 5px;
  font-weight: 550;
}
.login-card .field > input {
  width: 100%;
  min-height: var(--tap);
  padding: 0 11px;
  font-size: var(--fs-sm);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
}
.login-card .field > input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .16);
}

/* ------------------------------------------------------------------ 顶栏 / 导航 */
.page-title {
  font-size: var(--fs-sm);
  color: var(--ink-3);
  padding-left: 9px;
  margin-left: 3px;
  border-left: 1px solid var(--line);
  line-height: 1.2;
}
.who { font-size: var(--fs-xs); color: var(--ink-4); margin-right: 4px; }

.auth-split { display: flex; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: var(--tap);
  padding: 0 11px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  text-decoration: none;
  font-size: var(--fs-sm);
  transition: background .12s ease, color .12s ease;
}
.nav-item + .nav-item { margin-top: 2px; }
.nav-item:hover { background: var(--glass-3); color: var(--ink); }
.nav-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .18);
}
.nav-item[aria-current="page"] {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
}
.nav-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 12px;
  color: var(--ink-4);
  flex: 0 0 auto;
}
.nav-item[aria-current="page"] .nav-ico { color: var(--brand); }

/* ------------------------------------------------------------------ 内容区 */
.loading-slot,
.empty-slot {
  padding: 28px 4px;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--ink-4);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 0 9px;
}
.section-title h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
}
.section-title .hint { font-size: var(--fs-xs); color: var(--ink-4); }

/* 主表：一行 44px，一屏 12~14 行。表格绝不半透明（见 CONTRACT-v2 §6）。 */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dense-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.dense-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-4);
  background: var(--surface);
  padding: 8px 9px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.dense-table tbody td {
  height: 44px;
  padding: 0 9px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}
.dense-table tbody tr:hover td { background: var(--brand-soft); }
.dense-table .num { font-variant-numeric: tabular-nums; }
.dense-table .mono { font-family: var(--mono); font-size: var(--fs-xs); }
.dense-table .actions { display: flex; gap: 5px; }

/* 分组头：代理名 + 待跑人数 + 余额 + 预计花费 */
.group-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}
.group-name { font-weight: 650; color: var(--ink); font-size: var(--fs-sm); }
.group-meta { font-size: var(--fs-xs); color: var(--ink-4); }
.group-meta b { color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* 余额为负（欠款）：数字标红 + 后缀 */
.money-neg { color: var(--danger); font-weight: 650; }
.money-pos { color: var(--ok); font-weight: 600; }

/* 今日状态徽标 */
.mark-done { color: var(--ok); }
.mark-bad { color: var(--danger); }
.mark-void { color: var(--ink-4); }
.mark-none { color: var(--ink-4); }

/* 复制按钮：图标化，不抢注意力 */
.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: 5px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink-3);
  font-size: 10px;
  cursor: pointer;
  vertical-align: middle;
}
.copy-btn:hover { border-color: var(--ink-4); color: var(--ink); }
.copy-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.copy-btn[data-done="1"] { color: var(--ok); border-color: #bbf7d0; background: var(--ok-soft); }

/* 折叠区（跑不了） */
.fold {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}
.fold > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 13px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before {
  content: "▸";
  font-size: 10px;
  color: var(--ink-4);
  transition: transform .15s ease;
}
.fold[open] > summary::before { transform: rotate(90deg); }
.fold-body { padding: 2px 13px 12px; }
.blocked-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  font-size: var(--fs-sm);
  color: var(--ink-2);
}
.blocked-row + .blocked-row { border-top: 1px dashed var(--line); }

/* 汇总行 */
.table-sum {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 10px 13px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--ink-4);
}
.table-sum b { color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ 筛选栏 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 9px;
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
}
.filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--fs-xs);
  color: var(--ink-3);
}
.filter-bar input,
.filter-bar select {
  min-height: 34px;
  padding: 0 9px;
  font-size: var(--fs-sm);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
}
.filter-bar input:focus,
.filter-bar select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .16);
}
.filter-bar .grow { flex: 1 1 180px; }

/* ------------------------------------------------------------------ 分页 */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 11px 13px;
  font-size: var(--fs-xs);
  color: var(--ink-4);
}
.pager b { color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ toast */
.toast-host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  min-width: 180px;
  max-width: 340px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  line-height: 1.5;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  color: var(--ink);
  animation: toast-in .16s ease-out;
}
.toast[data-kind="ok"] { border-color: #bbf7d0; background: var(--ok-soft); color: var(--ok); }
.toast[data-kind="warn"] { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn); }
.toast[data-kind="err"] { border-color: var(--danger-line); background: var(--danger-soft); color: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ 弹层 */
.modal-host { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.modal-host[data-open="1"] { pointer-events: auto; }
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(6, 9, 16, .38);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 14px;
}
.modal-box {
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.modal-box.wide { max-width: 720px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 14px; font-weight: 650; color: var(--ink); }
.modal-body { padding: 15px; }
.modal-body p { margin: 0 0 10px; font-size: var(--fs-sm); line-height: 1.6; color: var(--ink-2); }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 15px;
  border-top: 1px solid var(--line);
}
.modal-form label { display: block; margin-bottom: 11px; }
.modal-form label > span {
  display: block;
  font-size: var(--fs-xs);
  color: var(--ink-3);
  margin-bottom: 4px;
  font-weight: 550;
}
.modal-form input,
.modal-form select {
  width: 100%;
  min-height: var(--tap);
  padding: 0 11px;
  font-size: var(--fs-sm);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
}
.modal-form input:focus,
.modal-form select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .16);
}
.modal-form .row2 { display: flex; gap: 10px; }
.modal-form .row2 > label { flex: 1; }

/* 一次性凭据展示（新建代理 / 重置密码） */
.secret-box {
  padding: 12px;
  border: 1px dashed var(--brand-line);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
}
.secret-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  font-size: var(--fs-sm);
  color: var(--ink-2);
}
.secret-line code {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  word-break: break-all;
}
.secret-warn {
  margin-top: 8px;
  font-size: var(--fs-xs);
  color: var(--warn);
}

/* ------------------------------------------------------------------ 壁纸页 */
.wall-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  overflow: hidden;
  background: var(--bg);
  background-size: cover;
  background-position: center;
}
.wall-meta { font-size: var(--fs-xs); color: var(--ink-4); margin-top: 8px; }
.wall-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.file-pick {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.file-pick:hover { border-color: var(--ink-4); }
.file-pick input { display: none; }

/* ------------------------------------------------------------------ 移动端 */
@media (max-width: 720px) {
  .shell { flex-direction: column; }
  .sidebar {
    position: sticky;
    top: var(--topbar-h);
    z-index: 5;
    display: flex;
    gap: 4px;
    width: 100%;
    overflow-x: auto;
    padding: 6px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav-item { flex: 0 0 auto; white-space: nowrap; }
  .nav-item + .nav-item { margin-top: 0; }
  .main { padding: 12px 10px 28px; }
  .dense-table tbody td { height: 46px; }
  .modal-box { max-width: none; }
  .toast-host { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .nav-item, .fold > summary::before { transition: none; }
}
