.overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(10px);
}

.modal {
  width: min(720px, 100%);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.25rem;
  background:
    radial-gradient(circle at top left, rgba(118, 185, 0, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(18, 18, 18, 0.98), rgba(10, 10, 10, 0.98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem 1.4rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.eyebrow {
  margin: 0;
  color: var(--color-primary-light);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.title {
  margin: 0.4rem 0 0;
  color: var(--color-text);
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0.45rem 0 0;
  color: var(--color-text-secondary);
  font-size: 0.92rem;
  line-height: 1.55;
  max-width: 36rem;
}

.closeButton {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text);
  font-size: 1.15rem;
}

.form {
  display: flex;
  flex-direction: column;
}

.error {
  margin: 1.1rem 1.4rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(255, 107, 107, 0.28);
  border-radius: 0.9rem;
  background: rgba(255, 107, 107, 0.1);
  color: #fcb3b3;
  font-size: 0.9rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding: 1.25rem 1.4rem 1.4rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.fieldWide {
  grid-column: 1 / -1;
}

.label {
  color: var(--color-text);
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.input,
.select {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text);
  padding: 0.8rem 0.95rem;
  font-size: 0.95rem;
}

.input:focus,
.select:focus {
  outline: none;
  border-color: rgba(118, 185, 0, 0.32);
  box-shadow: 0 0 0 3px rgba(118, 185, 0, 0.12);
}

.input:disabled,
.select:disabled,
.closeButton:disabled,
.secondaryButton:disabled,
.primaryButton:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.hint {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.permissionsSection {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.03);
}

.permissionsHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.permissionCount {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: rgba(118, 185, 0, 0.12);
  color: var(--color-text);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: normal;
}

.permissionList {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.permissionPill {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(118, 185, 0, 0.22);
  background: rgba(118, 185, 0, 0.08);
  color: var(--color-text);
  font-family: var(--font-mono, 'SFMono-Regular', Consolas, monospace);
  font-size: 0.78rem;
  line-height: 1.2;
}

.emptyState {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 0.86rem;
  line-height: 1.45;
}

.footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.1rem 1.4rem 1.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.secondaryButton,
.primaryButton {
  min-width: 140px;
  padding: 0.75rem 1.15rem;
  border-radius: 0.85rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.secondaryButton {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--color-text);
}

.primaryButton {
  border: none;
  background: var(--color-primary);
  color: #000;
}

@media (max-width: 720px) {
  .overlay {
    padding: 1rem;
  }

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

  .fieldWide {
    grid-column: auto;
  }

  .permissionsSection {
    padding: 0.9rem;
  }

  .footer {
    flex-direction: column-reverse;
  }

  .secondaryButton,
  .primaryButton {
    width: 100%;
  }
}
