:root {
  --primary: #ff7a1a;
  --primary-dark: #f56300;
  --bg: #f6f7f9;
  --text: #1f2329;
  --text-secondary: #646a73;
  --border: #e5e6eb;
  --shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
.hidden { display: none !important; }

/* ===== 登录 ===== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #fff3e9, #ffe1cc);
}
.login-card {
  background: #fff; padding: 40px; border-radius: 20px;
  box-shadow: var(--shadow); width: 360px; text-align: center;
}
.login-logo { font-size: 48px; margin-bottom: 12px; }
.login-card h2 { margin-bottom: 6px; }
.login-sub { color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }
.login-card input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 12px; font-size: 15px; outline: none; margin-bottom: 16px;
}
.login-card input:focus { border-color: var(--primary); }
.login-card button {
  width: 100%; padding: 12px; border: none; border-radius: 12px;
  background: var(--primary); color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer;
}
.login-card button:hover { background: var(--primary-dark); }
.login-err { color: #e54545; font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ===== 管理页 ===== */
.admin-header {
  height: 60px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
}
.admin-brand { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.admin-actions { display: flex; align-items: center; gap: 16px; }
.link { color: var(--primary-dark); text-decoration: none; font-size: 14px; }

.admin-main { max-width: 1100px; margin: 0 auto; padding: 28px 24px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }

.btn-primary {
  background: var(--primary); color: #fff; border: none; padding: 9px 18px;
  border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost {
  background: transparent; border: 1px solid var(--border); padding: 8px 16px;
  border-radius: 10px; font-size: 14px; cursor: pointer; color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg); }

.model-table {
  width: 100%; border-collapse: collapse; background: #fff;
  border-radius: 14px; overflow: hidden; box-shadow: var(--shadow);
}
.model-table th, .model-table td {
  padding: 14px 16px; text-align: left; font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.model-table th { background: #fafbfc; color: var(--text-secondary); font-weight: 600; }
.model-table tr:last-child td { border-bottom: none; }
.model-table td.url { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px;
}
.badge.on { background: #e6f7ed; color: #1a9b54; }
.badge.off { background: #f2f3f5; color: #8a9099; }
.grp { display: inline-block; padding: 2px 9px; border-radius: 6px; background: #fff3e9; color: #f56300; font-size: 12px; }
.grp-none { color: #c0c4cc; }
.row-actions button {
  border: none; background: transparent; cursor: pointer; font-size: 13px;
  padding: 4px 8px; border-radius: 6px; color: var(--text-secondary);
}
.row-actions button:hover { background: var(--bg); }
.row-actions .edit:hover { color: var(--primary-dark); }
.row-actions .test:hover { color: #1a9b54; }
.row-actions .del:hover { color: #e54545; }

.empty-tip { text-align: center; color: var(--text-secondary); padding: 40px; }

/* ===== 弹窗 ===== */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal-card {
  background: #fff; border-radius: 18px; padding: 28px; width: 560px;
  max-width: calc(100vw - 40px); max-height: 90vh; overflow-y: auto;
}
.modal-card h3 { margin-bottom: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid label {
  display: flex; flex-direction: column; gap: 6px; font-size: 13px;
  color: var(--text-secondary); font-weight: 600;
}
.form-grid label.full { grid-column: 1 / -1; }
.form-grid input, .form-grid select {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; outline: none; color: var(--text); font-weight: 400;
}
.form-grid input:focus, .form-grid select:focus { border-color: var(--primary); }
.form-grid small { color: #9aa0a6; font-weight: 400; font-size: 12px; }
.req { color: #e54545; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px; }
.checkbox-label input { width: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.modal-err { color: #e54545; font-size: 13px; margin-top: 12px; min-height: 18px; text-align: right; }
