* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #f4f6f9;
  color: #1f2937;
  font-size: 14px;
}
.hidden { display: none !important; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: #fff;
  padding: 36px 32px;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.08);
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card h1 { font-size: 20px; }
.login-card .sub { color: #6b7280; font-size: 13px; margin-bottom: 6px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #374151; }
.login-card input {
  padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px;
}
button {
  padding: 9px 16px; border: none; border-radius: 6px; background: #2563eb;
  color: #fff; font-size: 14px; cursor: pointer;
}
button:hover { background: #1d4ed8; }
button.ghost { background: transparent; color: #2563eb; border: 1px solid #bfdbfe; }
button.ghost:hover { background: #eff6ff; }
.error { color: #dc2626; font-size: 13px; min-height: 18px; }

.app-wrap { min-height: 100vh; }
.topbar {
  background: #111827; color: #fff; padding: 14px 24px;
  display: flex; justify-content: space-between; align-items: center;
}
.brand { font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar .ghost { color: #93c5fd; border-color: #374151; }
.tabs { display: flex; gap: 4px; padding: 0 24px; background: #fff; border-bottom: 1px solid #e5e7eb; }
.tab { background: transparent; color: #4b5563; border-radius: 0; padding: 12px 16px; border-bottom: 2px solid transparent; }
.tab:hover { background: #f9fafb; color: #111827; }
.tab.active { color: #2563eb; border-bottom-color: #2563eb; }
main { padding: 20px 24px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input, .toolbar select {
  padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px;
}
.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f1f3f5; font-size: 13px; }
.data-table th { background: #f9fafb; color: #6b7280; font-weight: 600; }
.data-table tbody tr:hover { background: #f9fafb; cursor: pointer; }
.badge { padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.badge.active { background: #dcfce7; color: #15803d; }
.badge.pending { background: #fef9c3; color: #a16207; }
.badge.inactive { background: #e5e7eb; color: #4b5563; }
.badge.lost { background: #fee2e2; color: #b91c1c; }
.badge.retired { background: #ede9fe; color: #6d28d9; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

.drawer {
  position: fixed; top: 0; right: 0; width: 420px; height: 100vh;
  background: #fff; box-shadow: -6px 0 24px rgba(0,0,0,.12);
  display: flex; flex-direction: column;
}
.drawer-head { padding: 16px 20px; border-bottom: 1px solid #e5e7eb; display: flex; justify-content: space-between; align-items: center; }
.drawer-body { padding: 16px 20px; overflow-y: auto; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; margin-bottom: 18px; }
.kv dt { color: #6b7280; }
.kv dd { color: #111827; word-break: break-all; }
.drawer-body h3 { font-size: 14px; margin: 16px 0 10px; }
.drawer-body label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: 13px; color: #374151; }
.drawer-body input, .drawer-body select, .drawer-body textarea {
  padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px;
}
.drawer-body label.checkbox { flex-direction: row; }
.drawer-body label.checkbox span { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.empty { color: #9ca3af; text-align: center; padding: 30px; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 8px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat-card .label { color: #6b7280; font-size: 13px; margin-bottom: 6px; }
.stat-card .value { font-size: 26px; font-weight: 600; color: #111827; }
.stat-card .value.ok { color: #15803d; }
.stat-card .value.warn { color: #b45309; }
.stat-card .value.bad { color: #b91c1c; }
.section-title { font-size: 15px; margin: 0 0 12px; color: #374151; }
.chk { display: inline-block; padding: 1px 7px; border-radius: 9px; font-size: 11px; margin: 1px 3px 1px 0; }
.chk.ok { background: #dcfce7; color: #15803d; }
.chk.bad { background: #fee2e2; color: #b91c1c; }
