:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --text: #1d2a38;
  --muted: #607286;
  --primary: #0b5cab;
  --primary-light: #e6f2ff;
  --border: #d7e0ea;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft Yahei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: #0a3e70;
  color: #fff;
}

h1 {
  margin: 0;
  font-size: 20px;
}

h2 {
  margin-top: 0;
}

.subtitle {
  margin: 6px 0 0;
  opacity: 0.85;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

select, input, textarea, button {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
}

button {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  cursor: pointer;
}

button:hover {
  filter: brightness(0.95);
}

.ghost-btn {
  background: transparent;
  border-color: #92b4d6;
  color: #eaf2fa;
}

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 75px);
}

.sidebar {
  border-right: 1px solid var(--border);
  background: #f8fbff;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-btn {
  text-align: left;
  background: #fff;
  color: #11385d;
  border-color: #c9d9e8;
}

.nav-btn.active {
  background: var(--primary);
  color: #fff;
}

.content {
  padding: 16px;
}

.tab {
  display: none;
}

.tab.active {
  display: block;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.card p {
  margin: 0;
  color: var(--muted);
}

.card h3 {
  margin: 8px 0 0;
  font-size: 28px;
}

.warning {
  border-color: #f5c2c7;
  background: #fff5f6;
}

.panel {
  margin-top: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.form-grid h3 {
  margin: 0 0 4px;
  grid-column: 1 / -1;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #244261;
}

.full {
  grid-column: 1 / -1;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 8px;
  vertical-align: top;
}

th {
  background: #f4f8fd;
}

.list {
  margin: 0;
  padding-left: 18px;
}

.list li {
  margin: 8px 0;
}

.list .warn {
  color: var(--danger);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.chip {
  background: var(--primary-light);
  border: 1px solid #c8def7;
  border-radius: 999px;
  padding: 6px 10px;
  text-align: center;
  color: #0a4c8a;
}

.inline-actions {
  display: flex;
  gap: 6px;
}

.inline-actions button {
  padding: 4px 8px;
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  min-width: 200px;
  max-width: 420px;
  background: #0f1720;
  color: #fff;
  padding: 10px 12px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.toast.show {
  opacity: 0.95;
}

.overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(7, 24, 44, 0.4);
  z-index: 20;
}

.overlay.show {
  display: flex;
}

.login-card {
  width: 360px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.12);
  padding: 16px;
  display: grid;
  gap: 10px;
}

.dark {
  color: #2f4f70;
}

.role-disabled {
  opacity: 0.55;
  pointer-events: none;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    flex-wrap: wrap;
  }
  .cards, .form-grid, .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
