:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --navy: #0f172a;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --teal: #0f766e;
  --danger: #dc2626;
  --warn: #d97706;
  --success: #16a34a;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }

.topbar {
  background: var(--navy);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.15);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 16px;
}

.topbar-badge {
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #bae6fd;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 99px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.container {
  max-width: 1220px;
  margin: 0 auto;
  padding: 22px 18px 56px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  margin-bottom: 18px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
}

.card-sub {
  font-size: 13px;
  color: var(--muted);
}

.login-wrap {
  max-width: 440px;
  margin: 64px auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 16px;
}

.form-grid .full { grid-column: 1 / -1; }

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.field input,
.field select,
.field textarea {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.field textarea { min-height: 76px; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn:hover { opacity: 0.92; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-teal { background: var(--teal); color: #fff; }
.btn-outline { background: #fff; color: var(--text); border: 1px solid #cbd5e1; }
.btn-danger { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.tab-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.tab-btn.active {
  background: #eff6ff;
  color: var(--primary);
  border-color: #bfdbfe;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-num { font-size: 26px; font-weight: 900; color: var(--navy); margin-top: 4px; }

.table-wrap { width: 100%; overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  white-space: nowrap;
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill-blue { background: #eff6ff; color: #1d4ed8; }
.pill-green { background: #f0fdf4; color: #15803d; }
.pill-amber { background: #fffbeb; color: #b45309; }
.pill-gray { background: #f1f5f9; color: #475569; }
.pill-red { background: #fef2f2; color: #b91c1c; }

.hint-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

.warn-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

.tenant-bar {
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tenant-bar select {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid #93c5fd;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  min-width: 260px;
}

.checklist-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 14px;
  margin: 12px 0;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
}

.check-item input { margin-top: 3px; }

.code-block {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  font-family: Consolas, Menlo, monospace;
  font-size: 12.5px;
  overflow-x: auto;
  white-space: pre;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--navy);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.25);
  z-index: 99;
  display: none;
}

.hidden { display: none !important; }

@media (max-width: 780px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .checklist-grid { grid-template-columns: 1fr; }
}
