* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  background: #f0f2f5;
  color: #333;
}

/* ===== 登录页 ===== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #2a5d8f 50%, #3a7ca5 100%);
}

.login-box {
  width: 400px;
  padding: 44px 40px 36px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.login-box .logo {
  text-align: center;
  margin-bottom: 8px;
}

.login-box .logo .icon {
  font-size: 42px;
}

.login-box h1 {
  font-size: 20px;
  text-align: center;
  color: #1e3a5f;
  margin-bottom: 4px;
}

.login-box .subtitle {
  text-align: center;
  font-size: 13px;
  color: #8a8a8a;
  margin-bottom: 28px;
}

.form-item {
  margin-bottom: 18px;
}

.form-item label {
  display: block;
  font-size: 13px;
  color: #555;
  margin-bottom: 6px;
}

.form-item input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-item input:focus {
  border-color: #2a5d8f;
  box-shadow: 0 0 0 2px rgba(42, 93, 143, 0.15);
}

.btn-login {
  width: 100%;
  height: 42px;
  margin-top: 6px;
  border: none;
  border-radius: 6px;
  background: #2a5d8f;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-login:hover {
  background: #1e4a75;
}

.btn-login:disabled {
  background: #9cb6cf;
  cursor: not-allowed;
}

.msg {
  min-height: 20px;
  margin-top: 10px;
  font-size: 13px;
  text-align: center;
}

.msg.error {
  color: #d4380d;
}

.msg.success {
  color: #389e0d;
}

/* ===== Admin 布局 ===== */
.admin-body {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: #1e3a5f;
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar .brand {
  padding: 20px 18px;
  font-size: 16px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar .brand span {
  color: #7ec8ff;
}

.menu {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.menu .menu-title {
  padding: 10px 18px 4px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.menu-item {
  display: block;
  width: 100%;
  padding: 10px 18px;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.menu-item.active {
  background: #2a5d8f;
  color: #fff;
}

.sidebar .user-box {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
}

.sidebar .user-box .uname {
  font-weight: 600;
  margin-bottom: 2px;
}

.sidebar .user-box .urole {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
}

.btn-logout {
  margin-top: 10px;
  width: 100%;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  background: none;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.12);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.topbar .page-title {
  font-size: 17px;
  font-weight: 600;
  color: #1e3a5f;
}

.content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.placeholder-card {
  background: #fff;
  border-radius: 10px;
  padding: 40px;
  text-align: center;
  color: #8a8a8a;
  border: 1px dashed #d9d9d9;
}

.placeholder-card .big {
  font-size: 40px;
  margin-bottom: 12px;
}

.placeholder-card h3 {
  color: #555;
  margin-bottom: 6px;
}

/* 表信息卡片 */
.table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.table-card {
  background: #fff;
  border-radius: 10px;
  padding: 18px;
  border: 1px solid #eef0f2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
}

.table-card:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.table-card .tname {
  font-size: 15px;
  font-weight: 600;
  color: #1e3a5f;
  margin-bottom: 6px;
}

.table-card .tmeta {
  font-size: 12px;
  color: #8a8a8a;
  line-height: 1.6;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  margin-left: 6px;
}

.badge.readonly {
  background: #fff1e0;
  color: #d46b08;
}

.badge.editable {
  background: #e6f7e6;
  color: #389e0d;
}

/* 数据表格 */
.card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card h3 {
  font-size: 16px;
  color: #1e3a5f;
  margin-bottom: 16px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid #eef0f2;
  font-size: 14px;
}

.data-table th {
  background: #f7f9fb;
  color: #555;
  font-weight: 600;
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: #fafbfc;
}

.role-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
}

.role-tag.super_admin {
  background: #e6f0fb;
  color: #1e5fa8;
}

.role-tag.viewer {
  background: #f2f3f5;
  color: #666;
}

/* 数据页工具栏 */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input {
  width: 260px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}

.search-input:focus {
  border-color: #2a5d8f;
}

.page-info {
  margin-left: auto;
  font-size: 13px;
  color: #8a8a8a;
}

.btn {
  height: 36px;
  padding: 0 18px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-search {
  background: #2a5d8f;
  color: #fff;
}

.btn-search:hover {
  background: #1e4a75;
}

.btn-add {
  background: #52c41a;
  color: #fff;
}

.btn-add:hover {
  background: #3da514;
}

.btn-cancel {
  background: #f0f0f0;
  color: #555;
}

.btn-cancel:hover {
  background: #e0e0e0;
}

.btn-save {
  background: #2a5d8f;
  color: #fff;
}

.btn-save:hover {
  background: #1e4a75;
}

.btn-sm {
  height: 28px;
  padding: 0 10px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  color: #555;
}

.btn-sm:hover {
  border-color: #2a5d8f;
  color: #2a5d8f;
}

.btn-sm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-edit {
  color: #1e5fa8;
  border-color: #b3d1f0;
}

.btn-del {
  color: #d4380d;
  border-color: #f0b9a8;
}

.table-wrap {
  overflow-x: auto;
}

.pager {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
}

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  width: 640px;
  max-width: 94vw;
  max-height: 86vh;
  background: #fff;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eef0f2;
}

.modal-head h3 {
  font-size: 16px;
  color: #1e3a5f;
}

.modal-close {
  border: none;
  background: none;
  font-size: 22px;
  color: #999;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #333;
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.modal-body .form-item:nth-last-child(-n + 2) {
  grid-column: span 1;
}

.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid #eef0f2;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal .form-item label {
  font-size: 13px;
  color: #555;
  display: block;
  margin-bottom: 5px;
}

.modal .input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}

.modal .input:focus {
  border-color: #2a5d8f;
}

.modal textarea.input {
  height: auto;
  padding: 8px 10px;
  resize: vertical;
}
