/* 文本分配后台 - 三段式布局 */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: #333;
  background: #f0f2f5;
}

a { color: #2f6fed; text-decoration: none; }
a:hover { text-decoration: underline; }

/* 左侧暗色侧边栏 */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #1e2430;
  color: #c5c9d2;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
}
.sidebar-brand {
  height: 56px;
  line-height: 56px;
  padding: 0 20px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: #161b24;
  border-bottom: 1px solid #2a3140;
  letter-spacing: 1px;
}
.sidebar-nav { padding: 12px 0; flex: 1; overflow-y: auto; }
.sidebar-nav a {
  display: block;
  padding: 12px 20px;
  color: #a8b0bd;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.sidebar-nav a:hover {
  background: #262d3b;
  color: #fff;
  text-decoration: none;
}
.sidebar-nav a.active {
  background: #262d3b;
  color: #fff;
  border-left-color: #3b82f6;
}
.sidebar-footer {
  padding: 14px 20px;
  font-size: 12px;
  color: #6b7280;
  border-top: 1px solid #2a3140;
}

/* 右侧区域 */
.main {
  margin-left: 220px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 顶部状态/操作栏 */
.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 600; color: #1f2937; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-meta { color: #6b7280; font-size: 13px; }

/* 主体内容 */
.content { padding: 20px 24px 40px; flex: 1; }

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  color: #111827;
}

.stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.stat-item {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 18px 22px;
  min-width: 160px;
  flex: 1;
}
.stat-item .label { color: #6b7280; font-size: 13px; margin-bottom: 8px; }
.stat-item .value { font-size: 28px; font-weight: 700; color: #111827; }
.stat-item .value.ok { color: #059669; }
.stat-item .value.warn { color: #d97706; }

.btn {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  background: #3b82f6;
  color: #fff;
  line-height: 1.4;
  vertical-align: middle;
}
.btn:hover { background: #2563eb; text-decoration: none; color: #fff; }
.btn-secondary { background: #fff; color: #374151; border-color: #d1d5db; }
.btn-secondary:hover { background: #f9fafb; color: #111; }
.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

label { display: block; margin-bottom: 6px; color: #374151; font-weight: 500; }
.form-group { margin-bottom: 14px; }
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}
.form-control:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,.15);
}
textarea.form-control { min-height: 160px; resize: vertical; line-height: 1.5; }
.form-hint { font-size: 12px; color: #6b7280; margin-top: 6px; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th, table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
  word-break: break-all;
}
table.data th {
  background: #f9fafb;
  color: #4b5563;
  font-weight: 600;
  white-space: nowrap;
}
table.data tr:hover td { background: #fafbfc; }
.mono { font-family: Consolas, Monaco, monospace; font-size: 12px; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 12px;
}
.badge-ok { background: #d1fae5; color: #065f46; }
.badge-off { background: #fee2e2; color: #991b1b; }
.badge-wait { background: #e0e7ff; color: #3730a3; }

.alert {
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 14px;
  font-size: 13px;
}
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

.pager {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  align-items: center;
  color: #6b7280;
  font-size: 13px;
}
.pager a {
  padding: 4px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  color: #374151;
  text-decoration: none;
}
.pager a:hover { background: #f3f4f6; }
.pager .disabled { opacity: .4; pointer-events: none; }

.content-empty { color: #9ca3af; padding: 24px; text-align: center; }

/* 登录页 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #1e2430 0%, #2d3748 50%, #1a202c 100%);
}
.login-box {
  width: 380px;
  background: #fff;
  border-radius: 8px;
  padding: 32px 28px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.login-box h1 {
  font-size: 20px;
  margin-bottom: 6px;
  color: #111;
}
.login-box .sub {
  color: #6b7280;
  font-size: 13px;
  margin-bottom: 24px;
}
.login-box .btn { width: 100%; padding: 10px; font-size: 14px; }

@media (max-width: 768px) {
  .sidebar { width: 180px; }
  .main { margin-left: 180px; }
  .content { padding: 14px; }
}
