:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f1f5f9;
  --panel: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --sidebar: #0f172a;
  --sidebar-active: #1e293b;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-overlay {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.login-card {
  background: #fff; width: 340px; padding: 32px 28px; border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.login-brand { font-size: 20px; font-weight: 700; color: var(--primary); }
.login-sub { color: var(--muted); margin-bottom: 18px; }
.login-card label { display: block; margin: 12px 0 4px; color: var(--muted); font-size: 13px; }
.login-card input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; outline: none; font-size: 14px;
}
.login-card input:focus { border-color: var(--primary); }
.login-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }
.login-tip { color: var(--muted); font-size: 12px; text-align: center; margin-top: 14px; }

/* ---------- 布局 ---------- */
.app { height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; flex-shrink: 0;
}
.topbar-brand { font-weight: 600; font-size: 16px; }
.topbar-user { margin-right: 14px; opacity: .9; }
.layout { flex: 1; display: flex; overflow: hidden; }
.sidebar {
  width: 210px; background: var(--sidebar); color: #cbd5e1;
  flex-shrink: 0; overflow-y: auto; padding: 12px 0;
}
.nav { display: flex; flex-direction: column; }
.nav a {
  color: #cbd5e1; text-decoration: none; padding: 12px 20px;
  display: flex; align-items: center; gap: 10px; font-size: 14px;
  border-left: 3px solid transparent;
}
.nav a:hover { background: var(--sidebar-active); }
.nav a.active { background: var(--sidebar-active); color: #fff; border-left-color: var(--primary); }
.nav .nav-icon { width: 18px; text-align: center; }
.content { flex: 1; overflow-y: auto; padding: 22px 26px; }

/* ---------- 卡片/标题 ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-title { font-size: 18px; font-weight: 600; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px; margin-bottom: 18px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; }
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .lbl { color: var(--muted); margin-top: 4px; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; background: var(--panel); }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 13px; }
.table th { background: #f8fafc; color: var(--muted); font-weight: 600; }
.table tr:hover td { background: #f8fafc; }
.table-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: auto; }

/* ---------- 表单/筛选 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px;
  font-size: 13px; outline: none; min-width: 150px; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.form-row { display: flex; flex-wrap: wrap; gap: 14px; }
.form-row .field { margin-bottom: 12px; }
.form-actions { margin-top: 10px; display: flex; gap: 10px; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 8px 14px; border-radius: 7px; cursor: pointer; font-size: 13px;
  transition: .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-block { width: 100%; margin-top: 16px; padding: 11px; font-size: 15px; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.4); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.15); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 徽标 ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-amber { background: #fef3c7; color: #b45309; }
.badge-gray { background: #e2e8f0; color: #475569; }
.badge-stay { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.badge-no-stay { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }

/* ---------- toast ---------- */
.toast-container { position: fixed; top: 70px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #0f172a; color: #fff; padding: 11px 16px; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); min-width: 220px; max-width: 360px;
  animation: slideIn .2s ease; font-size: 13px;
}
.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
.toast.info { background: #2563eb; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ---------- modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 1500; }
.modal { background: #fff; border-radius: 12px; width: 560px; max-width: 92vw; max-height: 88vh; overflow: auto; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { cursor: pointer; border: none; background: transparent; font-size: 22px; color: var(--muted); line-height: 1; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- 杂项 ---------- */
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.pager { display: flex; align-items: center; gap: 12px; justify-content: flex-end; margin-top: 14px; }
.muted { color: var(--muted); }
.required::after { content: " *"; color: var(--danger); }
.detail-grid { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; }
.detail-grid .k { color: var(--muted); }
.detail-grid .v { word-break: break-all; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar-track { flex: 1; background: #e2e8f0; border-radius: 6px; height: 18px; overflow: hidden; }
.bar-fill { background: var(--primary); height: 100%; }
.perm-group { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; }
.perm-group h4 { margin: 0 0 8px; font-size: 13px; color: var(--primary); }
.perm-item { display: inline-flex; align-items: center; gap: 6px; margin: 4px 12px 4px 0; font-size: 13px; }
.img-thumb { max-width: 120px; max-height: 120px; border-radius: 8px; border: 1px solid var(--border); }

/* ---------- 协议编辑 ---------- */
.field-col { flex: 1 1 100%; }
.cfg-textarea { width: 100%; min-height: 240px; resize: vertical; line-height: 1.7; font-family: inherit; white-space: pre-wrap; }
.cfg-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.agreement-preview { max-height: 60vh; overflow: auto; }
.agreement-preview p { margin: 0 0 10px; line-height: 1.8; white-space: pre-wrap; }

/* 审核弹窗-住宿信息 */
.audit-stay { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 12px 0; }
.audit-stay legend { font-size: 13px; color: var(--muted); padding: 0 6px; }
.chk-line { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 4px 0 10px; cursor: pointer; }
.stay-fields { margin-top: 6px; }
