* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f5f7;
  color: #1f2329;
}

.hidden { display: none !important; }

/* login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, #b3272d 0%, #8c1d22 45%, #5d1014 100%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 18px;
  padding: 36px 32px 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.login-mark {
  width: 56px; height: 56px; line-height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #b3272d, #8c1d22);
  color: #fff; font-size: 28px; font-weight: 700; text-align: center;
}

.login-card h1 { margin: 18px 0 4px; font-size: 24px; }
.login-sub { margin: 0 0 24px; color: #8a9099; font-size: 13px; }

.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; color: #646a73; margin-bottom: 8px; }
.field input, .field select, .field textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #dcdfe6;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #fff;
}
.field textarea { height: 90px; padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #b3272d; }

.btn {
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid #dcdfe6;
  background: #fff;
  color: #1f2329;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { border-color: #b3272d; color: #b3272d; }
.btn.primary { background: #b3272d; border-color: #b3272d; color: #fff; }
.btn.primary:hover { background: #9d1f25; color: #fff; }
.btn.small { height: 30px; font-size: 13px; padding: 0 12px; }
.btn.block { width: 100%; height: 42px; margin-top: 8px; }
.btn.danger { color: #c0392b; border-color: #e6b8b3; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.error-text { color: #c0392b; font-size: 13px; min-height: 18px; margin: 4px 0; }

/* shell */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px;
  background: #1f2329;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  flex-shrink: 0;
}

.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 20px; }
.brand-mark {
  width: 38px; height: 38px; line-height: 38px;
  border-radius: 10px; text-align: center;
  background: #b3272d; font-weight: 700;
}
.brand-title { font-size: 15px; font-weight: 600; }
.brand-sub { font-size: 12px; color: #9aa0a6; margin-top: 2px; }

#nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: #c9cdd4;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.nav-item:hover { background: #2b3038; color: #fff; }
.nav-item.active { background: #b3272d; color: #fff; }
.logout {
  margin-top: auto;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #3a4048;
  background: transparent;
  color: #c9cdd4;
  cursor: pointer;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid #e5e6eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h2 { margin: 0; font-size: 18px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.who { font-size: 13px; color: #8a9099; }

.view { padding: 24px 28px 48px; }

/* cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.stat {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #eceef1;
}
.stat-label { font-size: 13px; color: #8a9099; }
.stat-value { font-size: 30px; font-weight: 700; margin-top: 8px; }
.stat-value.warn { color: #c0392b; }
.stat-value.ok { color: #1f9d55; }

.panel {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #eceef1;
  margin-top: 20px;
  overflow: hidden;
}
.panel-head {
  padding: 16px 20px;
  border-bottom: 1px solid #f0f1f3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-head h3 { margin: 0; font-size: 15px; }
.panel-body { padding: 20px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid #f2f3f5; }
th { background: #fafbfc; color: #646a73; font-weight: 500; font-size: 13px; }
tr:last-child td { border-bottom: none; }
.row-click { cursor: pointer; }
.row-click:hover td { background: #fafbfc; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.tag.gray { background: #eef0f3; color: #646a73; }
.tag.green { background: #e7f7ee; color: #1f9d55; }
.tag.orange { background: #fdf3e2; color: #b06b10; }
.tag.red { background: #fdecea; color: #c0392b; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input, .toolbar select {
  height: 34px; padding: 0 10px; border: 1px solid #dcdfe6; border-radius: 8px; font-size: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 4px 18px;
}

.hint {
  margin: 0 0 18px;
  color: #646a73;
  font-size: 13px;
  line-height: 1.7;
  background: #fafbfc;
  border: 1px solid #eceef1;
  border-radius: 8px;
  padding: 10px 14px;
}

.empty { padding: 48px; text-align: center; color: #9aa0a6; font-size: 14px; }
.pager { display: flex; justify-content: flex-end; gap: 10px; align-items: center; padding: 14px 16px; font-size: 13px; color: #646a73; }

/* modal */
.modal {
  position: fixed; inset: 0;
  background: rgba(15, 18, 22, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; z-index: 50;
}
.modal-box {
  width: 100%; max-width: 560px;
  background: #fff; border-radius: 14px;
  padding: 24px;
  max-height: 86vh; overflow: auto;
}
.modal-box h3 { margin: 0 0 18px; font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 10px 12px; font-size: 14px; }
.kv .k { color: #8a9099; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  background: #1f2329;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all .22s ease;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: #c0392b; }

@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
  }
  .brand { display: none; }
  #nav { flex-direction: row; gap: 6px; overflow-x: auto; }
  .nav-item { text-align: center; padding: 8px 12px; font-size: 13px; }
  .logout { margin: 0 0 0 auto; padding: 8px 12px; white-space: nowrap; }
  .view { padding: 16px; }
  .topbar { padding: 0 16px; }
  .topbar h2 { font-size: 16px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  table { font-size: 13px; }
  th, td { padding: 10px 8px; }
}
