:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --line: #d9e2ec;
  --text: #1f2937;
  --muted: #6b7280;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --danger: #dc2626;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
}
.sidebar {
  background: #0f172a;
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.sidebar h2 { margin: 0 0 8px; font-size: 22px; }
.nav-links { display: flex; flex-direction: column; gap: 10px; }
.nav-links a, .linklike {
  display: inline-block;
  text-decoration: none;
  background: rgba(255,255,255,.08);
  color: white;
  padding: 12px 14px;
  border-radius: 10px;
  border: none;
  text-align: left;
  cursor: pointer;
}
.main-panel {
  padding: 28px;
  min-width: 0;
}
.full-width {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card {
  background: var(--panel);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  margin-bottom: 20px;
}
.login-card, .narrow-card { max-width: 480px; width: 100%; }
h1, h2 { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.alert {
  background: #e0f2fe;
  color: #075985;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
}
.stack-form, .inline-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.inline-form { flex-direction: row; flex-wrap: wrap; align-items: end; }
.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 16px;
}
.compact-grid { margin-top: 16px; }
label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}
.full { grid-column: 1 / -1; }
input, textarea, button {
  font: inherit;
}
input, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}
textarea { resize: vertical; }
button, .secondary-btn {
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 11px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button:hover, .secondary-btn:hover { background: var(--brand-dark); }
.secondary-btn {
  background: #475569;
}
.danger { background: var(--danger); }
.action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.top-gap { margin-top: 12px; }
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.import-box {
  margin: 16px 0 20px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #f8fafc;
}
.table-wrap {
  width: 100%;
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}
thead th {
  background: #eff6ff;
  font-size: 13px;
  position: sticky;
  top: 0;
  z-index: 1;
}
th, td {
  border: 1px solid #e5e7eb;
  padding: 10px 8px;
  vertical-align: top;
  text-align: left;
  font-size: 13px;
  line-height: 1.45;
}
.wrap, .long-text {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.records-table th:nth-last-child(1),
.records-table td:nth-last-child(1) {
  min-width: 120px;
}
.actions-col, .actions-cell {
  position: sticky;
  right: 0;
  background: #fff;
}
.actions-col { background: #eff6ff; }
.action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.small-btn {
  padding: 8px 10px;
  font-size: 12px;
}
.sortable button {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}
.sort-indicator { color: var(--muted); font-size: 12px; }
.hidden { display: none; }
.compact-table td:nth-child(5),
.compact-table td:nth-child(6) {
  max-width: 220px;
}
.default-password-tip {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fdba74;
  padding: 10px 12px;
  border-radius: 10px;
  margin: 10px 0 16px;
  font-size: 14px;
  font-weight: 600;
}
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.page-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.tool-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}
.filter-panel {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 16px;
}
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { gap: 16px; }
  .main-panel { padding: 16px; }
  th, td { font-size: 12px; padding: 8px 6px; }
}
