.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.heroLeft {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.backLink {
  font-size: 13.2px;
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}
.backLink:hover {
  color: var(--primary);
}
.title {
  font-size: 24.2px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  letter-spacing: -0.01em;
}
.systemBadge {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.metaRow {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 14.3px;
  color: var(--text-main);
  margin-top: 6px;
}
.metaRow span {
  color: var(--text-main);
  opacity: 0.75;
}
.metaRow strong {
  color: var(--text-main);
  opacity: 1;
  font-weight: 700;
}
.heroStats {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.statPill {
  background: var(--primary-light);
  border: 1px solid rgba(94, 114, 228, 0.25);
  border-radius: 12px;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 110px;
}
.statPill b {
  font-size: 24.2px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.statPillDenom {
  font-size: 15.4px;
  font-weight: 600;
  opacity: 0.6;
  margin-left: 2px;
}
.statPill span:last-child {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-main);
  opacity: 0.7;
  margin-top: 6px;
  font-weight: 700;
}

.sidebarAlert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
}
.sidebarAlertBody {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1 1 320px;
  color: var(--text-main);
}
.sidebarAlertBody i {
  font-size: 20px;
  color: #b45309;
  margin-top: 2px;
  flex-shrink: 0;
}
.sidebarAlertBody strong {
  display: block;
  font-size: 14.3px;
  margin-bottom: 4px;
}
.sidebarAlertBody p {
  margin: 0;
  font-size: 13.2px;
  line-height: 1.5;
  color: var(--text-main);
  opacity: 0.85;
}

.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow: hidden;
}
.sectionHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--background);
}
.sectionTitle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15.4px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}
.countBadge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12.1px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lightBtn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13.2px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.15s ease;
}
.lightBtn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}
.lightBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.primaryBtn {
  background: var(--primary);
  color: white;
  border: 1px solid var(--primary);
  font-size: 13.2px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  transition: all 0.15s ease;
}
.primaryBtn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}
.primaryBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.sectionBody {
  padding: 18px;
}
.modGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.modCard {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.modCard:hover {
  border-color: var(--primary);
}
.modHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--background);
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.modHeaderLeft {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.modName {
  font-size: 13.2px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modCount {
  font-size: 12.1px;
  color: var(--text-main);
  opacity: 0.6;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.modQuick {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--primary);
  font-size: 12.1px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.modQuick:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.modQuick:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: transparent;
  color: var(--primary);
  border-color: var(--border);
}
.modBody {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.permRow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s ease;
  min-height: 36px;
}
.permRow:hover {
  background: var(--primary-light);
}
.permRow.disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.permRow.disabled:hover {
  background: transparent;
}
.permRow input[type="checkbox"] {
  margin: 0;
  accent-color: var(--primary);
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}
.permRow input[type="checkbox"]:focus {
  box-shadow: none;
}
.permRow.disabled input {
  cursor: not-allowed;
}
.permLabel {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.permName {
  font-size: 14.3px;
  font-weight: 600;
  color: var(--text-main);
  flex-shrink: 0;
}
.permDesc {
  font-size: 13.2px;
  color: var(--text-main);
  opacity: 0.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.actionChip {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  min-width: 56px;
  text-align: center;
}
.chipCreate {
  background: rgba(22, 163, 74, 0.18);
  color: #14532d;
}
.chipRead {
  background: rgba(37, 99, 235, 0.18);
  color: #1e3a8a;
}
.chipUpdate {
  background: rgba(217, 119, 6, 0.2);
  color: #78350f;
}
.chipDelete {
  background: rgba(220, 38, 38, 0.18);
  color: #7f1d1d;
}
.chipOther {
  background: var(--border);
  color: var(--text-main);
}

.empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}
.empty i {
  font-size: 35.2px;
  opacity: 0.4;
  display: block;
  margin-bottom: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13.2px;
  font-weight: 600;
  margin-bottom: 12px;
}
.toastSuccess {
  background: rgba(34, 197, 94, 0.1);
  color: #15803d;
  border: 1px solid rgba(34, 197, 94, 0.25);
}
.toastError {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
:global(.spin) {
  display: inline-block;
  animation: spin 0.9s linear infinite;
}
