* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: #f5f6f8;
  color: #222;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; gap: 20px;
  background: #1f2937; color: #fff; padding: 0 20px; height: 56px;
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 18px; white-space: nowrap; }
.nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; }
.nav a { color: #cbd5e1; padding: 8px 12px; border-radius: 6px; white-space: nowrap; }
.nav a:hover { color: #fff; background: #374151; text-decoration: none; }
.nav a.active { color: #fff; background: #2563eb; }
.userbox { display: flex; align-items: center; gap: 10px; white-space: nowrap; color: #e5e7eb; }
.logout { color: #fca5a5; }

.container { max-width: 1200px; margin: 24px auto; padding: 0 20px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h1 small { color: #6b7280; font-weight: 400; font-size: 15px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash-success { background: #dcfce7; color: #166534; }
.flash-danger { background: #fee2e2; color: #991b1b; }
.flash-warning { background: #fef3c7; color: #92400e; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.card { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card .num { font-size: 28px; font-weight: 700; }
.card .label { color: #6b7280; font-size: 13px; }
.card.warn .num { color: #d97706; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 800px) { .cards, .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.panel { background: #fff; border-radius: 10px; padding: 18px; margin-bottom: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eef0f3; font-size: 14px; }
th { background: #f9fafb; color: #4b5563; font-weight: 600; }
tr:last-child td { border-bottom: none; }
.json { font-family: Consolas, monospace; font-size: 11px; color: #6b7280; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; background: #e0e7ff; color: #3730a3; font-size: 12px; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-muted { background: #e5e7eb; color: #4b5563; }
.muted { color: #9ca3af; font-size: 13px; }

.btn { display: inline-block; padding: 8px 14px; border-radius: 7px; border: 1px solid #d1d5db; background: #fff; cursor: pointer; font-size: 14px; color: #111; }
.btn:hover { background: #f9fafb; text-decoration: none; }
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-ok { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn-warn { background: #d97706; border-color: #d97706; color: #fff; }
.btn-block { width: 100%; }

.form label { display: block; font-size: 13px; color: #4b5563; margin: 4px 0 4px; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 7px;
  font-size: 14px; font-family: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #2563eb; }
.form .grid-3 > div { margin-bottom: 8px; }

.filter { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filter input, .filter select { width: auto; }
.filter input[name="q"] { flex: 1; min-width: 200px; }

.inline-form { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.inline-form input, .inline-form select { width: auto; }

.kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kv > div { background: #f9fafb; border-radius: 8px; padding: 10px 12px; }
.kv b { display: block; font-size: 12px; color: #6b7280; margin-bottom: 3px; font-weight: 500; }
.kv span { font-size: 14px; }
@media (max-width: 800px) { .kv { grid-template-columns: repeat(2, 1fr); } }

.thumbs { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.thumbs figure { margin: 0; text-align: center; }
.thumbs img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid #e5e7eb; }
.thumbs figcaption { font-size: 12px; color: #6b7280; margin-top: 4px; }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1f2937, #2563eb); }
.login-card { background: #fff; border-radius: 14px; padding: 32px; width: 360px; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.login-card h1 { text-align: center; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: #6b7280; font-size: 13px; margin: 0 0 20px; }
.login-card label { display: block; font-size: 13px; color: #4b5563; margin: 12px 0 4px; }
.hint { margin-top: 18px; background: #f9fafb; border-radius: 8px; padding: 10px 12px; font-size: 12px; color: #6b7280; }
.hint p { margin: 3px 0; }

.techpack { background: #fff; border-radius: 10px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.techpack table { box-shadow: none; border: 1px solid #e5e7eb; margin-bottom: 16px; }
@media print {
  .topbar, .btn, .page-head .btn, .flash { display: none; }
  .container { max-width: 100%; margin: 0; padding: 0; }
}
