:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #2563eb;
  --brand-weak: #eaf1ff;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --teal: #0f766e;
  --nav: #1f2937;
  --nav-soft: #2b3647;
  --shadow: 0 10px 28px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(245, 247, 251, 0.65), rgba(245, 247, 251, 0.92)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1600' height='900' viewBox='0 0 1600 900'%3E%3Crect width='1600' height='900' fill='%23d7e1ed'/%3E%3Cpath d='M0 650 C260 500 420 760 700 590 C980 420 1120 650 1600 450 L1600 900 L0 900 Z' fill='%2395a8ba'/%3E%3Cpath d='M0 720 C310 610 470 820 780 690 C1110 550 1270 720 1600 600 L1600 900 L0 900 Z' fill='%237e93a6'/%3E%3Cpath d='M0 255 C260 120 420 270 620 170 C850 60 1050 230 1300 100 C1430 40 1530 75 1600 35 L1600 0 L0 0 Z' fill='%23edf3f8'/%3E%3C/svg%3E");
  background-size: cover;
}

.login-card {
  width: min(390px, 100%);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-title {
  margin: 0 0 24px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
}

.login-row {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.captcha-row {
  display: grid;
  grid-template-columns: 1fr 108px;
  gap: 12px;
}

.captcha-box {
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #2563eb;
  font-size: 22px;
  font-weight: 800;
  background: #f8fafc;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 20px;
  color: var(--muted);
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
  background: var(--nav);
  color: #d5dce8;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
}

.brand {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  color: white;
  font-weight: 800;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #2563eb;
  font-size: 13px;
}

.nav-tree {
  padding: 18px 0 24px;
}

.nav-group {
  transition: background 180ms ease;
}

.nav-group.open {
  background: rgba(15, 23, 42, 0.24);
}

.nav-item,
.nav-parent {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  min-height: 54px;
  padding: 0 26px 0 40px;
  border-radius: 0;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: background 180ms ease, color 180ms ease;
}

.nav-item:hover,
.nav-parent:hover,
.nav-item.active,
.nav-parent.active,
.nav-parent.open {
  background: var(--nav-soft);
  color: #ffffff;
}

.nav-icon {
  width: 24px;
  flex: 0 0 24px;
  color: rgba(229, 236, 247, 0.88);
  font-size: 22px;
  text-align: center;
}

.nav-label {
  flex: 1;
  min-width: 0;
  font-size: 20px;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-arrow {
  color: rgba(229, 236, 247, 0.66);
  font-size: 18px;
  transition: transform 220ms ease;
}

.nav-parent.open .nav-arrow {
  transform: rotate(180deg);
}

.nav-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 260ms ease;
}

.nav-group.open .nav-panel {
  max-height: 720px;
}

.nav-panel .nav-item {
  min-height: 46px;
  padding-left: 96px;
  color: #c8d2df;
  font-size: 15px;
}

.nav-panel .nav-item::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: -22px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.45;
}

.nav-panel .nav-item.active::before {
  opacity: 1;
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr);
}

.topbar {
  height: 56px;
  background: white;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-weak);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.content {
  padding: 18px;
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.page-title {
  margin: 0;
  font-size: 20px;
}

.page-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 1px rgba(17, 24, 39, 0.02);
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  padding: 14px;
  margin-bottom: 12px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: #374151;
  background: #f9fafb;
  font-weight: 700;
}

td.long {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
}

tr:hover td {
  background: #fbfdff;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 14px;
  color: var(--muted);
}

.btn {
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
  min-height: 32px;
  padding: 0 11px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  border-color: #b8c2d2;
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.btn.success {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.btn.warning {
  background: var(--amber);
  border-color: var(--amber);
  color: white;
}

.btn.danger {
  background: var(--red);
  border-color: var(--red);
  color: white;
}

.btn.text {
  border-color: transparent;
  background: transparent;
  color: var(--brand);
  padding: 0 6px;
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  background: white;
  min-height: 36px;
  border-radius: 6px;
  padding: 8px 10px;
  outline: none;
}

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

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

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

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

.label {
  display: block;
  margin-bottom: 6px;
  color: #374151;
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
}

.badge.green {
  background: #dcfce7;
  color: #166534;
}

.badge.amber {
  background: #fef3c7;
  color: #92400e;
}

.badge.red {
  background: #fee2e2;
  color: #991b1b;
}

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

.stat {
  padding: 16px;
}

.stat-label {
  color: var(--muted);
}

.stat-value {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 800;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
}

.chart {
  height: 280px;
  padding: 20px;
  display: grid;
  align-items: end;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}

.bar {
  min-height: 28px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(#60a5fa, #2563eb);
}

.quick-list {
  padding: 14px;
}

.quick-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 12px 14px 0;
}

.tab {
  border: 1px solid var(--line);
  background: #f9fafb;
  border-radius: 6px 6px 0 0;
  padding: 8px 12px;
}

.tab.active {
  background: white;
  color: var(--brand);
  border-bottom-color: white;
}

.modal-mask,
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: none;
  z-index: 30;
}

.modal-mask.show,
.drawer-mask.show {
  display: block;
}

.modal {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow: auto;
  margin: 48px auto;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal-head,
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-title,
.drawer-title {
  font-size: 18px;
  font-weight: 800;
}

.modal-body,
.drawer-body {
  padding: 18px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.drawer {
  width: min(520px, 100vw);
  height: 100vh;
  margin-left: auto;
  background: white;
  box-shadow: var(--shadow);
}

.detail-list {
  display: grid;
  gap: 10px;
}

.detail-item {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.detail-key {
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #111827;
  color: white;
  padding: 12px 14px;
  border-radius: 8px;
  display: none;
  z-index: 50;
}

.toast.show {
  display: block;
}

.empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

.monitor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.monitor-card {
  padding: 16px;
}

.progress {
  height: 8px;
  background: #eef2f7;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 12px;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--teal);
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    max-height: 320px;
  }

  .stats,
  .dashboard-grid,
  .monitor-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}
