/* 帮闲 V2.5 管理台样式 · Step 5-1
 * 视觉基线沿用 V2 设计稿：品牌橙 / 信任绿 / 浅底深字。
 * 所有资源位于 public/static/，严禁把 storage/private 内容当静态资源引用。
 */
:root {
  --brand: #FF7A1A;
  --brand-dark: #E86200;
  --brand-soft: #FFF3E8;
  --brand-line: #FFD9B8;
  --grad-brand: linear-gradient(135deg, #FF9A44 0%, #FF6A00 100%);
  --trust: #16A34A;
  --trust-soft: #ECFDF3;
  --warn: #D97706;
  --warn-soft: #FFFBEB;
  --danger: #DC2626;
  --danger-soft: #FEF2F2;
  --info: #2563EB;
  --info-soft: #EFF6FF;
  --text: #1F2937;
  --text-2: #4B5563;
  --muted: #6B7280;
  --faint: #9CA3AF;
  --line: #E5E7EB;
  --line-soft: #F0F1F3;
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --side-w: 232px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
code {
  font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  background: var(--line-soft); padding: 1px 5px; border-radius: 4px; color: var(--text-2);
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; }
p { margin: 0; }

/* ---------------------------------------------------------------- 布局 */
.app { display: flex; min-height: 100vh; }
.side {
  width: var(--side-w); flex: 0 0 var(--side-w);
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px 18px; border-bottom: 1px solid var(--line-soft);
}
.brand img { width: 34px; height: 34px; display: block; }
.brand-txt strong { display: block; font-size: 16px; letter-spacing: .5px; line-height: 1.2; }
.brand-txt span { display: block; font-size: 11px; color: var(--faint); letter-spacing: 1.5px; }
.side-nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.nav-group { margin: 12px 0 4px; padding: 0 10px; font-size: 11px; color: var(--faint); letter-spacing: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; margin: 2px 0; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13.5px; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--line-soft); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; }
.nav-item .ro { margin-left: auto; font-size: 10px; color: var(--faint); font-weight: 400; }
.side-foot { padding: 14px 16px; border-top: 1px solid var(--line-soft); font-size: 11px; color: var(--faint); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; flex: 0 0 62px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 0 28px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.topbar h2 { font-size: 17px; }
.crumb { color: var(--faint); font-size: 12px; margin-top: 1px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; font-size: 13px;
}
.content { padding: 24px 28px 40px; flex: 1; }
.foot { padding: 16px 28px 22px; color: var(--faint); font-size: 11px; }

/* ---------------------------------------------------------------- 登录页 */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 480px at 15% -10%, #FFE7CF 0%, transparent 60%),
    radial-gradient(700px 420px at 95% 110%, #FFF0E2 0%, transparent 55%),
    var(--bg);
}
.login-box { width: 100%; max-width: 400px; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 22px; }
.login-brand img { width: 48px; height: 48px; }
.login-brand strong { font-size: 23px; letter-spacing: 2px; }
.login-brand span { display: block; font-size: 11px; color: var(--faint); letter-spacing: 3px; font-weight: 400; }
.login-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px; box-shadow: 0 12px 40px rgba(16, 24, 40, .08);
}
.login-card h3 { font-size: 18px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 22px; }
.login-foot { margin-top: 18px; text-align: center; color: var(--faint); font-size: 11px; line-height: 1.8; }

/* ---------------------------------------------------------------- 卡片 */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px;
}
.card-pad { padding: 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line-soft);
}
.card-head h3 { font-size: 15px; }
.card-head .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 20px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grad-brand); opacity: .85; }
.stat.ok::before { background: var(--trust); }
.stat.warn::before { background: var(--warn); }
.stat.info::before { background: var(--info); }
.stat-label { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 27px; font-weight: 700; letter-spacing: -.5px; margin-top: 6px; line-height: 1.25; }
.stat-value .unit { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.stat-hint { font-size: 11px; color: var(--faint); margin-top: 4px; }

/* ---------------------------------------------------------------- 徽标 / 提示 */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.7;
  background: var(--line-soft); color: var(--text-2); white-space: nowrap;
}
.badge.success { background: var(--trust-soft); color: var(--trust); }
.badge.warn    { background: var(--warn-soft);  color: var(--warn); }
.badge.danger  { background: var(--danger-soft);color: var(--danger); }
.badge.info    { background: var(--info-soft);  color: var(--info); }
.badge.brand   { background: var(--brand-soft); color: var(--brand-dark); }

.alert {
  padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px;
  background: var(--brand-soft); color: #92400E; font-size: 13px; border: 1px solid var(--brand-line);
}
.alert.success { background: var(--trust-soft); color: #166534; border-color: #BBF7D0; }
.alert.error   { background: var(--danger-soft); color: #991B1B; border-color: #FECACA; }
.alert.info    { background: var(--info-soft);  color: #1E40AF; border-color: #BFDBFE; }
.alert.plain   { background: var(--line-soft); color: var(--text-2); border-color: var(--line); }
.label { color: var(--muted); font-size: 12px; }
.faint { color: var(--faint); }

/* ---------------------------------------------------------------- 表格 */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 13px; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 11.5px; background: #FAFBFC; white-space: nowrap; }
tbody tr:hover { background: #FCFCFD; }
tbody tr:last-child td { border-bottom: 0; }
.table-empty { padding: 42px 16px; text-align: center; color: var(--faint); font-size: 13px; }
.empty { padding: 48px 20px; text-align: center; color: var(--faint); }
.empty strong { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 6px; }

/* ---------------------------------------------------------------- 表单 / 按钮 */
.field { margin-bottom: 15px; }
.field label { display: block; color: var(--text-2); font-size: 12.5px; margin-bottom: 6px; font-weight: 500; }
.field .help { color: var(--faint); font-size: 11px; margin-top: 5px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--text); background: var(--surface); outline: none;
  font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 122, 26, .12);
}
input:disabled, select:disabled { background: var(--line-soft); color: var(--faint); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 9px 16px;
  font: 500 13.5px/1.4 inherit; cursor: pointer; background: var(--brand); color: #fff;
  transition: filter .15s, background .15s, border-color .15s; white-space: nowrap;
}
.btn:hover { filter: brightness(.95); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost  { background: var(--surface); color: var(--text-2); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand-dark); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 6px 11px; font-size: 12px; }
.btn.block { width: 100%; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 14px 0 2px; font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- 状态页 / 水印 / toast */
.forbidden { max-width: 520px; margin: 8vh auto; text-align: center; }
.forbidden .code { font-size: 62px; font-weight: 800; color: var(--brand-soft); line-height: 1; }
.forbidden h3 { font-size: 19px; margin: 10px 0 8px; }
.watermark {
  position: fixed; right: 18px; bottom: 14px; color: rgba(31, 41, 55, .10);
  font-size: 12px; pointer-events: none; user-select: none; z-index: 2;
}
.toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 99; display: flex; flex-direction: column; gap: 8px; }
.toast {
  min-width: 220px; max-width: 380px; padding: 11px 15px; border-radius: var(--radius-sm);
  background: #1F2937; color: #fff; font-size: 13px; box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
  animation: toast-in .18s ease-out;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--trust); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- Step 5-2 · 审核队列 */
/* hidden 属性优先级必须高于 .modal / .drawer 的 display:flex，否则弹层默认可见 */
[hidden] { display: none !important; }
.alert.warn { background: var(--warn-soft); color: #92400E; border-color: #FDE68A; }
.sec-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 20px 0 10px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.link-btn {
  border: 0; background: none; padding: 2px 6px 2px 0; cursor: pointer;
  color: var(--brand-dark); font: inherit; font-size: 12.5px;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.muted { color: var(--muted); }
.link-btn.danger-text { color: var(--danger); }
.link-btn:disabled { opacity: .45; cursor: not-allowed; text-decoration: none; }

/* 弹窗 */
.modal {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(17, 24, 39, .42); padding: 18px;
}
.modal-panel {
  width: 100%; max-width: 480px; background: var(--surface); border-radius: var(--radius);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .22); overflow: hidden;
}
.modal-head, .drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px; border-bottom: 1px solid var(--line-soft);
}
.modal-head h3, .drawer-head h3 { font-size: 15px; }
.modal-x { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; }
.modal-x:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-foot, .drawer-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--line-soft); background: #FAFBFC;
}
.modal-body .alert { margin-bottom: 16px; }
.modal-body textarea { resize: vertical; }

/* 详情抽屉 */
.drawer { position: fixed; inset: 0; z-index: 55; display: flex; justify-content: flex-end; background: rgba(17, 24, 39, .32); }
.drawer-panel {
  width: min(520px, 100%); height: 100%; background: var(--surface); display: flex; flex-direction: column;
  box-shadow: -12px 0 40px rgba(0, 0, 0, .16);
}
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.drawer-foot .label { margin-right: auto; }

/* 键值信息 */
.kv { border: 1px solid var(--line-soft); border-radius: var(--radius-sm); overflow: hidden; }
.kv-row { display: grid; grid-template-columns: 118px 1fr; border-bottom: 1px solid var(--line-soft); }
.kv-row:last-child { border-bottom: 0; }
.kv-k { padding: 9px 12px; background: #FAFBFC; color: var(--muted); font-size: 12px; }
.kv-v { padding: 9px 12px; font-size: 12.5px; color: var(--text); word-break: break-all; }

/* 文件元数据清单 */
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm); font-size: 12.5px;
}
.file-item .file-meta { color: var(--faint); font-size: 11px; margin-left: auto; text-align: right; }
.file-item .spacer { flex: 1; }

/* 原文：水印叠层，关闭即清空 textContent */
.plain-box { position: relative; margin-top: 18px; padding: 14px; border: 1px dashed var(--danger); border-radius: var(--radius-sm); background: #FFF7F7; overflow: hidden; }
.plain-box .sec-title { margin-top: 0; color: var(--danger); }
.plain-box .kv { background: var(--surface); }
.plain-watermark {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; letter-spacing: 4px; color: rgba(220, 38, 38, .12);
  transform: rotate(-18deg); pointer-events: none; user-select: none; white-space: nowrap;
}
.plain-box .alert { margin: 12px 0; }

/* 私有原图预览 */
.file-preview { margin-top: 18px; }
.file-preview img { width: 100%; max-height: 320px; object-fit: contain; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #FAFBFC; }
.file-preview .alert { margin-bottom: 10px; }

/* ---------------------------------------------------------------- Step 5-3 · 运营表格与行内表单 */
.num { text-align: right; font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.num.in { color: var(--trust); }
.num.out { color: var(--danger); }
.cell-input, .cell-select {
  width: 100%; min-width: 88px; padding: 6px 8px; font-size: 12.5px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}
.cell-input:disabled, .cell-select:disabled { background: var(--line-soft); color: var(--faint); }
.cell-input.short { max-width: 92px; }
.cfg-value { min-width: 220px; }
.cfg-key { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--text-2); }
.cfg-diff { border-color: var(--brand) !important; box-shadow: 0 0 0 2px rgba(255,122,26,.12); }
.detail-json { display: block; max-width: 320px; font-size: 11.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desc-clip { display: block; max-width: 210px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.stat-value .unit-sm { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.drawer-close-hint { color: var(--faint); font-size: 11px; }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 900px) {
  :root { --side-w: 68px; }
  .brand { justify-content: center; padding: 16px 8px; }
  .brand-txt, .nav-group, .nav-item span:not(.ro), .nav-item .ro, .side-foot { display: none; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .topbar, .content, .foot { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .topbar { height: auto; min-height: 60px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .who .name { display: none; }
}
