/* wxoa-bridge 管理端样式 — 清爽白底中文后台风，零外部引用 */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --bg: #f5f6fa;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(17, 24, 39, .07);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px;
  flex: 0 0 216px;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  font-size: 16px;
  font-weight: 700;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  letter-spacing: .5px;
}
.nav { padding: 10px 8px; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--text);
  margin-bottom: 2px;
  font-size: 14px;
}
.nav-item:hover { background: #f3f4f6; }
.nav-item.active { background: #e8effe; color: var(--primary-dark); font-weight: 600; }
.nav-icon { width: 20px; text-align: center; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.content { padding: 24px; max-width: 1080px; width: 100%; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  background: #fff;
  color: var(--text);
  transition: all .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-ghost { border-color: var(--border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: #f3f4f6; }
.btn-warn { background: var(--warning); color: #fff; }
.btn-warn:hover:not(:disabled) { background: #b45309; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.form-row-wide { grid-column: 1 / -1; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; }
.req { color: var(--danger); margin-left: 2px; }
.input, select.input, textarea.input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .15s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.input.input-error { border-color: var(--danger); }
textarea.input { resize: vertical; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-error {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  background: #fef2f2;
  color: var(--danger);
  font-size: 13px;
}
.form-actions { margin-top: 18px; display: flex; gap: 10px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  background: #f9fafb;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  white-space: nowrap;
}
.table td { padding: 9px 12px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.table tbody tr:hover { background: #fafbfc; }
.table .ops { display: flex; gap: 6px; flex-wrap: wrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }
.ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}
.badge-green { background: #dcfce7; color: #166534; }
.badge-gray { background: #f3f4f6; color: var(--muted); }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-blue { background: #dbeafe; color: #1e40af; }

/* ---------- 工具条 ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .input { width: auto; min-width: 180px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: 10px;
  width: 560px;
  max-width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
}
.modal-sm { width: 400px; }
.modal-title {
  font-size: 15px;
  font-weight: 600;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------- Toast ---------- */
#toast-box {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.toast {
  padding: 9px 18px;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
  opacity: 0;
  transform: translateY(-8px);
  transition: all .25s;
  max-width: 70vw;
  word-break: break-all;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #eef2ff 0%, #f5f6fa 55%);
}
.login-card {
  width: 380px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 36px rgba(17, 24, 39, .12);
  padding: 34px 32px 28px;
}
.login-title { font-size: 19px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.login-card .form-row { margin-bottom: 14px; }

/* ---------- 菜单编辑器 ---------- */
.menu-main {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  background: #fcfcfd;
}
.menu-main-head {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  background: #f3f6fd;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  flex-wrap: wrap;
}
.menu-tag {
  font-size: 12px;
  color: var(--primary-dark);
  background: #dbeafe;
  border-radius: 4px;
  padding: 1px 8px;
  white-space: nowrap;
}
.menu-children { padding: 10px 12px 12px 40px; display: flex; flex-direction: column; gap: 8px; }
.menu-child-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.menu-child-row::before { content: "└"; color: var(--muted); margin-right: 2px; }
.menu-name-input { width: 180px; }
.menu-url-input { flex: 1; min-width: 220px; }
.menu-sort-label { font-size: 12px; color: var(--muted); }

/* ---------- 提示条 ---------- */
.alert { padding: 9px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

.empty { text-align: center; color: var(--muted); padding: 34px 0; font-size: 13px; }

.pager { display: flex; align-items: center; gap: 12px; justify-content: flex-end; margin-top: 12px; font-size: 13px; color: var(--muted); }
